8000 Loosen constraints on ujson file functions by tjstum · Pull Request #10081 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Loosen constraints on ujson file functions #10081

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

Merged
merged 2 commits into from
Apr 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions stubs/ujson/ujson.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from _typeshed import Incomplete
from _typeshed import Incomplete, SupportsRead, SupportsWrite
from collections.abc import Callable
from typing import IO, Any, AnyStr
from typing import Any, AnyStr

__version__: str

Expand Down Expand Up @@ -32,7 +32,7 @@ def dumps(
) -> str: ...
def dump(
obj: Any,
fp: IO[str],
fp: SupportsWrite[str],
*,
ensure_ascii: bool = ...,
double_precision: int = ...,
Expand All @@ -47,6 +47,6 @@ def dump(
) -> None: ...
def decode(s: AnyStr, precise_float: bool = ...) -> Any: ...
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@AlexWaygood should I also remove these (since they aren't being used as a TypeVar)?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, they look incorrect. I didn't want to ask you to change them in this PR since they are unrelated to the change you were making, but a followup PR fixing these would be welcome! :)

def loads(s: AnyStr, precise_float: bool = ...) -> Any: ...
def load(fp: IO[AnyStr], precise_float: bool = ...) -> Any: ...
def load(fp: SupportsRead[str | bytes], precise_float: bool = ...) -> Any: ...

class JSONDecodeError(ValueError): ...
0