-
Notifications
You must be signed in to change notification settings - Fork 10
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
merge upstream (Sourcery refactored) #3
base: master
Are you sure you want to change the base?
Conversation
elif s == arg: | ||
# --option | ||
# set value to True | ||
p = True | ||
del argv[i] | ||
else: | ||
if s == arg: | ||
# --option | ||
# set value to True | ||
p = True | ||
del argv[i] | ||
else: | ||
i = i + 1 | ||
i += 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 scan_argv
refactored with the following changes:
- Merge else clause's nested if statement into elif (
merge-else-if-into-elif
) - Replace assignment with augmented assignment (
aug-assign
)
i = i + 1 | ||
i += 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 scan_argvs
refactored with the following changes:
- Replace assignment with augmented assignment (
aug-assign
)
if not dir in self.library_dirs: | ||
if dir not in self.library_dirs: | ||
self.library_dirs.append(dir) | ||
elif fatal: | ||
fail("FATAL: bad directory %s in environment variable %s" % (dir, envvar)) | ||
fail(f"FATAL: bad directory {dir} in environment variable {envvar}") |
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 ExtensionConfiguration.add_libdirs
refactored with the following changes:
- Simplify logical expression using De Morgan identities (
de-morgan
) - Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring
)
if option != other_option: | ||
if scan_argv(self.argv, other_option) is not None: | ||
raise ConfigurationError('Cannot give both %s and %s' % (option, other_option)) | ||
if ( | ||
option != other_option | ||
and scan_argv(self.argv, other_option) is not None | ||
): | ||
raise ConfigurationError(f'Cannot give both {option} and {other_option}') |
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 ExtensionConfiguration.detect_ssl_option
refactored with the following changes:
- Merge nested if conditions (
merge-nested-ifs
) - Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring
)
if ssl_lib in ['openssl', 'wolfssl', 'gnutls', 'nss', 'mbedtls', 'sectransp']: | ||
ssl_lib_detected = ssl_lib | ||
getattr(self, 'using_%s' % ssl_lib)() | ||
else: | ||
if ssl_lib not in [ | ||
'openssl', | ||
'wolfssl', | ||
'gnutls', | ||
'nss', | ||
'mbedtls', | ||
'sectransp', | ||
]: | ||
raise ConfigurationError('Invalid value "%s" for PYCURL_SSL_LIBRARY' % ssl_lib) | ||
|
||
option = self.detect_ssl_option() | ||
if option: | ||
ssl_lib_detected = ssl_lib | ||
getattr(self, f'using_{ssl_lib_detected}')() | ||
if option := self.detect_ssl_option(): |
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 ExtensionConfiguration.detect_ssl_backend
refactored with the following changes:
- Swap if/else branches (
swap-if-else-branches
) - Remove unnecessary else after guard condition (
remove-unnecessary-else
) - Use previously assigned local variable (
use-assigned-variable
) - Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring
) - Use named expression to simplify assignment and conditional (
use-named-expression
)
f = open('doc/docstrings/%s' % entry) | ||
f = open(f'doc/docstrings/{entry}') |
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 convert_docstrings
refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring
)
options.append((pycurl.PROXY, self._proxy_url.netloc)) | ||
else: | ||
options.append((pycurl.PROXY, self._proxy_url.netloc)) | ||
options.append((pycurl.PROXY, self._proxy_url.netloc)) |
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 ProxyCURLHandlerPool.get_additional_curl_options
refactored with the following changes:
- Hoist repeated code outside conditional statement (
hoist-statement-from-if
)
if sys.version_info[0:2] < (major, minor): | ||
if sys.version_info[:2] < (major, minor): |
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 min_python
refactored with the following changes:
- Replace a[0:x] with a[:x] and a[x:len(a)] with a[x:] (
remove-redundant-slice-index
)
raise unittest.SkipTest('SSL backend is %s' % current_backend) | ||
raise unittest.SkipTest(f'SSL backend is {current_backend}') | ||
|
||
return fn(*args, **kwargs) | ||
|
||
return decorated | ||
|
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 only_ssl_backends
refactored with the following changes:
- Replace interpolated string formatting with f-string (
replace-interpolation-with-fstring
)
for i in range(num_attempts): | ||
for _ in range(num_attempts): |
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 wait_for_network_service
refactored with the following changes:
- Replace unused for index with underscore (
for-index-underscore
)
Sourcery Code Quality Report✅ Merging this PR will increase code quality in the affected files by 1.03%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
69079b5
to
fdb2b4a
Compare
Pull Request #2 refactored by Sourcery.
Since the original Pull Request was opened as a fork in a contributor's
repository, we are unable to create a Pull Request branching from it.
To incorporate these changes, you can either:
Merge this Pull Request instead of the original, or
Ask your contributor to locally incorporate these commits and push them to
the original Pull Request
Incorporate changes via command line
NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Help us improve this pull request!