def get_source_info(cls): """Return a dictionary with information about the source code of the implementation. Returns ------- info : dict - "kind" : str The implementation kind. - "name" : str The name of the function that provided the definition. - "sig" : str The formatted signature of the function. - "filename" : str The name of the source file. - "lines": tuple (int, int) First and list line number. - "docstring": str The docstring of the definition. """ basepath = os.path.dirname(os.path.dirname(numba.__file__)) impl = cls._overload_func code, firstlineno, path = cls.get_source_code_info(impl) sig = str(utils.pysignature(impl)) info = { 'kind': "overload", 'name': getattr(impl, '__qualname__', impl.__name__), 'sig': sig, 'filename': utils.safe_relpath(path, start=basepath), 'lines': (firstlineno, firstlineno + len(code) - 1), 'docstring': impl.__doc__ } return info
def get_template_info(self): basepath = os.path.dirname(os.path.dirname(numba.__file__)) impl = self._definition_func code, firstlineno, path = self.get_source_code_info(impl) sig = str(utils.pysignature(impl)) info = { 'kind': "intrinsic", 'name': getattr(impl, '__qualname__', impl.__name__), 'sig': sig, 'filename': utils.safe_relpath(path, start=basepath), 'lines': (firstlineno, firstlineno + len(code) - 1), 'docstring': impl.__doc__ } return info
def get_template_info(cls): basepath = os.path.dirname(os.path.dirname(numba.__file__)) code, firstlineno = inspect.getsourcelines(pyfunc) path = inspect.getsourcefile(pyfunc) sig = str(utils.pysignature(pyfunc)) info = { 'kind': "overload", 'name': getattr(cls.key, '__name__', "unknown"), 'sig': sig, 'filename': utils.safe_relpath(path, start=basepath), 'lines': (firstlineno, firstlineno + len(code) - 1), 'docstring': pyfunc.__doc__ } return info
def get_template_info(self): impl = getattr(self, "generic") basepath = os.path.dirname(os.path.dirname(numba.__file__)) code, firstlineno, path = self.get_source_code_info(impl) sig = str(utils.pysignature(impl)) info = { 'kind': "overload", 'name': getattr(self.key, '__name__', getattr(impl, '__qualname__', impl.__name__),), 'sig': sig, 'filename': utils.safe_relpath(path, start=basepath), 'lines': (firstlineno, firstlineno + len(code) - 1), 'docstring': impl.__doc__ } return info