Code cleaning

This commit is contained in:
Benjamin Renard 2022-01-20 19:14:16 +01:00
parent b90994037a
commit 9a89638e54
4 changed files with 13 additions and 13 deletions

View file

@ -549,8 +549,8 @@ class RawWrappedTextHelpFormatter(argparse.RawDescriptionHelpFormatter):
ident = m.group(1)
line_text = m.group(2)
# Wrap each lines and add in result with ident prefix
for l in textwrap.wrap(line_text, width - len(ident)):
result.append(ident + l)
for subline in textwrap.wrap(line_text, width - len(ident)):
result.append(ident + subline)
return result
@ -676,8 +676,8 @@ class Config: # pylint: disable=too-many-instance-attributes
dirpath = os.path.dirname(filepath)
if os.path.isfile(filepath):
if not os.access(filepath, os.W_OK):
log.error('Configuration file "%s" is not writable', filepath)
return False
log.error('Configuration file "%s" is not writable', filepath)
return False
elif not os.path.isdir(dirpath) or not os.access(dirpath, os.R_OK | os.W_OK | os.X_OK):
log.error(
'Configuration directory "%s" does not exist (or not writable)', dirpath)

View file

@ -404,10 +404,10 @@ class OracleDB:
if isinstance(order_by, str):
sql += ' ORDER BY {0}'.format(order_by)
elif (
isinstance(order_by, (list, tuple)) and len(order_by) == 2 and
isinstance(order_by[0], str) and
isinstance(order_by[1], str) and
order_by[1].upper() in ('ASC', 'UPPER')
isinstance(order_by, (list, tuple)) and len(order_by) == 2
and isinstance(order_by[0], str)
and isinstance(order_by[1], str)
and order_by[1].upper() in ('ASC', 'UPPER')
):
sql += ' ORDER BY "{0}" {1}'.format(order_by[0], order_by[1].upper())
else:

View file

@ -421,10 +421,10 @@ class PgDB:
if isinstance(order_by, str):
sql += ' ORDER BY {0}'.format(order_by)
elif (
isinstance(order_by, (list, tuple)) and len(order_by) == 2 and
isinstance(order_by[0], str) and
isinstance(order_by[1], str) and
order_by[1].upper() in ('ASC', 'UPPER')
isinstance(order_by, (list, tuple)) and len(order_by) == 2
and isinstance(order_by[0], str)
and isinstance(order_by[1], str)
and order_by[1].upper() in ('ASC', 'UPPER')
):
sql += ' ORDER BY "{0}" {1}'.format(order_by[0], order_by[1].upper())
else:

View file

@ -1,2 +1,2 @@
[flake8]
ignore = E501
ignore = E501,W503