mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-03-15 12:24:29 +00:00
16 lines
497 B
Python
16 lines
497 B
Python
def serialize_everything(obj):
|
|
"""Convert objects to serialisable things. Used by JSON serialiser as a default when it encounters unserializable things.
|
|
Just converts objects to dict. Try to avoid doing anything clever here when serialising spots, because we also need
|
|
to receive spots without complex handling."""
|
|
return obj.__dict__
|
|
|
|
|
|
def empty_queue(q):
|
|
"""Empty a queue"""
|
|
|
|
while not q.empty():
|
|
try:
|
|
q.get_nowait()
|
|
except:
|
|
break
|