summaryrefslogtreecommitdiffstats
path: root/Lib/_strptime.py
Commit message (Collapse)AuthorAgeFilesLines
* Make _strptime.TimeRE().pattern() use ``\s+`` for matching whitespace insteadBrett Cannon2007-06-031-1/+1
| | | | | | | of ``\s*``. This prevents patterns from "stealing" bits from other patterns in order to make a match work. Closes bug #1730389. Will be backported.
* time.strptime's caching of its locale object was being recreated when theBrett Cannon2007-04-011-5/+4
| | | | | | | | | locale changed but not used during the function call it was recreated during. The test in this checkin is untested (OS X does not have the proper locale support for me to test), although the fix for the bug this deals with was tested by the OP (#1290505). Once the buildbots verify the test at least doesn't fail it becomes a backport candidate.
* Use the thread lock's context manager instead of a try/finally statement.Brett Cannon2007-01-281-4/+1
|
* Remove specific mention of my name and email address from modules. Not reallyBrett Cannon2007-01-251-3/+0
| | | | | needed and all bug reports should go to the bug tracker, not directly to me. Plus I am not the only person to have edited these files at this point.
* Fix time.strptime's %U support. Basically rewrote the algorithm to be moreBrett Cannon2007-01-251-31/+30
| | | | | | | | | generic so that one only has to shift certain values based on whether the week was specified to start on Monday or Sunday. Cut out a lot of edge case code compared to the previous version. Also broke algorithm out into its own function (that is private to the module). Fixes bug #1643943 (thanks Biran Nahas for the report).
* Make the error message for when the time data and format do not match clearer.Brett Cannon2006-09-261-1/+1
|
* Change time.strptime() to raise ValueError whenever there is an error in theBrett Cannon2005-11-021-1/+14
| | | | | | | format string. Before exceptions generated by the internal code propagated up to the user and were not helpful. Closes bug #1340337.
* Clear out the regex cache when the TimeRE cache is invalidated by a localeBrett Cannon2005-09-151-1/+2
| | | | | | change. Fixes bug #1290505.
* Fix logic error introduced in last commit. Also add a comment to explain whatBrett Cannon2005-08-291-2/+5
| | | | the code is doing.
* fix bug where str.find() was being misused where __contains__ should have beenBrett Cannon2005-08-271-1/+1
| | | | used.
* Fix bug of implementation of algorithm for calculating the date from year, weekBrett Cannon2004-10-281-10/+12
| | | | | | | | of the year, and day of the week. Was not taking into consideration properly the issue of when %U is used for the week of the year but the year starts on Monday. Closes bug #1045381 again.
* Fix comments.Brett Cannon2004-10-181-2/+4
|
* Add support for %U and %W to contribute to calculating the date when the yearBrett Cannon2004-10-181-1/+43
| | | | | | and day of the week are specified. Closes bug #1045381.
* Fix bug introduced by the previous patch by changing TimeRE.__seqToRe() toBrett Cannon2004-10-061-2/+1
| | | | accept any iterable instead of only a sliceable object.
* Convert a listcomp to a gencomp (was already editing code).Brett Cannon2004-10-061-2/+2
|
* Locale data that contains regex metacharacters are now properly escaped.Brett Cannon2004-10-061-2/+4
| | | | Closes bug #1039270.
* Replace str.find()!=1 with the more readable "in" operator.Raymond Hettinger2004-05-041-1/+1
|
* Deal with possible case of having time.tzname[1] containing UTC or GMT.Brett Cannon2004-03-071-2/+2
| | | | | | Since it is known ahead of time that UTC and GMT always have no DST adjustment then just set the isdst value to 0 even if tzname[0] == tzname[1] . Fixes bug #897817 .
* Whitespace normalization.Tim Peters2004-01-181-1/+1
|
* * Migrate set() and frozenset() from the sandbox.Raymond Hettinger2003-11-161-4/+3
| | | | | | | | * Install the unittests, docs, newsitem, include file, and makefile update. * Exercise the new functions whereever sets.py was being used. Includes the docs for libfuncs.tex. Separate docs for the types are forthcoming.
* Let library modules use the new keyword arguments for list.sort().Raymond Hettinger2003-10-161-11/+9
|
* Make sure parentheses are escaped when used in the format string.Brett Cannon2003-08-291-1/+1
| | | | Closes bug #796149 . Will be backported.
* Fix handling of bad locale setup where time.tzname[0] == time.tzname[1] andBrett Cannon2003-08-111-10/+19
| | | | | | time.daylight is true. Add an explicit test for this situation. Fixed some wording in docstrings.
* Fix docstring in LocaleTime.Brett Cannon2003-08-081-2/+2
|
* Re-introduce caching of TimeRE and compiled regexes with added thread-safety.Brett Cannon2003-08-051-275/+136
| | | | | | | | | | | | Also remove now unnecessary property attributes for thread safety (no longer have lazy attributes) and code simplicity reasons. Timezone storage has been reworked to be simpler and more flexible. All values in LocaleTime instances are lower-cased. This is all done to simplify the module. The module now assumes nothing beyond the strptime function will be exposed for general use beyond providing functionality for strptime.
* Fixes bug of having default argument for TimeRE's __init__ that caused theBrett Cannon2003-07-241-2/+5
| | | | | LocaleTime instance to only be created once and thus not be recreated when the locale changed.
* Remove caching of TimeRE (and thus LocaleTime) instance. Error was beingBrett Cannon2003-07-241-41/+13
| | | | | | caught when executing test_strptime, test_logging, and test_time in that order when the testing of "%c" occured. Suspect the cache was not being recreated (the test passed when test_logging was forced to re-establish the locale).
* SF 748201: time.strptime() should display format and date on errorRaymond Hettinger2003-07-131-1/+2
| | | | Usability fix. Makes the error message more helpful.
* Fixes bug of timezone value being left as -1 when ``time.tzname[0] ==Brett Cannon2003-07-031-4/+5
| | | | | | | time.tzname[1] and not time.daylight`` is true when it should only when time.daylight is true. Tests are also fixed. Closes bug #763047 and its cohort #763052.
* use == like all the other conditionalsNeal Norwitz2003-06-291-1/+1
|
* Call time.tzset (if available) just before calculating possible timezones ↵Brett Cannon2003-05-131-0/+4
| | | | from time.tzname.
* Beefed up timezone support. UTC and GMT are now always recognized timezonesBrett Cannon2003-05-111-7/+15
| | | | | with values of 0. Also now check time.daylight to see if time.tzname[1] should be used in timezone checking.
* Raise a ValueError when there is data that was not covered in the format ↵Brett Cannon2003-04-281-0/+3
| | | | string. Done to match behavior of pre-existing C-based strptime implementations.
* Whitespace normalization.Tim Peters2003-04-241-3/+2
|
* Make _strptime escape regex syntax in format string to prevent use in ↵Brett Cannon2003-04-191-1/+10
| | | | internal regex.
* SF patch #691928: Use datetime in _strptimeRaymond Hettinger2003-03-091-56/+18
| | | | | | | | | | | | Contributed by Brett Cannon. To prevent code duplication, I patched _strptime to use datetime's date object to do Julian day, Gregorian, and day of the week calculations. Patch also includes new regression tests to test results and the calculation gets triggered. Very minor comment changes and the contact email are also changed.
* Whitespace normalization.Tim Peters2003-01-291-3/+3
|
* SF patch 670194: Performance enhancement for _strptime.py.Tim Peters2003-01-191-20/+36
| | | | | From Brett Cannon. Mostly speedups via caching format string -> compiled regexp.
* SF patch 670012: Compatibility changes for _strptime.py.Tim Peters2003-01-181-91/+89
| | | | | | | | | | | | | | | Patch from Brett Cannon: First, the 'y' directive now handles [00, 68] as a suffix for the 21st century while [69, 99] is treated as the suffix for the 20th century (this is for Open Group compatibility). strptime now returns default values that make it a valid date ... the ability to pass in a regex object to use instead of a format string (and the inverse ability to have strptime return a regex object) has been removed. This is in preparation for a future patch that will add some caching internally to get a speed boost.
* Checking in Brett Cannon's patch #662053, which fixes bug #661354.Jack Jansen2003-01-151-8/+12
| | | | _strptime can now handle getting two empty strings as the timezone information.
* Fix SF #658820, regex fixes for _strptime (Brett Cannon)Neal Norwitz2002-12-301-8/+9
| | | | Disallow zero for days and months
* Fix julian day problem with strptime. Note: XXX about using 0, suggestions?Neal Norwitz2002-12-261-1/+3
|
* Patch #639112: fixes for None locale and tz.Martin v. Löwis2002-11-271-5/+13
|
* Brett's fixes for various bugs and coding issues. Closes SF patch #Barry Warsaw2002-09-231-61/+69
| | | | | 593560, with some minor cleanups, line folding and whitespace normalization by Barry.
* Many hopefully benign style clean ups. Still passes the test suite ofBarry Warsaw2002-08-291-172/+200
| | | | course.
* strptime(): The code that was adding 12 to PM hours was incorrectBarry Warsaw2002-08-291-5/+12
| | | | | | | | | because it added it to 12 PM too. 12 PM should be hour 12 not hour 24. Also cleaned up a minor style nit. There are more style problems in this file that I'll clean up next (but I didn't want them to overwhelm the substance of this fix).
* Whitespace normalization.Tim Peters2002-08-081-40/+40
|
* Pure Python strptime implementation by Brett Cannon. See SF patch 474274.Guido van Rossum2002-07-191-0/+488
Also adds tests.