@@ -243,6 +243,9 @@ def _create_graph(self):
243
243
toc_base_modules = []
244
244
245
245
toc_graph = {}
246
+ min_dots = min (module .count ('.' ) for module in sorted_modules )
247
+ min_docs = max (min_dots , 1 )
248
+
246
249
for module in sorted_modules :
247
250
mod = self ._modules [module ]
248
251
@@ -251,7 +254,7 @@ def _create_graph(self):
251
254
252
255
# If the module's name contains more than one dot, it is not a base level
253
256
# module. Hence, add it to its parents submodules list.
254
- if module .count ('.' ) > 1 :
257
+ if module .count ('.' ) > min_docs :
255
258
# For example, if module is `tf.keras.applications.densenet` then its
256
259
# parent is `tf.keras.applications`.
257
260
parent_module = '.' .join (module .split ('.' )[:- 1 ])
@@ -758,7 +761,7 @@ def __init__(
758
761
root_title : str ,
759
762
py_modules : Sequence [Tuple [str , Any ]],
760
763
base_dir : Optional [Sequence [Union [str , pathlib .Path ]]] = None ,
761
- code_url_prefix : Sequence [str ] = (),
764
+ code_url_prefix : Union [ str , Sequence [str ] ] = (),
762
765
search_hints : bool = True ,
763
766
site_path : str = 'api_docs/python' ,
764
767
private_map : Optional [Dict [str , str ]] = None ,
0 commit comments