Skip to content

Commit df84adb

Browse files
committed
A tiny refactor
1 parent 8126bc1 commit df84adb

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

mypy/cache.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -391,15 +391,13 @@ def write_str_opt_list(data: WriteBuffer, value: list[str | None]) -> None:
391391
write_str_opt(data, item)
392392

393393

394-
JsonValue: _TypeAlias = None | int | str | bool | list["JsonValue"] | dict[str, "JsonValue"]
394+
Value: _TypeAlias = None | int | str | bool
395+
JsonValue: _TypeAlias = Value | list["JsonValue"] | dict[str, "JsonValue"]
396+
397+
# Currently tuples are used by mypyc plugin. They will be normalized to
398+
# JSON lists after a roundtrip.
395399
JsonValueEx: _TypeAlias = (
396-
None
397-
| int
398-
| str
399-
| bool
400-
| list["JsonValueEx"]
401-
| dict[str, "JsonValueEx"]
402-
| tuple["JsonValueEx", ...]
400+
Value | list["JsonValueEx"] | dict[str, "JsonValueEx"] | tuple["JsonValueEx", ...]
403401
)
404402

405403

@@ -424,8 +422,6 @@ def read_json_value(data: ReadBuffer) -> JsonValue:
424422
assert False, f"Invalid JSON tag: {tag}"
425423

426424

427-
# Currently tuples are used by mypyc plugin. They will be normalized to
428-
# JSON lists after a roundtrip.
429425
def write_json_value(data: WriteBuffer, value: JsonValueEx) -> None:
430426
if value is None:
431427
write_tag(data, LITERAL_NONE)

0 commit comments

Comments
 (0)