From: Daniele Varrazzo Date: Fri, 16 Oct 2020 14:37:05 +0000 (+0100) Subject: Trailing comma dropped from where black would reformat X-Git-Tag: 3.0.dev0~456 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efe7bd98edca1b500cd8a8b7559865e26270993c;p=thirdparty%2Fpsycopg.git Trailing comma dropped from where black would reformat The changes are detected by black 20.8b1 --- diff --git a/psycopg3/psycopg3/adapt.py b/psycopg3/psycopg3/adapt.py index 6d7cb796f..aa2f3a809 100644 --- a/psycopg3/psycopg3/adapt.py +++ b/psycopg3/psycopg3/adapt.py @@ -59,7 +59,7 @@ class Dumper: @classmethod def register_binary( - cls, src: type, dumper: DumperType, context: AdaptContext = None, + cls, src: type, dumper: DumperType, context: AdaptContext = None ) -> DumperType: return cls.register(src, dumper, context, format=Format.BINARY) @@ -118,7 +118,7 @@ class Loader: @classmethod def register_binary( - cls, oid: int, loader: LoaderType, context: AdaptContext = None, + cls, oid: int, loader: LoaderType, context: AdaptContext = None ) -> LoaderType: return cls.register(oid, loader, context, format=Format.BINARY) diff --git a/psycopg3/psycopg3/cursor.py b/psycopg3/psycopg3/cursor.py index 3f8cb74b4..81bc86289 100644 --- a/psycopg3/psycopg3/cursor.py +++ b/psycopg3/psycopg3/cursor.py @@ -217,7 +217,7 @@ class BaseCursor: pgq.convert(query, vars) self.connection.pgconn.send_prepare( - name, pgq.query, param_types=pgq.types, + name, pgq.query, param_types=pgq.types ) return pgq diff --git a/psycopg3/psycopg3/pq/pq_ctypes.py b/psycopg3/psycopg3/pq/pq_ctypes.py index 09c9ffb62..588b9a83b 100644 --- a/psycopg3/psycopg3/pq/pq_ctypes.py +++ b/psycopg3/psycopg3/pq/pq_ctypes.py @@ -811,7 +811,7 @@ class Escaping: ) else: out = impl.PQescapeBytea( - data, len(data), pointer(t_cast(c_ulong, len_out)), + data, len(data), pointer(t_cast(c_ulong, len_out)) ) if not out: raise MemoryError( diff --git a/psycopg3/psycopg3/types/composite.py b/psycopg3/psycopg3/types/composite.py index a5a0ee40e..b4ce1418c 100644 --- a/psycopg3/psycopg3/types/composite.py +++ b/psycopg3/psycopg3/types/composite.py @@ -29,7 +29,7 @@ class FieldInfo: class CompositeTypeInfo(TypeInfo): def __init__( - self, name: str, oid: int, array_oid: int, fields: Sequence[FieldInfo], + self, name: str, oid: int, array_oid: int, fields: Sequence[FieldInfo] ): super().__init__(name, oid, array_oid) self.fields = list(fields) diff --git a/tests/pq/test_escaping.py b/tests/pq/test_escaping.py index d4b8c8953..25fd1e072 100644 --- a/tests/pq/test_escaping.py +++ b/tests/pq/test_escaping.py @@ -136,9 +136,7 @@ def test_escape_string_badenc(pgconn): esc.escape_string(data) -@pytest.mark.parametrize( - "data", [(b"hello\00world"), (b"\00\00\00\00")], -) +@pytest.mark.parametrize("data", [(b"hello\00world"), (b"\00\00\00\00")]) def test_escape_bytea(pgconn, data): exp = br"\x" + b"".join(b"%02x" % c for c in data) esc = pq.Escaping(pgconn) @@ -169,9 +167,7 @@ def test_escape_1char(pgconn): assert rv == exp -@pytest.mark.parametrize( - "data", [(b"hello\00world"), (b"\00\00\00\00")], -) +@pytest.mark.parametrize("data", [(b"hello\00world"), (b"\00\00\00\00")]) def test_unescape_bytea(pgconn, data): enc = br"\x" + b"".join(b"%02x" % c for c in data) esc = pq.Escaping(pgconn) diff --git a/tests/test_connection.py b/tests/test_connection.py index 562a54dd8..547030621 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -244,7 +244,7 @@ def test_connect_args(monkeypatch, pgconn, testdsn, kwargs, want): @pytest.mark.parametrize( - "args, kwargs", [((), {}), (("", ""), {}), ((), {"nosuchparam": 42})], + "args, kwargs", [((), {}), (("", ""), {}), ((), {"nosuchparam": 42})] ) def test_connect_badargs(monkeypatch, pgconn, args, kwargs): def fake_connect(conninfo): diff --git a/tests/test_connection_async.py b/tests/test_connection_async.py index 6953d5b96..ca4ae75cf 100644 --- a/tests/test_connection_async.py +++ b/tests/test_connection_async.py @@ -252,7 +252,7 @@ async def test_connect_args(monkeypatch, pgconn, testdsn, kwargs, want): @pytest.mark.parametrize( - "args, kwargs", [((), {}), (("", ""), {}), ((), {"nosuchparam": 42})], + "args, kwargs", [((), {}), (("", ""), {}), ((), {"nosuchparam": 42})] ) async def test_connect_badargs(monkeypatch, pgconn, args, kwargs): def fake_connect(conninfo): diff --git a/tests/test_psycopg3_dbapi20.py b/tests/test_psycopg3_dbapi20.py index 2e91c2224..f12fac88e 100644 --- a/tests/test_psycopg3_dbapi20.py +++ b/tests/test_psycopg3_dbapi20.py @@ -133,7 +133,7 @@ def test_connect_args(monkeypatch, pgconn, testdsn, kwargs, want): @pytest.mark.parametrize( - "args, kwargs", [((), {}), (("", ""), {}), ((), {"nosuchparam": 42})], + "args, kwargs", [((), {}), (("", ""), {}), ((), {"nosuchparam": 42})] ) def test_connect_badargs(monkeypatch, pgconn, args, kwargs): def fake_connect(conninfo): diff --git a/tests/types/test_composite.py b/tests/types/test_composite.py index d61e681e3..a24289286 100644 --- a/tests/types/test_composite.py +++ b/tests/types/test_composite.py @@ -14,7 +14,7 @@ tests_str = [ "42,'foo','ba,r','ba''z','qu\"x'", ("42", "foo", "ba,r", "ba'z", 'qu"x'), ), - ("'foo''', '''foo', '\"bar', 'bar\"' ", ("foo'", "'foo", '"bar', 'bar"'),), + ("'foo''', '''foo', '\"bar', 'bar\"' ", ("foo'", "'foo", '"bar', 'bar"')), ]