Skip to content

Commit

Permalink
Code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shanejbrown committed Nov 2, 2023
1 parent 4ea33f4 commit a8a2506
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions buildrunner/validation/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,19 @@
with the terms of the Adobe license agreement accompanying it.
"""

from typing import Any, Dict, List, Optional, TypeVar, Union
from typing import Any, Dict, List, Optional, Union

from typing_extensions import Annotated

# pylint: disable=no-name-in-module
from pydantic import BaseModel, BeforeValidator, Field

T = TypeVar('T')
from typing_extensions import Annotated


def _validate_artifact_type(value) -> T:
def _validate_artifact_type(value) -> Any:
if value and not Artifact.model_validate(value):
raise ValueError(f'Invalid artifact type: {value}')
return value


AnnotatedArtifact = Annotated[T, BeforeValidator(_validate_artifact_type)]
AnnotatedArtifact = Annotated[Any, BeforeValidator(_validate_artifact_type)]


class StepPypiPush(BaseModel, extra='forbid'):
Expand Down

0 comments on commit a8a2506

Please sign in to comment.