Skip to content

Commit

Permalink
Restore compatibility for old TypedDictValue format (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra authored Feb 24, 2024
1 parent cef60b8 commit 9623e2a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pyanalyze/value.py
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,15 @@ def __init__(
extra_keys: Optional[Value] = None,
extra_keys_readonly: bool = False,
) -> None:
# Compatibility with old format, where values were (required, type) tuples.
items = {
key: (
value
if isinstance(value, TypedDictEntry)
else TypedDictEntry(value[1], required=value[0])
)
for key, value in items.items()
}
value_types = []
if items:
value_types += [val.typ for val in items.values()]
Expand Down

0 comments on commit 9623e2a

Please sign in to comment.