mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 18:04:32 +02:00
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>
This commit is contained in:
parent
d314d04215
commit
4949933917
1 changed files with 2 additions and 2 deletions
|
|
@ -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)])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue