forked from All-Hands-AI/OpenHands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
57 lines (43 loc) · 1.23 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from dataclasses import dataclass
@dataclass
class Event:
@property
def message(self) -> str | None:
if hasattr(self, '_message'):
return self._message # type: ignore [attr-defined]
return ''
@property
def id(self) -> int | None:
if hasattr(self, '_id'):
return self._id # type: ignore [attr-defined]
return -1
@property
def timestamp(self) -> str | None:
if hasattr(self, '_timestamp'):
return self._timestamp # type: ignore [attr-defined]
return None
@property
def source(self) -> str | None:
if hasattr(self, '_source'):
return self._source # type: ignore [attr-defined]
return None
@property
def cause(self) -> int | None:
if hasattr(self, '_cause'):
return self._cause # type: ignore [attr-defined]
return None
@dataclass
class Observation(Event):
content: str
@dataclass
class AgentStateChangedObservation(Observation):
"""
This data class represents the result from delegating to another agent
"""
agent_state: str
observation: str = ''
@property
def message(self) -> str:
return ''
E = Event()
print(E.message)