Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
state = state.strip()
Tello.LOGGER.debug('Raw state data: {}'.format(state))
if state == 'ok':
return {}
state_dict = {}
for field in state.split(';'):
split = field.split(':')
if len(split) < 2:
continue
key = split[0]
value = split[1]
if key in Tello.state_field_converters:
try:
value = Tello.state_field_converters[key](value)
except Exception as e:
Tello.LOGGER.debug('Error parsing state value for {}: {} to {}'
.format(key, value, Tello.state_field_converters[key]))
Tello.LOGGER.error(e)
state_dict[key] = value
return state_dict
def fromIps(ips: list):
"""Create TelloSwarm from a list of IP addresses.
Arguments:
ips: list of IP Addresses
"""
if len(ips) == 0:
raise Exception("No ips provided")
tellos = []
for ip in ips:
tellos.append(Tello(ip.strip()))
return TelloSwarm(tellos)