PyFunceble/publicsuffix.py
def _extensions(self, line):
        """
        Extract the extension from the given line.

        :param line: The line from the official public suffix repository.
        :type line: str
        """

        # We strip the parsed line.
        line = line.strip()

        if not line.startswith("//") and "." in line:
            # * The parsed line is not a commented line.
            # and
            # * There is a point in the parsed line.
            line = line.encode("idna").decode("utf-8")

            if line.startswith("*."):
                # The parsed line start with `*.`.

                # We remove the first two characters.
                line = line[2:]

            # We we split the points and we get the last element.
            # Explanation: The idea behind this action is to
            # always get the extension.
            extension = line.split(".")[-1]

            if extension in self.public_suffix_db:
                # The extension is alrady in our database.

                # We update the content of the 1st level TDL with
                # the content of the suffix.
                # In between, we format so that we ensure that there is no
                # duplicate in the database index content.
                self.public_suffix_db[extension] = List(
                    self.public_suffix_db[extension] + [line]
                ).format()
            else:
                # The extension is not already in our database.

                # We append the currently formatted extension and the line content.
                self.public_suffix_db.update({extension: [line]})
def _extensions(self, line):
        # We strip the parsed line.
        line = line.strip()

        if not line.startswith("//") and "." in line:
            # * The parsed line is not a commented line.
            # and
            # * There is a point in the parsed line.
            line = line.encode("idna").decode("utf-8")

            if line.startswith("*."):
                # The parsed line start with `*.`.

                # We remove the first two characters.
                line = line[2:]

            # We we split the points and we get the last element.
            # Explanation: The idea behind this action is to
            # always get the extension.
            extension = line.split(".")[-1]

            if extension in self.public_suffix_db:
                # The extension is alrady in our database.

                # We update the content of the 1st level TDL with
                # the content of the suffix.
                # In between, we format so that we ensure that there is no
                # duplicate in the database index content.
                self.public_suffix_db[extension] = List(
                    self.public_suffix_db[extension] + [line]
                ).format()
            else:
                # The extension is not already in our database.

                # We append the currently formatted extension and the line content.
                self.public_suffix_db.update({extension: [line]})
def _extensions ( self , line ) : # We strip the parsed line. line = line . strip ( ) if not line . startswith ( "//" ) and "." in line : # * The parsed line is not a commented line. # and # * There is a point in the parsed line. line = line . encode ( "idna" ) . decode ( "utf-8" ) if line . startswith ( "*." ) : # The parsed line start with `*.`. # We remove the first two characters. line = line [ 2 : ] # We we split the points and we get the last element. # Explanation: The idea behind this action is to # always get the extension. extension = line . split ( "." ) [ - 1 ] if extension in self . public_suffix_db : # The extension is alrady in our database. # We update the content of the 1st level TDL with # the content of the suffix. # In between, we format so that we ensure that there is no # duplicate in the database index content. self . public_suffix_db [ extension ] = List ( self . public_suffix_db [ extension ] + [ line ] ) . format ( ) else : # The extension is not already in our database. # We append the currently formatted extension and the line content. self . public_suffix_db . update ( { extension : [ line ] } )
Extract the extension from the given line.

        :param line: The line from the official public suffix repository.
        :type line: str
Extract the extension from the given line .