Skip to content

Commit 6e0fb78

Browse files
Fixing a couple type problems: how I would address most of #381 (#382)
* Create py.typed Signed-off-by: wyattscarpenter <[email protected]> * add -> Connection annotation Signed-off-by: wyattscarpenter <[email protected]> * massage the code to appease the particular version of the project's mypy deps Signed-off-by: wyattscarpenter <[email protected]> * fix circular import problem Signed-off-by: wyattscarpenter <[email protected]> --------- Signed-off-by: wyattscarpenter <[email protected]>
1 parent 7fade51 commit 6e0fb78

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/databricks/py.typed

Whitespace-only changes.

src/databricks/sql/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010

1111
import re
1212

13+
from typing import TYPE_CHECKING
14+
15+
if TYPE_CHECKING:
16+
# Use this import purely for type annotations, a la https://mypy.readthedocs.io/en/latest/runtime_troubles.html#import-cycles
17+
from .client import Connection
18+
1319

1420
class RedactUrlQueryParamsFilter(logging.Filter):
1521
pattern = re.compile(r"(\?|&)([\w-]+)=([^&]+)")
@@ -78,7 +84,7 @@ def TimestampFromTicks(ticks):
7884
return Timestamp(*time.localtime(ticks)[:6])
7985

8086

81-
def connect(server_hostname, http_path, access_token=None, **kwargs):
87+
def connect(server_hostname, http_path, access_token=None, **kwargs) -> "Connection":
8288
from .client import Connection
8389

8490
return Connection(server_hostname, http_path, access_token, **kwargs)

0 commit comments

Comments
 (0)