-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
python/apigen: Fix support for pybind11 overloaded functions
This was accidentally broken by #357.
- Loading branch information
Showing
9 changed files
with
232 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# fmt: off | ||
|
||
class Dim: | ||
"""1-d index interval with optionally-implicit bounds and dimension label. | ||
Group: | ||
Indexing | ||
""" | ||
|
||
def __init__(self, *args, **kwargs) -> None: | ||
"""__init__(*args, **kwargs) | ||
Overloaded function. | ||
1. __init__(self: tensorstore_demo.Dim, label: Optional[str] = None, *, implicit_lower: bool = True, implicit_upper: bool = True) -> None | ||
Constructs an unbounded interval ``(-inf, +inf)``. | ||
Args: | ||
label: Dimension label. | ||
implicit_lower: Indicates whether the lower bound is | ||
implicit. | ||
implicit_upper: Indicates whether the upper bound is | ||
implicit. | ||
Overload: | ||
unbounded | ||
2. __init__(self: tensorstore_demo.Dim, size: Optional[int], label: Optional[str] = None, *, inclusive_min: Optional[int] = None, implicit_lower: bool = False, implicit_upper: Optional[bool] = None) -> None | ||
Constructs a sized interval ``[inclusive_min, inclusive_min+size)``. | ||
Args: | ||
size: Size of the interval. | ||
label: Dimension label. | ||
inclusive_min: Inclusive lower bound. Defaults to :python:`0`. | ||
implicit_lower: Indicates whether the lower bound is | ||
implicit. | ||
implicit_upper: Indicates whether the upper bound is | ||
implicit. Defaults to :python:`False` if | ||
:python:`size` is specified, otherwise :python:`True`. | ||
Overload: | ||
size | ||
""" | ||
|
||
def foo(self, *args, **kwargs) -> None: | ||
"""foo(*args, **kwargs) | ||
Overloaded function. | ||
1. foo(self: tensorstore_demo.Dim, label: Optional[str] = None, *, implicit_lower: bool = True, implicit_upper: bool = True) -> None | ||
Constructs an unbounded interval ``(-inf, +inf)``. | ||
Args: | ||
label: Dimension label. | ||
implicit_lower: Indicates whether the lower bound is | ||
implicit. | ||
implicit_upper: Indicates whether the upper bound is | ||
implicit. | ||
Overload: | ||
unbounded | ||
2. foo(self: tensorstore_demo.Dim, size: Optional[int], label: Optional[str] = None, *, inclusive_min: Optional[int] = None, implicit_lower: bool = False, implicit_upper: Optional[bool] = None) -> None | ||
Constructs a sized interval ``[inclusive_min, inclusive_min+size)``. | ||
Args: | ||
size: Size of the interval. | ||
label: Dimension label. | ||
inclusive_min: Inclusive lower bound. Defaults to :python:`0`. | ||
implicit_lower: Indicates whether the lower bound is | ||
implicit. | ||
implicit_upper: Indicates whether the upper bound is | ||
implicit. Defaults to :python:`False` if | ||
:python:`size` is specified, otherwise :python:`True`. | ||
Overload: | ||
size | ||
""" | ||
|
||
bar = foo |
7 changes: 7 additions & 0 deletions
7
tests/snapshots/python_apigen_test/test_pybind11_overloaded_function/Dim.__init___size.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"signatures": [ | ||
"(self: tensorstore_demo.Dim, size: Optional[int], label: Optional[str] = None, *, inclusive_min: Optional[int] = None, implicit_lower: bool = False, implicit_upper: Optional[bool] = None) -> None" | ||
], | ||
"primary_entity": true, | ||
"siblings": null | ||
} |
7 changes: 7 additions & 0 deletions
7
...napshots/python_apigen_test/test_pybind11_overloaded_function/Dim.__init___unbounded.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"signatures": [ | ||
"(self: tensorstore_demo.Dim, label: Optional[str] = None, *, implicit_lower: bool = True, implicit_upper: bool = True) -> None" | ||
], | ||
"primary_entity": true, | ||
"siblings": null | ||
} |
7 changes: 7 additions & 0 deletions
7
tests/snapshots/python_apigen_test/test_pybind11_overloaded_function/Dim.bar_size.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"signatures": [ | ||
"(self: tensorstore_demo.Dim, size: Optional[int], label: Optional[str] = None, *, inclusive_min: Optional[int] = None, implicit_lower: bool = False, implicit_upper: Optional[bool] = None) -> None" | ||
], | ||
"primary_entity": false, | ||
"siblings": null | ||
} |
7 changes: 7 additions & 0 deletions
7
tests/snapshots/python_apigen_test/test_pybind11_overloaded_function/Dim.bar_unbounded.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"signatures": [ | ||
"(self: tensorstore_demo.Dim, label: Optional[str] = None, *, implicit_lower: bool = True, implicit_upper: bool = True) -> None" | ||
], | ||
"primary_entity": false, | ||
"siblings": null | ||
} |
9 changes: 9 additions & 0 deletions
9
tests/snapshots/python_apigen_test/test_pybind11_overloaded_function/Dim.foo_size.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"signatures": [ | ||
"(self: tensorstore_demo.Dim, size: Optional[int], label: Optional[str] = None, *, inclusive_min: Optional[int] = None, implicit_lower: bool = False, implicit_upper: Optional[bool] = None) -> None" | ||
], | ||
"primary_entity": true, | ||
"siblings": { | ||
"python_apigen_test_modules.pybind11_overloaded.Dim.bar(size)": true | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
tests/snapshots/python_apigen_test/test_pybind11_overloaded_function/Dim.foo_unbounded.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"signatures": [ | ||
"(self: tensorstore_demo.Dim, label: Optional[str] = None, *, implicit_lower: bool = True, implicit_upper: bool = True) -> None" | ||
], | ||
"primary_entity": true, | ||
"siblings": { | ||
"python_apigen_test_modules.pybind11_overloaded.Dim.bar(unbounded)": true | ||
} | ||
} |