<commit_before>#!/usr/bin/env python3

import re
import math
import time
import collections
import datetime
import calendar

LOCALTZ = time.altzone


def _mktime(time_struct):
    """Custom mktime because Windows can't be arsed to properly do pre-Epoch
    dates, probably because it's busy counting all its chromosomes.
    """
    try:
        return time.mktime(time_struct)
    except OverflowError:
        dt = datetime.datetime(*time_struct[:6])
        return dt.timestamp()


def currentutc():
    """Returns the current UTC timestamp.

    This is important, since time.gmtime() seems to use time.timezone, which
    doesn't factor in DST and thus doesn't actually return a utc timestamp.
    """
    return time.time() + LOCALTZ


def guesstype(timestr):
    """Tries to guess whether a string represents a time or a time delta and
    returns the appropriate object.

    :param timestr (required)
        The string to be analyzed
    """
    timestr_full = " {} ".format(timestr)
    if timestr_full.find(" in ") != -1 or timestr_full.find(" ago ") != -1:
        return Chronyk(timestr)

    comps = ["second", "minute", "hour", "day", "week", "month", "year"]
    for comp in comps:
        if timestr_full.find(comp) != -1:
            return ChronykDelta(timestr)

    return Chronyk(timestr)
<commit_msg>Try a different way of mktiming<commit_after>#!/usr/bin/env python3

import re
import math
import time
import collections
import datetime
import calendar

LOCALTZ = time.altzone


def _mktime(time_struct):
    """Custom mktime because Windows can't be arsed to properly do pre-Epoch
    dates, probably because it's busy counting all its chromosomes.
    """
    try:
        return time.mktime(time_struct)
    except OverflowError:
        dt = datetime.datetime(*time_struct[:6])
        ep = datetime.datetime(1970, 1, 1)
        diff = dt - ep
        return diff.days * 24 * 3600 + diff.seconds


def currentutc():
    """Returns the current UTC timestamp.

    This is important, since time.gmtime() seems to use time.timezone, which
    doesn't factor in DST and thus doesn't actually return a utc timestamp.
    """
    return time.time() + LOCALTZ


def guesstype(timestr):
    """Tries to guess whether a string represents a time or a time delta and
    returns the appropriate object.

    :param timestr (required)
        The string to be analyzed
    """
    timestr_full = " {} ".format(timestr)
    if timestr_full.find(" in ") != -1 or timestr_full.find(" ago ") != -1:
        return Chronyk(timestr)

    comps = ["second", "minute", "hour", "day", "week", "month", "year"]
    for comp in comps:
        if timestr_full.find(comp) != -1:
            return ChronykDelta(timestr)

    return Chronyk(timestr)

{'fraction_non_alphanumeric': 0.10392441860465117, 'fraction_numerical': 0.007994186046511628, 'mean_word_length': 3.007278020378457, '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': '872084', 'n_tokens_mistral': 852, 'n_tokens_neox': 829, 'n_words': 291}