Skip to content

Commit 45bb70f

Browse files
committed
fix: Resolve mypy type annotation errors
- Add proper type annotation for parser variable in parser_tool.py - Fix store type annotation using lowercase dict instead of Dict - Add null checks for self.last_input to prevent None attribute access - Fix regex search with None argument by adding proper null check - All 53 source files now pass mypy static analysis - All 78 tests continue to pass
1 parent a6e32d9 commit 45bb70f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/agents/deepagent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(
9090
self.dry_run = bool(dry_run)
9191
self.llm: Any = None
9292
self.agent: Any = None
93-
self.store = {} # In-memory session store
93+
self.store: dict[str, ChatMessageHistory] = {} # In-memory session store
9494

9595
if self.dry_run:
9696
self.tools = tools or [EchoTool()]
@@ -168,11 +168,11 @@ def invoke(self, input_data: dict, config: dict):
168168
self.last_input = input_data["input"]
169169

170170
# Simple logic to simulate tool use for testing
171-
if "parse" in self.last_input.lower():
171+
if self.last_input and "parse" in self.last_input.lower():
172172
for tool in self.tools:
173173
if tool.name == "DiagramParserTool":
174174
# Extract file path from prompt (simple parsing)
175-
match = re.search(r"\'(.*?)\'", self.last_input)
175+
match = re.search(r"\'(.*?)\'", self.last_input) if self.last_input else None
176176
if match:
177177
file_path = match.group(1)
178178
return {"output": tool._run(file_path)}

src/skills/parser_tool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def _run(self, file_path: str) -> str:
2525
# This is a simplified parser selection logic.
2626
# A more robust implementation would use a factory or
2727
# registration pattern.
28+
parser: DrawIOParser | MermaidParser | PlantUMLParser
2829
if file_path.endswith((".drawio", ".xml")):
2930
parser = DrawIOParser()
3031
elif file_path.endswith((".mmd", ".mermaid")):

0 commit comments

Comments
 (0)