| 
14 | 14 | from copy import deepcopy, copy  | 
15 | 15 | from functools import partial  | 
16 | 16 | from collections.abc import Mapping  | 
17 |  | -from typing import Callable, Optional, Union  | 
 | 17 | +from typing import (  | 
 | 18 | +    Callable, Optional, Union,  | 
 | 19 | +    overload, Literal, Any,  | 
 | 20 | +)  | 
18 | 21 | from deepdiff.helper import (  | 
19 | 22 |     strings,  | 
20 | 23 |     get_type,  | 
@@ -337,8 +340,8 @@ def find_class(self, module, name):  | 
337 | 340 |         # Forbid everything else.  | 
338 | 341 |         raise ForbiddenModule(FORBIDDEN_MODULE_MSG.format(module_dot_class)) from None  | 
339 | 342 | 
 
  | 
340 |  | -    def persistent_load(self, persistent_id):  | 
341 |  | -        if persistent_id == "<<NoneType>>":  | 
 | 343 | +    def persistent_load(self, pid):  | 
 | 344 | +        if pid == "<<NoneType>>":  | 
342 | 345 |             return type(None)  | 
343 | 346 | 
 
  | 
344 | 347 | 
 
  | 
@@ -642,9 +645,40 @@ def object_hook(self, obj):  # type: ignore  | 
642 | 645 |         return obj  | 
643 | 646 | 
 
  | 
644 | 647 | 
 
  | 
 | 648 | + | 
 | 649 | +@overload  | 
 | 650 | +def json_dumps(  | 
 | 651 | +    item: Any,  | 
 | 652 | +    **kwargs,  | 
 | 653 | +) -> str:  | 
 | 654 | +    ...  | 
 | 655 | + | 
 | 656 | + | 
 | 657 | +@overload  | 
 | 658 | +def json_dumps(  | 
 | 659 | +    item: Any,  | 
 | 660 | +    default_mapping:Optional[dict],  | 
 | 661 | +    force_use_builtin_json: bool,  | 
 | 662 | +    return_bytes:Literal[True],  | 
 | 663 | +    **kwargs,  | 
 | 664 | +) -> bytes:  | 
 | 665 | +    ...  | 
 | 666 | + | 
 | 667 | + | 
 | 668 | +@overload  | 
 | 669 | +def json_dumps(  | 
 | 670 | +    item: Any,  | 
 | 671 | +    default_mapping:Optional[dict],  | 
 | 672 | +    force_use_builtin_json: bool,  | 
 | 673 | +    return_bytes:Literal[False],  | 
 | 674 | +    **kwargs,  | 
 | 675 | +) -> str:  | 
 | 676 | +    ...  | 
 | 677 | + | 
 | 678 | + | 
645 | 679 | def json_dumps(  | 
646 |  | -    item,  | 
647 |  | -    default_mapping=None,  | 
 | 680 | +    item: Any,  | 
 | 681 | +    default_mapping:Optional[dict]=None,  | 
648 | 682 |     force_use_builtin_json: bool = False,  | 
649 | 683 |     return_bytes: bool = False,  | 
650 | 684 |     **kwargs,  | 
 | 
0 commit comments