PyFunceble/core.py
def file(self):
        """
        Manage the case that need to test each domain of a given file path.

        .. note::
            1 domain per line.
        """

        # We get, format, filter, clean the list to test.
        list_to_test = self._file_list_to_test_filtering()

        if PyFunceble.CONFIGURATION["idna_conversion"]:
            # We have to convert domains to idna.

            # We convert if we need to convert.
            list_to_test = domain2idna(list_to_test)

            if PyFunceble.CONFIGURATION["hierarchical_sorting"]:
                # The hierarchical sorting is desired by the user.

                # We format the list.
                list_to_test = List(list_to_test).custom_format(Sort.hierarchical)
            else:
                # The hierarchical sorting is not desired by the user.

                # We format the list.
                list_to_test = List(list_to_test).custom_format(Sort.standard)

        # We initiate a local variable which will save the current state of the list.
        not_filtered = list_to_test

        try:
            # We remove the element which are in the database from the
            # current list to test.
            list_to_test = List(
                list(
                    set(
                        list_to_test[PyFunceble.INTERN["counter"]["number"]["tested"] :]
                    )
                    - set(PyFunceble.INTERN["flatten_inactive_db"])
                )
            ).format()
            _ = list_to_test[-1]
        except IndexError:
            # Our list to test is the one with the element from the database.
            list_to_test = not_filtered[
                PyFunceble.INTERN["counter"]["number"]["tested"] :
            ]

            # We delete the undesired variable.
            del not_filtered

        if PyFunceble.CONFIGURATION["hierarchical_sorting"]:
            # The hierarchical sorting is desired by the user.

            # We format the list.
            list_to_test = List(list(list_to_test)).custom_format(Sort.hierarchical)

        try:
            # We test each element of the list to test.
            return [self.domain(x, list_to_test[-1]) for x in list_to_test if x]
        except IndexError:
            # We print a message on screen.
            print(PyFunceble.Fore.CYAN + PyFunceble.Style.BRIGHT + "Nothing to test.")
def file(self):
        # We get, format, filter, clean the list to test.
        list_to_test = self._file_list_to_test_filtering()

        if PyFunceble.CONFIGURATION["idna_conversion"]:
            # We have to convert domains to idna.

            # We convert if we need to convert.
            list_to_test = domain2idna(list_to_test)

            if PyFunceble.CONFIGURATION["hierarchical_sorting"]:
                # The hierarchical sorting is desired by the user.

                # We format the list.
                list_to_test = List(list_to_test).custom_format(Sort.hierarchical)
            else:
                # The hierarchical sorting is not desired by the user.

                # We format the list.
                list_to_test = List(list_to_test).custom_format(Sort.standard)

        # We initiate a local variable which will save the current state of the list.
        not_filtered = list_to_test

        try:
            # We remove the element which are in the database from the
            # current list to test.
            list_to_test = List(
                list(
                    set(
                        list_to_test[PyFunceble.INTERN["counter"]["number"]["tested"] :]
                    )
                    - set(PyFunceble.INTERN["flatten_inactive_db"])
                )
            ).format()
            _ = list_to_test[-1]
        except IndexError:
            # Our list to test is the one with the element from the database.
            list_to_test = not_filtered[
                PyFunceble.INTERN["counter"]["number"]["tested"] :
            ]

            # We delete the undesired variable.
            del not_filtered

        if PyFunceble.CONFIGURATION["hierarchical_sorting"]:
            # The hierarchical sorting is desired by the user.

            # We format the list.
            list_to_test = List(list(list_to_test)).custom_format(Sort.hierarchical)

        try:
            # We test each element of the list to test.
            return [self.domain(x, list_to_test[-1]) for x in list_to_test if x]
        except IndexError:
            # We print a message on screen.
            print(PyFunceble.Fore.CYAN + PyFunceble.Style.BRIGHT + "Nothing to test.")
def file ( self ) : # We get, format, filter, clean the list to test. list_to_test = self . _file_list_to_test_filtering ( ) if PyFunceble . CONFIGURATION [ "idna_conversion" ] : # We have to convert domains to idna. # We convert if we need to convert. list_to_test = domain2idna ( list_to_test ) if PyFunceble . CONFIGURATION [ "hierarchical_sorting" ] : # The hierarchical sorting is desired by the user. # We format the list. list_to_test = List ( list_to_test ) . custom_format ( Sort . hierarchical ) else : # The hierarchical sorting is not desired by the user. # We format the list. list_to_test = List ( list_to_test ) . custom_format ( Sort . standard ) # We initiate a local variable which will save the current state of the list. not_filtered = list_to_test try : # We remove the element which are in the database from the # current list to test. list_to_test = List ( list ( set ( list_to_test [ PyFunceble . INTERN [ "counter" ] [ "number" ] [ "tested" ] : ] ) - set ( PyFunceble . INTERN [ "flatten_inactive_db" ] ) ) ) . format ( ) _ = list_to_test [ - 1 ] except IndexError : # Our list to test is the one with the element from the database. list_to_test = not_filtered [ PyFunceble . INTERN [ "counter" ] [ "number" ] [ "tested" ] : ] # We delete the undesired variable. del not_filtered if PyFunceble . CONFIGURATION [ "hierarchical_sorting" ] : # The hierarchical sorting is desired by the user. # We format the list. list_to_test = List ( list ( list_to_test ) ) . custom_format ( Sort . hierarchical ) try : # We test each element of the list to test. return [ self . domain ( x , list_to_test [ - 1 ] ) for x in list_to_test if x ] except IndexError : # We print a message on screen. print ( PyFunceble . Fore . CYAN + PyFunceble . Style . BRIGHT + "Nothing to test." )
Manage the case that need to test each domain of a given file path.

        .. note::
            1 domain per line.
Manage the case that need to test each domain of a given file path .