Commit Graph

32 Commits

Author SHA1 Message Date
Raymond Hettinger bac788a3cd Replace str.find()!=1 with the more readable "in" operator. 2004-05-04 09:21:43 +00:00
Brett Cannon 8172ac3d15 Deal with possible case of having time.tzname[1] containing UTC or GMT.
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 .
2004-03-07 23:16:27 +00:00
Tim Peters 58eb11cf62 Whitespace normalization. 2004-01-18 20:29:55 +00:00
Raymond Hettinger a690a9967e * Migrate set() and frozenset() from the sandbox.
* 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.
2003-11-16 16:17:49 +00:00
Raymond Hettinger 6b59f5f3fd Let library modules use the new keyword arguments for list.sort(). 2003-10-16 05:53:16 +00:00
Brett Cannon 953c6f508b Make sure parentheses are escaped when used in the format string.
Closes bug #796149 .  Will be backported.
2003-08-29 02:28:54 +00:00
Brett Cannon 5187a3bcdb Fix handling of bad locale setup where time.tzname[0] == time.tzname[1] and
time.daylight is true.  Add an explicit test for this situation.

Fixed some wording in docstrings.
2003-08-11 07:24:05 +00:00
Brett Cannon f5c96fb74d Fix docstring in LocaleTime. 2003-08-08 01:53:05 +00:00
Brett Cannon 474335ce17 Re-introduce caching of TimeRE and compiled regexes with added thread-safety.
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.
2003-08-05 04:02:49 +00:00
Brett Cannon 2c24d42d32 Fixes bug of having default argument for TimeRE's __init__ that caused the
LocaleTime instance to only be created once and thus not be recreated when
the locale changed.
2003-07-24 20:02:28 +00:00
Brett Cannon 175ddb5b30 Remove caching of TimeRE (and thus LocaleTime) instance. Error was being
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).
2003-07-24 06:27:17 +00:00
Raymond Hettinger 4a6302b6fe SF 748201: time.strptime() should display format and date on error
Usability fix.  Makes the error message more helpful.
2003-07-13 01:31:38 +00:00
Brett Cannon cde2200ff2 Fixes bug of timezone value being left as -1 when ``time.tzname[0] ==
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.
2003-07-03 19:59:57 +00:00
Neal Norwitz 77290f25f3 use == like all the other conditionals 2003-06-29 04:16:49 +00:00
Brett Cannon abe8eb0a30 Call time.tzset (if available) just before calculating possible timezones from time.tzname. 2003-05-13 20:28:15 +00:00
Brett Cannon 172d9ef47e Beefed up timezone support. UTC and GMT are now always recognized timezones
with values of 0.  Also now check time.daylight to see if time.tzname[1]
should be used in timezone checking.
2003-05-11 06:23:36 +00:00
Brett Cannon 2b6dfec1cc Raise a ValueError when there is data that was not covered in the format string. Done to match behavior of pre-existing C-based strptime implementations. 2003-04-28 21:30:13 +00:00
Tim Peters 0eadaac7dc Whitespace normalization. 2003-04-24 16:02:54 +00:00
Brett Cannon 1e91d8eb03 Make _strptime escape regex syntax in format string to prevent use in internal regex. 2003-04-19 04:00:56 +00:00
Raymond Hettinger 1fdb633530 SF patch #691928: Use datetime in _strptime
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.
2003-03-09 07:44:42 +00:00
Tim Peters 2c60f7a136 Whitespace normalization. 2003-01-29 03:49:43 +00:00
Tim Peters 80cebc16aa SF patch 670194: Performance enhancement for _strptime.py.
From Brett Cannon.  Mostly speedups via caching format string ->
compiled regexp.
2003-01-19 04:40:44 +00:00
Tim Peters 08e54270f2 SF patch 670012: Compatibility changes for _strptime.py.
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.
2003-01-18 03:53:49 +00:00
Jack Jansen 62fe75509c Checking in Brett Cannon's patch #662053, which fixes bug #661354.
_strptime can now handle getting two empty strings as the timezone information.
2003-01-15 22:59:39 +00:00
Neal Norwitz 5efc50d8af Fix SF #658820, regex fixes for _strptime (Brett Cannon)
Disallow zero for days and months
2002-12-30 22:23:12 +00:00
Neal Norwitz 490602d629 Fix julian day problem with strptime. Note: XXX about using 0, suggestions? 2002-12-26 16:19:52 +00:00
Martin v. Löwis e16e01fac6 Patch #639112: fixes for None locale and tz. 2002-11-27 08:30:25 +00:00
Barry Warsaw 4d895fa125 Brett's fixes for various bugs and coding issues. Closes SF patch #
593560, with some minor cleanups, line folding and whitespace
normalization by Barry.
2002-09-23 22:46:49 +00:00
Barry Warsaw 35816e6745 Many hopefully benign style clean ups. Still passes the test suite of
course.
2002-08-29 16:24:50 +00:00
Barry Warsaw 2bdb61479d strptime(): The code that was adding 12 to PM hours was incorrect
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).
2002-08-29 15:29:49 +00:00
Tim Peters 469cdad822 Whitespace normalization. 2002-08-08 20:19:19 +00:00
Guido van Rossum 00efe7e798 Pure Python strptime implementation by Brett Cannon. See SF patch 474274.
Also adds tests.
2002-07-19 17:04:46 +00:00