<commit_before># -*- coding: utf-8 -*-
"""Types for dealing with different LDAP attributes."""

from __future__ import unicode_literals
from __future__ import print_function

import copy
import re
import sys

from ldapom import compat

if sys.version_info[0] >= 3: # Python 3
    unicode = str

OID_REGEX = re.compile(r"\( ([0-9\.]+) .* \)")
SINGLE_VALUE_REGEX = re.compile(r"\(.* SINGLE-VALUE .*\)")
ONE_NAME_REGEX = re.compile(r"\(.* NAME \'([^']+)\' .*\)")
MULTIPLE_NAMES_REGEX = re.compile(r"\(.* NAME \( ([^)]+) \) .*\)")
SYNTAX_REGEX = re.compile(r"\(.* SYNTAX ([0-9\.]+)({\d+})? .*\)")
DESC_REGEX = re.compile(r"\(.* DESC \'([^']+)\' .*\)")
SUP_REGEX = re.compile(r"\(.* SUP (\w+) .*\)")


class LDAPAttributeBase(compat.UnicodeMixin, object):
    """Holds an LDAP attribute and its values."""

    def __init__(self, name):
        """Creates a new attribute.

        :param name: The name for the attribute.
        :param name: str
        """
        self.name = name
        self._values = set()

    def __unicode__(self):
        if len(self._values) == 1:
            values_string = unicode(next(iter(self._values)))
        else:
            values_string = unicode(", ".join(map(unicode, self._values)))
        return "{name}: {values}".format(name=self.name, values=values_string)

    def __repr__(self):
        return "<LDAPAttribute " + self.name + ">"

    def __eq__(self, other):
        return self.name == other.name and self._values == other._values

    def __ne__(self, other):
        return not self.__eq__(other)

    def __hash__(self):
        return hash((self.name, frozenset(self._values)))

    def __deepcopy__(self, memo):
        c = type(self)(self.name)
        c._values = copy.deepcopy(self._values)
        return c


class SingleValueAttributeMixin(object):
    single_value = True
    multi_value = False

    def _get_value(self):<commit_msg>Make hash function in LDAPAttribute dependent only on attribute name<commit_after># -*- coding: utf-8 -*-
"""Types for dealing with different LDAP attributes."""

from __future__ import unicode_literals
from __future__ import print_function

import copy
import re
import sys

from ldapom import compat

if sys.version_info[0] >= 3: # Python 3
    unicode = str

OID_REGEX = re.compile(r"\( ([0-9\.]+) .* \)")
SINGLE_VALUE_REGEX = re.compile(r"\(.* SINGLE-VALUE .*\)")
ONE_NAME_REGEX = re.compile(r"\(.* NAME \'([^']+)\' .*\)")
MULTIPLE_NAMES_REGEX = re.compile(r"\(.* NAME \( ([^)]+) \) .*\)")
SYNTAX_REGEX = re.compile(r"\(.* SYNTAX ([0-9\.]+)({\d+})? .*\)")
DESC_REGEX = re.compile(r"\(.* DESC \'([^']+)\' .*\)")
SUP_REGEX = re.compile(r"\(.* SUP (\w+) .*\)")


class LDAPAttributeBase(compat.UnicodeMixin, object):
    """Holds an LDAP attribute and its values."""

    def __init__(self, name):
        """Creates a new attribute.

        :param name: The name for the attribute.
        :param name: str
        """
        self.name = name
        self._values = set()

    def __unicode__(self):
        if len(self._values) == 1:
            values_string = unicode(next(iter(self._values)))
        else:
            values_string = unicode(", ".join(map(unicode, self._values)))
        return "{name}: {values}".format(name=self.name, values=values_string)

    def __repr__(self):
        return "<LDAPAttribute " + self.name + ">"

    def __eq__(self, other):
        return self.name == other.name and self._values == other._values

    def __ne__(self, other):
        return not self.__eq__(other)

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

    def __deepcopy__(self, memo):
        c = type(self)(self.name)
        c._values = copy.deepcopy(self._values)
        return c


class SingleValueAttributeMixin(object):
    single_value = True
    multi_value = False

    def _get_value(self):
{'fraction_non_alphanumeric': 0.1712938711367208, 'fraction_numerical': 0.004714510214772132, 'mean_word_length': 2.9049079754601226, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6050629', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1261, 'n_words': 301}