@@ -296,22 +296,22 @@ def prop_to_binary(prop_val, type):
296
296
return struct .pack (format_str , Type .NULL )
297
297
298
298
# If field can be cast to a float, allow it
299
- if type == None or type == Type .NUMERIC :
299
+ if type is None or type == Type .NUMERIC :
300
300
try :
301
301
numeric_prop = float (prop_val )
302
302
if not math .isnan (numeric_prop ) and not math .isinf (numeric_prop ): # Don't accept non-finite values.
303
303
return struct .pack (format_str + "d" , Type .NUMERIC , numeric_prop )
304
304
except :
305
305
pass
306
306
307
- if type == None or type == Type .BOOL :
307
+ if type is None or type == Type .BOOL :
308
308
# If field is 'false' or 'true', it is a boolean
309
309
if prop_val .lower () == 'false' :
310
310
return struct .pack (format_str + '?' , Type .BOOL , False )
311
311
elif prop_val .lower () == 'true' :
312
312
return struct .pack (format_str + '?' , Type .BOOL , True )
313
313
314
- if type == None or type == Type .STRING :
314
+ if type is None or type == Type .STRING :
315
315
# If we've reached this point, the property is a string
316
316
encoded_str = str .encode (prop_val ) # struct.pack requires bytes objects as arguments
317
317
# Encoding len+1 adds a null terminator to the string
0 commit comments