Skip to content

Commit

Permalink
Sort the symbols alphabetically (#203)
Browse files Browse the repository at this point in the history
Co-authored-by: Sean Bartik <[email protected]>
  • Loading branch information
harishmohanraj and Sean Bartik authored Jun 29, 2023
1 parent 030b98c commit 288bd9d
Show file tree
Hide file tree
Showing 4 changed files with 1,037 additions and 1,048 deletions.
124 changes: 1 addition & 123 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -131,129 +131,7 @@
"line_number": 568,
"is_secret": false
}
],
"nbs/Mkdocs.ipynb": [
{
"type": "Base64 High Entropy String",
"filename": "nbs/Mkdocs.ipynb",
"hashed_secret": "a1783315fb0409d58b31c4eb975396aebb822c3f",
"is_verified": false,
"line_number": 180,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "nbs/Mkdocs.ipynb",
"hashed_secret": "61a783d06d904b9a8f32162073f2f16b744c7829",
"is_verified": false,
"line_number": 181,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "nbs/Mkdocs.ipynb",
"hashed_secret": "5d796d8e1b384192c1e891970f672274afe08606",
"is_verified": false,
"line_number": 183,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "nbs/Mkdocs.ipynb",
"hashed_secret": "801d90fbebdbd3bc67929f41d832785a62dfb448",
"is_verified": false,
"line_number": 185,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "nbs/Mkdocs.ipynb",
"hashed_secret": "2e0e34f0b434b8525e49885b496de94bd4a9c433",
"is_verified": false,
"line_number": 186,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "nbs/Mkdocs.ipynb",
"hashed_secret": "4479962f3a680bd9bfee244f2ae54bb0e60820f0",
"is_verified": false,
"line_number": 187,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "nbs/Mkdocs.ipynb",
"hashed_secret": "42f17702d1dca2f9c7c6f7f88d8501bdf3f6e090",
"is_verified": false,
"line_number": 3494,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "nbs/Mkdocs.ipynb",
"hashed_secret": "39fefaa2bdf8bdf9e7a367f631fdf0f312706f75",
"is_verified": false,
"line_number": 5818,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "nbs/Mkdocs.ipynb",
"hashed_secret": "ba989fc978ade8dc840c03028060a8e54b0f2674",
"is_verified": false,
"line_number": 5818,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "nbs/Mkdocs.ipynb",
"hashed_secret": "d85830e7dd6f96486b2ac6d7e8278ba64392fbf4",
"is_verified": false,
"line_number": 5819,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "nbs/Mkdocs.ipynb",
"hashed_secret": "bb1126f1a13278381b15b944cd02dee869a122ed",
"is_verified": false,
"line_number": 6778,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "nbs/Mkdocs.ipynb",
"hashed_secret": "e36776bac85c44d7cea9329e99fea460e36299ca",
"is_verified": false,
"line_number": 6778,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "nbs/Mkdocs.ipynb",
"hashed_secret": "04e6f531aa12493e60766252e17b61644cd76300",
"is_verified": false,
"line_number": 7141,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "nbs/Mkdocs.ipynb",
"hashed_secret": "af4afc0b70bda396f97109cf844a7f52f6c00d3a",
"is_verified": false,
"line_number": 7141,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "nbs/Mkdocs.ipynb",
"hashed_secret": "1e8d418a89e9881d2a634c627d9f2790eda843a5",
"is_verified": false,
"line_number": 7447,
"is_secret": false
}
]
},
"generated_at": "2023-06-19T08:22:02Z"
"generated_at": "2023-06-28T12:54:26Z"
}
1 change: 1 addition & 0 deletions nbdev_mkdocs/_modidx.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
'nbdev_mkdocs.mkdocs._import_submodules': ('mkdocs.html#_import_submodules', 'nbdev_mkdocs/mkdocs.py'),
'nbdev_mkdocs.mkdocs._is_private': ('mkdocs.html#_is_private', 'nbdev_mkdocs/mkdocs.py'),
'nbdev_mkdocs.mkdocs._load_submodules': ('mkdocs.html#_load_submodules', 'nbdev_mkdocs/mkdocs.py'),
'nbdev_mkdocs.mkdocs._merge_lists': ('mkdocs.html#_merge_lists', 'nbdev_mkdocs/mkdocs.py'),
'nbdev_mkdocs.mkdocs._read_sidebar_from_yml': ( 'mkdocs.html#_read_sidebar_from_yml',
'nbdev_mkdocs/mkdocs.py'),
'nbdev_mkdocs.mkdocs._replace_all': ('mkdocs.html#_replace_all', 'nbdev_mkdocs/mkdocs.py'),
Expand Down
48 changes: 29 additions & 19 deletions nbdev_mkdocs/mkdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,17 +806,27 @@ def _import_all_members(module_name: str) -> List[str]:
return names

