Skip to content

Commit

Permalink
chore: Update stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
sizmailov committed Nov 25, 2023
1 parent 37feafd commit 562ada4
Show file tree
Hide file tree
Showing 60 changed files with 713 additions and 214 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from __future__ import annotations

import pybind11_stubgen.typing_ext

import demo._bindings.classes

__all__ = ["value"]
value: demo._bindings.classes.Foo # value = <demo._bindings.classes.Foo object>
value: demo._bindings.classes.Foo = pybind11_stubgen.typing_ext.ValueExpr(
"<demo._bindings.classes.Foo object>"
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ from __future__ import annotations

import typing

import pybind11_stubgen.typing_ext

import demo._bindings.classes

__all__ = ["Bar1"]

class Bar1:
foo: typing.ClassVar[
demo._bindings.classes.Foo
] # value = <demo._bindings.classes.Foo object>
] = pybind11_stubgen.typing_ext.ValueExpr("<demo._bindings.classes.Foo object>")
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ from __future__ import annotations

import typing

import pybind11_stubgen.typing_ext

__all__ = ["Base", "CppException", "Derived", "Foo", "Outer"]

class Base:
Expand Down Expand Up @@ -34,11 +36,17 @@ class Outer:
TWO
"""

ONE: typing.ClassVar[Outer.Inner.NestedEnum] # value = <NestedEnum.ONE: 1>
TWO: typing.ClassVar[Outer.Inner.NestedEnum] # value = <NestedEnum.TWO: 2>
ONE: typing.ClassVar[
Outer.Inner.NestedEnum
] = pybind11_stubgen.typing_ext.ValueExpr("<NestedEnum.ONE: 1>")
TWO: typing.ClassVar[
Outer.Inner.NestedEnum
] = pybind11_stubgen.typing_ext.ValueExpr("<NestedEnum.TWO: 2>")
__members__: typing.ClassVar[
dict[str, Outer.Inner.NestedEnum]
] # value = {'ONE': <NestedEnum.ONE: 1>, 'TWO': <NestedEnum.TWO: 2>}
] = pybind11_stubgen.typing_ext.ValueExpr(
"{'ONE': <NestedEnum.ONE: 1>, 'TWO': <NestedEnum.TWO: 2>}"
)
def __eq__(self, other: typing.Any) -> bool: ...
def __getstate__(self) -> int: ...
def __hash__(self) -> int: ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ from __future__ import annotations

import typing

import pybind11_stubgen.typing_ext

__all__ = ["ConsoleForegroundColor", "Magenta", "accepts_ambiguous_enum"]

class ConsoleForegroundColor:
Expand All @@ -13,10 +15,12 @@ class ConsoleForegroundColor:

Magenta: typing.ClassVar[
ConsoleForegroundColor
] # value = <ConsoleForegroundColor.Magenta: 35>
] = pybind11_stubgen.typing_ext.ValueExpr("<ConsoleForegroundColor.Magenta: 35>")
__members__: typing.ClassVar[
dict[str, ConsoleForegroundColor]
] # value = {'Magenta': <ConsoleForegroundColor.Magenta: 35>}
] = pybind11_stubgen.typing_ext.ValueExpr(
"{'Magenta': <ConsoleForegroundColor.Magenta: 35>}"
)
def __eq__(self, other: typing.Any) -> bool: ...
def __getstate__(self) -> int: ...
def __hash__(self) -> int: ...
Expand All @@ -32,6 +36,12 @@ class ConsoleForegroundColor:
@property
def value(self) -> int: ...

def accepts_ambiguous_enum(color: ConsoleForegroundColor = ...) -> None: ...
def accepts_ambiguous_enum(
color: ConsoleForegroundColor = pybind11_stubgen.typing_ext.InvalidExpr(
"<ConsoleForegroundColor.Magenta: 35>"
),
) -> None: ...

Magenta: ConsoleForegroundColor # value = <ConsoleForegroundColor.Magenta: 35>
Magenta: ConsoleForegroundColor = pybind11_stubgen.typing_ext.ValueExpr(
"<ConsoleForegroundColor.Magenta: 35>"
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ from __future__ import annotations
import typing

import numpy
import pybind11_stubgen.typing_ext
import scipy.sparse

__all__ = [
Expand All @@ -25,12 +26,20 @@ N = typing.TypeVar("N", bound=int)

def accept_matrix_int(
arg0: numpy.ndarray[
tuple[typing.Literal[3], typing.Literal[3]], numpy.dtype[numpy.int32]
tuple[
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("3")],
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("3")],
],
numpy.dtype[numpy.int32],
]
) -> None: ...
def accept_vector_float64(
arg0: numpy.ndarray[
tuple[typing.Literal[3], typing.Literal[1]], numpy.dtype[numpy.float64]
tuple[
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("3")],
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("1")],
],
numpy.dtype[numpy.float64],
]
) -> None: ...
def dense_matrix_c(
Expand All @@ -41,30 +50,62 @@ def dense_matrix_r(
) -> numpy.ndarray[tuple[M, N], numpy.dtype[numpy.float32]]: ...
def fixed_mutator_a(
arg0: numpy.ndarray[
tuple[typing.Literal[5], typing.Literal[6]], numpy.dtype[numpy.float32]
tuple[
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("5")],
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("6")],
],
numpy.dtype[numpy.float32],
]
) -> None: ...
def fixed_mutator_c(
arg0: numpy.ndarray[
tuple[typing.Literal[5], typing.Literal[6]], numpy.dtype[numpy.float32]
tuple[
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("5")],
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("6")],
],
numpy.dtype[numpy.float32],
]
) -> None: ...
def fixed_mutator_r(
arg0: numpy.ndarray[
tuple[typing.Literal[5], typing.Literal[6]], numpy.dtype[numpy.float32]
tuple[
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("5")],
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("6")],
],
numpy.dtype[numpy.float32],
]
) -> None: ...
def four_col_matrix_r(
arg0: numpy.ndarray[tuple[M, typing.Literal[4]], numpy.dtype[numpy.float32]]
) -> numpy.ndarray[tuple[M, typing.Literal[4]], numpy.dtype[numpy.float32]]: ...
arg0: numpy.ndarray[
tuple[M, typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("4")]],
numpy.dtype[numpy.float32],
]
) -> numpy.ndarray[
tuple[M, typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("4")]],
numpy.dtype[numpy.float32],
]: ...
def four_row_matrix_r(
arg0: numpy.ndarray[tuple[typing.Literal[4], N], numpy.dtype[numpy.float32]]
) -> numpy.ndarray[tuple[typing.Literal[4], N], numpy.dtype[numpy.float32]]: ...
arg0: numpy.ndarray[
tuple[typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("4")], N],
numpy.dtype[numpy.float32],
]
) -> numpy.ndarray[
tuple[typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("4")], N],
numpy.dtype[numpy.float32],
]: ...
def get_matrix_int() -> numpy.ndarray[
tuple[typing.Literal[3], typing.Literal[3]], numpy.dtype[numpy.int32]
tuple[
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("3")],
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("3")],
],
numpy.dtype[numpy.int32],
]: ...
def get_vector_float64() -> numpy.ndarray[
tuple[typing.Literal[3], typing.Literal[1]], numpy.dtype[numpy.float64]
tuple[
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("3")],
typing.Literal[pybind11_stubgen.typing_ext.ValueExpr("1")],
],
numpy.dtype[numpy.float64],
]: ...
def sparse_matrix_c(arg0: scipy.sparse.csc_matrix) -> scipy.sparse.csc_matrix: ...
def sparse_matrix_r(arg0: scipy.sparse.csr_matrix) -> scipy.sparse.csr_matrix: ...
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ from __future__ import annotations

import typing

import pybind11_stubgen.typing_ext

__all__ = [
"Blue",
"ConsoleForegroundColor",
Expand Down Expand Up @@ -29,22 +31,24 @@ class ConsoleForegroundColor:

Blue: typing.ClassVar[
ConsoleForegroundColor
] # value = <ConsoleForegroundColor.Blue: 34>
] = pybind11_stubgen.typing_ext.ValueExpr("<ConsoleForegroundColor.Blue: 34>")
Green: typing.ClassVar[
ConsoleForegroundColor
] # value = <ConsoleForegroundColor.Green: 32>
] = pybind11_stubgen.typing_ext.ValueExpr("<ConsoleForegroundColor.Green: 32>")
Magenta: typing.ClassVar[
ConsoleForegroundColor
] # value = <ConsoleForegroundColor.Magenta: 35>
] = pybind11_stubgen.typing_ext.ValueExpr("<ConsoleForegroundColor.Magenta: 35>")
None_: typing.ClassVar[
ConsoleForegroundColor
] # value = <ConsoleForegroundColor.None_: -1>
] = pybind11_stubgen.typing_ext.ValueExpr("<ConsoleForegroundColor.None_: -1>")
Yellow: typing.ClassVar[
ConsoleForegroundColor
] # value = <ConsoleForegroundColor.Yellow: 33>
] = pybind11_stubgen.typing_ext.ValueExpr("<ConsoleForegroundColor.Yellow: 33>")
__members__: typing.ClassVar[
dict[str, ConsoleForegroundColor]
] # value = {'Green': <ConsoleForegroundColor.Green: 32>, 'Yellow': <ConsoleForegroundColor.Yellow: 33>, 'Blue': <ConsoleForegroundColor.Blue: 34>, 'Magenta': <ConsoleForegroundColor.Magenta: 35>, 'None_': <ConsoleForegroundColor.None_: -1>}
] = pybind11_stubgen.typing_ext.ValueExpr(
"{'Green': <ConsoleForegroundColor.Green: 32>, 'Yellow': <ConsoleForegroundColor.Yellow: 33>, 'Blue': <ConsoleForegroundColor.Blue: 34>, 'Magenta': <ConsoleForegroundColor.Magenta: 35>, 'None_': <ConsoleForegroundColor.None_: -1>}"
)
def __eq__(self, other: typing.Any) -> bool: ...
def __getstate__(self) -> int: ...
def __hash__(self) -> int: ...
Expand All @@ -64,8 +68,18 @@ def accept_defaulted_enum(
color: ConsoleForegroundColor = ConsoleForegroundColor.None_,
) -> None: ...

Blue: ConsoleForegroundColor # value = <ConsoleForegroundColor.Blue: 34>
Green: ConsoleForegroundColor # value = <ConsoleForegroundColor.Green: 32>
Magenta: ConsoleForegroundColor # value = <ConsoleForegroundColor.Magenta: 35>
None_: ConsoleForegroundColor # value = <ConsoleForegroundColor.None_: -1>
Yellow: ConsoleForegroundColor # value = <ConsoleForegroundColor.Yellow: 33>
Blue: ConsoleForegroundColor = pybind11_stubgen.typing_ext.ValueExpr(
"<ConsoleForegroundColor.Blue: 34>"
)
Green: ConsoleForegroundColor = pybind11_stubgen.typing_ext.ValueExpr(
"<ConsoleForegroundColor.Green: 32>"
)
Magenta: ConsoleForegroundColor = pybind11_stubgen.typing_ext.ValueExpr(
"<ConsoleForegroundColor.Magenta: 35>"
)
None_: ConsoleForegroundColor = pybind11_stubgen.typing_ext.ValueExpr(
"<ConsoleForegroundColor.None_: -1>"
)
Yellow: ConsoleForegroundColor = pybind11_stubgen.typing_ext.ValueExpr(
"<ConsoleForegroundColor.Yellow: 33>"
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ from __future__ import annotations

import typing

import pybind11_stubgen.typing_ext

__all__ = [
"Enum",
"Unbound",
Expand All @@ -18,8 +20,32 @@ class Enum:
class Unbound:
pass

def accept_unbound_enum(arg0: typing.Annotated[typing.Any, ...]) -> int: ...
def accept_unbound_enum_defaulted(x: Enum = ...) -> int: ...
def accept_unbound_type(arg0: tuple[typing.Annotated[typing.Any, ...], int]) -> int: ...
def accept_unbound_type_defaulted(x: Unbound = ...) -> int: ...
def get_unbound_type() -> typing.Annotated[typing.Any, ...]: ...
def accept_unbound_enum(
arg0: typing.Annotated[
typing.Any,
pybind11_stubgen.typing_ext.InvalidExpr("(anonymous namespace)::Enum"),
]
) -> int: ...
def accept_unbound_enum_defaulted(
x: Enum = pybind11_stubgen.typing_ext.InvalidExpr(
"<demo._bindings.flawed_bindings.Enum object>"
),
) -> int: ...
def accept_unbound_type(
arg0: tuple[
typing.Annotated[
typing.Any,
pybind11_stubgen.typing_ext.InvalidExpr("(anonymous namespace)::Unbound"),
],
int,
]
) -> int: ...
def accept_unbound_type_defaulted(
x: Unbound = pybind11_stubgen.typing_ext.InvalidExpr(
"<demo._bindings.flawed_bindings.Unbound object>"
),
) -> int: ...
def get_unbound_type() -> typing.Annotated[
typing.Any,
pybind11_stubgen.typing_ext.InvalidExpr("(anonymous namespace)::Unbound"),
]: ...
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ from __future__ import annotations

import typing

import pybind11_stubgen.typing_ext

__all__ = ["issue_51_catastrophic_regex", "issue_73_utf8_doc_chars"]

def issue_51_catastrophic_regex(arg0: int, arg1: int) -> None:
Expand All @@ -21,4 +23,4 @@ def issue_73_utf8_doc_chars() -> None:
values provide more damping in response.
"""

