|
@@ -13,6 +13,7 @@
|
|
from __future__ import absolute_import
|
|
from __future__ import absolute_import
|
|
|
|
|
|
import importlib
|
|
import importlib
|
|
|
|
+import sys
|
|
|
|
|
|
from .five import long_t, string
|
|
from .five import long_t, string
|
|
|
|
|
|
@@ -20,6 +21,8 @@ __all__ = ['Proxy', 'PromiseProxy', 'try_import', 'maybe_evaluate']
|
|
|
|
|
|
__module__ = __name__ # used by Proxy class body
|
|
__module__ = __name__ # used by Proxy class body
|
|
|
|
|
|
|
|
+PY3 = sys.version_info[0] == 3
|
|
|
|
+
|
|
|
|
|
|
def _default_cls_attr(name, type_, cls_value):
|
|
def _default_cls_attr(name, type_, cls_value):
|
|
# Proxy uses properties to forward the standard
|
|
# Proxy uses properties to forward the standard
|
|
@@ -160,7 +163,6 @@ class Proxy(object):
|
|
__ne__ = lambda x, o: x._get_current_object() != o
|
|
__ne__ = lambda x, o: x._get_current_object() != o
|
|
__gt__ = lambda x, o: x._get_current_object() > o
|
|
__gt__ = lambda x, o: x._get_current_object() > o
|
|
__ge__ = lambda x, o: x._get_current_object() >= o
|
|
__ge__ = lambda x, o: x._get_current_object() >= o
|
|
- __cmp__ = lambda x, o: cmp(x._get_current_object(), o)
|
|
|
|
__hash__ = lambda x: hash(x._get_current_object())
|
|
__hash__ = lambda x: hash(x._get_current_object())
|
|
__call__ = lambda x, *a, **kw: x._get_current_object()(*a, **kw)
|
|
__call__ = lambda x, *a, **kw: x._get_current_object()(*a, **kw)
|
|
__len__ = lambda x: len(x._get_current_object())
|
|
__len__ = lambda x: len(x._get_current_object())
|
|
@@ -188,7 +190,6 @@ class Proxy(object):
|
|
__invert__ = lambda x: ~(x._get_current_object())
|
|
__invert__ = lambda x: ~(x._get_current_object())
|
|
__complex__ = lambda x: complex(x._get_current_object())
|
|
__complex__ = lambda x: complex(x._get_current_object())
|
|
__int__ = lambda x: int(x._get_current_object())
|
|
__int__ = lambda x: int(x._get_current_object())
|
|
- __long__ = lambda x: long_t(x._get_current_object())
|
|
|
|
__float__ = lambda x: float(x._get_current_object())
|
|
__float__ = lambda x: float(x._get_current_object())
|
|
__oct__ = lambda x: oct(x._get_current_object())
|
|
__oct__ = lambda x: oct(x._get_current_object())
|
|
__hex__ = lambda x: hex(x._get_current_object())
|
|
__hex__ = lambda x: hex(x._get_current_object())
|
|
@@ -198,6 +199,10 @@ class Proxy(object):
|
|
__exit__ = lambda x, *a, **kw: x._get_current_object().__exit__(*a, **kw)
|
|
__exit__ = lambda x, *a, **kw: x._get_current_object().__exit__(*a, **kw)
|
|
__reduce__ = lambda x: x._get_current_object().__reduce__()
|
|
__reduce__ = lambda x: x._get_current_object().__reduce__()
|
|
|
|
|
|
|
|
+ if not PY3:
|
|
|
|
+ __cmp__ = lambda x, o: cmp(x._get_current_object(), o)
|
|
|
|
+ __long__ = lambda x: long_t(x._get_current_object())
|
|
|
|
+
|
|
|
|
|
|
class PromiseProxy(Proxy):
|
|
class PromiseProxy(Proxy):
|
|
"""This is a proxy to an object that has not yet been evaulated.
|
|
"""This is a proxy to an object that has not yet been evaulated.
|