Skip to content

Sourcery refactored master branch#1

Open
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master
Open

Sourcery refactored master branch#1
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master

Conversation

@sourcery-ai
Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot commented Aug 22, 2022

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

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

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from dcgithubaccount August 22, 2022 19:47

def __init__(self, key):
self.URL = 'https://www.googleapis.com/qpxExpress/v1/trips/search?key=%s'%key
self.URL = f'https://www.googleapis.com/qpxExpress/v1/trips/search?key={key}'
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function GoogleFlight.__init__ refactored with the following changes:

Comment on lines -59 to +73
Slice = 0
for s in trip["slice"]:
Slice = Slice + 1
print (" Slice %s" % Slice)
for flight in s["segment"]:
flight_number = flight["flight"]["number"]
flight_carrier = flight["flight"]["carrier"]
flight_origin = flight['leg'][0]['origin']
flight_departureTime = flight['leg'][0]['departureTime']
flight_destination = flight['leg'][0]['destination']
flight_arrivalTime = flight['leg'][0]['arrivalTime']
flight_mileage = flight['leg'][0]['mileage']
print (" %s%s %s %s %s %s %s mileage"%(flight_carrier, flight_number, flight_origin, flight_departureTime, flight_destination, flight_arrivalTime, flight_mileage))
Slice = 0
for s in trip["slice"]:
Slice = Slice + 1
print(f" Slice {Slice}")
for flight in s["segment"]:
flight_number = flight["flight"]["number"]
flight_carrier = flight["flight"]["carrier"]
flight_origin = flight['leg'][0]['origin']
flight_departureTime = flight['leg'][0]['departureTime']
flight_destination = flight['leg'][0]['destination']
flight_arrivalTime = flight['leg'][0]['arrivalTime']
flight_mileage = flight['leg'][0]['mileage']
print(
f" {flight_carrier}{flight_number} {flight_origin} {flight_departureTime} {flight_destination} {flight_arrivalTime} {flight_mileage} mileage"
)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function GoogleFlight.print_trip refactored with the following changes:

Comment on lines -87 to +89

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Found the following improvement in Function GoogleFlight.lowest:

@sourcery-ai
Copy link
Copy Markdown
Author

sourcery-ai bot commented Aug 22, 2022

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.44%.

Quality metrics Before After Change
Complexity 2.07 ⭐ 2.07 ⭐ 0.00
Method Length 49.25 ⭐ 51.00 ⭐ 1.75 👎
Working memory 6.95 🙂 6.95 🙂 0.00
Quality 79.16% 78.72% -0.44% 👎
Other metrics Before After Change
Lines 76 78 2
Changed files Quality Before Quality After Quality Change
google_flight_api.py 79.16% ⭐ 78.72% ⭐ -0.44% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
google_flight_api.py GoogleFlight.print_trip 3 ⭐ 118 🙂 11 😞 61.75% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

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.

0 participants