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


Python ModuleFinder.find_all_submodules方法代码示例

本文整理汇总了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
开发者ID:Lemma1,项目名称:MINAMI,代码行数:18,代码来源:make_table.py

示例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
开发者ID:pombredanne,项目名称:pymigration,代码行数:8,代码来源:model.py

示例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
开发者ID:Lemma1,项目名称:MINAMI,代码行数:104,代码来源:test_argdoc.py


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