Skip to content

πŸ™Œ OpenHands: AI-Driven Development

make runnable a class var (#1679)

Engel Nysta17308108c01
diff --git a/opendevin/events/action/action.py b/opendevin/events/action/action.py
index f35d4290ad..03fca6af2c 100644
--- a/opendevin/events/action/action.py
+++ b/opendevin/events/action/action.py
@@ -1,13 +1,12 @@
from dataclasses import dataclass
+from typing import ClassVar
from opendevin.events.event import Event
@dataclass
class Action(Event):
- @property
- def runnable(self):
- return False
+ runnable: ClassVar[bool] = False
def to_memory(self):
d = super().to_memory()
diff --git a/opendevin/events/action/agent.py b/opendevin/events/action/agent.py
index c1e2956aff..dca704713d 100644
--- a/opendevin/events/action/agent.py
+++ b/opendevin/events/action/agent.py
@@ -1,5 +1,5 @@
from dataclasses import dataclass, field
-from typing import Dict
+from typing import ClassVar, Dict
from opendevin.core.schema import ActionType
@@ -24,10 +24,7 @@ class AgentRecallAction(Action):
query: str
thought: str = ''
action: str = ActionType.RECALL
-
- @property
- def runnable(self) -> bool:
- return True
+ runnable: ClassVar[bool] = True
@property
def message(self) -> str:
diff --git a/opendevin/events/action/browse.py b/opendevin/events/action/browse.py
index 5ecf2bd998..548548f25b 100644
--- a/opendevin/events/action/browse.py
+++ b/opendevin/events/action/browse.py
@@ -1,4 +1,5 @@
from dataclasses import dataclass
+from typing import ClassVar
from opendevin.core.schema import ActionType
@@ -10,10 +11,7 @@ class BrowseURLAction(Action):
url: str
thought: str = ''
action: str = ActionType.BROWSE
-
- @property
- def runnable(self) -> bool:
- return True
+ runnable: ClassVar[bool] = True
@property
def message(self) -> str:
diff --git a/opendevin/events/action/commands.py b/opendevin/events/action/commands.py
index 11d0635369..efb88615e7 100644
--- a/opendevin/events/action/commands.py
+++ b/opendevin/events/action/commands.py
@@ -1,4 +1,5 @@
from dataclasses import dataclass
+from typing import ClassVar
from opendevin.core.schema import ActionType
@@ -11,9 +12,7 @@ class CmdRunAction(Action):
background: bool = False
thought: str = ''
action: str = ActionType.RUN
-
- def runnable(self) -> bool:
- return True
+ runnable: ClassVar[bool] = True
@property
def message(self) -> str:
@@ -32,9 +31,7 @@ class CmdKillAction(Action):
id: int
thought: str = ''
action: str = ActionType.KILL
-
- def runnable(self) -> bool:
- return True
+ runnable: ClassVar[bool] = True
@property
def message(self) -> str:
@@ -49,9 +46,7 @@ class IPythonRunCellAction(Action):
code: str
thought: str = ''
action: str = ActionType.RUN_IPYTHON
-
- def runnable(self) -> bool:
- return True
+ runnable: ClassVar[bool] = True
def __str__(self) -> str:
ret = '**IPythonRunCellAction**\n'
diff --git a/opendevin/events/action/files.py b/opendevin/events/action/files.py
index 09993d372e..02f0adf116 100644
--- a/opendevin/events/action/files.py
+++ b/opendevin/events/action/files.py
@@ -1,4 +1,5 @@
from dataclasses import dataclass
+from typing import ClassVar
from opendevin.core.schema import ActionType
@@ -18,10 +19,7 @@ class FileReadAction(Action):
end: int = -1
thought: str = ''
action: str = ActionType.READ
-
- @property
- def runnable(self) -> bool:
- return True
+ runnable: ClassVar[bool] = True
@property
def message(self) -> str:
@@ -36,10 +34,7 @@ class FileWriteAction(Action):
end: int = -1
thought: str = ''
action: str = ActionType.WRITE
-
- @property
- def runnable(self) -> bool:
- return True
+ runnable: ClassVar[bool] = True
@property
def message(self) -> str: