Skip to content

Commit 1aa2fc3

Browse files
authored
Rename get() type param to value_type to avoid shadowing builtin
Renames the `type` parameter in `get()` (sync and async) to `value_type` across all overloads and the implementation in both `client.py` and `async_client.py`. All callers use positional args, so no call-site changes needed. Closes #57.
1 parent 9a13916 commit 1aa2fc3

2 files changed

Lines changed: 18 additions & 16 deletions

File tree

sdk/src/opendecree/async_client.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,23 +161,25 @@ def _metadata(self) -> list[tuple[str, str]]:
161161
async def get(self, tenant_id: str, field_path: str) -> str: ...
162162

163163
@overload
164-
async def get(self, tenant_id: str, field_path: str, type: type[bool]) -> bool: ...
164+
async def get(self, tenant_id: str, field_path: str, value_type: type[bool]) -> bool: ...
165165

166166
@overload
167-
async def get(self, tenant_id: str, field_path: str, type: type[int]) -> int: ...
167+
async def get(self, tenant_id: str, field_path: str, value_type: type[int]) -> int: ...
168168

169169
@overload
170-
async def get(self, tenant_id: str, field_path: str, type: type[float]) -> float: ...
170+
async def get(self, tenant_id: str, field_path: str, value_type: type[float]) -> float: ...
171171

172172
@overload
173-
async def get(self, tenant_id: str, field_path: str, type: type[timedelta]) -> timedelta: ...
173+
async def get(
174+
self, tenant_id: str, field_path: str, value_type: type[timedelta]
175+
) -> timedelta: ...
174176

175177
@overload
176178
async def get(
177179
self,
178180
tenant_id: str,
179181
field_path: str,
180-
type: type[str],
182+
value_type: type[str],
181183
*,
182184
nullable: bool,
183185
) -> str | None: ...
@@ -186,7 +188,7 @@ async def get(
186188
self,
187189
tenant_id: str,
188190
field_path: str,
189-
type: type | None = None,
191+
value_type: type | None = None,
190192
*,
191193
nullable: bool = False,
192194
) -> object:
@@ -198,7 +200,7 @@ async def get(
198200
Args:
199201
tenant_id: Tenant UUID.
200202
field_path: Dot-separated field path (e.g., "payments.fee").
201-
type: Target type (str, int, float, bool, timedelta). Defaults to str.
203+
value_type: Target type (str, int, float, bool, timedelta). Defaults to str.
202204
nullable: If True, return None for null/unset values instead of raising.
203205
204206
Returns:
@@ -208,7 +210,7 @@ async def get(
208210
NotFoundError: If the field has no value (and nullable is False).
209211
TypeMismatchError: If the value cannot be converted to the requested type.
210212
"""
211-
target_type = type or str
213+
target_type = value_type or str
212214

213215
async def _call() -> object:
214216
resp = await self._stub.GetField(

sdk/src/opendecree/client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,23 +176,23 @@ def check_compatibility(self) -> None:
176176
def get(self, tenant_id: str, field_path: str) -> str: ...
177177

178178
@overload
179-
def get(self, tenant_id: str, field_path: str, type: type[bool]) -> bool: ...
179+
def get(self, tenant_id: str, field_path: str, value_type: type[bool]) -> bool: ...
180180

181181
@overload
182-
def get(self, tenant_id: str, field_path: str, type: type[int]) -> int: ...
182+
def get(self, tenant_id: str, field_path: str, value_type: type[int]) -> int: ...
183183

184184
@overload
185-
def get(self, tenant_id: str, field_path: str, type: type[float]) -> float: ...
185+
def get(self, tenant_id: str, field_path: str, value_type: type[float]) -> float: ...
186186

187187
@overload
188-
def get(self, tenant_id: str, field_path: str, type: type[timedelta]) -> timedelta: ...
188+
def get(self, tenant_id: str, field_path: str, value_type: type[timedelta]) -> timedelta: ...
189189

190190
@overload
191191
def get(
192192
self,
193193
tenant_id: str,
194194
field_path: str,
195-
type: type[str],
195+
value_type: type[str],
196196
*,
197197
nullable: bool,
198198
) -> str | None: ...
@@ -201,7 +201,7 @@ def get(
201201
self,
202202
tenant_id: str,
203203
field_path: str,
204-
type: type | None = None,
204+
value_type: type | None = None,
205205
*,
206206
nullable: bool = False,
207207
) -> object:
@@ -213,7 +213,7 @@ def get(
213213
Args:
214214
tenant_id: Tenant UUID.
215215
field_path: Dot-separated field path (e.g., "payments.fee").
216-
type: Target type (str, int, float, bool, timedelta). Defaults to str.
216+
value_type: Target type (str, int, float, bool, timedelta). Defaults to str.
217217
nullable: If True, return None for null/unset values instead of raising.
218218
219219
Returns:
@@ -223,7 +223,7 @@ def get(
223223
NotFoundError: If the field has no value (and nullable is False).
224224
TypeMismatchError: If the value cannot be converted to the requested type.
225225
"""
226-
target_type = type or str
226+
target_type = value_type or str
227227

228228
def _call() -> object:
229229
resp = self._stub.GetField(

0 commit comments

Comments
 (0)