<commit_before>"""
Proxy User and Role models.

"""
import base64
import hashlib

from django.db.models import Q

from django.contrib.auth.backends import ModelBackend as DjangoModelBackend
# Permission is imported solely so other places can import it from here
from django.contrib.auth.models import (
    User as BaseUser, Group, Permission
)

from django_browserid.auth import BrowserIDBackend as BaseBrowserIDBackend
from preferences import preferences
from registration.models import RegistrationProfile
from registration.signals import user_registered


# monkeypatch the User model to ensure unique email addresses
BaseUser._meta.get_field("email")._unique = True


class User(BaseUser):
    """Proxy for contrib.auth User that adds action methods and roles alias."""
    class Meta:
        proxy = True


    def delete(self, user=None):
        """
        Delete this user.

        We ignore the passed-in user since User is not a MTModel and doesn't
        track created_by / modified_by.
<commit_msg>equality operator to work on User classes<commit_after>"""
Proxy User and Role models.

"""
import base64
import hashlib

from django.db.models import Q

from django.contrib.auth.backends import ModelBackend as DjangoModelBackend
# Permission is imported solely so other places can import it from here
from django.contrib.auth.models import (
    User as BaseUser, Group, Permission
)

from django_browserid.auth import BrowserIDBackend as BaseBrowserIDBackend
from preferences import preferences
from registration.models import RegistrationProfile
from registration.signals import user_registered


# monkeypatch the User model to ensure unique email addresses
BaseUser._meta.get_field("email")._unique = True


class User(BaseUser):
    """Proxy for contrib.auth User that adds action methods and roles alias."""
    class Meta:
        proxy = True

    def __eq__(self, other_user):
        return self.id == other_user.id

    def delete(self, user=None):
        """
        Delete this user.

        We ignore the passed-in user since User is not a MTModel and doesn't
        track created_by / modified_by.

{'fraction_non_alphanumeric': 0.06097560975609756, 'fraction_numerical': 0.001876172607879925, 'mean_word_length': 3.8698630136986303, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7218064', 'n_tokens_mistral': 560, 'n_tokens_neox': 535, 'n_words': 228}