1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-19 21:30:10 +01:00

work towards switching fdroidserver/metadata.py to black

This commit is contained in:
Hans-Christoph Steiner 2023-04-24 14:46:03 +02:00
parent e5fda54693
commit e794ccb38c

View File

@ -397,8 +397,13 @@ class FieldValidator:
values = [v]
for v in values:
if not self.compiled.match(v):
_warn_or_exception(_("'{value}' is not a valid {field} in {appid}. Regex pattern: {pattern}")
.format(value=v, field=self.name, appid=appid, pattern=self.matching))
_warn_or_exception(
_(
"'{value}' is not a valid {field} in {appid}. Regex pattern: {pattern}"
).format(
value=v, field=self.name, appid=appid, pattern=self.matching
)
)
# Generic value types
@ -469,16 +474,14 @@ def check_metadata(app):
def parse_yaml_srclib(metadatapath):
thisinfo = {'RepoType': '',
'Repo': '',
'Subdir': None,
'Prepare': None}
thisinfo = {'RepoType': '', 'Repo': '', 'Subdir': None, 'Prepare': None}
if not metadatapath.exists():
_warn_or_exception(_("Invalid scrlib metadata: '{file}' "
"does not exist"
.format(file=metadatapath)))
_warn_or_exception(
_("Invalid scrlib metadata: '{file}' does not exist").format(
file=metadatapath
)
)
return thisinfo
with metadatapath.open("r", encoding="utf-8") as f:
@ -984,5 +987,9 @@ def write_metadata(metadatapath, app):
def add_metadata_arguments(parser):
"""Add common command line flags related to metadata processing."""
parser.add_argument("-W", choices=['error', 'warn', 'ignore'], default='error',
help=_("force metadata errors (default) to be warnings, or to be ignored."))
parser.add_argument(
"-W",
choices=['error', 'warn', 'ignore'],
default='error',
help=_("force metadata errors (default) to be warnings, or to be ignored."),
)