# %% ../nbs/Mkdocs.ipynb 68
def _merge_lists(members: List[str], submodules: List[str]) -> List[str]:
members_copy = members[:]
for sm in submodules:
for i, el in enumerate(members_copy):
if el.startswith(sm):
members_copy.insert(i, sm)
break
return members_copy


def _add_all_submodules(members: List[str]) -> List[str]:
def _f(x: str) -> List[str]:
xs = x.split(".")
return [".".join(xs[:i]) + "." for i in range(1, len(xs))]

submodules = list(set(itertools.chain(*[_f(x) for x in members])))
members = members + submodules
members = sorted(set(members))
members = _merge_lists(members, submodules)
members = list(dict.fromkeys(members))
return members

# %% ../nbs/Mkdocs.ipynb 71
# %% ../nbs/Mkdocs.ipynb 72
def _get_api_summary_item(x: str) -> str:
xs = x.split(".")
if x.endswith("."):
Expand All @@ -826,11 +836,11 @@ def _get_api_summary_item(x: str) -> str:
indent = " " * (4 * (len(xs)))
return f"{indent}- [{xs[-1]}](api/{'/'.join(xs)}.md)"

# %% ../nbs/Mkdocs.ipynb 73
# %% ../nbs/Mkdocs.ipynb 74
def _get_api_summary(members: List[str]) -> str:
return "\n".join([_get_api_summary_item(x) for x in members]) + "\n"

# %% ../nbs/Mkdocs.ipynb 75
# %% ../nbs/Mkdocs.ipynb 76
def _get_submodule_members(module_name: str) -> List[str]:
"""Get a list of all submodules contained within the module.
Expand All @@ -847,7 +857,7 @@ def _get_submodule_members(module_name: str) -> List[str]:
]
return members_with_submodules_str

# %% ../nbs/Mkdocs.ipynb 77
# %% ../nbs/Mkdocs.ipynb 78
def _load_submodules(
module_name: str, members_with_submodules: List[str]
) -> List[Union[types.FunctionType, Type[Any]]]:
Expand All @@ -871,7 +881,7 @@ def _load_submodules(
]
return names

# %% ../nbs/Mkdocs.ipynb 79
# %% ../nbs/Mkdocs.ipynb 80
def _generate_api_doc(name: str, docs_path: Path) -> Path:
xs = name.split(".")
module_name = ".".join(xs[:-1])
Expand All @@ -885,11 +895,11 @@ def _generate_api_doc(name: str, docs_path: Path) -> Path:

return path

# %% ../nbs/Mkdocs.ipynb 81
# %% ../nbs/Mkdocs.ipynb 82
def _generate_api_docs(members: List[str], docs_path: Path) -> List[Path]:
return [_generate_api_doc(x, docs_path) for x in members if not x.endswith(".")]

# %% ../nbs/Mkdocs.ipynb 83
# %% ../nbs/Mkdocs.ipynb 84
def _update_api_docs(
symbols: List[Union[types.FunctionType, Type[Any]]], docs_path: Path
) -> None:
Expand All @@ -905,7 +915,7 @@ def _update_api_docs(
) as f:
f.write(content)

# %% ../nbs/Mkdocs.ipynb 86
# %% ../nbs/Mkdocs.ipynb 87
def _generate_api_docs_for_module(root_path: str, module_name: str) -> str:
"""Generate API documentation for a module.
Expand Down Expand Up @@ -938,7 +948,7 @@ def _generate_api_docs_for_module(root_path: str, module_name: str) -> str:

# return textwrap.indent(submodule_summary, prefix=" " * 4)

# %% ../nbs/Mkdocs.ipynb 88
# %% ../nbs/Mkdocs.ipynb 89
def _restrict_line_length(s: str, width: int = 80) -> str:
"""Restrict the line length of a string.
Expand Down Expand Up @@ -966,7 +976,7 @@ def _restrict_line_length(s: str, width: int = 80) -> str:
_s += "\n" + line + "\n" if line.endswith(":") else " " + line + "\n"
return _s

# %% ../nbs/Mkdocs.ipynb 90
# %% ../nbs/Mkdocs.ipynb 91
def _generate_cli_doc_for_submodule(
root_path: str, docs_dir_name: str, cmd: str
) -> str:
Expand Down Expand Up @@ -1059,7 +1069,7 @@ def _generate_cli_docs_for_module(root_path: str, module_name: str) -> str:

return textwrap.indent(submodule_summary, prefix=" " * 4)

# %% ../nbs/Mkdocs.ipynb 94
# %% ../nbs/Mkdocs.ipynb 95
def _copy_change_log_if_exists(root_path: str, docs_path: Union[Path, str]) -> str:
"""Copy the CHANGELOG.md file to the docs folder if it's not already present.
Expand Down Expand Up @@ -1087,7 +1097,7 @@ def _copy_change_log_if_exists(root_path: str, docs_path: Union[Path, str]) -> s

return changelog

# %% ../nbs/Mkdocs.ipynb 97
# %% ../nbs/Mkdocs.ipynb 98
def _build_summary(
root_path: str,
module: str,
Expand Down Expand Up @@ -1145,7 +1155,7 @@ def _build_summary(
with open(docs_path / "SUMMARY.md", mode="w", encoding="utf-8") as f:
f.write(summary)

# %% ../nbs/Mkdocs.ipynb 100
# %% ../nbs/Mkdocs.ipynb 101
def _copy_cname_if_needed(root_path: str) -> None:
"""Copy the CNAME file to mkdocs/docs/CNAME if it's not already present.
Expand All @@ -1169,7 +1179,7 @@ def _copy_cname_if_needed(root_path: str) -> None:
f"File '{cname_path.resolve()}' not found, skipping copying..",
)

# %% ../nbs/Mkdocs.ipynb 102
# %% ../nbs/Mkdocs.ipynb 103
def _copy_docs_overrides(root_path: str) -> None:
"""Copy the docs_overrides directory to the mkdocs/docs/overrides directory.
Expand All @@ -1191,7 +1201,7 @@ def _copy_docs_overrides(root_path: str) -> None:
shutil.rmtree(dst_path, ignore_errors=True)
shutil.copytree(src_path, dst_path)

# %% ../nbs/Mkdocs.ipynb 104
# %% ../nbs/Mkdocs.ipynb 105
def _fix_sym_links_in_nbs(root_path: str, cache_path: Path, nbdev_lookup: NbdevLookup, docs_versioning: str, lib_version: str, use_relative_doc_links: bool) -> None: # type: ignore
"""Fix the default sym links generated by nbdev in the notebooks
Expand Down Expand Up @@ -1232,7 +1242,7 @@ def _fix_sym_links_in_nbs(root_path: str, cache_path: Path, nbdev_lookup: NbdevL

nbformat.write(_f, file)

# %% ../nbs/Mkdocs.ipynb 107
# %% ../nbs/Mkdocs.ipynb 108
def nbdev_mkdocs_docs(
root_path: str,
refresh_quarto_settings: bool = False,
Expand Down Expand Up @@ -1325,7 +1335,7 @@ def prepare(
no_mkdocs_build=no_mkdocs_build,
)

# %% ../nbs/Mkdocs.ipynb 110
# %% ../nbs/Mkdocs.ipynb 111
def preview(
root_path: str, use_relative_doc_links: bool, port: Optional[int] = None
) -> None:
Expand Down
Loading

0 comments on commit 288bd9d

Please sign in to comment.