Skip to content

Commit f7a7f4f

Browse files
🐛 Added Review Suggestions
We don't need to convert dict_keys/items to set. Also fixed the comment saying literally the opposite of what was happening
1 parent a275c86 commit f7a7f4f

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

mypy/checkexpr.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -790,20 +790,19 @@ def check_typeddict_call_with_kwargs(
790790
orig_callee: Type | None,
791791
) -> Type:
792792
actual_keys = kwargs.keys()
793-
found_set = set(actual_keys)
794-
if not (callee.required_keys <= found_set <= set(callee.items.keys())):
793+
if not (callee.required_keys <= actual_keys <= callee.items.keys()):
795794
expected_keys = [
796795
key
797796
for key in callee.items.keys()
798-
if key in callee.required_keys or key in found_set
797+
if key in callee.required_keys or key in actual_keys
799798
]
800799
self.msg.unexpected_typeddict_keys(
801800
callee, expected_keys=expected_keys, actual_keys=list(actual_keys), context=context
802801
)
803-
if callee.required_keys > found_set:
804-
# found_set is not a sub-set of the required_keys
805-
# This means we're dealing with something weird we can't
806-
# properly type
802+
if callee.required_keys > actual_keys:
803+
# found_set is a sub-set of the required_keys
804+
# This means we're missing some keys and as such, we can't
805+
# properly type the object
807806
return AnyType(TypeOfAny.from_error)
808807

809808
orig_callee = get_proper_type(orig_callee)

0 commit comments

Comments
 (0)