Skip to content

Commit e6733cb

Browse files
committed
Apply black formatting to auth files
1 parent 49eab2a commit e6733cb

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

src/databricks/sql/auth/auth.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,22 @@ def __init__(
5252
def get_auth_provider(cfg: ClientContext):
5353
"""
5454
Get an appropriate auth provider based on the provided configuration.
55-
55+
5656
Token Federation Support:
5757
-----------------------
5858
Currently, token federation is implemented as a separate auth type, but the goal is to
5959
refactor it as a feature that can work with any auth type. The current implementation
6060
is maintained for backward compatibility while the refactoring is planned.
61-
61+
6262
Future refactoring will introduce a `use_token_federation` flag that can be combined
6363
with any auth type to enable token federation.
64-
64+
6565
Args:
6666
cfg: The client context containing configuration parameters
67-
67+
6868
Returns:
6969
An appropriate AuthProvider instance
70-
70+
7171
Raises:
7272
RuntimeError: If no valid authentication settings are provided
7373
"""
@@ -163,22 +163,22 @@ def get_client_id_and_redirect_port(use_azure_auth: bool):
163163
def get_python_sql_connector_auth_provider(hostname: str, **kwargs):
164164
"""
165165
Get an auth provider for the Python SQL connector.
166-
166+
167167
This function is the main entry point for authentication in the SQL connector.
168168
It processes the parameters and creates an appropriate auth provider.
169-
169+
170170
TODO: Future refactoring needed:
171171
1. Add a use_token_federation flag that can be combined with any auth type
172172
2. Remove TOKEN_FEDERATION as an auth_type while maintaining backward compatibility
173173
3. Create a token federation wrapper that can wrap any existing auth provider
174-
174+
175175
Args:
176176
hostname: The Databricks server hostname
177177
**kwargs: Additional configuration parameters
178-
178+
179179
Returns:
180180
An appropriate AuthProvider instance
181-
181+
182182
Raises:
183183
ValueError: If username/password authentication is attempted (no longer supported)
184184
"""

src/databricks/sql/auth/token_federation.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ def get_headers() -> Dict[str, str]:
150150
else:
151151
# Token is from a different host, need to exchange
152152
logger.debug("Token from different host, attempting exchange")
153-
return self._try_token_exchange_or_fallback(access_token, token_type)
153+
return self._try_token_exchange_or_fallback(
154+
access_token, token_type
155+
)
154156
except Exception as e:
155157
logger.error(f"Error processing token: {str(e)}")
156158
# Fall back to original headers in case of error
@@ -324,13 +326,13 @@ def _send_token_exchange_request(
324326
) -> Dict[str, Any]:
325327
"""
326328
Send the token exchange request to the token endpoint.
327-
329+
328330
Args:
329331
token_exchange_data: The data to send in the request
330-
332+
331333
Returns:
332334
Dict[str, Any]: The parsed JSON response
333-
335+
334336
Raises:
335337
Exception: If the request fails
336338
"""

0 commit comments

Comments
 (0)