unitelabs.jsondocs.utils
Attributes
- Name
GriffeObjType
- Type
- Value
= typing.Union[griffe.Object, griffe.Class, griffe.Function, griffe.Module, griffe.Attribute]
- 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
get_mro(obj : GriffeObjType) -> list[str]
For a given `GriffeObjType` object return the MRO of the object.
Parameters
- Name
obj
- Type
- GriffeObjType
- Default
- Description
Response
- Type
- list[str]
- Description
mro_sort(a : GriffeObjType, b : GriffeObjType, mro : list[str]) -> None
For two `GriffeObjType` objects sort them first by their MRO and, if equal, by their line number.
Parameters
- Name
a
- Type
- GriffeObjType
- Default
- Description
- Name
b
- Type
- GriffeObjType
- Default
- Description
- Name
mro
- Type
- list[str]
- Default
- Description
sort_values_list_by_mro(obj : GriffeObjType, values_list : list[GriffeObjType]) -> list[str]
For a given `obj` sort the values in `values_list` by `obj`s MRO.
Parameters
- Name
obj
- Type
- GriffeObjType
- Default
- Description
- Name
values_list
- Type
- list[GriffeObjType]
- Default
- Description
Response
- Type
- list[str]
- Description
get_semver(version_str : str) -> str
For a distribution or build version string build the semver version string.
Parameters
- Name
version_str
- Type
- str
- Default
- Description
Response
- Type
- str
- Description