@@ -165,11 +165,11 @@ def Extra(_) -> None:
165165primitive_types = (bool , bytes , int , long , str , unicode , float , complex )
166166
167167Schemable = typing .Union [
168- Extra , 'Schema' , 'Object' ,
168+ 'Schema' , 'Object' ,
169169 _Mapping ,
170170 list , tuple , frozenset , set ,
171171 bool , bytes , int , long , str , unicode , float , complex ,
172- type , object , dict , type ( None ) , typing .Callable
172+ type , object , dict , None , typing .Callable
173173]
174174
175175
@@ -753,8 +753,7 @@ def extend(self, schema: Schemable, required: typing.Optional[bool] = None, extr
753753 :param extra: if set, overrides `extra` of this `Schema`
754754 """
755755
756- assert type (self .schema ) == dict and type (schema ) == dict , 'Both schemas must be dictionary-based'
757- assert isinstance (self .schema , dict )
756+ assert isinstance (self .schema , dict ) and isinstance (schema , dict ), 'Both schemas must be dictionary-based'
758757
759758 result = self .schema .copy ()
760759
@@ -779,7 +778,7 @@ def key_literal(key):
779778
780779 # if both are dictionaries, we need to extend recursively
781780 # create the new extended sub schema, then remove the old key and add the new one
782- if type (result_value ) == dict and type (value ) == dict :
781+ if isinstance (result_value , dict ) and isinstance (value , dict ) :
783782 new_value = Schema (result_value ).extend (value ).schema
784783 del result [result_key ]
785784 result [key ] = new_value
0 commit comments