Skip to content

Commit 3e08f1e

Browse files
MarkDaoustcopybara-github
authored andcommitted
Fixes for docs generation.
PiperOrigin-RevId: 379366095
1 parent c0cf619 commit 3e08f1e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tools/tensorflow_docs/api_generator/generate_lib.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ def _create_graph(self):
243243
toc_base_modules = []
244244

245245
toc_graph = {}
246+
min_dots = min(module.count('.') for module in sorted_modules)
247+
min_docs = max(min_dots, 1)
248+
246249
for module in sorted_modules:
247250
mod = self._modules[module]
248251

@@ -251,7 +254,7 @@ def _create_graph(self):
251254

252255
# If the module's name contains more than one dot, it is not a base level
253256
# module. Hence, add it to its parents submodules list.
254-
if module.count('.') > 1:
257+
if module.count('.') > min_docs:
255258
# For example, if module is `tf.keras.applications.densenet` then its
256259
# parent is `tf.keras.applications`.
257260
parent_module = '.'.join(module.split('.')[:-1])
@@ -758,7 +761,7 @@ def __init__(
758761
root_title: str,
759762
py_modules: Sequence[Tuple[str, Any]],
760763
base_dir: Optional[Sequence[Union[str, pathlib.Path]]] = None,
761-
code_url_prefix: Sequence[str] = (),
764+
code_url_prefix: Union[str, Sequence[str]] = (),
762765
search_hints: bool = True,
763766
site_path: str = 'api_docs/python',
764767
private_map: Optional[Dict[str, str]] = None,

0 commit comments

Comments
 (0)