Skip to content

Commit 020ebda

Browse files
claudexfgong
authored andcommitted
style: apply ruff format to reasoning-capability files
Feature commits introduced unformatted code in 7 files, which fails the CI 'ruff format --check' gate. Run 'ruff format' to bring them in line with the rest of the tree.
1 parent 635f12e commit 020ebda

7 files changed

Lines changed: 14 additions & 18 deletions

File tree

cubepi/checkpointer/postgres/checkpointer.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ def _schema_mismatch_hint(actual: int, expected: int) -> str:
5151
between ``actual`` and ``expected``, rather than hardcoding one version
5252
transition, so the hint stays correct as EXPECTED_SCHEMA_VERSION grows.
5353
"""
54-
steps = ", ".join(
55-
f"upgrade_v{v}_to_v{v + 1}_op()" for v in range(actual, expected)
56-
)
54+
steps = ", ".join(f"upgrade_v{v}_to_v{v + 1}_op()" for v in range(actual, expected))
5755
return (
5856
"cubepi was upgraded but host alembic is behind. "
5957
f"Generate a new alembic revision that calls {steps} + "

cubepi/providers/anthropic.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ async def stream(
190190
apply_reasoning_control(kwargs, cap, opts.reasoning, model=model)
191191
thinking_block = kwargs.get("thinking")
192192
thinking_enabled = (
193-
isinstance(thinking_block, dict)
194-
and thinking_block.get("type") == "enabled"
193+
isinstance(thinking_block, dict) and thinking_block.get("type") == "enabled"
195194
)
196195
if not thinking_enabled:
197196
kwargs.setdefault("temperature", model.temperature)

cubepi/providers/capability.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,9 @@ def _handle_unsupported_mode(
249249
message = f"Reasoning mode '{mode}' is not supported by this capability."
250250
if reasoning.unsupported_mode_policy == "error":
251251
raise ValueError(message)
252-
warnings.append(CapabilityWarning(code="unsupported_reasoning_mode", message=message))
252+
warnings.append(
253+
CapabilityWarning(code="unsupported_reasoning_mode", message=message)
254+
)
253255

254256

255257
def _payload_delta(before: dict[str, Any], after: dict[str, Any]) -> dict[str, Any]:
@@ -275,4 +277,3 @@ def _write_dotted_path(target: dict[str, Any], path: str, value: Any) -> None:
275277
cursor[part] = {}
276278
cursor = cursor[part]
277279
cursor[parts[-1]] = value
278-

cubepi/providers/openai.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def __init__(
7070
self._cap_active: bool = (
7171
capability is not None or model_capability_overrides is not None
7272
)
73-
self._capability: CapabilityDescriptor = (
74-
capability or get_capability_profile("openai.chat_completions")
73+
self._capability: CapabilityDescriptor = capability or get_capability_profile(
74+
"openai.chat_completions"
7575
)
7676
self._model_overrides: dict[str, CapabilityDescriptor] = (
7777
model_capability_overrides or {}

cubepi/providers/openai_responses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def __init__(
6969
self._cap_active: bool = (
7070
capability is not None or model_capability_overrides is not None
7171
)
72-
self._capability: CapabilityDescriptor = (
73-
capability or get_capability_profile("openai.responses")
72+
self._capability: CapabilityDescriptor = capability or get_capability_profile(
73+
"openai.responses"
7474
)
7575
self._model_overrides: dict[str, CapabilityDescriptor] = (
7676
model_capability_overrides or {}

cubepi/providers/reasoning_profiles.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
}
3030

3131

32-
def get_capability_profile(provider: str, api: str | None = None) -> CapabilityDescriptor:
32+
def get_capability_profile(
33+
provider: str, api: str | None = None
34+
) -> CapabilityDescriptor:
3335
"""Return the built-in capability profile for a provider/API pair."""
3436

3537
provider_key = provider.lower()

tests/providers/test_openai_responses_capability.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,7 @@ async def set_max(kwargs, model):
275275
kwargs["max_output_tokens"] = 1234
276276
return kwargs
277277

278-
payload = await _capture_payload_responses(
279-
p, _model(), on_payload=set_max
280-
)
278+
payload = await _capture_payload_responses(p, _model(), on_payload=set_max)
281279
assert payload["max_output_tokens"] == 1234
282280

283281

@@ -289,9 +287,7 @@ async def set_max(kwargs, model):
289287
kwargs["max_output_tokens"] = 999
290288
return kwargs
291289

292-
payload = await _capture_payload_responses(
293-
p, _model(), on_payload=set_max
294-
)
290+
payload = await _capture_payload_responses(p, _model(), on_payload=set_max)
295291
assert payload["max_output_tokens"] == 999
296292

297293

0 commit comments

Comments
 (0)