-
-
Notifications
You must be signed in to change notification settings - Fork 426
Mypy improvement #677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mypy improvement #677
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ | |
| from pendulum.mixins.default import FormattableMixin | ||
|
|
||
| if TYPE_CHECKING: | ||
| from typing import Literal | ||
| from pendulum.utils._compat import Literal | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be changed to |
||
|
|
||
|
|
||
| class Time(FormattableMixin, time): | ||
|
|
@@ -292,7 +292,7 @@ def __reduce__( | |
| ) -> tuple[type[Time], tuple[int, int, int, int, datetime.tzinfo | None]]: | ||
| return self.__reduce_ex__(2) | ||
|
|
||
| def __reduce_ex__( # type: ignore[override] | ||
| def __reduce_ex__( | ||
| self, protocol: int | ||
| ) -> tuple[type[Time], tuple[int, int, int, int, datetime.tzinfo | None]]: | ||
| return self.__class__, self._get_state(protocol) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,8 +6,20 @@ | |
| PY38 = sys.version_info[:2] >= (3, 8) | ||
|
|
||
| if sys.version_info < (3, 9): | ||
| import importlib_resources as resources | ||
|
|
||
| from backports import zoneinfo | ||
| else: | ||
| import zoneinfo | ||
|
|
||
| __all__ = ["zoneinfo"] | ||
| from importlib import resources | ||
|
|
||
|
|
||
| if sys.version_info < (3, 8): | ||
| from typing_extensions import Literal | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aliasing things like
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are only supporting
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| from typing_extensions import SupportsIndex | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably not 😆. I will need to rework this PR anyway since typing fails depending on the version of Python it's run on. |
||
| else: | ||
| from typing import Literal | ||
| from typing import SupportsIndex | ||
|
|
||
| __all__ = ["zoneinfo", "resources", "SupportsIndex", "Literal"] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be changed to
from typing_extensions import Literalso that pyright is supported