Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the return types of the classes' __enter__ functions #384

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/databricks/sql/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ def _set_use_inline_params_with_warning(self, value: Union[bool, str]):

return value

def __enter__(self):
# The ideal return type for this method is perhaps Self, but that was not added until 3.11, and we support pre-3.11 pythons, currently.
def __enter__(self) -> "Connection":
return self

def __exit__(self, exc_type, exc_value, traceback):
Expand Down Expand Up @@ -409,7 +410,8 @@ def __init__(
self.escaper = ParamEscaper()
self.lastrowid = None

def __enter__(self):
# The ideal return type for this method is perhaps Self, but that was not added until 3.11, and we support pre-3.11 pythons, currently.
def __enter__(self) -> "Cursor":
return self

def __exit__(self, exc_type, exc_value, traceback):
Expand Down
Loading