本文整理汇总了Python中modulefinder.ModuleFinder.find_all_submodules方法的典型用法代码示例。如果您正苦于以下问题:Python ModuleFinder.find_all_submodules方法的具体用法?Python ModuleFinder.find_all_submodules怎么用?Python ModuleFinder.find_all_submodules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modulefinder.ModuleFinder
的用法示例。
在下文中一共展示了ModuleFinder.find_all_submodules方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_submodules
# 需要导入模块: from modulefinder import ModuleFinder [as 别名]
# 或者: from modulefinder.ModuleFinder import find_all_submodules [as 别名]
def get_submodules(package):
"""Find names of all modules in `package`
Parameters
----------
package : imported Python package
Returns
-------
list
Sorted list of fully-qualified module names
"""
mf = ModuleFinder()
modules = sorted(["%s.%s" % (package.__name__,X) for X in mf.find_all_submodules(package) if X != "__init__"])
return modules
示例2: migrations_files
# 需要导入模块: from modulefinder import ModuleFinder [as 别名]
# 或者: from modulefinder.ModuleFinder import find_all_submodules [as 别名]
def migrations_files(self, reverse=False):
finder = ModuleFinder()
submodules_names = [name for name in finder.find_all_submodules(pymigrations) if self._submodule_name_valid(name)]
submodules = [import_module("pymigrations.%s" % name) for name in submodules_names]
submodules = sorted(submodules, key=lambda s: s.version, reverse=reverse)
return submodules
示例3: setUpClass
# 需要导入模块: from modulefinder import ModuleFinder [as 别名]
# 或者: from modulefinder.ModuleFinder import find_all_submodules [as 别名]
#.........这里部分代码省略.........
(" -n M M M, --ne M M M ", None),
(" -n M ", None),
(" -n M M ", None),
(" -n M M M ", None),
(" --ne M ", None),
(" --ne M M ", None),
(" --ne M M M ", None),
# arg + vals + desc
(" -n , --ne some description", None),
(" -n , --ne some description", None),
(" -n , --ne some description", None),
(" -n some description", None),
(" -n some description", None),
(" -n some description", None),
(" --ne some description", None),
(" --ne some description", None),
(" --ne some description", None),
# arg only
(" --help", None),
(" -h", None),
(" -h, --help", None),
(" arg1",None),
(" some_arg some_description with lots of words",None),
]
# test cases for test_get_col1_text, test_get_col2_text
cls.match_dicts = [
{ "arg1" : "ARG",
"col1" : "``ARG``",
"col2" : "",
},
{ "arg1" : "ARG",
"desc" : "some description",
"col1" : "``ARG``",
"col2" : "some description",
},
{ "arg1" : "-v",
"val1" : "ARG",
"col1" : "``-v ARG``",
"col2" : "",
},
{ "arg1" : "--val",
"val1" : "ARG",
"col1" : "``--val ARG``",
"col2" : ""
},
{ "arg1" : "-v",
"val1" : "ARG",
"arg2" : "--val",
"val2" : "ARG",
"desc" : "some description",
"col1" : "``-v ARG``, ``--val ARG``",
"col2" : "some description",
},
{ "arg1" : "-v",
"val1" : "ARG",
"desc" : "some description",
"col1" : "``-v ARG``",
"col2" : "some description",
},
{ "arg1" : "--val",
"val1" : "ARG",
"desc" : "some description",
"col1" : "``--val ARG``",
"col2" : "some description",
},
{ "arg1" : "-v",
"val1" : "ARG",
"arg2" : "--val",
"val2" : "ARG",
"desc" : "some description",
"col1" : "``-v ARG``, ``--val ARG``",
"col2" : "some description",
},
{ "arg1" : "-v",
"arg2" : "--val",
"col1" : "``-v``, ``--val``",
"col2" : ""
},
{ "arg1" : "-v",
"arg2" : "--val",
"desc" : "some description",
"col1" : "``-v``, ``--val``",
"col2" : "some description",
},
]
# automatically load module test cases for functional tests
# testcase names mapped to (module, expected rst output, built rst output)
cls.test_cases = {}
mf = ModuleFinder()
for modname in mf.find_all_submodules(sphinxcontrib.argdoc.test.cases):
if modname not in (__name__,"__init__"):
mod = importlib.import_module("sphinxcontrib.argdoc.test.cases.%s" % modname)
basename = "sphinxcontrib.argdoc.test.cases.%s_postargdoc.rst" % modname
tup = (mod,
resource_filename("sphinxcontrib.argdoc","test/testbuild/%s" % basename),
os.path.join(cls.optdict["outdir"],basename))
cls.test_cases[modname] = tup