From f46ff25caeb77604ece0f591c203d7b9c87a7131 Mon Sep 17 00:00:00 2001 From: Brendt Wohlberg Date: Tue, 10 Sep 2024 08:39:38 -0600 Subject: [PATCH 1/2] Resolve some sphinx build warnings (#550) * Resolve some sphinx build warnings * More robust rm --- docs/Makefile | 2 +- docs/source/conf/80-scico_numpy.py | 8 ++++---- docs/source/conf/81-scico_scipy.py | 4 ++-- docs/source/conf/85-dtype_typehints.py | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index 942246891..9be557357 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -48,7 +48,7 @@ help: @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: - rm $(AUTOSUMMARYDIR)/* + rm -f $(AUTOSUMMARYDIR)/* rm -rf $(BUILDDIR)/* html: diff --git a/docs/source/conf/80-scico_numpy.py b/docs/source/conf/80-scico_numpy.py index 8d495250b..eaad43125 100644 --- a/docs/source/conf/80-scico_numpy.py +++ b/docs/source/conf/80-scico_numpy.py @@ -27,7 +27,7 @@ # Improve formatting of jax.numpy warning f.__doc__ = re.sub( r"^\*\*\* This function is not yet implemented by jax.numpy, and will " - "raise NotImplementedError \*\*\*", + r"raise NotImplementedError \*\*\*", "**WARNING**: This function is not yet implemented by jax.numpy, " " and will raise :exc:`NotImplementedError`.", f.__doc__, @@ -52,14 +52,14 @@ flags=re.M, ) scico.numpy.testing.break_cycles.__doc__ = re.sub( - " __del__\) inside", "__del__\) inside", scico.numpy.testing.break_cycles.__doc__, flags=re.M + r" __del__\) inside", r"__del__\) inside", scico.numpy.testing.break_cycles.__doc__, flags=re.M ) scico.numpy.testing.assert_raises_regex.__doc__ = re.sub( - "\*args,\n.*\*\*kwargs", + r"\*args,\n.*\*\*kwargs", "*args, **kwargs", scico.numpy.testing.assert_raises_regex.__doc__, flags=re.M, ) scico.numpy.BlockArray.global_shards.__doc__ = re.sub( - "`Shard`s", "`Shard`\ s", scico.numpy.BlockArray.global_shards.__doc__, flags=re.M + r"`Shard`s", r"`Shard`\ s", scico.numpy.BlockArray.global_shards.__doc__, flags=re.M ) diff --git a/docs/source/conf/81-scico_scipy.py b/docs/source/conf/81-scico_scipy.py index ad4893c76..82ef91df2 100644 --- a/docs/source/conf/81-scico_scipy.py +++ b/docs/source/conf/81-scico_scipy.py @@ -28,8 +28,8 @@ # Remove entire numpydoc references section f.__doc__ = re.sub(r"References\n----------\n.*\n", "", f.__doc__, flags=re.DOTALL) # Remove problematic citation - f.__doc__ = re.sub("See \[dlmf\]_ for details.", "", f.__doc__, re.M) - f.__doc__ = re.sub("\[dlmf\]_", "NIST DLMF", f.__doc__, re.M) + f.__doc__ = re.sub(r"See \[dlmf\]_ for details.", "", f.__doc__, re.M) + f.__doc__ = re.sub(r"\[dlmf\]_", "NIST DLMF", f.__doc__, re.M) # Fix indentation problems scico.scipy.special.sph_harm.__doc__ = re.sub( diff --git a/docs/source/conf/85-dtype_typehints.py b/docs/source/conf/85-dtype_typehints.py index bcaa43399..94b99d59c 100644 --- a/docs/source/conf/85-dtype_typehints.py +++ b/docs/source/conf/85-dtype_typehints.py @@ -31,10 +31,10 @@ def typehints_formatter_function(annotation, config): DType: ":obj:`~scico.typing.DType`", # Compound types involving DType must be added here to avoid their DType # component being expanded in the docs. - Optional[DType]: ":obj:`~typing.Optional`\ [\ :obj:`~scico.typing.DType`\ ]", + Optional[DType]: r":obj:`~typing.Optional`\ [\ :obj:`~scico.typing.DType`\ ]", Union[DType, Sequence[DType]]: ( - ":obj:`~typing.Union`\ [\ :obj:`~scico.typing.DType`\ , " - ":obj:`~typing.Sequence`\ [\ :obj:`~scico.typing.DType`\ ]]" + r":obj:`~typing.Union`\ [\ :obj:`~scico.typing.DType`\ , " + r":obj:`~typing.Sequence`\ [\ :obj:`~scico.typing.DType`\ ]]" ), AxisIndex: ":obj:`~scico.typing.AxisIndex`", ArrayIndex: ":obj:`~scico.typing.ArrayIndex`", From 0b63130d1ffb66744d4beab9bb7d5b5ecec8d091 Mon Sep 17 00:00:00 2001 From: Brendt Wohlberg Date: Tue, 10 Sep 2024 08:45:46 -0600 Subject: [PATCH 2/2] Fix import errors in examples --- examples/scripts/ct_large_projection.py | 2 +- examples/scripts/ct_projector_comparison_2d.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/scripts/ct_large_projection.py b/examples/scripts/ct_large_projection.py index 814ab7cba..5067698bc 100644 --- a/examples/scripts/ct_large_projection.py +++ b/examples/scripts/ct_large_projection.py @@ -18,7 +18,7 @@ import jax from scico.examples import create_block_phantom -from scico.linop import XRayTransform3D +from scico.linop.xray import XRayTransform3D N = 1000 num_views = 10 diff --git a/examples/scripts/ct_projector_comparison_2d.py b/examples/scripts/ct_projector_comparison_2d.py index b54810c5a..2e5d02d3f 100644 --- a/examples/scripts/ct_projector_comparison_2d.py +++ b/examples/scripts/ct_projector_comparison_2d.py @@ -22,7 +22,7 @@ import scico.linop.xray.astra as astra from scico import plot -from scico.linop import XRayTransform2D +from scico.linop.xray import XRayTransform2D from scico.util import Timer """