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

View file

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

View file

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

View file

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