"mmdet/vscode:/vscode.git/clone" did not exist on "5686a37548cc20fc1242a78ef6dd993312eebdfd"
Commit 4a0a8bd8 authored by Baber's avatar Baber
Browse files

fix

parent c40a012a
......@@ -567,23 +567,27 @@ class TaskManager:
and self.task_index[name]["type"] == "python_task"
)
def _config_is_task(self, config: dict) -> bool:
@staticmethod
def _config_is_task(config: dict) -> bool:
"""Check if a config dictionary defines a single task."""
return "task" in config and isinstance(config["task"], str)
def _config_is_group(self, config: dict) -> bool:
@staticmethod
def _config_is_group(config: dict) -> bool:
"""Check if a config dictionary defines a group of tasks."""
return "task" in config and isinstance(config["task"], list)
def _config_is_python_task(self, config: dict) -> bool:
@staticmethod
def _config_is_python_task(config: dict) -> bool:
"""Check if a config dictionary defines a Python class-based task."""
return "class" in config
def _config_is_task_list(self, config: dict) -> bool:
@staticmethod
def _config_is_task_list(config: dict) -> bool:
"""Check if a config dictionary defines a task list."""
return "task_list" in config and isinstance(config["task_list"], list)
def _get_yaml_path(self, name: str) -> Union[str, int]:
def _get_yaml_path(self, name: str) -> Union[str, int, list[str]]:
"""
Get the YAML file path for a registered task.
......@@ -645,7 +649,7 @@ class TaskManager:
yaml_path: str,
tasks_and_groups: dict[str, dict],
config: Optional[dict] = None,
populate_tags_fn: Optional[callable] = None,
populate_tags_fn: Optional[Callable] = None,
) -> None:
"""Helper method to register a task in the tasks_and_groups dict"""
tasks_and_groups[task_name] = {
......@@ -779,11 +783,12 @@ class TaskManager:
grp = GroupConfig(**cfg)
subtasks: list[Union[str, dict]] = []
for t in grp.task:
if isinstance(t, str) and self._name_is_tag(t):
subtasks.extend(self._get_tasklist(t))
else:
subtasks.append(t)
if grp.task:
for t in grp.task:
if isinstance(t, str) and self._name_is_tag(t):
subtasks.extend(self._get_tasklist(t))
else:
subtasks.append(t)
return grp, subtasks
def _load_subtasks(
......
......@@ -173,18 +173,18 @@ class TestWalkthroughConfigs:
# Test config detection methods
assert self.tm._config_is_task(configs[0])
assert not self.tm._config_is_group(configs[0])
assert not self.tm._config_is_group()
assert not self.tm._config_is_task_list(configs[0])
assert not self.tm._config_is_task(configs[1])
assert self.tm._config_is_group(configs[1])
assert self.tm._config_is_group()
assert not self.tm._config_is_task_list(configs[1])
# Test task_list detection with actual config
task_list_config = {"task_list": [{"task": "task1"}, {"task": "task2"}]}
assert self.tm._config_is_task_list(task_list_config)
assert not self.tm._config_is_task(task_list_config)
assert not self.tm._config_is_group(task_list_config)
assert not self.tm._config_is_group()
if __name__ == "__main__":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment