def __call__(self, input, avoid, pcreg=None): icache_flush = 1 # If randomization is disabled, ensure that the seed # is always the same for the builder. state = random.getstate() if not context.randomize: random.seed(1) try: b = builder.builder() enc_data = b.enc_data_builder(input) dec_loop = b.DecoderLoopBuilder(icache_flush) enc_dec_loop = b.encDecoderLoopBuilder(dec_loop) dec = b.DecoderBuilder(dec_loop, icache_flush) output,dec = b.buildInit(dec); output += dec output += enc_dec_loop output += enc_data finally: random.setstate(state) return output
def __call__(self, input, avoid, pcreg=None): icache_flush = 1 # If randomization is disabled, ensure that the seed # is always the same for the builder. state = random.getstate() if not context.randomize: random.seed(1) try: b = builder.builder() enc_data = b.enc_data_builder(input) dec_loop = b.DecoderLoopBuilder(icache_flush) enc_dec_loop = b.encDecoderLoopBuilder(dec_loop) dec = b.DecoderBuilder(dec_loop, icache_flush) output, dec = b.buildInit(dec) output += dec output += enc_dec_loop output += enc_data finally: random.setstate(state) return output
def __init__(self): self.MainWindow = builder("SambaConfigWindow.glade", "samba_config_window") self.ui = self.MainWindow.get_ui(self) PASSWORD = "******" WinFunc.Initialize(self, PASSWORD)
def main(): parser = argparse.ArgumentParser() parser.add_argument("filename", help="File to compile") parser.add_argument("-O", "--optimize", help="Run optimization on program", action="store_true") parser.add_argument("-o", "--output", help="Name for output file", type=str, default=None) parser.add_argument("--x86", help="Compile to X86 architecture, 4Byte pointer size", action="store_true") args = parser.parse_args() file_in = args.filename if args.output is None: file_out = file_in.split(".")[0] + ".ll" else: file_out = args.output b = builder() with open(file_in, "r") as f: program = f.read() compiled = b.traslate(program, optimize=args.optimize, mode32=args.x86) with open(file_out, "w") as f: f.write(compiled)
def __init__(self, entity_num, entity_embedding_dim, rnn_hidden_size, vocab_size, max_sent_num=1, max_token_len=50, embedding_matrix=None, *args, **kwargs): super().__init__(*args, **kwargs) self.batcher = Batcher(HP.vocab_file, max_token_len) self.bilm_model, self.elmo = builder(options_file=HP.option_file, weight_file=HP.weight_file, session=tf.Session()) """ self.encoder = Model.BasicRecurrentEntityEncoder(embedding_matrix=embedding_matrix, max_entity_num=entity_num, entity_embedding_dim=entity_embedding_dim) self.decoder = Model.RNNRecurrentEntitiyDecoder(embedding_matrix=embedding_matrix, build_entity_cell=False, rnn_hidden_size=rnn_hidden_size, vocab_size=vocab_size, max_sent_num=max_sent_num, entity_embedding_dim=entity_embedding_dim, max_entity_num=entity_num) """ temp = np.zeros([max_token_len], dtype=np.int32) temp[:] = 261 temp[0] = 259 temp[2] = 260 self.sop = temp self.eop = temp self.sop[1] = 262 self.eop[1] = 263 self.sop = np.expand_dims(np.expand_dims(self.sop, axis=0), axis=1) self.eop = np.expand_dims(np.expand_dims(self.eop, axis=0), axis=1) self.max_token_len = max_token_len
def get_builder(self, imported_record): recordBuilder = builder() #Intializes the builder based on the records standard if imported_record['metadataStandardName'] == 'Datacite': dataciteBuilder = recordBuilder.build_datacite_json_record(imported_record) return dataciteBuilder elif imported_record['metadataStandardName'] == 'ISO19115': sansBuilder = recordBuilder.build_sans_json_record(imported_record) return sansBuilder else: raise builderError('Builder not available')
def add_pc(self): if (self.radioDesktop.isChecked() or self.radioGaming.isChecked() or self.radioWorkstation.isChecked()) and \ ((self.pricepicker.text() != "")): price = int(self.pricepicker.text()) cpu_brand, gpu_brand, storage_type = self.control_brands() pc_type = self.pc_pp cpu, gpu, motherboard, ram, ssd, hdd, psu_and_case = self.getpercentages() if price > 550: if cpu+gpu+motherboard+ram+ssd+hdd+psu_and_case == 100: self.pcs = builder(price, Percentage(gpu, cpu, ram, motherboard, ssd, hdd, psu_and_case), pc_type, gpu_brand, cpu_brand, storage_type) self.layout_main.addWidget(self.builded_pc(self.pcs), 9, 1) else: self.errorHandler( "Summary of the percentages cannot be more or less than 100% ") else: self.errorHandler("Price cannot be lower than 550") else: self.errorHandler('Pc Type or Price cannot be empty')
def __init__(self, use_character_input=True, max_batch_size=128, max_token_length=50, units=512, *args, **kwargs): super().__init__(*args, **kwargs) self.use_char = use_character_input self.max_token_length = max_token_length self.units = units if use_character_input: EWF = None else: EWF = HP.token_embedding_file self.ELMo, self.weight_layer = builder.builder( HP.option_file, HP.weight_file, max_token_length=max_token_length, use_character_inputs=use_character_input, embedding_weight_file=EWF, max_batch_size=max_batch_size) self.cell = tf.keras.layers.GRUCell(units=units) self.rnn = tf.keras.layers.RNN(cell=self.cell, return_sequences=True)
# source for each in makefile.findall( 'source' ): sys_bld.source.append( '%s%s' % ( dir, each.text ) ) # libraries for each in makefile.findall( 'library' ): sys_bld.source.append( '%s%s' % ( dir, each.text ) ) # more make files for each in makefile.findall( 'include' ): parseMakeFile( sys_bld, os.path.basename(each.text), '%s%s' % ( dir, os.path.dirname(each.text) ) ) if __name__ == '__main__': sys_bld = builder() # Init system build sys_bld.name = 'Farmer' sys_bld.conf.env['compiler'] = 'g++' sys_bld.conf.env['options'] = '' sys_bld.conf.env['out'] = 'out' sys_bld.conf.env['outfile'] = sys_bld.name sys_bld.conf.env['cflags'] = '' sys_bld.conf.env['cxxflags'] = '' sys_bld.conf.env['TOP_DIR'] = '.' sys_bld.conf.env['PLAN_CACHE'] = '__plancache_' parseMakeFile( sys_bld, 'makefile.xml' ) sys_bld.conf.platform_check()
def __init__(self): self.builder = builder()
def call_builder(parameters): builder(parameters)
def __init__(self, methodName='runTest'): super().__init__(methodName) self.builder = builder()