<commit_before>from django.conf import settings

from restclients_core.dao import DAO
from restclients_core.dao import MockDAO

from os.path import abspath, dirname
import os
import json


class MDOT(DAO):
    """
    DAO with methods for getting uwresources from the mdot-rest API.
    """
    def get_resources(self, **kwargs):
        url = "/api/v1/uwresources/"
        i = kwargs.__len__()
        if kwargs:
            url += "?"
            for key, value in kwargs.items():
                url += "{0}={1}".format(key, value)
                if i > 1:
                    url += "&"
                i = i - 1

        response = self.getURL(url,
                               {'Accept': 'application/json'})
        resources = json.loads(response.data)
        resources = self._python_list_to_resources_model_list(resources)
        return resources
<commit_msg>uses settings from commonconf<commit_after>from commonconf import settings

from restclients_core.dao import DAO

from os.path import abspath, dirname
import os
import json


class MDOT(DAO):
    """
    DAO with methods for getting uwresources from the mdot-rest API.
    Uses Mock DAO with following configuration:
    RESTCLIENTS_MDOT_DAO_CLASS='Mock'
    """
    def get_resources(self, **kwargs):
        url = "/api/v1/uwresources/"
        i = kwargs.__len__()
        if kwargs:
            url += "?"
            for key, value in kwargs.items():
                url += "{0}={1}".format(key, value)
                if i > 1:
                    url += "&"
                i = i - 1

        response = self.getURL(url,
                               {'Accept': 'application/json'})
        resources = json.loads(response.data)
        resources = self._python_list_to_resources_model_list(resources)
        return resources

{'fraction_non_alphanumeric': 0.10165745856353592, 'fraction_numerical': 0.0055248618784530384, 'mean_word_length': 1.9351701782820097, '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': '4128483', 'n_tokens_mistral': 527, 'n_tokens_neox': 523, 'n_words': 142}