This PR refactors the get_connections function in smartcar.py to enhance its type hinting and parameter handling. The changes include:
Type Hinting Updates:
Added NamedTuple and Optional from the typing module.
Changed filter and paging parameters to use Optional[Dict[str, str]] and Optional[Dict[str, Optional[int]]] respectively.
Parameter Handling Improvements:
Initialized filter and paging with empty dictionaries if they are not provided to avoid mutable default arguments.
Simplified the parameter extraction logic for filter and paging to be more concise and readable.
Docstring Updates:
Modified the docstring of the get_connections function to reflect the updated parameter types and provided detailed descriptions for each key in filter and paging.
Summary
This PR refactors the
get_connections
function insmartcar.py
to enhance its type hinting and parameter handling. The changes include:Type Hinting Updates:
NamedTuple
andOptional
from the typing module.filter
andpaging
parameters to useOptional[Dict[str, str]]
andOptional[Dict[str, Optional[int]]]
respectively.Parameter Handling Improvements:
filter
andpaging
with empty dictionaries if they are not provided to avoid mutable default arguments.filter
andpaging
to be more concise and readable.Docstring Updates:
get_connections
function to reflect the updated parameter types and provided detailed descriptions for each key infilter
andpaging
.Why This Change Is Needed
Fixes: https://github.com/smartcar/python-sdk/issues/137