Use pathlib.Path to resolve paths

* is_block_device() is no longer needed
  * (pathlib.Path provides that functionality)
This commit is contained in:
2Shirt 2019-04-07 22:41:41 -07:00
parent c4d00a2073
commit cd0a9456cb
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -1,24 +1,21 @@
# Wizard Kit: Functions - UFD
import pathlib
from functions.common import *
def get_full_path(item):
"""Get full path to item, returns str."""
#TODO
pass
"""Get full path to item, returns pathlib.Path obj."""
path_obj = pathlib.Path(item).resolve()
if not path_obj.exists():
raise FileNotFoundError(path_obj)
return path_obj
def is_block_device(item):
"""Verify item is a block device, returns bool."""
#TODO
pass
def is_valid_main_kit(path):
"""Verify path contains the main kit, returns bool."""
#TODO
pass
def is_valid_main_kit(path_obj):
"""Verify PathObj contains the main kit, returns bool."""
return path_obj.is_dir() and path_obj.joinpath('.bin').exists()
if __name__ == '__main__':