<commit_before># -*- coding: utf-8 -*-
import re
from datetime import datetime, timedelta

from dateparser.timezones import timezone_info_list


def pop_tz_offset_from_string(date_string):
    for timezone_re, offset in _tz_offsets.iteritems():
        if timezone_re.search(date_string):
            date_string = timezone_re.sub('', date_string).rstrip()
            return date_string, offset
    else:
        return date_string, None


def convert_to_local_tz(datetime_obj, datetime_tz_offset):
    return datetime_obj - datetime_tz_offset + local_tz_offset


def get_tz_offsets():
    return {
        re.compile(r'\b%s$' % tz_info[0]): timedelta(seconds=tz_info[1])
        for tz_info in timezone_info_list
    }


def get_local_tz_offset():<commit_msg>Improved timezones detection<commit_after># -*- coding: utf-8 -*-
import re
from datetime import datetime, timedelta

from dateparser.timezones import timezone_info_list


def pop_tz_offset_from_string(date_string):
    for timezone_re, offset in _tz_offsets.iteritems():
        if timezone_re.search(date_string):
            date_string = timezone_re.sub('', date_string).rstrip()
            return date_string, offset
    else:
        return date_string, None


def convert_to_local_tz(datetime_obj, datetime_tz_offset):
    return datetime_obj - datetime_tz_offset + local_tz_offset


def get_tz_offsets():
    return {
        re.compile(r'[\b|\d]%s$' % tz_info[0], re.IGNORECASE): timedelta(seconds=tz_info[1])
        for tz_info in timezone_info_list
    }


def get_local_tz_offset():
{'fraction_non_alphanumeric': 0.09377007064868337, 'fraction_numerical': 0.0038535645472061657, 'mean_word_length': 3.86875, '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': '6933388', 'n_tokens_mistral': 525, 'n_tokens_neox': 504, 'n_words': 106}