Skip to content
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

refactor: prefer f-strings to format where fits within black lengths #6186

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions requests/__init__.py
Expand Up @@ -94,9 +94,10 @@ def _check_cryptography(cryptography_version):
return

if cryptography_version < [1, 3, 4]:
warning = "Old version of cryptography ({}) may cause slowdown.".format(
cryptography_version
warning = (
f"Old version of cryptography ({cryptography_version}) may cause slowdown."
)

warnings.warn(warning, RequestsDependencyWarning)


Expand Down
4 changes: 2 additions & 2 deletions requests/auth.py
Expand Up @@ -59,8 +59,8 @@ def _basic_auth_str(username, password):
if isinstance(password, str):
password = password.encode("latin1")

authstr = "Basic " + to_native_string(
b64encode(b":".join((username, password))).strip()
authstr = (
f'Basic {to_native_string(b64encode(b":".join((username, password))).strip())}'
)

return authstr
Expand Down
4 changes: 2 additions & 2 deletions requests/utils.py
Expand Up @@ -840,9 +840,9 @@ def select_proxy(url, proxies):
return proxies.get(urlparts.scheme, proxies.get("all"))

proxy_keys = [
urlparts.scheme + "://" + urlparts.hostname,
f"{urlparts.scheme}://{urlparts.hostname}",
urlparts.scheme,
"all://" + urlparts.hostname,
f"all://{urlparts.hostname}",
"all",
]
proxy = None
Expand Down