move isoformat to compat, allow date, misc fixes
This commit is contained in:
parent
28fd9e4441
commit
8a8bec332e
5 changed files with 36 additions and 35 deletions
|
@ -352,21 +352,12 @@ class classproperty(Generic[_R]):
|
|||
tzdatetime = datetime
|
||||
|
||||
|
||||
fromisoformat: Callable[[str], datetime]
|
||||
import sys
|
||||
if sys.version_info[:2] >= (3, 7):
|
||||
# prevent mypy on py3.6 from complaining...
|
||||
fromisoformat_real = datetime.fromisoformat
|
||||
fromisoformat = fromisoformat_real
|
||||
else:
|
||||
from .py37 import fromisoformat
|
||||
|
||||
|
||||
# TODO doctests?
|
||||
def isoparse(s: str) -> tzdatetime:
|
||||
"""
|
||||
Parses timestamps formatted like 2020-05-01T10:32:02.925961Z
|
||||
"""
|
||||
from .compat import fromisoformat
|
||||
# TODO could use dateutil? but it's quite slow as far as I remember..
|
||||
# TODO support non-utc.. somehow?
|
||||
assert s.endswith('Z'), s
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue