Only have one statement in a line E701

https://www.flake8rules.com/rules/E701.html
This commit is contained in:
Stephan Kulow 2022-02-18 13:42:57 +01:00
parent 52dbb52b7f
commit f705a24db1
8 changed files with 37 additions and 19 deletions

View File

@ -1,4 +1,4 @@
[flake8] [flake8]
exclude = abichecker exclude = abichecker
max-line-length = 100 max-line-length = 100
ignore = E501,F401,E128,E251,E201,E202,E302,E305,F841,E261,E712,E126,E711,E125,E123,E101,E124,E127,E701,E714,W504,E129,E741 ignore = E501,F401,E128,E251,E201,E202,E302,E305,F841,E261,E712,E126,E711,E125,E123,E101,E124,E127,E714,W504,E129,E741

View File

@ -339,7 +339,8 @@ class CheckSource(ReviewBot.ReviewBot):
self.logger.info( self.logger.info(
'Checking required maintainer from the source project (%s)' % self.required_maintainer 'Checking required maintainer from the source project (%s)' % self.required_maintainer
) )
if not self.required_maintainer: return True if not self.required_maintainer:
return True
meta = ET.fromstringlist(show_project_meta(self.apiurl, source_project)) meta = ET.fromstringlist(show_project_meta(self.apiurl, source_project))
maintainers = meta.xpath('//person[@role="maintainer"]/@userid') maintainers = meta.xpath('//person[@role="maintainer"]/@userid')

View File

@ -112,7 +112,8 @@ class Cache(object):
Cache.patterns = [] Cache.patterns = []
if str2bool(os.environ.get('OSRT_DISABLE_CACHE', '')): if str2bool(os.environ.get('OSRT_DISABLE_CACHE', '')):
if conf.config['debug']: print('CACHE_DISABLE via $OSRT_DISABLE_CACHE', file=sys.stderr) if conf.config['debug']:
print('CACHE_DISABLE via $OSRT_DISABLE_CACHE', file=sys.stderr)
return return
for pattern in Cache.PATTERNS: for pattern in Cache.PATTERNS:
@ -170,11 +171,13 @@ class Cache(object):
Cache.delete_project(apiurl, project) Cache.delete_project(apiurl, project)
if os.path.exists(path) and time() - os.path.getmtime(path) <= ttl: if os.path.exists(path) and time() - os.path.getmtime(path) <= ttl:
if conf.config['debug']: print('CACHE_GET', url, file=sys.stderr) if conf.config['debug']:
print('CACHE_GET', url, file=sys.stderr)
return urlopen('file://' + path) return urlopen('file://' + path)
else: else:
reason = '(' + ('expired' if os.path.exists(path) else 'does not exist') + ')' reason = '(' + ('expired' if os.path.exists(path) else 'does not exist') + ')'
if conf.config['debug']: print('CACHE_MISS', url, reason, file=sys.stderr) if conf.config['debug']:
print('CACHE_MISS', url, reason, file=sys.stderr)
return None return None
@ -195,7 +198,8 @@ class Cache(object):
text = data.read() text = data.read()
data = BytesIO(text) data = BytesIO(text)
if conf.config['debug']: print('CACHE_PUT', url, project, file=sys.stderr) if conf.config['debug']:
print('CACHE_PUT', url, project, file=sys.stderr)
f = open(path, 'wb') f = open(path, 'wb')
f.write(text) f.write(text)
f.close() f.close()
@ -219,7 +223,8 @@ class Cache(object):
Cache.delete_project(apiurl, project) Cache.delete_project(apiurl, project)
if os.path.exists(path): if os.path.exists(path):
if conf.config['debug']: print('CACHE_DELETE', url, file=sys.stderr) if conf.config['debug']:
print('CACHE_DELETE', url, file=sys.stderr)
os.remove(path) os.remove(path)
# Also delete version without query. This does not handle other # Also delete version without query. This does not handle other
@ -234,7 +239,8 @@ class Cache(object):
path = Cache.path(apiurl, project) path = Cache.path(apiurl, project)
if os.path.exists(path): if os.path.exists(path):
if conf.config['debug']: print('CACHE_DELETE_PROJECT', apiurl, project, file=sys.stderr) if conf.config['debug']:
print('CACHE_DELETE_PROJECT', apiurl, project, file=sys.stderr)
rmtree_nfs_safe(path) rmtree_nfs_safe(path)
@staticmethod @staticmethod

View File

