-
Notifications
You must be signed in to change notification settings - Fork 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
Sourcery Starbot ⭐ refactored uri-tech/p-2022-091 #212
base: master
Are you sure you want to change the base?
Conversation
print("{} wrote:".format(self.client_address[0])) | ||
print(f"{self.client_address[0]} wrote:") |
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 CustomTCPHandler.handle
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
print("{} wrote:".format(self.client_address[1])) | ||
print(f"{self.client_address[1]} wrote:") |
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 CustomTCPHandler.handle
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
print("{} wrote:".format(self.client_address[0])) | ||
print(f"{self.client_address[0]} wrote:") |
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 CustomTCPHandler.handle
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
print("{} wrote:".format(self.client_address[0])) | ||
print(f"{self.client_address[0]} wrote:") |
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 CustomTCPHandler.handle
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
while(True): | ||
while True: |
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 ClientThread
refactored with the following changes:
- Remove unnecessary casts to int, str, float or bool (
remove-unnecessary-cast
)
RANGE_CONNECTION_TIME: tuple = tuple((114, 124)) | ||
RANGE_CONNECTION_TIME: tuple = 114, 124 |
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 8-8
refactored with the following changes:
- Unwrap a constant iterable constructor (
unwrap-iterable-construction
)
if(time()-self.startTime < maxConnectionTime): | ||
if (time()-self.startTime < maxConnectionTime): | ||
# self.request is the TCP socket connected to the client | ||
self.data = self.request.recv(1024).strip() | ||
print("{} wrote:".format(self.client_address[0])) | ||
print(f"{self.client_address[0]} wrote:") | ||
print(self.data) | ||
# just send back the same data, but upper-cased | ||
self.request.sendall(self.data.upper()) | ||
# self.request is the TCP socket connected to the client | ||
# self.request is the TCP socket connected to the client | ||
else: | ||
print(f"finish transmition with client") | ||
print("finish transmition with client") |
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 CustomTCPHandler.handle
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
) - Replace f-string with no interpolated values with string (
remove-redundant-fstring
)
response = bytes("{}: {}".format(cur_thread.name, data), 'ascii') | ||
response = bytes(f"{cur_thread.name}: {data}", 'ascii') |
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 ThreadedTCPRequestHandler.handle
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
print("Received: {}".format(response)) | ||
print(f"Received: {response}") |
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 client
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
print("{} wrote:".format(self.client_address[0])) | ||
print(f"{self.client_address[0]} wrote:") |
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 MyTCPHandler2.handle
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
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: