Fix undefined names, type errors, and code quality issues (#3288)

* Initial plan

* Fix critical code issues: undefined names, unused nonlocal, and type annotations

Co-authored-by: hlohaus <983577+hlohaus@users.noreply.github.com>

* Fix code style issues: improve None comparisons, membership tests, and lambda usage

Co-authored-by: hlohaus <983577+hlohaus@users.noreply.github.com>

* Remove unused imports: clean up re and os imports from tools

Co-authored-by: hlohaus <983577+hlohaus@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: hlohaus <983577+hlohaus@users.noreply.github.com>
This commit is contained in:
Copilot
2025-12-12 08:33:43 +01:00
committed by GitHub
parent 79546bff26
commit f244ee0c83
8 changed files with 15 additions and 6 deletions

View File

@@ -518,7 +518,7 @@ class Yupp(AsyncGeneratorProvider, ProviderModelMixin):
- If for_target=True → chunk belongs to the target model output.
"""
nonlocal is_thinking, thinking_content, normal_content, variant_text, session
nonlocal normal_content
if not is_valid_content(content):
return

View File

@@ -131,7 +131,7 @@ class GithubCopilot(AsyncGeneratorProvider, ProviderModelMixin):
"streaming": stream,
"confirmations": [],
"customInstructions": [],
"model": api_model,
"model": model,
"mode": "immersive"
}

View File

@@ -4,6 +4,12 @@ import re
import json
import uuid
try:
import nodriver
has_nodriver = True
except ImportError:
has_nodriver = False
from ...typing import AsyncResult, Messages, ImageType, Cookies
from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin
from ..helper import format_prompt

View File

@@ -50,7 +50,11 @@ class CookiesConfig:
class BrowserConfig:
port: int = None
host: str = "127.0.0.1"
stop_browser = lambda: None
@staticmethod
def stop_browser():
return None
browser_executable_path: str = None
DOMAINS = (

View File

@@ -25,6 +25,7 @@ def scrape_text(html: str, max_words: Optional[int] = None, add_source: bool = T
soup = BeautifulSoup(html, "html.parser")
# Read the meta tags
seen_texts = [] # Initialize seen_texts list to track already processed text
if add_metadata:
metadata: Dict[str, str] = {}

View File

@@ -1,6 +1,5 @@
from __future__ import annotations
import re
import os
import json
from pathlib import Path

View File

@@ -1,6 +1,5 @@
from __future__ import annotations
import os
import re
import json
import math

View File

@@ -85,7 +85,7 @@ __all__ = [
"Message",
"ContentPart",
"Cookies",
"Image",
"PILImage", # Changed from "Image" to "PILImage" to match the actual class name
"ImageType",
"MediaListType",
"ResponseType",