Skip to content
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

Relax typing of _key on _BaseVersion #669

Merged
merged 4 commits into from
Feb 6, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/packaging/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import collections
import itertools
import re
from typing import Callable, Optional, SupportsInt, Tuple, Union
from typing import Any, Callable, Optional, SupportsInt, Tuple, Union

from ._structures import Infinity, InfinityType, NegativeInfinity, NegativeInfinityType

Expand Down Expand Up @@ -63,7 +63,7 @@ class InvalidVersion(ValueError):


class _BaseVersion:
_key: CmpKey
_key: Tuple[Any, ...]

def __hash__(self) -> int:
return hash(self._key)
Expand Down Expand Up @@ -179,6 +179,7 @@ class Version(_BaseVersion):
"""

_regex = re.compile(r"^\s*" + VERSION_PATTERN + r"\s*$", re.VERBOSE | re.IGNORECASE)
_key: CmpKey

def __init__(self, version: str) -> None:
"""Initialize a Version object.
Expand Down