How to use set_name method in pandera

Best Python code snippet using pandera_python

inception.py

Source:inception.py Github

copy

Full Screen

...17 concat = Concat(2)18 conv1 = Sequential()19 conv1.add(SpatialConvolution(input_size, config[1][1], 1, 1, 1, 1)20 .set_init_method(weight_init_method=Xavier(),bias_init_method=ConstInitMethod(0.1))21 .set_name(name_prefix + "1x1"))22 conv1.add(ReLU(True).set_name(name_prefix + "relu_1x1"))23 concat.add(conv1)24 conv3 = Sequential()25 conv3.add(SpatialConvolution(input_size, config[2][1], 1, 1, 1, 1)26 .set_init_method(weight_init_method=Xavier(), bias_init_method=ConstInitMethod(0.1))27 .set_name(name_prefix + "3x3_reduce"))28 conv3.add(ReLU(True).set_name(name_prefix + "relu_3x3_reduce"))29 conv3.add(SpatialConvolution(config[2][1], config[2][2], 3, 3, 1, 1, 1, 1)30 .set_init_method(weight_init_method=Xavier(), bias_init_method=ConstInitMethod(0.1))31 .set_name(name_prefix + "3x3"))32 conv3.add(ReLU(True).set_name(name_prefix + "relu_3x3"))33 concat.add(conv3)34 conv5 = Sequential()35 conv5.add(SpatialConvolution(input_size, config[3][1], 1, 1, 1, 1)36 .set_init_method(weight_init_method=Xavier(), bias_init_method=ConstInitMethod(0.1))37 .set_name(name_prefix + "5x5_reduce"))38 conv5.add(ReLU(True).set_name(name_prefix + "relu_5x5_reduce"))39 conv5.add(SpatialConvolution(config[3][1], config[3][2], 5, 5, 1, 1, 2, 2)40 .set_init_method(weight_init_method=Xavier(), bias_init_method=ConstInitMethod(0.1))41 .set_name(name_prefix + "5x5"))42 conv5.add(ReLU(True).set_name(name_prefix + "relu_5x5"))43 concat.add(conv5)44 pool = Sequential()45 pool.add(SpatialMaxPooling(3, 3, 1, 1, 1, 1, to_ceil=True).set_name(name_prefix + "pool"))46 pool.add(SpatialConvolution(input_size, config[4][1], 1, 1, 1, 1)47 .set_init_method(weight_init_method=Xavier(), bias_init_method=ConstInitMethod(0.1))48 .set_name(name_prefix + "pool_proj"))49 pool.add(ReLU(True).set_name(name_prefix + "relu_pool_proj"))50 concat.add(pool).set_name(name_prefix + "output")51 return concat52def inception_v1_no_aux_classifier(class_num, has_dropout=True):53 model = Sequential()54 model.add(SpatialConvolution(3, 64, 7, 7, 2, 2, 3, 3, 1, False)55 .set_init_method(weight_init_method=Xavier(), bias_init_method=ConstInitMethod(0.1))56 .set_name("conv1/7x7_s2"))57 model.add(ReLU(True).set_name("conv1/relu_7x7"))58 model.add(SpatialMaxPooling(3, 3, 2, 2, to_ceil=True).set_name("pool1/3x3_s2"))59 model.add(SpatialCrossMapLRN(5, 0.0001, 0.75).set_name("pool1/norm1"))60 model.add(SpatialConvolution(64, 64, 1, 1, 1, 1)61 .set_init_method(weight_init_method=Xavier(), bias_init_method=ConstInitMethod(0.1))62 .set_name("conv2/3x3_reduce"))63 model.add(ReLU(True).set_name("conv2/relu_3x3_reduce"))64 model.add(SpatialConvolution(64, 192, 3, 3, 1, 1, 1, 1)65 .set_init_method(weight_init_method=Xavier(), bias_init_method=ConstInitMethod(0.1))66 .set_name("conv2/3x3"))67 model.add(ReLU(True).set_name("conv2/relu_3x3"))68 model.add(SpatialCrossMapLRN(5, 0.0001, 0.75).set_name("conv2/norm2"))69 model.add(SpatialMaxPooling(3, 3, 2, 2, to_ceil=True).set_name("pool2/3x3_s2"))70 model.add(inception_layer_v1(192, t([t([64]), t(71 [96, 128]), t([16, 32]), t([32])]), "inception_3a/"))72 model.add(inception_layer_v1(256, t([t([128]), t(73 [128, 192]), t([32, 96]), t([64])]), "inception_3b/"))74 model.add(SpatialMaxPooling(3, 3, 2, 2, to_ceil=True))75 model.add(inception_layer_v1(480, t([t([192]), t(76 [96, 208]), t([16, 48]), t([64])]), "inception_4a/"))77 model.add(inception_layer_v1(512, t([t([160]), t(78 [112, 224]), t([24, 64]), t([64])]), "inception_4b/"))79 model.add(inception_layer_v1(512, t([t([128]), t(80 [128, 256]), t([24, 64]), t([64])]), "inception_4c/"))81 model.add(inception_layer_v1(512, t([t([112]), t(82 [144, 288]), t([32, 64]), t([64])]), "inception_4d/"))83 model.add(inception_layer_v1(528, t([t([256]), t(84 [160, 320]), t([32, 128]), t([128])]), "inception_4e/"))85 model.add(SpatialMaxPooling(3, 3, 2, 2, to_ceil=True))86 model.add(inception_layer_v1(832, t([t([256]), t(87 [160, 320]), t([32, 128]), t([128])]), "inception_5a/"))88 model.add(inception_layer_v1(832, t([t([384]), t(89 [192, 384]), t([48, 128]), t([128])]), "inception_5b/"))90 model.add(SpatialAveragePooling(7, 7, 1, 1).set_name("pool5/7x7_s1"))91 if has_dropout:92 model.add(Dropout(0.4).set_name("pool5/drop_7x7_s1"))93 model.add(View([1024], num_input_dims=3))94 model.add(Linear(1024, class_num)95 .set_init_method(weight_init_method=Xavier(), bias_init_method=Zeros())96 .set_name("loss3/classifier"))97 model.add(LogSoftMax().set_name("loss3/loss3"))98 model.reset()99 return model100def inception_v1(class_num, has_dropout=True):101 feature1 = Sequential()102 feature1.add(SpatialConvolution(3, 64, 7, 7, 2, 2, 3, 3, 1, False)103 .set_init_method(weight_init_method=Xavier(), bias_init_method=ConstInitMethod(0.1))104 .set_name("conv1/7x7_s2"))105 feature1.add(ReLU(True).set_name("conv1/relu_7x7"))106 feature1.add(107 SpatialMaxPooling(3, 3, 2, 2, to_ceil=True)108 .set_name("pool1/3x3_s2"))109 feature1.add(SpatialCrossMapLRN(5, 0.0001, 0.75)110 .set_name("pool1/norm1"))111 feature1.add(SpatialConvolution(64, 64, 1, 1, 1, 1)112 .set_init_method(weight_init_method=Xavier(), bias_init_method=ConstInitMethod(0.1))113 .set_name("conv2/3x3_reduce"))114 feature1.add(ReLU(True).set_name("conv2/relu_3x3_reduce"))115 feature1.add(SpatialConvolution(64, 192, 3, 3, 1, 1, 1, 1)116 .set_init_method(weight_init_method=Xavier(), bias_init_method=ConstInitMethod(0.1))117 .set_name("conv2/3x3"))118 feature1.add(ReLU(True).set_name("conv2/relu_3x3"))119 feature1.add(SpatialCrossMapLRN(5, 0.0001, 0.75).set_name("conv2/norm2"))120 feature1.add(121 SpatialMaxPooling(3, 3, 2, 2, to_ceil=True).set_name("pool2/3x3_s2"))122 feature1.add(inception_layer_v1(192, t([123 t([64]), t([96, 128]), t([16, 32]), t([32])]),124 "inception_3a/"))125 feature1.add(inception_layer_v1(256, t([126 t([128]), t([128, 192]), t([32, 96]), t([64])]),127 "inception_3b/"))128 feature1.add(129 SpatialMaxPooling(3, 3, 2, 2, to_ceil=True).set_name("pool3/3x3_s2"))130 feature1.add(inception_layer_v1(480, t([131 t([192]), t([96, 208]), t([16, 48]), t([64])]),132 "inception_4a/"))133 output1 = Sequential()134 output1.add(SpatialAveragePooling(135 5, 5, 3, 3, ceil_mode=True).set_name("loss1/ave_pool"))136 output1.add(137 SpatialConvolution(512, 128, 1, 1, 1, 1).set_name("loss1/conv"))138 output1.add(ReLU(True).set_name("loss1/relu_conv"))139 output1.add(View([128 * 4 * 4, 3]))140 output1.add(Linear(128 * 4 * 4, 1024).set_name("loss1/fc"))141 output1.add(ReLU(True).set_name("loss1/relu_fc"))142 if has_dropout:143 output1.add(Dropout(0.7).set_name("loss1/drop_fc"))144 output1.add(Linear(1024, class_num).set_name("loss1/classifier"))145 output1.add(LogSoftMax().set_name("loss1/loss"))146 feature2 = Sequential()147 feature2.add(inception_layer_v1(512,148 t([t([160]), t([112, 224]), t([24, 64]), t([64])]),149 "inception_4b/"))150 feature2.add(inception_layer_v1(512,151 t([t([128]), t([128, 256]), t([24, 64]), t([64])]),152 "inception_4c/"))153 feature2.add(inception_layer_v1(512,154 t([t([112]), t([144, 288]), t([32, 64]), t([64])]),155 "inception_4d/"))156 output2 = Sequential()157 output2.add(SpatialAveragePooling(5, 5, 3, 3).set_name("loss2/ave_pool"))158 output2.add(159 SpatialConvolution(528, 128, 1, 1, 1, 1).set_name("loss2/conv"))160 output2.add(ReLU(True).set_name("loss2/relu_conv"))161 output2.add(View([128 * 4 * 4, 3]))162 output2.add(Linear(128 * 4 * 4, 1024).set_name("loss2/fc"))163 output2.add(ReLU(True).set_name("loss2/relu_fc"))164 if has_dropout:165 output2.add(Dropout(0.7).set_name("loss2/drop_fc"))166 output2.add(Linear(1024, class_num).set_name("loss2/classifier"))167 output2.add(LogSoftMax().set_name("loss2/loss"))168 output3 = Sequential()169 output3.add(inception_layer_v1(528,170 t([t([256]), t([160, 320]), t([32, 128]), t([128])]),171 "inception_4e/"))172 output3.add(SpatialMaxPooling(3, 3, 2, 2, to_ceil=True).set_name("pool4/3x3_s2"))173 output3.add(inception_layer_v1(832,174 t([t([256]), t([160, 320]), t([32, 128]), t([128])]),175 "inception_5a/"))176 output3.add(inception_layer_v1(832,177 t([t([384]), t([192, 384]), t([48, 128]), t([128])]),178 "inception_5b/"))179 output3.add(SpatialAveragePooling(7, 7, 1, 1).set_name("pool5/7x7_s1"))180 if has_dropout:181 output3.add(Dropout(0.4).set_name("pool5/drop_7x7_s1"))182 output3.add(View([1024, 3]))183 output3.add(Linear(1024, class_num)184 .set_init_method(weight_init_method=Xavier(), bias_init_method=Zeros())185 .set_name("loss3/classifier"))186 output3.add(LogSoftMax().set_name("loss3/loss3"))187 split2 = Concat(2).set_name("split2")188 split2.add(output3)189 split2.add(output2)190 mainBranch = Sequential()191 mainBranch.add(feature2)192 mainBranch.add(split2)193 split1 = Concat(2).set_name("split1")194 split1.add(mainBranch)195 split1.add(output1)196 model = Sequential()197 model.add(feature1)198 model.add(split1)199 model.reset()200 return model201def get_inception_data(url, sc=None, data_type="train"):202 path = os.path.join(url, data_type)203 return SeqFileFolder.files_to_image_frame(url=path, sc=sc, class_num=1000)204def config_option_parser():205 parser = OptionParser()206 parser.add_option("-f", "--folder", type=str, dest="folder", default="",207 help="url of hdfs folder store the hadoop sequence files")...

