1# Copyright (c) 2017-2018 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 868 unchanged lines hidden (view full) ---

877
878def cxxMethod(*args, **kwargs):
879 """Decorator to export C++ functions to Python"""
880
881 def decorate(func):
882 name = func.__name__
883 override = kwargs.get("override", False)
884 cxx_name = kwargs.get("cxx_name", name)
885 return_value_policy = kwargs.get("return_value_policy", None)
886
887 args, varargs, keywords, defaults = inspect.getargspec(func)
888 if varargs or keywords:
889 raise ValueError("Wrapped methods must not contain variable " \
890 "arguments")
891
892 # Create tuples of (argument, default)
893 if defaults:

--- 8 unchanged lines hidden (view full) ---

902 ccobj = self.getCCObject()
903 return getattr(ccobj, name)(*args, **kwargs)
904
905 @wraps(func)
906 def py_call(self, *args, **kwargs):
907 return func(self, *args, **kwargs)
908
909 f = py_call if override else cxx_call
909 f.__pybind = PyBindMethod(name, cxx_name=cxx_name, args=args)
910 f.__pybind = PyBindMethod(name, cxx_name=cxx_name, args=args,
911 return_value_policy=return_value_policy)
912
913 return f
914
915 if len(args) == 0:
916 return decorate
917 elif len(args) == 1 and len(kwargs) == 0:
918 return decorate(*args)
919 else:

--- 762 unchanged lines hidden ---