mirror of
https://github.com/element-hq/synapse
synced 2024-09-17 18:55:10 +00:00
Appease runtime
This commit is contained in:
parent
e785ba8c5d
commit
9064a424d6
1 changed files with 12 additions and 4 deletions
|
@ -82,18 +82,26 @@ JsonSerializable = object
|
|||
# used for some basic sanity checking in e.g. module API return values.
|
||||
# Bottom out at `object` so that the caller knows they aren't getting any more
|
||||
# checking; they can always use casts if necessary.
|
||||
_FrozenJson1 = Union[str, int, float, None, frozendict[str, object], Tuple[object, ...]]
|
||||
|
||||
_FrozenJson1 = Union[
|
||||
str, int, float, None, "frozendict[str, object]", Tuple[object, ...]
|
||||
]
|
||||
_FrozenJson2 = Union[
|
||||
str, int, float, None, frozendict[str, _FrozenJson1], Tuple[_FrozenJson1, ...]
|
||||
str, int, float, None, "frozendict[str, _FrozenJson1]", Tuple[_FrozenJson1, ...]
|
||||
]
|
||||
_FrozenJson3 = Union[
|
||||
str, int, float, None, frozendict[str, _FrozenJson2], Tuple[_FrozenJson2, ...]
|
||||
str, int, float, None, "frozendict[str, _FrozenJson2]", Tuple[_FrozenJson2, ...]
|
||||
]
|
||||
|
||||
# FrozenJson supports JSON-like data, but only using frozen data structures.
|
||||
# (frozendicts instead of dicts and tuples instead of lists)
|
||||
FrozenJson = _FrozenJson3
|
||||
FrozenJsonDict = frozendict[str, _FrozenJson3]
|
||||
if TYPE_CHECKING:
|
||||
# frozendict isn't subscriptable.
|
||||
|
||||
FrozenJsonDict = frozendict[str, _FrozenJson3]
|
||||
else:
|
||||
FrozenJsonDict = frozendict[str, Any]
|
||||
|
||||
|
||||
# Note that this seems to require inheriting *directly* from Interface in order
|
||||
|
|
Loading…
Reference in a new issue