-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sourcery refactored master branch #1
base: master
Are you sure you want to change the base?
Conversation
if isclass(obj) and issubclass(obj, Exception): | ||
return True | ||
return False | ||
return bool(isclass(obj) and issubclass(obj, Exception)) |
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 isexception
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
) - Simplify boolean if expression (
boolean-if-exp-identity
)
return '<Record {}>'.format(self.export('json')[1:-1]) | ||
return f"<Record {self.export('json')[1:-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 Record.__repr__
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
raise KeyError("Record contains multiple '{}' fields.".format(key)) | ||
raise KeyError(f"Record contains multiple '{key}' fields.") | ||
return self.values()[i] | ||
|
||
raise KeyError("Record contains no '{}' field.".format(key)) | ||
raise KeyError(f"Record contains no '{key}' field.") |
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 Record.__getitem__
refactored with the following changes:
- Replace call to format with f-string [×2] (
use-fstring-for-formatting
)
return '<RecordCollection size={} pending={}>'.format(len(self), self.pending) | ||
return f'<RecordCollection size={len(self)} pending={self.pending}>' |
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 RecordCollection.__repr__
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
if is_int: | ||
return rows[0] | ||
else: | ||
return RecordCollection(iter(rows)) | ||
return rows[0] if is_int else RecordCollection(iter(rows)) |
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 RecordCollection.__getitem__
refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp
)
raise IOError("File '{}'' not found!".format(path)) | ||
raise IOError(f"File '{path}'' not found!") | ||
|
||
# If it's a directory | ||
if os.path.isdir(path): | ||
raise IOError("'{}' is a directory!".format(path)) | ||
raise IOError(f"'{path}' is a directory!") |
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 Connection.bulk_query_file
refactored with the following changes:
- Replace call to format with f-string [×2] (
use-fstring-for-formatting
)
print('%s format not supported.' % format) | ||
print('Supported formats are %s.' % formats_lst) | ||
print(f'{format} format not supported.') | ||
print(f'Supported formats are {formats_lst}.') |
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
refactored with the following changes:
- Replace interpolated string formatting with f-string [×2] (
replace-interpolation-with-fstring
)
print('\033[1m{}\033[0m'.format(s)) | ||
print(f'\033[1m{s}\033[0m') |
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 PublishCommand.status
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
os.system('{} setup.py sdist bdist_wheel --universal'.format(sys.executable)) | ||
os.system(f'{sys.executable} setup.py sdist bdist_wheel --universal') |
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 PublishCommand.run
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
tx.commit() | ||
conn.query('INSERT INTO foo VALUES (44)') |
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 test_failing_transaction_self_managed
refactored with the following changes:
- Remove unreachable code (
remove-unreachable-code
)
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!