<commit_before>import bcrypt
from django.contrib.auth.models import User
from django.conf import settings


try:
    rounds = settings.BCRYPT_ROUNDS
except AttributeError:
    rounds = 12

_check_password = User.check_password

def bcrypt_check_password(self, raw_password):
    if self.password.startswith('bc$'):
        salt_and_hash = self.password[3:]
        return bcrypt.hashpw(raw_password, salt_and_hash) == salt_and_hash
    return _check_password(self, raw_password)

def bcrypt_set_password(self, raw_password):
    salt = bcrypt.gensalt(rounds)
    self.password = 'bc$' + bcrypt.hashpw(raw_password, salt)

User.check_password = <PASSWORD>check_password
User.set_password = <PASSWORD>
<commit_msg>Make the default setting retrieval more elegant.<commit_after>import bcrypt
from django.contrib.auth.models import User
from django.conf import settings


rounds = getattr(settings, "BCRYPT_ROUNDS", 12)
_check_password = User.check_password

def bcrypt_check_password(self, raw_password):
    if self.password.startswith('bc$'):
        salt_and_hash = self.password[3:]
        return bcrypt.hashpw(raw_password, salt_and_hash) == salt_and_hash
    return _check_password(self, raw_password)

def bcrypt_set_password(self, raw_password):
    salt = bcrypt.gensalt(rounds)
    self.password = 'bc$' + bcrypt.hashpw(raw_password, salt)

User.check_password = <PASSWORD>
User.set_password = <PASSWORD>

{'fraction_non_alphanumeric': 0.09560906515580736, 'fraction_numerical': 0.00424929178470255, 'mean_word_length': 5.197368421052632, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6401867', 'n_tokens_mistral': 468, 'n_tokens_neox': 451, 'n_words': 95}