Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented May 31, 2020

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^

@sourcery-ai sourcery-ai bot force-pushed the sourcery/master branch from 9489fe1 to 03dd8c2 Compare May 31, 2020 20:27
@sourcery-ai sourcery-ai bot force-pushed the sourcery/master branch from 03dd8c2 to 74ce665 Compare May 31, 2020 20:27
if srt:
filename += ".srt"
else:
filename += ".xml"

filename += '.srt' if srt else '.xml'
Copy link
Author

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

Comment on lines -161 to 165
js = youtube.js
watch_html = youtube.watch_html
vid_info = youtube.vid_info

with gzip.open(fp, "wb") as fh:
Copy link
Author

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

Comment on lines 276 to 286
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"

Copy link
Author

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)]
Copy link
Author

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)
Copy link
Author

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
Copy link
Author

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)
Copy link
Author

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

Comment on lines -371 to -372
# Given
target = "/target"
Copy link
Author

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

Comment on lines -408 to -409
# Given
target = "/target"
Copy link
Author

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

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

Successfully merging this pull request may close these issues.

2 participants