Skip to content

Commit

Permalink
Simplify stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Jun 30, 2024
1 parent 03de192 commit 8de4cc8
Showing 1 changed file with 2 additions and 38 deletions.
40 changes: 2 additions & 38 deletions jq.pyi
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
from collections.abc import Iterable
from typing import Any, Literal, overload
from typing import Any, overload

from typing_extensions import Self, TypeAlias, deprecated
from typing_extensions import Self, TypeAlias

JSON: TypeAlias = Any

class _EmptyValue: ...

_NO_VALUE: _EmptyValue

class _JqStatePool:
def __init__(self, program_bytes: bytes, args: Any) -> None: ...

class _Program:
def __init__(self, program_bytes: bytes, args: Any) -> None: ...
@overload
Expand All @@ -24,45 +21,14 @@ class _Program:
@property
def program_string(self) -> str: ...
def __repr__(self) -> str: ...
@overload
@deprecated("'transform' is kept for 0.1.x backwards compatibility")
def transform(
self,
value: JSON | _EmptyValue = _NO_VALUE,
text: JSON | _EmptyValue = _NO_VALUE,
*,
text_output: Literal[True],
multiple_output: Literal[False] = False,
) -> str: ...
@overload
@deprecated("'transform' is kept for 0.1.x backwards compatibility")
def transform(
self,
value: JSON | _EmptyValue = _NO_VALUE,
text: JSON | _EmptyValue = _NO_VALUE,
*,
text_output: Literal[False] = False,
multiple_output: Literal[True],
) -> list[JSON]: ...
@overload
@deprecated("'transform' is kept for 0.1.x backwards compatibility")
def transform(
self,
value: JSON | _EmptyValue = _NO_VALUE,
text: JSON | _EmptyValue = _NO_VALUE,
text_output: Literal[False] = False,
multiple_output: Literal[False] = False,
) -> JSON: ...

class _ProgramWithInput:
def __init__(self, jq_state_pool: _JqStatePool, bytes_input: bytes, *, slurp: bool) -> None: ...
def __iter__(self) -> _ResultIterator: ...
def text(self) -> str: ...
def all(self) -> list[JSON]: ...
def first(self) -> JSON: ...

class _ResultIterator:
def __init__(self, jq_state_pool: _JqStatePool, bytes_input: bytes, *, slurp: bool) -> None: ...
def __iter__(self) -> Self: ...
def __next__(self) -> JSON: ...

Expand All @@ -83,5 +49,3 @@ def iter(program: str, value: _EmptyValue = _NO_VALUE, *, text: str) -> _ResultI
def text(program: str, value: JSON, text: _EmptyValue = _NO_VALUE) -> str: ...
@overload
def text(program: str, value: _EmptyValue = _NO_VALUE, *, text: str) -> str: ...
@deprecated("'jq' is kept for 0.1.x backwards compatibility")
def jq(program: str) -> _Program: ...

0 comments on commit 8de4cc8

Please sign in to comment.