Blacken the code base.
This commit is contained in:
parent
d585c1529d
commit
07d079f204
19 changed files with 138 additions and 168 deletions
|
|
@ -12,13 +12,15 @@ class ConfigBase(object):
|
|||
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.doom.joinpath(self.config_name)
|
||||
).read()
|
||||
|
||||
self._dsda = self._config.get("dsda")
|
||||
if self._dsda is None:
|
||||
raise Exception(
|
||||
"required key 'dsda' not set in config "
|
||||
+ f"{self.doom.joinpath(self.config_name)}.")
|
||||
+ f"{self.doom.joinpath(self.config_name)}."
|
||||
)
|
||||
for d in ("iwads", "pwads", "demos", "fabricate"):
|
||||
self._init_attr([d], d, fn=self.doom.joinpath)
|
||||
|
||||
|
|
@ -29,10 +31,7 @@ class ConfigBase(object):
|
|||
self._init_attr(["thumbnail", "text_fill"], "white")
|
||||
self._init_attr(["thumbnail", "text_stroke"], "red")
|
||||
self._init_attr(["thumbnail", "overlay_name"], "M_DOOM_scaled.png")
|
||||
self._init_attr(
|
||||
["fetch", "mirror"],
|
||||
"https://youfailit.net/pub/idgames"
|
||||
)
|
||||
self._init_attr(["fetch", "mirror"], "https://youfailit.net/pub/idgames")
|
||||
|
||||
def _init_attr(self, what, default, fn=lambda x: x):
|
||||
propname = "_".join(what)
|
||||
|
|
@ -45,8 +44,7 @@ class ConfigBase(object):
|
|||
|
||||
setattr(self, f"_{propname}", fn(val))
|
||||
setattr(
|
||||
type(self), propname,
|
||||
property(lambda self: getattr(self, f"_{propname}"))
|
||||
type(self), propname, property(lambda self: getattr(self, f"_{propname}"))
|
||||
)
|
||||
|
||||
@property
|
||||
|
|
@ -65,10 +63,10 @@ class ConfigBase(object):
|
|||
def get_parser_func(toc):
|
||||
def add_common_args(self, prog_name):
|
||||
parser = super(toc, self).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
|
||||
|
||||
return add_common_args
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue