hippogriffe 0.1.1__py3-none-any.whl → 0.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hippogriffe/_extension.py +46 -46
- {hippogriffe-0.1.1.dist-info → hippogriffe-0.1.3.dist-info}/METADATA +2 -2
- {hippogriffe-0.1.1.dist-info → hippogriffe-0.1.3.dist-info}/RECORD +6 -6
- {hippogriffe-0.1.1.dist-info → hippogriffe-0.1.3.dist-info}/WHEEL +0 -0
- {hippogriffe-0.1.1.dist-info → hippogriffe-0.1.3.dist-info}/entry_points.txt +0 -0
- {hippogriffe-0.1.1.dist-info → hippogriffe-0.1.3.dist-info}/licenses/LICENSE +0 -0
hippogriffe/_extension.py
CHANGED
@@ -41,52 +41,54 @@ class _PublicApi:
|
|
41
41
|
self._data: dict[str, list[str]] = {}
|
42
42
|
self._builtin_modules = builtin_modules
|
43
43
|
self._public_modules = stdlib_modules + extra_public_modules
|
44
|
-
|
44
|
+
# Don't infinite loop on cycles. We only store Objects, and not Aliases, as in
|
45
|
+
# cycles then the aliases with be distinct: `X.Y.X.Y` is not `X.Y`, though the
|
46
|
+
# underlying object is the same.
|
45
47
|
|
46
|
-
agenda: list[tuple[griffe.
|
48
|
+
agenda: list[tuple[griffe.Object, bool]] = [(pkg, False)]
|
49
|
+
seen: set[griffe.Object] = {pkg}
|
47
50
|
while len(agenda) > 0:
|
48
51
|
item, force_public = agenda.pop()
|
49
|
-
seen.add(item)
|
50
|
-
# Skip private elements
|
51
|
-
if item.name.startswith("_") and not (
|
52
|
-
item.name.startswith("__") and item.name.endswith("__")
|
53
|
-
):
|
54
|
-
continue
|
55
|
-
if isinstance(item, griffe.Alias):
|
56
|
-
try:
|
57
|
-
final_item = item.final_target
|
58
|
-
except griffe.AliasResolutionError:
|
59
|
-
continue
|
60
|
-
if item.name != final_item.name:
|
61
|
-
# Renaming during import counts as private.
|
62
|
-
# (In particular this happens for backward compatibility, e.g.
|
63
|
-
# `equinox.nn.inference_mode` and `equinox.tree_inference`.)
|
64
|
-
continue
|
65
|
-
else:
|
66
|
-
final_item = item
|
67
|
-
|
68
52
|
toplevel_public = item.path in top_level_public_api
|
69
53
|
if force_public or toplevel_public:
|
70
54
|
# If we're in the public API, then we consider all of our children to be
|
71
55
|
# in it as well... (this saves us from having to parse out `filters` and
|
72
56
|
# `members` from our documentation)
|
73
|
-
agenda.extend(
|
74
|
-
(x, True) for x in item.all_members.values() if x not in seen
|
75
|
-
)
|
76
57
|
try:
|
77
|
-
paths = self._data[
|
58
|
+
paths = self._data[item.path]
|
78
59
|
except KeyError:
|
79
|
-
paths = self._data[
|
60
|
+
paths = self._data[item.path] = []
|
80
61
|
paths.append(item.path)
|
81
|
-
self._objects.add(
|
62
|
+
self._objects.add(item)
|
82
63
|
if toplevel_public:
|
83
|
-
self._toplevel_objects.add(
|
64
|
+
self._toplevel_objects.add(item)
|
65
|
+
sub_force_public = True
|
84
66
|
else:
|
85
67
|
# ...if we're not in the public API then check our members -- some of
|
86
68
|
# them might be in the public API.
|
87
|
-
|
88
|
-
|
89
|
-
|
69
|
+
sub_force_public = False
|
70
|
+
for member in item.all_members.values():
|
71
|
+
# Skip private elements
|
72
|
+
if member.name.startswith("_") and not (
|
73
|
+
member.name.startswith("__") and item.name.endswith("__")
|
74
|
+
):
|
75
|
+
continue
|
76
|
+
if isinstance(member, griffe.Alias):
|
77
|
+
try:
|
78
|
+
final_member = member.final_target
|
79
|
+
except griffe.AliasResolutionError:
|
80
|
+
continue
|
81
|
+
if member.name != final_member.name:
|
82
|
+
# Renaming during import counts as private.
|
83
|
+
# (In particular this happens for backward compatibility, e.g.
|
84
|
+
# `equinox.nn.inference_mode` and `equinox.tree_inference`.)
|
85
|
+
continue
|
86
|
+
else:
|
87
|
+
final_member = member
|
88
|
+
if final_member in seen:
|
89
|
+
continue
|
90
|
+
agenda.append((final_member, sub_force_public))
|
91
|
+
seen.add(final_member)
|
90
92
|
|
91
93
|
def toplevel(self) -> Iterable[griffe.Object]:
|
92
94
|
return self._toplevel_objects
|
@@ -235,18 +237,6 @@ def _get_repo_url(repo_url: None | str) -> tuple[pathlib.Path, str]:
|
|
235
237
|
"`hippogriffe.show_source_links` requires specifying a top-level "
|
236
238
|
"`repo_url`."
|
237
239
|
)
|
238
|
-
is_github = (
|
239
|
-
repo_url.removeprefix("https://")
|
240
|
-
.removeprefix("https://")
|
241
|
-
.startswith("github.com")
|
242
|
-
)
|
243
|
-
if not is_github:
|
244
|
-
# We need to format the `repo_url` to what the repo expects, so we have to
|
245
|
-
# hardcode this in.
|
246
|
-
raise ValueError(
|
247
|
-
"`hippogriffe.show_source_links` currently only supports "
|
248
|
-
"`repo_url: https://github.com/...`."
|
249
|
-
)
|
250
240
|
try:
|
251
241
|
git_head = subprocess.run(
|
252
242
|
["git", "rev-parse", "HEAD"], capture_output=True, check=False
|
@@ -264,9 +254,19 @@ def _get_repo_url(repo_url: None | str) -> tuple[pathlib.Path, str]:
|
|
264
254
|
else:
|
265
255
|
toplevel = pathlib.Path(git_toplevel.stdout.decode().strip())
|
266
256
|
commit_hash = git_head.stdout.decode().strip()
|
267
|
-
|
268
|
-
|
269
|
-
|
257
|
+
raw_url = repo_url.removeprefix("https://").removeprefix("https://")
|
258
|
+
if raw_url.startswith("github.com") or raw_url.startswith("gitlab.com"):
|
259
|
+
repo_url = (
|
260
|
+
f"{repo_url.removesuffix('/')}/blob/{commit_hash}/{{path}}"
|
261
|
+
"#L{start}-{end}"
|
262
|
+
)
|
263
|
+
else:
|
264
|
+
# We need to format the `repo_url` to what the repo expects, so we have to
|
265
|
+
# hardcode this in.
|
266
|
+
raise ValueError(
|
267
|
+
"`hippogriffe.show_source_links` currently only supports "
|
268
|
+
"`repo_url: https://github.com/...` and `repo_url: https://gitlab.com/...`."
|
269
|
+
)
|
270
270
|
return toplevel, repo_url
|
271
271
|
|
272
272
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hippogriffe
|
3
|
-
Version: 0.1.
|
4
|
-
Summary:
|
3
|
+
Version: 0.1.3
|
4
|
+
Summary: Tweaks for `mkdocstrings[python]`
|
5
5
|
Project-URL: repository, https://github.com/patrick-kidger/hippogriffe
|
6
6
|
Author-email: Patrick Kidger <contact@kidger.site>
|
7
7
|
License: Apache License
|
@@ -1,12 +1,12 @@
|
|
1
1
|
hippogriffe/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
hippogriffe/_extension.py,sha256=
|
2
|
+
hippogriffe/_extension.py,sha256=eCxc3ojhWAErkcCe0aCFifscR7giwg2LSIk8Sng0i60,14244
|
3
3
|
hippogriffe/_plugin.py,sha256=H0oPka_7URED9wOVYAWUNTWTJXFmH6q7g2W2G5hy64c,4564
|
4
4
|
hippogriffe/assets/_hippogriffe.css,sha256=BgyZLCaOaZNgQErdUb01vpNso4ilUMmoZ5d_OeVpfRE,147
|
5
5
|
hippogriffe/templates/material/hippogriffe/class.html.jinja,sha256=5i624gIuZfnf5toH3jWclzg1qlekqIZ2ODbpzeZcULw,954
|
6
6
|
hippogriffe/templates/material/hippogriffe/fn.html.jinja,sha256=vxrWOPkPkGD3Po9hbcYlyEjsJKhJmOHic4G5t2J0djc,196
|
7
7
|
hippogriffe/templates/material/hippogriffe/hippogriffe.jinja,sha256=KxTBKY0XqiFzqTT1iqFxhN2GhmtwLT4GWc8S86zyjOc,583
|
8
|
-
hippogriffe-0.1.
|
9
|
-
hippogriffe-0.1.
|
10
|
-
hippogriffe-0.1.
|
11
|
-
hippogriffe-0.1.
|
12
|
-
hippogriffe-0.1.
|
8
|
+
hippogriffe-0.1.3.dist-info/METADATA,sha256=OLb3uUzB1-8xA9Db8lGBHf3rTgVBxuFioMA_X0DjSF8,16268
|
9
|
+
hippogriffe-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
10
|
+
hippogriffe-0.1.3.dist-info/entry_points.txt,sha256=Et3dFNWG-biZ7XCvPI9na-buFT_hht1YT0p0JDNEQQM,158
|
11
|
+
hippogriffe-0.1.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
12
|
+
hippogriffe-0.1.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|