add latest changes from march'17

This commit is contained in:
r4sas
2018-02-12 17:28:18 +03:00
parent af722098f1
commit 7a88bf2efc
7 changed files with 24 additions and 22 deletions

View File

@@ -6,18 +6,18 @@ class PBinCLIException(Exception):
def check_readable(f):
"""Checks if path exists and readable"""
# Checks if path exists and readable
if not os.path.exists(f) or not os.access(f, os.R_OK):
raise PBinCLIException("Error accessing path: {}".format(f))
def check_writable(f):
"""Checks if path is writable"""
# Checks if path is writable
if not os.access(os.path.dirname(f) or ".", os.W_OK):
raise PBinCLIException("Path is not writable: {}".format(f))
"""http://stackoverflow.com/a/33571117"""
# http://stackoverflow.com/a/33571117
def json_load_byteified(file_handle):
return _byteify(
json.load(file_handle, object_hook=_byteify),