MCPcopy Index your code
hub / github.com/RustPython/RustPython / getdocloc

Method getdocloc

Lib/pydoc.py:564–598  ·  view source on GitHub ↗

Return the location of module docs or None

(self, object, basedir=sysconfig.get_path('stdlib'))

Source from the content-addressed store, hash-verified

562 docmodule = docclass = docroutine = docother = docproperty = docdata = fail
563
564 def getdocloc(self, object, basedir=sysconfig.get_path('stdlib')):
565 """Return the location of module docs or None"""
566
567 try:
568 file = inspect.getabsfile(object)
569 except TypeError:
570 file = '(built-in)'
571
572 docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS)
573
574 basedir = os.path.normcase(basedir)
575 if (isinstance(object, type(os)) and
576 (object.__name__ in ('errno', 'exceptions', 'gc',
577 'marshal', 'posix', 'signal', 'sys',
578 '_thread', 'zipimport') or
579 (file.startswith(basedir) and
580 not file.startswith(os.path.join(basedir, 'site-packages')))) and
581 object.__name__ not in ('xml.etree', 'test.test_pydoc.pydoc_mod')):
582
583 try:
584 from pydoc_data import module_docs
585 except ImportError:
586 module_docs = None
587
588 if module_docs and object.__name__ in module_docs.module_docs:
589 doc_name = module_docs.module_docs[object.__name__]
590 if docloc.startswith(("http://", "https://")):
591 docloc = "{}/{}".format(docloc.rstrip("/"), doc_name)
592 else:
593 docloc = os.path.join(docloc, doc_name)
594 else:
595 docloc = None
596 else:
597 docloc = None
598 return docloc
599
600# -------------------------------------------- HTML documentation generator
601

Callers 6

docmoduleMethod · 0.80
docmoduleMethod · 0.80
get_pydoc_htmlFunction · 0.80
get_pydoc_linkFunction · 0.80
get_pydoc_textFunction · 0.80
test_online_docs_linkMethod · 0.80

Calls 7

isinstanceFunction · 0.85
normcaseMethod · 0.80
getMethod · 0.45
startswithMethod · 0.45
joinMethod · 0.45
formatMethod · 0.45
rstripMethod · 0.45

Tested by 4

get_pydoc_htmlFunction · 0.64
get_pydoc_linkFunction · 0.64
get_pydoc_textFunction · 0.64
test_online_docs_linkMethod · 0.64