Skip to content

fix: typing in core - #504

Closed
alexanderankin wants to merge 3 commits into
mainfrom
typing_core
Closed

fix: typing in core#504
alexanderankin wants to merge 3 commits into
mainfrom
typing_core

Conversation

@alexanderankin

Copy link
Copy Markdown
Member

No description provided.

@alexanderankinalexanderankin changed the title typing in corefix: typing in coreMar 25, 2024
@totallyzen

Copy link
Copy Markdown
Contributor

Nice! Glad you found the time before me! Good start! 🙏

Comment threadcore/testcontainers/core/docker_client.py
def wait_for_logs(
container: "DockerContainer", predicate: Union[Callable, str], timeout: Optional[float] = None, interval: float = 1
container: "DockerContainer",
predicate: Union[Callable[..., Any], str],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the callable here be Callable[(str,) bool]? It's used as if predicate(stdout) or predicate(stderr):

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in java it also takes regex i dont remember if that is the case here but i will leave this thread open to review when and if this PR goes on. I think it belongs in a draft state for now. i just wanted to record the results of going through the exercise to add types. for example, some of the places we return ports are actually str | int (well, union, for 3.8 compatibility)

@oliverlambsonoliverlambson mentioned this pull request Jun 30, 2024
6 tasks
@Tranquility2Tranquility2 mentioned this pull request Aug 22, 2024
alexanderankin pushed a commit that referenced this pull request May 4, 2025
Supports:
#305
Related :
#691#692#700
Based on #504, kudos @alexanderankin ```
poetry run mypy --config-file pyproject.toml core/testcontainers/core/docker_client.py Success: no issues found in 1 source file
```
Old
```
Error Summary ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓
┃ File Path ┃ Errors ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━┩
│ core/testcontainers/core/version.py │ 12 │
│ core/testcontainers/core/docker_client.py │ 14 │
│ core/testcontainers/core/image.py │ 17 │
│ core/testcontainers/core/waiting_utils.py │ 8 │
│ core/testcontainers/core/container.py │ 20 │
│ core/tests/test_new_docker_api.py │ 4 │
│ core/tests/test_docker_in_docker.py │ 2 │
│ core/testcontainers/compose/compose.py │ 22 │
│ core/testcontainers/compose/__init__.py │ 2 │
│ core/tests/test_version.py │ 2 │
│ core/tests/test_ryuk.py │ 2 │
│ core/tests/test_registry.py │ 1 │
│ core/tests/test_image.py │ 3 │
│ core/tests/test_compose.py │ 7 │
└───────────────────────────────────────────┴────────┘
Found 116 errors in 14 files.
```
New
```
Error Summary ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓
┃ File Path ┃ Errors ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━┩
│ core/testcontainers/core/version.py │ 12 │
│ core/testcontainers/core/network.py │ 3 │
│ core/testcontainers/core/image.py │ 17 │
│ core/testcontainers/core/waiting_utils.py │ 8 │
│ core/testcontainers/core/container.py │ 19 │
│ core/tests/test_new_docker_api.py │ 4 │
│ core/tests/test_docker_in_docker.py │ 2 │
│ core/testcontainers/compose/compose.py │ 22 │
│ core/testcontainers/compose/__init__.py │ 2 │
│ core/tests/test_version.py │ 2 │
│ core/tests/test_ryuk.py │ 2 │
│ core/tests/test_registry.py │ 1 │
│ core/tests/test_image.py │ 3 │
│ core/tests/test_compose.py │ 7 │
└───────────────────────────────────────────┴────────┘
Found 104 errors in 14 files.
```
@alexanderankin

Copy link
Copy Markdown
MemberAuthor

closed in favor of #810

@alexanderankin
alexanderankin deleted the typing_core branch July 3, 2025 11:23
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@alexanderankin@totallyzen@jankatins