Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.10/site-packages/packaging/_structures.py: 24%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

42 statements  

1# This file is dual licensed under the terms of the Apache License, Version 

2# 2.0, and the BSD License. See the LICENSE file in the root of this repository 

3# for complete details. 

4 

5import typing 

6 

7 

8@typing.final 

9class InfinityType: 

10 __slots__ = () 

11 

12 def __repr__(self) -> str: 

13 return "Infinity" 

14 

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 

37Infinity = InfinityType() 

38 

39 

40@typing.final 

41class NegativeInfinityType: 

42 __slots__ = () 

43 

44 def __repr__(self) -> str: 

45 return "-Infinity" 

46 

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 

68 

69NegativeInfinity = NegativeInfinityType()