• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python sageinspect.sage_getargspec函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sage.misc.sageinspect.sage_getargspec函数的典型用法代码示例。如果您正苦于以下问题:Python sage_getargspec函数的具体用法?Python sage_getargspec怎么用?Python sage_getargspec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sage_getargspec函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: argspec

 def argspec():
     from sageinspect import sage_getargspec
     argspec = sage_getargspec(func)
     args = (argspec.args if not argspec.args is None else []) + self.options.keys()
     defaults = tuple(argspec.defaults if not argspec.defaults is None else ()) \
                     + tuple(self.options.values())
     #Note: argspec.defaults is not always a tuple for some reason
     return ArgSpec(args, argspec.varargs, argspec.keywords, defaults)
开发者ID:bgxcpku,项目名称:sagelib,代码行数:8,代码来源:decorators.py


示例2: f

 def f(wrapper):
     update_wrapper(wrapper, wrapped, assigned=assigned, updated=updated)
     wrapper._sage_src_ = lambda: sage_getsource(wrapped)
     wrapper._sage_src_lines_ = lambda: sage_getsourcelines(wrapped)
     #Getting the signature right in documentation by Sphinx (Trac 9976)
     #The attribute _sage_argspec_() is read by Sphinx if present and used
     #as the argspec of the function instead of using reflection.
     wrapper._sage_argspec_ = lambda: sage_getargspec(wrapped)
     return wrapper
开发者ID:Etn40ff,项目名称:sage,代码行数:9,代码来源:decorators.py


示例3: argspec

        def argspec():
            argspec = sage_getargspec(func)

            def listForNone(l):
                return l if not l is None else []
            newArgs = [self.name + opt for opt in self.options.keys()]
            args = (argspec.args if not argspec.args is None else []) + newArgs
            defaults = (argspec.defaults if not argspec.defaults is None else ()) \
                        + tuple(self.options.values())
            #Note: argspec.defaults is not always a tuple for some reason
            return ArgSpec(args, argspec.varargs, argspec.keywords, defaults)
开发者ID:Etn40ff,项目名称:sage,代码行数:11,代码来源:decorators.py


示例4: format_args

 def format_args(self):
     # for classes, the relevant signature is the __init__ method's
     initmeth = self.get_attr(self.object, '__init__', None)
     # classes without __init__ method, default __init__ or
     # __init__ written in C?
     if initmeth is None or initmeth is object.__init__ or not \
            (inspect.ismethod(initmeth) or inspect.isfunction(initmeth)):
         return None
     argspec = sage_getargspec(initmeth)
     if argspec[0] and argspec[0][0] in ('cls', 'self'):
         del argspec[0][0]
     return inspect.formatargspec(*argspec)
开发者ID:aaditya-thakkar,项目名称:sage,代码行数:12,代码来源:sage_autodoc.py


示例5: _sage_argspec_

    def _sage_argspec_(self):
        """
        Return the argument specification of the wrapped function or method.

        TESTS::

            sage: from sage.misc.sageinspect import sage_getargspec
            sage: from sage.sets.set_from_iterator import Decorator
            sage: d = Decorator()
            sage: d.f = find_local_minimum
            sage: sage_getargspec(d) # indirect doctest
            ArgSpec(args=['f', 'a', 'b', 'tol', 'maxfun'], varargs=None, keywords=None, defaults=(1.48e-08, 500))
        """
        from sage.misc.sageinspect import sage_getargspec
        return sage_getargspec(self.f)
开发者ID:anuragwaliya,项目名称:sage,代码行数:15,代码来源:set_from_iterator.py


示例6: args_on_obj

 def args_on_obj(self, obj):
     if hasattr(obj, "_sage_argspec_"):
         argspec = obj._sage_argspec_()
     elif inspect.isbuiltin(obj) or inspect.ismethoddescriptor(obj):
         # can never get arguments of a C function or method unless
         # a function to do so is supplied
         if self.env.config.autodoc_builtin_argspec:
             argspec = self.env.config.autodoc_builtin_argspec(obj)
         else:
             return None
     else:
         # The check above misses ordinary Python methods in Cython
         # files.
         argspec = sage_getargspec(obj)
     if argspec is not None and argspec[0] and argspec[0][0] in ('cls', 'self'):
         del argspec[0][0]
     return argspec
开发者ID:aaditya-thakkar,项目名称:sage,代码行数:17,代码来源:sage_autodoc.py


示例7: _sage_argspec_

    def _sage_argspec_(self):
        """
        Returns the argument specification for this object, which is
        just the argument specification for the underlying function.
        See :module:`sage.misc.sageinspect` for more information on
        this convention.

        EXAMPLES::

            sage: from sage.parallel.decorate import Parallel
            sage: p = Parallel(2)
            sage: def f(x, y):
            ...       return x + y
            sage: from sage.misc.sageinspect import sage_getargspec
            sage: sage_getargspec(p(f))
            ArgSpec(args=['x', 'y'], varargs=None, keywords=None, defaults=None)
        """
        from sage.misc.sageinspect import sage_getargspec
        return sage_getargspec(self.func)
开发者ID:sageb0t,项目名称:testsage,代码行数:19,代码来源:decorate.py


示例8: args_on_obj

 def args_on_obj(obj):
     if hasattr(obj, "_sage_argspec_"):
         return obj._sage_argspec_()
     if inspect.isbuiltin(obj) or \
            inspect.ismethoddescriptor(obj):
         # can never get arguments of a C function or method unless
         # a function to do so is supplied
         if self.env.config.autodoc_builtin_argspec:
             argspec = self.env.config.autodoc_builtin_argspec(obj)
             return argspec
         else:
             return None
     argspec = sage_getargspec(obj) #inspect.getargspec(obj)
     if isclassinstance(obj) or inspect.isclass(obj):
         # if a class should be documented as function, we try
         # to use the constructor signature as function
         # signature without the first argument.
         if argspec is not None and argspec[0]:
             del argspec[0][0]
     return argspec
开发者ID:bukzor,项目名称:sage,代码行数:20,代码来源:sage_autodoc.py



注:本文中的sage.misc.sageinspect.sage_getargspec函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sageinspect.sage_getsourcelines函数代码示例发布时间:2022-05-27
下一篇:
Python sage_ostools.have_program函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap