typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

[jsonschema] Improve stubs

Open donbarbos opened this issue 6 months ago • 5 comments

donbarbos avatar Jun 11 '25 13:06 donbarbos

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Jun 11 '25 13:06 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Jun 11 '25 16:06 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Jun 11 '25 17:06 github-actions[bot]

Diff from mypy_primer, showing the effect of this PR on open source code:

cloud-init (https://github.com/canonical/cloud-init)
+ cloudinit/config/schema.py:475: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, Any, Any, type[Exception]], Any]", target has type "SchemaKeywordValidator")  [assignment]
+ cloudinit/config/schema.py:475: note: "SchemaKeywordValidator.__call__" has type "Callable[[Arg(Validator, 'validator'), Arg(Any, 'value'), Arg(Any, 'instance'), Arg(bool | Mapping[str, Any], 'schema')], None]"
+ cloudinit/config/schema.py:476: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, Any, Any, type[Exception]], Any]", target has type "SchemaKeywordValidator")  [assignment]
+ cloudinit/config/schema.py:476: note: "SchemaKeywordValidator.__call__" has type "Callable[[Arg(Validator, 'validator'), Arg(Any, 'value'), Arg(Any, 'instance'), Arg(bool | Mapping[str, Any], 'schema')], None]"
+ cloudinit/config/schema.py:480: error: Argument "validators" to "create" has incompatible type "dict[str, SchemaKeywordValidator]"; expected "Mapping[str, Callable[[Any, Any, Mapping[str, Any] | list[Any] | str | int | float | bool | None, Mapping[str, Any]], Iterator[ValidationError]]] | tuple[()]"  [arg-type]
+ cloudinit/config/schema.py:482: error: Argument 4 to "create" has incompatible type "**dict[str, TypeChecker]"; expected "FormatChecker"  [arg-type]
+ cloudinit/config/schema.py:482: error: Argument 4 to "create" has incompatible type "**dict[str, TypeChecker]"; expected "Callable[[bool | Mapping[str, Any]], str]"  [arg-type]
+ cloudinit/config/schema.py:482: error: Argument 4 to "create" has incompatible type "**dict[str, TypeChecker]"; expected "Callable[[bool | Mapping[str, Any]], Iterable[tuple[str, Callable[[Any, Any, Mapping[str, Any] | list[Any] | str | int | float | bool | None, Mapping[str, Any]], Iterator[ValidationError]]]]]"  [arg-type]

prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/utilities/schema_tools/validation.py:43: error: Dict entry 0 has incompatible type "str": "Callable[[_Validator, object, Any, Any], Iterator[ValidationError]]"; expected "str": "SchemaKeywordValidator"  [dict-item]
+ src/prefect/utilities/schema_tools/validation.py:51: error: Argument "validators" to "create" has incompatible type "dict[str, SchemaKeywordValidator]"; expected "Union[Mapping[str, Callable[[Any, Any, Union[Mapping[str, Any], list[Any], str, int, float, bool, None], Mapping[str, Any]], Iterator[ValidationError]]], tuple[()]]"  [arg-type]

github-actions[bot] avatar Jun 13 '25 15:06 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Jun 13 '25 15:06 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Jul 07 '25 14:07 github-actions[bot]