forked from platypush/platypush
In Python 3.7 async is a strict language keyword that can't be used for variables names - replaces occurrences with _async
This commit is contained in:
parent
e625861edf
commit
f0577733b6
2 changed files with 4 additions and 4 deletions
|
@ -159,12 +159,12 @@ class Request(Message):
|
||||||
'origin attached: {}'.format(response))
|
'origin attached: {}'.format(response))
|
||||||
|
|
||||||
|
|
||||||
def execute(self, n_tries=1, async=True, **context):
|
def execute(self, n_tries=1, _async=True, **context):
|
||||||
"""
|
"""
|
||||||
Execute this request and returns a Response object
|
Execute this request and returns a Response object
|
||||||
Params:
|
Params:
|
||||||
n_tries -- Number of tries in case of failure before raising a RuntimeError
|
n_tries -- Number of tries in case of failure before raising a RuntimeError
|
||||||
async -- If True, the request will be run asynchronously and the
|
_async -- If True, the request will be run asynchronously and the
|
||||||
response posted on the bus when available (default),
|
response posted on the bus when available (default),
|
||||||
otherwise the current thread will wait for the response
|
otherwise the current thread will wait for the response
|
||||||
to be returned synchronously.
|
to be returned synchronously.
|
||||||
|
@ -212,7 +212,7 @@ class Request(Message):
|
||||||
if self.token is None or get_hash(self.token) != token_hash:
|
if self.token is None or get_hash(self.token) != token_hash:
|
||||||
raise PermissionError()
|
raise PermissionError()
|
||||||
|
|
||||||
if async:
|
if _async:
|
||||||
Thread(target=_thread_func, args=(n_tries,)).start()
|
Thread(target=_thread_func, args=(n_tries,)).start()
|
||||||
else:
|
else:
|
||||||
return _thread_func(n_tries)
|
return _thread_func(n_tries)
|
||||||
|
|
|
@ -108,7 +108,7 @@ class Procedure(object):
|
||||||
context['async'] = self._async; context['n_tries'] = n_tries
|
context['async'] = self._async; context['n_tries'] = n_tries
|
||||||
response = request.execute(**context)
|
response = request.execute(**context)
|
||||||
|
|
||||||
if not self.async:
|
if not self._async:
|
||||||
if isinstance(response.output, dict):
|
if isinstance(response.output, dict):
|
||||||
for (k,v) in response.output.items():
|
for (k,v) in response.output.items():
|
||||||
context[k] = v
|
context[k] = v
|
||||||
|
|
Loading…
Reference in a new issue