Skip to content

Commit

Permalink
docs: expose __(cuda_)array_interface__
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Feb 22, 2024
1 parent 3ff22d6 commit cd950be
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cuvec/cpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ def __new__(cls, arr):
(do not do `cuvec.CuVec((42, 1337))`;
instead use `cuvec.zeros((42, 137))`"""))

__array_interface__: Dict[str,
Any] # <https://numpy.org/doc/stable/reference/arrays.interface.html>

@property
def __cuda_array_interface__(self) -> Dict[str, Any]:
"""<https://numba.readthedocs.io/en/stable/cuda/cuda_array_interface.html>"""
if not hasattr(self, 'cuvec'):
raise AttributeError(
dedent("""\
Expand Down
4 changes: 4 additions & 0 deletions cuvec/pybind11.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,12 @@ def __new__(cls, arr):
(do not do `cuvec.pybind11.CuVec((42, 1337))`;
instead use `cuvec.pybind11.zeros((42, 137))`"""))

__array_interface__: Dict[str,
Any] # <https://numpy.org/doc/stable/reference/arrays.interface.html>

@property
def __cuda_array_interface__(self) -> Dict[str, Any]:
"""<https://numba.readthedocs.io/en/stable/cuda/cuda_array_interface.html>"""
if not hasattr(self, 'cuvec'):
raise AttributeError(
dedent("""\
Expand Down
4 changes: 4 additions & 0 deletions cuvec/swig.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ def __new__(cls, arr):
(do not do `cuvec.swig.CuVec((42, 1337))`;
instead use `cuvec.swig.zeros((42, 137))`"""))

__array_interface__: Dict[str,
Any] # <https://numpy.org/doc/stable/reference/arrays.interface.html>

@property
def __cuda_array_interface__(self) -> Dict[str, Any]:
"""<https://numba.readthedocs.io/en/stable/cuda/cuda_array_interface.html>"""
if not hasattr(self, 'cuvec'):
raise AttributeError(
dedent("""\
Expand Down
3 changes: 2 additions & 1 deletion docs/pydoc-markdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ loaders:
search_path: [..]
processors:
- type: filter
expression: not any(name.startswith(i) for i in ('cu_', 'is_raw', '__')) and default()
expression: not any(name.startswith(i) for i in ('cu_', 'is_raw', '__new')) and default()
exclude_special: false
- type: crossref
renderer:
type: mkdocs
Expand Down

0 comments on commit cd950be

Please sign in to comment.