-
Notifications
You must be signed in to change notification settings - Fork 50
Sourcery refactored master branch #3
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
base: master
Are you sure you want to change the base?
Conversation
| class Config(object): | ||
|
|
||
|
|
||
| class Config((object)): |
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.
Lines 3-16 refactored with the following changes:
- Replace list(), dict() or set() with comprehension (
collection-builtin-to-comprehension)
| try: | ||
| t = SESSION.query(Thumbnail).get(id) | ||
| return t | ||
| return SESSION.query(Thumbnail).get(id) |
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 thumb refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| if metadata is not None: | ||
| if metadata.has("duration"): | ||
| duration = metadata.get('duration').seconds | ||
| if metadata is not None and metadata.has("duration"): | ||
| duration = metadata.get('duration').seconds | ||
| if duration > min_duration: | ||
| images = [] | ||
| ttl_step = duration // no_of_photos | ||
| current_ttl = ttl_step | ||
| for looper in range(0, no_of_photos): | ||
| for _ in range(no_of_photos): |
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 generate_screen_shots refactored with the following changes:
- Merge nested if conditions (
merge-nested-ifs) - Replace range(0, x) with range(x) (
remove-zero-from-range) - Replace unused for index with underscore (
for-index-underscore)
| r = requests.get(url, allow_redirects=True, stream=True) | ||
| total_size = int(r.headers.get("content-length", 0)) | ||
| return total_size | ||
| return int(r.headers.get("content-length", 0)) |
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 DetectFileSize refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| if client is not None: | ||
| if ((total_size // downloaded_size) % 5) == 0: | ||
| time.sleep(0.3) | ||
| try: | ||
| client.edit_message_text( | ||
| chat_id, | ||
| message_id, | ||
| text="{}: {} of {}".format( | ||
| ud_type, | ||
| humanbytes(downloaded_size), | ||
| humanbytes(total_size) | ||
| ) | ||
| if ( | ||
| client is not None | ||
| and ((total_size // downloaded_size) % 5) == 0 | ||
| ): | ||
| time.sleep(0.3) | ||
| try: | ||
| client.edit_message_text( | ||
| chat_id, | ||
| message_id, | ||
| text="{}: {} of {}".format( | ||
| ud_type, | ||
| humanbytes(downloaded_size), | ||
| humanbytes(total_size) | ||
| ) | ||
| except: | ||
| pass | ||
| ) | ||
| except: | ||
| pass |
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 DownLoadFile refactored with the following changes:
- Merge nested if conditions (
merge-nested-ifs)
| ]) | ||
| ) | ||
| return | ||
| return |
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 convert_to_video refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp)
This removes the following comments ( why? ):
# chat_id=update.chat.id,
# ref: message from @Mo_Tech_Group
# get the correct width, height, and duration for videos greater than 10MB
# text=Translation.UPLOAD_START,
# await bot.edit_message_text(
# don't care about the extension
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!