-
Notifications
You must be signed in to change notification settings - Fork 142
Sourcery Starbot ⭐ refactored wklken/py-patterns #5
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
print("%s process %s" % (self.__class__.__name__, request)) | ||
print(f"{self.__class__.__name__} process {request}") |
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 ConcreteHandlerA.handle_request
refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring
)
print("%s process %s" % (self.__class__.__name__, request)) | ||
print(f"{self.__class__.__name__} process {request}") |
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 ConcreteHandlerB.handle_request
refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring
)
print("%s process %s" % (self.__class__.__name__, request)) | ||
print(f"{self.__class__.__name__} process {request}") |
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 ConcreteHandlerC.handle_request
refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring
)
l = [] | ||
l.append(TerminalExpression()) | ||
l = [TerminalExpression()] |
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 82-83
refactored with the following changes:
- Merge append into list declaration (
merge-list-append
)
if self.i < self.n: | ||
i = self.i | ||
self.i += 1 | ||
return i | ||
else: | ||
if self.i >= self.n: | ||
raise StopIteration() | ||
i = self.i | ||
self.i += 1 | ||
return i |
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 YRange.__next__
refactored with the following changes:
- Swap if/else branches (
swap-if-else-branches
) - Remove unnecessary else after guard condition (
remove-unnecessary-else
)
return "ProductA: %s" % self.name | ||
return f"ProductA: {self.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 AbstractProductA.__str__
refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring
)
return "ProductB: %s" % self.name | ||
return f"ProductB: {self.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 AbstractProductB.__str__
refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring
)
print('-'.join(item for item in self.__parts)) | ||
print('-'.join(self.__parts)) |
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 Product.show
refactored with the following changes:
- Simplify generator expression (
simplify-generator
)
return self.__instance | ||
else: | ||
return self.__instance | ||
return self.__instance |
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 Singleton.__call__
refactored with the following changes:
- Hoist repeated code outside conditional statement (
hoist-statement-from-if
)
self.__flyweights = dict() | ||
self.__flyweights = {} |
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 FlyweightFactory.__init__
refactored with the following changes:
- Replace
dict()
with{}
(dict-literal
)
Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨
Here's your pull request refactoring your most popular Python repo.
If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.
Review changes via command line
To manually merge these changes, make sure you're on the
master
branch, then run: