Skip to content

Conversation

@mistercrunch
Copy link
Member

@mistercrunch mistercrunch commented Aug 5, 2024

I'm not sure why this mypy pre-commit issue started triggering, but decided to take on fixing the issue and making the code more readable and DRY

For the record, and searchability, the original error was

superset/utils/json.py:215: error: No overload variant of "dumps" matches argument types "Any", "Optional[Callable[[Any], Any]]", "bool", "bool", "bool", "Union[str, int, None]", "Optional[Tuple[str, str]]", "Optional[Type[JSONEncoder]]", "None"  [call-overload]
superset/utils/json.py:215: note: Possible overload variants:
superset/utils/json.py:215: note:     def dumps(obj: Any, skipkeys: bool = ..., ensure_ascii: bool = ..., check_circular: bool = ..., allow_nan: bool = ..., *, cls: Type[JSONEncoder], indent: Union[str, int, None] = ..., separators: Optional[Tuple[str, str]] = ..., encoding: str = ..., default: Optional[Callable[[Any], Any]] = ..., use_decimal: bool = ..., namedtuple_as_object: bool = ..., tuple_as_array: bool = ..., bigint_as_string: bool = ..., sort_keys: bool = ..., item_sort_key: Optional[Callable[[Any], Union[SupportsDunderLT[Any], SupportsDunderGT[Any]]]] = ..., for_json: bool = ..., ignore_nan: bool = ..., int_as_string_bitcount: Optional[int] = ..., iterable_as_array: bool = ..., **kw: Any) -> str
superset/utils/json.py:215: note:     def dumps(obj: Any, skipkeys: bool = ..., ensure_ascii: bool = ..., check_circular: bool = ..., allow_nan: bool = ..., cls: Optional[Type[JSONEncoder]] = ..., indent: Union[str, int, None] = ..., separators: Optional[Tuple[str, str]] = ..., encoding: str = ..., default: Optional[Callable[[Any], Any]] = ..., use_decimal: bool = ..., namedtuple_as_object: bool = ..., tuple_as_array: bool = ..., bigint_as_string: bool = ..., sort_keys: bool = ..., item_sort_key: Optional[Callable[[Any], Union[SupportsDunderLT[Any], SupportsDunderGT[Any]]]] = ..., for_json: bool = ..., ignore_nan: bool = ..., int_as_string_bitcount: Optional[int] = ..., iterable_as_array: bool = ...) -> str
Found 1 error in 1 file (checked 1 source file)

No sure why this started triggering, but decided to take on fixing the issue and making the code more DRY
Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and LGT my friend Claude, too.

@mistercrunch mistercrunch merged commit c27db07 into master Aug 5, 2024
@mistercrunch mistercrunch deleted the fix_json_dumps_types branch August 5, 2024 20:18
WanjohiWanjohi pushed a commit to IDinsight/surveystream_superset_source that referenced this pull request Aug 6, 2024
nyohasstium pushed a commit to Webgains/superset that referenced this pull request Jan 2, 2025
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 5.0.0 First shipped in 5.0.0 labels Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset-io size/M 🚢 5.0.0 First shipped in 5.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants