# Link class
class Link:

    ## Constructor ##
    def __init__(self, text = "None", url = "None", status_code = 000):    # Not the keyword 'None' so it will still print something
        # Dictionary of URL-related content
        self.text = text
        self.url  = url
        self.status_code = status_code

    # Trims the inside of a string (removing extra whitespace between words)
    def trim_inner(self, text):
        return " ".join( [string.strip() for string in text.split()] )   # Separate the indiv. words and trim them individually


    ## OVERLOADS ##

    # String representation of the 'Link' class
    def __str__(self):
        # Format: status code, hyperlinked text, then url (CSV)
        text = self.trim_inner(self.text)      # Trim internal whitespace;
        if not text:                                   # If the string is blank, 
            text = "N/A"                               # Give it some text

        return f"{self.status_code}, {text}, {self.url}"

    # Relational Operators, compared by status code for sorting
    
    # > (less than)
    def __lt__(self, other):
        return self.status_code < other.status_code
    
    # >= (less than or equal to)
    def __le__(self, other):
        return self.status_code <= other.status_code
    
    # == (is equal to)
    def __eq__(self, other):
        return self.staus_code == other.status_code
    
    # != (is not equal to)
    def __ne__(self, other):
        return self.status_code != other.status_code
    
    # < (greater than)
    def __gt__(self, other):
        return self.status_code > other.status_code
    
    # <= (greater than or equal to)
    def __ge__(self, other):
        return self.status_code >= other.status_code

# End of Link class

# Link class
class Link:

    ## Constructor ##
    def __init__(self, text = "None", url = "None", status_code = 000):    # Not the keyword 'None' so it will still print something
        # Dictionary of URL-related content
        self.text = text
        self.url  = url
        self.status_code = status_code

    # Trims the inside of a string (removing extra whitespace between words)
    def trim_inner(self, text):
        return " ".join( [string.strip() for string in text.split()] )   # Separate the indiv. words and trim them individually


    ## OVERLOADS ##

    # String representation of the 'Link' class
    def __str__(self):
        # Format: status code, hyperlinked text, then url (CSV)
        text = self.trim_inner(self.text)      # Trim internal whitespace;
        if not text:                                   # If the string is blank, 
            text = "N/A"                               # Give it some text

        return f"{self.status_code}, {text}, {self.url}"

    # Relational Operators, compared by status code for sorting
    
    # > (less than)
    def __lt__(self, other):
        return self.status_code < other.status_code
    
    # >= (less than or equal to)
    def __le__(self, other):
        return self.status_code <= other.status_code
    
    # == (is equal to)
    def __eq__(self, other):
        return self.staus_code == other.status_code
    
    # != (is not equal to)
    def __ne__(self, other):
        return self.status_code != other.status_code
    
    # < (greater than)
    def __gt__(self, other):
        return self.status_code > other.status_code
    
    # <= (greater than or equal to)
    def __ge__(self, other):
        return self.status_code >= other.status_code

# End of Link class

# Link class ## Constructor ## # Not the keyword 'None' so it will still print something # Dictionary of URL-related content # Trims the inside of a string (removing extra whitespace between words) # Separate the indiv. words and trim them individually ## OVERLOADS ## # String representation of the 'Link' class # Format: status code, hyperlinked text, then url (CSV) # Trim internal whitespace; # If the string is blank, # Give it some text # Relational Operators, compared by status code for sorting # > (less than) # >= (less than or equal to) # == (is equal to) # != (is not equal to) # < (greater than) # <= (greater than or equal to) # End of Link class