本文整理汇总了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)))