PK!h6aioify/__init__.pyfrom functools import wraps, partial import asyncio import functools import inspect import module_wrapper __all__ = ['aioify'] wrapper_assignments = tuple(x for x in functools.WRAPPER_ASSIGNMENTS if x != '__annotations__') def wrap(func): @wraps(func, assigned=wrapper_assignments) async def run(*args, loop=None, executor=None, **kwargs): if loop is None: loop = asyncio.get_event_loop() pfunc = partial(func, *args, **kwargs) return await loop.run_in_executor(executor, pfunc) @wraps(func, assigned=wrapper_assignments) async def coroutine_run(*args, **kwargs): _, _ = args, kwargs return await func @wraps(func, assigned=wrapper_assignments) async def coroutine_function_run(*args, **kwargs): return await func(*args, **kwargs) if inspect.iscoroutine(object=func): result = coroutine_run elif inspect.iscoroutinefunction(object=func): result = coroutine_function_run else: result = run return result def default_create_name_function(cls): _ = cls return 'create' def aioify(obj, name=None, create_name_function=None, skip=(), wrap_return_values=False): create_name_function = create_name_function or default_create_name_function def create(cls): func = wrap(func=cls) if inspect.isclass(object=cls) else None return create_name_function(cls=cls), func return module_wrapper.wrap(obj=obj, wrapper=wrap, methods_to_add={create}, name=name, skip=skip, wrap_return_values=wrap_return_values) PK! aioify/__init__.pyifrom typing import Any, Callable, Collection def aioify(obj: Any, name: str = None, create_name_function: Callable[[Any], str] = None, skip: Collection[str] = (), wrap_return_values: bool = False): ... PK!Dn"aioify-0.3.1.dist-info/LICENSE.txtCopyright 2018 Yifei Kong Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!H\TTaioify-0.3.1.dist-info/WHEEL 1 0 нR \I$ơ7.ZON `h6oi14m,b4>4ɛpK>X;baP>PK!H2aioify-0.3.1.dist-info/METADATAU]o6}篸Edpv`[Ф tO2-]L$R#8گ%%q l<~{D_%<JpP">mRzn%(p3"[.,]uk;&I-_DžjAT()ۅ(P_߲8l.M:F*ߡpyǖ=USŃpڊI~݆Kή^h4X Mu`nR3Q]7p ,nҢ,e_ :ƦЪo0r#]`.['iֹl1g }H;eUzDgh -:rБ,>ڄ{_dlg~1҇^.KOd_V+։47qWy5B2Y2ފfcD(<#eGd-diwŵt9bv# D07%G,zKl+Iؒ-4ȍcMF"w-$$(iozyJvD)mwL=J0HQJ48sSn8Oы%=&^u0B5ݪgĽbU;3o*l*}wWsG2 eBpd; Fo7W$KΦIv\& <ƥ0sG1C8nuO{]&(,,SuO ;hx ~8y ?<:m}~_]3g젇o3uk3̓n: