Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove pytz Everything that pytz was being utilised for can be serviced perfectly fine by the standard library. Meanwhile, pytz is known as a footgun: https://blog.ganssle.io/articles/2018/03/pytz-fastest-footgun.html * Introduce compatibility timezone code for python2
- Loading branch information
1 parent
8c18750
commit 196b5f5
Showing
8 changed files
with
72 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""Compatibility shim for python2's lack of datetime.timezone. | ||
This is the example code from the Python 2 documentation: | ||
https://docs.python.org/2.7/library/datetime.html#tzinfo-objects | ||
""" | ||
|
||
from datetime import tzinfo, timedelta | ||
|
||
|
||
ZERO = timedelta(0) | ||
|
||
|
||
class UTC(tzinfo): | ||
"""UTC""" | ||
|
||
def utcoffset(self, dt): | ||
return ZERO | ||
|
||
def tzname(self, dt): | ||
return "UTC" | ||
|
||
def dst(self, dt): | ||
return ZERO | ||
|
||
|
||
utc = UTC() | ||
|
||
|
||
class timezone: | ||
utc = utc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters