Minor style updates

This commit is contained in:
Joel Collins 2018-11-06 15:57:33 +00:00
parent 79974a71e5
commit 8031327a5b
5 changed files with 124 additions and 86 deletions

View file

@ -17,6 +17,7 @@ except ImportError:
# Slightly crappy debugger logging
DEBUG = True
def log(s):
if DEBUG:
print('DEBUG: {}'.format(s))
@ -71,13 +72,13 @@ class StreamObject(object):
file_path = os.path.join(folder, file_name)
else:
file_path = file_name
return file_path
def lock(self):
"""Set locked flag to True"""
self.locked = True
def unlock(self):
"""Set locked flag to False"""
self.locked = False
@ -111,6 +112,11 @@ class StreamObject(object):
f.seek(0, 0) # Seek to the start of the file
f.write(self.binary) # Write data bytes to file
def clear_stream(self):
"""Clears the BytesIO stream of the StreamObject."""
self.stream = io.BytesIO()
return True
def delete(self) -> bool:
"""
If the StreamObject has been saved to disk, deletes the file and returns True.