<commit_before>import django.core.exceptions
from django.utils.translation import ugettext_lazy as _
from django.utils.datastructures import SortedDict
from django.utils.encoding import smart_unicode, smart_str
from django.forms.fields import Field
import datetime

class TimeDelta(datetime.timedelta):
    values_in_microseconds = SortedDict((
        # Uncomment the following two lines for year and month support
        # ('y', 31556925993600), # 52.177457 * (7*24*60*60*1000*1000)
        # ('m', 2629743832800), # 4.34812141 * (7*24*60*60*1000*1000)
        ('w', 604800000000), # 7*24*60*60*1000*1000
        ('d', 86400000000), # 24*60*60*1000*1000
        ('h', 3600000000), # 60*60*1000*1000
        ('m', 60000000), # 60*1000*1000
        ('s',  1000000), # 1000*1000
        ('ms', 1000),
        ('us', 1),
    ))
    
    def from_string(cls, value):
        if value == '0':
            return datetime.timedelta.__new__(TimeDelta)
        
        pairs = []
        for b in value.lower().split():
            for index, char in enumerate(b):
                if not char.isdigit():
                    pairs.append((b[:index], b[index:])) #digits, letters
                    break
        if not pairs:
            raise ValueError("Incorrect TimeDelta value")
    
        microseconds = 0
        for digits, chars in pairs:
            if not digits or not chars:
                raise ValidationError("Incorrect TimeDelta pair")
            microseconds += int(digits) * TimeDelta.values_in_microseconds[chars]
        
        return datetime.timedelta.__new__(TimeDelta, microseconds=microseconds)
    
    from_string = classmethod(from_string)

    def __new__(self, days=0, seconds=0, microseconds=0, value=None):
        """<commit_msg>fix stupid durationfield bug<commit_after>import django.core.exceptions
from django.utils.translation import ugettext_lazy as _
from django.utils.datastructures import SortedDict
from django.utils.encoding import smart_unicode, smart_str
from django.forms.fields import Field
import datetime

class TimeDelta(datetime.timedelta):
    values_in_microseconds = SortedDict((
        # Uncomment the following two lines for year and month support
        # ('y', 31556925993600), # 52.177457 * (7*24*60*60*1000*1000)
        # ('m', 2629743832800), # 4.34812141 * (7*24*60*60*1000*1000)
        ('w', 604800000000), # 7*24*60*60*1000*1000
        ('d', 86400000000), # 24*60*60*1000*1000
        ('h', 3600000000), # 60*60*1000*1000
        ('m', 60000000), # 60*1000*1000
        ('s',  1000000), # 1000*1000
        ('ms', 1000),
        ('us', 1),
    ))
    
    def from_string(cls, value):
        if value == '0' or value == '0.000000':
            return datetime.timedelta.__new__(TimeDelta)
        
        pairs = []
        for b in value.lower().split():
            for index, char in enumerate(b):
                if not char.isdigit():
                    pairs.append((b[:index], b[index:])) #digits, letters
                    break
        if not pairs:
            raise ValueError("Incorrect TimeDelta value")
    
        microseconds = 0
        for digits, chars in pairs:
            if not digits or not chars:
                raise ValidationError("Incorrect TimeDelta pair")
            microseconds += int(digits) * TimeDelta.values_in_microseconds[chars]
        
        return datetime.timedelta.__new__(TimeDelta, microseconds=microseconds)
    
    from_string = classmethod(from_string)

    def __new__(self, days=0, seconds=0, microseconds=0, value=None):
        """
{'fraction_non_alphanumeric': 0.11862030286034773, 'fraction_numerical': 0.10908581043185642, 'mean_word_length': 2.5142857142857142, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 8, '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': '1186234', 'n_tokens_mistral': 1354, 'n_tokens_neox': 1050, 'n_words': 260}