Full Screen

Full Screen

loadsyms_d13.020.py

Source:loadsyms_d13.020.py Github

copy

Full Screen

1ida_name.set_name(0x800c188,"md380_create_main_menu_entry");2ida_name.set_name(0x800c72e,"md380_create_menu_entry");3ida_name.set_name(0x800ded8,"gfx_drawtext10");4ida_name.set_name(0x800def6,"gfx_drawtext");5ida_name.set_name(0x800df1a,"draw_datetime_row");6ida_name.set_name(0x800e538,"draw_zone_channel");7ida_name.set_name(0x800fc84,"md380_menu_entry_back");8ida_name.set_name(0x80134a0,"Create_Menu_Utilies");9ida_name.set_name(0x80136c0,"md380_menu_entry_programradio");10ida_name.set_name(0x80156a4,"Create_Menu_Entry_RX_QRG_shown");11ida_name.set_name(0x8015720,"Create_Menu_Entry_RX_QRG_1");12ida_name.set_name(0x80157fc,"Create_Menu_Entry_RX_QRG_2");13ida_name.set_name(0x801587a,"Create_Menu_Entry_RX_QRG_3");14ida_name.set_name(0x8015900,"Create_Menu_Entry_RX_QRG_4");15ida_name.set_name(0x8018b28,"md380_itow");16ida_name.set_name(0x801ad56,"Create_Menu_Entry_LEDIndicator");17ida_name.set_name(0x801b042,"md380_menu_numerical_input");18ida_name.set_name(0x801d368,"gfx_set_bg_color");19ida_name.set_name(0x801d370,"gfx_set_fg_color");20ida_name.set_name(0x801d88c,"gfx_blockfill");21ida_name.set_name(0x801dcc0,"gfx_clear3");22ida_name.set_name(0x801dd08,"gfx_drawtext2");23ida_name.set_name(0x801dd1a,"gfx_drawtext4");24ida_name.set_name(0x801fe5c,"f_4225");25ida_name.set_name(0x8021874,"gfx_select_font");26ida_name.set_name(0x802189c,"gfx_drawchar");27ida_name.set_name(0x8021940,"gfx_drawchar_pos");28ida_name.set_name(0x802256a,"aes_startup_check");29ida_name.set_name(0x80226c0,"Get_Welcome_Line1_from_spi_flash");30ida_name.set_name(0x80226d2,"Get_Welcome_Line2_from_spi_flash");31ida_name.set_name(0x80226f6,"rc_write_radio_config_to_flash");32ida_name.set_name(0x80237fe,"gfx_drawbmp");33ida_name.set_name(0x8023ee4,"Edit_Message_Menu_Entry");34ida_name.set_name(0x8025ae4,"F_4315");35ida_name.set_name(0x8027728,"gfx_drawtext6");36ida_name.set_name(0x80277c2,"gfx_drawtext7");37ida_name.set_name(0x802b3f6,"md380_RTC_GetTime");38ida_name.set_name(0x802b50c,"md380_RTC_GetDate");39ida_name.set_name(0x802c83c,"md380_f_4520");40ida_name.set_name(0x802dfbc,"md380_f_4137");41ida_name.set_name(0x802f994,"bp_sempost");42ida_name.set_name(0x802f9b8,"bp_sempost2");43ida_name.set_name(0x802f9dc,"Beep_Process");44ida_name.set_name(0x8030ad8,"bp_set_freq");45ida_name.set_name(0x8030b08,"bp_tone_on");46ida_name.set_name(0x8030b58,"bp_tone_off");47ida_name.set_name(0x8031084,"md380_OSMboxPend");48ida_name.set_name(0x803119c,"md380_OSMboxPost");49ida_name.set_name(0x8031276,"md380_spiflash_sektor_erase4k");50ida_name.set_name(0x80312aa,"md380_spiflash_block_erase64k");51ida_name.set_name(0x8031476,"md380_spiflash_read");52ida_name.set_name(0x80314bc,"md380_spi_sendrecv");53ida_name.set_name(0x8031508,"md380_spiflash_wait");54ida_name.set_name(0x803152a,"md380_spiflash_enable");55ida_name.set_name(0x8031546,"md380_spiflash_disable");56ida_name.set_name(0x803155e,"md380_spiflash_write");57ida_name.set_name(0x80318b0,"md380_spiflash_security_registers_read");58ida_name.set_name(0x803352c,"md380_Write_Command_2display");59ida_name.set_name(0x8033534,"md380_Write_Data_2display");60ida_name.set_name(0x802b80a,"md380_GPIO_SetBits");61ida_name.set_name(0x802b80e,"md380_GPIO_ResetBits");62ida_name.set_name(0x2001de38,"md380_radio_config_bank2");63ida_name.set_name(0x8033dac,"draw_statusline");64ida_name.set_name(0x8033eb4,"OSTimeDly");65ida_name.set_name(0x8036c38,"aes_cipher");66ida_name.set_name(0x8036cc0,"aes_loadkey");67ida_name.set_name(0x803b39a,"main_menu");68ida_name.set_name(0x803f708,"OSSemCreate");69ida_name.set_name(0x803f754,"OSSemPend");70ida_name.set_name(0x803f844,"OSSemPost");71ida_name.set_name(0x803ff84,"c5000_spi0_writereg");72ida_name.set_name(0x803ffd0,"c5000_spi0_readreg");73ida_name.set_name(0x8040a02,"dmr_call_start");74ida_name.set_name(0x8040ce6,"dmr_before_squelch");75ida_name.set_name(0x8040de0,"dmr_sms_arrive");76ida_name.set_name(0x8041430,"dmr_call_end");77ida_name.set_name(0x80417e0,"dmr_CSBK_handler");78ida_name.set_name(0x8043de4,"OS_ENTER_CRITICAL");79ida_name.set_name(0x8043dec,"OS_EXIT_CRITICAL");80ida_name.set_name(0x80462bc,"Start");81ida_name.set_name(0x8046520,"Start_multiple_tasks");82ida_name.set_name(0x8049e14,"Start_2_more_tasks__init_vocoder_tasks");83ida_name.set_name(0x804b234,"ambe_unpack");84ida_name.set_name(0x804dd70,"dmr_handle_data");85ida_name.set_name(0x804e580,"OSTaskCreateExt");86ida_name.set_name(0x804e64c,"OSTaskNameSet");87ida_name.set_name(0x804eb64,"md380_f_4098");88ida_name.set_name(0x804ec66,"f_4101");89ida_name.set_name(0x804ec66,"md380_f_4102");90ida_name.set_name(0x804f94c,"kb_handler");91ida_name.set_name(0x80531d8,"ambe_encode_thing");92ida_name.set_name(0x8053680,"ambe_decode_wav");93ida_name.set_name(0x8055100,"usb_setcallbacks");94ida_name.set_name(0x8059b02,"usb_send_packet");95ida_name.set_name(0x808eb30,"usb_do_setup");96ida_name.set_name(0x808ebee,"usb_dnld_handle");97ida_name.set_name(0x808f308,"usb_upld_handle");98ida_name.set_name(0x8090370,"usb_dfu_write");99ida_name.set_name(0x80903c0,"usb_dfu_read");100ida_name.set_name(0x809662e,"usb_serialnumber");101ida_name.set_name(0x809a4c0,"gfx_font_small");102ida_name.set_name(0x80cf780,"gfx_font_norm");103ida_name.set_name(0x80cff30,"md380_wt_programradio");104ida_name.set_name(0x80f8510,"welcomebmp");105ida_name.set_name(0x200049fc,"mn_editbuffer_poi");106ida_name.set_name(0x20004a14,"md380_dfutargetadr");107ida_name.set_name(0x20004a14,"md380_dfu_target_adr");108ida_name.set_name(0x20004acc,"md380_menu_0x200011e4");109ida_name.set_name(0x20004acc,"md380_menu_depth");110ida_name.set_name(0x20004cba,"currently_selected_menu_entry");111ida_name.set_name(0x20013594,"ambe_mystery");112ida_name.set_name(0x20013f28,"ambe_outbuffer0");113ida_name.set_name(0x20013fc8,"ambe_outbuffer1");114ida_name.set_name(0x2001410e,"ambe_inbuffer");115ida_name.set_name(0x2001ae74,"md380_packet");116ida_name.set_name(0x2001b246,"md380_menu_0x2001d3f0");117ida_name.set_name(0x2001b274,"md380_menu_mem_base");118ida_name.set_name(0x2001cb54,"msg_sms_hdr_prep");119ida_name.set_name(0x2001cb58,"selected_contact_name_wstring");120ida_name.set_name(0x2001cb9a,"md380_menu_edit_buf");121ida_name.set_name(0x2001ccbc,"msg_sms_bdy_prep");122ida_name.set_name(0x2001cddc,"zone_name");123ida_name.set_name(0x2001cefc,"msg_sms_bdy");124ida_name.set_name(0x2001d504,"md380_usbstring");125ida_name.set_name(0x2001d5cc,"md380_menu_memory");126ida_name.set_name(0x2001da1c,"gfx_info");127ida_name.set_name(0x2001dadc,"md380_radio_config");128ida_name.set_name(0x2001db2c,"msg_buffer");129ida_name.set_name(0x2001de78,"struct_channel_info2");130ida_name.set_name(0x2001deb8,"current_channel_info");131ida_name.set_name(0x2001defa,"top_side_button_pressed_function");132ida_name.set_name(0x2001defb,"top_side_button_held_function");133ida_name.set_name(0x2001defc,"bottom_side_button_pressed_function");134ida_name.set_name(0x2001defd,"bottom_side_button_held_function");135ida_name.set_name(0x2001e0d0,"print_buffer");136ida_name.set_name(0x2001e1ac,"contact");137ida_name.set_name(0x2001e1d0,"msg_sms_hdr");138ida_name.set_name(0x2001e1f4,"channel_name");139ida_name.set_name(0x2001e3c0,"menu_title_cstring");140ida_name.set_name(0x2001e3fc,"toplinetext");141ida_name.set_name(0x2001e410,"botlinetext");142ida_name.set_name(0x2001e534,"smeter_rssi");143ida_name.set_name(0x2001e574,"md380_program_radio_unprohibited");144ida_name.set_name(0x2001e5f0,"radio_status_1");145ida_name.set_name(0x2001e5f8,"kb_keypressed");146ida_name.set_name(0x2001e604,"q_status_4");147ida_name.set_name(0x2001e650,"sema1_poi");148ida_name.set_name(0x2001e658,"event5_mbox_poi");149ida_name.set_name(0x2001e65c,"event1_mbox_poi_radio");150ida_name.set_name(0x2001e660,"event4_mbox_poi");151ida_name.set_name(0x2001e664,"event3_mbox_poi");152ida_name.set_name(0x2001e670,"sema2_poi");153ida_name.set_name(0x2001e67c,"event2_mbox_poi_beep");154ida_name.set_name(0x2001e6c0,"bp_freq");155ida_name.set_name(0x2001e754,"md380_blockadr");156ida_name.set_name(0x2001e758,"md380_packetlen");157ida_name.set_name(0x2001e7b0,"kb_top_side_key_press_time");158ida_name.set_name(0x2001e7b2,"kb_bot_side_key_press_time");159ida_name.set_name(0x2001e7b8,"kb_side_key_max_time");160ida_name.set_name(0x2001e7ba,"kb_row_col_pressed");161ida_name.set_name(0x2001e7be,"kb_key_press_time");162ida_name.set_name(0x2001e7f8,"backlight_timer");163ida_name.set_name(0x2001e844,"m_cntr2");164ida_name.set_name(0x2001e850,"selected_channel");165ida_name.set_name(0x2001e890,"kb_keycode");166ida_name.set_name(0x2001e892,"gui_opmode3");167ida_name.set_name(0x2001e8a7,"bp_2001e8a7");168ida_name.set_name(0x2001e8a8,"beep_code_send");169ida_name.set_name(0x2001e8a9,"event5_buffer");170ida_name.set_name(0x2001e8aa,"event1_buffer");171ida_name.set_name(0x2001e8c1,"channel_num");172ida_name.set_name(0x2001e903,"md380_menu_entry_selected");173ida_name.set_name(0x2001e914,"md380_menu_0x2001d3c1");174ida_name.set_name(0x2001e915,"md380_menu_id");175ida_name.set_name(0x2001e943,"md380_menu_0x2001d3ed");176ida_name.set_name(0x2001e944,"md380_menu_0x2001d3ee");177ida_name.set_name(0x2001e945,"md380_menu_0x2001d3ef");178ida_name.set_name(0x2001e946,"md380_menu_0x2001d3f0");179ida_name.set_name(0x2001e947,"md380_menu_0x2001d3f1");180ida_name.set_name(0x2001e94a,"md380_menu_0x2001d3f4");181ida_name.set_name(0x2001e94b,"gui_opmode2");182ida_name.set_name(0x2001e94c,"gui_opmode1_prev");183ida_name.set_name(0x2001e94d,"gui_opmode1");184ida_name.set_name(0x2001e962,"md380_dfu_state");185ida_name.set_name(0x2001e963,"md380_thingy2");186ida_name.set_name(0x80f8560,"DMR_BMP1");187ida_name.set_name(0x80f8538,"DMR_BMP2");...

