-
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 dev/0.15.1 branch #2
base: dev/0.15.1
Are you sure you want to change the base?
Conversation
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.
Due to GitHub API limits, only the first 60 comments can be shown.
return "{}/{}".format(args.namespace, args.project["name"]) | ||
return f'{args.namespace}/{args.project["name"]}' |
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_full_name
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
"id": "{}/{}".format(get_full_name(args), args.project["version"]), | ||
"id": f'{get_full_name(args)}/{args.project["version"]}', |
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 add_version_to_package
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
raise Exception("Version {} already in packages JSON" | ||
.format(args.project["version"]), | ||
file=sys.stderr) | ||
raise Exception( | ||
f'Version {args.project["version"]} already in packages JSON', | ||
file=sys.stderr, | ||
) | ||
|
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 main
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
|
||
description=description, | ||
long_description=long_description, | ||
long_description_content_type='text/markdown', | ||
|
||
author="Fishtown Analytics", | ||
author_email="info@fishtownanalytics.com", | ||
url="https://github.com/fishtown-analytics/dbt", | ||
packages=[], | ||
install_requires=[ | ||
'dbt-core=={}'.format(package_version), | ||
'dbt-postgres=={}'.format(package_version), | ||
'dbt-redshift=={}'.format(package_version), | ||
'dbt-snowflake=={}'.format(package_version), | ||
'dbt-bigquery=={}'.format(package_version), | ||
f'dbt-core=={package_version}', | ||
f'dbt-postgres=={package_version}', | ||
f'dbt-redshift=={package_version}', | ||
f'dbt-snowflake=={package_version}', | ||
f'dbt-bigquery=={package_version}', | ||
], | ||
zip_safe=False, | ||
classifiers=[ | ||
'Development Status :: 5 - Production/Stable', | ||
|
||
'License :: OSI Approved :: Apache Software License', | ||
|
||
'Operating System :: Microsoft :: Windows', | ||
'Operating System :: MacOS :: MacOS X', | ||
'Operating System :: POSIX :: Linux', | ||
|
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 20-45
refactored with the following changes:
- Replace call to format with f-string [×5] (
use-fstring-for-formatting
)
'Asked to compile {} node, but it has no compiled form' | ||
.format(model.resource_type) | ||
f'Asked to compile {model.resource_type} node, but it has no compiled form' | ||
) | ||
|
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 _compiled_type_for
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
raise RuntimeError( | ||
"Error showing deprecation warning: {}".format(name) | ||
) | ||
raise RuntimeError(f"Error showing deprecation warning: {name}") |
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 warn
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
path = "[%s]" % "][".join(map(repr, exc.relative_path)) | ||
return 'at path {}: {}'.format(path, exc.message) | ||
path = f'[{"][".join(map(repr, exc.relative_path))}]' | ||
return f'at path {path}: {exc.message}' |
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 validator_error_message
refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring
) - Replace call to format with f-string (
use-fstring-for-formatting
)
if not hasattr(node, 'name'): | ||
# we probably failed to parse a block, so we can't know the name | ||
return '{} ({})'.format( | ||
node.resource_type, | ||
node.original_file_path | ||
) | ||
return "{} {} ({})".format( | ||
node.resource_type, | ||
node.name, | ||
node.original_file_path) | ||
return ( | ||
f"{node.resource_type} {node.name} ({node.original_file_path})" | ||
if hasattr(node, 'name') | ||
else f'{node.resource_type} ({node.original_file_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.
Function RuntimeException.node_to_string
refactored with the following changes:
- Swap if/else branches of if expression to remove negation (
swap-if-expression
) - Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
) - Replace call to format with f-string [×2] (
use-fstring-for-formatting
)
This removes the following comments ( why? ):
# we probably failed to parse a block, so we can't know the name
lines.append("> {} {}".format( | ||
msg, | ||
self.node_to_string(item))) | ||
lines.append(f"> {msg} {self.node_to_string(item)}") |
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 RuntimeException.process_stack
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
node_string = " in {}".format(self.node_to_string(self.node)) | ||
node_string = f" in {self.node_to_string(self.node)}" | ||
|
||
if hasattr(self.msg, 'split'): | ||
split_msg = self.msg.split("\n") | ||
else: | ||
split_msg = str(self.msg).split("\n") | ||
|
||
lines = ["{}{}".format(self.type + ' Error', | ||
node_string)] + split_msg | ||
lines = ([f"{self.type} Error{node_string}"] + split_msg) | ||
|
||
lines += self.process_stack() | ||
|
||
return lines[0] + "\n" + "\n".join( | ||
[" " + line for line in lines[1:]]) | ||
return (lines[0] + "\n" + "\n".join([f" {line}" for line in lines[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 RuntimeException.__str__
refactored with the following changes:
- Replace call to format with f-string [×2] (
use-fstring-for-formatting
) - Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
) - Simplify unnecessary nesting, casting and constant values in f-strings (
simplify-fstring-formatting
)
Branch
dev/0.15.1
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
dev/0.15.1
branch, then run:Help us improve this pull request!