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

Method build

tensorflow/tools/docs/generate_lib.py:616–680  ·  view source on GitHub ↗

Build all the docs. This produces two outputs python api docs: * generated from modules set with `set_py_modules`. * written to '{FLAGS.output_dir}/api_docs/python/' non-api docs: * Everything in '{FLAGS.src_dir}' is copied to '{FLAGS.output_dir}'. * '@{}' re

(self, flags)

Source from the content-addressed store, hash-verified

614 self._do_not_descend_map)
615
616 def build(self, flags):
617 """Build all the docs.
618
619 This produces two outputs
620
621 python api docs:
622
623 * generated from modules set with `set_py_modules`.
624 * written to '{FLAGS.output_dir}/api_docs/python/'
625
626 non-api docs:
627
628 * Everything in '{FLAGS.src_dir}' is copied to '{FLAGS.output_dir}'.
629 * '@{}' references in '.md' files are replaced with links.
630 * '.md' files under 'api_guides/python' have explicit ids set for their
631 second level headings.
632
633 Args:
634 flags:
635 * src_dir: Where to fetch the non-api-docs.
636 * base_dir: Base of the docs directory (Used to build correct
637 relative links).
638 * output_dir: Where to write the resulting docs.
639
640 Returns:
641 The number of errors encountered while processing.
642 """
643 # Extract the python api from the _py_modules
644 doc_index = build_doc_index(flags.src_dir)
645 visitor = self.run_extraction()
646 reference_resolver = self.make_reference_resolver(visitor, doc_index)
647
648 if getattr(flags, 'api_cache_out_path', None):
649 reference_resolver.to_json_file(flags.api_cache_out_path)
650
651 # Build the guide_index for the api_docs back links.
652 root_title = getattr(flags, 'root_title', 'TensorFlow')
653 guide_index = _build_guide_index(
654 os.path.join(flags.src_dir, 'api_guides/python'))
655
656 # Write the api docs.
657 parser_config = self.make_parser_config(visitor, reference_resolver,
658 guide_index, flags.base_dir)
659 output_dir = os.path.join(flags.output_dir, 'api_docs/python')
660
661 write_docs(
662 output_dir,
663 parser_config,
664 yaml_toc=self.yaml_toc,
665 root_title=root_title,
666 search_hints=getattr(flags, 'search_hints', True),
667 site_api_path=getattr(flags, 'site_api_path', ''))
668
669 # Replace all the @{} references in files under `FLAGS.src_dir`
670 replace_refs(flags.src_dir, flags.output_dir, reference_resolver, '*.md')
671 # Fix the tags in the guide dir.
672 guide_dir = os.path.join(flags.output_dir, 'api_guides/python')
673 if os.path.exists(guide_dir):

Callers 1

build_docsFunction · 0.95

Calls 12

run_extractionMethod · 0.95
make_parser_configMethod · 0.95
build_doc_indexFunction · 0.85
_build_guide_indexFunction · 0.85
write_docsFunction · 0.85
replace_refsFunction · 0.85
update_id_tags_inplaceFunction · 0.85
to_json_fileMethod · 0.80
log_errorsMethod · 0.80
num_errorsMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected