Skip to content

Commit

Permalink
Add link to Path in docstring + added intersphinx
Browse files Browse the repository at this point in the history
Refs #43
  • Loading branch information
sverhoeven committed Jul 8, 2021
1 parent 33afb56 commit 5ed4a31
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
21 changes: 20 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'nbsphinx']
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'nbsphinx', 'sphinx.ext.intersphinx']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -240,3 +240,22 @@ def setup(app):
('pcrglobwb', 'params_style'),
('wflow', 'params_style'),
]

intersphinx_mapping = {
'cf_units': ('https://scitools.org.uk/cf-units/docs/latest/', None),
'esmvalcore':
(f'https://docs.esmvaltool.org/projects/esmvalcore/en/latest/',
None),
'esmvaltool': (f'https://docs.esmvaltool.org/en/latest/', None),
'grpc4bmi': (f'https://grpc4bmi.readthedocs.io/en/latest/', None),
'iris': ('https://scitools-iris.readthedocs.io/en/latest/', None),
'lime': ('https://lime-ml.readthedocs.io/en/latest/', None),
'basic_modeling_interface': ('https://bmi.readthedocs.io/en/latest/', None),
'matplotlib': ('https://matplotlib.org/', None),
'numpy': ('https://numpy.org/doc/stable/', None),
'pandas': ('https://pandas.pydata.org/pandas-docs/dev', None),
'python': ('https://docs.python.org/3/', None),
'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
'seaborn': ('https://seaborn.pydata.org/', None),
'sklearn': ('https://scikit-learn.org/stable', None),
}
2 changes: 1 addition & 1 deletion ewatercycle/config/_config_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def load_from_file(self, filename: Union[os.PathLike, str]) -> None:

self.clear()
self.update(CFG_DEFAULT)
self.update(Config._load_user_config(filename))
self.update(Config._load_user_config(path))

def reload(self) -> None:
"""Reload the config file."""
Expand Down
4 changes: 2 additions & 2 deletions ewatercycle/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ def data_files_from_recipe_output(recipe_output: RecipeOutput) -> Tuple[str, Dic


def to_absolute_path(input_path: str, parent: Path = None, must_exist: bool = False) -> Path:
"""Parse input string as pathlib.Path object.
"""Parse input string as :py:class:`pathlib.Path` object.
Args:
input_path: Input string path that can be a relative or absolute path.
parent: Optional parent path of the input path
must_exist: Optional argument to check if the input path exists.
Returns:
The input path that is an absolute path and a pathlib.Path object.
The input path that is an absolute path and a :py:class:`pathlib.Path` object.
"""
pathlike = Path(input_path)
if parent:
Expand Down

0 comments on commit 5ed4a31

Please sign in to comment.