Skip to content

Commit aa68912

Browse files
committed
runtime entry as dataclass
Signed-off-by: adarsh0728 <gooneriitk@gmail.com>
1 parent 72c24ce commit aa68912

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

pynumaflow/errors/_dtypes.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1+
from dataclasses import dataclass, asdict
2+
3+
4+
@dataclass
15
class _RuntimeErrorEntry:
26
"""Represents a runtime error entry to be persisted."""
3-
4-
def __init__(self, container: str, timestamp: int, code: str, message: str, details: str):
5-
self.container = container
6-
self.timestamp = timestamp
7-
self.code = code
8-
self.message = message
9-
self.details = details
7+
container: str
8+
timestamp: int
9+
code: str
10+
message: str
11+
details: str
1012

1113
def to_dict(self) -> dict:
12-
return {
13-
"container": self.container,
14-
"timestamp": self.timestamp,
15-
"code": self.code,
16-
"message": self.message,
17-
"details": self.details,
18-
}
14+
"""Converts the dataclass instance to a dictionary."""
15+
return asdict(self)

0 commit comments

Comments
 (0)