MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / python_link

Method python_link

tensorflow/tools/docs/parser.py:303–331  ·  view source on GitHub ↗

Resolve a "@{python symbol}" reference to a Markdown link. This will pick the canonical location for duplicate symbols. The input to this function should already be stripped of the '@' and '{}'. This function returns a Markdown link. If `code_ref` is true, it is assumed that this

(self, link_text, ref_full_name, relative_path_to_root,
                  code_ref=True)

Source from the content-addressed store, hash-verified

301 return string
302
303 def python_link(self, link_text, ref_full_name, relative_path_to_root,
304 code_ref=True):
305 """Resolve a "@{python symbol}" reference to a Markdown link.
306
307 This will pick the canonical location for duplicate symbols. The
308 input to this function should already be stripped of the '@' and
309 '{}'. This function returns a Markdown link. If `code_ref` is
310 true, it is assumed that this is a code reference, so the link
311 text will be rendered as code (using backticks).
312 `link_text` should refer to a library symbol, starting with 'tf.'.
313
314 Args:
315 link_text: The text of the Markdown link.
316 ref_full_name: The fully qualified name of the symbol to link to.
317 relative_path_to_root: The relative path from the location of the current
318 document to the root of the API documentation.
319 code_ref: If true (the default), put `link_text` in `...`.
320
321 Returns:
322 A markdown link to the documentation page of `ref_full_name`.
323 """
324 url = self.reference_to_url(ref_full_name, relative_path_to_root)
325
326 if code_ref:
327 link_text = link_text.join(['<code>', '</code>'])
328 else:
329 link_text = self._link_text_to_html(link_text)
330
331 return '<a href="{}">{}</a>'.format(url, link_text)
332
333 @staticmethod
334 def _link_text_to_html(link_text):

Callers 2

_one_refMethod · 0.95
generate_global_indexFunction · 0.80

Calls 4

reference_to_urlMethod · 0.95
_link_text_to_htmlMethod · 0.95
joinMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected