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 refactored master branch #1

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

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Dec 1, 2021

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 MattFisher December 1, 2021 02:13
video_file_url = smallest_video['url'] + '.mp4' # Append extension
return video_file_url
return smallest_video['url'] + '.mp4'
Copy link
Author

Choose a reason for hiding this comment

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

Function find_smallest_video_asset_url refactored with the following changes:

This removes the following comments ( why? ):

# Append extension

Comment on lines -123 to +122
media_data = r.json()
return media_data
return r.json()
Copy link
Author

Choose a reason for hiding this comment

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

Function show_media refactored with the following changes:

Comment on lines -133 to +131
srt_file_name = autosub.generate_subtitles(source_path=video_file_name)
return srt_file_name
return autosub.generate_subtitles(source_path=video_file_name)
Copy link
Author

Choose a reason for hiding this comment

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

Function autosub_video_file refactored with the following changes:

Comment on lines -155 to +164
base_url = 'https://api.wistia.com/v1'
url_template = '{base_url}/medias/{media_hashed_id}/captions/{language_code}.json'
if replace and replaceable_captions:
base_url = 'https://api.wistia.com/v1'
url_template = '{base_url}/medias/{media_hashed_id}/captions/{language_code}.json'
detail_url = url_template.format(
base_url=base_url,
media_hashed_id=wistia_hashed_id,
language_code=language_code,
)
r = s.put(detail_url, files=files)
r.raise_for_status()

else:
r = s.post(list_url, data=dict(language_code=language_code), files=files)
r.raise_for_status()

r.raise_for_status()
Copy link
Author

Choose a reason for hiding this comment

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

Function upload_subtitle_file_to_wistia_video refactored with the following changes:

Comment on lines -283 to +279
args = parser.parse_args()
return args
return parser.parse_args()
Copy link
Author

Choose a reason for hiding this comment

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

Function main.parse_arguments refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Dec 1, 2021

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.06%.

Quality metrics Before After Change
Complexity 1.63 ⭐ 1.66 ⭐ 0.03 👎
Method Length 48.28 ⭐ 47.39 ⭐ -0.89 👍
Working memory 7.31 🙂 7.31 🙂 0.00
Quality 78.23% 78.29% 0.06% 👍
Other metrics Before After Change
Lines 265 260 -5
Changed files Quality Before Quality After Quality Change
wistitler.py 78.23% ⭐ 78.29% ⭐ 0.06% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
wistitler.py upload_subtitle_file_to_wistia_video 3 ⭐ 100 🙂 12 😞 62.38% 🙂 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