Last active
April 25, 2019 03:47
-
-
Save 1st1/a1936d2f283c1e2f1848c4ed42634ebf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in asyncio: | |
class asyncio.AbstractFileIOImplementation: | |
async def open(self): | |
raise NotImplementedError | |
async def open(...): | |
return await get_current_loop(). get_file_io_implementation().open(...) | |
# in uvloop or twisted or ...: | |
class uvloop.FileIO(asyncio.AbstractFileIOImplementation): | |
# ... implementation of "open()" | |
class uvloop.Loop(uvloop.FileIO): | |
def get_file_io_implementation(self): | |
return self | |
# later in user code: | |
async def main(): | |
file = await asyncio.open(...) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment