rlcompleter2.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:pyshell 作者: oglops 项目源码 文件源码
def doculines(self, name, obj, keywidth):
        """ show documentation for one match trimmed to 
            a few lines (currently one).
        """
        if keyword.iskeyword(name):
            objdoc = '<python keyword>'
        else:
            objdoc = docstring(obj)
            if not objdoc:
                objdoc = ': %s, type: %s' % (obj,type(obj))
        objdoc = self.condense_rex.sub('. ',objdoc.strip())

        # cut out part of c-signature in doctring 
        try:
            inspect.getargspec(obj)
        except TypeError:
            i = objdoc.find('->')
            if i!=-1:
                objdoc = objdoc[i:]

        namedoc = self.TypeView(name,obj)
        namedoc = namedoc.ljust(keywidth)+' '

        line = namedoc + objdoc
        width = self.config.terminalwidth-4
        return [line[:width-1].ljust(width-1)]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号