def initialize_task()

in dynalab_cli/init.py [0:0]


    def initialize_task(self, key, value):
        tasks, task_codes = get_tasks()
        while value not in task_codes:
            message = (
                f"Please choose a valid task name from one of "
                f"[{', '.join(task_codes)}]: "
            )
            value = input(message)

        task = [task for task in tasks if task["task_code"] == value][0]
        annotation_config = json.loads(task["annotation_config_json"])

        task_info = {"annotation_config": annotation_config, "task": value}

        task_info_path = os.path.join(
            self.config_handler.root_dir,
            self.config_handler.dynalab_dir,
            f"{value}.json",
        )
        task_io_dir = os.path.dirname(task_info_path)
        os.makedirs(task_io_dir, exist_ok=True)
        with open(task_info_path, "w+") as f:
            f.write(json.dumps(task_info, indent=4))

        self.update_field(key, value)