Skip to content

Commit 64b8658

Browse files
committed
refactor(preprocess): refactor stringify function in preprocess module
- Rename 'val' parameter to 'argument' for clarity - Simplify conditional logic for boolean and integer handling
1 parent 15cdb4e commit 64b8658

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/typesense/preprocess.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@
2424
StringifiedParamSchema: typing.TypeAlias = typing.Dict[str, str]
2525

2626

27-
def stringify(val: _Types) -> str:
28-
if not isinstance(val, (str, int, bool)):
29-
raise InvalidParameter(f"Value {val} is not a string, integer, or boolean.")
30-
if isinstance(val, bool) or isinstance(val, int):
31-
return str(val).lower()
32-
else:
33-
return val
27+
def stringify(argument: _Types) -> str:
28+
if not isinstance(argument, (str, int, bool)):
29+
raise InvalidParameter(
30+
f"Value {argument} is not a string, integer, or boolean.",
31+
)
32+
if isinstance(argument, (bool, int)):
33+
return str(argument).lower()
34+
return argument
3435

3536

3637
def process_param_list(

0 commit comments

Comments
 (0)