@@ -81,7 +81,7 @@ def __str__(self) -> str:
81
81
simplified = self ._simplified_form
82
82
if simplified is not None :
83
83
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 } "
85
85
86
86
def contains (
87
87
self , version : UnparsedVersion , prereleases : bool | None = None
@@ -115,11 +115,8 @@ def allows_lower(self, other: RangeSpecifier) -> bool:
115
115
if self .min is None :
116
116
return True
117
117
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
123
120
)
124
121
125
122
def allows_higher (self , other : RangeSpecifier ) -> bool :
@@ -128,11 +125,8 @@ def allows_higher(self, other: RangeSpecifier) -> bool:
128
125
if self .max is None :
129
126
return True
130
127
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
136
130
)
137
131
138
132
def is_strictly_lower (self , other : RangeSpecifier ) -> bool :
@@ -142,10 +136,8 @@ def is_strictly_lower(self, other: RangeSpecifier) -> bool:
142
136
if self .max is None or other .min is None :
143
137
return False
144
138
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 )
149
141
)
150
142
151
143
def is_adjacent_to (self , other : RangeSpecifier ) -> bool :
@@ -162,22 +154,24 @@ def __lt__(self, other: Any) -> bool:
162
154
return self .allows_lower (other )
163
155
164
156
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
168
159
and (
169
160
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
+ )
172
165
)
173
166
)
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
177
169
and (
178
170
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
+ )
181
175
)
182
176
)
183
177
return min_lower and max_higher
0 commit comments