PyFunceble/database.py
def add(self):
        """
        Save the current :code.`PyFunceble.CONFIGURATION['to_test']`
        into the current timestamp.
        """

        if PyFunceble.CONFIGURATION["inactive_database"]:
            # The database subsystem is activated.

            # We get the timestamp to use as index.
            timestamp = str(self._timestamp())

            if (
                "inactive_db" in PyFunceble.INTERN
                and PyFunceble.INTERN["file_to_test"]
                in PyFunceble.INTERN["inactive_db"]
            ):
                # * The file path is not into the database.

                if (
                    timestamp
                    in PyFunceble.INTERN["inactive_db"][
                        PyFunceble.INTERN["file_to_test"]
                    ]
                ):
                    # The timetamp is already into the database related to the file we
                    # are testing.

                    if (
                        PyFunceble.INTERN["to_test"]
                        not in PyFunceble.INTERN["inactive_db"][
                            PyFunceble.INTERN["file_to_test"]
                        ][timestamp]
                    ):
                        # The currently tested element is not into the database related
                        # to the file we are testing.

                        # We append the currently tested element into the database.
                        PyFunceble.INTERN["inactive_db"][
                            PyFunceble.INTERN["file_to_test"]
                        ][timestamp].append(PyFunceble.INTERN["to_test"])
                else:
                    # The timetamp is not into the database related to the file we
                    # are testing.

                    # We append the index and the database element into the databse
                    # related to the file we are testing.
                    PyFunceble.INTERN["inactive_db"][
                        PyFunceble.INTERN["file_to_test"]
                    ].update({timestamp: [PyFunceble.INTERN["to_test"]]})

                if (
                    "to_test"
                    in PyFunceble.INTERN["inactive_db"][
                        PyFunceble.INTERN["file_to_test"]
                    ]
                    and PyFunceble.INTERN["to_test"]
                    in PyFunceble.INTERN["inactive_db"][
                        PyFunceble.INTERN["file_to_test"]
                    ]["to_test"]
                ):
                    # * The `to_test` index is into the database related to the file we
                    #   are testing.
                    # and
                    # * The element we are testing is into the `to_test` index related to
                    #   the file we are testing.

                    # We remove the element from the list of element to test.
                    PyFunceble.INTERN["inactive_db"][PyFunceble.INTERN["file_to_test"]][
                        "to_test"
                    ].remove(PyFunceble.INTERN["to_test"])
            else:
                # The file path is not into the database.

                # We initiate the file path and its content into the database.
                PyFunceble.INTERN["inactive_db"] = {
                    PyFunceble.INTERN["file_to_test"]: {
                        timestamp: [PyFunceble.INTERN["to_test"]]
                    }
                }

            # And we save the data into the database.
            self._backup()
