Skip to content

Commit

Permalink
Black the files
Browse files Browse the repository at this point in the history
  • Loading branch information
susodapop committed Oct 29, 2024
1 parent 63004c1 commit d10270a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/databricks/sql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,33 @@ def DateFromTicks(ticks):
def TimestampFromTicks(ticks):
return Timestamp(*time.localtime(ticks)[:6])


def singleton(class_):
instances = {}

def getinstance(*args, **kwargs):
if class_ not in instances:
instances[class_] = class_(*args, **kwargs)
return instances[class_]

return getinstance


@singleton
class DefaultNone(object):
"""Used to represent a default value of None so that this code can distinguish between
the user passing None versus a default value of None being used.
"""

pass


def connect(server_hostname, http_path, access_token: Optional[Union[str, DefaultNone]]=DefaultNone, **kwargs) -> "Connection":
def connect(
server_hostname,
http_path,
access_token: Optional[Union[str, DefaultNone]] = DefaultNone,
**kwargs
) -> "Connection":
from .client import Connection

return Connection(server_hostname, http_path, access_token, **kwargs)
2 changes: 1 addition & 1 deletion src/databricks/sql/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def read(self) -> Optional[OAuthToken]:
elif access_token is None:
logger.info(
"Connection access_token was passed a None value. U2M OAuth will be attempted"
)
)
else:
access_token_kv = {"access_token": access_token}
kwargs = {**kwargs, **access_token_kv}
Expand Down

0 comments on commit d10270a

Please sign in to comment.