GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support exhaustive checking for “in” operator. by Malika1109 · Pull Request #16593 · python/mypy

Support exhaustive checking for “in” operator. #16593

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.

Sign up for GitHub

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

Closed
Malika1109 wants to merge 38 commits into python:master from Malika1109:in-exhaustive-checking

Uh oh!

There was an error while loading. Please reload this page.

Closed

Support exhaustive checking for “in” operator. #16593

Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
bd3c60a
Creating if branch to check for TupleExpr
Malika1109 Dec 1, 2023
8a0aee6
Checking if all elements iin the TupleExpr are enums
Malika1109 Dec 1, 2023
23d13f9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 1, 2023
f73e3fa
Fixed indent issues
Malika1109 Dec 1, 2023
aaec558
Merge branch 'in-exhaustive-checking' of https://github.com/Malika110…
Malika1109 Dec 1, 2023
e14adcb
Modified operators.py
Malika1109 Dec 1, 2023
018cf15
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 1, 2023
38102c7
Fixed formatting issues
Malika1109 Dec 1, 2023
a3fb558
Merge branch 'master' into in-exhaustive-checking
Malika1109 Dec 1, 2023
cd9826c
Merging purposes commit
Malika1109 Dec 1, 2023
ec1c3d4
Merging purposes commit
Malika1109 Dec 1, 2023
526f430
Resolved merge conflicts in typinig_extensions.pyi
Malika1109 Dec 1, 2023
605f66c
Resolved merge conflicts in typinig_extensions.pyi
Malika1109 Dec 1, 2023
c70b3f1
Merge pull request #1 from python/master
Malika1109 Dec 1, 2023
b56ab60
Resolved formatting issues
Malika1109 Dec 1, 2023
8116d9f
Merge branch 'master' of https://github.com/Malika1109/mypy into in-e…
Malika1109 Dec 1, 2023
090bc6f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 1, 2023
2df876c
Modified pyproject.tomll for ruff error
Malika1109 Dec 2, 2023
4a9e582
Made changes to handling of in for open-source errors
Malika1109 Dec 4, 2023
9bd590e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 4, 2023
6dd351c
Changed handling of in operator
Malika1109 Dec 4, 2023
17e1b7e
Changed handling of in operator
Malika1109 Dec 4, 2023
30b6cae
successfully created the check-in-exhaustive-checking-3.test file for…
a-khaldi Dec 5, 2023
fc611bc
removed the 3 in the name of the file for clarity + began the test wi…
a-khaldi Dec 5, 2023
4d38b0b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 5, 2023
4420ed8
testing is done without any comments, want to make sure it passes bef…
a-khaldi Dec 5, 2023
652caa4
testing is done without any comments, want to make sure it passes bef…
a-khaldi Dec 5, 2023
b4bf17a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 5, 2023
55d3b2f
removed unneeded comments & code
ssaloos Dec 5, 2023
16ca296
Delete feature-test.py for PR
GulnazSerikbay Dec 5, 2023
e7694a8
added comments for clarity and minor changes to in exhaustive checkin…
Dec 6, 2023
64a8ab5
added some enum type extraction + test
GulnazSerikbay Dec 6, 2023
6973a96
Merge branch
GulnazSerikbay Dec 6, 2023
5a060f7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 6, 2023
8144105
small fix
GulnazSerikbay Dec 6, 2023
69aec40
merge for pull and push
GulnazSerikbay Dec 6, 2023
046370e
removed some code
GulnazSerikbay Dec 6, 2023
06c8d98
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 6, 2023
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
Changed handling of in operator
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@Malika1109
Malika1109 committed Dec 4, 2023
commit 6dd351ca584d7d3492d8233eae74958e30b0fffb

There are no files selected for viewing

79 changes: 40 additions & 39 deletions 79 mypy/checker.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5842,51 +5842,52 @@ def has_no_custom_eq_checks(t: Type) -> bool:
if_map = {}
else_map = None

if left_index in narrowable_operand_index_to_hash:
# print("left in")
# We only try and narrow away 'None' for now
if is_overlapping_none(item_type):
collection_item_type = get_proper_type(
builtin_item_type(iterable_type)
)
# print("done5", if_map, else_map)
if (
collection_item_type is not None
and not is_overlapping_none(collection_item_type)
and not (
isinstance(collection_item_type, Instance)
and collection_item_type.type.fullname == "builtins.object"
)
and is_overlapping_erased_types(
item_type, collection_item_type
else:
if left_index in narrowable_operand_index_to_hash:
# print("left in")
# We only try and narrow away 'None' for now
if is_overlapping_none(item_type):
collection_item_type = get_proper_type(
builtin_item_type(iterable_type)
)
):
if_map[operands[left_index]] = remove_optional(item_type)
# print("done5", if_map, else_map)
if (
collection_item_type is not None
and not is_overlapping_none(collection_item_type)
and not (
isinstance(collection_item_type, Instance)
and collection_item_type.type.fullname == "builtins.object"
)
and is_overlapping_erased_types(
item_type, collection_item_type
)
):
if_map[operands[left_index]] = remove_optional(item_type)

# print("done6", if_map, else_map)
# print("done6", if_map, else_map)

if right_index in narrowable_operand_index_to_hash:
# print("right in")
if_type, else_type = self.conditional_types_for_iterable(
item_type, iterable_type
)
expr = operands[right_index]
# print("done7", if_map, else_map)
if right_index in narrowable_operand_index_to_hash:
# print("right in")
if_type, else_type = self.conditional_types_for_iterable(
item_type, iterable_type
)
expr = operands[right_index]
# print("done7", if_map, else_map)

if if_type is None:
if_map = None
# print("done8", if_map, else_map)
else:
if_map[expr] = if_type
# print("done9", if_map, else_map)
if if_type is None:
if_map = None
# print("done8", if_map, else_map)
else:
if_map[expr] = if_type
# print("done9", if_map, else_map)

if else_type is None:
else_map = None
# print("done11", if_map, else_map)
else:
else_map[expr] = else_type
if else_type is None:
else_map = None
# print("done11", if_map, else_map)
else:
else_map[expr] = else_type

# print("done12", if_map, else_map)
# print("done12", if_map, else_map)

else:
if_map = {}
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.