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

Method _cc_link

tensorflow/tools/docs/parser.py:446–469  ·  view source on GitHub ↗

Generate a link for a @{tensorflow::...} reference.

(self, string, link_text, unused_manual_link_text,
               relative_path_to_root)

Source from the content-addressed store, hash-verified

444 raise TFDocsError('Unknown Document "%s"' % string)
445
446 def _cc_link(self, string, link_text, unused_manual_link_text,
447 relative_path_to_root):
448 """Generate a link for a @{tensorflow::...} reference."""
449 # TODO(josh11b): Fix this hard-coding of paths.
450 if string == 'tensorflow::ClientSession':
451 ret = 'class/tensorflow/client-session.md'
452 elif string == 'tensorflow::Scope':
453 ret = 'class/tensorflow/scope.md'
454 elif string == 'tensorflow::Status':
455 ret = 'class/tensorflow/status.md'
456 elif string == 'tensorflow::Tensor':
457 ret = 'class/tensorflow/tensor.md'
458 elif string == 'tensorflow::ops::Const':
459 ret = 'namespace/tensorflow/ops.md#const'
460 else:
461 raise TFDocsError('C++ reference not understood: "%s"' % string)
462
463 # relative_path_to_root gets you to api_docs/python, we go from there
464 # to api_docs/cc, and then add ret.
465 cc_relative_path = os.path.normpath(os.path.join(
466 relative_path_to_root, '../cc', ret))
467
468 return '<a href="{}"><code>{}</code></a>'.format(cc_relative_path,
469 link_text)
470
471
472# TODO(aselle): Collect these into a big list for all modules and functions

Callers 1

_one_refMethod · 0.95

Calls 3

TFDocsErrorClass · 0.85
joinMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected