Skip to content

Commit 947c8a6

Browse files
authored
fix(DEVC-2032): fix deprecated Pydantic methods warnings (#116)
* fix(DEVC-2032): fix depration warning for pydantic Field(...) min_items arg * fix(DEVC-2032): replace deprecated `copy` with `model_copy`
1 parent bdcfc2c commit 947c8a6

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/corva/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def wrapper(
197197
return
198198

199199
app_event = event.metadata.log_type.event.model_validate(
200-
event.copy(update={"records": records}, deep=True).model_dump()
200+
event.model_copy(update={"records": records}, deep=True).model_dump()
201201
)
202202
with LoggingContext(
203203
aws_request_id=aws_request_id,

src/corva/models/stream/raw.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ class RawMetadata(CorvaBaseEvent):
8282
RecordsTime = Sequence[RawTimeRecord]
8383
RecordsDepth = Sequence[RawDepthRecord]
8484
else:
85-
RecordsBase = Annotated[List[RawBaseRecord], Field(min_items=1)]
86-
RecordsTime = Annotated[List[RawTimeRecord], Field(min_items=0)]
87-
RecordsDepth = Annotated[List[RawDepthRecord], Field(min_items=1)]
85+
RecordsBase = Annotated[List[RawBaseRecord], Field(min_length=1)]
86+
RecordsTime = Annotated[List[RawTimeRecord], Field(min_length=0)]
87+
RecordsDepth = Annotated[List[RawDepthRecord], Field(min_length=1)]
8888

8989

9090
class RawStreamEvent(CorvaBaseEvent, RawBaseEvent):

src/corva/models/stream/stream.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class StreamDepthRecord(CorvaBaseEvent):
3939
RecordsTime = Sequence[StreamTimeRecord]
4040
RecordsDepth = Sequence[StreamDepthRecord]
4141
else:
42-
RecordsTime = Annotated[List[StreamTimeRecord], Field(min_items=1)]
43-
RecordsDepth = Annotated[List[StreamDepthRecord], Field(min_items=1)]
42+
RecordsTime = Annotated[List[StreamTimeRecord], Field(min_length=1)]
43+
RecordsDepth = Annotated[List[StreamDepthRecord], Field(min_length=1)]
4444

4545

4646
class StreamEvent(CorvaBaseEvent):

tests/unit/test_scheduled_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def test_set_schedule_start(
254254
def app(e, api, state):
255255
return e
256256

257-
event = event.copy(update={'schedule_start': value})
257+
event = event.model_copy(update={'schedule_start': value})
258258
app_event = (
259259
type(event)
260260
.model_validate(

0 commit comments

Comments
 (0)