-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Sourcery refactored master branch #83
base: master
Are you sure you want to change the base?
Conversation
9489fe1
to
03dd8c2
Compare
03dd8c2
to
74ce665
Compare
if srt: | ||
filename += ".srt" | ||
else: | ||
filename += ".xml" | ||
|
||
filename += '.srt' if srt else '.xml' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Caption.download refactored with the following changes:
- Replace if statement with if expression
js = youtube.js | ||
watch_html = youtube.watch_html | ||
vid_info = youtube.vid_info | ||
|
||
with gzip.open(fp, "wb") as fh: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function build_playback_report refactored with the following changes:
- Move assignments closer to their usage
pytube/extract.py
Outdated
otf_type = "FORMAT_STREAM_TYPE_OTF" | ||
|
||
if key == "url_encoded_fmt_stream_map" and not stream_data.get( | ||
"url_encoded_fmt_stream_map" | ||
): | ||
"url_encoded_fmt_stream_map" | ||
): | ||
formats = json.loads(stream_data["player_response"])["streamingData"]["formats"] | ||
formats.extend( | ||
json.loads(stream_data["player_response"])["streamingData"][ | ||
"adaptiveFormats" | ||
] | ||
) | ||
otf_type = "FORMAT_STREAM_TYPE_OTF" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function apply_descrambler refactored with the following changes:
- Move assignments closer to their usage
ntfs_characters = [chr(i) for i in range(0, 31)] | ||
ntfs_characters = [chr(i) for i in range(31)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function safe_filename refactored with the following changes:
- Replace range(0, x) with range(x)
if itag in ITAGS: | ||
res, bitrate = ITAGS[itag] | ||
else: | ||
res, bitrate = None, None | ||
res, bitrate = ITAGS[itag] if itag in ITAGS else (None, None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function get_format_profile refactored with the following changes:
- Replace if statement with if expression
"downloading (%s total bytes) file to %s", self.filesize, file_path, | ||
'downloading (%s total bytes) file to %s', bytes_remaining, file_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Stream.download refactored with the following changes:
- Use previously assigned local variable
logger.info( | ||
"downloading (%s total bytes) file to buffer", self.filesize, | ||
) | ||
|
||
logger.info('downloading (%s total bytes) file to buffer', bytes_remaining) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Stream.stream_to_buffer refactored with the following changes:
- Use previously assigned local variable
# Given | ||
target = "/target" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_ffmpeg_process_res_none_should_not_download refactored with the following changes:
- Move assignments closer to their usage
# Given | ||
target = "/target" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function test_ffmpeg_process_audio_fallback_none_should_exit refactored with the following changes:
- Move assignments closer to their usage
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: