Update codestyle for easy reading#37
Open
knwachuk wants to merge 4 commits intoc0decracker:masterfrom
Open
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the code for improved readability and maintainability while also moving print statements into the SystemExit arguments. Key changes include reformatting function definitions and list constructions, updating error handling to use SystemExit with messages, and adding type annotations and docstrings.
|
|
||
|
|
||
| def ceildiv(a, b): | ||
| def ceildiv(a: float, b: float) -> float: |
There was a problem hiding this comment.
The function documentation and return type annotation indicate a float result, but the function returns an int. Consider updating the return type annotation to '-> int' for consistency.
Suggested change
| def ceildiv(a: float, b: float) -> float: | |
| def ceildiv(a: float, b: float) -> int: |
| if split_count == 1: | ||
| print("Video length is less then the target split length.") | ||
| raise SystemExit | ||
| raise SystemExit("Video length is less then the target split length.") |
There was a problem hiding this comment.
The error message contains a grammatical typo: 'less then' should be corrected to 'less than'.
Suggested change
| raise SystemExit("Video length is less then the target split length.") | |
| raise SystemExit("Video length is less than the target split length.") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR aims to make it easy to read (and ultimately modify) the source code. It also moved the print statements into the
SystemExitclass as an argument. For insight into why this change, see https://stackoverflow.com/questions/13992662/using-sys-exit-or-systemexit-when-to-use-which