|
23 | 23 | from future.utils import with_metaclass
|
24 | 24 |
|
25 | 25 |
|
26 |
| -class asynchron(with_metaclass(abc.ABCMeta, object)): |
| 26 | +class async_(with_metaclass(abc.ABCMeta, object)): |
27 | 27 | """ Base class for async_function/async_method. Creates a wrapped function/method that will
|
28 | 28 | run the original function/method on a thread pool worker thread and return a Job instance
|
29 | 29 | for monitoring the status of the thread.
|
@@ -55,27 +55,27 @@ def __call__(self, *args, **kwargs):
|
55 | 55 | return _job.Job(future=self.executor.submit(self._call, *args, **kwargs))
|
56 | 56 |
|
57 | 57 |
|
58 |
| -class async_function(asynchron): |
| 58 | +class async_function(async_): |
59 | 59 | """ This decorator can be applied to any static function that makes blocking calls to create
|
60 | 60 | a modified version that creates a Job and returns immediately; the original
|
61 | 61 | method will be called on a thread pool worker thread.
|
62 | 62 | """
|
63 | 63 |
|
64 | 64 | def _call(self, *args, **kwargs):
|
65 | 65 | # Call the wrapped method.
|
66 |
| - return self._function(*asynchron._preprocess_args(*args), **asynchron._preprocess_kwargs(**kwargs)) |
| 66 | + return self._function(*async_._preprocess_args(*args), **async_._preprocess_kwargs(**kwargs)) |
67 | 67 |
|
68 | 68 |
|
69 |
| -class async_method(asynchron): |
| 69 | +class async_method(async_): |
70 | 70 | """ This decorator can be applied to any class instance method that makes blocking calls to create
|
71 | 71 | a modified version that creates a Job and returns immediately; the original method will be
|
72 | 72 | called on a thread pool worker thread.
|
73 | 73 | """
|
74 | 74 |
|
75 | 75 | def _call(self, *args, **kwargs):
|
76 | 76 | # Call the wrapped method.
|
77 |
| - return self._function(self.obj, *asynchron._preprocess_args(*args), |
78 |
| - **asynchron._preprocess_kwargs(**kwargs)) |
| 77 | + return self._function(self.obj, *async_._preprocess_args(*args), |
| 78 | + **async_._preprocess_kwargs(**kwargs)) |
79 | 79 |
|
80 | 80 | def __get__(self, instance, owner):
|
81 | 81 | # This is important for attribute inheritance and setting self.obj so it can be
|
|
0 commit comments