@@ -44,7 +44,7 @@ def wrapper(self: "Spec", other: SpecComparable) -> bool:
44
44
if not isinstance (other , comparable_types ):
45
45
return NotImplemented
46
46
# For compatible types, convert them to Version instance:
47
- if isinstance (other , String .__args__ ): # type: ignore
47
+ if isinstance (other , String .__args__ ): # type: ignore
48
48
other = Version .parse (cast (String , other ))
49
49
if isinstance (other , dict ):
50
50
other = Version (** other )
@@ -129,8 +129,7 @@ class however, only ``*`` is used regardless what you used before.
129
129
"""
130
130
131
131
_regex = re .compile (
132
- rf"{ _operator_regex_str } ?\s*{ _version_regex_str } " ,
133
- re .VERBOSE | re .IGNORECASE
132
+ rf"{ _operator_regex_str } ?\s*{ _version_regex_str } " , re .VERBOSE | re .IGNORECASE
134
133
)
135
134
136
135
_regex_version_any = re .compile (_version_any , re .VERBOSE | re .IGNORECASE )
@@ -200,7 +199,7 @@ def __init__(self, spec: Union[str, bytes]) -> None:
200
199
]
201
200
202
201
# This is the special case for 1 -> 1.0.0
203
- if ( minor is None and patch is None ) :
202
+ if minor is None and patch is None :
204
203
self .real_version_tuple [1 :3 ] = (0 , 0 )
205
204
elif (minor not in placeholders ) and (patch is None ):
206
205
self .real_version_tuple [2 ] = 0
@@ -309,61 +308,55 @@ def __eq__(self, other: SpecComparable) -> bool: # type: ignore
309
308
"""self == other."""
310
309
# Find the position of the first "*"
311
310
index = self .__get_index ()
312
- version = tuple ([
313
- int (cast (int , item ))
314
- for item in self .real_version_tuple [:index ]
315
- ])
311
+ version = tuple (
312
+ [int (cast (int , item )) for item in self .real_version_tuple [:index ]]
313
+ )
316
314
317
315
return cast (Version , other [:index ]) == version
318
316
319
317
@preparecomparison
320
318
def __ne__ (self , other : SpecComparable ) -> bool : # type: ignore
321
319
"""self != other."""
322
320
index = self .__get_index ()
323
- version = tuple ([
324
- int (cast (int , item ))
325
- for item in self .real_version_tuple [:index ]
326
- ])
321
+ version = tuple (
322
+ [int (cast (int , item )) for item in self .real_version_tuple [:index ]]
323
+ )
327
324
return cast (Version , other [:index ]) != version
328
325
329
326
@preparecomparison
330
327
def __lt__ (self , other : SpecComparable ) -> bool :
331
328
"""self < other."""
332
329
index : Optional [int ] = self .__get_index ()
333
- version = tuple ([
334
- int (cast (int , item ))
335
- for item in self .real_version_tuple [:index ]
336
- ])
330
+ version = tuple (
331
+ [int (cast (int , item )) for item in self .real_version_tuple [:index ]]
332
+ )
337
333
return cast (Version , other [:index ]) < version
338
334
339
335
@preparecomparison
340
336
def __gt__ (self , other : SpecComparable ) -> bool :
341
337
"""self > other."""
342
338
index = self .__get_index ()
343
- version = tuple ([
344
- int (cast (int , item ))
345
- for item in self .real_version_tuple [:index ]
346
- ])
339
+ version = tuple (
340
+ [int (cast (int , item )) for item in self .real_version_tuple [:index ]]
341
+ )
347
342
return cast (Version , other [:index ]) > version
348
343
349
344
@preparecomparison
350
345
def __le__ (self , other : SpecComparable ) -> bool :
351
346
"""self <= other."""
352
347
index = self .__get_index ()
353
- version = tuple ([
354
- int (cast (int , item ))
355
- for item in self .real_version_tuple [:index ]
356
- ])
348
+ version = tuple (
349
+ [int (cast (int , item )) for item in self .real_version_tuple [:index ]]
350
+ )
357
351
return cast (Version , other [:index ]) <= version
358
352
359
353
@preparecomparison
360
354
def __ge__ (self , other : SpecComparable ) -> bool :
361
355
"""self >= other."""
362
356
index = self .__get_index ()
363
- version = tuple ([
364
- int (cast (int , item ))
365
- for item in self .real_version_tuple [:index ]
366
- ])
357
+ version = tuple (
358
+ [int (cast (int , item )) for item in self .real_version_tuple [:index ]]
359
+ )
367
360
return cast (Version , other [:index ]) >= version
368
361
369
362
# @preparecomparison
@@ -391,7 +384,8 @@ def _tilde(self, other: SpecComparable) -> bool:
391
384
str (int (major ) + 1 if length == 1 else major ),
392
385
str (int (minor ) + 1 if length >= 2 else minor ),
393
386
"0" ,
394
- ])
387
+ ]
388
+ )
395
389
# print("> tilde", length, u_version)
396
390
397
391
# Delegate it to other
0 commit comments