fix flake8 errors

Related: https://pagure.io/koji/issue/3480
This commit is contained in:
Tomas Kopecek 2022-08-29 10:28:28 +02:00
parent a4ae298162
commit 59f7f8642a
3 changed files with 10 additions and 10 deletions

View file

@ -106,19 +106,19 @@ def convert_value(value, cast=None, message=None,
"""
if value is None:
if not none_allowed:
raise(exc_type(message or f"Invalid type, expected type {cast}"))
raise exc_type(message or f"Invalid type, expected type {cast}")
else:
return value
if check_only:
if not isinstance(value, cast):
raise(exc_type(message or f"Invalid type for value '{value}': {type(value)}, "
f"expected type {cast}"))
raise exc_type(message or f"Invalid type for value '{value}': {type(value)}, "
f"expected type {cast}")
else:
try:
value = cast(value)
except (ValueError, TypeError):
raise(exc_type(message or f"Invalid type for value '{value}': {type(value)}, "
f"expected type {cast}"))
raise exc_type(message or f"Invalid type for value '{value}': {type(value)}, "
f"expected type {cast}")
return value
@ -6957,7 +6957,7 @@ class CG_Importer(object):
def match_kojifile(self, comp):
"""Look up the file by archive id and sanity check the other data"""
assert(comp['type'] == 'kojifile')
assert (comp['type'] == 'kojifile')
archive = get_archive(comp['archive_id'], strict=True)
build = get_build(archive['build_id'], strict=True)
@ -10044,7 +10044,7 @@ class BuildTagInheritsFromTest(koji.policy.BaseSimpleTest):
def run(self, data):
test_name, *args = self.str.split()
assert(test_name == self.name)
assert (test_name == self.name)
for tinfo in policy_get_build_tags(data, taginfo=True):
if tinfo is None:
# content generator buildroots might not have tag info

View file

@ -659,8 +659,8 @@ def check_sigmd5(filename):
data = f.read(16)
tag, data_type, offset, count = struct.unpack('!IIII', data)
if tag == 1004: # SIGMD5
assert(data_type == 7) # binary data
assert(count == 16) # 16 bytes of md5
assert (data_type == 7) # binary data
assert (count == 16) # 16 bytes of md5
break
# seek to location of md5
f.seek(o + 8 + indexcount * 16 + offset)

View file

@ -26,7 +26,7 @@ def get_install_requires():
def get_version():
cwd = os.path.dirname(__file__)
exec(open(os.path.join(cwd, 'koji/_version.py'), 'rt').read())
return(locals()['__version__'])
return locals()['__version__']
def get_long_description():