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

Blacken src/pip/_internal/network/ #10193

Merged
merged 1 commit into from
Jul 23, 2021
Merged

Conversation

pradyunsg
Copy link
Member

Progresses the black formatting of the codebase further.

Towards #8543

Progresses the black formatting of the codebase further.
@pradyunsg pradyunsg added the skip news Does not need a NEWS file entry (eg: trivial changes) label Jul 23, 2021
Copy link
Member

@uranusjr uranusjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not very related but there are a few things I also want to change in the formatted code; f-string instead of str + str, don't use str() in logger call, those kind of things. We can do them in another PR if you want to keep things pure (for e.g. .git-blame-ignore-revs)

Comment on lines +153 to +158
# fmt: off
kr_auth = (
get_keyring_auth(index_url, username) or
get_keyring_auth(netloc, username)
)
# fmt: on
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does Black format this to?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah dammit. I was explicitly trying to avoid mixing manual changes from automated ones. >.<

Anyway, removing this creates this patch:

diff --git a/src/pip/_internal/network/auth.py b/src/pip/_internal/network/auth.py
index 74d225472..0713f0205 100644
--- a/src/pip/_internal/network/auth.py
+++ b/src/pip/_internal/network/auth.py
@@ -150,12 +150,9 @@ def _get_new_credentials(
         # If we don't have a password and keyring is available, use it.
         if allow_keyring:
             # The index url is more specific than the netloc, so try it first
-            # fmt: off
-            kr_auth = (
-                get_keyring_auth(index_url, username) or
-                get_keyring_auth(netloc, username)
+            kr_auth = get_keyring_auth(index_url, username) or get_keyring_auth(
+                netloc, username
             )
-            # fmt: on
             if kr_auth:
                 logger.debug("Found credentials in keyring for %s", netloc)
                 return kr_auth

I think that's clearly worse. It's psf/black#2156 upstream.

@pradyunsg
Copy link
Member Author

I also want to change in the formatted code; f-string instead of str + str, don't use str() in logger call, those kind of things

Yup, I saw them too and; as you said, for follow ups!

@pradyunsg pradyunsg merged commit 330d0aa into pypa:main Jul 23, 2021
@pradyunsg pradyunsg deleted the blacken/network branch July 23, 2021 20:20
@pradyunsg
Copy link
Member Author

Thanks for the review! ^>^

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
skip news Does not need a NEWS file entry (eg: trivial changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants