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


Python pydoc.__file__方法代码示例

本文整理汇总了Python中pydoc.__file__方法的典型用法代码示例。如果您正苦于以下问题:Python pydoc.__file__方法的具体用法?Python pydoc.__file__怎么用?Python pydoc.__file__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pydoc的用法示例。


在下文中一共展示了pydoc.__file__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run_pydoc

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import __file__ [as 别名]
def run_pydoc(module_name, *args, **env):
    """
    Runs pydoc on the specified module. Returns the stripped
    output of pydoc.
    """
    args = args + (module_name,)
    # do not write bytecode files to avoid caching errors
    rc, out, err = assert_python_ok('-B', pydoc.__file__, *args, **env)
    return out.strip() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:test_pydoc.py

示例2: get_pydoc_link

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import __file__ [as 别名]
def get_pydoc_link(module):
    "Returns a documentation web link of a module"
    dirname = os.path.dirname
    basedir = dirname(dirname(os.path.realpath(__file__)))
    doc = pydoc.TextDoc()
    loc = doc.getdocloc(module, basedir=basedir)
    return loc 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:9,代码来源:test_pydoc.py

示例3: _restricted_walk_packages

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import __file__ [as 别名]
def _restricted_walk_packages(self, walk_packages, path=None):
        """
        A version of pkgutil.walk_packages() that will restrict itself to
        a given path.
        """
        default_path = path or [os.path.dirname(__file__)]
        def wrapper(path=None, prefix='', onerror=None):
            return walk_packages(path or default_path, prefix, onerror)
        return wrapper 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:test_pydoc.py

示例4: test_importfile

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import __file__ [as 别名]
def test_importfile(self):
        loaded_pydoc = pydoc.importfile(pydoc.__file__)

        self.assertIsNot(loaded_pydoc, pydoc)
        self.assertEqual(loaded_pydoc.__name__, 'pydoc')
        self.assertEqual(loaded_pydoc.__file__, pydoc.__file__)
        self.assertEqual(loaded_pydoc.__spec__, pydoc.__spec__) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:9,代码来源:test_pydoc.py

示例5: test_url_requests

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import __file__ [as 别名]
def test_url_requests(self):
        # Test for the correct title in the html pages returned.
        # This tests the different parts of the URL handler without
        # getting too picky about the exact html.
        requests = [
            ("", "Pydoc: Index of Modules"),
            ("get?key=", "Pydoc: Index of Modules"),
            ("index", "Pydoc: Index of Modules"),
            ("topics", "Pydoc: Topics"),
            ("keywords", "Pydoc: Keywords"),
            ("pydoc", "Pydoc: module pydoc"),
            ("get?key=pydoc", "Pydoc: module pydoc"),
            ("search?key=pydoc", "Pydoc: Search Results"),
            ("topic?key=def", "Pydoc: KEYWORD def"),
            ("topic?key=STRINGS", "Pydoc: TOPIC STRINGS"),
            ("foobar", "Pydoc: Error - foobar"),
            ("getfile?key=foobar", "Pydoc: Error - getfile?key=foobar"),
            ]

        with self.restrict_walk_packages():
            for url, title in requests:
                self.call_url_handler(url, title)

            path = string.__file__
            title = "Pydoc: getfile " + path
            url = "getfile?key=" + path
            self.call_url_handler(url, title) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:29,代码来源:test_pydoc.py

示例6: get_pydoc_link

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import __file__ [as 别名]
def get_pydoc_link(module):
    "Returns a documentation web link of a module"
    dirname = os.path.dirname
    basedir = dirname(dirname(__file__))
    doc = pydoc.TextDoc()
    loc = doc.getdocloc(module, basedir=basedir)
    return loc 
开发者ID:ShikyoKira,项目名称:Project-New-Reign---Nemesis-Main,代码行数:9,代码来源:test_pydoc.py

示例7: get_pydoc_link

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import __file__ [as 别名]
def get_pydoc_link(module):
    "Returns a documentation web link of a module"
    abspath = os.path.abspath
    dirname = os.path.dirname
    basedir = dirname(dirname(abspath(__file__)))
    doc = pydoc.TextDoc()
    loc = doc.getdocloc(module, basedir=basedir)
    return loc 
开发者ID:bkerler,项目名称:android_universal,代码行数:10,代码来源:test_pydoc.py


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