From 4e0aaccdabffdf717d45113bbd7eddc2484c56ea Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Mon, 11 Jul 2022 16:31:39 +0200 Subject: [PATCH] Extend annotations for `psycopg2.sql` (#8263) --- stubs/psycopg2/psycopg2/sql.pyi | 39 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/stubs/psycopg2/psycopg2/sql.pyi b/stubs/psycopg2/psycopg2/sql.pyi index 923e0ef90..17cada92a 100644 --- a/stubs/psycopg2/psycopg2/sql.pyi +++ b/stubs/psycopg2/psycopg2/sql.pyi @@ -1,48 +1,49 @@ +from collections.abc import Iterator from typing import Any class Composable: def __init__(self, wrapped) -> None: ... def as_string(self, context) -> str: ... - def __add__(self, other): ... - def __mul__(self, n): ... - def __eq__(self, other): ... - def __ne__(self, other): ... + def __add__(self, other) -> Composed: ... + def __mul__(self, n) -> Composed: ... + def __eq__(self, other) -> bool: ... + def __ne__(self, other) -> bool: ... class Composed(Composable): def __init__(self, seq) -> None: ... @property - def seq(self): ... - def as_string(self, context): ... - def __iter__(self): ... - def __add__(self, other): ... - def join(self, joiner): ... + def seq(self) -> list[Composable]: ... + def as_string(self, context) -> str: ... + def __iter__(self) -> Iterator[Composable]: ... + def __add__(self, other) -> Composed: ... + def join(self, joiner) -> Composed: ... class SQL(Composable): def __init__(self, string) -> None: ... @property - def string(self): ... - def as_string(self, context): ... - def format(self, *args, **kwargs): ... - def join(self, seq): ... + def string(self) -> str: ... + def as_string(self, context) -> str: ... + def format(self, *args, **kwargs) -> Composed: ... + def join(self, seq) -> Composed: ... class Identifier(Composable): def __init__(self, *strings) -> None: ... @property - def strings(self): ... + def strings(self) -> tuple[str, ...]: ... @property - def string(self): ... - def as_string(self, context): ... + def string(self) -> str: ... + def as_string(self, context) -> str: ... class Literal(Composable): @property def wrapped(self): ... - def as_string(self, context): ... + def as_string(self, context) -> str: ... class Placeholder(Composable): def __init__(self, name: Any | None = ...) -> None: ... @property - def name(self): ... - def as_string(self, context): ... + def name(self) -> str | None: ... + def as_string(self, context) -> str: ... NULL: Any DEFAULT: Any