<commit_before>import requests


class HackerNews():

    def __init__(self):
        self.url = 'https://hacker-news.firebaseio.com/v0/{uri}'

    def request(self, method, uri):
        url = self.url.format(uri=uri)
        return requests.request(method, url)

    def item(self, item_id):
        r = self.request('GET', 'item/{item_id}.json'.format(item_id=item_id))
        return r.json()

    def user(self, user_id):
        r = self.request('GET', 'user/{user_id}.json'.format(user_id=user_id))
        return r.json()

    def top_stories(self):
        r = self.request('GET', 'topstories.json')
        return r.json()

    def max_item(self):
        r = self.request('GET', 'maxitem.json')
        return r.json()

    def updates(self):
        r = self.request('GET', 'updates.json')
        return r.json()

<commit_msg>Convert timestamps to native datetime objects (breaking change)<commit_after>from datetime import datetime

import requests


class HackerNews():

    def __init__(self, timeout=5):
        self.url = 'https://hacker-news.firebaseio.com/v0/{uri}'
        self.timeout = timeout

    def request(self, method, uri):
        url = self.url.format(uri=uri)
        return requests.request(method, url, timeout=self.timeout)

    def item(self, item_id):
        r = self.request('GET', 'item/{item_id}.json'.format(item_id=item_id))
        item = r.json()
        item['time'] = datetime.fromtimestamp(item['time'])
        return item

    def user(self, user_id):
        r = self.request('GET', 'user/{user_id}.json'.format(user_id=user_id))
        user = r.json()
        user['created'] = datetime.fromtimestamp(user['created'])
        return user

    def top_stories(self):
        r = self.request('GET', 'topstories.json')
        return r.json()

    def max_item(self):
        r = self.request('GET', 'maxitem.json')
        return r.json()

    def updates(self):
        r = self.request('GET', 'updates.json')
        return r.json()

{'fraction_non_alphanumeric': 0.15241448692152917, 'fraction_numerical': 0.0015090543259557343, 'mean_word_length': 2.6901669758812616, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1400650', 'n_tokens_mistral': 648, 'n_tokens_neox': 630, 'n_words': 131}