@ -27,7 +27,8 @@ class ListCommand:
SupersedeCommand(self.api).perform() SupersedeCommand(self.api).perform()
requests = self.api.get_open_requests() requests = self.api.get_open_requests()
if not len(requests): return if not len(requests):
return
splitter = RequestSplitter(self.api, requests, in_ring=True) splitter = RequestSplitter(self.api, requests, in_ring=True)
splitter.group_by('./action/target/@devel_project') splitter.group_by('./action/target/@devel_project')

View File

@ -74,7 +74,8 @@ class OBSLock(object):
http_POST(url, data=data) http_POST(url, data=data)
def acquire(self): def acquire(self):
if not self.needed: return self if not self.needed:
return self
# If the project doesn't have locks configured, raise a # If the project doesn't have locks configured, raise a
# Warning (but continue the operation) # Warning (but continue the operation)
@ -114,7 +115,8 @@ class OBSLock(object):
return self return self
def release(self, force=False): def release(self, force=False):
if not force and not self.needed: return if not force and not self.needed:
return
# If the project do not have locks configured, simply ignore # If the project do not have locks configured, simply ignore
# the operation. # the operation.

View File

@ -52,7 +52,8 @@ class Group(object):
for a in archs: for a in archs:
# we use groups.yml for powerpc through a branch, # we use groups.yml for powerpc through a branch,
# so ignore inapplicable architectures # so ignore inapplicable architectures
if a not in self.packages: continue if a not in self.packages:
continue
self.packages[a].append([package, self.name]) self.packages[a].append([package, self.name])
def parse_yml(self, packages): def parse_yml(self, packages):
@ -222,7 +223,8 @@ class Group(object):
jobs += sel.jobs(solv.Job.SOLVER_LOCK) jobs += sel.jobs(solv.Job.SOLVER_LOCK)
for n in list(solved[arch]) + list(suggested): for n in list(solved[arch]) + list(suggested):
if n in locked: continue if n in locked:
continue
sel = pool.select(str(n), solv.Selection.SELECTION_NAME) sel = pool.select(str(n), solv.Selection.SELECTION_NAME)
jobs += sel.jobs(solv.Job.SOLVER_INSTALL) jobs += sel.jobs(solv.Job.SOLVER_INSTALL)

View File

@ -162,7 +162,8 @@ def print_repo_delta(pool, repo2, packages_file):
present.setdefault(key, {}) present.setdefault(key, {})
present[key][s.evr] = s.repo present[key][s.evr] = s.repo
for s in repo2.solvables: for s in repo2.solvables:
if s.arch == 'src': continue if s.arch == 'src':
continue
key = '{}/{}'.format(s.name, s.arch) key = '{}/{}'.format(s.name, s.arch)
if present.get(key, {}).get(s.evr): if present.get(key, {}).get(s.evr):
continue continue

View File

@ -351,9 +351,11 @@ class StagingWorkflow(ABC):
def create_attribute_type(self, namespace, name, values=None): def create_attribute_type(self, namespace, name, values=None):
"""Creates a new attribute type in the OBS instance.""" """Creates a new attribute type in the OBS instance."""
if namespace not in self.attr_types: self.attr_types[namespace] = [] if namespace not in self.attr_types:
self.attr_types[namespace] = []
if name not in self.attr_types[namespace]: self.attr_types[namespace].append(name) if name not in self.attr_types[namespace]:
self.attr_types[namespace].append(name)
meta = """ meta = """
<namespace name='{}'> <namespace name='{}'>
@ -446,7 +448,8 @@ class StagingWorkflow(ABC):
:param name: name of the user :param name: name of the user
:type name: str :type name: str
""" """
if name in self.users: return if name in self.users:
return
meta = """ meta = """
<person> <person>
<login>{}</login> <login>{}</login>
@ -478,7 +481,8 @@ class StagingWorkflow(ABC):
After the execution, the target project is indexed in the projects dictionary twice, After the execution, the target project is indexed in the projects dictionary twice,
by its name and as 'target'. by its name and as 'target'.
""" """
if self.projects.get('target'): return if self.projects.get('target'):
return
self.create_target_project() self.create_target_project()
self.create_staging_users() self.create_staging_users()
@ -1056,7 +1060,8 @@ class Request(object):
self.revoke() self.revoke()
def revoke(self): def revoke(self):
if self.revoked: return if self.revoked:
return
self.change_state('revoked') self.change_state('revoked')
self.revoked = True self.revoked = True