]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
chore: upgrade black to 23.1.0
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 1 Feb 2023 10:25:26 +0000 (11:25 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 1 Feb 2023 10:25:26 +0000 (11:25 +0100)
Code reformatted to adhere to the new style requested (stricter on
redundant tuples unpacking brackets and blank lines at blocks start).

42 files changed:
psycopg/psycopg/_column.py
psycopg/psycopg/_pipeline.py
psycopg/psycopg/abc.py
psycopg/psycopg/connection_async.py
psycopg/psycopg/copy.py
psycopg/psycopg/crdb/connection.py
psycopg/psycopg/cursor.py
psycopg/psycopg/cursor_async.py
psycopg/psycopg/postgres.py
psycopg/psycopg/pq/_debug.py
psycopg/psycopg/pq/abc.py
psycopg/psycopg/server_cursor.py
psycopg/psycopg/types/array.py
psycopg/psycopg/types/bool.py
psycopg/psycopg/types/composite.py
psycopg/psycopg/types/datetime.py
psycopg/psycopg/types/hstore.py
psycopg/psycopg/types/json.py
psycopg/psycopg/types/multirange.py
psycopg/psycopg/types/net.py
psycopg/psycopg/types/numeric.py
psycopg/psycopg/types/range.py
psycopg/psycopg/types/string.py
psycopg/psycopg/types/uuid.py
psycopg/setup.cfg
psycopg_pool/psycopg_pool/base.py
psycopg_pool/psycopg_pool/pool.py
tests/constraints.txt
tests/pool/test_null_pool.py
tests/pool/test_null_pool_async.py
tests/pool/test_pool.py
tests/pool/test_pool_async.py
tests/scripts/bench-411.py
tests/test_adapt.py
tests/test_dns_srv.py
tests/test_tpc.py
tests/test_tpc_async.py
tests/test_typeinfo.py
tests/types/test_array.py
tests/types/test_bool.py
tests/types/test_none.py
tools/update_oids.py

index 9e4e7357c2fd397d432e37ed01acd219e4c89774..50577e637cb442d7ce1bd17143b34f5154e6a0b4 100644 (file)
@@ -18,7 +18,6 @@ class ColumnData(NamedTuple):
 
 
 class Column(Sequence[Any]):
-
     __module__ = "psycopg"
 
     def __init__(self, cursor: "BaseCursor[Any, Any]", index: int):
index c818d86e8136d3ecd8c3f36ffbb604cda44369ef..233d66b234f4664182e2282d00e4a32214196de3 100644 (file)
@@ -38,7 +38,6 @@ logger = logging.getLogger("psycopg")
 
 
 class BasePipeline:
-
     command_queue: Deque[PipelineCommand]
     result_queue: Deque[PendingResult]
     _is_supported: Optional[bool] = None
index 80c8fbfb3d8967200bc8b3ee8ff040e2783fa798..0cf1a7511c8877fba777b83bfb8e1bd255390336 100644 (file)
@@ -200,7 +200,6 @@ class Loader(Protocol):
 
 
 class Transformer(Protocol):
-
     types: Optional[Tuple[int, ...]]
     formats: Optional[List[pq.Format]]
 
index aa02dc0d34b91c4f281df66c5ccd988f46bf4b79..6d95d7641218fe3705bf99b401c6bc79105e94f4 100644 (file)
@@ -107,7 +107,6 @@ class AsyncConnection(BaseConnection[Row]):
         cursor_factory: Optional[Type[AsyncCursor[Row]]] = None,
         **kwargs: Any,
     ) -> "AsyncConnection[Any]":
-
         if sys.platform == "win32":
             loop = asyncio.get_running_loop()
             if isinstance(loop, asyncio.ProactorEventLoop):
index 751430664d3933e623cb307c2b8499eabdffa3e1..33322aa61f8f4e2b0c13275269028ec379336f75 100644 (file)
@@ -669,7 +669,6 @@ class Formatter(ABC):
 
 
 class TextFormatter(Formatter):
-
     format = TEXT
 
     def __init__(self, transformer: Transformer, encoding: str = "utf-8"):
@@ -714,7 +713,6 @@ class TextFormatter(Formatter):
 
 
 class BinaryFormatter(Formatter):
-
     format = BINARY
 
     def __init__(self, transformer: Transformer):
index 6e79ed1d01b798956a86bb305434c29d48bea33b..451474b77ecf9a07bf93174187a2db3789a55c0c 100644 (file)
@@ -23,7 +23,6 @@ if TYPE_CHECKING:
 
 
 class _CrdbConnectionMixin:
-
     _adapters: Optional[AdaptersMap]
     pgconn: "PGconn"
 
index 7c32f29e4f67087f02fdafdc2ef8bed440657732..8379c589ab2835a6d08542dfaf736e474652601e 100644 (file)
@@ -771,7 +771,6 @@ class Cursor(BaseCursor["Connection[Any]", Row]):
             raise e.ProgrammingError("stream() cannot be used in pipeline mode")
 
         with self._conn.lock:
