]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Fixed linter errors found by new flake8 version
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 16 May 2020 14:26:25 +0000 (02:26 +1200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 17 May 2020 09:29:34 +0000 (21:29 +1200)
psycopg3/pq/__init__.py
psycopg3/pq/_pq_ctypes.py
psycopg3/types/oids.py
setup.py

index cbb90557a0411b1102e27d2968ed94bc3f4ad11b..16463e9c216acc5f0f72d997bb85fac5041cd3a6 100644 (file)
@@ -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()
index 45448438338ff117f98a6e09333ee8d64260205d..208eeded6d111206bfebcde45978dc57f9f5b6fc 100644 (file)
@@ -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 = []
index 39a9d4206c8d16386354b6aa83660d927d58e987..c9d6de145b284c8d2a45f2b016564d8a35afe68c 100644 (file)
@@ -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
 
index 0bc13ac6ddc75a5d0c76e9a7b2bbd59116a6ca8c..ab371e15d89dbd2e7ed41f938dc30c1e79be4192 100644 (file)
--- 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)