Skip to content

Commit 43e7321

Browse files
bashandboneCopilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>
1 parent 8b47b64 commit 43e7321

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/codeweaver/providers/config/categories/embedding.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def client(self) -> LiteralSDKClient:
223223
with contextlib.suppress(AttributeError, KeyError, ValueError):
224224
is_sdkclient_member = SDKClient.from_string(self.provider.variable) is not None
225225
if self.provider.only_uses_own_client and is_sdkclient_member:
226-
return cast("LiteralSDKClient", SDKClient.from_string(self.provider.variable))
226+
return cast(LiteralSDKClient, SDKClient.from_string(self.provider.variable))
227227
if self.provider not in (Provider.AZURE, Provider.HEROKU):
228228
raise ValueError(
229229
f"Cannot resolve embedding client for provider {self.provider.variable}.",
@@ -834,7 +834,7 @@ def validate_model_compatibility(self) -> AsymmetricEmbeddingProviderSettings:
834834
@property
835835
def dimension(self) -> NonNegativeInt:
836836
"""Get the embedding dimension for both models (they must match)."""
837-
return cast("NonNegativeInt", self.dimension_tuple[0] or 0)
837+
return cast(NonNegativeInt, self.dimension_tuple[0] or 0)
838838

839839
@property
840840
def datatype(self) -> str:

src/codeweaver/providers/config/categories/reranking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class BaseRerankingProviderSettings(BaseProviderCategorySettings):
9898
@property
9999
def client(self) -> LiteralSDKClient:
100100
"""Return the reranking SDKClient enum member."""
101-
return cast("LiteralSDKClient", SDKClient.from_string(self.provider.variable))
101+
return cast(LiteralSDKClient, SDKClient.from_string(self.provider.variable))
102102

103103
def is_cloud(self) -> bool:
104104
"""Return True if the provider is a cloud provider, False otherwise."""

tests/integration/test_config_validation_flow.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from datetime import timedelta
1818
from pathlib import Path
19-
from unittest.mock import AsyncMock, Mock, NonCallableMock
19+
from unittest.mock import AsyncMock, Mock
2020

2121
import pytest
2222

@@ -115,8 +115,10 @@ def mock_checkpoint_manager(test_checkpoint_data: dict) -> Mock:
115115
manager.delete = AsyncMock()
116116
# Some tests may call `load_checkpoint()` instead of `load()`;
117117
# make it an alias so both return the same checkpoint object.
118-
manager.load_checkpoint = manager.load
119-
manager.validate_checkpoint_compatibility = AsyncMock(return_value=(True, "NONE"))
118+
if hasattr(manager, "load_checkpoint"):
119+
manager.load_checkpoint = manager.load
120+
if hasattr(manager, "validate_checkpoint_compatibility"):
121+
manager.validate_checkpoint_compatibility = AsyncMock(return_value=(True, "NONE"))
120122

121123
# Configure synchronous fingerprint helpers with real CheckpointSettingsFingerprint
122124
# instances so ConfigChangeAnalyzer's ``is_compatible_with`` comparison works correctly.

0 commit comments

Comments
 (0)