diff --git a/my/core/common.py b/my/core/common.py index 97d4b1d..10ecacc 100644 --- a/my/core/common.py +++ b/my/core/common.py @@ -280,14 +280,24 @@ tzdatetime = datetime fromisoformat: Callable[[str], datetime] import sys -if sys.version_info.minor >= 7: +if sys.version_info[:2] >= (3, 7): # prevent mypy on py3.6 from complaining... - fromisoformat_real = datetime.fromisoformat # type: ignore[attr-defined] + fromisoformat_real = datetime.fromisoformat fromisoformat = fromisoformat_real else: from .py37 import fromisoformat +if sys.version_info[:2] >= (3, 8): + from typing import Literal +else: + if TYPE_CHECKING: + from typing_extensions import Literal + else: + # erm.. I guess as long as it's not crashing, whatever... + Literal = Union + + # TODO doctests? def isoparse(s: str) -> tzdatetime: """ diff --git a/my/time/tz/common.py b/my/time/tz/common.py index 1c2c9c9..b6ebbe5 100644 --- a/my/time/tz/common.py +++ b/my/time/tz/common.py @@ -23,7 +23,7 @@ def default_policy() -> Policy: return cast(Policy, user_config.tz.policy) except Exception as e: # todo meh.. need to think how to do this more carefully - # rationale: do not mess with user's data until they want + # rationale: do not mess with user's data unless they want return 'keep'