devctrl.task.sweeps.find_hierarchy#

find_hierarchy(task: Task) → tuple[str, SettingsClass] | None[source]#

Return the hierarchy object of the task.

First, the task (and its nested settings fields) are searched for a GroupHierarchy-typed field. If it has none, the task itself is used as the hierarchy object when it owns flat hierarchy level fields (fields named like HIERARCHY_SEGMENTS), so sweep templates write the level fields of the task directly.

Parameters:

task – Task to inspect.

Returns:

(dotted field path, hierarchy object), or None if the task has neither a GroupHierarchy-typed field nor flat hierarchy level fields.