Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4e0aacc

Browse files
authored
Extend annotations for psycopg2.sql (#8263)
1 parent edc0ecd commit 4e0aacc

1 file changed

Lines changed: 20 additions & 19 deletions

File tree

stubs/psycopg2/psycopg2/sql.pyi

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,49 @@
1+
from collections.abc import Iterator
12
from typing import Any
23

34
class Composable:
45
def __init__(self, wrapped) -> None: ...
56
def as_string(self, context) -> str: ...
6-
def __add__(self, other): ...
7-
def __mul__(self, n): ...
8-
def __eq__(self, other): ...
9-
def __ne__(self, other): ...
7+
def __add__(self, other) -> Composed: ...
8+
def __mul__(self, n) -> Composed: ...
9+
def __eq__(self, other) -> bool: ...
10+
def __ne__(self, other) -> bool: ...
1011

1112
class Composed(Composable):
1213
def __init__(self, seq) -> None: ...
1314
@property
14-
def seq(self): ...
15-
def as_string(self, context): ...
16-
def __iter__(self): ...
17-
def __add__(self, other): ...
18-
def join(self, joiner): ...
15+
def seq(self) -> list[Composable]: ...
16+
def as_string(self, context) -> str: ...
17+
def __iter__(self) -> Iterator[Composable]: ...
18+
def __add__(self, other) -> Composed: ...
19+
def join(self, joiner) -> Composed: ...
1920

2021
class SQL(Composable):
2122
def __init__(self, string) -> None: ...
2223
@property
23-
def string(self): ...
24-
def as_string(self, context): ...
25-
def format(self, *args, **kwargs): ...
26-
def join(self, seq): ...
24+
def string(self) -> str: ...
25+
def as_string(self, context) -> str: ...
26+
def format(self, *args, **kwargs) -> Composed: ...
27+
def join(self, seq) -> Composed: ...
2728

2829
class Identifier(Composable):
2930
def __init__(self, *strings) -> None: ...
3031
@property
31-
def strings(self): ...
32+
def strings(self) -> tuple[str, ...]: ...
3233
@property
33-
def string(self): ...
34-
def as_string(self, context): ...
34+
def string(self) -> str: ...
35+
def as_string(self, context) -> str: ...
3536

3637
class Literal(Composable):
3738
@property
3839
def wrapped(self): ...
39-
def as_string(self, context): ...
40+
def as_string(self, context) -> str: ...
4041

4142
class Placeholder(Composable):
4243
def __init__(self, name: Any | None = ...) -> None: ...
4344
@property
44-
def name(self): ...
45-
def as_string(self, context): ...
45+
def name(self) -> str | None: ...
46+
def as_string(self, context) -> str: ...
4647

4748
NULL: Any
4849
DEFAULT: Any

0 commit comments

Comments
 (0)