Skip to content

Commit a085979

Browse files
committed
🚨 fix-lint(unused-code): Removed unused code within the files
1 parent 3f7b88a commit a085979

2 files changed

Lines changed: 1 addition & 36 deletions

File tree

hackagent/router/adapters/litellm_adapter.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import logging
1717
import os
18-
from typing import TYPE_CHECKING, Any, Dict, List, Optional
18+
from typing import Any, Dict, List, Optional
1919

2020
from .base import Agent # Updated import
2121

@@ -89,11 +89,6 @@ def _get_litellm_exceptions():
8989
return _litellm_exceptions
9090

9191

92-
# For backwards compatibility and type checking
93-
if TYPE_CHECKING:
94-
from litellm.exceptions import AuthenticationError
95-
96-
9792
# --- Custom Exceptions ---
9893
class LiteLLMConfigurationError(Exception):
9994
"""Custom exception for LiteLLM adapter configuration issues."""

hackagent/router/adapters/openai_adapter.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,11 @@
2828
# but tests can patch them directly
2929
OpenAI = None
3030
OPENAI_AVAILABLE = None
31-
_OpenAIError = None
32-
_APIConnectionError = None
33-
_RateLimitError = None
34-
_APITimeoutError = None
3531

3632

3733
def _get_openai():
3834
"""Lazily import and return the openai module."""
3935
global _openai_module, _openai_available, OpenAI, OPENAI_AVAILABLE
40-
global _OpenAIError, _APIConnectionError, _RateLimitError, _APITimeoutError
4136
if _openai_module is None:
4237
try:
4338
import openai as _openai
@@ -47,34 +42,13 @@ def _get_openai():
4742
# Also set module-level names for compatibility
4843
OpenAI = _openai.OpenAI
4944
OPENAI_AVAILABLE = True
50-
_OpenAIError = _openai.OpenAIError
51-
_APIConnectionError = _openai.APIConnectionError
52-
_RateLimitError = _openai.RateLimitError
53-
_APITimeoutError = _openai.APITimeoutError
5445
except ImportError:
5546
_openai_module = False
5647
_openai_available = False
5748
OPENAI_AVAILABLE = False
5849
return _openai_module if _openai_module else None
5950

6051

61-
def __getattr__(name):
62-
"""Lazy module-level attribute access for exception classes."""
63-
# Map exception names to their private globals
64-
exception_map = {
65-
"OpenAIError": "_OpenAIError",
66-
"APIConnectionError": "_APIConnectionError",
67-
"RateLimitError": "_RateLimitError",
68-
"APITimeoutError": "_APITimeoutError",
69-
}
70-
if name in exception_map:
71-
# Ensure openai is loaded
72-
_get_openai()
73-
# Return the exception class (may be None if openai not available)
74-
return globals().get(exception_map[name])
75-
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
76-
77-
7852
def _get_openai_exceptions():
7953
"""Get OpenAI exception classes, or dummy classes if not available."""
8054
openai = _get_openai()
@@ -101,10 +75,6 @@ def _is_openai_available():
10175
return _openai_available
10276

10377

104-
# For backward compatibility - make it a simple function call
105-
OPENAI_AVAILABLE = None # Will be set lazily
106-
107-
10878
def _check_openai_available():
10979
global OPENAI_AVAILABLE
11080
if OPENAI_AVAILABLE is None:

0 commit comments

Comments
 (0)