From 28c1a05d571d15a3c54c1dedc2ce0e503d486697 Mon Sep 17 00:00:00 2001 From: Dustin Ingram Date: Mon, 6 Feb 2023 03:53:24 -0500 Subject: [PATCH] Relax typing of _key on _BaseVersion (#669) --- src/packaging/version.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/packaging/version.py b/src/packaging/version.py index e5c738cf..b30e8cbf 100644 --- a/src/packaging/version.py +++ b/src/packaging/version.py @@ -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 @@ -63,7 +63,7 @@ class InvalidVersion(ValueError): class _BaseVersion: - _key: CmpKey + _key: Tuple[Any, ...] def __hash__(self) -> int: return hash(self._key) @@ -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.