Code cleaning

master
Benjamin Renard 1 year ago
parent b90994037a
commit 9a89638e54

@ -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)

@ -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:

@ -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:

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

Loading…
Cancel
Save