Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mgyucht committed Jul 4, 2024
1 parent da607ba commit 48a1564
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions databricks/sdk/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pathlib
import sys
import urllib.parse
from typing import Dict, Iterable, List, Optional, Tuple
from typing import Dict, Iterable, Optional

import requests

Expand Down Expand Up @@ -237,7 +237,8 @@ def user_agent(self):
# global user agent includes SDK version, product name & version, platform info,
# and global extra info. Config can have specific extra info associated with it,
# such as an override product, auth type, and other user-defined information.
return useragent.to_string(self._product_info, [("auth", self.auth_type)] + self._user_agent_other_info)
return useragent.to_string(self._product_info,
[("auth", self.auth_type)] + self._user_agent_other_info)

@property
def _upstream_user_agent(self) -> str:
Expand Down Expand Up @@ -456,7 +457,6 @@ def _init_product(self, product, product_version):
else:
self._product_info = None


def __repr__(self):
return f'<{self.debug_string()}>'

Expand Down
14 changes: 6 additions & 8 deletions databricks/sdk/useragent.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import copy
import logging
import os
import platform
import re
import copy
from typing import Optional, Tuple, List
from typing import List, Optional, Tuple

from .version import __version__

Expand Down Expand Up @@ -121,7 +121,8 @@ def _sanitize_header_value(value: str) -> str:
return value


def to_string(alternate_product_info: Optional[Tuple[str, str]] = None, other_info: Optional[List[Tuple[str, str]]] = None) -> str:
def to_string(alternate_product_info: Optional[Tuple[str, str]] = None,
other_info: Optional[List[Tuple[str, str]]] = None) -> str:
"""Compute the full User-Agent header.
The User-Agent header contains the product name, version, and other metadata that is submitted to Databricks on
Expand All @@ -133,11 +134,8 @@ def to_string(alternate_product_info: Optional[Tuple[str, str]] = None, other_in
base.append(alternate_product_info)
else:
base.append((_product_name, _product_version))
base.extend([
("databricks-sdk-py", __version__),
("python", platform.python_version()),
("os", platform.uname().system.lower()),
])
base.extend([("databricks-sdk-py", __version__), ("python", platform.python_version()),
("os", platform.uname().system.lower()), ])
if other_info:
base.extend(other_info)
base.extend(_extra)
Expand Down
1 change: 1 addition & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import platform

import pytest

from databricks.sdk import useragent
Expand Down

0 comments on commit 48a1564

Please sign in to comment.