get_flat_dependant
Recursively flattens a Dependant object and its sub-dependencies into a single Dependant object, aggregating all parameters and dependencies. It can optionally skip repeated dependencies to avoid infinite recursion.
def get_flat_dependant(
dependant: Dependant,
skip_repeats: bool = False,
visited: list[DependencyCacheKey] | None = None,
parent_oauth_scopes: list[str] | None = None
) - > Dependant
Recursively flattens a Dependant object by consolidating all its sub-dependencies into a single Dependant object. This is useful for processing a dependency tree as a single unit, combining parameters and OAuth scopes from all levels.
Parameters
| Name | Type | Description |
|---|---|---|
| dependant | Dependant | The initial Dependant object to flatten, which may contain nested dependencies. |
| skip_repeats | bool = False | A boolean flag indicating whether to skip processing sub-dependencies that have already been visited during the flattening process, preventing infinite recursion in cyclic dependency graphs. |
| visited | `list[DependencyCacheKey] | None` = None |
| parent_oauth_scopes | `list[str] | None` = None |
Returns
| Type | Description |
|---|---|
Dependant | A new Dependant object representing the flattened structure, containing all parameters and OAuth scopes from the original dependant and its sub-dependencies. |