@@ -44,7 +44,7 @@ def convert_from_dict(cls: type, data: dict) -> object:
4444 if data is None :
4545 return data
4646
47- if type (data ) == cls :
47+ if isinstance (data , cls ) :
4848 return data
4949
5050 if dataclasses .is_dataclass (cls ):
@@ -54,7 +54,7 @@ def convert_from_dict(cls: type, data: dict) -> object:
5454 if not ((str (typ ).startswith ('dict[' ) or
5555 str (typ ).startswith ('typing.Dict[' ) or
5656 str (typ ).startswith ('requests.structures.CaseInsensitiveDict[' ) or
57- typ == dict or str (typ ).startswith ('OrderedDict[' ))):
57+ typ is dict or str (typ ).startswith ('OrderedDict[' ))):
5858 data = {}
5959
6060 members = inspect .signature (cls .__init__ ).parameters
@@ -82,7 +82,7 @@ def convert_from_dict(cls: type, data: dict) -> object:
8282 elif (str (typ ).startswith ('dict[' ) or
8383 str (typ ).startswith ('typing.Dict[' ) or
8484 str (typ ).startswith ('requests.structures.CaseInsensitiveDict[' ) or
85- typ == dict or str (typ ).startswith ('OrderedDict[' )):
85+ typ is dict or str (typ ).startswith ('OrderedDict[' )):
8686
8787 values = {}
8888 generic_type = object
@@ -92,7 +92,7 @@ def convert_from_dict(cls: type, data: dict) -> object:
9292 v = data [member ][k ]
9393 values [k ] = get_value (generic_type , v )
9494 kwargs [member ] = values
95- elif typ == inspect .Parameter .empty :
95+ elif typ is inspect .Parameter .empty :
9696 if inspect .Parameter .VAR_KEYWORD == members [member ].kind :
9797 if type (data ) in dict_types :
9898 kwargs .update (data )
@@ -117,7 +117,7 @@ def get_value(typ: type, val: object) -> object:
117117 values .append (converted )
118118 return values
119119 elif str (typ ).startswith ('dict[' ) or str (typ ).startswith (
120- 'typing.Dict[' ) or str (typ ).startswith ('requests.structures.CaseInsensitiveDict[' ) or typ == dict :
120+ 'typing.Dict[' ) or str (typ ).startswith ('requests.structures.CaseInsensitiveDict[' ) or typ is dict :
121121 values = {}
122122 for k in val :
123123 v = val [k ]
0 commit comments