def add(self):
        """
        Save the current :code.`PyFunceble.CONFIGURATION['to_test']`
        into the current timestamp.
        """

        if PyFunceble.CONFIGURATION["inactive_database"]:
            # The database subsystem is activated.

            # We get the timestamp to use as index.
            timestamp = str(self._timestamp())

            if (
                "inactive_db" in PyFunceble.INTERN
                and PyFunceble.INTERN["file_to_test"]
                in PyFunceble.INTERN["inactive_db"]
            ):
                # * The file path is not into the database.

                if (
                    timestamp
                    in PyFunceble.INTERN["inactive_db"][
                        PyFunceble.INTERN["file_to_test"]
                    ]
                ):
                    # The timetamp is already into the database related to the file we
                    # are testing.

                    if (
                        PyFunceble.INTERN["to_test"]
                        not in PyFunceble.INTERN["inactive_db"][
                            PyFunceble.INTERN["file_to_test"]
                        ][timestamp]
                    ):
                        # The currently tested element is not into the database related
                        # to the file we are testing.

                        # We append the currently tested element into the database.
                        PyFunceble.INTERN["inactive_db"][
                            PyFunceble.INTERN["file_to_test"]
                        ][timestamp].append(PyFunceble.INTERN["to_test"])
                else:
                    # The timetamp is not into the database related to the file we
                    # are testing.

                    # We append the index and the database element into the databse
                    # related to the file we are testing.
                    PyFunceble.INTERN["inactive_db"][
                        PyFunceble.INTERN["file_to_test"]
                    ].update({timestamp: [PyFunceble.INTERN["to_test"]]})

                if (
                    "to_test"
                    in PyFunceble.INTERN["inactive_db"][
                        PyFunceble.INTERN["file_to_test"]
                    ]
                    and PyFunceble.INTERN["to_test"]
                    in PyFunceble.INTERN["inactive_db"][
                        PyFunceble.INTERN["file_to_test"]
                    ]["to_test"]
                ):
                    # * The `to_test` index is into the database related to the file we
                    #   are testing.
                    # and
                    # * The element we are testing is into the `to_test` index related to
                    #   the file we are testing.

                    # We remove the element from the list of element to test.
                    PyFunceble.INTERN["inactive_db"][PyFunceble.INTERN["file_to_test"]][
                        "to_test"
                    ].remove(PyFunceble.INTERN["to_test"])
            else:
                # The file path is not into the database.

                # We initiate the file path and its content into the database.
                PyFunceble.INTERN["inactive_db"] = {
                    PyFunceble.INTERN["file_to_test"]: {
                        timestamp: [PyFunceble.INTERN["to_test"]]
                    }
                }

            # And we save the data into the database.
            self._backup()
def add ( self ) : if PyFunceble . CONFIGURATION [ "inactive_database" ] : # The database subsystem is activated. # We get the timestamp to use as index. timestamp = str ( self . _timestamp ( ) ) if ( "inactive_db" in PyFunceble . INTERN and PyFunceble . INTERN [ "file_to_test" ] in PyFunceble . INTERN [ "inactive_db" ] ) : # * The file path is not into the database. if ( timestamp in PyFunceble . INTERN [ "inactive_db" ] [ PyFunceble . INTERN [ "file_to_test" ] ] ) : # The timetamp is already into the database related to the file we # are testing. if ( PyFunceble . INTERN [ "to_test" ] not in PyFunceble . INTERN [ "inactive_db" ] [ PyFunceble . INTERN [ "file_to_test" ] ] [ timestamp ] ) : # The currently tested element is not into the database related # to the file we are testing. # We append the currently tested element into the database. PyFunceble . INTERN [ "inactive_db" ] [ PyFunceble . INTERN [ "file_to_test" ] ] [ timestamp ] . append ( PyFunceble . INTERN [ "to_test" ] ) else : # The timetamp is not into the database related to the file we # are testing. # We append the index and the database element into the databse # related to the file we are testing. PyFunceble . INTERN [ "inactive_db" ] [ PyFunceble . INTERN [ "file_to_test" ] ] . update ( { timestamp : [ PyFunceble . INTERN [ "to_test" ] ] } ) if ( "to_test" in PyFunceble . INTERN [ "inactive_db" ] [ PyFunceble . INTERN [ "file_to_test" ] ] and PyFunceble . INTERN [ "to_test" ] in PyFunceble . INTERN [ "inactive_db" ] [ PyFunceble . INTERN [ "file_to_test" ] ] [ "to_test" ] ) : # * The `to_test` index is into the database related to the file we #   are testing. # and # * The element we are testing is into the `to_test` index related to #   the file we are testing. # We remove the element from the list of element to test. PyFunceble . INTERN [ "inactive_db" ] [ PyFunceble . INTERN [ "file_to_test" ] ] [ "to_test" ] . remove ( PyFunceble . INTERN [ "to_test" ] ) else : # The file path is not into the database. # We initiate the file path and its content into the database. PyFunceble . INTERN [ "inactive_db" ] = { PyFunceble . INTERN [ "file_to_test" ] : { timestamp : [ PyFunceble . INTERN [ "to_test" ] ] } } # And we save the data into the database. self . _backup ( )
Save the current :code.`PyFunceble.CONFIGURATION['to_test']`
        into the current timestamp.
Save the current : code . PyFunceble . CONFIGURATION [ to_test ] into the current timestamp .