-
Notifications
You must be signed in to change notification settings - Fork 8
Sourcery refactored master branch #34
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
Conversation
server = zone + "." + self.suffix | ||
server = f"{zone}.{self.suffix}" |
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 UWhois.get_whois_server
refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation
)
if query.endswith("." + zone): | ||
if query.endswith(f".{zone}"): |
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 UWhois.whois
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
data = self.sock.recv(2048) | ||
if data: | ||
if data := self.sock.recv(2048): |
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 WhoisClient.whois
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
if not utils.is_well_formed_fqdn(whois_query): | ||
whois_entry = "; Bad request: '{0}'\r\n".format(whois_query) | ||
else: | ||
whois_entry = self.whois(whois_query) | ||
whois_entry = ( | ||
self.whois(whois_query) | ||
if utils.is_well_formed_fqdn(whois_query) | ||
else "; Bad request: '{0}'\r\n".format(whois_query) | ||
) | ||
|
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 WhoisListener.handle_stream
refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp
) - Swap if/else branches of if expression to remove negation (
swap-if-expression
)
whois_server = "whois.nic.%s" % zone | ||
whois_server = f"whois.nic.{zone}" |
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 scrape_whois_from_iana
refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring
)
print("%s=%s" % (zone, whois_servers[zone])) | ||
print(f"{zone}={whois_servers[zone]}") | ||
|
||
if args.ipv4: | ||
print("[ipv4_assignments]") | ||
for prefix, whois_server in fetch_ipv4_assignments(IPV4_ASSIGNMENTS): | ||
print("%s=%s" % (prefix, whois_server)) | ||
print(f"{prefix}={whois_server}") |
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 interpolated string formatting with f-string [×2] (
replace-interpolation-with-fstring
)
return dict( | ||
(key, decode_value(value)) for key, value in self.items(section) | ||
) | ||
return {key: decode_value(value) for key, value in self.items(section)} |
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 ConfigParser.get_section_dict
refactored with the following changes:
- Replace list(), dict() or set() with comprehension (
collection-builtin-to-comprehension
)
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!