How to use _update_params method in localstack

Best Python code snippet using localstack_python

api.py

Source:api.py Github

copy

Full Screen

...4def account_type(overrides=None):5 defaults = {6 'cmd': 'account_type',7 }8 params = _update_params(defaults, overrides)9 return get(params)10def activate_flag(overrides=None):11 defaults = {12 'cmd': 'activate_flag',13 }14 params = _update_params(defaults, overrides)15 return get(params)16def apn_config(overrides=None):17 cmd = ','.join(['APN_config' + str(i) for i in range(0, 10)])18 defaults = {19 'cmd': cmd,20 'multi_data': '1',21 }22 params = _update_params(defaults, overrides)23 return get(params)24def cell_id(overrides=None):25 defaults = {26 'cmd': 'cell_id',27 }28 params = _update_params(defaults, overrides)29 return get(params)30def connection_mode(overrides=None):31 defaults = {32 'cmd': 'connection_mode',33 }34 params = _update_params(defaults, overrides)35 return get(params)36def connect_network(overrides=None):37 defaults = {38 'goformId': 'CONNECT_NETWORK',39 }40 data = _update_params(defaults, overrides)41 return post(data)42def current_upgrade_state(overrides=None):43 defaults = {44 'cmd': 'current_upgrade_state',45 }46 params = _update_params(defaults, overrides)47 return get(params)48def custom_account_type(overrides=None):49 defaults = {50 'cmd': 'custom_account_type',51 }52 params = _update_params(defaults, overrides)53 return get(params)54def delete_sms(overrides=None):55 """56 Delete Sms57 Args58 overrides (dict):59 msg_id: ';' (empty), 'X;' (one) 'X;Y;Z;' (many)60 """61 defaults = {62 'goformId': 'DELETE_SMS',63 'msg_id': '',64 }65 data = _update_params(defaults, overrides)66 return post(data)67def dial_mode(overrides=None):68 defaults = {69 'cmd': 'dial_mode',70 }71 params = _update_params(defaults, overrides)72 return get(params)73def disable_pin(overrides=None):74 defaults = {75 'goformId': 'DISABLE_PIN',76 'OldPinNumber': '',77 }78 data = _update_params(defaults, overrides)79 return post(data)80def disconnect_network(overrides=None):81 defaults = {82 'goformId': 'DISCONNECT_NETWORK',83 }84 data = _update_params(defaults, overrides)85 return post(data)86def dns_mode(overrides=None):87 defaults = {88 'cmd': 'dns_mode',89 }90 params = _update_params(defaults, overrides)91 return get(params)92def enable_pin(overrides=None):93 defaults = {94 'goformId': 'ENABLE_PIN',95 'OldPinNumber': '',96 'NewPinNumber': '',97 }98 data = _update_params(defaults, overrides)99 return post(data)100def enter_pin(overrides=None):101 defaults = {102 'goformId': 'ENTER_PIN',103 'PinNumber': '',104 }105 data = _update_params(defaults, overrides)106 return post(data)107def enter_puk(overrides=None):108 defaults = {109 'goformId': 'ENTER_PUK',110 'PUKNumber': '',111 'PinNumber': '',112 }113 data = _update_params(defaults, overrides)114 return post(data)115def get_sim_status(overrides=None):116 defaults = {117 'cmd': 'modem_main_state',118 }119 params = _update_params(defaults, overrides)120 return get(params)121def hardware_version(overrides=None):122 defaults = {123 'cmd': 'hardware_version',124 }125 params = _update_params(defaults, overrides)126 return get(params)127def if_upgrade(overrides=None):128 """129 select_op : "check", "1" (download), "2" (cancel)130 """131 defaults = {132 'goformId': 'IF_UPGRADE',133 'select_op': '',134 }135 data = _update_params(defaults, overrides)136 return post(data)137def imei(overrides=None):138 defaults = {139 'cmd': 'imei',140 }141 params = _update_params(defaults, overrides)142 return get(params)143def ipv4_apn_list(overrides=None):144 cmd = ','.join(['ipv4_apn_list' + str(i) for i in range(0, 10)])145 defaults = {146 'cmd': cmd,147 'multi_data': '1',148 }149 params = _update_params(defaults, overrides)150 return get(params)151def ipv6_apn_config(overrides=None):152 cmd = ','.join(['ipv6_APN_config' + str(i) for i in range(0, 10)])153 defaults = {154 'cmd': cmd,155 'multi_data': '1',156 }157 params = _update_params(defaults, overrides)158 return get(params)159def ipv6_apn_list(overrides=None):160 cmd = ','.join(['ipv6_apn_list' + str(i) for i in range(0, 10)])161 defaults = {162 'cmd': cmd,163 'multi_data': '1',164 }165 params = _update_params(defaults, overrides)166 return get(params)167def ipv6_dns_mode(overrides=None):168 defaults = {169 'cmd': 'ipv6_dns_mode',170 }171 params = _update_params(defaults, overrides)172 return get(params)173def ipv6_prefer_dns_auto(overrides=None):174 defaults = {175 'cmd': 'ipv6_prefer_dns_auto',176 }177 params = _update_params(defaults, overrides)178 return get(params)179def ipv6_prefer_dns_manual(overrides=None):180 defaults = {181 'cmd': 'ipv6_prefer_dns_manual',182 }183 params = _update_params(defaults, overrides)184 return get(params)185def ipv6_standby_dns_auto(overrides=None):186 defaults = {187 'cmd': 'ipv6_standby_dns_auto',188 }189 params = _update_params(defaults, overrides)190 return get(params)191def ipv6_standby_dns_manual(overrides=None):192 defaults = {193 'cmd': 'ipv6_standby_dns_manual',194 }195 params = _update_params(defaults, overrides)196 return get(params)197def ipv6_wan_apn(overrides=None):198 defaults = {199 'cmd': 'ipv6_wan_apn',200 }201 params = _update_params(defaults, overrides)202 return get(params)203def ipv6_wan_ipaddr(overrides=None):204 defaults = {205 'cmd': 'ipv6_wan_ipaddr',206 }207 params = _update_params(defaults, overrides)208 return get(params)209def is_msg_preview(overrides=None):210 defaults = {211 'cmd': 'is_msg_preview',212 }213 params = _update_params(defaults, overrides)214 return get(params)215def is_show_ssid_key_oled(overrides=None):216 defaults = {217 'cmd': 'is_show_ssid_key_oled',218 }219 params = _update_params(defaults, overrides)220 return get(params)221def lac_code(overrides=None):222 defaults = {223 'cmd': 'lac_code',224 }225 params = _update_params(defaults, overrides)226 return get(params)227def language(overrides=None):228 defaults = {229 'cmd': 'Language',230 }231 params = _update_params(defaults, overrides)232 return get(params)233def lan_ipaddr_for_current(overrides=None):234 defaults = {235 'cmd': 'lan_ipaddr_for_current',236 }237 params = _update_params(defaults, overrides)238 return get(params)239def localdomain_for_current(overrides=None):240 defaults = {241 'cmd': 'LocalDomain_for_current',242 }243 params = _update_params(defaults, overrides)244 return get(params)245def locked_hplmns(overrides=None):246 defaults = {247 'cmd': 'locked_hplmns',248 }249 params = _update_params(defaults, overrides)250 return get(params)251def lock_status(overrides=None):252 defaults = {253 'cmd': 'lock_status',254 }255 params = _update_params(defaults, overrides)256 return get(params)257def m_netselect_status(overrides=None):258 """259 Manual netselect status260 """261 defaults = {262 'cmd': 'm_netselect_status',263 'multi_data': '1',264 }265 params = _update_params(defaults, overrides)266 return get(params)267def modem_main_state(overrides=None):268 defaults = {269 'cmd': 'modem_main_state',270 }271 params = _update_params(defaults, overrides)272 return get(params)273def modem_model(overrides=None):274 defaults = {275 'cmd': 'modem_model',276 }277 params = _update_params(defaults, overrides)278 return get(params)279def modem_msn(overrides=None):280 defaults = {281 'cmd': 'modem_msn',282 }283 params = _update_params(defaults, overrides)284 return get(params)285def msisdn(overrides=None):286 defaults = {287 'cmd': 'msisdn',288 }289 params = _update_params(defaults, overrides)290 return get(params)291def net_select(overrides=None):292 defaults = {293 'cmd': 'net_select',294 }295 params = _update_params(defaults, overrides)296 return get(params)297def net_select_mode(overrides=None):298 defaults = {299 'cmd': 'net_select_mode',300 }301 params = _update_params(defaults, overrides)302 return get(params)303def network_provider_fullname(overrides=None):304 defaults = {305 'cmd': 'network_provider_fullname',306 }307 params = _update_params(defaults, overrides)308 return get(params)309def network_provider(overrides=None):310 defaults = {311 'cmd': 'network_provider',312 }313 params = _update_params(defaults, overrides)314 return get(params)315def network_type(overrides=None):316 defaults = {317 'cmd': 'network_type',318 }319 params = _update_params(defaults, overrides)320 return get(params)321def new_version_state(overrides=None):322 defaults = {323 'cmd': 'new_version_state',324 }325 params = _update_params(defaults, overrides)326 return get(params)327def pdp_type(overrides=None):328 defaults = {329 'cmd': 'pdp_type',330 }331 params = _update_params(defaults, overrides)332 return get(params)333def pinnumber(overrides=None):334 defaults = {335 'cmd': 'pinnumber',336 }337 params = _update_params(defaults, overrides)338 return get(params)339def pin_status(overrides=None):340 defaults = {341 'cmd': 'pin_status',342 }343 params = _update_params(defaults, overrides)344 return get(params)345def ppp_status(overrides=None):346 defaults = {347 'cmd': 'ppp_status',348 }349 params = _update_params(defaults, overrides)350 return get(params)351def prefer_dns_auto(overrides=None):352 defaults = {353 'cmd': 'prefer_dns_auto',354 }355 params = _update_params(defaults, overrides)356 return get(params)357def prefer_dns_manual(overrides=None):358 defaults = {359 'cmd': 'prefer_dns_manual',360 }361 params = _update_params(defaults, overrides)362 return get(params)363def puknumber(overrides=None):364 defaults = {365 'cmd': 'puknumber',366 }367 params = _update_params(defaults, overrides)368 return get(params)369def realtime_rx_thrpt(overrides=None):370 defaults = {371 'cmd': 'realtime_rx_thrpt',372 }373 params = _update_params(defaults, overrides)374 return get(params)375def realtime_time(overrides=None):376 defaults = {377 'cmd': 'realtime_time',378 }379 params = _update_params(defaults, overrides)380 return get(params)381def realtime_tx_thrpt(overrides=None):382 defaults = {383 'cmd': 'realtime_tx_thrpt',384 }385 params = _update_params(defaults, overrides)386 return get(params)387def reboot_device(overrides=None):388 defaults = {389 'goformId': 'REBOOT_DEVICE',390 }391 data = _update_params(defaults, overrides)392 return post(data)393def reset_data_counter_ex(overrides=None):394 defaults = {395 'goformId': 'RESET_DATA_COUNTER_EX',396 'reset_wan_statistics_option': 'total',397 }398 data = _update_params(defaults, overrides)399 return post(data)400def restore_factory_settings(overrides=None):401 defaults = {402 'goformId': 'RESTORE_FACTORY_SETTINGS',403 }404 data = _update_params(defaults, overrides)405 return post(data)406def rmcc(overrides=None):407 defaults = {408 'cmd': 'rmcc',409 }410 params = _update_params(defaults, overrides)411 return get(params)412def rmnc(overrides=None):413 defaults = {414 'cmd': 'rmnc',415 }416 params = _update_params(defaults, overrides)417 return get(params)418def roam_setting_option(overrides=None):419 defaults = {420 'cmd': 'roam_setting_option',421 }422 params = _update_params(defaults, overrides)423 return get(params)424def save_phone_number(overrides=None):425 defaults = {426 'goformId': 'SAVE_PHONE_NUMBER',427 'Phone_Num': '',428 }429 data = _update_params(defaults, overrides)430 return post(data)431def save_sms(overrides=None):432 """433 Save sms434 Args435 overrides (dict):436 SMSNumber: ';' (empty) 'X;' (singular) 'X;Y;Z;' (multiple)437 sms_time:438 SMSMessage: '' (empty)439 Index: -1 (new), n (replace n)440 encode_type: GSM7_default, GSM7_turkey, UNICODE441 """442 defaults = {443 'goformId': 'SAVE_SMS',444 'location': '1',445 'tags': '4',446 'SMSNumber': '',447 'SMSMessage': '',448 'Index': '-1',449 'encode_type': 'GSM7_default',450 'sms_time': '',451 }452 data = _update_params(defaults, overrides)453 return post(data)454def scan_network(overrides=None):455 defaults = {456 'goformId': 'SCAN_NETWORK',457 }458 data = _update_params(defaults, overrides)459 return post(data)460def send_sms(overrides=None):461 """462 Send sms463 Args464 overrides (dict):465 Number: ';' (empty) 'X;' (singular) 'X;Y;Z;' (multiple)466 sms_time:467 MessageBody: '' (empty)468 ID: -1 (new), n (replace n)469 encode_type: GSM7_default, GSM7_turkey, UNICODE470 """471 defaults = {472 'goformId': 'SEND_SMS',473 'Number': '',474 'sms_time': '',475 'MessageBody': '',476 'ID': '-1',477 'encode_type': 'GSM7_default',478 }479 data = _update_params(defaults, overrides)480 return post(data)481def set_account_type(overrides=None):482 """483 Set acount type484 Args485 overrides (dict):486 AccountType: 'Contract', 'Prepaid', 'Custom'487 """488 defaults = {489 'goformId': 'SET_ACCOUNT_TYPE',490 'AccountType': '',491 }492 data = _update_params(defaults, overrides)493 return post(data)494def set_auto_account_type_v4v6(overrides=None):495 defaults = {496 'goformId': 'SET_AUTO_ACCOUNT_TYPE_V4V6',497 'APN': '',498 'Number': '',499 'DNS': '',500 'DNS2': '',501 'Security': '',502 'Username': '',503 'Password': '',504 'dns_mode': '',505 'pdp_select': '',506 'pdp_addr': '',507 'account_type': '',508 'reporting_account_type': '',509 'ipv6_wan_apn': '',510 'wan_dial': '',511 'ipv6_ppp_auth_mode': '',512 'ipv6_ppp_username': '',513 'ipv6_ppp_passwd': '',514 'ipv6_dns_mode': '',515 'ipv6_prefer_dns_manual': '',516 'ipv6_standby_dns_manual': '',517 'ipv6_pdp_select': '',518 'ipv6_pdp_addr': '',519 }520 data = _update_params(defaults, overrides)521 return post(data)522def set_bearer_preference(overrides=None):523 """524 BearerPreference: "Only_GSM", "Only_WCDMA"525 "WCDMA_preferred", "Only_LTE", "NETWORK_auto",526 """527 defaults = {528 'goformId': 'SET_BEARER_PREFERENCE',529 'BearerPreference': '',530 }531 data = _update_params(defaults, overrides)532 return post(data)533def set_connection_mode(overrides=None):534 """535 ConnectionMode: "auto_dial", "manual_dial", "demand_dial"536 roam_setting_option: "on", "off"537 """538 defaults = {539 'goformId': 'SET_CONNECTION_MODE',540 'ConnectionMode': '',541 'roam_setting_option': '',542 }543 data = _update_params(defaults, overrides)544 return post(data)545def set_dial_ip_type(overrides=None):546 """547 ip_type: "IP", "IPV6", "IPV4V6"548 """549 defaults = {550 'goformId': 'SET_DIAL_IP_TYPE',551 'ip_type': '',552 }553 data = _update_params(defaults, overrides)554 return post(data)555def set_message_center(overrides=None):556 defaults = {557 'goformId': 'SET_MESSAGE_CENTER',558 'save_time': 'largest',559 'status_save': '0',560 'save_location': 'native',561 'MessageCenter': '',562 }563 data = _update_params(defaults, overrides)564 return post(data)565def set_msg_preview_status(overrides=None):566 """567 isMessagePreview : "0", "1"568 """569 defaults = {570 'goformId': 'SET_MSG_PREVIEW_STATUS',571 'isMessagePreview': '',572 }573 data = _update_params(defaults, overrides)574 return post(data)575def set_msg_read(overrides=None):576 defaults = {577 'goformId': 'SET_MSG_READ',578 'msg_id': '',579 'tag': '0',580 }581 data = _update_params(defaults, overrides)582 return post(data)583def set_network(overrides=None):584 """585 NetworkNumber: a valid mccmnc586 Rat: "0" (2G), "2" (3G), "7" (4G)587 """588 defaults = {589 'goformId': 'SET_NETWORK',590 'NetworkNumber': '',591 'Rat': '',592 }593 data = _update_params(defaults, overrides)594 return post(data)595def set_remind_flag(overrides=None):596 defaults = {597 'goformId': 'SET_REMIND_FLAG',598 'sms_remind': '0',599 'redirect_flag': '',600 }601 data = _update_params(defaults, overrides)602 return post(data)603def set_show_ssid_key_oled(overrides=None):604 """605 doubleTapEnabled : "0", "1"606 """607 defaults = {608 'goformId': 'SET_SHOW_SSID_KEY_OLED',609 'doubleTapEnabled': '',610 }611 data = _update_params(defaults, overrides)612 return post(data)613def set_web_language(overrides=None):614 """615 Language: ISO-3166. ie: "en-gb"616 """617 defaults = {618 'goformId': 'SET_WEB_LANGUAGE',619 'Language': '',620 }621 data = _update_params(defaults, overrides)622 return post(data)623def signalbar(overrides=None):624 defaults = {625 'cmd': 'signalbar',626 }627 params = _update_params(defaults, overrides)628 return get(params)629def simcard_roam(overrides=None):630 defaults = {631 'cmd': 'simcard_roam',632 }633 params = _update_params(defaults, overrides)634 return get(params)635def sim_active_result(overrides=None):636 defaults = {637 'cmd': 'sim_active_result',638 }639 params = _update_params(defaults, overrides)640 return get(params)641def sim_iccid(overrides=None):642 defaults = {643 'cmd': 'sim_iccid',644 }645 params = _update_params(defaults, overrides)646 return get(params)647def sim_imsi(overrides=None):648 defaults = {649 'cmd': 'sim_imsi',650 }651 params = _update_params(defaults, overrides)652 return get(params)653def sms_capacity_info(overrides=None):654 """655 Sms Capacity Info656 """657 defaults = {658 'cmd': 'sms_capacity_info',659 }660 params = _update_params(defaults, overrides)661 return get(params)662def sms_cmd_status_info(overrides=None):663 """664 Sms Cmd Status Info665 Args666 overrides (dict):667 sms_cmd: 3 (set message center), 4 (send), 5 (save), 6 (delete)668 """669 defaults = {670 'cmd': 'sms_cmd_status_info',671 'sms_cmd': '',672 }673 params = _update_params(defaults, overrides)674 return get(params)675def sms_page_data(overrides=None):676 """677 Sms Page Data678 Args679 overrides (dict):680 tags: 2 (outbox), 10 (dustbin), 11 (draftbox), 12 (inbox)681 """682 defaults = {683 'cmd': 'sms_page_data',684 'page': '0',685 'data_per_page': '10',686 'mem_store': '1',687 'tags': '',688 'order_by': 'order by id desc',689 }690 params = _update_params(defaults, overrides)691 return get(params)692def sms_parameter_info(overrides=None):693 defaults = {694 'cmd': 'sms_parameter_info',695 }696 params = _update_params(defaults, overrides)697 return get(params)698def sms_received_flag(overrides=None):699 """700 Sms Recieved Flag701 """702 defaults = {703 'cmd': 'sms_received_flag',704 }705 params = _update_params(defaults, overrides)706 return get(params)707def sms_received_flag_flag(overrides=None):708 """709 Clear Sms Recieved Flag710 (this get request changes device state)711 """712 defaults = {713 'cmd': 'sms_received_flag',714 'sms_received_flag_flag': '0',715 'multi_data': '1',716 }717 params = _update_params(defaults, overrides)718 return get(params)719def sms_remind(overrides=None):720 defaults = {721 'cmd': 'sms_remind',722 }723 params = _update_params(defaults, overrides)724 return get(params)725def sms_unread_num(overrides=None):726 defaults = {727 'cmd': 'sms_unread_num',728 'multi_data': '1',729 }730 params = _update_params(defaults, overrides)731 return get(params)732def sntp_time(overrides=None):733 defaults = {734 'cmd': 'sntp_time',735 'multi_data': '1',736 }737 params = _update_params(defaults, overrides)738 return get(params)739def standby_dns_auto(overrides=None):740 defaults = {741 'cmd': 'standby_dns_auto',742 }743 params = _update_params(defaults, overrides)744 return get(params)745def standby_dns_manual(overrides=None):746 defaults = {747 'cmd': 'standby_dns_manual',748 }749 params = _update_params(defaults, overrides)750 return get(params)751def sv_of_imeisv(overrides=None):752 defaults = {753 'cmd': 'sv_of_imeisv',754 }755 params = _update_params(defaults, overrides)756 return get(params)757def system_uptime(overrides=None):758 defaults = {759 'cmd': 'system_uptime',760 'multi_data': '1',761 }762 params = _update_params(defaults, overrides)763 return get(params)764def total_rx_bytes(overrides=None):765 defaults = {766 'cmd': 'total_rx_bytes',767 }768 params = _update_params(defaults, overrides)769 return get(params)770def total_time(overrides=None):771 defaults = {772 'cmd': 'total_time',773 }774 params = _update_params(defaults, overrides)775 return get(params)776def total_tx_bytes(overrides=None):777 defaults = {778 'cmd': 'total_tx_bytes',779 }780 params = _update_params(defaults, overrides)781 return get(params)782def unlock_nck_time(overrides=None):783 defaults = {784 'cmd': 'unlock_nck_time',785 }786 params = _update_params(defaults, overrides)787 return get(params)788def unlock_network(overrides=None):789 defaults = {790 'goformId': 'UNLOCK_NETWORK',791 'unlock_network_code': '',792 }793 data = _update_params(defaults, overrides)794 return post(data)795def update_info(overrides=None):796 defaults = {797 'cmd': 'update_info',798 }799 params = _update_params(defaults, overrides)800 return get(params)801def upgrade_result(overrides=None):802 defaults = {803 'cmd': 'upgrade_result',804 }805 params = _update_params(defaults, overrides)806 return get(params)807def ussd_data_info(overrides=None):808 defaults = {809 'cmd': 'ussd_data_info',810 }811 params = _update_params(defaults, overrides)812 return get(params)813def ussd_process(overrides=None):814 defaults = {815 'goformId': 'USSD_PROCESS',816 'USSD_operator': 'ussd_send',817 'USSD_send_number': '',818 }819 data = _update_params(defaults, overrides)820 return post(data)821def ussd_write_flag(overrides=None):822 defaults = {823 'cmd': 'ussd_write_flag',824 }825 params = _update_params(defaults, overrides)826 return get(params)827def wa_inner_version(overrides=None):828 defaults = {829 'cmd': 'wa_inner_version',830 }831 params = _update_params(defaults, overrides)832 return get(params)833def wan_apn(overrides=None):834 defaults = {835 'cmd': 'wan_apn',836 }837 params = _update_params(defaults, overrides)838 return get(params)839def wan_ipaddr(overrides=None):840 defaults = {841 'cmd': 'wan_ipaddr',842 }843 params = _update_params(defaults, overrides)844 return get(params)845def wan_manual_contents_long(overrides=None):846 defaults = {847 'cmd': 'wan_manual_contents_long',848 }849 params = _update_params(defaults, overrides)850 return get(params)851def webui_product_name(overrides=None):852 defaults = {853 'cmd': 'webui_product_name',854 }855 params = _update_params(defaults, overrides)856 return get(params)857def _update_params(defaults, overrides):858 def is_str(value):859 return isinstance(value, str)860 logging.getLogger(__name__).debug('Defaults: %s', defaults)861 logging.getLogger(__name__).debug('Overrides: %s', overrides)862 params = defaults863 if overrides and isinstance(overrides, dict):864 # remove any non string key/values from the supplied inputs865 overrides = {k: v for k, v in overrides.items() if is_str(k)866 and is_str(v)}867 # take any new values iff the key exists in the defaults868 updates = {k: overrides[k]869 for k in defaults.keys() if k in overrides.keys()}870 # take a copy of the defaults and update with the valid overrides871 params = defaults.copy()...

