<commit_before># coding=utf-8
"""
"""
from __future__ import absolute_import

from babel.dates import DateTimePattern, parse_pattern

def babel2datetime(pattern):
  """Convert date format from babel
  (http://babel.pocoo.org/docs/dates/#date-fields)) to a format understood by
  datetime.strptime.
  """
  if not isinstance(pattern, DateTimePattern):
    pattern = parse_pattern(pattern)

  map_fmt = {
    # days
    'd'   : '%d',
    'dd'  : '%d',
    'EEE' : '%a',
    'EEEE': '%A',
    'EEEEE': '%a', # narrow name => short name
    # months
    'M'   : '%m',
    'MM'  : '%m',
    'MMM' : '%b',
    'MMMM': '%B',
    # years
    'y'   : '%Y',
    'yy'  : '%Y',
    'yyyy': '%Y',
    # hours
    'h' : '%I',
    'hh': '%I',
    'H' : '%H',
    'HH': '%H',
    # minutes,
    'm' : '%M',
    'mm': '%M',
    # seconds
    's' : '%S',
    'ss': '%S',
    # am/pm
    'a': '%p',
    }

  return pattern.format % map_fmt
<commit_msg>code formatting<commit_after># coding=utf-8
"""
"""
from __future__ import absolute_import

from babel.dates import DateTimePattern, parse_pattern

def babel2datetime(pattern):
  """Convert date format from babel
  (http://babel.pocoo.org/docs/dates/#date-fields)) to a format understood by
  datetime.strptime.
  """
  if not isinstance(pattern, DateTimePattern):
    pattern = parse_pattern(pattern)

  map_fmt = {
    # days
    'd'    : '%d',
    'dd'   : '%d',
    'EEE'  : '%a',
    'EEEE' : '%A',
    'EEEEE': '%a', # narrow name => short name
    # months
    'M'   : '%m',
    'MM'  : '%m',
    'MMM' : '%b',
    'MMMM': '%B',
    # years
    'y'   : '%Y',
    'yy'  : '%Y',
    'yyyy': '%Y',
    # hours
    'h' : '%I',
    'hh': '%I',
    'H' : '%H',
    'HH': '%H',
    # minutes,
    'm' : '%M',
    'mm': '%M',
    # seconds
    's' : '%S',
    'ss': '%S',
    # am/pm
    'a': '%p',
    }

  return pattern.format % map_fmt

{'fraction_non_alphanumeric': 0.2232905982905983, 'fraction_numerical': 0.002136752136752137, 'mean_word_length': 2.332740213523132, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5770989', 'n_tokens_mistral': 743, 'n_tokens_neox': 727, 'n_words': 177}