<commit_before>import oauth2
import urlparse


class Consumer:

    """
        Creates a new consumer for authentication with Tumblr.
    """

    def __init__(self, consumer_key, consumer_secret):

        return oauth2.Consumer(consumer_key, consumer_secret)


def consumer(consumer_key, consumer_secret):

    """
        Creates a new consumer for authentication with Tumblr.
    """

    return oauth2.Consumer(consumer_key, consumer_secret)


class RequestToken:

    """
        Creates a new request token for gaining credentials to authenticate with
         Tumblr.
    """

    def __init__(self, consumer):

        request_token_url = 'http://www.tumblr.com/oauth/request_token'

        client = oauth2.Client(consumer)

        resp, content = client.request(request_token_url, 'POST')

        self.token = urlparse.parse_qs(content)


def request_token(consumer):

    """
        Creates a new request token for gaining credentials to authenticate with
         Tumblr.
    """

    request_token_url = 'http://www.tumblr.com/oauth/request_token'

    client = oauth2.Client(consumer)

    resp, content = client.request(request_token_url, 'POST')

    return urlparse.parse_qs(content)


class AccessToken:

    """
        Creates a new access token for gaining credentials to authenticate with
         Tumblr.
    """

    def __init__(self, consumer, request_response, request_token):

        access_token_url = 'http://www.tumblr.com/oauth/access_token'

        url = urlparse.urlparse(request_response)
        query_dict = urlparse.parse_qs(url.query)
        oauth_verifier = query_dict['oauth_verifier'][0]

        token = oauth2.Token(request_token['oauth_token'], request_token['oauth_token_secret'][0])
        token.set_verifier(oauth_verifier)
        client = oauth2.Client(consumer)

        resp, content = client.request(access_token_url, 'POST')
        self.token = urlparse.parse_qs(content)


def access_token(consumer, request_response, request_token):

    """
        Creates a new access token for gaining credentials to authenticate with
         Tumblr.
    """

    access_token_url = 'http://www.tumblr.com/oauth/access_token'

    url = urlparse.urlparse(request_response)
    query_dict = urlparse.parse_qs(url.query)
    oauth_verifier = query_dict['oauth_verifier'][0]

    token = oauth2.Token(request_token['oauth_token'], request_token['oauth_token_secret'][0])
    token.set_verifier(oauth_verifier)
    client = oauth2.Client(consumer)

    resp, content = client.request(access_token_url, 'POST')
    return urlparse.parse_qs(content)<commit_msg>Cleaned up non-functioning code.<commit_after>import oauth2
import urlparse


def consumer(consumer_key, consumer_secret):

    """
        Creates a new consumer for authentication with Tumblr.
    """

    return oauth2.Consumer(consumer_key, consumer_secret)


def request_token(consumer):

    """
        Creates a new request token for gaining credentials to authenticate with
         Tumblr.
    """

    request_token_url = 'http://www.tumblr.com/oauth/request_token'

    client = oauth2.Client(consumer)

    resp, content = client.request(request_token_url, 'POST')

    return urlparse.parse_qs(content)


def access_token(consumer, request_response, request_token):

    """
        Creates a new access token for gaining credentials to authenticate with
         Tumblr.
    """

    access_token_url = 'http://www.tumblr.com/oauth/access_token'

    url = urlparse.urlparse(request_response)
    query_dict = urlparse.parse_qs(url.query)
    oauth_verifier = query_dict['oauth_verifier'][0]

    token = oauth2.Token(request_token['oauth_token'], request_token['oauth_token_secret'][0])
    token.set_verifier(oauth_verifier)
    client = oauth2.Client(consumer, token)

    resp, content = client.request(access_token_url, 'POST')
    return urlparse.parse_qs(content)
{'fraction_non_alphanumeric': 0.09809964047252183, 'fraction_numerical': 0.005136106831022085, 'mean_word_length': 3.487327188940092, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '5076658', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1163, 'n_words': 242}