def django(path_=path('web')): return nested( cd(path_), prefix('export DJANGO_SETTINGS_MODULE=goma.settings.' + env.environment), prefix('source ' + path('secret', 'env')), prefix('source ' + path('venv', 'goma', 'bin', 'activate')), )
def _createValidationFile(self): vFile = xbmcvfs.File(common.path(common.AddonProfile() + "backup.bvf"), 'w') vFile.write( json.dumps({ "name": "Backup Validation File", "version": xbmc.getInfoLabel('System.BuildVersion') })) vFile.write("") vFile.close() return self.remoteFS.put( common.path(common.AddonProfile() + "backup.bvf"), self.remoteFS.RootPath + "backup.bvf")
def run(self, mode=-1): result = True if not common.any2bool( xbmc.getInfoLabel("Window(%s).Property(%s)" % (10000, "SystemRecovery.Running"))): # set windows setting to true window = xbmcgui.Window(10000) window.setProperty("SystemRecovery.Running", "true") if self.remoteFS.RootPath is not None and self.remoteFS.RootPath != '': common.debug( "Local directory: " + self.localFS.RootPath + ", Remote directory: " + self.remoteFS.RootPath, "SystemRecovery") if mode == self.Backup: if common.setting("compress_backups"): # delete old temp file if self.localFS.exists( common.path('special://temp/backup.zip')): self.localFS.rmfile( common.path('special://temp/backup.zip')) # save the remote file system and use the zip vfs self.savedRemoteFS = self.remoteFS self.remoteFS = ZipFileSystem( common.path("special://temp/backup.zip"), "w") self.remoteFS.setRootPath(self.remoteFS.RootPath + time.strftime("%Y%m%d%H%M") + "/") # run backup process self.backup() result = self.status >= 0 elif mode == self.Restore: if self.restorePoint.split('.')[-1] != 'zip': self.remoteFS.setRootPath(self.remoteFS.RootPath + self.restorePoint + "/") # run restore process self.restore() result = self.status >= 0 else: result = False # cleaning locations self.localFS.cleanup() self.remoteFS.cleanup() else: result = False # reset the window setting window.setProperty("SystemRecovery.Running", "") else: common.warn( 'Script already running, no additional instance is needed') result = False return result
def _checkValidationFile(self, path): # copy the file and open it self.localFS.put(path + "backup.bvf", common.path(common.AddonProfile() + "backup.bvf")) vFile = xbmcvfs.File(common.path(common.AddonProfile() + "backup.bvf"), 'r') jsonString = vFile.read() vFile.close() try: json_dict = json.loads(jsonString) return xbmc.getInfoLabel( 'System.BuildVersion') == json_dict['version'] except ValueError: return False
def configure_modbus_logger(cfg, recycle_logs=True): """ Configure the logger. Args: cfg (Namespace): The PUReST config namespace. """ logger = logging.getLogger("modbus_tk") if isinstance(cfg, dict): cfg = Configuration(**cfg) if cfg.no_modbus_log: logger.setLevel(logging.ERROR) logger.addHandler(logging.NullHandler()) else: logger.setLevel(logging.DEBUG) fmt = "%(asctime)s - %(levelname)s - " "%(module)s::%(funcName)s @ %(lineno)d - %(message)s" fmtr = logging.Formatter(fmt) if not cfg.no_modbus_console_log: sh = logging.StreamHandler() sh.setFormatter(fmtr) sh.setLevel(cfg.modbus_console_log_level.upper()) logger.addHandler(sh) if not cfg.no_modbus_file_log: modbus_log = path(cfg.modbus_log) if recycle_logs: remove_file(modbus_log) make_dir(os.path.dirname(modbus_log)) fh = logging.FileHandler(modbus_log) fh.setFormatter(fmtr) fh.setLevel(cfg.modbus_file_log_level.upper()) logger.addHandler(fh)
def map_states_to_clusters(input_filename): result = {} with open(common.path("mcl_output"), 'r') as mcl_output: for index, line in enumerate(mcl_output.readlines()): fields = line.rstrip('\n').split('\t') cluster_id = "cluster_%i" % (index) for field in fields: result[field] = cluster_id return result
def update(branch=None): # deployed repo is just a symlink to dev so do nothing if env.environment == "development": print 'Skipping repo update because env=development' return deploy_lock = path('home', 'run', 'deploy-lock.txt') if files.exists(deploy_lock): print 'Deploy lock exists. Aborting... If you want to remove this ' + \ 'then ssh onto the server and rm %s' % deploy_lock sys.exit(1) if branch is None: branch = "master" if not files.exists(path('repo')): run('git clone [email protected]:sesameio/goma.git %s' % path('repo')) with cd(path('repo')): run('git reset --hard HEAD') run('git fetch --all') run('git checkout origin/%s' % branch)
def choose(): inventory_option = ui.get_inputs(["Please select option: "], "")[0] if inventory_option == "1": file_name_local = common.path() + "accounting/items.csv" new_table = data_manager.get_table_from_file(file_name_local) show_table(new_table) return False elif inventory_option == "2": add_new_table = add(table) show_table(add_new_table) save(add_new_table) elif inventory_option == "3": remove_table = remove(table, id()) try: show_table(remove_table) save(remove_table) except TypeError: return False return False elif inventory_option == "4": updated_table = update(table, id()) try: show_table(updated_table) save(updated_table) except TypeError: return False return False elif inventory_option == "5": ui.print_result(which_year_max(table), "Most profitable year") return False elif inventory_option == "6": year = ui.get_inputs([x + ": " for x in ["Year"]], "")[0] try: while common.validate_years(year) == False: ui.print_error_message("Please enter a valid year: ") year = ui.get_inputs([x + ": " for x in ["Year"]], "")[0] except ValueError: return False ui.print_result(avg_amount(table, year), "Average (per item) profit in a given year") return False elif inventory_option == "0": global back_to_main_menu back_to_main_menu = False return back_to_main_menu else: raise KeyError("There is no such option.")
def __init__(self): self.status = 0 self.localFS = None self.remoteFS = None self.restoreFile = None self.savedRemoteFS = None self.remoteBasePath = None self.fileManager = None self.restorePoint = None self.localFS = LocalFileSystem(common.path('special://home')) if common.setting('remote_selection') == 1: self.remoteBasePath = common.setting('remote_path_2') self.remoteFS = LocalFileSystem(common.setting('remote_path_2')) common.setAddonSetting("remote_path", "") elif common.setting('remote_selection') == 0: self.remoteBasePath = common.setting('remote_path') self.remoteFS = LocalFileSystem(common.setting("remote_path"))
def clean_pyc(): with cd(path('repo')): run('find -name "*.pyc" | xargs rm -f')
def update(branch=None): repo.update(branch) with context_managers.django(common.path('repo')): run('pip install -r requirements/{}.txt'.format(env.environment))
Data table structure: * id (string): Unique and random generated identifier at least 2 special characters (except: ';'), 2 number, 2 lower and 2 upper case letters) * title (string): Title of the game sold * price (number): The actual sale price in USD * month (number): Month of the sale * day (number): Day of the sale * year (number): Year of the sale """ import ui import data_manager import common list_labels = ["id", "title", "price", "month", "day", "year"] read_file = common.path() + "sales/sales.csv" table = data_manager.get_table_from_file(read_file) year_range_input_options = [ "Month from", "Day from", "Year from", "Month to", "Day to", "Year to" ] back_to_main_menu = True def start_module(): """ Starts this module and displays its menu. * User can access default special features from here. * User can go back to main menu from here. Returns: None
def restore(self): self.status = 0 # catch for if the restore point is actually a zip file if self.restorePoint.split('.')[-1] == 'zip': common.debug("Copying zip file: " + self.restorePoint, "SystemRecovery") # set root to data dir home self.localFS.setRootPath(common.path("special://temp/")) if not self.localFS.exists( common.path("special://temp/" + self.restorePoint)): # copy just this file from the remote vfs zipFile = [] zipFile.append(self.remoteBasePath + self.restorePoint) self.backupFiles(zipFile, self.remoteFS, self.localFS) else: common.debug("Zip file exists already", "SystemRecovery") # extract the zip file zip_vfs = ZipFileSystem( common.path("special://temp/" + self.restorePoint), 'r') zip_vfs.extract(common.path("special://temp/")) zip_vfs.cleanup() # set the new remote vfs and fix xbmc path self.remoteFS = LocalFileSystem( common.path("special://temp/" + self.restorePoint.split(".")[0] + "/")) self.localFS.setRootPath(common.path("special://home/")) # for restores remote path must exist if not os.path.isdir(self.remoteFS.RootPath): common.error("Error: Remote path doesn't exist: %s" % self.remoteFS.RootPath) self.status = -1 return # create a validation file for backup rotation if not self._checkValidationFile(self.remoteFS.RootPath): common.error( "Validation file can not be validated, restore process skipped" ) self.status = -1 return common.debug("Creating files list", "SystemRecovery") allFiles = [] fileManager = FileManager(self.remoteFS) # go through each of the user selected items and write them to the backup store if common.setting("backup_config"): # check for the existance of an advancedsettings file if self.remoteFS.exists(self.remoteFS.RootPath + "userdata/advancedsettings.xml"): fileManager.addFile(self.remoteFS.RootPath + "userdata/advancedsettings.xml") fileManager.addFile('-' + self.remoteFS.RootPath + 'userdata/keymaps') fileManager.walkTree(self.remoteFS.RootPath + "userdata/keymaps") fileManager.addFile('-' + self.remoteFS.RootPath + "userdata/peripheral_data") fileManager.walkTree(self.remoteFS.RootPath + "userdata/peripheral_data") fileManager.addFile('-' + self.remoteFS.RootPath + "userdata/library") fileManager.walkTree(self.remoteFS.RootPath + "userdata/library") # this part is an oddity dirs, configFiles = self.remoteFS.listdir(self.remoteFS.RootPath + "userdata/") for aFile in configFiles: if (aFile.endswith(".xml")): fileManager.addFile(self.remoteFS.RootPath + "userdata/" + aFile) if common.setting('backup_addons'): fileManager.addFile('-' + self.remoteFS.RootPath + "addons") fileManager.walkTree(self.remoteFS.RootPath + "addons") self.localFS.mkdir(common.path('special://home/userdata')) if common.setting('backup_addon_data'): fileManager.addFile('-' + self.remoteFS.RootPath + "userdata/addon_data") fileManager.walkTree(self.remoteFS.RootPath + "userdata/addon_data") if common.setting('backup_database'): fileManager.addFile('-' + self.remoteFS.RootPath + "userdata/Database") fileManager.walkTree(self.remoteFS.RootPath + "userdata/Database") if common.setting("backup_playlists"): fileManager.addFile('-' + self.remoteFS.RootPath + "userdata/playlists") fileManager.walkTree(self.remoteFS.RootPath + "userdata/playlists") if common.setting('backup_profiles'): fileManager.addFile('-' + self.remoteFS.RootPath + "userdata/profiles") fileManager.walkTree(self.remoteFS.RootPath + "userdata/profiles") if common.setting("backup_thumbnails"): fileManager.addFile('-' + self.remoteFS.RootPath + "userdata/Thumbnails") fileManager.walkTree(self.remoteFS.RootPath + "userdata/Thumbnails") # add to array allFiles.append({ "source": self.remoteFS.RootPath, "dest": self.localFS.RootPath, "files": fileManager.getFiles() }) # check if there are custom directories if common.setting('custom_dir_1_enable') and common.setting( 'backup_custom_dir_1' ) is not None and common.setting('backup_custom_dir_1') != '': self.localFS.setRootPath(common.setting('backup_custom_dir_1')) if self.remoteFS.exists(self.remoteFS.RootPath + "custom_" + self._createCRC(self.localFS.RootPath)): # index files to restore fileManager.walkTree(self.remoteFS.RootPath + "custom_" + self._createCRC(self.localFS.RootPath)) allFiles.append({ "source": self.remoteFS.RootPath + "custom_" + self._createCRC(self.localFS.RootPath), "dest": self.localFS.RootPath, "files": fileManager.getFiles() }) else: self.status += 1 common.debug("Error: Remote path doesn't exist: %s" % self.remoteFS.RootPath) if common.setting('custom_dir_2_enable') and common.setting( 'backup_custom_dir_2' ) is not None and common.setting('backup_custom_dir_2') != '': self.localFS.setRootPath(common.setting('backup_custom_dir_2')) if self.remoteFS.exists(self.remoteFS.RootPath + "custom_" + self._createCRC(self.localFS.RootPath)): # index files to restore fileManager.walkTree(self.remoteFS.RootPath + "custom_" + self._createCRC(self.localFS.RootPath)) allFiles.append({ "source": self.remoteFS.RootPath + "custom_" + self._createCRC(self.localFS.RootPath), "dest": self.localFS.RootPath, "files": fileManager.getFiles() }) else: self.status += 1 common.debug("Error: Remote path doesn't exist: %s" % self.remoteFS.RootPath) if common.setting('custom_dir_3_enable') and common.setting( 'backup_custom_dir_3' ) is not None and common.setting('backup_custom_dir_3') != '': self.localFS.setRootPath(common.setting('backup_custom_dir_3')) if self.remoteFS.exists(self.remoteFS.RootPath + "custom_" + self._createCRC(self.localFS.RootPath)): # index files to restore fileManager.walkTree(self.remoteFS.RootPath + "custom_" + self._createCRC(self.localFS.RootPath)) allFiles.append({ "source": self.remoteFS.RootPath + "custom_" + self._createCRC(self.localFS.RootPath), "dest": self.localFS.RootPath, "files": fileManager.getFiles() }) else: self.status += 1 common.debug("Error: Remote path doesn't exist: %s" % self.remoteFS.RootPath) # restore all the files for fileGroup in allFiles: self.remoteFS.setRootPath(fileGroup['source']) self.localFS.setRootPath(fileGroup['dest']) self.backupFiles(fileGroup['files'], self.remoteFS, self.localFS) if self.restorePoint.split('.')[-1] == 'zip': # delete the zip file and the extracted directory self.localFS.rmfile( common.path("special://temp/" + self.restorePoint)) self.localFS.rmdir(self.remoteFS.RootPath) if common.setting("backup_config"): # update the guisettings information (or what we can from it) gui_settings = SettingsManager( 'special://home/userdata/guisettings.xml') gui_settings.run() # call update addons to refresh everything xbmc.executebuiltin('UpdateLocalAddons')
def run(self, index): """ Runs package for content discovery and processing""" # check if forecast workflow is enabled if not common.setting('Enabled'): return # check provider configuration provider = self.getProviderByCode(common.setting('ProviderCode')) common.debug("Found provider to run forecast workflow: %s" % provider) if provider is None: common.NotificationMsg(32202, 15000) return if provider is not None and ( (common.setting('APIKey') == '' or common.setting('APIKey') is None) and common.any2bool(common.setting("ShowAPIKeyOption"))): common.NotificationMsg(32123, 15000) return # validate provider configuration if common.any2bool(common.setting("ShowAPIKeyOption")): try: provider.validate() common.debug( "Content provider is valid, running weather forecast workflow" ) except BaseException as err: common.debug( "Content provider is invalid, reset forecast skin properties: %s" % str(err)) common.NotificationMsg(32203, 20000) provider.clear() return # normalize locations count = 0 found = False for id in range(1, 6): locname = common.setting('Location%iAction' % id) locid = common.setting('Location%i' % id) if not found and (locname != '' and locid != ''): count += 1 elif not found and (locname == '' or locid == ''): found = True if found: common.setSkinProperty(12600, 'Location%i' % id) common.setsetting('Location%iAction' % id) common.setsetting('Location%i' % id) else: common.setSkinProperty(12600, 'Location%i' % id, locname) common.setSkinProperty(12600, 'Locations', str(count)) common.debug("Active locations: %s" % str(count)) # identify the right location if index is None: common.debug( 'Run GeoIP location discovery due to missing configuration') locname, locid = provider.geoip() else: common.debug("Using location index: %s" % str(index)) locname = common.setting('Location%sAction' % str(index)) locid = common.setting('Location%s' % str(index)) if locid == '' and common.any2int(index) > 1: common.debug( 'Trying first location instead, due to invalid index defined in previous configuration' ) locname = common.setting('Location1Action') locid = common.setting('Location1') if locid == '': common.debug( 'Run GeoIP location discovery due to wrong configuration') locname, locid = provider.geoip() # run forecast workflow if locname != '': # reset skin properties when the location is changed if locid != provider.skininfo("Current.Location"): provider.clear() # publish provider details provider.skinproperty('WeatherProvider', provider.name()) if os.path.isfile( common.path('resources', 'media', provider.code() + '.png')): provider.skinproperty( 'WeatherProviderLogo', common.path('resources', 'media', provider.code() + '.png')) else: provider.skinproperty('WeatherProviderLogo', common.path('icon.png')) # call provider forecast common.debug('Call forecast for location %s (%s)' % (locname, locid)) provider.forecast(locname, locid) else: common.warn('No location found or configured') provider.clear()
""" Customer Relationship Management (CRM) module Data table structure: * id (string): Unique and random generated identifier at least 2 special characters (except: ';'), 2 number, 2 lower and 2 upper case letters) * name (string) * email (string) * subscribed (int): Is she/he subscribed to the newsletter? 1/0 = yes/no """ import ui import data_manager import common list_labels = ["id", "name", "email", "subscribed"] read_file = common.path() + "crm/customers.csv" table = data_manager.get_table_from_file(read_file) back_to_main_menu = True def start_module(): """ Starts this module and displays its menu. * User can access default special features from here. * User can go back to main menu from here. Returns: None """ global back_to_main_menu back_to_main_menu = True
Data table structure: * id (string): Unique and random generated identifier at least 2 special characters (except: ';'), 2 number, 2 lower and 2 upper case letters) * month (number): Month of the transaction * day (number): Day of the transaction * year (number): Year of the transaction * type (string): in = income, out = outflow * amount (int): amount of transaction in USD """ import ui import data_manager import common file_name = common.path() + "accounting/items.csv" table = data_manager.get_table_from_file(file_name) title_input = "Please enter the product data" list_labels = ["Id", "Month", "Day", "Year", "Type", "Ammount"] year_months_day = { "01": 31, "02": 29, "03": 31, "04": 30, "05": 31, "06": 30, "07": 31, "08": 31, "09": 30, "10": 31, "11": 30,
def manage(*args): with context_managers.django(common.path('web')): run('python manage.py %s' % ' '.join('"%s"' % arg for arg in args))
def backup(self): self.status = 0 # check if remote path exists if self.remoteFS.exists(self.remoteFS.RootPath): # may be data in here already common.debug("Remote path exists - may have old files in it", "SystemRecovery") else: # make the remote directory self.remoteFS.mkdir(self.remoteFS.RootPath) # create a validation file for backup rotation if not self._createValidationFile(): # we may not be able to write to this destination for some reason common.error( "Validation file can not be created, backup process skipped") self.status = -1 return common.debug("Creating files list", "SystemRecovery") allFiles = [] fileManager = FileManager(self.localFS) # go through each of the user selected items and write them to the backup store if common.setting('backup_addons'): fileManager.addFile("-" + common.path('special://home/addons')) fileManager.walkTree(common.path('special://home/addons')) fileManager.addFile("-" + common.path('special://home/userdata')) if common.setting('backup_addon_data'): fileManager.addFile( "-" + common.path('special://home/userdata/addon_data')) fileManager.walkTree( common.path('special://home/userdata/addon_data')) if common.setting('backup_database'): fileManager.addFile( "-" + common.path('special://home/userdata/Database')) fileManager.walkTree( common.path('special://home/userdata/Database')) if common.setting("backup_playlists"): fileManager.addFile( "-" + common.path('special://home/userdata/playlists')) fileManager.walkTree( common.path('special://home/userdata/playlists')) if common.setting('backup_profiles'): fileManager.addFile( "-" + common.path('special://home/userdata/profiles')) fileManager.walkTree( common.path('special://home/userdata/profiles')) if common.setting("backup_thumbnails"): fileManager.addFile( "-" + common.path('special://home/userdata/Thumbnails')) fileManager.walkTree( common.path('special://home/userdata/Thumbnails')) if common.setting("backup_config"): fileManager.addFile("-" + common.path('special://home/userdata/keymaps')) fileManager.walkTree( common.path('special://home/userdata/keymaps')) fileManager.addFile( "-" + common.path('special://home/userdata/peripheral_data')) fileManager.walkTree( common.path('special://home/userdata/peripheral_data')) fileManager.addFile('-' + common.path('special://home/userdata/library')) fileManager.walkTree( common.path('special://home/userdata/library')) # this part is an oddity dirs, configFiles = self.localFS.listdir( common.path('special://home/userdata/')) for aFile in configFiles: if aFile.endswith(".xml"): fileManager.addFile( common.path('special://home/userdata/') + aFile) # add to array allFiles.append({ "source": self.localFS.RootPath, "dest": self.remoteFS.RootPath, "files": fileManager.getFiles() }) orig_base_path = self.remoteFS.RootPath # check if there are custom directories if common.setting('custom_dir_1_enable') and common.setting( 'backup_custom_dir_1' ) is not None and common.setting('backup_custom_dir_1') != '': # create a special remote path with hash self.localFS.setRootPath(common.setting('backup_custom_dir_1')) fileManager.addFile("-custom_" + self._createCRC(self.localFS.RootPath)) # walk the directory fileManager.walkTree(self.localFS.RootPath) allFiles.append({ "source": self.localFS.RootPath, "dest": self.remoteFS.RootPath + "custom_" + self._createCRC(self.localFS.RootPath), "files": fileManager.getFiles() }) if common.setting('custom_dir_2_enable') and common.setting( 'backup_custom_dir_2' ) is not None and common.setting('backup_custom_dir_2') != '': # create a special remote path with hash self.localFS.setRootPath(common.setting('backup_custom_dir_2')) fileManager.addFile("-custom_" + self._createCRC(self.localFS.RootPath)) # walk the directory fileManager.walkTree(self.localFS.RootPath) allFiles.append({ "source": self.localFS.RootPath, "dest": self.remoteFS.RootPath + "custom_" + self._createCRC(self.localFS.RootPath), "files": fileManager.getFiles() }) if common.setting('custom_dir_3_enable') and common.setting( 'backup_custom_dir_3' ) is not None and common.setting('backup_custom_dir_3') != '': # create a special remote path with hash self.localFS.setRootPath(common.setting('backup_custom_dir_3')) fileManager.addFile("-custom_" + self._createCRC(self.localFS.RootPath)) # walk the directory fileManager.walkTree(self.localFS.RootPath) allFiles.append({ "source": self.localFS.RootPath, "dest": self.remoteFS.RootPath + "custom_" + self._createCRC(self.localFS.RootPath), "files": fileManager.getFiles() }) # backup all the files for fileGroup in allFiles: self.localFS.setRootPath(fileGroup['source']) self.remoteFS.setRootPath(fileGroup['dest']) filesCopied = self.backupFiles(fileGroup['files'], self.localFS, self.remoteFS) if not filesCopied: common.warn( "Not all files were copied: %s" % self.localFS.RootPath, "SystemRecovery") self.status += 1 # reset remote and xbmc vfs self.localFS.setRootPath("special://home/") self.remoteFS.setRootPath(orig_base_path) # send the zip file to the real remote vfs if common.setting("compress_backups"): zip_name = self.remoteFS.RootPath[:-1] + ".zip" self.remoteFS.cleanup() self.localFS.rename(common.path("special://temp/backup.zip"), common.path("special://temp/" + zip_name)) fileManager.addFile(common.path("special://temp/" + zip_name)) # set root to data dir home self.localFS.setRootPath(common.path("special://temp/")) self.remoteFS = self.savedRemoteFS fileCopied = self.backupFiles(fileManager.getFiles(), self.localFS, self.remoteFS) if not fileCopied: # zip archive copy filed, inform the user common.warn("The destination may not be writeable: %s" % self.remoteFS.RootPath) self.ststus = -1 return # delete the temp zip file self.localFS.rmfile(common.path("special://temp/" + zip_name)) # remove old backups self._rotateBackups()
from os.path import join from collections import OrderedDict sys.path.append(join(os.path.dirname(__file__), "pylib")) import common import rustout import unicode_utils from rustout import char_escape from common import path, memoize from unicode_utils import is_surrogate, cp_to_char OUTPUT_DIRS = { 'IDNA_MAPPING': path("components/idna/mapping/src/tables"), } def data_path(name): return join(common.IDNA_DATA_DIR, name) def test_data_path(name): return join(common.IDNA_TEST_DATA_DIR, name) # == Version == @memoize def get_unicode_version():
def __init__(self, settingsFile): self._readFile(common.path(settingsFile))
""" Store module Data table structure: * id (string): Unique and random generated identifier at least 2 special characters (except: ';'), 2 number, 2 lower and 2 upper case letters) * title (string): Title of the game * manufacturer (string) * price (number): Price in dollars * in_stock (number) """ import ui import data_manager import common list_labels = ["id", "title", "manufacturer", "price", "in_stock"] read_file = common.path() + "store/games.csv" table = data_manager.get_table_from_file(read_file) back_to_main_menu = True def start_module(): """ Starts this module and displays its menu. * User can access default special features from here. * User can go back to main menu from here. Returns: None """ global back_to_main_menu back_to_main_menu = True
""" Inventory module Data table structure: * id (string): Unique and random generated identifier at least 2 special characters (except: ';'), 2 number, 2 lower and 2 upper case letters) * name (string): Name of item * manufacturer (string) * purchase_year (number): Year of purchase * durability (number): Years it can be used """ import ui import data_manager import common list_labels = ["id", "name", "manufacturer", "purchase_year", "durability"] read_file = common.path() + "inventory/inventory.csv" table = data_manager.get_table_from_file(read_file) back_to_main_menu = True def start_module(): """ Starts this module and displays its menu. * User can access default special features from here. * User can go back to main menu from here. Returns: None """ global back_to_main_menu back_to_main_menu = True
import os import sys from os.path import join sys.path.append(join(os.path.dirname(__file__), "pylib")) import common import rustout import unicode_utils from common import path, memoize from unicode_utils import is_surrogate OUTPUT_DIRS = { 'UCD_CORE': path("components/ucd/core/src/tables"), 'UCD_AGE': path("components/ucd/age/src/tables"), 'UCD_BIDI': path("components/ucd/bidi/src/tables"), 'UCD_NORMAL': path("components/ucd/normal/src/tables"), 'NORMAL_TESTS': path("components/normal/tests/tables"), } def data_path(name): return join(common.UCD_DATA_DIR, name) def test_data_path(name): return join(common.UCD_TEST_DATA_DIR, name) # == Version ==
def get_clusters(model): write_model_to_mcl_input(model, common.path("mcl_input")) run_mcl(common.path("mcl_input"), common.path("mcl_output")) return map_states_to_clusters(common.path("mcl_output"))
""" Inventory module Data table structure: * id (string): Unique and random generated identifier at least 2 special characters (except: ';'), 2 number, 2 lower and 2 upper case letters) * name (string): Name of item * manufacturer (string) * purchase_year (number): Year of purchase * durability (number): Years it can be used """ import ui import data_manager import common list_labels = ["id", "name", "year"] read_file = common.path() + "hr/persons.csv" table = data_manager.get_table_from_file(read_file) back_to_main_menu = True def start_module(): """ Starts this module and displays its menu. * User can access default special features from here. * User can go back to main menu from here. Returns: None """ global back_to_main_menu back_to_main_menu = True