Full Screen

Full Screen

ipset_manager.py

Source:ipset_manager.py Github

copy

Full Screen

1#2# Licensed under the Apache License, Version 2.0 (the "License");3# you may not use this file except in compliance with the License.4# You may obtain a copy of the License at5#6# http://www.apache.org/licenses/LICENSE-2.07#8# Unless required by applicable law or agreed to in writing, software9# distributed under the License is distributed on an "AS IS" BASIS,10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11# See the License for the specific language governing permissions and12# limitations under the License.13import copy14import netaddr15from neutron.agent.linux import utils as linux_utils16from oslo_concurrency import lockutils17IPSET_ADD_BULK_THRESHOLD = 518NET_PREFIX = 'N'19SWAP_SUFFIX = '-n'20IPSET_NAME_MAX_LENGTH = 31 - len(SWAP_SUFFIX)21class IpsetManager(object):22 """Smart wrapper for ipset.23 Keeps track of ip addresses per set, using bulk24 or single ip add/remove for smaller changes.25 """26 def __init__(self, execute=None, namespace=None):27 self.execute = execute or linux_utils.execute28 self.namespace = namespace29 self.ipset_sets = {}30 def _sanitize_addresses(self, addresses):31 """This method converts any address to ipset format.32 If an address has a mask of /0 we need to cover to it to a mask of33 /1 as ipset does not support /0 length addresses. Instead we use two34 /1's to represent the /0.35 """36 sanitized_addresses = []37 for ip in addresses:38 ip = netaddr.IPNetwork(ip)39 if ip.prefixlen == 0:40 if ip.version == 4:41 sanitized_addresses.append('0.0.0.0/1')42 sanitized_addresses.append('128.0.0.0/1')43 elif ip.version == 6:44 sanitized_addresses.append('::/1')45 sanitized_addresses.append('8000::/1')46 else:47 sanitized_addresses.append(str(ip))48 return sanitized_addresses49 @staticmethod50 def get_name(id, ethertype):51 """Returns the given ipset name for an id+ethertype pair.52 This reference can be used from iptables.53 """54 name = NET_PREFIX + ethertype + id55 return name[:IPSET_NAME_MAX_LENGTH]56 def set_name_exists(self, set_name):57 """Returns true if the set name is known to the manager."""58 return set_name in self.ipset_sets59 def set_members(self, id, ethertype, member_ips):60 """Create or update a specific set by name and ethertype.61 It will make sure that a set is created, updated to62 add / remove new members, or swapped atomically if63 that's faster, and return added / removed members.64 """65 member_ips = self._sanitize_addresses(member_ips)66 set_name = self.get_name(id, ethertype)67 add_ips = self._get_new_set_ips(set_name, member_ips)68 del_ips = self._get_deleted_set_ips(set_name, member_ips)69 if add_ips or del_ips or not self.set_name_exists(set_name):70 self.set_members_mutate(set_name, ethertype, member_ips)71 return add_ips, del_ips72 def set_members_mutate(self, set_name, ethertype, member_ips):73 with lockutils.lock('neutron-ipset-%s' % self.namespace,74 external=True):75 if not self.set_name_exists(set_name):76 # The initial creation is handled with create/refresh to77 # avoid any downtime for existing sets (i.e. avoiding78 # a flush/restore), as the restore operation of ipset is79 # additive to the existing set.80 self._create_set(set_name, ethertype)81 self._refresh_set(set_name, member_ips, ethertype)82 # TODO(majopela,shihanzhang,haleyb): Optimize this by83 # gathering the system ipsets at start. So we can determine84 # if a normal restore is enough for initial creation.85 # That should speed up agent boot up time.86 else:87 add_ips = self._get_new_set_ips(set_name, member_ips)88 del_ips = self._get_deleted_set_ips(set_name, member_ips)89 if (len(add_ips) + len(del_ips) < IPSET_ADD_BULK_THRESHOLD):90 self._add_members_to_set(set_name, add_ips)91 self._del_members_from_set(set_name, del_ips)92 else:93 self._refresh_set(set_name, member_ips, ethertype)94 def destroy(self, id, ethertype, forced=False):95 with lockutils.lock('neutron-ipset-%s' % self.namespace,96 external=True):97 set_name = self.get_name(id, ethertype)98 self._destroy(set_name, forced)99 def _add_member_to_set(self, set_name, member_ip):100 cmd = ['ipset', 'add', '-exist', set_name, member_ip]101 self._apply(cmd)102 self.ipset_sets[set_name].append(member_ip)103 def _refresh_set(self, set_name, member_ips, ethertype):104 new_set_name = set_name + SWAP_SUFFIX105 set_type = self._get_ipset_set_type(ethertype)106 process_input = ["create %s hash:net family %s" % (new_set_name,107 set_type)]108 for ip in member_ips:109 process_input.append("add %s %s" % (new_set_name, ip))110 self._restore_sets(process_input)111 self._swap_sets(new_set_name, set_name)112 self._destroy(new_set_name, True)113 self.ipset_sets[set_name] = copy.copy(member_ips)114 def _del_member_from_set(self, set_name, member_ip):115 cmd = ['ipset', 'del', set_name, member_ip]116 self._apply(cmd, fail_on_errors=False)117 self.ipset_sets[set_name].remove(member_ip)118 def _create_set(self, set_name, ethertype):119 cmd = ['ipset', 'create', '-exist', set_name, 'hash:net', 'family',120 self._get_ipset_set_type(ethertype)]121 self._apply(cmd)122 self.ipset_sets[set_name] = []123 def _apply(self, cmd, input=None, fail_on_errors=True):124 input = '\n'.join(input) if input else None125 cmd_ns = []126 if self.namespace:127 cmd_ns.extend(['ip', 'netns', 'exec', self.namespace])128 cmd_ns.extend(cmd)129 self.execute(cmd_ns, run_as_root=True, process_input=input,130 check_exit_code=fail_on_errors)131 def _get_new_set_ips(self, set_name, expected_ips):132 new_member_ips = (set(expected_ips) -133 set(self.ipset_sets.get(set_name, [])))134 return list(new_member_ips)135 def _get_deleted_set_ips(self, set_name, expected_ips):136 deleted_member_ips = (set(self.ipset_sets.get(set_name, [])) -137 set(expected_ips))138 return list(deleted_member_ips)139 def _add_members_to_set(self, set_name, add_ips):140 for ip in add_ips:141 if ip not in self.ipset_sets[set_name]:142 self._add_member_to_set(set_name, ip)143 def _del_members_from_set(self, set_name, del_ips):144 for ip in del_ips:145 if ip in self.ipset_sets[set_name]:146 self._del_member_from_set(set_name, ip)147 def _get_ipset_set_type(self, ethertype):148 return 'inet6' if ethertype == 'IPv6' else 'inet'149 def _restore_sets(self, process_input):150 cmd = ['ipset', 'restore', '-exist']151 self._apply(cmd, process_input)152 def _swap_sets(self, src_set, dest_set):153 cmd = ['ipset', 'swap', src_set, dest_set]154 self._apply(cmd)155 def _destroy(self, set_name, forced=False):156 if set_name in self.ipset_sets or forced:157 cmd = ['ipset', 'destroy', set_name]158 self._apply(cmd, fail_on_errors=False)...

