mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 14:57:59 -05:00
* refactor actions and events * remove type_key * remove stream * move import * move import * fix NullObs * reorder imports * fix lint * fix dataclasses * remove blank fields * fix nullobs * fix sidebar labels * fix test compilation * switch to asdict * lint * fix whitespace * fix executable * delint * fix run * remove NotImplementeds * fix path prefix * remove null files * add debug * add more debug info * fix dataclass on null * remove debug * revert sandbox * fix merge issues * fix tyeps * Update opendevin/events/action/browse.py
34 lines
672 B
Python
34 lines
672 B
Python
from dataclasses import dataclass
|
|
|
|
from opendevin.schema import ObservationType
|
|
|
|
from .observation import Observation
|
|
|
|
|
|
@dataclass
|
|
class FileReadObservation(Observation):
|
|
"""
|
|
This data class represents the content of a file.
|
|
"""
|
|
|
|
path: str
|
|
observation: str = ObservationType.READ
|
|
|
|
@property
|
|
def message(self) -> str:
|
|
return f'I read the file {self.path}.'
|
|
|
|
|
|
@dataclass
|
|
class FileWriteObservation(Observation):
|
|
"""
|
|
This data class represents a file write operation
|
|
"""
|
|
|
|
path: str
|
|
observation: str = ObservationType.WRITE
|
|
|
|
@property
|
|
def message(self) -> str:
|
|
return f'I wrote to the file {self.path}.'
|