Skip to content

Commit

Permalink
improve stub for JSONDecodeError
Browse files Browse the repository at this point in the history
  • Loading branch information
PrettyWood authored and ijl committed Jun 3, 2022
1 parent e8d5d3c commit 651b700
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ci/azure-sdist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ steps:
displayName: ensure toolchain
- bash: PATH=$(path) $(interpreter) -m pip install --user --upgrade pip "maturin>=0.12.18,<0.13" wheel
displayName: build dependencies
- bash: PATH=$(path) $(interpreter) -m pip install --user -r test/requirements.txt -r integration/requirements.txt
- bash: PATH=$(path) $(interpreter) -m pip install --user -r test/requirements.txt -r integration/requirements.txt mypy==0.960
displayName: test dependencies
- bash: PATH=$(path) maturin sdist
displayName: package sdist
Expand All @@ -28,6 +28,8 @@ steps:
displayName: thread
- bash: PATH=$(path) ./integration/run http
displayName: http
- bash: PATH=$(path) ./integration/run typestubs
displayName: typestubs
- bash: PATH=$(path) ./ci/deploy target/wheels/*.tar.gz
displayName: deploy
env:
Expand Down
5 changes: 5 additions & 0 deletions integration/run
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ if [[ $to_run == *"http"* ]]; then
pkill -f 'wsgi:app' # pkill not present on manylinux_2_24_x86_64
set -e
fi

if [[ $to_run == *"typestubs"* ]]; then
python "${_dir}"/typestubs.py
mypy "${_dir}"/typestubs.py
fi
5 changes: 5 additions & 0 deletions integration/typestubs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

import orjson

orjson.JSONDecodeError(msg="the_msg", doc="the_doc", pos=1)
3 changes: 2 additions & 1 deletion orjson.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
from typing import Any, Callable, Optional, Union

__version__: str
Expand All @@ -9,7 +10,7 @@ def dumps(
) -> bytes: ...
def loads(__obj: Union[bytes, bytearray, memoryview, str]) -> Any: ...

class JSONDecodeError(ValueError): ...
class JSONDecodeError(json.JSONDecodeError): ...
class JSONEncodeError(TypeError): ...

OPT_APPEND_NEWLINE: int
Expand Down

0 comments on commit 651b700

Please sign in to comment.