Skip to content

Commit 9341d29

Browse files
committed
Smoosh lintage
oidc-exchange: noqa on `import id` oidc-exchange: isort oidc-exchange: fix herestring style Smoosh lintage pre-commit: disable WPS332 This action runs on Python 3.11. more lintage Disable WPS326; ignore a WPS504. ignore WPS462 Produces poor suggestions here. oidc-exchange: simplify oidc-exchange: noqa -> pylint disable oidc-exchange: add-trailing-comma fixes
1 parent 74cd5c1 commit 9341d29

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ repos:
110110
WPS110,
111111
WPS111,
112112
WPS305,
113+
WPS326,
114+
WPS332,
113115
WPS347,
114116
WPS360,
115117
WPS421,
@@ -120,6 +122,7 @@ repos:
120122
WPS440,
121123
WPS441,
122124
WPS453,
125+
WPS462,
123126
- --select
124127
- WPS
125128
additional_dependencies:

oidc-exchange.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import os
2-
from pathlib import Path
32
import sys
3+
from pathlib import Path
44
from textwrap import dedent
55
from typing import NoReturn
66
from urllib.parse import urlparse
77

8-
import id
8+
import id # pylint: disable=W0622
99
import requests
1010

1111
_GITHUB_STEP_SUMMARY = Path(os.getenv("GITHUB_STEP_SUMMARY"))
@@ -22,7 +22,7 @@
2222
permissions:
2323
id-token: write
2424
```
25-
"""
25+
""",
2626
)
2727

2828

@@ -32,7 +32,8 @@ def die(msg: str) -> NoReturn:
3232

3333
# NOTE: `msg` is Markdown formatted, so we emit only the header line to
3434
# avoid clogging the console log with a full Markdown formatted document.
35-
print(f"::error::OIDC exchange failure: {msg.splitlines()[0]}", file=sys.stderr)
35+
header = msg.splitlines()[0]
36+
print(f"::error::OIDC exchange failure: {header}", file=sys.stderr)
3637
sys.exit(1)
3738

3839

@@ -60,20 +61,20 @@ def assert_successful_audience_call(resp: requests.Response, domain: str):
6061
# This index does not support OIDC.
6162
die(
6263
"audience retrieval failed: repository at "
63-
f"{domain} does not indicate OIDC support"
64+
f"{domain} does not indicate OIDC support",
6465
)
6566
case other:
6667
# Unknown: the index may or may not support OIDC, but didn't respond with
6768
# something we expect. This can happen if the index is broken, in maintenance mode,
6869
# misconfigured, etc.
6970
die(
7071
"audience retrieval failed: repository at "
71-
f"{domain} responded with unexpected {other}"
72+
f"{domain} responded with unexpected {other}",
7273
)
7374

7475

7576
repository_url = get_normalized_input("repository-url")
76-
if not repository_url:
77+
if not repository_url: # noqa: WPS504
7778
# Easy case: no explicit repository URL, which means we're using PyPI and we can just
7879
# hardcode the exchange endpoint and OIDC audience.
7980
token_exchange_url = "https://pypi.org/_/oidc/github/mint-token"
@@ -117,8 +118,8 @@ def assert_successful_audience_call(resp: requests.Response, domain: str):
117118
118119
This strongly suggests a server configuration or downtime issue; wait
119120
a few minutes and try again.
120-
"""
121-
)
121+
""",
122+
),
122123
)
123124

124125
reasons = "\n".join(
@@ -132,7 +133,7 @@ def assert_successful_audience_call(resp: requests.Response, domain: str):
132133
Token request failed: the server refused the request for the following reasons:
133134
134135
{reasons}
135-
"""
136+
""",
136137
)
137138

138139
mint_token_payload = mint_token_resp.json()
@@ -145,8 +146,8 @@ def assert_successful_audience_call(resp: requests.Response, domain: str):
145146
146147
This strongly suggests a server configuration or downtime issue; wait
147148
a few minutes and try again.
148-
"""
149-
)
149+
""",
150+
),
150151
)
151152

152153
# Mask the newly minted PyPI token, so that we don't accidentally leak it in logs.

0 commit comments

Comments
 (0)