Skip to content
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

Add stubs for cysimdjson #13666

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions pyrightconfig.stricter.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"stubs/click-web",
"stubs/commonmark",
"stubs/corus",
"stubs/cysimdjson",
"stubs/dateparser",
"stubs/defusedxml",
"stubs/docker",
Expand Down
2 changes: 2 additions & 0 deletions stubs/cysimdjson/METADATA.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
version = "24.12"
upstream_repository = "https://github.com/TeskaLabs/cysimdjson"
21 changes: 21 additions & 0 deletions stubs/cysimdjson/cysimdjson/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from .cysimdjson import (
MAXSIZE_BYTES as MAXSIZE_BYTES,
PADDING as PADDING,
SIMDJSON_VERSION as SIMDJSON_VERSION,
JSONArray as JSONArray,
JSONElement as JSONElement,
JSONObject as JSONObject,
JSONParser as JSONParser,
addr_to_element as addr_to_element,
)

__all__ = [
"JSONParser",
"JSONObject",
"JSONArray",
"JSONElement",
"addr_to_element",
"SIMDJSON_VERSION",
"MAXSIZE_BYTES",
"PADDING",
]
49 changes: 49 additions & 0 deletions stubs/cysimdjson/cysimdjson/cysimdjson.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from collections.abc import Generator

MAXSIZE_BYTES: int
PADDING: int
SIMDJSON_VERSION: str

class JSONArray:
def at_pointer(self, key: str) -> JSONElement: ...
def export(self) -> list[object]: ...
def get_addr(self) -> int: ...
def get_value(self) -> JSONElement: ...
def __contains__(self, item: JSONElement) -> bool: ...
def __getitem__(self, key: int) -> JSONElement: ...
def __iter__(self) -> Generator[JSONElement]: ...
def __len__(self) -> int: ...
def __reduce__(self): ...

class JSONElement:
def at_pointer(self, key: str) -> JSONElement: ...
def export(self) -> object: ...
def get_addr(self) -> int: ...
def get_value(self) -> JSONElement: ...
def __reduce__(self): ...

class JSONObject:
def at_pointer(self, key: str) -> JSONElement: ...
def export(self) -> dict[str, object]: ...
def get(self, key: str, default: JSONElement | None = None) -> JSONElement | None: ...
def get_addr(self, *args, **kwargs) -> int: ...
def get_value(self) -> JSONElement: ...
def items(self) -> Generator[tuple[str, JSONElement]]: ...
def keys(self) -> Generator[str]: ...
def __contains__(self, key: str) -> bool: ...
def __getitem__(self, key: str) -> JSONElement: ...
def __iter__(self) -> Generator[str]: ...
def __len__(self) -> int: ...
def __reduce__(self): ...

class JSONParser:
def __init__(self, max_capacity: int | None = None) -> None: ...
def active_implementation(self) -> str: ...
def load(self, path: str) -> JSONElement: ...
def loads(self, content: str) -> JSONElement: ...
def parse(self, event: bytes) -> JSONElement: ...
def parse_in_place(self, event: bytes) -> JSONElement: ...
def parse_string(self, event: str) -> JSONElement: ...
def __reduce__(self): ...

def addr_to_element(element_addr: int) -> JSONElement: ...
Loading