File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -336,7 +336,7 @@ extra items::
336
336
name: str
337
337
338
338
def f(movie: Movie) -> None:
339
- del movie["name"] # Not OK. The value type of 'name' is 'Required[int ]'
339
+ del movie["name"] # Not OK. The value type of 'name' is 'Required[str ]'
340
340
del movie["year"] # OK. The value type of 'year' is 'NotRequired[int]'
341
341
342
342
Interaction with ``Unpack ``
@@ -727,8 +727,8 @@ with signatures matching ``dict[str, VT]``
727
727
reveal_type(not_required_num_dict.popitem()) # OK. Revealed type is 'tuple[str, int]'
728
728
729
729
def f(not_required_num_dict: IntDictWithNum, key: str):
730
- not_required_num_dict[key] = 42 # OK
731
- del not_required_num_dict[key] # OK
730
+ not_required_num_dict[key] = 42 # OK
731
+ del not_required_num_dict[key] # OK
732
732
733
733
:ref: `Notes on indexed accesses <pep728-type-narrowing >` from the previous section
734
734
still apply.
@@ -742,7 +742,7 @@ because such dict can be a subtype of dict::
742
742
def f(might_not_be_a_builtin_dict: dict[str, int]):
743
743
int_dict: IntDict = might_not_be_a_builtin_dict # Not OK
744
744
745
- not_a_builtin_dict: CustomDict = {"num": 1}
745
+ not_a_builtin_dict = CustomDict( {"num": 1})
746
746
f(not_a_builtin_dict)
747
747
748
748
Runtime behavior
You can’t perform that action at this time.
0 commit comments