From 9a89638e5479a9cbd115a911f0d60960c82eacc9 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 20 Jan 2022 19:14:16 +0100 Subject: [PATCH] Code cleaning --- mylib/config.py | 8 ++++---- mylib/oracle.py | 8 ++++---- mylib/pgsql.py | 8 ++++---- setup.cfg | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/mylib/config.py b/mylib/config.py index 9451d28..0139ccb 100644 --- a/mylib/config.py +++ b/mylib/config.py @@ -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) diff --git a/mylib/oracle.py b/mylib/oracle.py index 186c282..0f30411 100644 --- a/mylib/oracle.py +++ b/mylib/oracle.py @@ -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: diff --git a/mylib/pgsql.py b/mylib/pgsql.py index 76d0773..f37e904 100644 --- a/mylib/pgsql.py +++ b/mylib/pgsql.py @@ -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: diff --git a/setup.cfg b/setup.cfg index e44b810..a1cce8e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,2 @@ [flake8] -ignore = E501 +ignore = E501,W503