Dorothydu's picture
Upload 50 random repository samples
9d3c8f5 verified
from asyncio import sleep
def make_native_coroutine_handler():
"""Returns a native coroutine to be used in tests"""
async def my_native_coroutine_handler(sleep_time):
await sleep(sleep_time)
return sleep_time
return my_native_coroutine_handler
def make_ref_function():
"""Returns a function with a type hint that is locally defined """
# the symbol is defined here, so it is not seen outside
class A:
pass
def ref(a: A) -> A:
pass
return ref
def make_ref_function2():
""" """
from typing import Any
def ref(a: Any):
pass
return ref
def get_my_wrapper(f):
def my_wrapper(*args, a, **kwargs):
# a is automatically extracted from the sig
return a + f(*args, **kwargs)
return my_wrapper