PyFunceble/database.py
def _merge(self):
        """
        Merge the real database with the older one which
        has already been set into :code:`PyFunceble.INTERN["inactive_db"]`
        """

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

            # We get the content of the database.
            database_content = Dict().from_json(File(self.inactive_db_path).read())

            # We get the database top keys.
            database_top_keys = database_content.keys()

            for database_top_key in database_top_keys:
                # We loop through the list of database top keys.

                if database_top_key not in PyFunceble.INTERN["inactive_db"]:
                    # The currently read top key is not already into the database.

                    # We initiate the currently read key with the same key from
                    # our database file.
                    PyFunceble.INTERN["inactive_db"][
                        database_top_key
                    ] = database_content[database_top_key]
                else:
                    # The currently read top key is already into the database.

                    # We get the list of lower indexes.
                    database_low_keys = database_content[database_top_key].keys()

                    for database_low_key in database_low_keys:
                        # We loop through the lower keys.

                        if (
                            database_low_key
                            not in PyFunceble.INTERN["inactive_db"][database_top_key]
                        ):  # pragma: no cover
                            # The lower key is not already into the database.

                            # We initiate the currently read low and top key with the
                            # same combinaison from our database file.
                            PyFunceble.INTERN["inactive_db"][database_top_key][
                                database_low_key
                            ] = database_content[database_top_key][database_low_key]
                        else:
                            # The lower key is not already into the database.

                            # We exted the currently read low and top key combinaison
                            # with the same combinaison from our database file.
                            PyFunceble.INTERN["inactive_db"][database_top_key][
                                database_low_key
                            ].extend(
                                database_content[database_top_key][database_low_key]
                            )

                            # And we format the list of element to ensure that there is no
                            # duplicate into the database content.
                            PyFunceble.INTERN["inactive_db"][database_top_key][
                                database_low_key
                            ] = List(
                                PyFunceble.INTERN["inactive_db"][database_top_key][
                                    database_low_key
                                ]
                            ).format()
def _merge(self):
        """
        Merge the real database with the older one which
        has already been set into :code:`PyFunceble.INTERN["inactive_db"]`
        """

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

            # We get the content of the database.
            database_content = Dict().from_json(File(self.inactive_db_path).read())

            # We get the database top keys.
            database_top_keys = database_content.keys()

            for database_top_key in database_top_keys:
                # We loop through the list of database top keys.

                if database_top_key not in PyFunceble.INTERN["inactive_db"]:
                    # The currently read top key is not already into the database.

                    # We initiate the currently read key with the same key from
                    # our database file.
                    PyFunceble.INTERN["inactive_db"][
                        database_top_key
                    ] = database_content[database_top_key]
                else:
                    # The currently read top key is already into the database.

                    # We get the list of lower indexes.
                    database_low_keys = database_content[database_top_key].keys()

                    for database_low_key in database_low_keys:
                        # We loop through the lower keys.

                        if (
                            database_low_key
                            not in PyFunceble.INTERN["inactive_db"][database_top_key]
                        ):  # pragma: no cover
                            # The lower key is not already into the database.

                            # We initiate the currently read low and top key with the
                            # same combinaison from our database file.
                            PyFunceble.INTERN["inactive_db"][database_top_key][
                                database_low_key
                            ] = database_content[database_top_key][database_low_key]
                        else:
                            # The lower key is not already into the database.

                            # We exted the currently read low and top key combinaison
                            # with the same combinaison from our database file.
                            PyFunceble.INTERN["inactive_db"][database_top_key][
                                database_low_key
                            ].extend(
                                database_content[database_top_key][database_low_key]
                            )

                            # And we format the list of element to ensure that there is no
                            # duplicate into the database content.
                            PyFunceble.INTERN["inactive_db"][database_top_key][
                                database_low_key
                            ] = List(
                                PyFunceble.INTERN["inactive_db"][database_top_key][
                                    database_low_key
                                ]
                            ).format()
def _merge ( self ) : if PyFunceble . CONFIGURATION [ "inactive_database" ] : # The database subsystem is activated. # We get the content of the database. database_content = Dict ( ) . from_json ( File ( self . inactive_db_path ) . read ( ) ) # We get the database top keys. database_top_keys = database_content . keys ( ) for database_top_key in database_top_keys : # We loop through the list of database top keys. if database_top_key not in PyFunceble . INTERN [ "inactive_db" ] : # The currently read top key is not already into the database. # We initiate the currently read key with the same key from # our database file. PyFunceble . INTERN [ "inactive_db" ] [ database_top_key ] = database_content [ database_top_key ] else : # The currently read top key is already into the database. # We get the list of lower indexes. database_low_keys = database_content [ database_top_key ] . keys ( ) for database_low_key in database_low_keys : # We loop through the lower keys. if ( database_low_key not in PyFunceble . INTERN [ "inactive_db" ] [ database_top_key ] ) : # pragma: no cover # The lower key is not already into the database. # We initiate the currently read low and top key with the # same combinaison from our database file. PyFunceble . INTERN [ "inactive_db" ] [ database_top_key ] [ database_low_key ] = database_content [ database_top_key ] [ database_low_key ] else : # The lower key is not already into the database. # We exted the currently read low and top key combinaison # with the same combinaison from our database file. PyFunceble . INTERN [ "inactive_db" ] [ database_top_key ] [ database_low_key ] . extend ( database_content [ database_top_key ] [ database_low_key ] ) # And we format the list of element to ensure that there is no # duplicate into the database content. PyFunceble . INTERN [ "inactive_db" ] [ database_top_key ] [ database_low_key ] = List ( PyFunceble . INTERN [ "inactive_db" ] [ database_top_key ] [ database_low_key ] ) . format ( )
Merge the real database with the older one which
        has already been set into :code:`PyFunceble.INTERN["inactive_db"]`
Merge the real database with the older one which has already been set into : code : PyFunceble . INTERN [ inactive_db ]