From 49499339179943c3342a81b22a3969c9ed3daaa8 Mon Sep 17 00:00:00 2001 From: tomaioo Date: Mon, 6 Jul 2026 23:10:15 -0700 Subject: [PATCH] refactor: built-in name shadowing in `jsonsplit` signature The `jsonsplit` function in `recipes.py` uses `type` as a parameter name, shadowing the Python built-in `type`. This can cause subtle bugs if the built-in is needed within the function scope or in nested calls, and it reduces code clarity for readers. Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com> --- sqlite_utils/recipes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlite_utils/recipes.py b/sqlite_utils/recipes.py index 55b55a41e..a39462935 100644 --- a/sqlite_utils/recipes.py +++ b/sqlite_utils/recipes.py @@ -68,9 +68,9 @@ def parsedatetime( def jsonsplit( - value: str, delimiter: str = ",", type: Callable[[str], object] = str + value: str, delimiter: str = ",", type_: Callable[[str], object] = str ) -> str: """ Convert a string like a,b,c into a JSON array ["a", "b", "c"] """ - return json.dumps([type(s.strip()) for s in value.split(delimiter)]) + return json.dumps([type_(s.strip()) for s in value.split(delimiter)])