当前位置: 首页>>代码示例>>Python>>正文


Python WSGIServer.mro方法代码示例

本文整理汇总了Python中wsgiref.simple_server.WSGIServer.mro方法的典型用法代码示例。如果您正苦于以下问题:Python WSGIServer.mro方法的具体用法?Python WSGIServer.mro怎么用?Python WSGIServer.mro使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wsgiref.simple_server.WSGIServer的用法示例。


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

示例1: shape_text

# 需要导入模块: from wsgiref.simple_server import WSGIServer [as 别名]
# 或者: from wsgiref.simple_server.WSGIServer import mro [as 别名]
def shape_text(this_cls, doc=pydoc.plaintext):
    attrs = [
        (name, kind) for name, kind, cls, _ in pydoc.classify_class_attrs(this_cls)
        if cls == this_cls
    ]
    attrs = [
        (name, kind) for name, kind in attrs if not (name.startswith("__") and name.endswith("__"))
    ]
    method_names = [name for name, kind in attrs if kind == "method"]
    content = doc.indent("".join([doc.document(getattr(this_cls, name)) for name in method_names]))
    mro = " <- ".join([cls.__name__ for cls in this_cls.mro()])
    return "\n".join([mro, content])


def grep_by_indent(s, level, rx=re.compile("^\s+")):
    for line in s.split("\n"):
        m = rx.search(line)
        if m is None or len(m.group(0)) <= level:
            yield line


from matplotlib.backends.backend_svg import RendererSVG  # noqa
# from collections import ChainMap
from wsgiref.simple_server import WSGIServer

for cls in WSGIServer.mro():
    if cls == object:
        break
    text = shape_text(cls)
    print("\n".join(grep_by_indent(text, 4)))
开发者ID:podhmo,项目名称:individual-sandbox,代码行数:32,代码来源:03shape.py


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