Skip to content

Commit

Permalink
Enable cross-references on function signatures in documentation
Browse files Browse the repository at this point in the history
When enabling `signature_crossrefs`, some default values use enumeration
values that we'd really like to have anchors for in the documentation.
(This also seems sensible for typing-only classes.)  We currently use an
"attributes" table in the class docstring for this purpose; build on
this by forcing MkDocs to render the respective class attribute too, via
an empty "docstring" for the attribute.

I considered enabling parameter headings, but these cannot be suppressed
from the table of contents, and the table of contents then starts
looking very cramped.
  • Loading branch information
the-13th-letter committed Sep 29, 2024
1 parent 1112627 commit 7dbdf93
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
3 changes: 1 addition & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,10 @@ plugins:
show_root_heading: true
show_symbol_type_heading: true
show_symbol_type_toc: true
parameters_heading: true
members_order: 'source'
show_signature_annotations: true
separate_signature: true
signature_crossrefs: false
signature_crossrefs: true
unwrap_annotated: true
paths:
- src
Expand Down
25 changes: 24 additions & 1 deletion src/derivepassphrase/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ class VaultConfigGlobalSettings(TypedDict, total=False):
"""

key: NotRequired[str]
""""""
phrase: NotRequired[str]
""""""
unicode_normalization_form: NotRequired[
Literal['NFC', 'NFD', 'NFKC', 'NFKD']
]
""""""


class VaultConfigServicesSettings(VaultConfigGlobalSettings, total=False):
Expand Down Expand Up @@ -81,14 +84,23 @@ class VaultConfigServicesSettings(VaultConfigGlobalSettings, total=False):
"""

notes: NotRequired[str]
""""""
length: NotRequired[int]
""""""
repeat: NotRequired[int]
""""""
lower: NotRequired[int]
""""""
upper: NotRequired[int]
""""""
number: NotRequired[int]
""""""
space: NotRequired[int]
""""""
dash: NotRequired[int]
""""""
symbol: NotRequired[int]
""""""


_VaultConfig = TypedDict(
Expand All @@ -99,7 +111,7 @@ class VaultConfigServicesSettings(VaultConfigGlobalSettings, total=False):


class VaultConfig(TypedDict, _VaultConfig, total=False):
r"""Configuration for vault.
r"""Configuration for vault. For typing purposes.
Usually stored as JSON.
Expand Down Expand Up @@ -168,7 +180,9 @@ class KeyCommentPair(NamedTuple):
"""

key: bytes | bytearray
""""""
comment: bytes | bytearray
""""""


class SSH_AGENTC(enum.Enum): # noqa: N801
Expand All @@ -191,10 +205,15 @@ class SSH_AGENTC(enum.Enum): # noqa: N801
"""

REQUEST_IDENTITIES: int = 11
""""""
SIGN_REQUEST: int = 13
""""""
ADD_IDENTITY: int = 17
""""""
REMOVE_IDENTITY: int = 18
""""""
ADD_ID_CONSTRAINED: int = 25
""""""


class SSH_AGENT(enum.Enum): # noqa: N801
Expand All @@ -215,6 +234,10 @@ class SSH_AGENT(enum.Enum): # noqa: N801
"""

FAILURE: int = 5
""""""
SUCCESS: int = 6
""""""
IDENTITIES_ANSWER: int = 12
""""""
SIGN_RESPONSE: int = 14
""""""
5 changes: 5 additions & 0 deletions src/derivepassphrase/exporter/storeroom.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ class KeyPair(TypedDict):
"""

encryption_key: bytes
""""""
signing_key: bytes
""""""


class MasterKeys(TypedDict):
Expand All @@ -112,8 +114,11 @@ class MasterKeys(TypedDict):
"""

hashing_key: bytes
""""""
encryption_key: bytes
""""""
signing_key: bytes
""""""


def derive_master_keys_keys(password: str | bytes, iterations: int) -> KeyPair:
Expand Down

0 comments on commit 7dbdf93

Please sign in to comment.