Skip to content

Commit

Permalink
Replace basemodel with dataclass in event.py (#5754)
Browse files Browse the repository at this point in the history
replace basemodel with dataclass in event.py

Replaced event classes based on Pydantic.BaseModel with @dateclass
  • Loading branch information
jonathan-eq authored Sep 21, 2023
1 parent 6695973 commit 7b6b10b
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/ert/ensemble_evaluator/event.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from dataclasses import dataclass
from typing import Optional

from pydantic import BaseModel

from .snapshot import PartialSnapshot, Snapshot


class _UpdateEvent(BaseModel):
@dataclass
class _UpdateEvent:
phase_name: str
current_phase: int
total_phases: int
Expand All @@ -14,20 +14,17 @@ class _UpdateEvent(BaseModel):
iteration: int


@dataclass
class FullSnapshotEvent(_UpdateEvent):
snapshot: Optional[Snapshot]

class Config:
arbitrary_types_allowed = True
snapshot: Optional[Snapshot] = None


@dataclass
class SnapshotUpdateEvent(_UpdateEvent):
partial_snapshot: Optional[PartialSnapshot]

class Config:
arbitrary_types_allowed = True
partial_snapshot: Optional[PartialSnapshot] = None


class EndEvent(BaseModel):
@dataclass
class EndEvent:
failed: bool
failed_msg: Optional[str]
failed_msg: Optional[str] = None

0 comments on commit 7b6b10b

Please sign in to comment.