本文整理匯總了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