Skip to content

Commit

Permalink
Add docs for getting current backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
hameerabbasi committed Apr 24, 2019
1 parent 5c48a8c commit e36a2ef
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/generated/uarray.get_current_backend.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
uarray.get\_current\_backend
============================

.. currentmodule:: uarray

.. autofunction:: get_current_backend
2 changes: 2 additions & 0 deletions docs/generated/uarray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

register_backend

get_current_backend

.. rubric:: Context Managers
.. autosummary::
:toctree:
Expand Down
10 changes: 10 additions & 0 deletions uarray/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,15 @@ def _backend_order_iter() -> Iterable[BackendOptions]:


def get_current_backend() -> Optional[BackendOptions]:
"""
Returns the current backend, with options. ``None`` indicates that
there is no possible backend that can be used.
See Also
--------
BackendOptions: The backend, plus any associated options.
set_backend: Set the current backend.
"""
be = _current_backend.get()

if be is None:
Expand All @@ -461,6 +470,7 @@ class set_backend:
See Also
--------
BackendOptions: The backend plus options.
get_current_backend: Get the current backend.
skip_backend: A context manager that allows skipping of backends.
DispatchableInstance: Items to be coerced must be marked by a DispatchableInstance.
"""
Expand Down

0 comments on commit e36a2ef

Please sign in to comment.