Skip to content

Commit 2e750ab

Browse files
Alfonso Sastrecursoragent
andcommitted
fix: apply ruff formatting to push.py (I001 import sort + line length)
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 7cb062d commit 2e750ab

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

ocpi/core/push.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from ocpi.modules.versions.enums import VersionNumber
1616
from ocpi.modules.versions.v_2_2_1.enums import InterfaceRole
1717

18-
1918
# Ordered from newest to oldest. Update this list when new OCPI versions are added.
2019
_VERSION_PREFERENCE = ["2.3.0", "2.2.1", "2.1.1"]
2120

@@ -33,9 +32,7 @@ def _pick_version_details_url(
3332
Entries missing either the ``version`` or ``url`` key are silently skipped.
3433
"""
3534
by_version = {
36-
v["version"]: v["url"]
37-
for v in versions_list
38-
if "version" in v and "url" in v
35+
v["version"]: v["url"] for v in versions_list if "version" in v and "url" in v
3936
}
4037

4138
if requested.value in by_version:
@@ -145,25 +142,19 @@ async def push_object(
145142
# If response is a versions list, negotiate version and
146143
# fetch the details URL for the best mutual version.
147144
if isinstance(response_data, list):
148-
details_url = _pick_version_details_url(
149-
response_data, version
150-
)
145+
details_url = _pick_version_details_url(response_data, version)
151146
if not details_url:
152147
raise ValueError(
153148
f"No mutual OCPI version found. "
154149
f"Requested {version.value}, receiver supports: "
155150
f"{[v.get('version') for v in response_data]}"
156151
)
157-
logger.info(
158-
f"Resolved version details URL: {details_url}"
159-
)
152+
logger.info(f"Resolved version details URL: {details_url}")
160153
response = await client.get(
161154
details_url,
162155
headers={"authorization": client_auth_token},
163156
)
164-
logger.info(
165-
f"Version details response: {response.status_code}"
166-
)
157+
logger.info(f"Version details response: {response.status_code}")
167158
response.raise_for_status()
168159
response_data = response.json()["data"]
169160

0 commit comments

Comments
 (0)