Skip to content

Commit 54e0d8e

Browse files
committed
Update type annotations for core.
1 parent 20ac61c commit 54e0d8e

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

core/testcontainers/core/container.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ def stop(self, force=True, delete_volume=True) -> None:
7171
def __enter__(self) -> 'DockerContainer':
7272
return self.start()
7373

74-
def __exit__(self, exc_type, exc_val, exc_tb):
74+
def __exit__(self, exc_type, exc_val, exc_tb) -> None:
7575
self.stop()
7676

77-
def __del__(self):
77+
def __del__(self) -> None:
7878
"""
7979
Try to remove the container in all circumstances
8080
"""

core/testcontainers/core/waiting_utils.py

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import re
1616
import time
1717
import traceback
18-
from typing import Any, Callable, Iterable, Mapping, Optional, TYPE_CHECKING
18+
from typing import Any, Callable, Iterable, Mapping, Optional, TYPE_CHECKING, Union
1919
import wrapt
2020

2121
from . import config
@@ -76,27 +76,21 @@ def wait_for(condition: Callable[..., bool]) -> bool:
7676
return condition()
7777

7878

79-
def wait_for_logs(container: "DockerContainer", predicate: Callable,
79+
def wait_for_logs(container: "DockerContainer", predicate: Union[Callable, str],
8080
timeout: Optional[float] = None, interval: float = 1) -> float:
8181
"""
8282
Wait for the container to emit logs satisfying the predicate.
8383
84-
Parameters
85-
----------
86-
container : DockerContainer
87-
Container whose logs to wait for.
88-
predicate : callable or str
89-
Predicate that should be satisfied by the logs. If a string, the it is used as the pattern
90-
for a multiline regular expression search.
91-
timeout : float or None
92-
Number of seconds to wait for the predicate to be satisfied. Defaults to wait indefinitely.
93-
interval : float
94-
Interval at which to poll the logs.
95-
96-
Returns
97-
-------
98-
duration : float
99-
Number of seconds until the predicate was satisfied.
84+
Args:
85+
container: Container whose logs to wait for.
86+
predicate: Predicate that should be satisfied by the logs. If a string, the it is used as
87+
the pattern for a multiline regular expression search.
88+
timeout: Number of seconds to wait for the predicate to be satisfied. Defaults to wait
89+
indefinitely.
90+
interval: Interval at which to poll the logs.
91+
92+
Returns:
93+
duration: Number of seconds until the predicate was satisfied.
10094
"""
10195
if isinstance(predicate, str):
10296
predicate = re.compile(predicate, re.MULTILINE).search

0 commit comments

Comments
 (0)