30
30
31
31
MAGIC_BYTE : Final [bytes ] = b"\x15 "
32
32
33
- _type_to_alias : Final [Dict [Type [Any ], str ]] = dict ()
33
+ _type_to_alias : Final [Dict [Type [Any ], str ]] = {}
34
34
"""A mapping of proxied Python types to their alias."""
35
35
36
- _alias_to_type : Final [Dict [str , Type [Any ]]] = dict ()
36
+ _alias_to_type : Final [Dict [str , Type [Any ]]] = {}
37
37
"""A mapping of aliases to their proxied Python type."""
38
38
39
- _attribute_mappings : Final [Dict [Type [Any ], Dict [str , str ]]] = dict ()
39
+ _attribute_mappings : Final [Dict [Type [Any ], Dict [str , str ]]] = {}
40
40
"""A mapping of object attributes that require a different name when serialized/deserialized."""
41
41
42
- _attribute_mappings_rev : Final [Dict [Type [Any ], Dict [str , str ]]] = dict ()
42
+ _attribute_mappings_rev : Final [Dict [Type [Any ], Dict [str , str ]]] = {}
43
43
"""The same mapping as _attribute_mappings, but in reverse for deserialization."""
44
44
45
45
@@ -165,7 +165,7 @@ def _flatten_obj(self, obj: Any) -> dict[str, str | dict[str, list[dict[str, Any
165
165
if alias is not None :
166
166
marker = result .get (_JSON_PICKLE_OBJ , None )
167
167
if marker is not None :
168
- actual : dict [str , Any ] = dict ()
168
+ actual : dict [str , Any ] = {}
169
169
actual [_META_CLASS ] = alias
170
170
for key , value in result .items ():
171
171
# ignore jsonpickle specific content as well as protected keys
@@ -190,11 +190,11 @@ def _flatten_obj(self, obj: Any) -> dict[str, str | dict[str, list[dict[str, Any
190
190
and _META_VERSION not in value_
191
191
and _META_ENUM not in value_
192
192
):
193
- entries = list ()
193
+ entries = []
194
194
for key_inner , value_inner in value .items ():
195
195
entries .append ({_JSON_KEY : key_inner , _JSON_VALUE : value_inner })
196
196
197
- padding : dict [str , Any ] = dict ()
197
+ padding : dict [str , Any ] = {}
198
198
padding ["entries" ] = entries
199
199
value_ = padding
200
200
@@ -230,7 +230,7 @@ def _restore(self, obj: Any) -> Any:
230
230
metadata : Any = obj .get (_META_CLASS , None )
231
231
if metadata is not None :
232
232
type_ : Optional [Type [Any ]] = _type_for (metadata )
233
- actual : dict [Any , Any ] = dict ()
233
+ actual : dict [Any , Any ] = {}
234
234
if type_ is None :
235
235
if "map" in metadata .lower ():
236
236
for entry in obj [_JSON_ENTRIES ]:
@@ -264,7 +264,7 @@ def _restore(self, obj: Any) -> Any:
264
264
if len (obj ) == 1 :
265
265
entries = obj .get (_JSON_ENTRIES , None )
266
266
if entries is not None :
267
- actual = dict ()
267
+ actual = {}
268
268
for entry in obj [_JSON_ENTRIES ]:
269
269
actual [entry [_JSON_KEY ]] = entry [_JSON_VALUE ]
270
270
return super ().restore (actual , reset = False )
0 commit comments