cic-cli/cic/base.py

39 lines
730 B
Python
Raw Normal View History

2021-10-09 19:56:29 +02:00
# standard imports
import os
mod_dir = os.path.dirname(os.path.realpath(__file__))
root_dir = os.path.join(mod_dir, '..')
data_dir = os.path.join(mod_dir, 'data')
schema_dir = os.path.join(mod_dir, 'schema')
class Data:
__default_version = 0
def __init__(self):
self.dirty = False
self.inited = False
self.__version = self.__default_version
def load(self):
if self.dirty:
raise RuntimeError('Object contains uncommitted changes')
def start(self):
if self.inited:
raise RuntimeError('Object already initialized')
def version(self):
return self.__version
2021-10-09 20:37:54 +02:00
def set_version(self, version):
self.__version = version