def update(self):
        self.__update__()
        w = HeaderCustomize(self.titulo)
        w.slider = self.slider
        w._atras = self._atras
        w._screen = self._screen
        self.add(w)
        w = MediaManager("Logo")
        w.btn2 = "Elegir logo"
        w.btn1 = "Eliminar logo"
        w.Media = self.Media
        w.placeholder = "No se a elegido un logo"
        self.add(w)

        w = Input("Titulo del sitio")
        self.add(w)
        w = Input("Descripción corta")
        self.add(w)
        w = CheckBox("Muestra el título y descripción del sitio")
        self.add(w)

        w = MediaManager("Icono del sitio")
        w.descripcion = """
		El icono del sitio lo usa el navegador 
		como icono de la aplicación para tu sitio. 
		Los iconos deben ser cuadrados y al menos de 512 píxeles de ancho y alto.
		"""
        w.placeholder = "No se a elegido un logo"
        w.Media = self.Media
        self.add(w)
        self.css({
            "padding-left": "20px",
            "padding-right": "20px"
        }, None, ">div:nth-child(n+2)")
示例#2
0
def tempGener(reactants,products,globalDict):
    global inCounter,gener
    DIST=0.001
    print '\n\n\nThis part is about generating the DeltaE to take temp=(-deltaE/ln(1-[acceptance fraction]))\n\n'
    #dictionaries=[]
    newDict=globalDict
    DIST=0.001 #Long step for arbitrary search for the mean.    
    for idxx in range(FILENOTEMP):
        reacFiles,prodFiles=[],[]
        for attr in reactants: # This part will generate input files for reactants and products
            filename=attr[0]
            template=attr[2]
            basename=attr[1]
            inp = Input(filename, basename, inCounter, template, newDict)
            
            # =(self.filename, self.basename, inCounter, self.template, newDict)
            
            ## newDict is the dictionary we want to implement.
            ## self.template is a string of the lines of the user input
            ##untill the first **** line.
            
            rvalues = inp.modify()
            """ This meathod creates a new input file and return a list of 3 or 2 organs:
                1) The dictionary that pulled to the new file.
                2) The name of the new file.
                3) String of the lines of the user input file untill the first **** line.
                * If it is not the first run, organ 3 dissmissed.
            """
            reacFiles.append(rvalues[1])

        for attr in products: # This part will generate input files for reactants and products
            filename=attr[0]
            template=attr[2]
            basename=attr[1]
            inp = Input(filename, basename, inCounter, template, newDict)
            
            # =(self.filename, self.basename, inCounter, self.template, newDict)
            
            ## newDict is the dictionary we want to implement.
            ## self.template is a string of the lines of the user input
            ##untill the first **** line.
            
            rvalues = inp.modify()
            """ This meathod creates a new input file and return a list of 3 or 2 organs:
                1) The dictionary that pulled to the new file.
                2) The name of the new file.
                3) String of the lines of the user input file untill the first **** line.
                * If it is not the first run, organ 3 dissmissed.
            """
            prodFiles.append(rvalues[1])
            
        gener=generatorReac(reacFiles,prodFiles,DIST,newDict)
        print '\n\n'+str(inCounter)+'  '+str(gener.gradeTemp)+'\n\n'
        newDict=gener.generateTemp()

