File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
exasol/toolbox/util/dependencies Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ from typing import Annotated
4+
35from packaging .version import Version
46from pydantic import (
57 BaseModel ,
8+ BeforeValidator ,
69 ConfigDict ,
7- field_validator ,
810)
911
12+ VERSION_TYPE = Annotated [Version , BeforeValidator (lambda v : Version (str (v )))]
13+
1014
1115class Package (BaseModel ):
1216 model_config = ConfigDict (frozen = True , arbitrary_types_allowed = True )
1317
1418 name : str
15- version : Version
16-
17- @field_validator ("version" , mode = "before" )
18- def convert_version (cls , v : str ) -> Version :
19- return Version (v )
19+ version : VERSION_TYPE
2020
2121 @property
2222 def normalized_name (self ) -> str :
Original file line number Diff line number Diff line change 11import pytest
22from packaging .version import Version
3- from toolbox .util .git import Git
3+
4+ from exasol .toolbox .util .git import Git
45
56POETRY_LOCK = "poetry.lock"
67
You can’t perform that action at this time.
0 commit comments