(klass, method, arg, val, signature)
| 551 | |
| 552 | @staticmethod |
| 553 | def to_python(klass, method, arg, val, signature): |
| 554 | val = fixups.base_to_python(val) |
| 555 | klass_af = {'IP4Config': socket.AF_INET, 'IP6Config': socket.AF_INET6}.get(klass, socket.AF_INET) |
| 556 | if method == 'Get': |
| 557 | if arg == 'Ip4Address': |
| 558 | return fixups.addr_to_python(val, socket.AF_INET) |
| 559 | if arg == 'Ip6Address': |
| 560 | return fixups.addr_to_python(val, socket.AF_INET6) |
| 561 | if arg == 'Ssid': |
| 562 | return fixups.ssid_to_python(val) |
| 563 | if arg == 'Strength': |
| 564 | return fixups.strength_to_python(val) |
| 565 | if arg == 'Addresses': |
| 566 | return [fixups.addrconf_to_python(addr, klass_af) for addr in val] |
| 567 | if arg == 'Routes': |
| 568 | return [fixups.route_to_python(route, klass_af) for route in val] |
| 569 | if arg in ('Nameservers', 'WinsServers'): |
| 570 | return [fixups.addr_to_python(addr, klass_af) for addr in val] |
| 571 | if arg == 'Options': |
| 572 | for key in val: |
| 573 | if key.startswith('requested_'): |
| 574 | val[key] = bool(int(val[key])) |
| 575 | elif val[key].isdigit(): |
| 576 | val[key] = int(val[key]) |
| 577 | elif key in ('domain_name_servers', 'ntp_servers', 'routers'): |
| 578 | val[key] = val[key].split() |
| 579 | |
| 580 | return val |
| 581 | if method == 'GetSettings': |
| 582 | if 'ssid' in val.get('802-11-wireless', {}): |
| 583 | val['802-11-wireless']['ssid'] = fixups.ssid_to_python(val['802-11-wireless']['ssid']) |
| 584 | for key in val: |
| 585 | val_ = val[key] |
| 586 | if 'mac-address' in val_: |
| 587 | val_['mac-address'] = fixups.mac_to_python(val_['mac-address']) |
| 588 | if 'cloned-mac-address' in val_: |
| 589 | val_['cloned-mac-address'] = fixups.mac_to_python(val_['cloned-mac-address']) |
| 590 | if 'bssid' in val_: |
| 591 | val_['bssid'] = fixups.mac_to_python(val_['bssid']) |
| 592 | if 'ipv4' in val: |
| 593 | val['ipv4']['addresses'] = [fixups.addrconf_to_python(addr,socket.AF_INET) for addr in val['ipv4']['addresses']] |
| 594 | val['ipv4']['routes'] = [fixups.route_to_python(route,socket.AF_INET) for route in val['ipv4']['routes']] |
| 595 | val['ipv4']['dns'] = [fixups.addr_to_python(addr,socket.AF_INET) for addr in val['ipv4']['dns']] |
| 596 | if 'ipv6' in val: |
| 597 | val['ipv6']['addresses'] = [fixups.addrconf_to_python(addr,socket.AF_INET6) for addr in val['ipv6']['addresses']] |
| 598 | val['ipv6']['routes'] = [fixups.route_to_python(route,socket.AF_INET6) for route in val['ipv6']['routes']] |
| 599 | val['ipv6']['dns'] = [fixups.addr_to_python(addr,socket.AF_INET6) for addr in val['ipv6']['dns']] |
| 600 | return val |
| 601 | if method == 'PropertiesChanged': |
| 602 | for prop in val: |
| 603 | val[prop] = fixups.to_python(klass, 'Get', prop, val[prop], None) |
| 604 | return val |
| 605 | |
| 606 | @staticmethod |
| 607 | def base_to_python(val): |
no test coverage detected