MCPcopy Index your code
hub / github.com/pex-tool/pex / serve_html_docs

Function serve_html_docs

pex/docs/command.py:70–103  ·  view source on GitHub ↗
(
    open_browser=False,  # type: bool
    config=HtmlDocsConfig(),  # type: HtmlDocsConfig
)

Source from the content-addressed store, hash-verified

68
69
70def serve_html_docs(
71 open_browser=False, # type: bool
72 config=HtmlDocsConfig(), # type: HtmlDocsConfig
73):
74 # type: (...) -> Union[LaunchResult, Error]
75 html_docs = docs.root(doc_type="html")
76 if not html_docs:
77 return Error(
78 dedent(
79 """\
80 This Pex distribution does not include embedded docs.
81
82 You can find the latest docs here:
83 HTML: https://docs.pex-tool.org
84 PDF: https://github.com/pex-tool/pex/releases/latest/download/pex.pdf
85 """
86 ).rstrip()
87 )
88
89 try:
90 result = server.launch(html_docs, port=STANDARD_PORT)
91 except LaunchError:
92 try:
93 result = server.launch(html_docs, port=0)
94 except LaunchError as e:
95 with open(e.log) as fp:
96 for line in fp:
97 logger.log(logging.ERROR, line.rstrip())
98 return Error("Failed to launch {server}.".format(server=server.name))
99
100 if open_browser:
101 try_(try_open(result.server_info.url, open_program=config.browser, suppress_stderr=True))
102
103 return result

Callers 2

runMethod · 0.90
__call__Method · 0.90

Calls 7

ErrorClass · 0.90
try_Function · 0.90
try_openFunction · 0.90
HtmlDocsConfigClass · 0.85
launchMethod · 0.80
logMethod · 0.80
rootMethod · 0.45

Tested by

no test coverage detected