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
class Super: | |
def __get__(self, instance, owner): | |
parent = super(self.owner, instance) | |
return getattr(parent, self.name) | |
def __set_name__(self, owner, name): | |
self.name = name |
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
import asyncio | |
import concurrent | |
from concurrent.futures import ThreadPoolExecutor | |
from contextlib import contextmanager | |
import sys | |
import random | |
import time | |
import uvloop | |
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) |
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
import asyncio | |
import concurrent | |
from concurrent.futures import ThreadPoolExecutor | |
from contextlib import contextmanager | |
import sys | |
import random | |
import time | |
import uvloop | |
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) |
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
import asyncio | |
from functools import wraps | |
# это https://github.com/Bi-Coloured-Python-Rock-Snake/greenhack | |
from greenhack import exempt, as_async | |
def wrap_outer(co_func): | |
@wraps(co_func) | |
def wrapper(*args, **kwargs): |
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
import asyncio | |
import threading | |
import time | |
from asyncio import get_event_loop | |
from functools import wraps | |
from concurrent.futures import ThreadPoolExecutor | |
# implemented for fun. Could use asriref | |
def sync_to_async(f): |