unitelabs.jsondocs.annotations
Attributes
- Name
GriffeAnnotationType
- Type
- Value
= typing.Union[griffe.Expr, str]
- Description
Functions
get_name(obj : GriffeObjType) -> str
Extract `obj`s name. For an obj `B` deriving from obj `A`, the name for any method or attribute of `A` which is not overridden by `B` will be the qualified path of the method in `A`. In this case, the `obj.canonical_path` will not equal the `obj.path`. We intentionally return the `obj.canonical_path` here, as it reduces redundancy.
Parameters
- Name
obj
- Type
- GriffeObjType
- Default
- Description
Response
- Type
- str
- Description
resolve_alias(obj : GriffeAnnotationType) -> str
Resolve a possibly-aliased `obj`s name to its fully-qualified form.
Parameters
- Name
obj
- Type
- GriffeAnnotationType
- Default
- Description
Response
- Type
- str
- Description
qualify_name(expression : GriffeAnnotationType) -> typing.Union[dict[str, typing.Any], str]
Update the `name` of an `griffe.ExprName` to its fully-qualified form, if possible.
Parameters
- Name
expression
- Type
- GriffeAnnotationType
- Default
- Description
Response
- Type
- typing.Union[dict[str, typing.Any], str]
- Description
normalize_expr(annotation : GriffeAnnotationType) -> typing.Union[dict[str, str], str]
Convert the given `annotation` into its normalized, fully-qualified form.
Parameters
- Name
annotation
- Type
- GriffeAnnotationType
- Default
- Description
Response
- Type
- typing.Union[dict[str, str], str]
- Description
has_subannotation(annotation : GriffeAnnotationType) -> bool
Whether or not an `annotation` must be further parsed to qualify its constituent parts.
Parameters
- Name
annotation
- Type
- GriffeAnnotationType
- Default
- Description
Response
- Type
- bool
- Description
qualify_annotation(annotation : GriffeAnnotationType) -> typing.Union[dict[str, typing.Any], str]
For an annotation, iterate through all parts of the parsed annotation and qualify any aliases. A `griffe.Expr` can contain: - `left` : an annotation to the left of a square bracket - `slice` : the contents of a square bracket - `elements` : the contents of a comma-separated list
Parameters
- Name
annotation
- Type
- GriffeAnnotationType
- Default
- Description
Response
- Type
- typing.Union[dict[str, typing.Any], str]
- Description