_cleanup: typing.Any # value = <capsule object>
_cleanup: typing.Any = pybind11_stubgen.typing_ext.ValueExpr("<capsule object>")
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ from __future__ import annotations
import datetime

import numpy
import pybind11_stubgen.typing_ext
from numpy import random

__all__ = [
Expand All @@ -27,10 +28,14 @@ class Foo:

def add_day(arg0: datetime.datetime) -> datetime.datetime: ...

foolist: list # value = [<demo._bindings.values.Foo object>, <demo._bindings.values.Foo object>]
foovar: Foo # value = <demo._bindings.values.Foo object>
foolist: list = pybind11_stubgen.typing_ext.ValueExpr(
"[<demo._bindings.values.Foo object>, <demo._bindings.values.Foo object>]"
)
foovar: Foo = pybind11_stubgen.typing_ext.ValueExpr(
"<demo._bindings.values.Foo object>"
)
list_with_none: list = [None, 2, {}]
none = None
t_10ms: datetime.timedelta # value = datetime.timedelta(microseconds=10000)
t_20ns: datetime.timedelta # value = datetime.timedelta(0)
t_30s: datetime.timedelta # value = datetime.timedelta(seconds=30)
t_10ms: datetime.timedelta = datetime.timedelta(microseconds=10000)
t_20ns: datetime.timedelta = datetime.timedelta(0)
t_30s: datetime.timedelta = datetime.timedelta(seconds=30)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ from __future__ import annotations
import sys as sys
import typing as typing

import pybind11_stubgen.typing_ext

from demo.pure_python.functions_3_8_plus import args_mix
from demo.pure_python.functions_3_9_plus import generic_alias_annotation

Expand All @@ -24,8 +26,12 @@ class _Dummy:
def foo(): ...

def accept_frozenset(arg: frozenset[int | float]) -> int | None: ...
def builtin_function_as_default_arg(func: type(len) = len): ...
def function_as_default_arg(func: type(search) = search): ...
def builtin_function_as_default_arg(
func: pybind11_stubgen.typing_ext.ValueExpr("type(len)") = len,
): ...
def function_as_default_arg(
func: pybind11_stubgen.typing_ext.ValueExpr("type(search)") = search,
): ...
def lambda_as_default_arg(callback=...): ...
def search(a: int, b: list[int]) -> int: ...
def static_method_as_default_arg(callback=_Dummy.foo): ...
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ def args_mix(
*args: int,
x: int = 1,
y=int,
**kwargs: typing.Dict[int, str],
**kwargs: dict[int, str],
): ...
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from __future__ import annotations

import pybind11_stubgen.typing_ext

import demo._bindings.classes

__all__ = ["value"]
value: demo._bindings.classes.Foo # value = <demo._bindings.classes.Foo object>
value: demo._bindings.classes.Foo = pybind11_stubgen.typing_ext.ValueExpr(
"<demo._bindings.classes.Foo object>"
)
Loading

0 comments on commit 562ada4

Please sign in to comment.