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

Suppress mypy warning #1410

Merged
merged 1 commit into from
Feb 22, 2025
Merged

Suppress mypy warning #1410

merged 1 commit into from
Feb 22, 2025

Conversation

tleonhardt
Copy link
Member

@tleonhardt tleonhardt commented Feb 19, 2025

Supress new mypy warning that first appeared with a new version of mypy.

Warning is:

cmd2/argparse_custom.py: note: In member "_print_message" of class "Cmd2ArgumentParser":
cmd2/argparse_custom.py:1364:44: error: Argument 2 of "_print_message" is incompatible with supertype "ArgumentParser"; supertype defines the argument type as "SupportsWrite[str] | None"  [override]
cmd2/argparse_custom.py:1364:44: note: This violates the Liskov substitution principle
cmd2/argparse_custom.py:1364:44: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides

I tried replacing typing.IO[str] with SupportsWrite[str] as suggested, but then that broke things down the road because we need this thing to support an isatty method within ansi.style_aware_write. So for now we can just suppress this warning.

Warning is:
```
cmd2/argparse_custom.py: note: In member "_print_message" of class "Cmd2ArgumentParser":
cmd2/argparse_custom.py:1364:44: error: Argument 2 of "_print_message" is incompatible with supertype "ArgumentParser"; supertype defines the argument type as "SupportsWrite[str] | None"  [override]
cmd2/argparse_custom.py:1364:44: note: This violates the Liskov substitution principle
cmd2/argparse_custom.py:1364:44: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
```
@tleonhardt tleonhardt self-assigned this Feb 19, 2025
@tleonhardt tleonhardt merged commit 8045763 into master Feb 22, 2025
47 checks passed
@tleonhardt tleonhardt deleted the fix_mypy_error branch February 22, 2025 18:47
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.

1 participant