aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaron de Leeuw <me@jarondl.net>2014-12-01 22:01:11 +0200
committerYaron de Leeuw <me@jarondl.net>2014-12-01 22:01:11 +0200
commit3c316b5722c01fd1e8be9cdbb1173904083fc1e3 (patch)
treef9d95d78a769343ff4385f7a031e916e66bd75b2
parent683c66e173f9b86d5bc274302dd5fcbf1a717fd7 (diff)
downloaddateutil-3c316b5722c01fd1e8be9cdbb1173904083fc1e3.tar.gz
more pep8 and style edits
-rw-r--r--LICENSE3
-rw-r--r--README.rst6
-rw-r--r--dateutil/tz.py32
-rw-r--r--dateutil/tzwin.py30
-rwxr-xr-xsetup.py37
5 files changed, 55 insertions, 53 deletions
diff --git a/LICENSE b/LICENSE
index 5834335..2fc67ab 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,7 +1,8 @@
dateutil - Extensions to the standard Python datetime module.
Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
-Copyright (c) 2012 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
+Copyright (c) 2012-2014 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
+Copyright (c) 2014 - Yaron de Leeuw <me@jarondl.net>
All rights reserved.
diff --git a/README.rst b/README.rst
index 3d48ebf..e04bff8 100644
--- a/README.rst
+++ b/README.rst
@@ -80,9 +80,9 @@ in 2003
It is maintained by:
-* Gustavo Niemeyer <gustavo@niemeyer.net> 2003-2013
-* Tomi Pieviläinen <tomi.pievilainen@iki.fi> 2013-2014
-* Yaron de Leeuw <me@jarond.net> 2014-
+* Gustavo Niemeyer <gustavo@niemeyer.net> 2003-2011
+* Tomi Pieviläinen <tomi.pievilainen@iki.fi> 2012-2014
+* Yaron de Leeuw <me@jarondl.net> 2014-
Building and releasing
======================
diff --git a/dateutil/tz.py b/dateutil/tz.py
index 6ccace8..50a1836 100644
--- a/dateutil/tz.py
+++ b/dateutil/tz.py
@@ -246,27 +246,27 @@ class tzfile(datetime.tzinfo):
fileobj.read(16)
(
- # The number of UTC/local indicators stored in the file.
- ttisgmtcnt,
+ # The number of UTC/local indicators stored in the file.
+ ttisgmtcnt,
- # The number of standard/wall indicators stored in the file.
- ttisstdcnt,
+ # The number of standard/wall indicators stored in the file.
+ ttisstdcnt,
- # The number of leap seconds for which data is
- # stored in the file.
- leapcnt,
+ # The number of leap seconds for which data is
+ # stored in the file.
+ leapcnt,
- # The number of "transition times" for which data
- # is stored in the file.
- timecnt,
+ # The number of "transition times" for which data
+ # is stored in the file.
+ timecnt,
- # The number of "local time types" for which data
- # is stored in the file (must not be zero).
- typecnt,
+ # The number of "local time types" for which data
+ # is stored in the file (must not be zero).
+ typecnt,
- # The number of characters of "time zone
- # abbreviation strings" stored in the file.
- charcnt,
+ # The number of characters of "time zone
+ # abbreviation strings" stored in the file.
+ charcnt,
) = struct.unpack(">6l", fileobj.read(24))
diff --git a/dateutil/tzwin.py b/dateutil/tzwin.py
index c02cd3e..4276930 100644
--- a/dateutil/tzwin.py
+++ b/dateutil/tzwin.py
@@ -1,7 +1,6 @@
# This code was originally contributed by Jeffrey Harris.
import datetime
import struct
-import warnings
from six.moves import winreg
@@ -26,6 +25,7 @@ def _settzkeyname():
TZKEYNAME = _settzkeyname()
+
class tzwinbase(datetime.tzinfo):
"""tzinfo class based on win32's timezones available in the registry."""
@@ -93,18 +93,18 @@ class tzwin(tzwinbase):
# See http://ww_winreg.jsiinc.com/SUBA/tip0300/rh0398.htm
tup = struct.unpack("=3l16h", keydict["TZI"])
- self._stdoffset = -tup[0]-tup[1] # Bias + StandardBias * -1
- self._dstoffset = self._stdoffset-tup[2] # + DaylightBias * -1
+ self._stdoffset = -tup[0]-tup[1] # Bias + StandardBias * -1
+ self._dstoffset = self._stdoffset-tup[2] # + DaylightBias * -1
(self._stdmonth,
- self._stddayofweek, # Sunday = 0
- self._stdweeknumber, # Last = 5
+ self._stddayofweek, # Sunday = 0
+ self._stdweeknumber, # Last = 5
self._stdhour,
self._stdminute) = tup[4:9]
(self._dstmonth,
- self._dstdayofweek, # Sunday = 0
- self._dstweeknumber, # Last = 5
+ self._dstdayofweek, # Sunday = 0
+ self._dstweeknumber, # Last = 5
self._dsthour,
self._dstminute) = tup[12:17]
@@ -129,7 +129,8 @@ class tzwinlocal(tzwinbase):
self._dstname = keydict["DaylightName"].encode("iso-8859-1")
try:
- tzkey = winreg.OpenKey(handle, "%s\%s"%(TZKEYNAME, self._stdname))
+ tzkey = winreg.OpenKey(handle, "%s\%s" % (TZKEYNAME,
+ self._stdname))
_keydict = valuestodict(tzkey)
self._display = _keydict["Display"]
tzkey.Close()
@@ -141,36 +142,37 @@ class tzwinlocal(tzwinbase):
self._stdoffset = -keydict["Bias"]-keydict["StandardBias"]
self._dstoffset = self._stdoffset-keydict["DaylightBias"]
-
# See http://ww_winreg.jsiinc.com/SUBA/tip0300/rh0398.htm
tup = struct.unpack("=8h", keydict["StandardStart"])
(self._stdmonth,
- self._stddayofweek, # Sunday = 0
- self._stdweeknumber, # Last = 5
+ self._stddayofweek, # Sunday = 0
+ self._stdweeknumber, # Last = 5
self._stdhour,
self._stdminute) = tup[1:6]
tup = struct.unpack("=8h", keydict["DaylightStart"])
(self._dstmonth,
- self._dstdayofweek, # Sunday = 0
- self._dstweeknumber, # Last = 5
+ self._dstdayofweek, # Sunday = 0
+ self._dstweeknumber, # Last = 5
self._dsthour,
self._dstminute) = tup[1:6]
def __reduce__(self):
return (self.__class__, ())
+
def picknthweekday(year, month, dayofweek, hour, minute, whichweek):
"""dayofweek == 0 means Sunday, whichweek 5 means last instance"""
first = datetime.datetime(year, month, 1, hour, minute)
- weekdayone = first.replace(day=((dayofweek-first.isoweekday())%7+1))
+ weekdayone = first.replace(day=((dayofweek-first.isoweekday()) % 7+1))
for n in range(whichweek):
dt = weekdayone+(whichweek-n)*ONEWEEK
if dt.month == month:
return dt
+
def valuestodict(key):
"""Convert a registry key's values to a dictionary."""
dict = {}
diff --git a/setup.py b/setup.py
index b50637c..2f7a9c5 100755
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,6 @@
#!/usr/bin/python
-from os.path import isfile, join
+from os.path import isfile
import codecs
-import glob
import os
import re
@@ -14,27 +13,27 @@ if isfile("MANIFEST"):
TOPDIR = os.path.dirname(__file__) or "."
VERSION = re.search('__version__ = "([^"]+)"',
- codecs.open(TOPDIR + "/dateutil/__init__.py", encoding='utf-8').read()).group(1)
+ codecs.open(TOPDIR + "/dateutil/__init__.py",
+ encoding='utf-8').read()).group(1)
setup(name="python-dateutil",
- version = VERSION,
- description = "Extensions to the standard Python datetime module",
- author = "Yaron de Leeuw",
- author_email = "me@jarondl.net",
- url = "https://dateutil.readthedocs.org",
- license = "Simplified BSD",
- long_description =
-"""\
-The dateutil module provides powerful extensions to the
+ version=VERSION,
+ description="Extensions to the standard Python datetime module",
+ author="Yaron de Leeuw",
+ author_email="me@jarondl.net",
+ url="https://dateutil.readthedocs.org",
+ license="Simplified BSD",
+ long_description="""
+The dateutil module provides powerful extensions to the
datetime module available in the Python standard library.
""",
- packages = ["dateutil", "dateutil.zoneinfo"],
- package_data = {"dateutil.zoneinfo": ["dateutil-zoneinfo.tar.gz"]},
- zip_safe = True,
- requires = ["six"],
- install_requires = ["six"], # XXX fix when packaging is sane again
- classifiers = [
+ packages=["dateutil", "dateutil.zoneinfo"],
+ package_data={"dateutil.zoneinfo": ["dateutil-zoneinfo.tar.gz"]},
+ zip_safe=True,
+ requires=["six"],
+ install_requires=["six"], # XXX fix when packaging is sane again
+ classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
@@ -48,5 +47,5 @@ datetime module available in the Python standard library.
'Programming Language :: Python :: 3.4',
'Topic :: Software Development :: Libraries',
],
- test_suite = "dateutil.test.test"
+ test_suite="dateutil.test.test"
)