From: Daniele Varrazzo Date: Sat, 16 May 2020 14:26:25 +0000 (+1200) Subject: Fixed linter errors found by new flake8 version X-Git-Tag: 3.0.dev0~518 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b28b389862cd8e0ac0910b1435c1cd86166703a5;p=thirdparty%2Fpsycopg.git Fixed linter errors found by new flake8 version --- diff --git a/psycopg3/pq/__init__.py b/psycopg3/pq/__init__.py index cbb90557a..16463e9c2 100644 --- a/psycopg3/pq/__init__.py +++ b/psycopg3/pq/__init__.py @@ -50,7 +50,7 @@ def import_from_libpq() -> None: from . import pq_cython # type: ignore except Exception as e: if not impl: - logger.debug(f"C pq wrapper not available: %s", e) + logger.debug("C pq wrapper not available: %s", e) else: raise ImportError( f"requested pq implementation '{impl}' not available" @@ -69,7 +69,7 @@ def import_from_libpq() -> None: from . import pq_ctypes except Exception as e: if not impl: - logger.debug(f"ctypes pq wrapper not available: %s", e) + logger.debug("ctypes pq wrapper not available: %s", e) else: raise ImportError( f"requested pq implementation '{impl}' not available" @@ -86,7 +86,7 @@ def import_from_libpq() -> None: if impl: raise ImportError(f"requested pq impementation '{impl}' unknown") else: - raise ImportError(f"no pq wrapper available") + raise ImportError("no pq wrapper available") import_from_libpq() diff --git a/psycopg3/pq/_pq_ctypes.py b/psycopg3/pq/_pq_ctypes.py index 454484383..208eeded6 100644 --- a/psycopg3/pq/_pq_ctypes.py +++ b/psycopg3/pq/_pq_ctypes.py @@ -505,12 +505,14 @@ def generate_stub() -> None: istart, iend = [ i - for i, l in enumerate(lines) - if re.match(r"\s*#\s*autogenerated:\s+(start|end)", l) + for i, line in enumerate(lines) + if re.match(r"\s*#\s*autogenerated:\s+(start|end)", line) ] known = { - l[4:].split("(", 1)[0] for l in lines[:istart] if l.startswith("def ") + line[4:].split("(", 1)[0] + for line in lines[:istart] + if line.startswith("def ") } signatures = [] diff --git a/psycopg3/types/oids.py b/psycopg3/types/oids.py index 39a9d4206..c9d6de145 100644 --- a/psycopg3/types/oids.py +++ b/psycopg3/types/oids.py @@ -194,11 +194,11 @@ select format( ) new.extend(out.stdout.splitlines()) - new = [b" " * 4 + l if l else b"" for l in new] # indent + new = [b" " * 4 + line if line else b"" for line in new] # indent istart, iend = [ i - for i, l in enumerate(lines) - if re.match(br"\s*#\s*autogenerated:\s+(start|end)", l) + for i, line in enumerate(lines) + if re.match(br"\s*#\s*autogenerated:\s+(start|end)", line) ] lines[istart + 1 : iend] = new diff --git a/setup.py b/setup.py index 0bc13ac6d..ab371e15d 100644 --- a/setup.py +++ b/setup.py @@ -61,7 +61,7 @@ class psycopg3_build_ext(build_ext): try: out = sp.run( - ["pg_config", f"--includedir"], stdout=sp.PIPE, check=True + ["pg_config", "--includedir"], stdout=sp.PIPE, check=True ) except Exception as e: log.warn("cannot build C module: %s", e)