Skip to content

Commit 5f3c5b0

Browse files
Tranquility2alexanderankin
authored andcommitted
more fixes
1 parent f288a81 commit 5f3c5b0

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

core/testcontainers/compose/compose.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from dataclasses import asdict, dataclass, field, fields
1+
from dataclasses import asdict, dataclass, field, fields, is_dataclass
22
from functools import cached_property
33
from json import loads
44
from logging import warning
@@ -25,9 +25,11 @@ def _ignore_properties(cls: type[_IPT], dict_: Any) -> _IPT:
2525
https://gist.github.com/alexanderankin/2a4549ac03554a31bef6eaaf2eaf7fd5"""
2626
if isinstance(dict_, cls):
2727
return dict_
28+
if not is_dataclass(cls):
29+
raise TypeError(f"Expected a dataclass type, got {cls}")
2830
class_fields = {f.name for f in fields(cls)}
2931
filtered = {k: v for k, v in dict_.items() if k in class_fields}
30-
return cls(**filtered)
32+
return cast("_IPT", cls(**filtered))
3133

3234

3335
@dataclass

core/testcontainers/core/container.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def with_env(self, key: str, value: str) -> Self:
101101
self.env[key] = value
102102
return self
103103

104-
def with_env_file(self, env_file: Union[str, PathLike]) -> Self:
104+
def with_env_file(self, env_file: Union[str, PathLike[str]]) -> Self:
105105
env_values = dotenv_values(env_file)
106106
for key, value in env_values.items():
107107
assert value is not None

core/testcontainers/core/waiting_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def wait_container_is_ready(*transient_exceptions: type[BaseException]) -> Calla
4444
"""
4545
transient_exceptions = TRANSIENT_EXCEPTIONS + tuple(transient_exceptions)
4646

47-
@wrapt.decorator
47+
@wrapt.decorator # type: ignore[misc]
4848
def wrapper(wrapped: Callable[..., Any], instance: Any, args: list[Any], kwargs: dict[str, Any]) -> Any:
4949
from testcontainers.core.container import DockerContainer
5050

0 commit comments

Comments
 (0)