#        gener.getBestDict() # Printing the debugging row.
        inCounter +=1    
        del inp # Deletion our object in order to not take memory space while running Gaussian.
    '''
示例#3
0
 def benchmark(self, path, content, benchmarks, sample, maxTokens, filters):
     self._resetFile(path)
     logFile = Logger.logFile('log')
     wordList = self._parse(path, content, False)
     lines = self._getLines(content)
     lineIndex = 0
     tokensTested = 0
     for index, (word, loc, node) in enumerate(wordList):
         # Go backwards so we can use last prediction and input in subsequent
         # logging code
         if tokensTested >= maxTokens:
             return tokensTested
         while (loc > lines[lineIndex][1] + len(lines[lineIndex][0])):
             lineIndex += 1
         lineStart = lines[lineIndex][1]
         linePrefix = content[lineStart:loc]
         if self.benchmarkCounter % sample == 0 and \
            (not filters.onlySeen or word in self.words) and \
            len(word) >= filters.minWordLength and \
            not ('#' in linePrefix or '//' in linePrefix) and \
            (not filters.onlyIdentifiers or tokenizer.isIdentifier(word)):
             prediction = []
             for prefixSize in range(PREFIX_SIZE, -1, -1):
                 input = AnnotatedInput(
                     Input(path, content, loc, word[:prefixSize], -1),
                     wordList, index, lines, lineIndex)
                 prediction = self._predictAnnotated(input)
                 for benchmark in benchmarks:
                     benchmark.update(prediction, word, prefixSize)
             doLogging = True
             if filters.inFirst != -1:
                 predictedWords = [
                     w for (w, p) in prediction[:filters.inFirst]
                 ]
                 if word not in predictedWords:
                     doLogging = False
             if filters.notInFirst != -1:
                 predictedWords = [
                     w for (w, p) in prediction[:filters.notInFirst]
                 ]
                 if word in predictedWords:
                     doLogging = False
             if doLogging:
                 self._logPrediction(input, prediction, word)
                 tokensTested += 1
         else:
             input = AnnotatedInput(Input(path, content, loc, '', -1),
                                    wordList, index, lines, lineIndex)
         self.words.add(word)
         self._trainOneWord(input, word, False, True)
         self.tokensTrained += 1
         self.benchmarkCounter += 1
     return tokensTested
示例#4
0
def main():
  if len(sys.argv) == 1:
    # read from stdin
    processor = Input(sys.stdin)
    processor.summary()

    pass
  if len(sys.argv) == 2:
    filename = sys.argv[1]
    # Read from file
    file1 = open(filename,"r+")
    text = file1.readlines()
    processor = Input(text)
    processor.summary()
示例#5
0
    def __init__(self, mode):
        if mode == 'local' or mode == 'Local' or mode =='LOCAL':
            print("Running in a local video...")
            self.input = Input()
            self.mode = 1

        elif mode == 'reatime' or mode == 'RealTime' or mode =='realTime' or mode =='Realtime' or mode =='REALTIME':
            self.input = Input()
            pygame.init()
            pygame.display.set_mode((Constants.SCREEN_WIDTH, Constants.SCREEN_HEIGHT))
            pygame.display.set_caption("PoseTracking!")
            screen = pygame.display.get_surface()
            self.scene = Scene(screen, self.input)
            self.mode = 0
示例#6
0
 def test_decline_card(self):
     self.decliner = Input([
         'Add Tom 4111111111111111 $1000', 'Charge Tom $650',
         'Charge Tom $800'
     ])
     val = self.decliner.card_book['Tom'].get_balance()
     self.assertEqual(val, 650)
示例#7
0
    def load_input(self, assignment, input_conf):
        if self._03_prob_type == AgGlobals.PROBLEM_TYPE_PROG and AgGlobals.is_flags_set(
                self._99_state, AgGlobals.PROBLEM_STATE_LOADED):
            # Check whether the input configuration file exists.
            self._99_state = AgGlobals.clear_flags(
                self._99_state, AgGlobals.PROBLEM_STATE_INPUTS_LOADED)
            if not os.path.exists(input_conf):
                print '\Input configuration file {} does not exist, exit...'.format(
                    input_conf)
                sys.exit()

            self._99_inputs = {}

            for io in sorted(self._07_inp_outps):
                self._99_inputs[io] = Input(self._07_inp_outps[io][0],
                                            self._07_inp_outps[io][1])

                section = AgGlobals.get_input_section(assignment,
                                                      self._01_prob_no, io)
                self._99_inputs[io].load_input(input_conf, section)

            self._99_state = AgGlobals.set_flags(
                self._99_state, AgGlobals.PROBLEM_STATE_INPUTS_LOADED)

            return True

        return False
示例#8
0
 def test_same_input(self):
     input_line = [
         'Add Kshitij 79927398713 $6000', 'Add Kshitij 79927398713 $6000'
     ]
     processor = Input(input_line)
     output = processor.card_book
     self.assertEqual(len(processor.card_book), 1)
示例#9
0
 def test_multiple_input(self):
     input_line = [
         'Add Lisa 5454545454545454 $3000', 'Add Kshitij 79927398713 $6000'
     ]
     processor = Input(input_line)
     output = processor.card_book
     self.assertEqual(len(processor.card_book), 2)
示例#10
0
 def text(self, required=False, **kwds):
     from Input import Input
     control = Input(**kwds)
     from FormField import FormField
     field = FormField(control, required)
     self.contents.append(field)
     return control
示例#11
0
文件: OCR.py 项目: heinemann44/TCC
def ocr(caminho_imagem=config.caminho_imagem_entrada):
    seg = Segmentar()
    array_texto = seg.segmentar_imagem(caminho_imagem=caminho_imagem,
                                       inverter_imagem=config.letra_cor_preta)
    texto = ''

    inp = Input()
    iterator = inp.pegar_batch(pasta_dados='./Data/Letra/')
    imagens = iterator.get_next()

    cnn = RedeNeural()
    logits = cnn.construir_arquitetura(imagens)
    id_letra = _decode_one_hot(logits)

    with tf.Session() as sess:
        sess.run(tf.global_variables_initializer())
        sess.run(iterator.initializer)
        saver = tf.train.Saver()
        saver.restore(sess, './Output/model.ckpt')
        for linha in array_texto:
            for palavra in linha:
                for _ in palavra:
                    saida = sess.run(id_letra)
                    letra_predicao = retornar_letra(saida[0])
                    texto += letra_predicao
                texto += ' '
            texto += '\n'

    _criar_arquivo_text(texto)
示例#12
0
文件: Testar.py 项目: heinemann44/TCC
def avaliar():
    inp = Input()
    iterator = inp.pegar_batch(tamanho_batch=config.batch_size,
                               pasta_dados="./Data/Testar")
    imagens, labels = iterator.get_next()

    print("shape img: {}".format(imagens.get_shape().as_list()))

    cnn = RedeNeural()

    logits = cnn.construir_arquitetura(imagens)

    accuracy = cnn.accuracy(logits, labels)

    with tf.Session() as sess:
        sess.run(tf.global_variables_initializer())
        sess.run(iterator.initializer)
        total_batch = 128 // config.batch_size
        avg_acc = 0.
        saver = tf.train.Saver()
        sess.run(tf.global_variables_initializer())
        coord = tf.train.Coordinator()
        threads = tf.train.start_queue_runners(coord=coord)
        saver.restore(
            sess,
            './Output/model.ckpt')  # /home/samuelehp04/TCC/Output/model.ckpt
        for batch in range(total_batch):
            acc = sess.run(accuracy)
            avg_acc += acc / total_batch
        print("Precisao: {:.5f}".format(avg_acc))
        coord.request_stop()
        coord.join(threads)
示例#13
0
    def get_points(self):
        final_score = 0
        try:
            print("Raw input: " + str(self.raw_input))
            print("Raw output: " + str(self.raw_output))
            self.obj_in = Input(self.raw_input)
            self.obj_out = Output(self.raw_output)
            #self.obj_in.print()
            #self.obj_out.print()
            print("==================================================")
            for vehicle in self.obj_out.vehicles:
                print("----------------------------------------------")
                print("Calculating score for vehicle: {0}".format(vehicle.index))

                for ride_index in vehicle.rides_indexes:
                    ride = self.obj_in.rides[int(ride_index)]
                    print("Taking ride {0}".format(ride_index))
                    ride_score = self.calculate_points(vehicle, ride, int(self.obj_in.bonus))
                    print("Adding {0} to the total score of {1}".format(ride_score, final_score))
                    final_score += ride_score

                    print("Current step time {0}".format(vehicle.step_time))
                    print("------")

        except Exception as e:
            print("Something crashed: " + str(e))
            #raise e
            return 0

        return final_score
示例#14
0
 def __init__(self, toSort = None):
     input = Input(toSort)
     self.toSort = list(input.getArray())
     self.sorted = list(input.getArray())
     self.newPositions = []
     for i in range(len(self.toSort)):
         self.newPositions.append(i)
示例#15
0
    def train(self,
              path,
              content,
              maxTokens=sys.maxint,
              weightTraining=False,
              sample=1):
        # FixMe: [usability] Add file name as suggestion
        wordList = self._parse(path, content, not weightTraining)
        lines = self._getLines(content)
        self.tokensTrained += min(len(wordList), maxTokens)

        self._resetFile(path)
        lineIndex = 0
        tokensTrained = 0
        for index, (word, loc, node) in enumerate(wordList):
            if tokensTrained >= maxTokens:
                return tokensTrained
            while (loc > lines[lineIndex][1] + len(lines[lineIndex][0])):
                lineIndex += 1
            input = AnnotatedInput(Input(path, content, loc, "", -1), wordList,
                                   index, lines, lineIndex)
            weightTrain = False
            if self.trainingCounter % sample == 0:
                tokensTrained += 1
                weightTrain = weightTraining
            self._trainOneWord(input, word, weightTrain, False)
            self.trainingCounter += 1
        return tokensTrained
示例#16
0
 def test_charge_credit_account(self):
     self.inputter = Input([
         'Add Lisa 5454545454545454 $3000', 'Charge Lisa $8',
         'Credit Lisa $100'
     ], )
     value = self.inputter.card_book['Lisa'].get_balance()
     self.assertEqual(value, -92)
示例#17
0
    def generate_input_config(self, assignment, in_out_dir, cfg):
        if self._03_prob_type == AgGlobals.PROBLEM_TYPE_PROG and AgGlobals.is_flags_set(
                self._99_state, AgGlobals.PROBLEM_STATE_LOADED):
            for io in sorted(self._07_inp_outps):
                # print io, self._07_inp_outps[io]
                section = AgGlobals.get_input_section(assignment,
                                                      self._01_prob_no, io)

                # if "['{}']".format( section ) in cfg.sections():
                #    print 'Error: Input configuration section: {} already exists. Did not overwrite'.format( section )
                #    return
                cfg.add_section(section)

                temp_in = Input(self._07_inp_outps[io][0],
                                self._07_inp_outps[io][1])
                for key in sorted(temp_in.__dict__.keys()):
                    # Filter only the instances variables that are necessary for the configuration file
                    if key[0:4] != '_99_':
                        cfg.set(section, key[3:],
                                ' {}'.format(temp_in.__dict__[key]))

                if self._07_inp_outps[io][0] == AgGlobals.INPUT_NATURE_LONG:
                    input_file_path = os.path.join(
                        in_out_dir,
                        AgGlobals.get_input_file_name(assignment,
                                                      self._01_prob_no, io))
                    cfg.set(section, 'input_file', input_file_path)
                    fo = open(input_file_path, 'a')
                    fo.close()
示例#18
0
	def done(self):

		self.BasicTabs.width="100%"
		self.BasicTabs.tabWidth="100%"
		self.BasicTabs.update()
		i=Input("Titulo:")
		t=TinyMCE("Contenido:")
		t.data=self.dataChildren[1]


		if "value" in self.dataChildren[1]:
			t.value=self.dataChildren[1]["value"]

		



		s.when(self.target3.html(self.BasicTabs.target)).then(self.BasicTabs.done)
		self.BasicTabs.appendToTab(0,i)
		self.BasicTabs.appendToTab(0,t)
		

		
		
		
		self.target.find(">button").on("click",self.insertar)
		self.target2.find(">button").find(">.titulo").text("prueba")
		self.target2.find(">button").on("click",self.open)
		
		
		self.__titulo=self.target.find(">button").find(">.titulo")
		self.titulo(self._titulo)

		t.reconectar()
示例#19
0
def inputProcessor(listOfTraitsForEachFile, listOfFiles, firstRunFlag,
                   dictToImplement):
    for attr in listOfTraitsForEachFile:  # This part will generate input files for reactants and products
        filename = attr[0]
        template = attr[2]
        basename = attr[1]

        # =(self.filename, self.basename, inCounter, self.template, newDict)

        ## newDict is the dictionary we want to implement.
        ## self.template is a string of the lines of the user input file untill the first **** line.
        if firstRunFlag:
            listOfFiles.append(filename)
        else:
            inp = Input(filename, basename, inCounter, template,
                        dictToImplement)
            rvalues = inp.modify()
            """ This meathod creates a new input file and return a list of 3 or 2 organs:
                1) The dictionary that pulled to the new file.
                2) The name of the new file.
                3) String of the lines of the user input file untill the first **** line.
                * If it is not the first run, organ 3 dissmissed.
            """
            listOfFiles.append(rvalues[1])
            return (inp)
示例#20
0
def transactionFromByteArray(trans_data):
    offset = 0
    in_arr = []
    out_arr = []
    no_of_input = int.from_bytes(trans_data[:4], 'big')
    offset += 4
    for i in range(no_of_input):
        trans_ID = trans_data[offset:offset + 32].hex()
        offset += 32
        index = int.from_bytes(trans_data[offset:offset + 4], 'big')
        offset += 4
        sign_len = int.from_bytes(trans_data[offset:offset + 4], 'big')
        offset += 4
        sign = trans_data[offset:offset + sign_len].hex()
        offset += sign_len
        inp_obj = Input(trans_ID, index, sign)
        in_arr.append(inp_obj)

    no_of_output = int.from_bytes(trans_data[offset:offset + 4], 'big')
    offset += 4
    for i in range(no_of_output):
        coins = int.from_bytes(trans_data[offset:offset + 8], 'big')
        offset += 8
        key_len = int.from_bytes(trans_data[offset:offset + 4], 'big')
        offset += 4
        key = trans_data[offset:offset + key_len].decode()
        offset += key_len
        out_obj = Output(coins, key)
        out_arr.append(out_obj)
    return [in_arr, out_arr]
示例#21
0
 def radio(self, **kwds):
     from Input import Input
     control = Input(type="radio", **kwds)
     from FormField import FormField
     field = FormField(control)
     self.contents.append(field)
     return control
示例#22
0
 def __init__(self):
     """
     creates a new program
     """
     self.input = Input()
     self.output = Output()
     self.inventory = Inventory()
     self.choice = None
示例#23
0
 def add_view(self):
     Input(
         self, 'group', None, {
             'add_delete': True,
             'o': self.views_o,
             'general_name': 'view',
             'group_type': 'view_definer'
         })
示例#24
0
 def from_json(self, data):
     data_inp = data['input']
     data_out = data['output']
     for i in data_inp:
         self.inp_arr.append(
             Input(i['transactionID'], i['index'], i['signature']))
     for i in data_out:
         self.out_arr.append(Output(i['amount'], i['recepient']))
示例#25
0
def handleFile0(filename):
    print filename,'\n'
    basename = ".".join(filename.split('/')[-1].split('.')[:-1])
    inp = Input(filename, basename, inCounter) # Initializing an object of Input module
    rvalues = inp.modify();del inp

    #return structure:  ([name of new file(filename),basename,template of file, dictionary of this file])
    return ([rvalues[1],basename,rvalues[2],rvalues[0]])
 def __init__(self):
     self._window = None
     self._graphics = None
     self._sprite = None 
     self._running = True
     self._renderer = SDL_Renderer()
     self._player = None
     self._input = Input() 
示例#27
0
 def __init__(self):
     random.seed()
     self.input = Input()
     self.notemanager = NoteManager()
     self.zither = Zither()
     self.timer = 0
     self.font = pygame.font.Font(None, 64)
     self.score = 0
示例#28
0
 def __init__(self):
     self.input = Input()
     pygame.init()
     pygame.display.set_mode(
         (Constants.SCREEN_WIDTH, Constants.SCREEN_HEIGHT))
     pygame.display.set_caption("color-based-multi-person-id-tracker")
     screen = pygame.display.get_surface()
     self.output = Output(screen, self.input)
示例#29
0
 def __init__(self):
     self.input = Input()
     pygame.init()
     pygame.display.set_mode(
         (Constants.SCREEN_WIDTH, Constants.SCREEN_HEIGHT))
     pygame.display.set_caption("Twister!")
     screen = pygame.display.get_surface()
     self.scene = Scene(screen, self.input)
示例#30
0
 def __init__(self):
     pygame.init()
     pygame.display.set_icon(
         pygame.transform.scale(functions.load_image(GAME_ICON), (32, 32)))
     pygame.display.set_caption('Python-Game')
     self.playerObj = Player.Player()
     self.audioObj = Audio.GameAudio()
     self.inputObj = Input()
     self._log = logging.getLogger(__name__)
     self._log.debug('Initialized Game')