<commit_before>from ordered_set import OrderedSet

class Column(object):
    """Identifies a single named column of data, either by column name only or qualified by the
    table name on which it appears. Columns are case-insensitive.
    """

    def __init__(self, name, qualifiers=None):
        name_parts = name.split('.')
        self.name = name_parts[-1]
        self.qualifiers = OrderedSet(qualifiers or [])
        if len(name_parts) > 1:
            self.qualifiers.add(name_parts[0].lower())

    @property
    def name(self):
        return self._name

    @name.setter
    def name(self, value):
        self._cased_name = value
        self._name = value.lower()

    @property
    def qualifiers(self):
        return self._qualifiers

    @qualifiers.setter
    def qualifiers(self, value):
        self._qualifiers = OrderedSet([qual.lower() for qual in value])
     
    def __eq__(self, other):
        if type(other) is type(self):
            return (
                self.name == other.name and
                ((other.qualifiers & self.qualifiers) or
                    not other.qualifiers or
                    not self.qualifiers
                )
            )
        return False

    def __ne__(self, other):
        return not self == other

    def __hash__(self):
        return hash(self.name)

    def __str__(self):
        return self._cased_name

    def __repr__(self):
        if self.qualifiers:
            return '.'.join([str(sorted(self.qualifiers)), self.name])
        return self.name<commit_msg>Clarify column string representation<commit_after>from ordered_set import OrderedSet

class Column(object):
    """Identifies a single named column of data, either by column name only or qualified by the
    table name on which it appears. Columns are case-insensitive.
    """

    def __init__(self, name, qualifiers=None):
        name_parts = name.split('.')
        self.name = name_parts[-1]
        self.qualifiers = OrderedSet(qualifiers or [])
        if len(name_parts) > 1:
            self.qualifiers.add(name_parts[0].lower())

    @property
    def name(self):
        return self._name

    @name.setter
    def name(self, value):
        self._cased_name = value
        self._name = value.lower()

    @property
    def qualifiers(self):
        return self._qualifiers

    @qualifiers.setter
    def qualifiers(self, value):
        self._qualifiers = OrderedSet([qual.lower() for qual in value])
     
    def __eq__(self, other):
        if type(other) is type(self):
            return (
                self.name == other.name and
                ((other.qualifiers & self.qualifiers) or
                    not other.qualifiers or
                    not self.qualifiers
                )
            )
        return False

    def __ne__(self, other):
        return not self == other

    def __hash__(self):
        return hash(self.name)

    def __str__(self):
        return self._cased_name

    def __repr__(self):
        if self.qualifiers:
            return '.'.join([qualifiers_to_str(self.qualifiers), self.name])
        return self.name

def qualifiers_to_str(qualifiers):
    if len(qualifiers) == 0:
        return ''
    elif len(qualifiers) == 1:
        return qualifiers[0]
    else:
        return '(' + '|'.join(sorted(qualifiers)) + ')'
{'fraction_non_alphanumeric': 0.10077984403119376, 'fraction_numerical': 0.0026994601079784043, 'mean_word_length': 2.051235132662397, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5853671', 'n_tokens_mistral': 971, 'n_tokens_neox': 940, 'n_words': 254}