PEP 8 compliance.
This commit is contained in:
parent
e8d06c616f
commit
ff384678de
1 changed files with 48 additions and 43 deletions
|
@ -18,17 +18,21 @@ MIRROR="https://youfailit.net/pub/idgames" # NYC
|
|||
class Base(Command):
|
||||
def get_parser(self, prog_name):
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument('--doom', default=pathlib.Path.home().joinpath("doom"))
|
||||
parser.add_argument(
|
||||
'--doom', default=pathlib.Path.home().joinpath("doom"))
|
||||
parser.add_argument('--config-name', default='config.toml')
|
||||
return parser
|
||||
|
||||
def init_base(self, parsed_args):
|
||||
self._doom = pathlib.Path(parsed_args.doom)
|
||||
self._config_name = parsed_args.config_name
|
||||
self._config = tomlkit.toml_file.TOMLFile(self.doom.joinpath(self.config_name)).read()
|
||||
self._config = tomlkit.toml_file.TOMLFile(
|
||||
self.doom.joinpath(self.config_name)).read()
|
||||
self._dsda = self._config.get("dsda")
|
||||
if self.dsda is None:
|
||||
raise Exception(f"required key 'dsda' not set in config {self.doom.joinpath(self.config_name)}.")
|
||||
raise Exception(
|
||||
"required key 'dsda' not set in config "
|
||||
+ f"{self.doom.joinpath(self.config_name)}.")
|
||||
for d in ("iwads", "pwads", "demos", "fabricate"):
|
||||
self._init_path(d)
|
||||
|
||||
|
@ -37,8 +41,10 @@ class Base(Command):
|
|||
self.take_action(parsed_args)
|
||||
|
||||
def _init_path(self, what):
|
||||
setattr(self, f"_{what}", self.doom.joinpath(self._config.get(what, what)))
|
||||
setattr(type(self), what, property(lambda self: getattr(self, f"_{what}")))
|
||||
setattr(
|
||||
self, f"_{what}", self.doom.joinpath(self._config.get(what, what)))
|
||||
setattr(
|
||||
type(self), what, property(lambda self: getattr(self, f"_{what}")))
|
||||
|
||||
@property
|
||||
def doom(self):
|
||||
|
@ -59,4 +65,3 @@ class Base(Command):
|
|||
with io.open(iwadpath) as f:
|
||||
iwad = self.iwads.joinpath(f.read().strip() + ".WAD")
|
||||
return iwad
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue