Skip to content

Commit

Permalink
util: python: modules(): Sort modules for docstring
Browse files Browse the repository at this point in the history
Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
  • Loading branch information
pdxjohnny committed Jul 16, 2021
1 parent 9a1f480 commit 9112a67
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions dffml/util/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,22 @@ def modules(
... return (root / "dom") in path.parents or path.name.startswith("__")
...
>>> # Print the first module
>>> for import_name, module in dffml.modules(root, package_name, skip=skip):
... print(import_name)
... break
>>> for import_name, module in sorted(
... dffml.modules(root, package_name, skip=skip),
... key=lambda import_name_and_module: import_name_and_module[0],
... ):
... print(import_name, sorted(module.__dict__.keys())[0])
...
xml.sax.expatreader
xml.etree.ElementInclude ElementTree
xml.etree.ElementPath _SelectorContext
xml.etree.ElementTree Comment
xml.etree.cElementTree Comment
xml.parsers.expat EXPAT_VERSION
xml.sax._exceptions SAXException
xml.sax.expatreader AttributesImpl
xml.sax.handler ContentHandler
xml.sax.saxutils XMLFilterBase
xml.sax.xmlreader AttributesImpl
"""
for path in pathlib.Path(root).rglob("*.py"):
# Figure out name
Expand Down

0 comments on commit 9112a67

Please sign in to comment.