-
             try:
                 self._conn.wait(self._stream_send_gen(query, params, binary=binary))
                 first = True
index 42cd8e501f03308c2747d6aec313812f7cc847e9..405dc006437296b9adbda6b67ad09da0a3e3d381 100644 (file)
@@ -135,7 +135,6 @@ class AsyncCursor(BaseCursor["AsyncConnection[Any]", Row]):
             raise e.ProgrammingError("stream() cannot be used in pipeline mode")
 
         async with self._conn.lock:
-
             try:
                 await self._conn.wait(
                     self._stream_send_gen(query, params, binary=binary)
index 7a5d9dd473731db7060e3710b178ec573e3e951f..44565952d2ffff2527606aa27ca17302e19f9224 100644 (file)
@@ -16,7 +16,6 @@ adapters = AdaptersMap(types=types)
 
 
 def register_default_types(types: TypesRegistry) -> None:
-
     from .types.range import RangeInfo
     from .types.multirange import MultirangeInfo
 
@@ -106,7 +105,6 @@ def register_default_types(types: TypesRegistry) -> None:
 
 
 def register_default_adapters(context: AdaptContext) -> None:
-
     from .types import array, bool, composite, datetime, enum, json, multirange
     from .types import net, none, numeric, range, string, uuid
 
index f35d09f45cc7a502496deb38c7b88d0969e76440..f86f3bdcb1e00cdfcf86446d7d60131a388275b2 100644 (file)
@@ -91,7 +91,7 @@ def debugging(f: Func) -> Func:
         reprs = []
         for arg in args:
             reprs.append(f"{arg!r}")
-        for (k, v) in kwargs.items():
+        for k, v in kwargs.items():
             reprs.append(f"{k}={v!r}")
 
         logger.info("PGconn.%s(%s)", f.__name__, ", ".join(reprs))
index 9c45f64d18c3310ab65eb88201276bfefe95e650..971d00eea469784ef700b6a6f9d4e6a1234d91dd 100644 (file)
@@ -19,7 +19,6 @@ Buffer: TypeAlias = Union[bytes, bytearray, memoryview]
 
 
 class PGconn(Protocol):
-
     notice_handler: Optional[Callable[["PGresult"], None]]
     notify_handler: Optional[Callable[["PGnotify"], None]]
 
index b890d7728245e87810d75aeaaa836768cc8045a3..31b7f2e6744049dc434b5603a9883de0568d7b89 100644 (file)
@@ -188,7 +188,6 @@ class ServerCursorMixin(BaseCursor[ConnectionType, Row]):
         yield from self._conn._exec_command(query)
 
     def _make_declare_statement(self, query: Query) -> sql.Composed:
-
         if isinstance(query, bytes):
             query = query.decode(self._encoding)
         if not isinstance(query, sql.Composable):
index 93f9da389a122e402594b40f9f59996da3cad69e..af85be04c36dc03c35cb6cef1e2d775e5993d4d1 100644 (file)
@@ -110,7 +110,6 @@ class BaseListDumper(RecursiveDumper):
 
 
 class ListDumper(BaseListDumper):
-
     delimiter = b","
 
     def get_key(self, obj: List[Any], format: PyFormat) -> DumperKey:
@@ -212,7 +211,6 @@ def _get_needs_quotes_regexp(delimiter: bytes) -> Pattern[bytes]:
 
 
 class ListBinaryDumper(BaseListDumper):
-
     format = pq.Format.BINARY
 
     def get_key(self, obj: List[Any], format: PyFormat) -> DumperKey:
@@ -292,7 +290,6 @@ class ListBinaryDumper(BaseListDumper):
 
 
 class ArrayLoader(RecursiveLoader):
-
     delimiter = b","
     base_oid: int
 
@@ -302,7 +299,6 @@ class ArrayLoader(RecursiveLoader):
 
 
 class ArrayBinaryLoader(RecursiveLoader):
-
     format = pq.Format.BINARY
 
     def load(self, data: Buffer) -> List[Any]:
index db34ce17c5cd5d2ad077bb6a84a2f210688f1ed9..2ad53c2f4168ce9d6f2203aba9c18be06abfd151 100644 (file)
@@ -11,7 +11,6 @@ from ..adapt import Buffer, Dumper, Loader
 
 
 class BoolDumper(Dumper):
-
     oid = _oids.BOOL_OID
 
     def dump(self, obj: bool) -> bytes:
@@ -22,7 +21,6 @@ class BoolDumper(Dumper):
 
 
 class BoolBinaryDumper(Dumper):
-
     format = Format.BINARY
     oid = _oids.BOOL_OID
 
@@ -36,7 +34,6 @@ class BoolLoader(Loader):
 
 
 class BoolBinaryLoader(Loader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> bool:
index 12059852e254b7aa1d05659873733813b54fc3c1..e2a5d0d94bc335ce9ad09b845df38e542d8176b7 100644 (file)
@@ -113,7 +113,6 @@ class SequenceDumper(RecursiveDumper):
 
 
 class TupleDumper(SequenceDumper):
-
     # Should be this, but it doesn't work
     # oid = _oids.RECORD_OID
 
@@ -122,7 +121,6 @@ class TupleDumper(SequenceDumper):
 
 
 class TupleBinaryDumper(RecursiveDumper):
-
     format = pq.Format.BINARY
 
     # Subclasses must set an info
@@ -234,7 +232,6 @@ class RecordBinaryLoader(Loader):
 
 
 class CompositeLoader(RecordLoader):
-
     factory: Callable[..., Any]
     fields_types: List[int]
     _types_set = False
@@ -256,7 +253,6 @@ class CompositeLoader(RecordLoader):
 
 
 class CompositeBinaryLoader(RecordBinaryLoader):
-
     format = pq.Format.BINARY
     factory: Callable[..., Any]
 
index d4842cdcdb8c60cd711ed7a5f42dcf5dec42208a..f566f6dcf8fc2588b14e26a6fe6b77ef64a9cf10 100644 (file)
@@ -38,7 +38,6 @@ _py_date_min_days = date.min.toordinal()
 
 
 class DateDumper(Dumper):
-
     oid = _oids.DATE_OID
 
     def dump(self, obj: date) -> bytes:
@@ -48,7 +47,6 @@ class DateDumper(Dumper):
 
 
 class DateBinaryDumper(Dumper):
-
     format = Format.BINARY
     oid = _oids.DATE_OID
 
@@ -76,7 +74,6 @@ class _BaseTimeTextDumper(_BaseTimeDumper):
 
 
 class TimeDumper(_BaseTimeTextDumper):
-
     oid = _oids.TIME_OID
 
     def upgrade(self, obj: time, format: PyFormat) -> Dumper:
@@ -87,12 +84,10 @@ class TimeDumper(_BaseTimeTextDumper):
 
 
 class TimeTzDumper(_BaseTimeTextDumper):
-
     oid = _oids.TIMETZ_OID
 
 
 class TimeBinaryDumper(_BaseTimeDumper):
-
     format = Format.BINARY
     oid = _oids.TIME_OID
 
@@ -110,7 +105,6 @@ class TimeBinaryDumper(_BaseTimeDumper):
 
 
 class TimeTzBinaryDumper(_BaseTimeDumper):
-
     format = Format.BINARY
     oid = _oids.TIMETZ_OID
 
@@ -144,7 +138,6 @@ class _BaseDatetimeTextDumper(_BaseDatetimeDumper):
 
 
 class DatetimeDumper(_BaseDatetimeTextDumper):
-
     oid = _oids.TIMESTAMPTZ_OID
 
     def upgrade(self, obj: datetime, format: PyFormat) -> Dumper:
@@ -155,12 +148,10 @@ class DatetimeDumper(_BaseDatetimeTextDumper):
 
 
 class DatetimeNoTzDumper(_BaseDatetimeTextDumper):
-
     oid = _oids.TIMESTAMP_OID
 
 
 class DatetimeBinaryDumper(_BaseDatetimeDumper):
-
     format = Format.BINARY
     oid = _oids.TIMESTAMPTZ_OID
 
@@ -177,7 +168,6 @@ class DatetimeBinaryDumper(_BaseDatetimeDumper):
 
 
 class DatetimeNoTzBinaryDumper(_BaseDatetimeDumper):
-
     format = Format.BINARY
     oid = _oids.TIMESTAMP_OID
 
@@ -188,7 +178,6 @@ class DatetimeNoTzBinaryDumper(_BaseDatetimeDumper):
 
 
 class TimedeltaDumper(Dumper):
-
     oid = _oids.INTERVAL_OID
 
     def __init__(self, cls: type, context: Optional[AdaptContext] = None):
@@ -216,7 +205,6 @@ class TimedeltaDumper(Dumper):
 
 
 class TimedeltaBinaryDumper(Dumper):
-
     format = Format.BINARY
     oid = _oids.INTERVAL_OID
 
@@ -226,7 +214,6 @@ class TimedeltaBinaryDumper(Dumper):
 
 
 class DateLoader(Loader):
-
     _ORDER_YMD = 0
     _ORDER_DMY = 1
     _ORDER_MDY = 2
@@ -270,7 +257,6 @@ class DateLoader(Loader):
 
 
 class DateBinaryLoader(Loader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> date:
@@ -285,7 +271,6 @@ class DateBinaryLoader(Loader):
 
 
 class TimeLoader(Loader):
-
     _re_format = re.compile(rb"^(\d+):(\d+):(\d+)(?:\.(\d+))?")
 
     def load(self, data: Buffer) -> time:
@@ -312,7 +297,6 @@ class TimeLoader(Loader):
 
 
 class TimeBinaryLoader(Loader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> time:
@@ -327,7 +311,6 @@ class TimeBinaryLoader(Loader):
 
 
 class TimetzLoader(Loader):
-
     _re_format = re.compile(
         rb"""(?ix)
         ^
@@ -369,7 +352,6 @@ class TimetzLoader(Loader):
 
 
 class TimetzBinaryLoader(Loader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> time:
@@ -386,7 +368,6 @@ class TimetzBinaryLoader(Loader):
 
 
 class TimestampLoader(Loader):
-
     _re_format = re.compile(
         rb"""(?ix)
         ^
@@ -472,7 +453,6 @@ class TimestampLoader(Loader):
 
 
 class TimestampBinaryLoader(Loader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> datetime:
@@ -487,7 +467,6 @@ class TimestampBinaryLoader(Loader):
 
 
 class TimestamptzLoader(Loader):
-
     _re_format = re.compile(
         rb"""(?ix)
         ^
@@ -563,7 +542,6 @@ class TimestamptzLoader(Loader):
 
 
 class TimestamptzBinaryLoader(Loader):
-
     format = Format.BINARY
 
     def __init__(self, oid: int, context: Optional[AdaptContext] = None):
@@ -600,7 +578,6 @@ class TimestamptzBinaryLoader(Loader):
 
 
 class IntervalLoader(Loader):
-
     _re_interval = re.compile(
         rb"""
         (?: ([-+]?\d+) \s+ years? \s* )?                # Years
@@ -660,7 +637,6 @@ class IntervalLoader(Loader):
 
 
 class IntervalBinaryLoader(Loader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> timedelta:
index f668da8c6e08e4e20800871de5363930cdf8322b..86d7913f3dd7506f10a51e6a979c18078d7739e2 100644 (file)
@@ -51,7 +51,6 @@ class BaseHstoreDumper(RecursiveDumper):
             tokens.append('"')
 
         for k, v in obj.items():
-
             if not isinstance(k, str):
                 raise e.DataError("hstore keys can only be strings")
             add_token(k)
index fc4a6d6f3fbbfb158d7464a21939eff90b9e6f91..3683bf2cbefbf3e2312c2f99896e3123dc2d3c7b 100644 (file)
@@ -118,7 +118,6 @@ class Jsonb(_JsonWrapper):
 
 
 class _JsonDumper(Dumper):
-
     # The globally used JSON dumps() function. It can be changed globally (by
     # set_json_dumps) or by a subclass.
     _dumps: JsonDumpsFunction = json.dumps
@@ -133,23 +132,19 @@ class _JsonDumper(Dumper):
 
 
 class JsonDumper(_JsonDumper):
-
     oid = _oids.JSON_OID
 
 
 class JsonBinaryDumper(_JsonDumper):
-
     format = Format.BINARY
     oid = _oids.JSON_OID
 
 
 class JsonbDumper(_JsonDumper):
-
     oid = _oids.JSONB_OID
 
 
 class JsonbBinaryDumper(_JsonDumper):
-
     format = Format.BINARY
     oid = _oids.JSONB_OID
 
@@ -159,7 +154,6 @@ class JsonbBinaryDumper(_JsonDumper):
 
 
 class _JsonLoader(Loader):
-
     # The globally used JSON loads() function. It can be changed globally (by
     # set_json_loads) or by a subclass.
     _loads: JsonLoadsFunction = json.loads
@@ -188,7 +182,6 @@ class JsonBinaryLoader(_JsonLoader):
 
 
 class JsonbBinaryLoader(_JsonLoader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> Any:
index 2fa1c67aab244e2951cb65f452e40898d425d2c4..623ac36f64317462854664a314424e7198e256dd 100644 (file)
@@ -278,7 +278,6 @@ class MultirangeDumper(BaseMultirangeDumper):
 
 
 class MultirangeBinaryDumper(BaseMultirangeDumper):
-
     format = Format.BINARY
 
     def dump(self, obj: Multirange[Any]) -> Buffer:
@@ -297,7 +296,6 @@ class MultirangeBinaryDumper(BaseMultirangeDumper):
 
 
 class BaseMultirangeLoader(RecursiveLoader, Generic[T]):
-
     subtype_oid: int
 
     def __init__(self, oid: int, context: Optional[AdaptContext] = None):
@@ -352,7 +350,6 @@ _END_INT = ord("}")
 
 
 class MultirangeBinaryLoader(BaseMultirangeLoader[T]):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> Multirange[T]:
index 99a023e9b421fa658cc21fbab93e5e8b184abf24..983de9a039ad1bd41665bb6dff10025eac9d6f20 100644 (file)
@@ -50,7 +50,6 @@ class _LazyIpaddress:
 
 
 class InterfaceDumper(Dumper):
-
     oid = _oids.INET_OID
 
     def dump(self, obj: Interface) -> bytes:
@@ -58,7 +57,6 @@ class InterfaceDumper(Dumper):
 
 
 class NetworkDumper(Dumper):
-
     oid = _oids.CIDR_OID
 
     def dump(self, obj: Network) -> bytes:
@@ -109,7 +107,6 @@ class InetBinaryDumper(_AIBinaryDumper, _LazyIpaddress):
 
 
 class NetworkBinaryDumper(Dumper):
-
     format = Format.BINARY
     oid = _oids.CIDR_OID
 
@@ -138,7 +135,6 @@ class InetLoader(_LazyIpaddressLoader):
 
 
 class InetBinaryLoader(_LazyIpaddressLoader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> Union[Address, Interface]:
@@ -168,7 +164,6 @@ class CidrLoader(_LazyIpaddressLoader):
 
 
 class CidrBinaryLoader(_LazyIpaddressLoader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> Network:
index ada6e942ee770183d33dbc2bbf458231c3af26bc..1d421afa807d5b4d958ac43d9150febe1f014bb8 100644 (file)
@@ -49,7 +49,6 @@ class _IntDumper(Dumper):
 
 
 class _SpecialValuesDumper(Dumper):
-
     _special: Dict[bytes, bytes] = {}
 
     def dump(self, obj: Any) -> bytes:
@@ -65,7 +64,6 @@ class _SpecialValuesDumper(Dumper):
 
 
 class FloatDumper(_SpecialValuesDumper):
-
     oid = _oids.FLOAT8_OID
 
     _special = {
@@ -80,7 +78,6 @@ class Float4Dumper(FloatDumper):
 
 
 class FloatBinaryDumper(Dumper):
-
     format = Format.BINARY
     oid = _oids.FLOAT8_OID
 
@@ -89,7 +86,6 @@ class FloatBinaryDumper(Dumper):
 
 
 class Float4BinaryDumper(FloatBinaryDumper):
-
     oid = _oids.FLOAT4_OID
 
     def dump(self, obj: float) -> bytes:
@@ -97,7 +93,6 @@ class Float4BinaryDumper(FloatBinaryDumper):
 
 
 class DecimalDumper(_SpecialValuesDumper):
-
     oid = _oids.NUMERIC_OID
 
     def dump(self, obj: Decimal) -> bytes:
@@ -163,7 +158,6 @@ class IntDumper(Dumper):
 
 
 class Int2BinaryDumper(Int2Dumper):
-
     format = Format.BINARY
 
     def dump(self, obj: int) -> bytes:
@@ -171,7 +165,6 @@ class Int2BinaryDumper(Int2Dumper):
 
 
 class Int4BinaryDumper(Int4Dumper):
-
     format = Format.BINARY
 
     def dump(self, obj: int) -> bytes:
@@ -179,7 +172,6 @@ class Int4BinaryDumper(Int4Dumper):
 
 
 class Int8BinaryDumper(Int8Dumper):
-
     format = Format.BINARY
 
     def dump(self, obj: int) -> bytes:
@@ -192,7 +184,6 @@ BIT_PER_PGDIGIT = log(2) / log(10_000)
 
 
 class IntNumericBinaryDumper(IntNumericDumper):
-
     format = Format.BINARY
 
     def dump(self, obj: int) -> Buffer:
@@ -200,7 +191,6 @@ class IntNumericBinaryDumper(IntNumericDumper):
 
 
 class OidBinaryDumper(OidDumper):
-
     format = Format.BINARY
 
     def dump(self, obj: int) -> bytes:
@@ -208,7 +198,6 @@ class OidBinaryDumper(OidDumper):
 
 
 class IntBinaryDumper(IntDumper):
-
     format = Format.BINARY
 
     _int2_dumper = Int2BinaryDumper(Int2)
@@ -224,7 +213,6 @@ class IntLoader(Loader):
 
 
 class Int2BinaryLoader(Loader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> int:
@@ -232,7 +220,6 @@ class Int2BinaryLoader(Loader):
 
 
 class Int4BinaryLoader(Loader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> int:
@@ -240,7 +227,6 @@ class Int4BinaryLoader(Loader):
 
 
 class Int8BinaryLoader(Loader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> int:
@@ -248,7 +234,6 @@ class Int8BinaryLoader(Loader):
 
 
 class OidBinaryLoader(Loader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> int:
@@ -262,7 +247,6 @@ class FloatLoader(Loader):
 
 
 class Float4BinaryLoader(Loader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> float:
@@ -270,7 +254,6 @@ class Float4BinaryLoader(Loader):
 
 
 class Float8BinaryLoader(Loader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> float:
@@ -331,7 +314,6 @@ _pack_numeric_head = cast(
 
 
 class NumericBinaryLoader(Loader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> Decimal:
@@ -361,7 +343,6 @@ NUMERIC_NINF_BIN = _pack_numeric_head(0, 0, NUMERIC_NINF, 0)
 
 
 class DecimalBinaryDumper(Dumper):
-
     format = Format.BINARY
     oid = _oids.NUMERIC_OID
 
@@ -378,7 +359,6 @@ class NumericDumper(DecimalDumper):
 
 
 class NumericBinaryDumper(Dumper):
-
     format = Format.BINARY
     oid = _oids.NUMERIC_OID
 
index 98ad7c44d609472e029038df79291be09251fe3a..649f3ce0542971ca6f5a145bae076070c1799f03 100644 (file)
@@ -396,7 +396,6 @@ _re_esc = re.compile(rb"([\\\"])")
 
 
 class RangeBinaryDumper(BaseRangeDumper):
-
     format = Format.BINARY
 
     def dump(self, obj: Range[Any]) -> Buffer:
@@ -517,7 +516,6 @@ _re_undouble = re.compile(rb'(["\\])\1')
 
 
 class RangeBinaryLoader(BaseRangeLoader[T]):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> Range[T]:
index 11318667915a4a24da6cd56481fc8227421d7c53..a0adc5650412d27b4d721b4bfeefb92ea723fcca 100644 (file)
@@ -56,17 +56,14 @@ class _StrDumper(_BaseStrDumper):
 
 
 class StrBinaryDumper(_StrBinaryDumper):
-
     oid = _oids.TEXT_OID
 
 
 class StrBinaryDumperVarchar(_StrBinaryDumper):
-
     oid = _oids.VARCHAR_OID
 
 
 class StrBinaryDumperName(_StrBinaryDumper):
-
     oid = _oids.NAME_OID
 
 
@@ -84,12 +81,10 @@ class StrDumper(_StrDumper):
 
 
 class StrDumperVarchar(_StrDumper):
-
     oid = _oids.VARCHAR_OID
 
 
 class StrDumperName(_StrDumper):
-
     oid = _oids.NAME_OID
 
 
@@ -126,12 +121,10 @@ class TextLoader(Loader):
 
 
 class TextBinaryLoader(TextLoader):
-
     format = Format.BINARY
 
 
 class BytesDumper(Dumper):
-
     oid = _oids.BYTEA_OID
     _qprefix = b""
 
@@ -169,7 +162,6 @@ class BytesDumper(Dumper):
 
 
 class BytesBinaryDumper(Dumper):
-
     format = Format.BINARY
     oid = _oids.BYTEA_OID
 
@@ -178,7 +170,6 @@ class BytesBinaryDumper(Dumper):
 
 
 class ByteaLoader(Loader):
-
     _escaping: "EscapingProto"
 
     def __init__(self, oid: int, context: Optional[AdaptContext] = None):
@@ -191,7 +182,6 @@ class ByteaLoader(Loader):
 
 
 class ByteaBinaryLoader(Loader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> Buffer:
index f9f35d54f87899459abe677d61756656047b288b..6e0d8156b9b2e44192d0bdb9e41738d92ac74a84 100644 (file)
@@ -19,7 +19,6 @@ UUID: Callable[..., "uuid.UUID"] = None  # type: ignore[assignment]
 
 
 class UUIDDumper(Dumper):
-
     oid = _oids.UUID_OID
 
     def dump(self, obj: "uuid.UUID") -> bytes:
@@ -27,7 +26,6 @@ class UUIDDumper(Dumper):
 
 
 class UUIDBinaryDumper(UUIDDumper):
-
     format = Format.BINARY
 
     def dump(self, obj: "uuid.UUID") -> bytes:
@@ -48,7 +46,6 @@ class UUIDLoader(Loader):
 
 
 class UUIDBinaryLoader(UUIDLoader):
-
     format = Format.BINARY
 
     def load(self, data: Buffer) -> "uuid.UUID":
index d96f747f1973fb5bd72d23660465fa0415017a8b..089fa4ee276f8cd0948a53614f59a54d4a0da69b 100644 (file)
@@ -72,7 +72,7 @@ test =
     pytest-cov >= 3.0
     pytest-randomly >= 3.5
 dev =
-    black >= 22.3.0
+    black >= 23.1.0
     dnspython >= 2.1
     flake8 >= 4.0
     mypy >= 0.990
index c081419e702c48e765310de920df5aca80127c91..fe29408c3034b2c6abe5bf1f818d8b3ddb4161cb 100644 (file)
@@ -16,7 +16,6 @@ from ._compat import Counter, Deque
 
 
 class BasePool(Generic[ConnectionType]):
-
     # Used to generate pool names
     _num_pool = 0
 
index 05cfc8fea2ce445f757c988b4dd93a5b0e19800e..dd50d73a6de4aea2c8bc0bef7b001a81694a9d5d 100644 (file)
@@ -351,7 +351,6 @@ class ConnectionPool(BasePool[Connection[Any]]):
         connections: Sequence[Connection[Any]] = (),
         timeout: float = 0.0,
     ) -> None:
-
         # Stop the scheduler
         self._sched.enter(0, None)
 
index 5c86d5a3a0c0e08b27ae2c307d9ac1190ed0ae2b..a254f29076c10651ca07b94eff14e36534796d1c 100644 (file)
@@ -17,7 +17,7 @@ pytest-cov == 3.0.0
 pytest-randomly == 3.5.0
 
 # From the 'dev' extra
-black == 22.3.0
+black == 23.1.0
 dnspython == 2.1.0
 flake8 == 4.0.0
 types-setuptools == 57.4.0
index c0e80603f7f932fa7cf24d11115fff1657ff9e31..51cc67ad9924233036c92c4d6aae1a8294ec037a 100644 (file)
@@ -191,7 +191,6 @@ def test_reset(dsn):
 
     with NullConnectionPool(dsn, max_size=1, reset=reset) as p:
         with p.connection() as conn:
-
             # Queue the worker so it will take the same connection a second time
             # instead of making a new one.
             t = Thread(target=worker)
@@ -225,7 +224,6 @@ def test_reset_badstate(dsn, caplog):
 
     with NullConnectionPool(dsn, max_size=1, reset=reset) as p:
         with p.connection() as conn:
-
             t = Thread(target=worker)
             t.start()
             ensure_waiting(p)
@@ -257,7 +255,6 @@ def test_reset_broken(dsn, caplog):
 
     with NullConnectionPool(dsn, max_size=1, reset=reset) as p:
         with p.connection() as conn:
-
             t = Thread(target=worker)
             t.start()
             ensure_waiting(p)
index 23a1a5221fb70f0b9fac547fd564d75d6c346d21..d33eecb4d10844661e7edda9184376c98ee6a1aa 100644 (file)
@@ -193,7 +193,6 @@ async def test_reset(dsn):
 
     async with AsyncNullConnectionPool(dsn, max_size=1, reset=reset) as p:
         async with p.connection() as conn:
-
             # Queue the worker so it will take the same connection a second time
             # instead of making a new one.
             t = create_task(worker())
@@ -226,7 +225,6 @@ async def test_reset_badstate(dsn, caplog):
 
     async with AsyncNullConnectionPool(dsn, max_size=1, reset=reset) as p:
         async with p.connection() as conn:
-
             t = create_task(worker())
             await ensure_waiting(p)
 
@@ -257,7 +255,6 @@ async def test_reset_broken(dsn, caplog):
 
     async with AsyncNullConnectionPool(dsn, max_size=1, reset=reset) as p:
         async with p.connection() as conn:
-
             t = create_task(worker())
             await ensure_waiting(p)
 
index 30c790b10963c240b26b101f874ab6b9e29fe2f4..29c4bf55456edfa93b9ec09e362cf4f02eef4ec7 100644 (file)
@@ -812,7 +812,6 @@ def test_grow(dsn, monkeypatch, min_size, want_times):
 @pytest.mark.slow
 @pytest.mark.timing
 def test_shrink(dsn, monkeypatch):
-
     from psycopg_pool.pool import ShrinkPool
 
     results: List[Tuple[int, int]] = []
index 286a77524dc4e7dd4e07a13c041f53f96d6118e3..27f9f452c40b3dc00fa09a1a26ff96414d01deb2 100644 (file)
@@ -766,7 +766,6 @@ async def test_grow(dsn, monkeypatch, min_size, want_times):
 @pytest.mark.slow
 @pytest.mark.timing
 async def test_shrink(dsn, monkeypatch):
-
     from psycopg_pool.pool_async import ShrinkPool
 
     results: List[Tuple[int, int]] = []
index a4d1af3024d7e168d3fa55d15bc684ca7a00b1dc..bf137db61f3c5f20a9fe1a49ec1541cd21492148 100644 (file)
@@ -30,7 +30,6 @@ data: List[Dict[str, Any]] = []
 
 
 def main() -> None:
-
     args = parse_cmdline()
 
     ids[:] = range(args.ntests)
index 9ca469bfb78a6334549db6d498009eb1959ca03c..31668d20ead9d776e280c7fd6455ddfca7b2fd19 100644 (file)
@@ -133,7 +133,6 @@ def test_subclass_dumper(conn):
 
 
 def test_dumper_protocol(conn):
-
     # This class doesn't inherit from adapt.Dumper but passes a mypy check
     from .adapters_example import MyStrDumper
 
@@ -146,7 +145,6 @@ def test_dumper_protocol(conn):
 
 
 def test_loader_protocol(conn):
-
     # This class doesn't inherit from adapt.Loader but passes a mypy check
     from .adapters_example import MyTextLoader
 
@@ -392,7 +390,6 @@ def test_no_cast_needed(conn, fmt_in):
 @pytest.mark.slow
 @pytest.mark.skipif(_psycopg is None, reason="C module test")
 def test_optimised_adapters():
-
     # All the optimised adapters available
     c_adapters = {}
     for n in dir(_psycopg):
index 15b370685b819377ca930ff34be60a40736eb027..857491ccd1b4afd0c3d4f375760b9632eb505974 100644 (file)
@@ -57,9 +57,7 @@ def test_srv(conninfo, want, env, fake_srv, setpgenv):
 async def test_srv_async(conninfo, want, env, afake_srv, setpgenv):
     setpgenv(env)
     params = conninfo_to_dict(conninfo)
-    params = await (
-        psycopg._dns.resolve_srv_async(params)  # type: ignore[attr-defined]
-    )
+    params = await psycopg._dns.resolve_srv_async(params)  # type: ignore[attr-defined]
     assert conninfo_to_dict(want) == params
 
 
index 91a04e0672befcf721d16f9fadb685ea95771fb6..f1ef16cb6a00c32481cb5d2fa5cde25ba9deef67 100644 (file)
@@ -181,7 +181,7 @@ class TestTPC:
 
         # check the values returned
         assert len(okvals) == len(xids)
-        for (xid, (gid, prepared, owner, database)) in zip(xids, okvals):
+        for xid, (gid, prepared, owner, database) in zip(xids, okvals):
             assert xid.gtrid == gid
             assert xid.prepared == prepared
             assert xid.owner == owner
index a409a2e82b4cb6665a6297ac8df8d5e2fec7bef4..a829c4c12dd5d70b4685574ede73306f7ac73628 100644 (file)
@@ -185,7 +185,7 @@ class TestTPC:
 
         # check the values returned
         assert len(okvals) == len(xids)
-        for (xid, (gid, prepared, owner, database)) in zip(xids, okvals):
+        for xid, (gid, prepared, owner, database) in zip(xids, okvals):
             assert xid.gtrid == gid
             assert xid.prepared == prepared
             assert xid.owner == owner
index f715539af801af422091a2880a70535316a28469..56dab053dabafb706294c93bf10f12aef355d6fc 100644 (file)
@@ -69,7 +69,6 @@ _info_cls = pytest.mark.parametrize(
 @_status
 @_info_cls
 def test_fetch_not_found(conn, name, status, info_cls, monkeypatch):
-
     if TypeInfo._has_to_regtype_function(conn):
         exit_orig = psycopg.Transaction.__exit__
 
@@ -93,7 +92,6 @@ def test_fetch_not_found(conn, name, status, info_cls, monkeypatch):
 @_status
 @_info_cls
 async def test_fetch_not_found_async(aconn, name, status, info_cls, monkeypatch):
-
     if TypeInfo._has_to_regtype_function(aconn):
         exit_orig = psycopg.AsyncTransaction.__aexit__
 
index 74c17a61438da7b77a965f4e213d43494db8be92..b0db151321538546fd382c196e50521807839f26 100644 (file)
@@ -263,7 +263,6 @@ def test_dump_list_no_comma_separator(conn):
             self.coords = (x1, y1, x2, y2)
 
     class BoxDumper(Dumper):
-
         format = pq.Format.TEXT
         oid = psycopg.postgres.types["box"].oid
 
index edd4dad7af5e475f6cbbd4ebb7f3506f0762a3b9..73f394d13b1ab8ee9e57d8c7dbbe75a461fa9e70 100644 (file)
@@ -26,7 +26,6 @@ def test_roundtrip_bool(conn, b, fmt_in, fmt_out):
 
 @pytest.mark.parametrize("val", [True, False])
 def test_quote_bool(conn, val):
-
     tx = Transformer()
     assert tx.get_dumper(val, PyFormat.TEXT).quote(val) == str(val).lower().encode(
         "ascii"
@@ -38,7 +37,6 @@ def test_quote_bool(conn, val):
 
 
 def test_quote_none(conn):
-
     tx = Transformer()
     assert tx.get_dumper(None, PyFormat.TEXT).quote(None) == b"NULL"
 
index 4c008fd786d1edd8906eb62cfbfc450fbc8178fb..94827a3a066110ae7e8d59a85b8a398980932fc0 100644 (file)
@@ -3,7 +3,6 @@ from psycopg.adapt import Transformer, PyFormat
 
 
 def test_quote_none(conn):
-
     tx = Transformer()
     assert tx.get_dumper(None, PyFormat.TEXT).quote(None) == b"NULL"
 
index 3eb8f2a29ffcb99177bb819cc3d7c4f5652415e2..22f04ec5307de7cb3bd5cc13b1785ac377e10244 100755 (executable)
@@ -104,7 +104,7 @@ def get_version_comment(conn: Connection) -> List[str]:
 
 def get_py_oids(conn: Connection) -> List[str]:
     lines = []
-    for (typname, oid) in conn.execute(
+    for typname, oid in conn.execute(
         """
 select typname, oid
 from pg_type
@@ -125,7 +125,7 @@ def get_py_types(conn: Connection) -> List[str]:
     # Note: "record" is a pseudotype but still a useful one to have.
     # "pg_lsn" is a documented public type and useful in streaming replication
     lines = []
-    for (typname, oid, typarray, regtype, typdelim) in conn.execute(
+    for typname, oid, typarray, regtype, typdelim in conn.execute(
         """
 select typname, oid, typarray,
     -- CRDB might have quotes in the regtype representation
@@ -160,7 +160,7 @@ order by typname
 
 def get_py_ranges(conn: Connection) -> List[str]:
     lines = []
-    for (typname, oid, typarray, rngsubtype) in conn.execute(
+    for typname, oid, typarray, rngsubtype in conn.execute(
         """
 select typname, oid, typarray, rngsubtype
 from
@@ -180,7 +180,7 @@ order by typname
 
 def get_py_multiranges(conn: Connection) -> List[str]:
     lines = []
-    for (typname, oid, typarray, rngtypid, rngsubtype) in conn.execute(
+    for typname, oid, typarray, rngtypid, rngsubtype in conn.execute(
         """
 select typname, oid, typarray, rngtypid, rngsubtype
 from
@@ -203,7 +203,7 @@ order by typname
 
 def get_cython_oids(conn: Connection) -> List[str]:
     lines = []
-    for (typname, oid) in conn.execute(
+    for typname, oid in conn.execute(
         """
 select typname, oid
 from pg_type