-
Notifications
You must be signed in to change notification settings - Fork 15
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
Conversation
@@ -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]], |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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
e1d176d
to
5dd8723
Compare
mypy fix tests/framework/components/test_manager.py
Description
Changes and notes
Testing