<commit_before>from django.conf import settings

from main.utils_species import SpeciesFacade

SOME_SPECIES_NAME_NAME_ID_MAP = {
    "Canis lupus subsp. familiaris": 30883,
    "Canis lupus": 25454,
    "Vespadelus douglasorum": 24204
}

REST_FRAMEWORK_TEST_SETTINGS = settings.REST_FRAMEWORK
REST_FRAMEWORK_TEST_SETTINGS['DEFAULT_AUTHENTICATION_CLASSES'] += [
    'rest_framework.authentication.SessionAuthentication',
]


class LightSpeciesFacade(SpeciesFacade):
    def name_id_by_species_name(self):
        """
        :return: a dict where key is species_name and the value is name_id
        """
        return SOME_SPECIES_NAME_NAME_ID_MAP

    def get_all_species(self, properties=None):
        """
        :param properties: a sequence of Property, e.g [PROPERTY_SPECIES_NAME, PROPERTY_NAME_ID] or None for all
        attributes
        :return: Return a list of species properties (see structure above) but with only the specified attributes.
        NOTE: limiting the number of properties speed-up the request.
        """
        return []


def set_site(record_data, dataset, site):
    """
    Update the 'Site' column value with the given site code
    :param record_data:
    :param dataset:<commit_msg>Added check  for session authentication before adding it to the settings<commit_after>from django.conf import settings

from main.utils_species import SpeciesFacade

SOME_SPECIES_NAME_NAME_ID_MAP = {
    "Canis lupus subsp. familiaris": 30883,
    "Canis lupus": 25454,
    "Vespadelus douglasorum": 24204
}

REST_FRAMEWORK_TEST_SETTINGS = settings.REST_FRAMEWORK
if 'rest_framework.authentication.SessionAuthentication' \
        not in REST_FRAMEWORK_TEST_SETTINGS['DEFAULT_AUTHENTICATION_CLASSES']:
    REST_FRAMEWORK_TEST_SETTINGS['DEFAULT_AUTHENTICATION_CLASSES'] \
        .append('rest_framework.authentication.SessionAuthentication')


class LightSpeciesFacade(SpeciesFacade):
    def name_id_by_species_name(self):
        """
        :return: a dict where key is species_name and the value is name_id
        """
        return SOME_SPECIES_NAME_NAME_ID_MAP

    def get_all_species(self, properties=None):
        """
        :param properties: a sequence of Property, e.g [PROPERTY_SPECIES_NAME, PROPERTY_NAME_ID] or None for all
        attributes
        :return: Return a list of species properties (see structure above) but with only the specified attributes.
        NOTE: limiting the number of properties speed-up the request.
        """
        return []


def set_site(record_data, dataset, site):
    """
    Update the 'Site' column value with the given site code
    :param record_data:
    :param dataset:
{'fraction_non_alphanumeric': 0.07196684250188395, 'fraction_numerical': 0.011303692539562924, 'mean_word_length': 3.749552772808587, 'pattern_counts': {'":': 6, '<': 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': '5920625', 'n_tokens_mistral': 825, 'n_tokens_neox': 772, 'n_words': 220}