def initDB(self, forceInit=False): """ T.initGPStor(forceInit) -> Initialize the database with default values @param forceInit: Initialize even if database exists @type forceInit: boolean """ if GPStor.checkSetup(db_path=self.db_path, db_file=self.db_file) and not forceInit: return self.tagDB = GPStor(db_path=self.db_path, db_file=self.db_file) self.tagDB.getDataRW() self.tagDB.writeData({'e2t': {}, 't2e': {}, 'e2a': {}})
def __init__(self, db_path=os.getcwd(), db_file=DB_FILE, logger=None): """ Tagging() -> object of class Tagging @param db_path: Path to database. Defaults to empty string @type db_path: string """ self.db_path = db_path self.db_file = db_file if GPStor.checkSetup(db_path=self.db_path, db_file=self.db_file): self.tagDB = GPStor(db_path=self.db_path, db_file=self.db_file) else: self.tagDB = None self.useWriteCache = False self.tagDict = {} self.logger = logger