Exemplo n.º 1
0
def getCounter(S, typeFactuur):
    counters = utils.readJson('Resources/counters.json')
    c = counters.setdefault(S, 100) + 1
    if typeFactuur != utils.TypeFactuur.Afdrukvoorbeeld:
        counters[S] = c
        utils.writeJson('Resources/counters.json', counters)
    return c
Exemplo n.º 2
0
    def writeConfigurations(self, cfgStr, result, pathToConfigurationsFile):
        configurations = {}
        if (os.path.exists(pathToConfigurationsFile)):
            configurations = utils.readJson(pathToConfigurationsFile)
        configurations[cfgStr] = result
        utils.writeJson(pathToConfigurationsFile, configurations)

        return
Exemplo n.º 3
0
def loadWebshopArtikels(silent=True):
    webshopLijst = []
    webshopProducts = utils.readJson('Resources/Artikelen.json')
    if webshopProducts == {}:
        webshopProducts = api.getArtikels(silent=silent)
        utils.writeJson('Resources/Artikelen.json', webshopProducts)
    for d in webshopProducts:
        item = d
        if item is not None:
            webshopLijst.append(item)
    return webshopLijst
Exemplo n.º 4
0
    def __updateMeta(self, filename):
        print(filename)
        try:
            obj = utils.readJson(filename)
            obj['iterations'] += self.__save_round
        except:
            obj = {}
            obj['name'] = filename
            obj['iterations'] = self.__save_round
            obj['active_func'] = self.__prop.queryAttr('active_func')
            obj['weights_shape'] = self.__prop.queryAttr('weights_shape')

        utils.writeJson(obj, filename)
Exemplo n.º 5
0
	def loadArtikels(silent=True):
		webshopProducts = utils.readJson('Resources/Artikelen.json')
		customProducts = utils.readJson('Resources/Custom/custom.json')
		if webshopProducts == {}:
			webshopProducts = api.getArtikels(silent=silent)
			utils.writeJson('Resources/Artikelen.json',webshopProducts)
		for d in webshopProducts:
			item = utils.makeWebshopItem(1,d)
			if item is not None:
				webshopLijst.append(item)
		for d in customProducts:
			item = utils.makePreCustomItem(1,d)
			if item is not None:
				customLijst.append(item)
 def process(self, url, params):
     if url == '/ANIMATOR/':
         return ujson.dumps(self.config)
     elif url == '/ANIMATOR/SET/' and "KEY" in params and "VALUE" in params:
         keys = params['KEY'].split(',')
         values = params['VALUE'].split(',')
         for i in range(len(keys)):
             self.setValue(keys[i], values[i])
         utils.writeJson(_CONFIG_FILE, self.config)
         return ujson.dumps(self.config)
     elif url == '/ANIMATOR/RESET/':
         self.resetConfig()
         utils.writeJson(_CONFIG_FILE, self.config)
         return ujson.dumps(self.config)
     return None
Exemplo n.º 7
0
def install():
    #install tex packages & python-qt4
    #dialog voor password
    while True:
        dialogData = raw_input("Wachtwoord:")
        if encrypt.checkPassword(dialogData):
            data = {}
            data['password'] = dialogData
            utils.writeJson('../password.json', data)
            break
        print("Wachtwoord Incorrect")
    if not os.path.exists('Facturen/'):
        os.makedirs('Facturen/')
    if not os.path.exists('Resources/Klanten/'):
        os.makedirs('Resources/Klanten/')
    if not os.path.exists('Resources/Autos/'):
        os.makedirs('Resources/Autos/')
    if not os.path.exists('Resources/Custom/'):
        os.makedirs('Resources/Custom/')
    makeJsonFiles()
    main()
Exemplo n.º 8
0
    def myCompile(self, cfg, executionTime):

        # Fetch the configuration
        indexes = utils.getIndexesOfLength(cfg, len(self.designSpace) - 1)

        # Erase parameters that do not make sense
        self.eraseUselessParameters(indexes)

        # Write the configuration to the INDEX_FILE file
        inputName = os.environ['INPUT_NAME']
        outputFile = os.environ['INDEX_FILE']
        utils.writeFile(outputFile, indexes)

        repoPath = os.environ['REPO_PATH']
        if (self.finalConfFlag):
            args = self.args

            hostname = socket.gethostname()
            benchmarkName = args['benchmark']

            configJson = args['configBenchmarkJson']
            numOfCores = configJson['numOfCores']
            htFlag = configJson['HT']
            pwFlag = configJson['PW']

            modeStr = 'REG'
            if (htFlag):
                modeStr = 'HT'
            if (pwFlag):
                modeStr += '/PW'

            bestConfFile = repoPath + '/data/' + benchmarkName + '/' + hostname + '/' + modeStr + '/' + str(
                numOfCores) + '/' + inputName + '/bestConfiguration.json'
            bestConf = {'conf': indexes, 'time': executionTime}
            utils.writeJson(bestConfFile, bestConf)

        return os.system(
            repoPath + '/src/scripts/backEnd'
        )  # generate the binary of the best configuration found
 def process(self, url, params):
     if url == '/THERMOSTAT/':
         return self._get_state()
     elif url == '/THERMOSTAT/SET/':
         try:
             if 'IS_HEATER' in params:
                 self._config['is_heater'] = utils.str2bool(
                     params['IS_HEATER'])
             if 'DESIRED_TEMPERATURE' in params:
                 desired_temperature = utils.str2float(
                     params['DESIRED_TEMPERATURE'])
                 if 0.0 <= desired_temperature and desired_temperature <= 100.0:
                     self._config[
                         'desired_temperature'] = desired_temperature
             if 'HYSTERESIS' in params:
                 hysteresis = utils.str2float(params['HYSTERESIS'])
                 if 0.1 <= hysteresis and hysteresis <= 5.0:
                     self._config['hysteresis'] = hysteresis
         except Exception as e:
             utils.printWarn('THERMOSTAT', 'exception during process')
             utils.printWarn('THERMOSTAT', e)
         utils.writeJson(_CONFIG_FILE, self._config)
         return self._get_state()
     return None
Exemplo n.º 10
0
def main():
    data = api.getArtikels()
    utils.writeJson('Resources/Artikelen.json', data)
    for item in data:
        downloadImage(item)
Exemplo n.º 11
0
def startFactuur(data, typeFactuur):
    if typeFactuur != utils.TypeFactuur.Afdrukvoorbeeld:
        utils.writeJson('Resources/Klanten/' + data['Klant']['Naam'] + '.json',
                        data['Klant'])
    makeFactuur(data, typeFactuur)
Exemplo n.º 12
0
def standardBedrijfInfo():
    company = utils.readJson('Resources/company.json')
    if company != {}:
        return company
    return utils.writeJson('Resources/company.json', utils.makeCompany())