35
35
from . import types
36
36
37
37
38
- C = typing .TypeVar ('C' , bound = 'Connection' )
39
- Writer = typing .Callable [[bytes ],
40
- typing .Coroutine [typing .Any , typing .Any , None ]]
38
+ _Connection = typing .TypeVar ('_Connection' , bound = 'Connection' )
39
+ _Writer = typing .Callable [[bytes ],
40
+ typing .Coroutine [typing .Any , typing .Any , None ]]
41
+ _RecordsType = typing .List ['_cprotocol.Record' ]
42
+ _RecordsExtraType = typing .Tuple [_RecordsType , bytes , bool ]
43
+ _AnyCallable = typing .Callable [..., typing .Any ]
44
+
41
45
OutputType = typing .Union [typing .AnyStr ,
42
46
compat .PathLike [typing .AnyStr ],
43
47
typing .IO [typing .AnyStr ],
44
- Writer ]
48
+ _Writer ]
45
49
SourceType = typing .Union [typing .AnyStr ,
46
50
compat .PathLike [typing .AnyStr ],
47
51
typing .IO [typing .AnyStr ],
48
52
typing .AsyncIterable [bytes ]]
49
53
50
54
CopyFormat = typing_extensions .Literal ['text' , 'csv' , 'binary' ]
51
55
PasswordType = typing .Union [str , typing .Callable [[], str ]]
52
- RecordsType = typing .List ['_cprotocol.Record' ]
53
- RecordsExtraType = typing .Tuple [RecordsType , bytes , bool ]
54
- AnyCallable = typing .Callable [..., typing .Any ]
55
56
56
57
57
58
class Listener (typing_extensions .Protocol ):
@@ -890,7 +891,7 @@ async def _copy_out(self, copy_stmt: str,
890
891
# output is not a path-like object
891
892
path = None
892
893
893
- writer = None # type: typing.Optional[Writer ]
894
+ writer = None # type: typing.Optional[_Writer ]
894
895
opened_by_us = False
895
896
run_in_executor = self ._loop .run_in_executor
896
897
@@ -1458,7 +1459,7 @@ def _set_proxy(self, proxy: typing.Optional['_pool.PoolConnectionProxy']) \
1458
1459
self ._proxy = proxy
1459
1460
1460
1461
def _check_listeners (self ,
1461
- listeners : 'typing._Collection[AnyCallable ]' ,
1462
+ listeners : 'typing._Collection[_AnyCallable ]' ,
1462
1463
listener_type : str ) -> None :
1463
1464
if listeners :
1464
1465
count = len (listeners )
@@ -1555,24 +1556,24 @@ async def reload_schema_state(self) -> None:
1555
1556
async def _execute (self , query : str , args : typing .Sequence [typing .Any ],
1556
1557
limit : int , timeout : typing .Optional [float ],
1557
1558
return_status : typing_extensions .Literal [True ]) \
1558
- -> RecordsExtraType :
1559
+ -> _RecordsExtraType :
1559
1560
...
1560
1561
1561
- @typing .overload # noqa: F811
1562
+ @typing .overload
1562
1563
async def _execute (self , query : str , args : typing .Sequence [typing .Any ],
1563
1564
limit : int , timeout : typing .Optional [float ],
1564
1565
return_status : typing_extensions .Literal [False ] = ...) \
1565
- -> RecordsType :
1566
+ -> _RecordsType :
1566
1567
...
1567
1568
1568
- @typing .overload # noqa: F811
1569
+ @typing .overload
1569
1570
async def _execute (self , query : str , args : typing .Sequence [typing .Any ],
1570
1571
limit : int , timeout : typing .Optional [float ],
1571
1572
return_status : bool ) \
1572
- -> typing .Union [RecordsExtraType , RecordsType ]:
1573
+ -> typing .Union [_RecordsExtraType , _RecordsType ]:
1573
1574
...
1574
1575
1575
- async def _execute (self , query : str , args : typing .Sequence [typing .Any ], # noqa: F811, E501
1576
+ async def _execute (self , query : str , args : typing .Sequence [typing .Any ],
1576
1577
limit : int , timeout : typing .Optional [float ],
1577
1578
return_status : bool = False ) -> typing .Any :
1578
1579
with self ._stmt_exclusive_section :
@@ -1584,29 +1585,29 @@ async def _execute(self, query: str, args: typing.Sequence[typing.Any], # noqa:
1584
1585
async def __execute (self , query : str , args : typing .Sequence [typing .Any ],
1585
1586
limit : int , timeout : typing .Optional [float ],
1586
1587
return_status : typing_extensions .Literal [True ]) \
1587
- -> typing .Tuple [RecordsExtraType ,
1588
+ -> typing .Tuple [_RecordsExtraType ,
1588
1589
'_cprotocol.PreparedStatementState' ]:
1589
1590
...
1590
1591
1591
- @typing .overload # noqa: F811
1592
+ @typing .overload
1592
1593
async def __execute (self , query : str , args : typing .Sequence [typing .Any ],
1593
1594
limit : int , timeout : typing .Optional [float ],
1594
1595
return_status : typing_extensions .Literal [
1595
1596
False ] = ...) \
1596
- -> typing .Tuple [RecordsType , '_cprotocol.PreparedStatementState' ]:
1597
+ -> typing .Tuple [_RecordsType , '_cprotocol.PreparedStatementState' ]:
1597
1598
...
1598
1599
1599
- @typing .overload # noqa: F811
1600
+ @typing .overload
1600
1601
async def __execute (self , query : str , args : typing .Sequence [typing .Any ],
1601
1602
limit : int , timeout : typing .Optional [float ],
1602
1603
return_status : bool ) \
1603
- -> typing .Union [typing .Tuple [RecordsExtraType ,
1604
+ -> typing .Union [typing .Tuple [_RecordsExtraType ,
1604
1605
'_cprotocol.PreparedStatementState' ],
1605
- typing .Tuple [RecordsType ,
1606
+ typing .Tuple [_RecordsType ,
1606
1607
'_cprotocol.PreparedStatementState' ]]:
1607
1608
...
1608
1609
1609
- async def __execute (self , query : str , # noqa: F811
1610
+ async def __execute (self , query : str ,
1610
1611
args : typing .Sequence [typing .Any ],
1611
1612
limit : int , timeout : typing .Optional [float ],
1612
1613
return_status : bool = False ) -> typing .Tuple [
@@ -1711,7 +1712,7 @@ async def connect(dsn: typing.Optional[str] = ..., *,
1711
1712
...
1712
1713
1713
1714
1714
- @typing .overload # noqa: F811
1715
+ @typing .overload
1715
1716
async def connect (dsn : typing .Optional [str ] = ..., * ,
1716
1717
host : typing .Optional [connect_utils .HostType ] = ...,
1717
1718
port : typing .Optional [connect_utils .PortType ] = ...,
@@ -1726,13 +1727,13 @@ async def connect(dsn: typing.Optional[str] = ..., *,
1726
1727
max_cacheable_statement_size : int = ...,
1727
1728
command_timeout : typing .Optional [float ] = ...,
1728
1729
ssl : typing .Optional [connect_utils .SSLType ] = ...,
1729
- connection_class : typing .Type [C ],
1730
+ connection_class : typing .Type [_Connection ],
1730
1731
server_settings : typing .Optional [
1731
- typing .Dict [str , str ]] = ...) -> C :
1732
+ typing .Dict [str , str ]] = ...) -> _Connection :
1732
1733
...
1733
1734
1734
1735
1735
- async def connect (dsn : typing .Optional [str ] = None , * , # noqa: F811
1736
+ async def connect (dsn : typing .Optional [str ] = None , * ,
1736
1737
host : typing .Optional [connect_utils .HostType ] = None ,
1737
1738
port : typing .Optional [connect_utils .PortType ] = None ,
1738
1739
user : typing .Optional [str ] = None ,
@@ -1746,10 +1747,9 @@ async def connect(dsn: typing.Optional[str] = None, *, # noqa: F811
1746
1747
max_cacheable_statement_size : int = 1024 * 15 ,
1747
1748
command_timeout : typing .Optional [float ] = None ,
1748
1749
ssl : typing .Optional [connect_utils .SSLType ] = None ,
1749
- connection_class : typing .Type [C ] = \
1750
- Connection , # type: ignore
1750
+ connection_class : typing .Type [_Connection ] = Connection , # type: ignore # noqa: E501
1751
1751
server_settings : typing .Optional [
1752
- typing .Dict [str , str ]] = None ) -> C :
1752
+ typing .Dict [str , str ]] = None ) -> _Connection :
1753
1753
r"""A coroutine to establish a connection to a PostgreSQL server.
1754
1754
1755
1755
The connection parameters may be specified either as a connection
0 commit comments