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 stub file #108

Open
wants to merge 2 commits into
base: master
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
51 changes: 51 additions & 0 deletions jq.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from collections.abc import Iterable
from typing import Any, overload

from typing_extensions import Self, TypeAlias

JSON: TypeAlias = Any

class _EmptyValue: ...

_NO_VALUE: _EmptyValue

class _Program:
def __init__(self, program_bytes: bytes, args: Any) -> None: ...
@overload
def input(self, value: JSON, text: _EmptyValue = _NO_VALUE) -> _ProgramWithInput: ...
@overload
def input(self, value: _EmptyValue = _NO_VALUE, *, text: str) -> _ProgramWithInput: ...
def input_value(self, value: JSON) -> _ProgramWithInput: ...
def input_values(self, values: Iterable[JSON]) -> _ProgramWithInput: ...
def input_text(self, text: str, *, slurp: bool = False) -> _ProgramWithInput: ...
@property
def program_string(self) -> str: ...
def __repr__(self) -> str: ...

class _ProgramWithInput:
def __iter__(self) -> _ResultIterator: ...
def text(self) -> str: ...
def all(self) -> list[JSON]: ...
def first(self) -> JSON: ...

class _ResultIterator:
def __iter__(self) -> Self: ...
def __next__(self) -> JSON: ...

def compile(program: str, args: Any | None = None) -> _Program: ...
@overload
def all(program: str, value: JSON, text: _EmptyValue = _NO_VALUE) -> list[JSON]: ...
@overload
def all(program: str, value: _EmptyValue = _NO_VALUE, *, text: str) -> list[JSON]: ...
@overload
def first(program: str, value: JSON, text: _EmptyValue = _NO_VALUE) -> JSON: ...
@overload
def first(program: str, value: _EmptyValue = _NO_VALUE, *, text: str) -> JSON: ...
@overload
def iter(program: str, value: JSON, text: _EmptyValue = _NO_VALUE) -> _ResultIterator: ...
@overload
def iter(program: str, value: _EmptyValue = _NO_VALUE, *, text: str) -> _ResultIterator: ...
@overload
def text(program: str, value: JSON, text: _EmptyValue = _NO_VALUE) -> str: ...
@overload
def text(program: str, value: _EmptyValue = _NO_VALUE, *, text: str) -> str: ...
Empty file added py.typed
Empty file.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def _extract_tarball(self, tarball_path, lib_dir):
license='BSD 2-Clause',
ext_modules = [jq_extension],
cmdclass={"build_ext": jq_build_ext},
package_data={"jq": ["py.typed"]},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
Expand All @@ -129,4 +130,3 @@ def _extract_tarball(self, tarball_path, lib_dir):
'Programming Language :: Python :: 3.12',
],
)