Example #1
0
 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 ())
Example #2
0
 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 ())