當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。