From 79fe2843ede3725e8ecc9526a010cebd464e3c1d Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Wed, 5 Jul 2023 16:23:10 +0100 Subject: [PATCH 1/3] doc: re-enable Sphinx nitpicky mode FIX Sphinx nitpicky mode is required to detect broken references, so re-enable it and fix the currently broken refs and warnings. --- doc/conf.py | 6 ++++++ lisa/notebook.py | 2 +- lisa/stats.py | 2 +- lisa/utils.py | 4 ++-- lisa/wa.py | 2 +- tools/lisa-doc-build | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index c6c000a25..c0651371f 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -430,6 +430,12 @@ ignored_refs = { # that cannot be fixed because of Sphinx limitations and external # constraints on names. r'ITEM_CLS', + + # Python <= 3.8 has a formatting issue in typing.Union[..., None] that + # makes it appear as typing.Union[..., NoneType], leading to a broken + # reference since the intersphinx inventory of the stdlib does not provide + # any link for NoneType. + r'NoneType', } ignored_refs.update( re.escape(f'{x.__module__}.{x.__qualname__}') diff --git a/lisa/notebook.py b/lisa/notebook.py index 396d3a2d2..b513bcded 100644 --- a/lisa/notebook.py +++ b/lisa/notebook.py @@ -395,7 +395,7 @@ def plot_signal(series, name=None, interpolation=None, add_markers=True, vdim=No :type add_markers: bool :param vdim: Value axis dimension. - :type vdim: holoviews.Dimension + :type vdim: holoviews.core.dimension.Dimension """ if isinstance(series, pd.DataFrame): try: diff --git a/lisa/stats.py b/lisa/stats.py index 2cdb8d05e..18644863e 100644 --- a/lisa/stats.py +++ b/lisa/stats.py @@ -211,7 +211,7 @@ class Stats(Loggable): :param stats: Dictionnary of statistical functions to summarize each value group formed by tag columns along the aggregation columns. If ``None`` is given as value, the name will be passed to - :meth:`pandas.core.groupby.GroupBy.agg`. Otherwise, the provided + :meth:`pandas.core.groupby.SeriesGroupBy.agg`. Otherwise, the provided function will be run. .. note:: One set of keys is special: ``'mean'``, ``'std'`` and diff --git a/lisa/utils.py b/lisa/utils.py index 7853e02ff..ec3a9c509 100644 --- a/lisa/utils.py +++ b/lisa/utils.py @@ -3935,7 +3935,7 @@ class LazyMapping(Mapping): def mp_spawn_pool(import_main=False, **kwargs): """ - Create a context manager wrapping :class:`multiprocessing.Pool` using the + Create a context manager wrapping :class:`multiprocessing.pool.Pool` using the ``spawn`` method, which is safe even in multithreaded applications. :param import_main: If ``True``, let the spawned process import the @@ -3944,7 +3944,7 @@ def mp_spawn_pool(import_main=False, **kwargs): *lot* of time (actually, unbounded amount of time). :type import_main: bool - :Variable keyword arguments: Forwarded to :meth:`multiprocessing.Pool`. + :Variable keyword arguments: Forwarded to :class:`multiprocessing.pool.Pool`. """ ctx = multiprocessing.get_context(method='spawn') empty_main = nullcontext if import_main else _empty_main diff --git a/lisa/wa.py b/lisa/wa.py index c7d4336a7..ac00e7708 100644 --- a/lisa/wa.py +++ b/lisa/wa.py @@ -284,7 +284,7 @@ class WAOutput(StatsProp, Mapping, Loggable): def outputs(self): """ Dict containing a mapping of 'wa run' names to - :class:`wa.framework.RunOutput` objects. + :class:`RunOutput` objects. """ wa_outputs = list(discover_wa_outputs(self.path)) diff --git a/tools/lisa-doc-build b/tools/lisa-doc-build index 271caa55f..ba795aa67 100755 --- a/tools/lisa-doc-build +++ b/tools/lisa-doc-build @@ -24,7 +24,7 @@ cd "$LISA_HOME/doc" || exit 1 # Build the main documentation ############################## -make SPHINXOPTS='-n --no-color --keep-going -T -j auto' html || ret=1 +make SPHINXOPTS='-n --no-color -W --keep-going -T -j auto' html || ret=1 echo echo "Building man pages" -- GitLab From a819b625971bdb80346e05f60b1aa8f41ce09ed2 Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Thu, 6 Jul 2023 10:51:40 +0100 Subject: [PATCH 2/3] lisa.utils: Fix optional_kwargs __doc__ forwarding FIX Fix optional_kwargs() handling of docstring, so that the decorator ends up with its original docstring as intended. --- lisa/utils.py | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/lisa/utils.py b/lisa/utils.py index ec3a9c509..96e7f1bfc 100644 --- a/lisa/utils.py +++ b/lisa/utils.py @@ -1857,32 +1857,33 @@ def optional_kwargs(func): above ``@classmethod`` so it can handle it properly. """ - is_cls_method = False + prepare = lambda args: (args, func) + rewrap = functools.wraps(func) + if isinstance(func, classmethod): - f = func.__func__ - is_cls_method = True - if isinstance(func, staticmethod): - f = func.__func__ - else: - f = func + rewrap = lambda f: classmethod( + functools.wraps(func.__func__)(f) + ) + def prepare(args): + cls, *args = args + return (args, func.__get__(None, cls)) - @functools.wraps(f) + elif isinstance(func, staticmethod): + rewrap = lambda f: staticmethod( + functools.wraps(func.__func__)(f) + ) + prepare = lambda args: (args, func.__func__) + + @rewrap def wrapper(*args, **kwargs): - if is_cls_method: - cls, *args = args - _f = f.__get__(None, cls) - else: - _f = f + args, f = prepare(args) if not kwargs and len(args) == 1 and callable(args[0]): - return _f(args[0]) + return f(args[0]) else: if args: raise TypeError(f'Positional parameters are not allowed when applying {f.__qualname__} decorator, please use keyword arguments') - return functools.partial(_f, **kwargs) - - if is_cls_method: - wrapper = classmethod(wrapper) + return functools.partial(f, **kwargs) return wrapper -- GitLab From b73ba79095cb20ae630f9ad75a0f84403d5ad99e Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Thu, 6 Jul 2023 11:10:32 +0100 Subject: [PATCH 3/3] .readthedocs.yml: Update to Python 3.11 and Ubuntu 22.04 --- .readthedocs.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index d89fbf96f..86b9b426e 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -9,7 +9,8 @@ version: 2 sphinx: builder: html configuration: doc/conf.py - # intersphinx is broken for some dependencies like devlib + # Deploy and build the doc no matter what, we are supposed to catch warnings + # in other CIs. fail_on_warning: false @@ -17,9 +18,9 @@ sphinx: formats: [] build: - os: ubuntu-20.04 + os: ubuntu-22.04 tools: - python: "3.10" + python: "3.11" apt_packages: - graphviz - plantuml -- GitLab