Full Screen

Full Screen

controller.py

Source:controller.py Github

copy

Full Screen

...51 # rospy.set_param("motorPowerSet/m2", 65535)52 # rospy.set_param("motorPowerSet/m3", 65535)53 # rospy.set_param("motorPowerSet/m4", 65535)54 ## update the params55 # self._update_params(["motorPowerSet/m1"])56 # self._update_params(["motorPowerSet/m2"])57 # self._update_params(["motorPowerSet/m3"])58 # self._update_params(["motorPowerSet/m4"])59 params_list = [["ctrlMel/massThrust"], ["commander/enHighLevel"], ["stabilizer/estimator"], ["stabilizer/controller"],60 ["kalman/resetEstimation"], ["ctrlMel/mass"], ["ctrlMel/i_range_z"], ["ctrlMel/i_range_y"], ["ctrlMel/i_range_x"], 61 ["ctrlMel/i_range_m_z"], ["ctrlMel/i_range_m_y"], ["ctrlMel/i_range_m_x"], ["ctrlMel/kR_x"], ["ctrlMel/kw_x"], ["myTraj/oscmagnitude"], 62 ["ctrlMel/kR_y"], ["ctrlMel/kw_y"], ["ctrlMel/kR_z"], ["ctrlMel/kw_z"], ["ctrlMel/kd_omega_rp"], ["ctrlMel/kp_x"],63 ["ctrlMel/kd_x"], ["ctrlMel/ki_x"], ["ctrlMel/kp_y"], ["ctrlMel/kd_y"], ["ctrlMel/ki_y"], ["ctrlMel/kp_z"], ["myTraj/height"],64 ["ctrlMel/kd_z"], ["ctrlMel/ki_z"], ["ctrlMel/ki_m_x"], ["ctrlMel/ki_m_y"], ["ctrlMel/ki_m_z"], ["ctrlMel/time_instance"]]65 for i in range(len(params_list)):66 self._update_params(params_list[i])67 time.sleep(0.05)68 time.sleep(1.0)69 rospy.loginfo(rospy.get_namespace()+": waiting for emergency service")70 rospy.wait_for_service('emergency')71 rospy.loginfo(rospy.get_namespace()+": found emergency service")72 self._emergency = rospy.ServiceProxy('emergency', Empty)73 if use_controller:74 rospy.loginfo(rospy.get_namespace()+": waiting for land service")75 rospy.wait_for_service('land')76 rospy.loginfo(rospy.get_namespace()+": found land service")77 self._land = rospy.ServiceProxy('land', Empty)78 rospy.loginfo(rospy.get_namespace()+": waiting for takeoff service")79 rospy.wait_for_service('takeoff')80 rospy.loginfo(rospy.get_namespace()+": found takeoff service")81 self._takeoff = rospy.ServiceProxy('takeoff', Empty)82 else:83 self._land = None84 self._takeoff = None85 # subscribe to the joystick at the end to make sure that all required86 # services were found87 self._buttons = None88 rospy.Subscriber(joy_topic, Joy, self._joyChanged)89 def _joyChanged(self, data):90 if data.axes[7] != 0:91 angle = rospy.get_param("myTraj/oscmagnitude")92 rospy.set_param("myTraj/oscmagnitude", angle+0.02*data.axes[7])93 self._update_params(["myTraj/oscmagnitude"])94 pass95 96 for i in range(0, len(data.buttons)):97 if self._buttons == None or data.buttons[i] != self._buttons[i]:98 if i == 0 and data.buttons[i] == 1 and self._land != None:99 self._land()100 if i == 1 and data.buttons[i] == 1:101 self._emergency()102 if i == 2 and data.buttons[i] == 1 and self._takeoff != None:103 rospy.set_param("ctrlMel/i_m_err_z_init", 1.1)104 rospy.set_param("ctrlMel/i_m_err_x_init", -3.8)105 rospy.set_param("ctrlMel/i_m_err_y_init", 1.9)106 rospy.set_param("ctrlMel/i_err_z_init", 3.5)107 rospy.set_param("ctrlMel/i_err_x_init", 1.2)108 rospy.set_param("ctrlMel/i_err_y_init", -1.2)109 params_list = [["ctrlMel/i_m_err_z_init"], ["ctrlMel/i_m_err_x_init"],["ctrlMel/i_m_err_y_init"], 110 ["ctrlMel/i_err_z_init"], ["ctrlMel/i_err_x_init"], ["ctrlMel/i_err_y_init"]]111 for i in range(len(params_list)):112 self._update_params(params_list[i])113 self._takeoff()114 if i == 4 and data.buttons[i] == 1:115 value = int(rospy.get_param("ring/headlightEnable"))116 if value == 0:117 rospy.set_param("ring/headlightEnable", 1)118 else:119 rospy.set_param("ring/headlightEnable", 0)120 self._update_params(["ring/headlightEnable"])121 print(not value)122 self._buttons = data.buttons123if __name__ == '__main__':124 rospy.init_node('crazyflie_demo_controller', anonymous=True)125 use_controller = rospy.get_param("~use_crazyflie_controller", False)126 joy_topic = rospy.get_param("~joy_topic", "joy")127 controller = Controller(use_controller, joy_topic)...

