hippogriffe 0.2.0__py3-none-any.whl → 0.2.2__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 +18 -8
- {hippogriffe-0.2.0.dist-info → hippogriffe-0.2.2.dist-info}/METADATA +2 -2
- {hippogriffe-0.2.0.dist-info → hippogriffe-0.2.2.dist-info}/RECORD +6 -6
- {hippogriffe-0.2.0.dist-info → hippogriffe-0.2.2.dist-info}/WHEEL +0 -0
- {hippogriffe-0.2.0.dist-info → hippogriffe-0.2.2.dist-info}/entry_points.txt +0 -0
- {hippogriffe-0.2.0.dist-info → hippogriffe-0.2.2.dist-info}/licenses/LICENSE +0 -0
hippogriffe/_extension.py
CHANGED
@@ -92,7 +92,7 @@ class _PublicApi:
|
|
92
92
|
if isinstance(member, griffe.Alias):
|
93
93
|
try:
|
94
94
|
final_member = member.final_target
|
95
|
-
except griffe.AliasResolutionError:
|
95
|
+
except (griffe.AliasResolutionError, griffe.CyclicAliasError):
|
96
96
|
continue
|
97
97
|
if member.name != final_member.name:
|
98
98
|
# Renaming during import counts as private.
|
@@ -268,12 +268,15 @@ def _get_repo_url(repo_url: None | str) -> tuple[pathlib.Path, str]:
|
|
268
268
|
else:
|
269
269
|
toplevel = pathlib.Path(git_toplevel.stdout.decode().strip())
|
270
270
|
commit_hash = git_head.stdout.decode().strip()
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
271
|
+
if "://" in repo_url:
|
272
|
+
protocol, repo_url = repo_url.split("://", 1)
|
273
|
+
protocol = f"{protocol}://"
|
274
|
+
else:
|
275
|
+
protocol = ""
|
276
|
+
if repo_url.startswith("github.com"):
|
277
|
+
fragment = "L{start}-L{end}"
|
278
|
+
elif repo_url.startswith("gitlab.com"):
|
279
|
+
fragment = "L{start}-{end}"
|
277
280
|
else:
|
278
281
|
# We need to format the `repo_url` to what the repo expects, so we have to
|
279
282
|
# hardcode this in.
|
@@ -281,6 +284,9 @@ def _get_repo_url(repo_url: None | str) -> tuple[pathlib.Path, str]:
|
|
281
284
|
"`hippogriffe.show_source_links` currently only supports "
|
282
285
|
"`repo_url: https://github.com/...` and `repo_url: https://gitlab.com/...`."
|
283
286
|
)
|
287
|
+
# Expect url in the form `https://github.com/org/repo`, strip any trailing paths
|
288
|
+
repo_url = "/".join(repo_url.split("/")[:3])
|
289
|
+
repo_url = f"{protocol}{repo_url}/blob/{commit_hash}/{{path}}#{fragment}"
|
284
290
|
return toplevel, repo_url
|
285
291
|
|
286
292
|
|
@@ -351,7 +357,11 @@ class HippogriffeExtension(griffe.Extension):
|
|
351
357
|
with contextlib.suppress(BaseException):
|
352
358
|
obj = eval(obj, context)
|
353
359
|
# Then if it's in the public API, convert it over.
|
354
|
-
if
|
360
|
+
if (
|
361
|
+
isinstance(obj, type)
|
362
|
+
and obj is not type(None)
|
363
|
+
and not hasattr(obj, "__pdoc__")
|
364
|
+
):
|
355
365
|
new_path, _ = public_api[f"{obj.__module__}.{obj.__qualname__}"]
|
356
366
|
return wl.TextDoc(new_path)
|
357
367
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hippogriffe
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.2
|
4
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>
|
@@ -295,4 +295,4 @@ plugins:
|
|
295
295
|
- torch.Tensor
|
296
296
|
```
|
297
297
|
|
298
|
-
List each object under whatever public path `somelib.Foo` that you would like it to be displayed under (and from which it must be
|
298
|
+
List each object under whatever public path `somelib.Foo` that you would like it to be displayed under (and from which it must be accessible), not whichever private path `somelib._internal.foo.Foo` it is defined at.
|
@@ -1,12 +1,12 @@
|
|
1
1
|
hippogriffe/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
hippogriffe/_extension.py,sha256=
|
2
|
+
hippogriffe/_extension.py,sha256=d60NW7VnWolEKYF-62WUp9o4RAviB3eXnHUC2zQJCWI,16352
|
3
3
|
hippogriffe/_plugin.py,sha256=9omje-ROpvo24YYSIcul8XjKwuzFhV7rE9a1f3XDUws,4307
|
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.2.
|
9
|
-
hippogriffe-0.2.
|
10
|
-
hippogriffe-0.2.
|
11
|
-
hippogriffe-0.2.
|
12
|
-
hippogriffe-0.2.
|
8
|
+
hippogriffe-0.2.2.dist-info/METADATA,sha256=LI0Hi2TiM-0WwREciAuktiduV-u50M8otJwMmlkE7r4,16450
|
9
|
+
hippogriffe-0.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
10
|
+
hippogriffe-0.2.2.dist-info/entry_points.txt,sha256=Et3dFNWG-biZ7XCvPI9na-buFT_hht1YT0p0JDNEQQM,158
|
11
|
+
hippogriffe-0.2.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
12
|
+
hippogriffe-0.2.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|