Skip to content

Commit 053d07f

Browse files
committed
Add type annotations for clickhouse.
1 parent 7e47c78 commit 053d07f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

clickhouse/testcontainers/clickhouse/__init__.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# License for the specific language governing permissions and limitations
1212
# under the License.
1313
import os
14+
from typing import Optional
1415

1516
import clickhouse_driver
1617
from clickhouse_driver.errors import Error
@@ -45,12 +46,12 @@ class ClickHouseContainer(DbContainer):
4546

4647
def __init__(
4748
self,
48-
image="clickhouse/clickhouse-server:latest",
49-
port=9000,
50-
user=None,
51-
password=None,
52-
dbname=None
53-
):
49+
image: str = "clickhouse/clickhouse-server:latest",
50+
port: int = 9000,
51+
user: Optional[str] = None,
52+
password: Optional[str] = None,
53+
dbname: Optional[str] = None
54+
) -> None:
5455
super().__init__(image=image)
5556

5657
self.CLICKHOUSE_USER = user or self.CLICKHOUSE_USER
@@ -60,16 +61,16 @@ def __init__(
6061
self.with_exposed_ports(self.port_to_expose)
6162

6263
@wait_container_is_ready(Error, EOFError)
63-
def _connect(self):
64+
def _connect(self) -> None:
6465
with clickhouse_driver.Client.from_url(self.get_connection_url()) as client:
6566
client.execute("SELECT version()")
6667

67-
def _configure(self):
68+
def _configure(self) -> None:
6869
self.with_env("CLICKHOUSE_USER", self.CLICKHOUSE_USER)
6970
self.with_env("CLICKHOUSE_PASSWORD", self.CLICKHOUSE_PASSWORD)
7071
self.with_env("CLICKHOUSE_DB", self.CLICKHOUSE_DB)
7172

72-
def get_connection_url(self, host=None):
73+
def get_connection_url(self, host: Optional[str] = None) -> str:
7374
return self._create_connection_url(
7475
dialect="clickhouse",
7576
username=self.CLICKHOUSE_USER,

0 commit comments

Comments
 (0)