Improved _remove_empty so that it doesn't remove 0, just None
This commit is contained in:
committed by
Sébastien Corbin
parent
a42a9ca543
commit
ea3800375c
@@ -15,8 +15,8 @@ def draw_signature(data, as_file=False):
|
|||||||
if `as_file` is True, a temp file is returned instead of Image instance
|
if `as_file` is True, a temp file is returned instead of Image instance
|
||||||
"""
|
"""
|
||||||
def _remove_empty_pts(pt):
|
def _remove_empty_pts(pt):
|
||||||
return {'x': list(filter(None, pt['x'])), 'y': list(filter(None, pt['y']))}
|
return {'x': list(filter(lambda n: n is not None, pt['x'])), 'y': list(filter(lambda n: n is not None, pt['y']))}
|
||||||
|
|
||||||
if type(data) is str:
|
if type(data) is str:
|
||||||
drawing = json.loads(data, object_hook=_remove_empty_pts)
|
drawing = json.loads(data, object_hook=_remove_empty_pts)
|
||||||
elif type(data) is list:
|
elif type(data) is list:
|
||||||
|
|||||||
Reference in New Issue
Block a user