Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/scikit_learn-1.4.dev0-py3.8-linux-x86_64.egg/sklearn/externals/_packaging/_structures.py: 55%

40 statements  

« prev     ^ index     » next       coverage.py v7.3.2, created at 2023-12-12 06:31 +0000

1"""Vendoered from 

2https://github.com/pypa/packaging/blob/main/packaging/_structures.py 

3""" 

4# Copyright (c) Donald Stufft and individual contributors. 

5# All rights reserved. 

6 

7# Redistribution and use in source and binary forms, with or without 

8# modification, are permitted provided that the following conditions are met: 

9 

10# 1. Redistributions of source code must retain the above copyright notice, 

11# this list of conditions and the following disclaimer. 

12 

13# 2. Redistributions in binary form must reproduce the above copyright 

14# notice, this list of conditions and the following disclaimer in the 

15# documentation and/or other materials provided with the distribution. 

16 

17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 

18# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 

19# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

20# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 

21# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 

22# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 

23# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 

24# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 

25# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 

26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

27 

28 

29class InfinityType: 

30 def __repr__(self) -> str: 

31 return "Infinity" 

32 

33 def __hash__(self) -> int: 

34 return hash(repr(self)) 

35 

36 def __lt__(self, other: object) -> bool: 

37 return False 

38 

39 def __le__(self, other: object) -> bool: 

40 return False 

41 

42 def __eq__(self, other: object) -> bool: 

43 return isinstance(other, self.__class__) 

44 

45 def __ne__(self, other: object) -> bool: 

46 return not isinstance(other, self.__class__) 

47 

48 def __gt__(self, other: object) -> bool: 

49 return True 

50 

51 def __ge__(self, other: object) -> bool: 

52 return True 

53 

54 def __neg__(self: object) -> "NegativeInfinityType": 

55 return NegativeInfinity 

56 

57 

58Infinity = InfinityType() 

59 

60 

61class NegativeInfinityType: 

62 def __repr__(self) -> str: 

63 return "-Infinity" 

64 

65 def __hash__(self) -> int: 

66 return hash(repr(self)) 

67 

68 def __lt__(self, other: object) -> bool: 

69 return True 

70 

71 def __le__(self, other: object) -> bool: 

72 return True 

73 

74 def __eq__(self, other: object) -> bool: 

75 return isinstance(other, self.__class__) 

76 

77 def __ne__(self, other: object) -> bool: 

78 return not isinstance(other, self.__class__) 

79 

80 def __gt__(self, other: object) -> bool: 

81 return False 

82 

83 def __ge__(self, other: object) -> bool: 

84 return False 

85 

86 def __neg__(self: object) -> InfinityType: 

87 return Infinity 

88 

89 

90NegativeInfinity = NegativeInfinityType()