-
Notifications
You must be signed in to change notification settings - Fork 0
Sourcery refactored master 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: master
Are you sure you want to change the base?
Conversation
cmd_folder = os.path.join(BASE_DIR + '/cli', 'commands') | ||
cmd_folder = os.path.join(f'{BASE_DIR}/cli', 'commands') |
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 28-28
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
rv = [] | ||
for filename in os.listdir(cmd_folder): | ||
if filename.endswith('.py') and \ | ||
filename.startswith('cmd_'): | ||
rv.append(filename[4:-3]) | ||
rv = [ | ||
filename[4:-3] | ||
for filename in os.listdir(cmd_folder) | ||
if filename.endswith('.py') and filename.startswith('cmd_') | ||
] |
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 CLI.list_commands
refactored with the following changes:
- Convert for loop into list comprehension (
list-comprehension
)
mod = __import__('cli.commands.cmd_' + name, locals = None, globals = None, fromlist = ['cli']) | ||
mod = __import__( | ||
f'cli.commands.cmd_{name}', | ||
locals=None, | ||
globals=None, | ||
fromlist=['cli'], | ||
) |
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 CLI.get_command
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
with open(f'api/__init__.py', 'a+') as f: | ||
with open('api/__init__.py', 'a+') as f: |
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 make_api
refactored with the following changes:
- Replace f-string with no interpolated values with string (
remove-redundant-fstring
)
with open(f'models/__init__.py', 'a+') as f: | ||
with open('models/__init__.py', 'a+') as f: |
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 make_model
refactored with the following changes:
- Replace f-string with no interpolated values with string (
remove-redundant-fstring
)
handler = RotatingFileHandler(LOG_DIR + '/app.log', maxBytes = 1000000, backupCount = 5) | ||
handler = RotatingFileHandler( | ||
f'{LOG_DIR}/app.log', maxBytes=1000000, backupCount=5 | ||
) |
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 64-64
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
exts = [] | ||
for ext in _mime_types: | ||
if mime_type in _mime_types[ext]: | ||
exts.append(ext) | ||
return exts | ||
return [ext for ext in _mime_types if mime_type in _mime_types[ext]] |
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 get_extensions
refactored with the following changes:
- Convert for loop into list comprehension (
list-comprehension
) - Inline variable that is immediately returned (
inline-immediately-returned-variable
)
if equal is NotImplemented: | ||
return NotImplemented | ||
return not equal | ||
return NotImplemented if equal is NotImplemented else not equal |
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 UserMixin.__ne__
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
return '<User {}>'.format(self.username) | ||
return f'<User {self.username}>' |
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 User.__repr__
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
result = cls.query().where('username', username).first_or_fail() | ||
if result: | ||
if result := cls.query().where('username', username).first_or_fail(): |
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 User.lookup
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
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:Help us improve this pull request!