PyFunceble/mining.py
def _add(self, to_add):
        """
        Add the currently mined information to the
        mined "database".

        :param to_add: The element to add.
        :type to_add: dict
        """

        if PyFunceble.CONFIGURATION["mining"]:
            # The mining is activated.

            if PyFunceble.INTERN["file_to_test"] not in PyFunceble.INTERN["mined"]:
                # Our tested file path is not into our mined database.

                # We initiate it.
                PyFunceble.INTERN["mined"][PyFunceble.INTERN["file_to_test"]] = {}

            for element in to_add:
                # We loop through the element to add.

                if (
                    element
                    in PyFunceble.INTERN["mined"][PyFunceble.INTERN["file_to_test"]]
                ):
                    # The element is already into the tested file path database.

                    # We extent it with our element to add.
                    PyFunceble.INTERN["mined"][PyFunceble.INTERN["file_to_test"]][
                        element
                    ].extend(to_add[element])
                else:
                    # The element is already into the tested file path database.

                    # We initiate it.
                    PyFunceble.INTERN["mined"][PyFunceble.INTERN["file_to_test"]][
                        element
                    ] = to_add[element]

                # We format the added information in order to avoid duplicate.
                PyFunceble.INTERN["mined"][PyFunceble.INTERN["file_to_test"]][
                    element
                ] = List(
                    PyFunceble.INTERN["mined"][PyFunceble.INTERN["file_to_test"]][
                        element
                    ]
                ).format()

            # We backup everything.
            self._backup()
def _add(self, to_add):
        """
        Add the currently mined information to the
        mined "database".

        :param to_add: The element to add.
        :type to_add: dict
        """

        if PyFunceble.CONFIGURATION["mining"]:
            # The mining is activated.

            if PyFunceble.INTERN["file_to_test"] not in PyFunceble.INTERN["mined"]:
                # Our tested file path is not into our mined database.

                # We initiate it.
                PyFunceble.INTERN["mined"][PyFunceble.INTERN["file_to_test"]] = {}

            for element in to_add:
                # We loop through the element to add.

                if (
                    element
                    in PyFunceble.INTERN["mined"][PyFunceble.INTERN["file_to_test"]]
                ):
                    # The element is already into the tested file path database.

                    # We extent it with our element to add.
                    PyFunceble.INTERN["mined"][PyFunceble.INTERN["file_to_test"]][
                        element
                    ].extend(to_add[element])
                else:
                    # The element is already into the tested file path database.

                    # We initiate it.
                    PyFunceble.INTERN["mined"][PyFunceble.INTERN["file_to_test"]][
                        element
                    ] = to_add[element]

                # We format the added information in order to avoid duplicate.
                PyFunceble.INTERN["mined"][PyFunceble.INTERN["file_to_test"]][
                    element
                ] = List(
                    PyFunceble.INTERN["mined"][PyFunceble.INTERN["file_to_test"]][
                        element
                    ]
                ).format()

            # We backup everything.
            self._backup()
Add the currently mined information to the
        mined "database".

        :param to_add: The element to add.
        :type to_add: dict