Skip to content
Draft
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import sys

sys.path.insert(0, os.path.abspath("./"))
sys.path.insert(0, os.path.abspath("../"))
# sys.path.insert(0, os.path.abspath("../"))
sys.path.append(os.path.abspath("./_ext"))

# -- Project information -----------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions docs/skip_api_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def _skip_api_items(app, what, name, obj, skip, options):
skip = True
elif what == "module" and len(name.split(".")) > 3:
skip = True
elif "add_doc_from" in name:
skip = True

# if not skip:
# print(f"{what} {name}")
Expand Down
7 changes: 5 additions & 2 deletions src/earthkit/meteo/thermo/thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
# nor does it submit to any jurisdiction.
#

from earthkit.meteo.utils.docs import add_doc_from

from . import array


def celsius_to_kelvin(*args, **kwargs):
return array.celsius_to_kelvin(*args, **kwargs)
@add_doc_from(array.celsius_to_kelvin)
def celsius_to_kelvin(t):
return array.celsius_to_kelvin(t)


def kelvin_to_celsius(*args, **kwargs):
Expand Down
16 changes: 16 additions & 0 deletions src/earthkit/meteo/utils/docs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# (C) Copyright 2021 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.
#


def add_doc_from(func_with_doc):
def wrapped(func):
func.__doc__ = func_with_doc.__doc__
return func

return wrapped
Loading