pyjson5
pyjson5 copied to clipboard
typing error in dumps
In dumps, the **kw at the end causes an unknown type error:
Type of "dumps" is partially unknown
Type of "dumps" is "(obj: Any, *, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, cls: type[JSON5Encoder] | None = None, indent: int | str | None = None, separators: Tuple[str, str] | None = None, default: ((Any) -> Any) | None = None, sort_keys: bool = False, quote_keys: bool = False, trailing_commas: bool = True, allow_duplicate_keys: bool = True, quote_style: QuoteStyle = QuoteStyle.ALWAYS_DOUBLE, **kw: Unknown) -> str"Pylance[reportUnknownMemberType](https://github.com/microsoft/pylance-release/blob/main/docs/diagnostics/reportUnknownMemberType.md)
adding type ": Any" to the **kw arg fixes it.
def dumps(
obj: Any,
*,
skipkeys: bool = False,
ensure_ascii: bool = True,
check_circular: bool = True,
allow_nan: bool = True,
cls: Optional[Type['JSON5Encoder']] = None,
indent: Optional[Union[int, str]] = None,
separators: Optional[Tuple[str, str]] = None,
default: Optional[Callable[[Any], Any]] = None,
sort_keys: bool = False,
quote_keys: bool = False,
trailing_commas: bool = True,
allow_duplicate_keys: bool = True,
quote_style: QuoteStyle = QuoteStyle.ALWAYS_DOUBLE,
**kw: Any,
):
Never mind. it's a "strict" pyright check. I'll turn it off.
Looks like it's probably the right fix anyway, though.