Skip to content

Commit a0aa023

Browse files
improve docstrings, remove redundant comments and imports
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent c227739 commit a0aa023

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/databricks/sql/backend/sea/utils/http_client.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import urllib.parse
55
import urllib.request
66
from typing import Dict, Any, Optional, List, Tuple, Union
7-
from urllib.parse import urljoin
87

98
from urllib3 import HTTPConnectionPool, HTTPSConnectionPool, ProxyManager
109
from urllib3.util import make_headers
@@ -15,9 +14,6 @@
1514
from databricks.sql.types import SSLOptions
1615
from databricks.sql.exc import (
1716
RequestError,
18-
MaxRetryDurationError,
19-
SessionAlreadyClosedError,
20-
CursorAlreadyClosedError,
2117
)
2218

2319
logger = logging.getLogger(__name__)
@@ -200,7 +196,7 @@ def close(self):
200196
self._pool.clear()
201197

202198
def using_proxy(self) -> bool:
203-
"""Check if proxy is being used (for compatibility with Thrift client)."""
199+
"""Check if proxy is being used."""
204200
return self.realhost is not None
205201

206202
def set_retry_command_type(self, command_type: CommandType):
@@ -255,8 +251,6 @@ def _make_request(
255251

256252
logger.debug(f"Making {method} request to {path}")
257253

258-
# When v3 retries are enabled, urllib3 handles retries internally via DatabricksRetryPolicy
259-
# When disabled, we let exceptions bubble up (similar to Thrift backend approach)
260254
if self._pool is None:
261255
raise RequestError("Connection pool not initialized", None)
262256

@@ -276,7 +270,6 @@ def _make_request(
276270
error_message = f"SEA HTTP request failed with status {response.status}"
277271
raise Exception(error_message)
278272
except MaxRetryError as e:
279-
# urllib3 MaxRetryError should bubble up for redirect tests to catch
280273
logger.error(f"SEA HTTP request failed with MaxRetryError: {e}")
281274
raise
282275
except Exception as e:
@@ -291,6 +284,7 @@ def _get_command_type_from_path(self, path: str, method: str) -> CommandType:
291284
This helps the retry policy make appropriate decisions for different
292285
types of SEA operations.
293286
"""
287+
294288
path = path.lower()
295289
method = method.upper()
296290

0 commit comments

Comments
 (0)