|
25 | 25 | from threading import Lock
|
26 | 26 | from time import strptime
|
27 | 27 | from types import TracebackType
|
28 |
| -from typing import Any, Callable, Generator, Iterable, Iterator, NamedTuple, Sequence, TypeVar |
| 28 | +from typing import ( |
| 29 | + Any, |
| 30 | + Callable, |
| 31 | + Generator, |
| 32 | + Iterable, |
| 33 | + Iterator, |
| 34 | + NamedTuple, |
| 35 | + Sequence, |
| 36 | + TypeVar, |
| 37 | +) |
29 | 38 | from uuid import UUID
|
30 | 39 |
|
31 | 40 | from cryptography.hazmat.backends import default_backend
|
|
115 | 124 | DEFAULT_CLIENT_PREFETCH_THREADS = 4
|
116 | 125 | MAX_CLIENT_PREFETCH_THREADS = 10
|
117 | 126 | DEFAULT_BACKOFF_POLICY = exponential_backoff()
|
118 |
| -T = TypeVar('T', bound=SnowflakeCursor) |
| 127 | +T = TypeVar("T", bound=SnowflakeCursor) |
119 | 128 |
|
120 | 129 |
|
121 | 130 | def DefaultConverterClass() -> type:
|
@@ -443,7 +452,7 @@ def __init__(
|
443 | 452 | elif "streamlit" in sys.modules:
|
444 | 453 | kwargs["application"] = "streamlit"
|
445 | 454 |
|
446 |
| - self.converter = None |
| 455 | + self.converter: SnowflakeConverter | None = None |
447 | 456 | self.query_context_cache: QueryContextCache | None = None
|
448 | 457 | self.query_context_cache_size = 5
|
449 | 458 | if connections_file_path is not None:
|
@@ -869,9 +878,7 @@ def rollback(self) -> None:
|
869 | 878 | """Rolls back the current transaction."""
|
870 | 879 | self.cursor().execute("ROLLBACK")
|
871 | 880 |
|
872 |
| - def cursor( |
873 |
| - self, cursor_class: type[T] = SnowflakeCursor |
874 |
| - ) -> T: |
| 881 | + def cursor(self, cursor_class: type[T] = SnowflakeCursor) -> T: |
875 | 882 | """Creates a cursor object. Each statement will be executed in a new cursor object."""
|
876 | 883 | logger.debug("cursor")
|
877 | 884 | if not self.rest:
|
@@ -939,7 +946,7 @@ def setup_ocsp_privatelink(app, hostname) -> None:
|
939 | 946 |
|
940 | 947 | def __open_connection(self):
|
941 | 948 | """Opens a new network connection."""
|
942 |
| - self.converter = self._converter_class( |
| 949 | + self.converter = self.converter_class( |
943 | 950 | use_numpy=self._numpy, support_negative_year=self._support_negative_year
|
944 | 951 | )
|
945 | 952 |
|
|
0 commit comments