Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5139)

Side by Side Diff: Lib/datetime.py

Issue 11930: Remove time.accept2dyear
Patch Set: Created 2 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Lib/test/datetimetester.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Concrete date/time and related types -- prototype implemented in Python. 1 """Concrete date/time and related types -- prototype implemented in Python.
2 2
3 See http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage 3 See http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage
4 4
5 See also http://dir.yahoo.com/Reference/calendars/ 5 See also http://dir.yahoo.com/Reference/calendars/
6 6
7 For a primer on DST, including many current DST rules, see 7 For a primer on DST, including many current DST rules, see
8 http://webexhibits.org/daylightsaving/ 8 http://webexhibits.org/daylightsaving/
9 9
10 For more about DST than you ever wanted to know, see 10 For more about DST than you ever wanted to know, see
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 def _format_time(hh, mm, ss, us): 166 def _format_time(hh, mm, ss, us):
167 # Skip trailing microseconds when us==0. 167 # Skip trailing microseconds when us==0.
168 result = "%02d:%02d:%02d" % (hh, mm, ss) 168 result = "%02d:%02d:%02d" % (hh, mm, ss)
169 if us: 169 if us:
170 result += ".%06d" % us 170 result += ".%06d" % us
171 return result 171 return result
172 172
173 # Correctly substitute for %z and %Z escapes in strftime formats. 173 # Correctly substitute for %z and %Z escapes in strftime formats.
174 def _wrap_strftime(object, format, timetuple): 174 def _wrap_strftime(object, format, timetuple):
175 year = timetuple[0]
176 if year < 1000:
177 raise ValueError("year=%d is before 1000; the datetime strftime() "
178 "methods require year >= 1000" % year)
179 # Don't call utcoffset() or tzname() unless actually needed. 175 # Don't call utcoffset() or tzname() unless actually needed.
180 freplace = None # the string to use for %f 176 freplace = None # the string to use for %f
181 zreplace = None # the string to use for %z 177 zreplace = None # the string to use for %z
182 Zreplace = None # the string to use for %Z 178 Zreplace = None # the string to use for %Z
183 179
184 # Scan format for %z and %Z escapes, replacing as needed. 180 # Scan format for %z and %Z escapes, replacing as needed.
185 newformat = [] 181 newformat = []
186 push = newformat.append 182 push = newformat.append
187 i, n = 0, len(format) 183 i, n = 0, len(format)
188 while i < n: 184 while i < n:
(...skipping 1914 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 _check_time_fields, _check_tzinfo_arg, _check_tzname, 2099 _check_time_fields, _check_tzinfo_arg, _check_tzname,
2104 _check_utc_offset, _cmp, _cmperror, _date_class, _days_before_month, 2100 _check_utc_offset, _cmp, _cmperror, _date_class, _days_before_month,
2105 _days_before_year, _days_in_month, _format_time, _is_leap, 2101 _days_before_year, _days_in_month, _format_time, _is_leap,
2106 _isoweek1monday, _math, _ord2ymd, _time, _time_class, _tzinfo_class, 2102 _isoweek1monday, _math, _ord2ymd, _time, _time_class, _tzinfo_class,
2107 _wrap_strftime, _ymd2ord) 2103 _wrap_strftime, _ymd2ord)
2108 # XXX Since import * above excludes names that start with _, 2104 # XXX Since import * above excludes names that start with _,
2109 # docstring does not get overwritten. In the future, it may be 2105 # docstring does not get overwritten. In the future, it may be
2110 # appropriate to maintain a single module level docstring and 2106 # appropriate to maintain a single module level docstring and
2111 # remove the following line. 2107 # remove the following line.
2112 from _datetime import __doc__ 2108 from _datetime import __doc__
OLDNEW
« no previous file with comments | « no previous file | Lib/test/datetimetester.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7