File tree Expand file tree Collapse file tree 5 files changed +29
-2
lines changed
Expand file tree Collapse file tree 5 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 1818 "__aiter__" : "__iter__" ,
1919 "__anext__" : "__next__" ,
2020 "asynccontextmanager" : "contextmanager" ,
21+ "AsyncIterable" : "Iterable" ,
22+ "AsyncIterator" : "Iterator" ,
23+ "AsyncGenerator" : "Generator" ,
2124 # TODO StopIteration is still accepted in Python 2, but the right change
2225 # is 'raise StopAsyncIteration' -> 'return' since we want to use unasynced
2326 # code in Python 3.7+
@@ -68,8 +71,16 @@ def unasync_tokens(tokens):
6871 # `print( stuff)`
6972 used_space = space
7073 else :
71- if toknum == std_tokenize .NAME and tokval in ASYNC_TO_SYNC :
72- tokval = ASYNC_TO_SYNC [tokval ]
74+ if toknum == std_tokenize .NAME :
75+ if tokval in ASYNC_TO_SYNC :
76+ tokval = ASYNC_TO_SYNC [tokval ]
77+ # Convert classes prefixed with 'Async' into 'Sync'
78+ elif (
79+ len (tokval ) > 5
80+ and tokval .startswith ("Async" )
81+ and tokval [5 ].isupper ()
82+ ):
83+ tokval = "Sync" + tokval [5 :]
7384 if used_space is None :
7485 used_space = space
7586 yield (used_space , tokval )
Original file line number Diff line number Diff line change 1+ class AsyncSocket (object ):
2+ async def send_all (self , data ):
3+ ...
Original file line number Diff line number Diff line change 1+ import typing
2+
3+ typing .AsyncIterable [bytes ]
4+ typing .AsyncIterator [bytes ]
5+ typing .AsyncGenerator [bytes ]
Original file line number Diff line number Diff line change 1+ class SyncSocket (object ):
2+ def send_all (self , data ):
3+ ...
Original file line number Diff line number Diff line change 1+ import typing
2+
3+ typing .Iterable [bytes ]
4+ typing .Iterator [bytes ]
5+ typing .Generator [bytes ]
You can’t perform that action at this time.
0 commit comments