Voice et bot modif
This commit is contained in:
parent
189d56026b
commit
7333a22bcd
10774 changed files with 634644 additions and 933308 deletions
|
|
@ -2,68 +2,32 @@
|
|||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
import typing
|
||||
"""Backward-compatibility shim for unpickling Version objects serialized before
|
||||
packaging 26.1.
|
||||
|
||||
Old pickles reference ``packaging._structures.InfinityType`` and
|
||||
``packaging._structures.NegativeInfinityType``. This module provides minimal
|
||||
stand-in classes so that ``pickle.loads()`` can resolve those references.
|
||||
The deserialized objects are not used for comparisons — ``Version.__setstate__``
|
||||
discards the stale ``_key`` cache and recomputes it from the core version fields.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
@typing.final
|
||||
class InfinityType:
|
||||
__slots__ = ()
|
||||
"""Stand-in for the removed ``InfinityType`` used in old comparison keys."""
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return "Infinity"
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return hash(repr(self))
|
||||
|
||||
def __lt__(self, other: object) -> bool:
|
||||
return False
|
||||
|
||||
def __le__(self, other: object) -> bool:
|
||||
return False
|
||||
|
||||
def __eq__(self, other: object) -> bool:
|
||||
return isinstance(other, self.__class__)
|
||||
|
||||
def __gt__(self, other: object) -> bool:
|
||||
return True
|
||||
|
||||
def __ge__(self, other: object) -> bool:
|
||||
return True
|
||||
|
||||
def __neg__(self: object) -> "NegativeInfinityType":
|
||||
return NegativeInfinity
|
||||
|
||||
|
||||
Infinity = InfinityType()
|
||||
|
||||
|
||||
@typing.final
|
||||
class NegativeInfinityType:
|
||||
__slots__ = ()
|
||||
"""Stand-in for the removed ``NegativeInfinityType`` used in old comparison keys."""
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return "-Infinity"
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return hash(repr(self))
|
||||
|
||||
def __lt__(self, other: object) -> bool:
|
||||
return True
|
||||
|
||||
def __le__(self, other: object) -> bool:
|
||||
return True
|
||||
|
||||
def __eq__(self, other: object) -> bool:
|
||||
return isinstance(other, self.__class__)
|
||||
|
||||
def __gt__(self, other: object) -> bool:
|
||||
return False
|
||||
|
||||
def __ge__(self, other: object) -> bool:
|
||||
return False
|
||||
|
||||
def __neg__(self: object) -> InfinityType:
|
||||
return Infinity
|
||||
|
||||
|
||||
Infinity = InfinityType()
|
||||
NegativeInfinity = NegativeInfinityType()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue