Sourcery refactored master branch#1
Conversation
| smallest_video = sorted(video_assets, key=lambda v: v['fileSize'])[0] | ||
| video_file_url = smallest_video['url'] + '.mp4' # Append extension | ||
| return video_file_url | ||
| return smallest_video['url'] + '.mp4' |
There was a problem hiding this comment.
Function find_smallest_video_asset_url refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
This removes the following comments ( why? ):
# Append extension
| media_data = r.json() | ||
| return media_data | ||
| return r.json() |
There was a problem hiding this comment.
Function show_media refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| srt_file_name = autosub.generate_subtitles(source_path=video_file_name) | ||
| return srt_file_name | ||
| return autosub.generate_subtitles(source_path=video_file_name) |
There was a problem hiding this comment.
Function autosub_video_file refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| 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() |
There was a problem hiding this comment.
Function upload_subtitle_file_to_wistia_video refactored with the following changes:
- Hoist repeated code outside conditional statement (
hoist-statement-from-if) - Move assignments closer to their usage (
move-assign)
| args = parser.parse_args() | ||
| return args | ||
| return parser.parse_args() |
There was a problem hiding this comment.
Function main.parse_arguments refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
Sourcery Code Quality Report✅ Merging this PR will increase code quality in the affected files by 0.06%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
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! |
Branch
masterrefactored 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
masterbranch, then run:Help us improve this pull request!