-
Notifications
You must be signed in to change notification settings - Fork 21
Appease mypy #3636
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
Appease mypy #3636
Conversation
bbca7bd to
6069294
Compare
| exclude = [ | ||
| 'scipp/__init__\.py', | ||
| 'scipp/coords/', | ||
| 'scipp/curve_fit\.py', | ||
| 'scipp/format/formatter\.py', | ||
| 'scipp/io/hdf5\.py', | ||
| 'scipp/logging\.py', | ||
| 'scipp/object_list\.py', | ||
| 'scipp/operations\.py', | ||
| 'scipp/reduction\.py', | ||
| 'scipp/scipy/integrate/__init__\.py', | ||
| 'scipp/scipy/optimize/__init__\.py', | ||
| 'scipp/testing/strategies\.py', | ||
| 'scipp/utils/profile\.py', |
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.
Nice, list is getting very short!
| from typing import Protocol as _Protocol | ||
|
|
||
| # Importing CoordTable from coord_table.py would result in an import | ||
| # cycle because that module imports rule.py | ||
| # CoordTable is only needed for type annotations here, | ||
| # so a protocol is enough. | ||
| class _CoordProvider(_Protocol): | ||
| def consume(self, name: str) -> Coord: | ||
| pass | ||
|
|
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.
Was the comment wrong, or what has changed?
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.
It wasn't wrong. But the new solution matches what we do in other places (
scipp/src/scipp/coords/rule.py
Lines 21 to 24 in 6069294
| if TYPE_CHECKING: | |
| from coord_table import CoordTable | |
| else: | |
| CoordTable = Any |
6069294 to
4d82f7e
Compare
Same procedure as every time