Skip to content

Commit 7606fe9

Browse files
committed
Remove unused VersionDef class
This allows the comparison-with-callable pylint rule to be enabled.
1 parent cdd9e0c commit 7606fe9

3 files changed

Lines changed: 1 addition & 58 deletions

File tree

archinstall/lib/models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from .audio_configuration import Audio, AudioConfiguration
22
from .bootloader import Bootloader
3-
from .gen import LocalPackage, PackageSearch, PackageSearchResult, VersionDef
3+
from .gen import LocalPackage, PackageSearch, PackageSearchResult
44
from .network_configuration import NetworkConfiguration, Nic, NicType
55
from .users import PasswordStrength, User

archinstall/lib/models/gen.py

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,6 @@
22
from typing import Any
33

44

5-
@dataclass
6-
class VersionDef:
7-
version_string: str
8-
9-
@classmethod
10-
def parse_version(cls) -> list[str]:
11-
if '.' in cls.version_string:
12-
versions = cls.version_string.split('.')
13-
else:
14-
versions = [cls.version_string]
15-
16-
return versions
17-
18-
@classmethod
19-
def major(self) -> str:
20-
return self.parse_version()[0]
21-
22-
@classmethod
23-
def minor(cls) -> str | None:
24-
versions = cls.parse_version()
25-
if len(versions) >= 2:
26-
return versions[1]
27-
28-
return None
29-
30-
@classmethod
31-
def patch(cls) -> str | None:
32-
versions = cls.parse_version()
33-
if '-' in versions[-1]:
34-
_, patch_version = versions[-1].split('-', 1)
35-
return patch_version
36-
37-
return None
38-
39-
def __eq__(self, other) -> bool:
40-
if other.major == self.major and \
41-
other.minor == self.minor and \
42-
other.patch == self.patch:
43-
44-
return True
45-
return False
46-
47-
def __lt__(self, other) -> bool:
48-
if self.major() > other.major():
49-
return False
50-
elif self.minor() and other.minor() and self.minor() > other.minor():
51-
return False
52-
elif self.patch() and other.patch() and self.patch() > other.patch():
53-
return False
54-
55-
return True
56-
57-
def __str__(self) -> str:
58-
return self.version_string
59-
60-
615
@dataclass
626
class PackageSearchResult:
637
pkgname: str

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ disable = [
160160
"bare-except",
161161
"broad-exception-caught",
162162
"cell-var-from-loop",
163-
"comparison-with-callable",
164163
"dangerous-default-value",
165164
"fixme",
166165
"protected-access",

0 commit comments

Comments
 (0)