Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: mypy fails related to simplejson.dumps #29861

Merged
merged 1 commit into from
Aug 5, 2024

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
38 of 39 checks passed
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants