<commit_before>"""scholarometer.py - single file Python module for accessing scholarometer.

Note that this module is designed and tested in Python3. No effort is currently
made to support Python 2
"""

# pylama:ignore=E128,E501

# TODO: rest of API

import logging
from urllib.parse import urlunparse, urljoin, quote

import requests  # External dep
from defusedxml.ElementTree import fromstring as xmlparse


def _log():
    return logging.getLogger('scholarometer')


class Config(object):
    """An instance of this class is an imuutable configuration for API call.

    Currently only our default instance makes sense, so you can just ignore
    this class.
    """

    DEF_SCHEME = 'http'
    DEF_SERVER = 'scholarometer.indiana.edu'
    DEF_ROOT = '/api/'

    def __init__(self, scheme=None, server=None, root=None):
        """Set up the immutable config."""
        self.scheme = scheme or Config.DEF_SCHEME
        self.server = server or Config.DEF_SERVER
        self.root = root or Config.DEF_ROOT
        self.session = requests.Session()

    def _get_url(self, path, scheme=None, server=None, root=None):
        baseurl = urlunparse((
            scheme or self.scheme,<commit_msg>spelling typo fix in comments<commit_after>"""scholarometer.py - single file Python module for accessing scholarometer.

Note that this module is designed and tested in Python3. No effort is currently
made to support Python 2
"""

# pylama:ignore=E128,E501

# TODO: rest of API

import logging
from urllib.parse import urlunparse, urljoin, quote

import requests  # External dep
from defusedxml.ElementTree import fromstring as xmlparse


def _log():
    return logging.getLogger('scholarometer')


class Config(object):
    """An instance of this class is an immutable configuration for API call.

    Currently only our default instance makes sense, so you can just ignore
    this class.
    """

    DEF_SCHEME = 'http'
    DEF_SERVER = 'scholarometer.indiana.edu'
    DEF_ROOT = '/api/'

    def __init__(self, scheme=None, server=None, root=None):
        """Set up the immutable config."""
        self.scheme = scheme or Config.DEF_SCHEME
        self.server = server or Config.DEF_SERVER
        self.root = root or Config.DEF_ROOT
        self.session = requests.Session()

    def _get_url(self, path, scheme=None, server=None, root=None):
        baseurl = urlunparse((
            scheme or self.scheme,
{'fraction_non_alphanumeric': 0.08443708609271523, 'fraction_numerical': 0.006622516556291391, 'mean_word_length': 3.386569872958258, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '758492', 'n_tokens_mistral': 709, 'n_tokens_neox': 679, 'n_words': 249}