diff --git a/bento_lib/auth/middleware/base.py b/bento_lib/auth/middleware/base.py index 9cb0a46..790b0d3 100644 --- a/bento_lib/auth/middleware/base.py +++ b/bento_lib/auth/middleware/base.py @@ -7,7 +7,10 @@ from ..exceptions import BentoAuthException -__all__ = ["BaseAuthMiddleware"] +__all__ = ["EvaluationResultMatrix", "BaseAuthMiddleware"] + + +EvaluationResultMatrix = tuple[tuple[bool, ...], ...] class BaseAuthMiddleware(ABC): @@ -96,7 +99,7 @@ def _evaluate_body(resources: Iterable[dict], permissions: Iterable[str]) -> dic return {"resources": tuple(resources), "permissions": tuple(permissions)} @staticmethod - def _matrix_tuple_cast(authz_result: list[list[bool]]) -> tuple[tuple[bool, ...]]: + def _matrix_tuple_cast(authz_result: list[list[bool]]) -> tuple[tuple[bool, ...], ...]: return tuple(tuple(x) for x in authz_result) def evaluate( @@ -107,7 +110,7 @@ def evaluate( require_token: bool = False, headers_getter: Callable[[Any], dict[str, str]] | None = None, mark_authz_done: bool = False, - ) -> tuple[tuple[bool, ...]]: + ) -> EvaluationResultMatrix: if mark_authz_done: self.mark_authz_done(request) return self._matrix_tuple_cast( @@ -159,7 +162,7 @@ async def async_evaluate( require_token: bool = False, headers_getter: Callable[[Any], dict[str, str]] | None = None, mark_authz_done: bool = False, - ) -> tuple[tuple[bool, ...]]: + ) -> EvaluationResultMatrix: if mark_authz_done: self.mark_authz_done(request) return self._matrix_tuple_cast( @@ -228,7 +231,7 @@ async def async_check_authz_evaluate( require_token: bool = True, set_authz_flag: bool = False, headers_getter: Callable[[Any], dict[str, str]] | None = None, - ): + ) -> None: if not self.enabled: return diff --git a/bento_lib/package.cfg b/bento_lib/package.cfg index 41b9ac7..7bd5eb8 100644 --- a/bento_lib/package.cfg +++ b/bento_lib/package.cfg @@ -1,5 +1,5 @@ [package] name = bento_lib -version = 9.0.0a1 +version = 9.0.0a2 authors = David Lougheed, Paul Pillot author_emails = david.lougheed@mail.mcgill.ca, paul.pillot@computationalgenomics.ca diff --git a/bento_lib/workflows/models.py b/bento_lib/workflows/models.py index a4a448a..5d7777d 100644 --- a/bento_lib/workflows/models.py +++ b/bento_lib/workflows/models.py @@ -37,36 +37,36 @@ class WorkflowBaseInput(FrozenBaseModel): class WorkflowInjectedInput(WorkflowBaseInput): - injected: Literal[True] + injected: Literal[True] = True class WorkflowStringInput(WorkflowBaseInput): - type: Literal["string"] + type: Literal["string"] = "string" class WorkflowStringArrayInput(WorkflowBaseInput): - type: Literal["string[]"] + type: Literal["string[]"] = "string[]" class WorkflowNumberInput(WorkflowBaseInput): - type: Literal["number"] + type: Literal["number"] = "number" class WorkflowNumberArrayInput(WorkflowBaseInput): - type: Literal["number[]"] + type: Literal["number[]"] = "number[]" class WorkflowBooleanInput(WorkflowBaseInput): - type: Literal["boolean"] + type: Literal["boolean"] = "boolean" class WorkflowEnumInput(WorkflowBaseInput): - type: Literal["enum"] + type: Literal["enum"] = "enum" values: list[str] | HttpUrl # list of values, or a URL returning an array of enum values class WorkflowEnumArrayInput(WorkflowBaseInput): - type: Literal["enum[]"] + type: Literal["enum[]"] = "enum[]" values: list[str] | HttpUrl # list of values, or a URL returning an array of enum values repeatable: bool = True @@ -77,28 +77,28 @@ class WorkflowProjectDatasetInput(WorkflowBaseInput): class WorkflowFileInput(WorkflowBaseInput): # can be sourced from drop box / DRS / workflow outputs, whatever the UI decides works - type: Literal["file"] + type: Literal["file"] = "file" pattern: str = "*" # file name regular expression pattern class WorkflowFileArrayInput(WorkflowBaseInput): # can be sourced from drop box / DRS / workflow outputs, whatever the UI decides works - type: Literal["file[]"] + type: Literal["file[]"] = "file[]" pattern: str = "*" # file name regular expression pattern class WorkflowDirectoryInput(WorkflowBaseInput): # can be sourced from drop box / DRS / workflow outputs, whatever the UI decides works - type: Literal["directory"] + type: Literal["directory"] = "directory" class WorkflowDirectoryArrayInput(WorkflowBaseInput): # can be sourced from drop box / DRS / workflow outputs, whatever the UI decides works - type: Literal["directory[]"] + type: Literal["directory[]"] = "directory[]" class WorkflowServiceUrlInput(WorkflowInjectedInput): - type: Literal["service-url"] + type: Literal["service-url"] = "service-url" service_kind: str