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 ):
@@ -921,7 +922,7 @@ async def _copy_out(self, copy_stmt: str,
921
922
# output is not a path-like object
922
923
path = None
923
924
924
- writer = None # type: typing.Optional[Writer ]
925
+ writer = None # type: typing.Optional[_Writer ]
925
926
opened_by_us = False
926
927
run_in_executor = self ._loop .run_in_executor
927
928
@@ -1509,7 +1510,7 @@ def _set_proxy(self, proxy: typing.Optional['_pool.PoolConnectionProxy']) \
1509
1510
self ._proxy = proxy
1510
1511
1511
1512
def _check_listeners (self ,
1512
- listeners : 'typing._Collection[AnyCallable ]' ,
1513
+ listeners : 'typing._Collection[_AnyCallable ]' ,
1513
1514
listener_type : str ) -> None :
1514
1515
if listeners :
1515
1516
count = len (listeners )
@@ -1606,24 +1607,24 @@ async def reload_schema_state(self) -> None:
1606
1607
async def _execute (self , query : str , args : typing .Sequence [typing .Any ],
1607
1608
limit : int , timeout : typing .Optional [float ],
1608
1609
return_status : typing_extensions .Literal [True ]) \
1609
- -> RecordsExtraType :
1610
+ -> _RecordsExtraType :
1610
1611
...
1611
1612
1612
- @typing .overload # noqa: F811
1613
+ @typing .overload
1613
1614
async def _execute (self , query : str , args : typing .Sequence [typing .Any ],
1614
1615
limit : int , timeout : typing .Optional [float ],
1615
1616
return_status : typing_extensions .Literal [False ] = ...) \
1616
- -> RecordsType :
1617
+ -> _RecordsType :
1617
1618
...
1618
1619
1619
- @typing .overload # noqa: F811
1620
+ @typing .overload
1620
1621
async def _execute (self , query : str , args : typing .Sequence [typing .Any ],
1621
1622
limit : int , timeout : typing .Optional [float ],
1622
1623
return_status : bool ) \
1623
- -> typing .Union [RecordsExtraType , RecordsType ]:
1624
+ -> typing .Union [_RecordsExtraType , _RecordsType ]:
1624
1625
...
1625
1626
1626
- async def _execute (self , query : str , args : typing .Sequence [typing .Any ], # noqa: F811, E501
1627
+ async def _execute (self , query : str , args : typing .Sequence [typing .Any ],
1627
1628
limit : int , timeout : typing .Optional [float ],
1628
1629
return_status : bool = False ) -> typing .Any :
1629
1630
with self ._stmt_exclusive_section :
@@ -1635,29 +1636,29 @@ async def _execute(self, query: str, args: typing.Sequence[typing.Any], # noqa:
1635
1636
async def __execute (self , query : str , args : typing .Sequence [typing .Any ],
1636
1637
limit : int , timeout : typing .Optional [float ],
1637
1638
return_status : typing_extensions .Literal [True ]) \
1638
- -> typing .Tuple [RecordsExtraType ,
1639
+ -> typing .Tuple [_RecordsExtraType ,
1639
1640
'_cprotocol.PreparedStatementState' ]:
1640
1641
...
1641
1642
1642
- @typing .overload # noqa: F811
1643
+ @typing .overload
1643
1644
async def __execute (self , query : str , args : typing .Sequence [typing .Any ],
1644
1645
limit : int , timeout : typing .Optional [float ],
1645
1646
return_status : typing_extensions .Literal [
1646
1647
False ] = ...) \
1647
- -> typing .Tuple [RecordsType , '_cprotocol.PreparedStatementState' ]:
1648
+ -> typing .Tuple [_RecordsType , '_cprotocol.PreparedStatementState' ]:
1648
1649
...
1649
1650
1650
- @typing .overload # noqa: F811
1651
+ @typing .overload
1651
1652
async def __execute (self , query : str , args : typing .Sequence [typing .Any ],
1652
1653
limit : int , timeout : typing .Optional [float ],
1653
1654
return_status : bool ) \
1654
- -> typing .Union [typing .Tuple [RecordsExtraType ,
1655
+ -> typing .Union [typing .Tuple [_RecordsExtraType ,
1655
1656
'_cprotocol.PreparedStatementState' ],
1656
- typing .Tuple [RecordsType ,
1657
+ typing .Tuple [_RecordsType ,
1657
1658
'_cprotocol.PreparedStatementState' ]]:
1658
1659
...
1659
1660
1660
- async def __execute (self , query : str , # noqa: F811
1661
+ async def __execute (self , query : str ,
1661
1662
args : typing .Sequence [typing .Any ],
1662
1663
limit : int , timeout : typing .Optional [float ],
1663
1664
return_status : bool = False ) -> typing .Tuple [
@@ -1762,7 +1763,7 @@ async def connect(dsn: typing.Optional[str] = ..., *,
1762
1763
...
1763
1764
1764
1765
1765
- @typing .overload # noqa: F811
1766
+ @typing .overload
1766
1767
async def connect (dsn : typing .Optional [str ] = ..., * ,
1767
1768
host : typing .Optional [connect_utils .HostType ] = ...,
1768
1769
port : typing .Optional [connect_utils .PortType ] = ...,
@@ -1777,13 +1778,13 @@ async def connect(dsn: typing.Optional[str] = ..., *,
1777
1778
max_cacheable_statement_size : int = ...,
1778
1779
command_timeout : typing .Optional [float ] = ...,
1779
1780
ssl : typing .Optional [connect_utils .SSLType ] = ...,
1780
- connection_class : typing .Type [C ],
1781
+ connection_class : typing .Type [_Connection ],
1781
1782
server_settings : typing .Optional [
1782
- typing .Dict [str , str ]] = ...) -> C :
1783
+ typing .Dict [str , str ]] = ...) -> _Connection :
1783
1784
...
1784
1785
1785
1786
1786
- async def connect (dsn : typing .Optional [str ] = None , * , # noqa: F811
1787
+ async def connect (dsn : typing .Optional [str ] = None , * ,
1787
1788
host : typing .Optional [connect_utils .HostType ] = None ,
1788
1789
port : typing .Optional [connect_utils .PortType ] = None ,
1789
1790
user : typing .Optional [str ] = None ,
@@ -1797,10 +1798,9 @@ async def connect(dsn: typing.Optional[str] = None, *, # noqa: F811
1797
1798
max_cacheable_statement_size : int = 1024 * 15 ,
1798
1799
command_timeout : typing .Optional [float ] = None ,
1799
1800
ssl : typing .Optional [connect_utils .SSLType ] = None ,
1800
- connection_class : typing .Type [C ] = \
1801
- Connection , # type: ignore
1801
+ connection_class : typing .Type [_Connection ] = Connection , # type: ignore # noqa: E501
1802
1802
server_settings : typing .Optional [
1803
- typing .Dict [str , str ]] = None ) -> C :
1803
+ typing .Dict [str , str ]] = None ) -> _Connection :
1804
1804
r"""A coroutine to establish a connection to a PostgreSQL server.
1805
1805
1806
1806
The connection parameters may be specified either as a connection
0 commit comments