def __init__(self, f, app_name=None, unwrap_spec=None, descrmismatch=None, as_classmethod=False): "NOT_RPYTHON" Wrappable.__init__(self) # f must be a function whose name does NOT start with 'app_' self_type = None if hasattr(f, 'im_func'): self_type = f.im_class f = f.im_func if not isinstance(f, types.FunctionType): raise TypeError, "function expected, got %r instead" % f if app_name is None: if f.func_name.startswith('app_'): raise ValueError, ("function name %r suspiciously starts " "with 'app_'" % f.func_name) app_name = f.func_name self._code = BuiltinCode(f, unwrap_spec=unwrap_spec, self_type=self_type, descrmismatch=descrmismatch) self.__name__ = f.func_name self.name = app_name self.as_classmethod = as_classmethod self._staticdefs = list(f.func_defaults or ())
def __init__(self, f, app_name=None, unwrap_spec = None, descrmismatch=None): "NOT_RPYTHON" Wrappable.__init__(self) # f must be a function whose name does NOT start with 'app_' self_type = None if hasattr(f, 'im_func'): self_type = f.im_class f = f.im_func if not isinstance(f, types.FunctionType): raise TypeError, "function expected, got %r instead" % f if app_name is None: if f.func_name.startswith('app_'): raise ValueError, ("function name %r suspiciously starts " "with 'app_'" % f.func_name) app_name = f.func_name self._code = BuiltinCode(f, unwrap_spec=unwrap_spec, self_type = self_type, descrmismatch=descrmismatch) self.__name__ = f.func_name self.name = app_name self._staticdefs = list(f.func_defaults or ())
def __new__(cls, f, app_name=None, unwrap_spec=None, descrmismatch=None, as_classmethod=False): "NOT_RPYTHON" # f must be a function whose name does NOT start with 'app_' self_type = None if hasattr(f, 'im_func'): self_type = f.im_class f = f.im_func if not isinstance(f, types.FunctionType): raise TypeError, "function expected, got %r instead" % f if app_name is None: if f.func_name.startswith('app_'): raise ValueError, ("function name %r suspiciously starts " "with 'app_'" % f.func_name) app_name = f.func_name if unwrap_spec is not None: unwrap_spec_key = tuple(unwrap_spec) else: unwrap_spec_key = None key = (f, self_type, unwrap_spec_key, descrmismatch, as_classmethod) if key in cls.instancecache: result = cls.instancecache[key] assert result.__class__ is cls return result self = Wrappable.__new__(cls) cls.instancecache[key] = self self._code = BuiltinCode(f, unwrap_spec=unwrap_spec, self_type=self_type, descrmismatch=descrmismatch) self.__name__ = f.func_name self.name = app_name self.as_classmethod = as_classmethod self._staticdefs = list(f.func_defaults or ()) return self
def __new__(cls, f, app_name=None, unwrap_spec = None, descrmismatch=None, as_classmethod=False): "NOT_RPYTHON" # f must be a function whose name does NOT start with 'app_' self_type = None if hasattr(f, 'im_func'): self_type = f.im_class f = f.im_func if not isinstance(f, types.FunctionType): raise TypeError, "function expected, got %r instead" % f if app_name is None: if f.func_name.startswith('app_'): raise ValueError, ("function name %r suspiciously starts " "with 'app_'" % f.func_name) app_name = f.func_name if unwrap_spec is not None: unwrap_spec_key = tuple(unwrap_spec) else: unwrap_spec_key = None key = (f, self_type, unwrap_spec_key, descrmismatch, as_classmethod) if key in cls.instancecache: result = cls.instancecache[key] assert result.__class__ is cls return result self = Wrappable.__new__(cls) cls.instancecache[key] = self self._code = BuiltinCode(f, unwrap_spec=unwrap_spec, self_type = self_type, descrmismatch=descrmismatch) self.__name__ = f.func_name self.name = app_name self.as_classmethod = as_classmethod self._staticdefs = list(f.func_defaults or ()) return self