Skip to content

Commit 651b700

Browse files
PrettyWoodijl
authored andcommitted
improve stub for JSONDecodeError
1 parent e8d5d3c commit 651b700

4 files changed

Lines changed: 15 additions & 2 deletions

File tree

ci/azure-sdist.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ steps:
1616
displayName: ensure toolchain
1717
- bash: PATH=$(path) $(interpreter) -m pip install --user --upgrade pip "maturin>=0.12.18,<0.13" wheel
1818
displayName: build dependencies
19-
- bash: PATH=$(path) $(interpreter) -m pip install --user -r test/requirements.txt -r integration/requirements.txt
19+
- bash: PATH=$(path) $(interpreter) -m pip install --user -r test/requirements.txt -r integration/requirements.txt mypy==0.960
2020
displayName: test dependencies
2121
- bash: PATH=$(path) maturin sdist
2222
displayName: package sdist
@@ -28,6 +28,8 @@ steps:
2828
displayName: thread
2929
- bash: PATH=$(path) ./integration/run http
3030
displayName: http
31+
- bash: PATH=$(path) ./integration/run typestubs
32+
displayName: typestubs
3133
- bash: PATH=$(path) ./ci/deploy target/wheels/*.tar.gz
3234
displayName: deploy
3335
env:

integration/run

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ if [[ $to_run == *"http"* ]]; then
1818
pkill -f 'wsgi:app' # pkill not present on manylinux_2_24_x86_64
1919
set -e
2020
fi
21+
22+
if [[ $to_run == *"typestubs"* ]]; then
23+
python "${_dir}"/typestubs.py
24+
mypy "${_dir}"/typestubs.py
25+
fi

integration/typestubs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
2+
3+
import orjson
4+
5+
orjson.JSONDecodeError(msg="the_msg", doc="the_doc", pos=1)

orjson.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
from typing import Any, Callable, Optional, Union
23

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

12-
class JSONDecodeError(ValueError): ...
13+
class JSONDecodeError(json.JSONDecodeError): ...
1314
class JSONEncodeError(TypeError): ...
1415

1516
OPT_APPEND_NEWLINE: int

0 commit comments

Comments
 (0)