Skip to content

Commit a0be473

Browse files
committed
refactor: resolve or silence further linting issues
1 parent 9083ea5 commit a0be473

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

version_query/version.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
@enum.unique
1919
class VersionComponent(enum.IntEnum):
2020
"""Enumeration of standard version components."""
21+
# pylint: disable = invalid-name
2122

2223
Major = 1 << 1
2324
Minor = 1 << 2
@@ -29,10 +30,10 @@ class VersionComponent(enum.IntEnum):
2930

3031

3132
def _version_tuple_checker(version_tuple, flags):
32-
return all([(_ is not None if flag else _ is None) for _, flag in zip(version_tuple, flags)])
33+
return all((_ is not None if flag else _ is None) for _, flag in zip(version_tuple, flags))
3334

3435

35-
class Version(collections.abc.Hashable): # pylint: disable = too-many-public-methods
36+
class Version(collections.abc.Hashable): # pylint: disable = too-many-public-methods, too-many-instance-attributes
3637
"""For storing and manipulating version information.
3738
3839
Definitions of acceptable version formats are provided in readme.
@@ -202,7 +203,7 @@ def from_sem_version(cls, sem_version: t.Union[dict, semver.VersionInfo]):
202203
def from_version(cls, version: 'Version'):
203204
return cls.from_dict(version.to_dict())
204205

205-
def __init__(
206+
def __init__( # pylint: disable = keyword-arg-before-vararg, too-many-arguments
206207
self, major: int, minor: t.Optional[int] = None, patch: t.Optional[int] = None, *args,
207208
pre_release: t.Optional[t.Sequence[
208209
t.Tuple[t.Optional[str], t.Optional[str], t.Optional[int]]]] = None,
@@ -503,13 +504,13 @@ def _pre_release_segment_to_str(self, segment: int) -> str:
503504
assert self._pre_release is not None
504505
version_tuple = self._pre_release[segment]
505506
if _version_tuple_checker(version_tuple, (True, True, False)):
506-
return '{}{}'.format(*version_tuple[:2])
507+
return '{}{}'.format(*version_tuple[:2]) # pylint: disable = consider-using-f-string
507508
if _version_tuple_checker(version_tuple, (True, False, True)):
508509
return f'{version_tuple[0]}{version_tuple[2]}'
509510
if _version_tuple_checker(version_tuple, (False, True, True)):
510-
return '{}{}'.format(*version_tuple[1:])
511+
return '{}{}'.format(*version_tuple[1:]) # pylint: disable = consider-using-f-string
511512
if _version_tuple_checker(version_tuple, (True, True, True)):
512-
return '{}{}{}'.format(*version_tuple)
513+
return '{}{}{}'.format(*version_tuple) # pylint: disable = consider-using-f-string
513514
raise ValueError(f'cannot generate valid version string from {repr(self)}')
514515

515516
def pre_release_to_str(self) -> str:

0 commit comments

Comments
 (0)