Full Screen

Full Screen

symbols_FW_2017_nongps_4.05.py

Source:symbols_FW_2017_nongps_4.05.py Github

copy

Full Screen

1ida_name.set_name(0x8032f34,"F_4315");2ida_name.set_name(0x0,"TG_cacheA");3ida_name.set_name(0x0,"TG_cacheB");4ida_name.set_name(0x2001cafa,"backlight_timer");5ida_name.set_name(0x2001c4d4,"botlinetext");6ida_name.set_name(0x2001be48,"channelA");7ida_name.set_name(0x2001be88,"channelB");8ida_name.set_name(0x2001bec8,"channelC");9ida_name.set_name(0x2001c284,"channel_name");10ida_name.set_name(0x2001c318,"contact");11ida_name.set_name(0x804e460,"dmr_CSBK_handler");12ida_name.set_name(0x804602c,"dmr_before_squelch");13ida_name.set_name(0x804defc,"dmr_call_end");14ida_name.set_name(0x804d136,"dmr_call_start");15ida_name.set_name(0x806afe0,"dmr_handle_data");16ida_name.set_name(0x804d84c,"dmr_sms_arrive");17ida_name.set_name(0x800e540,"draw_datetime_row");18ida_name.set_name(0x804810c,"draw_statusline");19ida_name.set_name(0x800f320,"draw_zone_channel");20ida_name.set_name(0x803a5c6,"enable_backlight");21ida_name.set_name(0x803e204,"f_1444");22ida_name.set_name(0x8029270,"f_4225");23ida_name.set_name(0x8011702,"get_menu_id_for_depth");24ida_name.set_name(0x80264ac,"gfx_blockfill");25ida_name.set_name(0x8026a28,"gfx_clear3");26ida_name.set_name(0x802f9b8,"gfx_drawbmp");27ida_name.set_name(0x802f8ec,"gfx_drawchar_pos");28ida_name.set_name(0x800e476,"gfx_drawtext");29ida_name.set_name(0x800e420,"gfx_drawtext10");30ida_name.set_name(0x8026a7c,"gfx_drawtext2");31ida_name.set_name(0x8026a9a,"gfx_drawtext4");32ida_name.set_name(0x802ff34,"gfx_drawtext7");33ida_name.set_name(0x80dfc28,"gfx_font_norm");34ida_name.set_name(0x80dfbe8,"gfx_font_small");35ida_name.set_name(0x802b4ac,"gfx_select_font");36ida_name.set_name(0x8025e0c,"gfx_set_bg_color");37ida_name.set_name(0x8025e18,"gfx_set_fg_color");38ida_name.set_name(0x2001cba6,"gui_opmode1");39ida_name.set_name(0x2001cba5,"gui_opmode1_prev");40ida_name.set_name(0x2001cba4,"gui_opmode2");41ida_name.set_name(0x2001cbf7,"gui_opmode3");42ida_name.set_name(0x2001cbc9,"kb_bot_side_key_press_time");43ida_name.set_name(0x806ff48,"kb_handler");44ida_name.set_name(0x2001cbcf,"kb_key_press_time");45ida_name.set_name(0x2001cbd8,"kb_keycode");46ida_name.set_name(0x2001c914,"kb_keypressed");47ida_name.set_name(0x2001cb9d,"kb_row_col_pressed");48ida_name.set_name(0x2001cbcb,"kb_side_key_max_time");49ida_name.set_name(0x2001cbc7,"kb_top_side_key_press_time");50ida_name.set_name(0x2001ca78,"m_cntr2");51ida_name.set_name(0x80580c0,"main_menu");52ida_name.set_name(0x2001c8ac,"md380_CPS_version");53ida_name.set_name(0x8041be6,"md380_OSMboxPend");54ida_name.set_name(0x8041cfc,"md380_OSMboxPost");55ida_name.set_name(0x803a272,"md380_RTC_GetDate");56ida_name.set_name(0x803a13e,"md380_RTC_GetTime");57ida_name.set_name(0x2001c8c4,"md380_blockadr");58ida_name.set_name(0x800c188,"md380_create_main_menu_entry");59ida_name.set_name(0x800c93c,"md380_create_menu_entry");60ida_name.set_name(0x2001c8f8,"md380_current_TG");61ida_name.set_name(0x2001cbe7,"md380_dfu_state");62ida_name.set_name(0x20001280,"md380_dfu_target_adr");63ida_name.set_name(0x20001280,"md380_dfutargetadr");64ida_name.set_name(0x801d6cc,"md380_itow");65ida_name.set_name(0x2001c900,"md380_lastheard_dest");66ida_name.set_name(0x2001c8fc,"md380_lastheard_dmrid");67ida_name.set_name(0x2001c89c,"md380_dmr_id");68ida_name.set_name(0x2001cb6c,"md380_menu_id");69ida_name.set_name(0x2000155c,"md380_menu_depth");70#Warning in: md380_menu_0x200011e4 = md380_menu_depth ;71#Warning in: md380_menu_0x2001d3c1 = md380_menu_id - 1 ;72#Warning in: md380_menu_0x2001d3ed = md380_menu_id + 48 ;73#Warning in: md380_menu_0x2001d3ee = md380_menu_id + 49 ;74#Warning in: md380_menu_0x2001d3ef = md380_menu_id + 50 ;75#Warning in: md380_menu_0x2001d3f0 = md380_menu_id + 51 ;76#Warning in: md380_menu_0x2001d3f1 = md380_menu_id + 52 ;77#Warning in: md380_menu_0x2001d3f4 = md380_menu_id + 55 ;78ida_name.set_name(0x2001c590,"md380_menu_edit_buf");79ida_name.set_name(0x8011736,"md380_menu_entry_back");80ida_name.set_name(0x8015670,"md380_menu_entry_programradio");81ida_name.set_name(0x2001cb5a,"md380_menu_entry_selected");82ida_name.set_name(0x20014dd0,"md380_menu_mem_base");83ida_name.set_name(0x2001aed0,"md380_menu_memory");84ida_name.set_name(0x8021214,"md380_menu_numerical_input");85ida_name.set_name(0x20018e08,"md380_packet");86ida_name.set_name(0x2001c8c8,"md380_packetlen");87ida_name.set_name(0x2001b82c,"md380_radio_config");88ida_name.set_name(0x8044884,"md380_spi_sendrecv");89ida_name.set_name(0x8044c80,"md380_spiflash_block_erase64k");90ida_name.set_name(0x804490e,"md380_spiflash_disable");91ida_name.set_name(0x80448f2,"md380_spiflash_enable");92ida_name.set_name(0x804483e,"md380_spiflash_read");93ida_name.set_name(0x8044690,"md380_spiflash_security_registers_read");94ida_name.set_name(0x8044628,"md380_spiflash_sektor_erase4k");95ida_name.set_name(0x80448d0,"md380_spiflash_wait");96ida_name.set_name(0x8044926,"md380_spiflash_write");97ida_name.set_name(0x2001cbe8,"md380_thingy2");98ida_name.set_name(0x2001b3a8,"md380_usbstring");99ida_name.set_name(0x80dffe8,"md380_wt_programradio");100ida_name.set_name(0x2000114c,"mn_editbuffer_poi");101ida_name.set_name(0x2001c920,"q_status_4");102ida_name.set_name(0x802d0f8,"read_contact");103ida_name.set_name(0x0,"store_dst");104ida_name.set_name(0x0,"store_src");105ida_name.set_name(0x2001c23c,"testTG");106ida_name.set_name(0x2001c84c,"toplinetext");107ida_name.set_name(0x80cf7e4,"usb_dnld_handle");108ida_name.set_name(0x807b532,"usb_send_packet");109ida_name.set_name(0x80cff80,"usb_upld_handle");110ida_name.set_name(0x2001aa70,"zone_name");111ida_name.set_name(0x8048570,"OSTimeDly");112ida_name.set_name(0x80428bc,"bp_sempost");113ida_name.set_name(0x80428e2,"bp_sempost2");114ida_name.set_name(0x8042908,"Beep_Process");115ida_name.set_name(0x8043c02,"bp_set_freq");116ida_name.set_name(0x8043c36,"bp_tone_on");117ida_name.set_name(0x8043c86,"bp_tone_off");118ida_name.set_name(0x805f5e4,"OSSemPost");119ida_name.set_name(0x805f4f4,"OSSemPend");120ida_name.set_name(0x805f4a2,"OSSemCreate");121ida_name.set_name(0x2000f6f0,"ambe_mystery");122ida_name.set_name(0x8075de0,"ambe_decode_wav");123ida_name.set_name(0x806ab68,"ambe_unpack");124ida_name.set_name(0x8075938,"ambe_encode_thing");125ida_name.set_name(0x2001cc0c,"bp_2001CCF0");126ida_name.set_name(0x2001c7c0,"bp_freq");127ida_name.set_name(0x80d58b2,"IRQ_ORIGINAL_SYSTICK_HDLR");128ida_name.set_name(0x2001c218,"channel_A_destination");129ida_name.set_name(0x2001c90c,"radio_status_1");130ida_name.set_name(0x2001c85c,"micGainValue");131ida_name.set_name(0x2001c850,"currentMenuItemTitle");132ida_name.set_name(0x2001c440,"dmr_lc_header_buffer");133ida_name.set_name(0x2001c9a8,"PcTuneRelated");134ida_name.set_name(0x2001c920,"q_status_4");135ida_name.set_name(0x2001cc0d,"beep_code_send");136ida_name.set_name(0x805f640,"OS_ENTER_CRITICAL");137ida_name.set_name(0x805f648,"OS_EXIT_CRITICAL");138ida_name.set_name(0x2001c974,"sema1_poi");139ida_name.set_name(0x2001e578,"event5_mbox_poi");140ida_name.set_name(0x2001e57c,"event1_mbox_poi_radio");141ida_name.set_name(0x2001c990,"event3_mbox_poi");142ida_name.set_name(0x2001c988,"event4_mbox_poi");143ida_name.set_name(0x2001c9b0,"event2_mbox_poi_beep");144ida_name.set_name(0x2001c99c,"sema2_poi");145ida_name.set_name(0x8061900,"OSTaskCreateExt");146ida_name.set_name(0x80619ce,"OSTaskNameSet");147ida_name.set_name(0x2001bd88,"current_channel_info");148ida_name.set_name(0x805df06,"subb_805F562");149ida_name.set_name(0x80cf6fe,"usb_do_setup");150ida_name.set_name(0x2001a7e8,"msg_sms_hdr");151ida_name.set_name(0x2001c318,"msg_sms_hdr_prep");152ida_name.set_name(0x2001c798,"program_radio_flag_byte");153ida_name.set_name(0x804b29c,"aes_cipher");...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pandera automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful