-
Notifications
You must be signed in to change notification settings - Fork 2
Sourcery refactored main branch #1
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: main
Are you sure you want to change the base?
Conversation
| # Find the index of "Copy code" line | ||
| copy_code_index = -1 | ||
| for i, line in enumerate(lines): | ||
| if line.strip() == 'Copy code': | ||
| copy_code_index = i | ||
| break | ||
|
|
||
| copy_code_index = next( | ||
| (i for i, line in enumerate(lines) if line.strip() == 'Copy code'), -1 | ||
| ) |
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 clean_pinescript refactored with the following changes:
- Use the built-in function
nextinstead of a for-loop (use-next) - Use named expression to simplify assignment and conditional (
use-named-expression) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
This removes the following comments ( why? ):
# Find the index of "Copy code" line
| directory_path = "PineScripts" | ||
|
|
||
| file_count = sum([len(files) for _, _, files in os.walk(directory_path)]) | ||
| file_count = sum(len(files) for _, _, files in os.walk(directory_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.
Lines 25-25 refactored with the following changes:
- Replace unneeded comprehension with generator (
comprehension-to-generator)
|
|
||
| while True: | ||
| url = base_url + f'page-{page}/?script_type=strategies&script_access=open&sort=month_popular&route_range=1' | ||
| url = f'{base_url}page-{page}/?script_type=strategies&script_access=open&sort=month_popular&route_range=1' |
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 21-42 refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation)
|
|
||
| async def download_page(session, page): | ||
| url = base_url + f'page-{page}/?script_type=strategies&script_access=open&sort=month_popular&route_range=1' | ||
| url = f'{base_url}page-{page}/?script_type=strategies&script_access=open&sort=month_popular&route_range=1' |
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 download_page refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation)
|
|
||
| async def download_page(session, page): | ||
| url = base_url + f'page-{page}/?script_type=strategies&script_access=open&sort=month_popular&route_range=1' | ||
| url = f'{base_url}page-{page}/?script_type=strategies&script_access=open&sort=month_popular&route_range=1' |
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 download_page refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation)
|
|
||
| def download_page(page): | ||
| url = base_url + f'page-{page}/?script_type=strategies&script_access=open&sort=month_popular&route_range=1' | ||
| url = f'{base_url}page-{page}/?script_type=strategies&script_access=open&sort=month_popular&route_range=1' |
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 download_page refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation)
|
|
||
| async def download_page(session, page): | ||
| url = base_url + f'page-{page}/?script_type=strategies&script_access=open&sort=month_popular&route_range=1' | ||
| url = f'{base_url}page-{page}/?script_type=strategies&script_access=open&sort=month_popular&route_range=1' |
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 download_page refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation)
|
|
||
| async def download_page(session, page): | ||
| url = base_url + f'page-{page}/?script_type=strategies&script_access=open&sort=month_popular&route_range=1' | ||
| url = f'{base_url}page-{page}/?script_type=strategies&script_access=open&sort=month_popular&route_range=1' |
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 download_page refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation)
Branch
mainrefactored 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
mainbranch, then run:Help us improve this pull request!