<commit_before>import requests as re

def get_ref_from_doi(doi, base_url='http://dx.doi.org/'):
    request_url = base_url + doi
    headers = {b'Accept': 'application/citeproc+json'}
    request_output = re.get(request_url, headers=headers)
    if request_output.status_code == 200 :
        return request_output.json()
    else :
        raise ValueError("No such DOI found")<commit_msg>Docstring for get_from_doi<commit_after>import requests as re

def get_ref_from_doi(doi, base_url='http://dx.doi.org/'):
    """ Get a JSON record from a CrossRef DOI

    The output of this function is a `dict` representation of the record,
    that can be used directly by :func:`library.new`.

    Args:
        doi: A string giving the DOI you want to look for
        base_url: The URL to be added before the DOI, defaults to `dx.doi.org`

    Returns:
        A `dict` representation of a json-csl bibliograghic record

    Raises:
        ValueError: No DOI is found (response code of the request is not `200 OK`)

    """
    request_url = base_url + doi
    headers = {b'Accept': 'application/citeproc+json'}
    request_output = re.get(request_url, headers=headers)
    if request_output.status_code == 200 :
        return request_output.json()
    else :
        raise ValueError("No such DOI found")
{'fraction_non_alphanumeric': 0.09600614439324116, 'fraction_numerical': 0.0069124423963133645, 'mean_word_length': 3.2305194805194803, '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': '5958553', 'n_tokens_mistral': 415, 'n_tokens_neox': 389, 'n_words': 130}