|
12 | 12 | class Container: |
13 | 13 | def __init__( |
14 | 14 | self, |
15 | | - ): |
| 15 | + ) -> None: |
16 | 16 | self._image_name: str = 'thenativeweb/eventsourcingdb' |
17 | 17 | self._image_tag: str = 'latest' |
18 | 18 | self._api_token: str = 'secret' |
@@ -57,7 +57,7 @@ def _create_container(self) -> None: |
57 | 57 | detach=True, |
58 | 58 | ) # type: ignore |
59 | 59 |
|
60 | | - def _extract_port_from_container_info(self, container_info): |
| 60 | + def _extract_port_from_container_info(self, container_info) -> int | None: |
61 | 61 | port = None |
62 | 62 | valid_mapping = True |
63 | 63 | port_mappings = None |
@@ -95,7 +95,7 @@ def _fetch_mapped_port(self) -> None: |
95 | 95 | self._stop_and_remove_container() |
96 | 96 | raise RuntimeError('Failed to determine mapped port') |
97 | 97 |
|
98 | | - def _get_container_info(self): |
| 98 | + def _get_container_info(self) -> dict | None: |
99 | 99 | if self._container is None: |
100 | 100 | return None |
101 | 101 | return self._docker_client.api.inspect_container(self._container.id) |
@@ -142,7 +142,7 @@ def _pull_or_get_image(self) -> None: |
142 | 142 | except errors.APIError as e: |
143 | 143 | self._handle_image_pull_error(e) |
144 | 144 |
|
145 | | - def _handle_image_pull_error(self, error): |
| 145 | + def _handle_image_pull_error(self, error) -> None: |
146 | 146 | image_name = f"{self._image_name}:{self._image_tag}" |
147 | 147 | try: |
148 | 148 | self._docker_client.images.get(image_name) |
@@ -211,7 +211,7 @@ def _check_endpoint_available(self, url: str) -> bool: |
211 | 211 | return self._check_response_ok(response) |
212 | 212 |
|
213 | 213 | # pylint: disable=R6301 |
214 | | - def _check_response_ok(self, response) -> bool: |
| 214 | + def _check_response_ok(self, response: requests.Response) -> bool: |
215 | 215 | return response is not None and response.status_code == HTTPStatus.OK |
216 | 216 |
|
217 | 217 | def with_api_token(self, token: str) -> 'Container': |
|
0 commit comments