@@ -81,7 +81,7 @@ def __str__(self) -> str:
8181 simplified = self ._simplified_form
8282 if simplified is not None :
8383 return simplified
84- return f' { ">=" if self .include_min else ">" } { self .min } ,{ "<=" if self .include_max else "<" } { self .max } '
84+ return f" { '>=' if self .include_min else '>' } { self .min } ,{ '<=' if self .include_max else '<' } { self .max } "
8585
8686 def contains (
8787 self , version : UnparsedVersion , prereleases : bool | None = None
@@ -115,11 +115,8 @@ def allows_lower(self, other: RangeSpecifier) -> bool:
115115 if self .min is None :
116116 return True
117117
118- return (
119- self .min < other .min
120- or self .min == other .min
121- and self .include_min
122- and not other .include_min
118+ return self .min < other .min or (
119+ self .min == other .min and self .include_min and not other .include_min
123120 )
124121
125122 def allows_higher (self , other : RangeSpecifier ) -> bool :
@@ -128,11 +125,8 @@ def allows_higher(self, other: RangeSpecifier) -> bool:
128125 if self .max is None :
129126 return True
130127
131- return (
132- self .max > other .max
133- or self .max == other .max
134- and self .include_max
135- and not other .include_max
128+ return self .max > other .max or (
129+ self .max == other .max and self .include_max and not other .include_max
136130 )
137131
138132 def is_strictly_lower (self , other : RangeSpecifier ) -> bool :
@@ -142,10 +136,8 @@ def is_strictly_lower(self, other: RangeSpecifier) -> bool:
142136 if self .max is None or other .min is None :
143137 return False
144138
145- return (
146- self .max < other .min
147- or self .max == other .min
148- and False in (self .include_max , other .include_min )
139+ return self .max < other .min or (
140+ self .max == other .min and False in (self .include_max , other .include_min )
149141 )
150142
151143 def is_adjacent_to (self , other : RangeSpecifier ) -> bool :
@@ -162,22 +154,24 @@ def __lt__(self, other: Any) -> bool:
162154 return self .allows_lower (other )
163155
164156 def is_superset (self , other : RangeSpecifier ) -> bool :
165- min_lower = (
166- self .min is None
167- or other .min is not None
157+ min_lower = self .min is None or (
158+ other .min is not None
168159 and (
169160 self .min < other .min
170- or self .min == other .min
171- and not (not self .include_min and other .include_min )
161+ or (
162+ self .min == other .min
163+ and not (not self .include_min and other .include_min )
164+ )
172165 )
173166 )
174- max_higher = (
175- self .max is None
176- or other .max is not None
167+ max_higher = self .max is None or (
168+ other .max is not None
177169 and (
178170 self .max > other .max
179- or self .max == other .max
180- and not (not self .include_max and other .include_max )
171+ or (
172+ self .max == other .max
173+ and not (not self .include_max and other .include_max )
174+ )
181175 )
182176 )
183177 return min_lower and max_higher
0 commit comments