Skip to content

Commit 80d66ef

Browse files
committed
update vendoring
1 parent f970a6a commit 80d66ef

49 files changed

Lines changed: 6383 additions & 1136 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pipenv/vendor/packaging/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
__summary__ = "Core utilities for Python packages"
77
__uri__ = "https://github.com/pypa/packaging"
88

9-
__version__ = "26.0"
9+
__version__ = "26.2"
1010

1111
__author__ = "Donald Stufft and individual contributors"
1212
__email__ = "donald@stufft.io"

pipenv/vendor/packaging/_parser.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,34 @@ def __repr__(self) -> str:
2727
def serialize(self) -> str:
2828
raise NotImplementedError
2929

30+
def __getstate__(self) -> str:
31+
# Return just the value string for compactness and stability.
32+
return self.value
33+
34+
def _restore_value(self, value: object) -> None:
35+
if not isinstance(value, str):
36+
raise TypeError(
37+
f"Cannot restore {self.__class__.__name__} value from {value!r}"
38+
)
39+
self.value = value
40+
41+
def __setstate__(self, state: object) -> None:
42+
if isinstance(state, str):
43+
# New format (26.2+): just the value string.
44+
self._restore_value(state)
45+
return
46+
if isinstance(state, tuple) and len(state) == 2:
47+
# Old format (packaging <= 26.0, __slots__): (None, {slot: value}).
48+
_, slot_dict = state
49+
if isinstance(slot_dict, dict) and "value" in slot_dict:
50+
self._restore_value(slot_dict["value"])
51+
return
52+
if isinstance(state, dict) and "value" in state:
53+
# Old format (packaging <= 25.0, no __slots__): plain __dict__.
54+
self._restore_value(state["value"])
55+
return
56+
raise TypeError(f"Cannot restore {self.__class__.__name__} from {state!r}")
57+
3058

3159
class Variable(Node):
3260
__slots__ = ()

pipenv/vendor/packaging/_structures.py

Lines changed: 14 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,68 +2,32 @@
22
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
33
# for complete details.
44

5-
import typing
5+
"""Backward-compatibility shim for unpickling Version objects serialized before
6+
packaging 26.1.
7+
8+
Old pickles reference ``packaging._structures.InfinityType`` and
9+
``packaging._structures.NegativeInfinityType``. This module provides minimal
10+
stand-in classes so that ``pickle.loads()`` can resolve those references.
11+
The deserialized objects are not used for comparisons — ``Version.__setstate__``
12+
discards the stale ``_key`` cache and recomputes it from the core version fields.
13+
"""
14+
15+
from __future__ import annotations
616

717

8-
@typing.final
918
class InfinityType:
10-
__slots__ = ()
19+
"""Stand-in for the removed ``InfinityType`` used in old comparison keys."""
1120

1221
def __repr__(self) -> str:
1322
return "Infinity"
1423

15-
def __hash__(self) -> int:
16-
return hash(repr(self))
17-
18-
def __lt__(self, other: object) -> bool:
19-
return False
20-
21-
def __le__(self, other: object) -> bool:
22-
return False
23-
24-
def __eq__(self, other: object) -> bool:
25-
return isinstance(other, self.__class__)
26-
27-
def __gt__(self, other: object) -> bool:
28-
return True
29-
30-
def __ge__(self, other: object) -> bool:
31-
return True
32-
33-
def __neg__(self: object) -> "NegativeInfinityType":
34-
return NegativeInfinity
35-
36-
37-
Infinity = InfinityType()
38-
3924

40-
@typing.final
4125
class NegativeInfinityType:
42-
__slots__ = ()
26+
"""Stand-in for the removed ``NegativeInfinityType`` used in old comparison keys."""
4327

4428
def __repr__(self) -> str:
4529
return "-Infinity"
4630

47-
def __hash__(self) -> int:
48-
return hash(repr(self))
49-
50-
def __lt__(self, other: object) -> bool:
51-
return True
52-
53-
def __le__(self, other: object) -> bool:
54-
return True
55-
56-
def __eq__(self, other: object) -> bool:
57-
return isinstance(other, self.__class__)
58-
59-
def __gt__(self, other: object) -> bool:
60-
return False
61-
62-
def __ge__(self, other: object) -> bool:
63-
return False
64-
65-
def __neg__(self: object) -> InfinityType:
66-
return Infinity
67-
6831

32+
Infinity = InfinityType()
6933
NegativeInfinity = NegativeInfinityType()

pipenv/vendor/packaging/_tokenizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def __str__(self) -> str:
7575
re.VERBOSE,
7676
),
7777
"SPECIFIER": re.compile(
78-
Specifier._operator_regex_str + Specifier._version_regex_str,
78+
Specifier._specifier_regex_str,
7979
re.VERBOSE | re.IGNORECASE,
8080
),
8181
"AT": re.compile(r"\@"),

0 commit comments

Comments
 (0)