Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mypy fixes tests/framework/components/test_manager.py #586

Merged
merged 5 commits into from
Feb 14, 2025

Conversation

stevebachmeier
Copy link
Contributor

mypy fix tests/framework/components/test_manager.py

Description

Changes and notes

Testing

@@ -295,9 +295,12 @@ def _get_file(component: Component | Manager) -> str:
return inspect.getfile(component.__class__)

@staticmethod
def _flatten(components: list[Component | Manager]) -> list[Component | Manager]:
def _flatten(
components: Sequence[Component | Manager | Sequence[Any]],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where are we on type-hinting nested things? This method flattens a list of lists of arbitrary depth, so I just went w/ Any

Copy link
Contributor

Choose a reason for hiding this comment

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

I recall this is similar to the grief we had in LCT, but fwiw supposedly you can do recursive type aliases
https://stackoverflow.com/questions/53638973/recursive-type-annotations?rq=4

with pytest.raises(ComponentConfigError, match="no name"):
_ = 10 in component_list
_ = 10 in component_list # type: ignore[operator]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ignoring b/c it's precisely what we're ensuring raises

@stevebachmeier stevebachmeier force-pushed the sbachmei/mic-5712/mypy-test-manager branch from e1d176d to 5dd8723 Compare February 14, 2025 22:25
@stevebachmeier stevebachmeier merged commit 5d6097e into main Feb 14, 2025
6 of 8 checks passed
@stevebachmeier stevebachmeier deleted the sbachmei/mic-5712/mypy-test-manager branch February 14, 2025 22:35
Sign up for free to 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