Files
revng-revng/python/revng/pypeline/task/task.py
Giacomo Vercesi eefdca934b pypeline: give better names to some attributes
Rename some attributes of pypeline objects to better-suited names:
* `TaskArgument.to_container_decl` -> `TaskArgument.declaration`
* `PipelineNode.arguments` -> `PipelineNode.argument_declarations`
* `PipelineNode.arguments_with_access` -> `PipelineNode.arguments`
2025-12-19 10:26:49 +01:00

35 lines
921 B
Python

#
# This file is distributed under the MIT License. See LICENSE.md for details.
#
from dataclasses import dataclass
from enum import Flag, auto
from revng.pypeline.container import ContainerDeclaration
class TaskArgumentAccess(Flag):
READ = auto()
WRITE = auto()
READ_WRITE = READ | WRITE
@dataclass(slots=True, frozen=True)
class TaskArgument(ContainerDeclaration):
"""
A container argument for a task.
It has a name, it has to be bounded to a ContainerDeclaration and we can specify whether the
container is just read, just written or both.
"""
access: TaskArgumentAccess
# This is the description of the argument that will appear in the CLI
help_text: str = ""
def declaration(self) -> ContainerDeclaration:
"""
Convert this TaskArgument to a ContainerDeclaration.
"""
return ContainerDeclaration(self.name, self.container_type)