tools/metrics/histograms/generate_expired_histograms_array.py
def _GetBaseDate(content, regex):
  """Fetches base date from |content| to compare expiry dates with.

  Args:
   content: A string with the base date.
   regex: A regular expression object that matches the base date.

  Returns:
   A base date as datetime.date object.

  Raises:
    Error if |content| doesn't match |regex| or the matched date has invalid
    format.
  """
  base_date_str = _FindMatch(content, regex, 1)
  if not base_date_str:
    return None
  try:
    base_date = datetime.datetime.strptime(
        base_date_str, extract_histograms.EXPIRY_DATE_PATTERN).date()
    return base_date
  except ValueError:
    raise Error("Unable to parse base date {date} from {content}.".
                format(date=base_date_str, content=content))
Fetches base date from |content| to compare expiry dates with.

  Args:
   content: A string with the base date.
   regex: A regular expression object that matches the base date.

  Returns:
   A base date as datetime.date object.

  Raises:
    Error if |content| doesn't match |regex| or the matched date has invalid
    format.
  
Fetches base date from |content| to compare expiry dates with.
Args:
content: A string with the base date.
regex: A regular expression object that matches the base date.

A base date as datetime.date object.

Error if |content| doesn't match |regex| or the matched date has invalid
format.
Fetches base date from |content| to compare expiry dates with . Args : content : A string with the base date . regex : A regular expression object that matches the base date . A base date as datetime . date object . Error if |content| doesn ' t match |regex| or the matched date has invalid format .
def _GetBaseDate(content, regex):
  base_date_str = _FindMatch(content, regex, 1)
  if not base_date_str:
    return None
  try:
    base_date = datetime.datetime.strptime(
        base_date_str, extract_histograms.EXPIRY_DATE_PATTERN).date()
    return base_date
  except ValueError:
    raise Error("Unable to parse base date {date} from {content}.".
                format(date=base_date_str, content=content))
def _GetBaseDate ( content , regex ) : base_date_str = _FindMatch ( content , regex , 1 ) if not base_date_str : return None try : base_date = datetime . datetime . strptime ( base_date_str , extract_histograms . EXPIRY_DATE_PATTERN ) . date ( ) return base_date except ValueError : raise Error ( "Unable to parse base date {date} from {content}." . format ( date = base_date_str , content = content ) )
Fetches base date from |content| to compare expiry dates with.
Fetches base date from |content| to compare expiry dates with .
"""Fetches base date from |content| to compare expiry dates with.

  Args:
   content: A string with the base date.
   regex: A regular expression object that matches the base date.

  Returns:
   A base date as datetime.date object.

  Raises:
    Error if |content| doesn't match |regex| or the matched date has invalid
    format.
  """
content
regex