6except ImportError
as e:
7 message =
'Failed to load uHAL bindings.'
8 message +=
'\nDetails: "{}"'
10 if sys.version_info[0] > 2:
11 exec(
'raise type(e)(message.format(e.msg)).with_traceback(sys.exc_info()[2]) from None')
13 exec(
'raise type(e), message.format(e.message), sys.exc_info()[2]')
19if sys.version_info[0] <= 2:
21 return long(int(self))
22 ValWord_uint32.__long__ = _ValWord_to_long
24ValWord_uint32.__index__ = ValWord_uint32.__int__
29 def valWord_method(self):
31 return int_method( int(self) )
33 def valWord_method(self, other):
37 int_method =
getattr(int_type, method_name)
39 return int_method( int_type(self), other )
41 return int_method( int_type(self), int_type(other) )
44 setattr(ValWord_uint32, method_name, valWord_method)
48 for method_name
in method_names:
57 '__sub__',
'__rsub__',
58 '__mul__',
'__rmul__',
59 '__mod__',
'__rmod__',
60 '__pow__',
'__rpow__',
61 '__lshift__',
'__rlshift__',
62 '__rshift__',
'__rrshift__',
63 '__and__',
'__rand__',
68if sys.hexversion >= 0x020600F0:
75_add_int_methods_to_ValWord([
'__lt__',
'__le__',
'__eq__',
'__ne__',
'__gt__',
'__ge__']
if (sys.version_info[0] > 2)
else [
'__cmp__'])
object getattr(handle obj, handle name)
void setattr(handle obj, handle name, handle value)
bool isinstance(handle obj)
\rst Return true if obj is an instance of T.
def _add_int_methods_to_ValWord(method_names, unary=False)
def _add_int_method_to_ValWord(method_name, unary=False)
def _ValWord_to_long(self)
Pythonic additions to the ValWord_uint32 API.
void exec(const str &expr, object global=globals(), object local=object())