Skip to content

Commit

Permalink
fix Sig None
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Sep 27, 2023
1 parent 16198c5 commit 1a4c64b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions papyri/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1541,8 +1541,10 @@ def prepare_doc_for_one_object(
else:
assert blob is not None
assert api_object is not None

blob.textsignature = TextSignature(str(api_object.signature))
if api_object.signature is None:
blob.textsignature = TextSignature(None)
else:
blob.textsignature = TextSignature(str(api_object.signature))
del blob.content["Signature"]
self.log.debug("%r", blob.textsignature)

Expand Down
6 changes: 5 additions & 1 deletion papyri/tests/test_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ def test_self():
c = Config(dry_run=True, dummy_progress=True)
g = Gen(False, config=c)
g.collect_package_metadata("papyri", ".", {})
g.collect_api_docs("papyri", {"papyri.examples:example1"})
g.collect_api_docs("papyri", {"papyri.examples:example1", "papyri"})
assert g.data["papyri.examples:example1"].to_dict()["textsignature"] == {
"type": "TextSignature",
"value": "(pos, only, /, var, args, *, kwargs, also=None)",
}
assert g.data["papyri"].to_dict()["textsignature"] == {
"type": "TextSignature",
"value": None,
}

0 comments on commit 1a4c64b

Please sign in to comment.