Fix mypy type-checking errors

- Remove unused type ignore comments from multiple files
- Fix TypedDict type mismatch in browser_env/actions.py by ensuring arguments are converted to strings
- Install missing type stubs (types-requests, types-tqdm)

All core packages (browser_env, agent, evaluation_harness, llms, tests) now pass mypy checks.

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
openhands 2025-09-02 14:39:10 +00:00
parent 50d69a6a27
commit 60a6ca1a5d
5 changed files with 7 additions and 5 deletions

View File

@ -1378,7 +1378,9 @@ def parse_playwright_code(code: str) -> list[ParsedPlaywrightCode]:
if isinstance(node, ast.Call):
function_name = node.func.id # type: ignore[attr-defined]
arguments = [
ast.literal_eval(arg) if isinstance(arg, ast.Str) else arg
str(ast.literal_eval(arg))
if isinstance(arg, ast.Str)
else str(arg)
for arg in node.args
]
keywords = {

View File

@ -10,7 +10,7 @@ from pathlib import Path
from typing import Any, Tuple, Union
from beartype import beartype
from nltk.tokenize import word_tokenize # type: ignore
from nltk.tokenize import word_tokenize
from playwright.sync_api import CDPSession, Page
from browser_env.actions import Action

View File

@ -1,4 +1,4 @@
from text_generation import Client # type: ignore
from text_generation import Client
def generate_from_huggingface_completion(

View File

@ -1,7 +1,7 @@
from typing import Any
import tiktoken
from transformers import LlamaTokenizer # type: ignore
from transformers import LlamaTokenizer
class Tokenizer(object):

View File

@ -123,7 +123,7 @@ def test_parallel_script_browser_env() -> None:
# assert is_bearable(info["page"].tolist(), list[DetachedPage])
assert info["page"][0].url == "https://www.rfc-editor.org/rfc/rfc2606.html"
assert info["page"][1].url == "https://www.rfc-editor.org/rfc/rfc6761.html"
vector_env.close() # type: ignore[no-untyped-call]
vector_env.close()
def test_focus_placeholder_and_label(