pylint fixes
This commit is contained in:
parent
352e087518
commit
b4b5b672c6
2 changed files with 37 additions and 9 deletions
|
@ -0,0 +1,6 @@
|
||||||
|
[MESSAGES CONTROL]
|
||||||
|
disable=
|
||||||
|
missing-module-docstring,
|
||||||
|
missing-function-docstring,
|
||||||
|
line-too-long,
|
||||||
|
too-many-arguments,
|
|
@ -7,6 +7,19 @@ from semver import Version
|
||||||
logger = getLogger(__name__)
|
logger = getLogger(__name__)
|
||||||
|
|
||||||
class Mod:
|
class Mod:
|
||||||
|
"""This class represents a Stellaris mod's descriptor file.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
name (str): The name of the mod.
|
||||||
|
path (PathLike): The path to the mod's directory.
|
||||||
|
dependencies (List[str]): A list of the mod's dependencies.
|
||||||
|
picture (PathLike): The path to the mod's thumbnail picture.
|
||||||
|
tags (List[str]): A list of the mod's tags.
|
||||||
|
version (str): The mod's version.
|
||||||
|
supported_version (StellarisVersion): The version of Stellaris the mod supports.
|
||||||
|
remote_file_id (int): The mod's remote file ID.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
|
@ -61,6 +74,14 @@ class Mod:
|
||||||
}
|
}
|
||||||
|
|
||||||
class StellarisVersion(Version):
|
class StellarisVersion(Version):
|
||||||
|
"""This class represents a Stellaris version.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
major (int): The major version number.
|
||||||
|
minor (int): The minor version number.
|
||||||
|
patch (int): The patch version number.
|
||||||
|
codename (str): The codename of the version.
|
||||||
|
"""
|
||||||
def __init__(self, **kwargs) -> None:
|
def __init__(self, **kwargs) -> None:
|
||||||
# Build a dictionary of the arguments except prerelease and build
|
# Build a dictionary of the arguments except prerelease and build
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
@ -117,22 +138,23 @@ class StellarisVersion(Version):
|
||||||
return (self.codename, self.major, self.minor, self.patch, self.prerelease, self.build)
|
return (self.codename, self.major, self.minor, self.patch, self.prerelease, self.build)
|
||||||
|
|
||||||
def to_dict(self) -> dict:
|
def to_dict(self) -> dict:
|
||||||
return dict(
|
return {
|
||||||
codename=self.codename,
|
"codename": self.codename,
|
||||||
major=self.major,
|
"major": self.major,
|
||||||
minor=self.minor,
|
"minor": self.minor,
|
||||||
patch=self.patch,
|
"patch": self.patch,
|
||||||
prerelease=self.prerelease,
|
"prerelease": self.prerelease,
|
||||||
build=self.build,
|
"build": self.build
|
||||||
)
|
}
|
||||||
|
|
||||||
def parse(path: PathLike) -> Mod:
|
def parse(path: PathLike) -> Mod:
|
||||||
|
"""Parse a Stellaris mod descriptor file into a Mod object."""
|
||||||
config = {}
|
config = {}
|
||||||
current_key = None
|
current_key = None
|
||||||
in_multiline_value = False
|
in_multiline_value = False
|
||||||
multiline_value = []
|
multiline_value = []
|
||||||
|
|
||||||
with open(path, 'r') as file:
|
with open(path, 'r', encoding='UTF-8') as file:
|
||||||
lines = file.readlines()
|
lines = file.readlines()
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
|
Loading…
Reference in a new issue