Lines Matching +full:ansi +full:- +full:regex
1 """Strptime-related classes and functions.
4 LocaleTime -- Discovers and stores locale-specific time information
5 TimeRE -- Creates regexes for pattern matching a string of text containing
9 _getlang -- Figure out what language is being used for the locale
10 strptime -- Calculates the time struct represented by the passed-in string
31 """Stores and handles locale-specific information related to time.
34 f_weekday -- full weekday names (7-item list)
35 a_weekday -- abbreviated weekday names (7-item list)
36 f_month -- full month names (13-item list; dummy value in [0], which
38 a_month -- abbreviated month names (13-item list, dummy value in
40 am_pm -- AM/PM representation (2-item list)
41 LC_date_time -- format string for date/time representation (string)
42 LC_date -- format string for date representation (string)
43 LC_time -- format string for time representation (string)
44 timezone -- daylight- and non-daylight-savings timezone representation
45 (2-item list of sets)
46 lang -- Language used by instance (2-item tuple)
57 happen when using threads where one thread calls a locale-dependent
60 locks to prevent changing the locale while locale-dependent code is
139 # If %W is used, then Sunday, 2005-01-03 will fall on week 0 since
140 # 2005-01-03 occurs before the first Monday of the year. Otherwise
185 # The " [1-9]" part of the regex is to make %c from ANSI C work
186 'd': r"(?P<d>3[0-1]|[1-2]\d|0[1-9]|[1-9]| [1-9])",
187 'f': r"(?P<f>[0-9]{1,6})",
188 'H': r"(?P<H>2[0-3]|[0-1]\d|\d)",
189 'I': r"(?P<I>1[0-2]|0[1-9]|[1-9])",
191 'j': r"(?P<j>36[0-6]|3[0-5]\d|[1-2]\d\d|0[1-9]\d|00[1-9]|[1-9]\d|0[1-9]|[1-9])",
192 'm': r"(?P<m>1[0-2]|0[1-9]|[1-9])",
193 'M': r"(?P<M>[0-5]\d|\d)",
194 'S': r"(?P<S>6[0-1]|[0-5]\d|\d)",
195 'U': r"(?P<U>5[0-3]|[0-4]\d|\d)",
196 'w': r"(?P<w>[0-6])",
197 'u': r"(?P<u>[1-7])",
198 'V': r"(?P<V>5[0-3]|0[1-9]|[1-4]\d|\d)",
204 'z': r"(?P<z>[+-]\d\d:?[0-5]\d(:?[0-5]\d(\.\d{1,6})?)?|(?-i:Z))",
220 """Convert a list to a regex string for matching a directive.
234 regex = '|'.join(re_escape(stuff) for stuff in to_convert)
235 regex = '(?P<%s>%s' % (directive, regex)
236 return '%s)' % regex
239 """Return regex pattern for the format string.
242 regex syntax are escaped.
247 # as regex syntax. Cannot use re.escape since we have to deal with
256 format[:directive_index-1],
285 week_0_length = (7 - first_weekday) % 7
287 return 1 + day_of_week - first_weekday
289 days_to_week = week_0_length + (7 * (week_of_year - 1))
299 ordinal = (iso_week * 7) + iso_weekday - correction
304 iso_year -= 1
305 ordinal -= datetime_date(iso_year, 1, 1).toordinal()
310 """Return a 2-tuple consisting of a time struct and an int containing
358 tz = -1
361 # Default to -1 to signify that values not known; not critical to have,
421 s += "0" * (6 - len(s))
432 weekday -= 1
435 weekday -= 1
466 gmtoff_remainder_padding = "0" * (6 - len(gmtoff_remainder))
468 if z.startswith("-"):
469 gmtoff = -gmtoff
470 gmtoff_fraction = -gmtoff_fraction
472 # Since -1 is default value only need to worry about setting tz if
473 # it can be something other than -1.
525 year -= 1
530 # Cannot pre-calculate datetime_date() since can change in Julian
534 julian = datetime_date(year, month, day).toordinal() - \
539 (julian - 1) +
569 tzname, gmtoff = tt[-2:]