MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / getdocloc

Method getdocloc

tools/python-3.11.9-amd64/Lib/pydoc.py:510–534  ·  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

508 docmodule = docclass = docroutine = docother = docproperty = docdata = fail
509
510 def getdocloc(self, object, basedir=sysconfig.get_path('stdlib')):
511 """Return the location of module docs or None"""
512
513 try:
514 file = inspect.getabsfile(object)
515 except TypeError:
516 file = '(built-in)'
517
518 docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS)
519
520 basedir = os.path.normcase(basedir)
521 if (isinstance(object, type(os)) and
522 (object.__name__ in ('errno', 'exceptions', 'gc', 'imp',
523 'marshal', 'posix', 'signal', 'sys',
524 '_thread', 'zipimport') or
525 (file.startswith(basedir) and
526 not file.startswith(os.path.join(basedir, 'site-packages')))) and
527 object.__name__ not in ('xml.etree', 'test.test_pydoc.pydoc_mod')):
528 if docloc.startswith(("http://", "https://")):
529 docloc = "{}/{}.html".format(docloc.rstrip("/"), object.__name__.lower())
530 else:
531 docloc = os.path.join(docloc, object.__name__.lower() + ".html")
532 else:
533 docloc = None
534 return docloc
535
536# -------------------------------------------- HTML documentation generator
537

Callers 2

docmoduleMethod · 0.80
docmoduleMethod · 0.80

Calls 7

startswithMethod · 0.80
typeClass · 0.50
getMethod · 0.45
joinMethod · 0.45
formatMethod · 0.45
rstripMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected