Skip to content

Commit

Permalink
Make __cosmology_namespace__ a property
Browse files Browse the repository at this point in the history
Signed-off-by: Nathaniel Starkman <nstarman@users.noreply.github.com>
  • Loading branch information
nstarman committed May 16, 2023
1 parent 7853add commit a823243
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions src/cosmology/compat/classy/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,9 @@ def __post_init__(self) -> None:
self._cosmo_fn: dict[str, Any]
object.__setattr__(self, "_cosmo_fn", {})

def __cosmology_namespace__(
self, /, *, api_version: str | None = None
) -> CosmologyNamespace:
"""Returns an object that has all the cosmology API functions on it.
Parameters
----------
api_version: Optional[str]
string representing the version of the cosmology API specification
to be returned, in ``'YYYY.MM'`` form, for example, ``'2020.10'``.
If ``None``, it return the namespace corresponding to latest version
of the cosmology API specification. If the given version is invalid
or not implemented for the given module, an error is raised.
Default: ``None``.
.. note:: currently only `None` is supported.
Returns
-------
`CosmologyNamespace`
An object representing the CAMB cosmology API namespace.
"""
@property
def __cosmology_namespace__(self) -> CosmologyNamespace:
"""Returns :class:`~cosmology.api.CosmologyNamespace` for CLASS."""
import cosmology.compat.classy as namespace

return cast(CosmologyNamespace, namespace)

0 comments on commit a823243

Please sign in to comment.