initial upload

This commit is contained in:
r4sas
2017-02-18 21:00:40 +03:00
commit a46f03ec83
8 changed files with 222 additions and 0 deletions

15
pbincli/utils.py Normal file
View File

@@ -0,0 +1,15 @@
"""Various code"""
import os
class PBinCLIException(Exception):
pass
def check_readable(f):
"""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"""
if not os.access(os.path.dirname(f) or ".", os.W_OK):
raise PBinCLIException("Path is not writable: {}".format(f))