Expand Python maintenance tasks
This commit is contained in:
@@ -61,6 +61,7 @@ class InputField:
|
||||
options: tuple[InputOption, ...]
|
||||
accept: tuple[str, ...]
|
||||
maximum_bytes: int | None
|
||||
sensitive: bool = False
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -325,7 +326,7 @@ def parse_input_field(manifest_path: Path, filename: str, raw: Any) -> InputFiel
|
||||
raise ValueError(f"{manifest_path} task {filename} has a non-object input field.")
|
||||
allowed = {
|
||||
"name", "label", "type", "required", "default", "minimum", "maximum",
|
||||
"step", "pattern", "options", "accept", "maximum_bytes",
|
||||
"step", "pattern", "options", "accept", "maximum_bytes", "sensitive",
|
||||
}
|
||||
unknown = set(raw) - allowed
|
||||
if unknown:
|
||||
@@ -344,6 +345,9 @@ def parse_input_field(manifest_path: Path, filename: str, raw: Any) -> InputFiel
|
||||
required = raw.get("required", False)
|
||||
if not isinstance(required, bool):
|
||||
raise ValueError(f"{manifest_path} task {filename} input {name} required must be true or false.")
|
||||
sensitive = raw.get("sensitive", False)
|
||||
if not isinstance(sensitive, bool):
|
||||
raise ValueError(f"{manifest_path} task {filename} input {name} sensitive must be true or false.")
|
||||
|
||||
numeric_keys = ("minimum", "maximum", "step")
|
||||
numeric_values = {key: raw.get(key) for key in numeric_keys}
|
||||
@@ -407,6 +411,7 @@ def parse_input_field(manifest_path: Path, filename: str, raw: Any) -> InputFiel
|
||||
options=options,
|
||||
accept=accept,
|
||||
maximum_bytes=maximum_bytes,
|
||||
sensitive=sensitive,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user