XEP-0009: Fix invalid function name under Python 3.7.

This commit is contained in:
Emmanuel Gil Peyrot 2018-07-24 18:21:03 +02:00
parent 2fc2a88970
commit a88f317bbf

View file

@ -405,8 +405,10 @@ class Proxy(Endpoint):
self._callback = callback
def __getattribute__(self, name, *args):
if name in ('__dict__', '_endpoint', 'async', '_callback'):
if name in ('__dict__', '_endpoint', '_callback'):
return object.__getattribute__(self, name)
elif name == 'async':
return lambda callback: Proxy(self._endpoint, callback)
else:
attribute = self._endpoint.__getattribute__(name)
if hasattr(attribute, '__call__'):
@ -420,9 +422,6 @@ class Proxy(Endpoint):
pass # If the attribute doesn't exist, don't care!
return attribute
def async(self, callback):
return Proxy(self._endpoint, callback)
def get_endpoint(self):
'''
Returns the proxified endpoint.