Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make __cosmology_namespace__ a property #10

Merged
merged 1 commit into from
May 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading