Removes upper-case 'List' imports from typing and replaces them with lower-case 'list' (#1676)

This commit is contained in:
Ammar Ladhani 2024-05-09 19:05:46 -04:00 committed by GitHub
parent 26d82841d5
commit 564739d1db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View File

@ -1,5 +1,5 @@
import re
from typing import List, Mapping
from typing import Mapping
from agenthub.codeact_agent.prompt import EXAMPLES, SYSTEM_MESSAGE
from opendevin.controller.agent import Agent
@ -117,7 +117,7 @@ class CodeActAgent(Agent):
"""
sandbox_plugins: List[PluginRequirement] = [
sandbox_plugins: list[PluginRequirement] = [
JupyterRequirement(),
SWEAgentCommandsRequirement(),
]
@ -144,7 +144,7 @@ class CodeActAgent(Agent):
- llm (LLM): The llm to be used by this agent
"""
super().__init__(llm)
self.messages: List[Mapping[str, str]] = []
self.messages: list[Mapping[str, str]] = []
self.cost_accumulator = 0
def step(self, state: State) -> Action:
@ -263,5 +263,5 @@ class CodeActAgent(Agent):
# it want to talk to the user
return MessageAction(content=action_str, wait_for_response=True)
def search_memory(self, query: str) -> List[str]:
def search_memory(self, query: str) -> list[str]:
raise NotImplementedError('Implement this abstract method')

View File

@ -2,7 +2,7 @@ import atexit
import json
import os
import uuid
from typing import Dict, List
from typing import Dict
from opendevin.core.logger import opendevin_logger as logger
from opendevin.core.schema.action import ActionType
@ -31,7 +31,7 @@ class Message:
class MessageStack:
_messages: Dict[str, List[Message]] = {}
_messages: Dict[str, list[Message]] = {}
def __init__(self):
self._load_messages()
@ -51,7 +51,7 @@ class MessageStack:
return
del self._messages[sid]
def get_messages(self, sid: str) -> List[Dict[str, object]]:
def get_messages(self, sid: str) -> list[Dict[str, object]]:
if sid not in self._messages:
return []
return [msg.to_dict() for msg in self._messages[sid]]