Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery Starbot ⭐ refactored s-rigaud/pyTelloSDK #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SourceryAI
Copy link

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch https://github.com/sourcery-ai-bot/pyTelloSDK master
git merge --ff-only FETCH_HEAD
git reset HEAD^

except (ModuleNotFoundError, ImportError):
except ImportError:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 35-45 refactored with the following changes:

ip_net = ipaddress.ip_network(interface + '/24', strict=False)
ip_net = ipaddress.ip_network(f'{interface}/24', strict=False)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function AbstractDrone.get_all_drones refactored with the following changes:

Comment on lines -260 to +288
if self.is_connected:
flight_mode = flight_mode.lower().strip()
if flight_mode == 'open pipe':
self.flight_mode = OpenPipeMode(self)

elif flight_mode == 'reactive':
self.flight_mode = ReactiveMode(self)

elif flight_mode == 'act from file':
if options.get('filename') is None:
self.end_connection = True
raise TypeError("You forgot filename argument. \nSee : https://github.com/s-rigaud/dev-pyTelloSDK#flightmodes for help")
else:
self.flight_mode = ActFromFileMode(self, **options)

elif flight_mode == 'act from list':
if options.get('actions') is None:
self.end_connection = True
raise TypeError("You forgot actions argument. \nSee : https://github.com/s-rigaud/dev-pyTelloSDK#flightmodes for help")
self.flight_mode = ActFromActionListMode(self, **options)

elif flight_mode == 'picture mission':
if NO_VIDEO_DECODER:
raise NoVideoDecoderError("Be sure you have access to either av library or libh264decoder")
self.flight_mode = PictureMission(self, **options)
if not self.is_connected:
return
flight_mode = flight_mode.lower().strip()
if flight_mode == 'act from file':
if options.get('filename') is None:
self.end_connection = True
raise TypeError("You forgot filename argument. \nSee : https://github.com/s-rigaud/dev-pyTelloSDK#flightmodes for help")
else:
print('You enter an unrecognize flight mode')
self.flight_mode = ActFromFileMode(self, **options)

elif flight_mode == 'act from list':
if options.get('actions') is None:
self.end_connection = True
raise TypeError("You forgot actions argument. \nSee : https://github.com/s-rigaud/dev-pyTelloSDK#flightmodes for help")
self.flight_mode = ActFromActionListMode(self, **options)

elif flight_mode == 'open pipe':
self.flight_mode = OpenPipeMode(self)

elif flight_mode == 'picture mission':
if NO_VIDEO_DECODER:
raise NoVideoDecoderError("Be sure you have access to either av library or libh264decoder")
self.flight_mode = PictureMission(self, **options)
elif flight_mode == 'reactive':
self.flight_mode = ReactiveMode(self)

else:
print('You enter an unrecognize flight mode')
self.end_connection = True
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function AbstractDrone.init_flight_mode refactored with the following changes:

Comment on lines -350 to +351
elif AV_AVAILABLE:
else:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function AbstractDrone.process_frame refactored with the following changes:

@@ -52,7 +52,6 @@ def start(self, **options):
self.swarm.end_connection = True
self.swarm.command_socket.close()
break
# Useless escape chars
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function ReactiveMode.start refactored with the following changes:

This removes the following comments ( why? ):

# Useless escape chars

data = data + self.queue[0]
data += self.queue[0]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function VideoStream.read refactored with the following changes:

  • Replace assignment with augmented assignment (aug-assign)

Comment on lines -24 to +26
print("Sending message: " + message)
print(f"Sending message: {message}")
except Exception as exc:
print("Error sending: " + str(exc))
print(f"Error sending: {str(exc)}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function send refactored with the following changes:

Comment on lines -38 to +40
print("Sending message: " + message)
print(f"Sending message: {message}")
except Exception as exc:
print("Error sending: " + str(exc))
print(f"Error sending: {str(exc)}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function send refactored with the following changes:

Comment on lines -16 to +18
print("Sending message: " + message)
print(f"Sending message: {message}")
except Exception as exc:
print("Error sending: " + str(exc))
print(f"Error sending: {str(exc)}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function send refactored with the following changes:

Comment on lines -16 to +18
print("Sending message: " + message)
print(f"Sending message: {message}")
except Exception as e:
print("Error sending: " + str(e))
print(f"Error sending: {str(e)}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function send refactored with the following changes:

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant