MCPcopy Index your code
hub / github.com/python/cpython / getdocloc

Method getdocloc

Lib/pydoc.py:500–523  ·  view source on GitHub ↗

Return the location of module docs or None

(self, object, basedir=None)

Source from the content-addressed store, hash-verified

498 docmodule = docclass = docroutine = docother = docproperty = docdata = fail
499
500 def getdocloc(self, object, basedir=None):
501 """Return the location of module docs or None"""
502 basedir = self.STDLIB_DIR if basedir is None else basedir
503 docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS)
504
505 if (self._is_stdlib_module(object, basedir) and
506 object.__name__ not in ('xml.etree', 'test.test_pydoc.pydoc_mod')):
507
508 try:
509 from pydoc_data import module_docs
510 except ImportError:
511 module_docs = None
512
513 if module_docs and object.__name__ in module_docs.module_docs:
514 doc_name = module_docs.module_docs[object.__name__]
515 if docloc.startswith(("http://", "https://")):
516 docloc = "{}/{}".format(docloc.rstrip("/"), doc_name)
517 else:
518 docloc = os.path.join(docloc, doc_name)
519 else:
520 docloc = None
521 else:
522 docloc = None
523 return docloc
524
525 def _get_version(self, object):
526 if self._is_stdlib_module(object):

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 6

_is_stdlib_moduleMethod · 0.95
getMethod · 0.45
startswithMethod · 0.45
formatMethod · 0.45
rstripMethod · 0.45
joinMethod · 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