Skip to content

Sourcery refactored main branch#1

Open
sourcery-ai[bot] wants to merge 1 commit intomainfrom
sourcery/main
Open

Sourcery refactored main branch#1
sourcery-ai[bot] wants to merge 1 commit intomainfrom
sourcery/main

Conversation

@sourcery-ai
Copy link

@sourcery-ai sourcery-ai bot commented Jul 21, 2023

Branch main 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 main branch, then run:

git fetch origin sourcery/main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from custodeexcessus July 21, 2023 16:39
nextIndex = videos.index(currentVideo) + 1
# If we're not wrapping around
if not nextIndex >= len(videos):
if nextIndex < len(videos):
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_next_video refactored with the following changes:

  • Simplify logical expression using De Morgan identities (de-morgan)

def get_random_video(viddir):
videos = list(filter(supported_filetype, os.listdir(viddir)))
if videos:
if videos := list(filter(supported_filetype, os.listdir(viddir))):
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_random_video refactored with the following changes:

Comment on lines -189 to +196
output = f"{seconds:.1f} second(s) / {minutes:.1f} minute(s) / {hours:.1f} hour(s) / {days:.2f} day(s)"
return f"{seconds:.1f} second(s) / {minutes:.1f} minute(s) / {hours:.1f} hour(s) / {days:.2f} day(s)"
elif minutes < 1:
return f"{seconds:.1f} second(s)"
elif hours < 1:
return f"{minutes:.1f} minute(s)"
elif days < 1:
return f"{hours:.1f} hour(s)"
else:
if minutes < 1:
output = f"{seconds:.1f} second(s)"
elif hours < 1:
output = f"{minutes:.1f} minute(s)"
elif days < 1:
output = f"{hours:.1f} hour(s)"
else:
output = f"{days:.2f} day(s)"

return output
return f"{days:.2f} day(s)"
Copy link
Author

Choose a reason for hiding this comment

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

Function estimate_runtime refactored with the following changes:

Comment on lines -207 to +203
for i in glob.glob(name + ".*"):
for i in glob.glob(f"{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 find_subtitles refactored with the following changes:

Comment on lines -280 to +276
if args.directory:
viddir = args.directory
else:
viddir = "Videos"
viddir = args.directory if args.directory else "Videos"
Copy link
Author

Choose a reason for hiding this comment

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

Lines 280-283 refactored with the following changes:

Comment on lines +103 to +107
ruleCount = 8

tab = ' '
lineSpacing = 2

Copy link
Author

Choose a reason for hiding this comment

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

Lines 113-144 refactored with the following changes:


def clip(val, min_, max_):
return (min_ if val < min_ else (max_ if val > max_ else val))
return min_ if val < min_ else min(val, max_)
Copy link
Author

Choose a reason for hiding this comment

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

Function clip refactored with the following changes:

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

Comments