Full Screen

Full Screen

managers.py

Source:managers.py Github

copy

Full Screen

...3from django.utils.encoding import smart_text4from .fields import currency_field_name5__all__ = ('QuerysetWithMoney', 'MoneyManager',)6class QuerysetWithMoney(QuerySet):7 def _update_params(self, kwargs):8 from django.db.models.constants import LOOKUP_SEP9 from money.money import Money10 to_append = {}11 for name, value in kwargs.items():12 if isinstance(value, Money):13 path = name.split(LOOKUP_SEP)14 if len(path) > 1:15 field_name = currency_field_name(path[0])16 else:17 field_name = currency_field_name(name)18 to_append[field_name] = smart_text(value.currency)19 kwargs.update(to_append)20 return kwargs21 def dates(self, *args, **kwargs):22 kwargs = self._update_params(kwargs)23 return super(QuerysetWithMoney, self).dates(*args, **kwargs)24 def distinct(self, *args, **kwargs):25 kwargs = self._update_params(kwargs)26 return super(QuerysetWithMoney, self).distinct(*args, **kwargs)27 def extra(self, *args, **kwargs):28 kwargs = self._update_params(kwargs)29 return super(QuerysetWithMoney, self).extra(*args, **kwargs)30 def get(self, *args, **kwargs):31 kwargs = self._update_params(kwargs)32 return super(QuerysetWithMoney, self).get(*args, **kwargs)33 def get_or_create(self, **kwargs):34 kwargs = self._update_params(kwargs)35 return super(QuerysetWithMoney, self).get_or_create(**kwargs)36 def filter(self, *args, **kwargs):37 kwargs = self._update_params(kwargs)38 return super(QuerysetWithMoney, self).filter(*args, **kwargs)39 def complex_filter(self, *args, **kwargs):40 kwargs = self._update_params(kwargs)41 return super(QuerysetWithMoney, self).complex_filter(*args, **kwargs)42 def exclude(self, *args, **kwargs):43 kwargs = self._update_params(kwargs)44 return super(QuerysetWithMoney, self).exclude(*args, **kwargs)45 def in_bulk(self, *args, **kwargs):46 kwargs = self._update_params(kwargs)47 return super(QuerysetWithMoney, self).in_bulk(*args, **kwargs)48 def iterator(self, *args, **kwargs):49 kwargs = self._update_params(kwargs)50 return super(QuerysetWithMoney, self).iterator(*args, **kwargs)51 def latest(self, *args, **kwargs):52 kwargs = self._update_params(kwargs)53 return super(QuerysetWithMoney, self).latest(*args, **kwargs)54 def order_by(self, *args, **kwargs):55 kwargs = self._update_params(kwargs)56 return super(QuerysetWithMoney, self).order_by(*args, **kwargs)57 def select_related(self, *args, **kwargs):58 kwargs = self._update_params(kwargs)59 return super(QuerysetWithMoney, self).select_related(*args, **kwargs)60 def values(self, *args, **kwargs):61 kwargs = self._update_params(kwargs)62 return super(QuerysetWithMoney, self).values(*args, **kwargs)63class MoneyManager(models.Manager):64 def get_queryset(self):...

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 localstack 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