self.file = file
def write(self, data: Buffer) -> None:
- self.file.write(data)
+ self.file.write(data) # type: ignore[arg-type]
class AsyncCopy(BaseCopy["AsyncConnection[Any]"]):
def _parse_row_text(data: Buffer, tx: Transformer) -> Tuple[Any, ...]:
if not isinstance(data, bytes):
data = bytes(data)
- fields = data.split(b"\t") # type: ignore
- fields[-1] = fields[-1][:-1] # type: ignore # drop \n
+ fields = data.split(b"\t")
+ fields[-1] = fields[-1][:-1] # drop \n
row = [None if f == b"\\N" else _load_re.sub(_load_sub, f) for f in fields]
return tx.load_sequence(row)
elif hasattr(obj, "error_message"):
# obj is a PGconn
- obj = cast(PGconn, obj)
if obj.status == OK:
encoding = pgconn_encoding(obj)
bmsg = obj.error_message
aparams = (c_char_p * nparams)(
*(
# convert bytearray/memoryview to bytes
- b
- if b is None or isinstance(b, bytes)
- else bytes(b) # type: ignore[arg-type]
+ b if b is None or isinstance(b, bytes) else bytes(b)
for b in param_values
)
)
return self._load_map[data]
except KeyError:
enc = conn_encoding(self.connection)
- label = data.decode(enc, "replace") # type: ignore[union-attr]
+ label = data.decode(enc, "replace")
raise e.DataError(
f"bad member for enum {self.enum.__qualname__}: {label!r}"
)
global IPv4Address, IPv6Address, IPv4Interface, IPv6Interface
global IPv4Network, IPv6Network
- if not ip_address:
+ if ip_address is None:
from ipaddress import ip_address, ip_interface, ip_network
from ipaddress import IPv4Address, IPv6Address
from ipaddress import IPv4Interface, IPv6Interface
def __init__(self, oid: int, context: Optional[AdaptContext] = None):
super().__init__(oid, context)
global UUID
- if not UUID:
+ if UUID is None:
from uuid import UUID
def load(self, data: Buffer) -> "uuid.UUID":
],
# Requirements to run the test suite
"test": [
- "mypy >= 0.981",
+ "mypy >= 0.990",
"pproxy >= 2.7",
"pytest >= 6.2.5",
"pytest-asyncio >= 0.17",
"black >= 22.3.0",
"dnspython >= 2.1",
"flake8 >= 4.0",
- "mypy >= 0.981",
+ "mypy >= 0.990",
"types-setuptools >= 57.4",
"wheel >= 0.37",
],
]
warn_unused_ignores = true
show_error_codes = true
+disable_bytearray_promotion = true
+disable_memoryview_promotion = true
strict = true
-enable_recursive_aliases = true
[[tool.mypy.overrides]]
module = [