Skip to content

Commit b56f280

Browse files
committed
_vendor: Add Version object from packaging
1 parent 9731c1b commit b56f280

File tree

3 files changed

+650
-0
lines changed

3 files changed

+650
-0
lines changed

src/libvcs/_vendor/__init__.py

Whitespace-only changes.

src/libvcs/_vendor/_structures.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# via https://github.com/pypa/packaging/blob/22.0/packaging/_structures.py
2+
# This file is dual licensed under the terms of the Apache License, Version
3+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
4+
# for complete details.
5+
from __future__ import annotations
6+
7+
8+
class InfinityType:
9+
def __repr__(self) -> str:
10+
return "Infinity"
11+
12+
def __hash__(self) -> int:
13+
return hash(repr(self))
14+
15+
def __lt__(self, other: object) -> bool:
16+
return False
17+
18+
def __le__(self, other: object) -> bool:
19+
return False
20+
21+
def __eq__(self, other: object) -> bool:
22+
return isinstance(other, self.__class__)
23+
24+
def __gt__(self, other: object) -> bool:
25+
return True
26+
27+
def __ge__(self, other: object) -> bool:
28+
return True
29+
30+
def __neg__(self: object) -> NegativeInfinityType:
31+
return NegativeInfinity
32+
33+
34+
Infinity = InfinityType()
35+
36+
37+
class NegativeInfinityType:
38+
def __repr__(self) -> str:
39+
return "-Infinity"
40+
41+
def __hash__(self) -> int:
42+
return hash(repr(self))
43+
44+
def __lt__(self, other: object) -> bool:
45+
return True
46+
47+
def __le__(self, other: object) -> bool:
48+
return True
49+
50+
def __eq__(self, other: object) -> bool:
51+
return isinstance(other, self.__class__)
52+
53+
def __gt__(self, other: object) -> bool:
54+
return False
55+
56+
def __ge__(self, other: object) -> bool:
57+
return False
58+
59+
def __neg__(self: object) -> InfinityType:
60+
return Infinity
61+
62+
63+
NegativeInfinity = NegativeInfinityType()

0 commit comments

Comments
 (0)