8000 Narrow `is` with final types correctly by sobolevn · Pull Request #15646 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Narrow is with final types correctly #15646

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 12, 2023
commit 0076ae855af496ad7dfbffdd45f4e75d2bc972f3
5 changes: 2 additions & 3 deletions mypy/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2860,9 +2860,8 @@ def __eq__(self, other: object) -> bool:
return self.item == other.item

def is_singleton_type(self) -> bool:
return (
(isinstance(self.item, Instance) and self.item.type.is_final)
or isinstance(self.item, NoneType)
return (isinstance(self.item, Instance) and self.item.type.is_final) or isinstance(
self.item, NoneType
)

def serialize(self) -> JsonDict:
Expand Down
0