Skip to content

Commit

Permalink
mark static methods with @staticmethod and dont use self in them
Browse files Browse the repository at this point in the history
  • Loading branch information
M4GNV5 committed Mar 21, 2020
1 parent 552edd1 commit 2f55324
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions djitellopy/tello.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def get_own_udp_object(self):
host = self.address[0]
return drones[host]

@staticmethod
def udp_response_receiver():
"""Setup drone UDP receiver. This method listens for responses of Tello.
Must be run from a background thread in order to not block the main thread."""
Expand All @@ -130,9 +131,10 @@ def udp_response_receiver():

drones[address]['responses'].append(data)
except Exception as e:
self.LOGGER.error(e)
Tello.LOGGER.error(e)
break

@staticmethod
def udp_state_receiver():
"""Setup state UDP receiver. This method listens for state infor from
the Tello. Must be run from a background thread in order to not block
Expand All @@ -150,9 +152,10 @@ def udp_state_receiver():

drones[address]['state'] = Tello.parse_state(data)
except Exception as e:
self.LOGGER.error(e)
Tello.LOGGER.error(e)
break

@staticmethod
def parse_state(state):
"""Parse a state line to a dict"""
state = state.decode('ASCII').strip()
Expand All @@ -173,7 +176,7 @@ def parse_state(state):
try:
value = Tello.state_field_converters[key](value)
except Exception as e:
self.LOGGER.error(e)
Tello.LOGGER.error(e)

state_obj[key] = value

Expand Down

0 comments on commit 2f55324

Please sign in to comment.