from datetime import datetime from enum import Flag, unique, global_enum from pathlib import Path ''' Defining IOTTB_HOME_ABS here implies that it be immutable. It is used here so that one could configure it. But after its used in __man__ this cannot be relied upon. ''' IOTTB_HOME_ABS = Path().home() / 'IOTTB.db' # TODO maybe wrap this into class to make it easier to pass along to different objects # But will need more refactoring DEVICE_METADATA_FILE = 'device_metadata.json' CAPTURE_METADATA_FILE = 'capture_metadata.json' TODAY_DATE_STRING = datetime.now().strftime('%d%b%Y').lower() # TODO convert to function in utils or so CAPTURE_FOLDER_BASENAME = 'capture_###' AFFIRMATIVE_USER_RESPONSE = {'yes', 'y', 'true', 'Y', 'Yes', 'YES'} NEGATIVE_USER_RESPONSE = {'no', 'n', 'N', 'No'} YES_DEFAULT = AFFIRMATIVE_USER_RESPONSE.union({'', ' '}) NO_DEFAULT = NEGATIVE_USER_RESPONSE.union({'', ' '}) @unique @global_enum class ReturnCodes(Flag): SUCCESS = 0 ABORTED = 1 FAILURE = 2 UNKNOWN = 3 FILE_NOT_FOUND = 4 FILE_ALREADY_EXISTS = 5 INVALID_ARGUMENT = 6 INVALID_ARGUMENT_VALUE = 7 def iottb_home_abs(): return None