From da40824c6ff083af107cffc97fbbdacdd2421012 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Wed, 17 Mar 2021 22:08:40 -0500 Subject: [PATCH 01/15] Add missing `algorithm` to a sentence. --- src/python/bezier/hazmat/triangle_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/bezier/hazmat/triangle_helpers.py b/src/python/bezier/hazmat/triangle_helpers.py index fefe3130..dfd705c4 100644 --- a/src/python/bezier/hazmat/triangle_helpers.py +++ b/src/python/bezier/hazmat/triangle_helpers.py @@ -965,7 +965,7 @@ def make_transform(degree, weights_a, weights_b, weights_c): This is a helper used only by :func:`specialize_triangle`. - Applies the de Casteljau to the identity matrix, thus + Applies the de Casteljau algorithm to the identity matrix, thus effectively caching the algorithm in a transformation matrix. .. note:: From ca677a7dcb2eda9a486ad51cf7f366e5d8d11eda Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Wed, 17 Mar 2021 22:13:37 -0500 Subject: [PATCH 02/15] Making sure imports appear at least once in `bezier.hazmat.triangle_intersection`. --- src/python/bezier/hazmat/triangle_intersection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python/bezier/hazmat/triangle_intersection.py b/src/python/bezier/hazmat/triangle_intersection.py index 3b7a1f32..a04321a0 100644 --- a/src/python/bezier/hazmat/triangle_intersection.py +++ b/src/python/bezier/hazmat/triangle_intersection.py @@ -154,12 +154,12 @@ def newton_refine(nodes, degree, x_val, y_val, s, t): .. testsetup:: newton-refine-triangle - import numpy as np - import bezier from bezier.hazmat.triangle_intersection import newton_refine .. doctest:: newton-refine-triangle + >>> import bezier + >>> import numpy as np >>> nodes = np.asfortranarray([ ... [0.0, 1.0, 2.0, 2.0, 2.0, 0.0], ... [0.0, 0.0, 0.0, 1.0, 2.0, 2.0], From cd23e29304ee370d6194168984c88a1eba26e2ef Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Wed, 17 Mar 2021 22:15:33 -0500 Subject: [PATCH 03/15] Making sure imports appear at least once in `bezier.triangle`. --- src/python/bezier/triangle.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/python/bezier/triangle.py b/src/python/bezier/triangle.py index bcec8eb0..d841b19d 100644 --- a/src/python/bezier/triangle.py +++ b/src/python/bezier/triangle.py @@ -156,6 +156,7 @@ class Triangle(_base.Base): .. doctest:: triangle-constructor >>> import bezier + >>> import numpy as np >>> nodes = np.asfortranarray([ ... [0.0, 0.5, 1.0 , 0.125, 0.375, 0.25], ... [0.0, 0.0, 0.25, 0.5 , 0.375, 1.0 ], From c1ada53b4e8a06802893e88ce7e0b23918c704b5 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Wed, 17 Mar 2021 22:18:03 -0500 Subject: [PATCH 04/15] Making sure imports appear at least once in docs landing page. --- README.rst | 2 ++ README.rst.release.template | 2 ++ README.rst.template | 2 ++ docs/index.rst | 2 ++ docs/index.rst.release.template | 2 ++ 5 files changed, 10 insertions(+) diff --git a/README.rst b/README.rst index 90856cf8..d54f31bc 100644 --- a/README.rst +++ b/README.rst @@ -103,6 +103,8 @@ For example, to create a curve: .. code-block:: python + >>> import bezier + >>> import numpy as np >>> nodes1 = np.asfortranarray([ ... [0.0, 0.5, 1.0], ... [0.0, 1.0, 0.0], diff --git a/README.rst.release.template b/README.rst.release.template index 51ee0540..fac7e618 100644 --- a/README.rst.release.template +++ b/README.rst.release.template @@ -101,6 +101,8 @@ For example, to create a curve: .. code-block:: python + >>> import bezier + >>> import numpy as np >>> nodes1 = np.asfortranarray([ ... [0.0, 0.5, 1.0], ... [0.0, 1.0, 0.0], diff --git a/README.rst.template b/README.rst.template index 23e240ad..fbcc2d3a 100644 --- a/README.rst.template +++ b/README.rst.template @@ -96,6 +96,8 @@ For example, to create a curve: {code_block1} + >>> import bezier + >>> import numpy as np >>> nodes1 = np.asfortranarray([ ... [0.0, 0.5, 1.0], ... [0.0, 1.0, 0.0], diff --git a/docs/index.rst b/docs/index.rst index dbff9d43..700ff1b1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -151,6 +151,8 @@ For example, to create a curve: .. doctest:: getting-started + >>> import bezier + >>> import numpy as np >>> nodes1 = np.asfortranarray([ ... [0.0, 0.5, 1.0], ... [0.0, 1.0, 0.0], diff --git a/docs/index.rst.release.template b/docs/index.rst.release.template index c8a19863..2b18a457 100644 --- a/docs/index.rst.release.template +++ b/docs/index.rst.release.template @@ -149,6 +149,8 @@ For example, to create a curve: .. doctest:: getting-started + >>> import bezier + >>> import numpy as np >>> nodes1 = np.asfortranarray([ ... [0.0, 0.5, 1.0], ... [0.0, 1.0, 0.0], From c0ca98735701c9b4658152648d5d37fbfe2e279c Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Wed, 17 Mar 2021 22:20:32 -0500 Subject: [PATCH 05/15] Making sure imports appear at least once in `bezier.hazmat.triangle_helpers`. --- src/python/bezier/hazmat/triangle_helpers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/python/bezier/hazmat/triangle_helpers.py b/src/python/bezier/hazmat/triangle_helpers.py index dfd705c4..5c04b5a2 100644 --- a/src/python/bezier/hazmat/triangle_helpers.py +++ b/src/python/bezier/hazmat/triangle_helpers.py @@ -1290,6 +1290,8 @@ def jacobian_det(nodes, degree, st_vals): .. doctest:: jacobian-det :options: +NORMALIZE_WHITESPACE + >>> import bezier + >>> import numpy as np >>> nodes = np.asfortranarray([ ... [0.0, 1.0, 2.0, 0.0, 1.5, 0.0], ... [0.0, 0.0, 0.0, 1.0, 1.5, 2.0], From 51a6a658478e54dd5c96ee8df11d30b0a8b7e179 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Wed, 17 Mar 2021 22:22:00 -0500 Subject: [PATCH 06/15] Making sure imports appear at least once in `bezier.hazmat.intersection_helpers`. --- src/python/bezier/hazmat/intersection_helpers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/python/bezier/hazmat/intersection_helpers.py b/src/python/bezier/hazmat/intersection_helpers.py index 672ae9e6..7d64c956 100644 --- a/src/python/bezier/hazmat/intersection_helpers.py +++ b/src/python/bezier/hazmat/intersection_helpers.py @@ -141,6 +141,8 @@ def realroots(*coeffs): .. doctest:: newton-refine1 + >>> import bezier + >>> import numpy as np >>> nodes1 = np.asfortranarray([ ... [0.0, 2.0, 4.0], ... [0.0, 4.0, 0.0], From 7d5e475e797068d52c56a643a78ef5127d42856d Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Wed, 17 Mar 2021 22:23:10 -0500 Subject: [PATCH 07/15] Making sure imports appear at least once in `bezier.hazmat.helpers`. --- src/python/bezier/hazmat/helpers.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/python/bezier/hazmat/helpers.py b/src/python/bezier/hazmat/helpers.py index 941b9aba..eeb5902d 100644 --- a/src/python/bezier/hazmat/helpers.py +++ b/src/python/bezier/hazmat/helpers.py @@ -524,14 +524,11 @@ class UnsupportedDegree(NotImplementedError): a small subset of possible degrees, so the implementation is **degree-specific**: - .. testsetup:: unsupported-degree - - import numpy as np - import bezier - .. doctest:: unsupported-degree :options: +NORMALIZE_WHITESPACE + >>> import bezier + >>> import numpy as np >>> degree = 5 >>> nodes = np.empty((2, degree + 1), order="F") >>> curve = bezier.Curve(nodes, degree=degree) From ab17f512c6fda1d0948898f50d0b608a35f6c29e Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Wed, 17 Mar 2021 22:24:46 -0500 Subject: [PATCH 08/15] Making sure imports appear at least once in `bezier.hazmat.geometric_intersection`. --- src/python/bezier/hazmat/geometric_intersection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/bezier/hazmat/geometric_intersection.py b/src/python/bezier/hazmat/geometric_intersection.py index b233d945..7c446e84 100644 --- a/src/python/bezier/hazmat/geometric_intersection.py +++ b/src/python/bezier/hazmat/geometric_intersection.py @@ -158,11 +158,11 @@ def linearization_error(nodes): .. testsetup:: linearization-error, linearization-error-fail import numpy as np - import bezier from bezier.hazmat.geometric_intersection import linearization_error .. doctest:: linearization-error + >>> import numpy as np >>> nodes = np.asfortranarray([ ... [0.0, 3.0, 9.0], ... [0.0, 1.0, -2.0], From 7900ad46fb3a4ef3183da57f57ed119ef5d4c50d Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Wed, 17 Mar 2021 22:28:03 -0500 Subject: [PATCH 09/15] Making sure imports appear at least once in `bezier.hazmat.curve_helpers`. Also adding a missing "need" to a comment. --- src/python/bezier/hazmat/curve_helpers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/python/bezier/hazmat/curve_helpers.py b/src/python/bezier/hazmat/curve_helpers.py index 2ee0a383..ae2f36cf 100644 --- a/src/python/bezier/hazmat/curve_helpers.py +++ b/src/python/bezier/hazmat/curve_helpers.py @@ -328,7 +328,7 @@ def compute_length(nodes): return np.linalg.norm(first_deriv[:, 0], ord=2) # NOTE: We import SciPy at runtime to avoid the import-time cost for users - # that don't pure Python curve helpers (e.g. if the ``_speedup`` + # that don't need pure Python curve helpers (e.g. if the ``_speedup`` # module is available). The ``scipy`` import is a tad expensive. import scipy.integrate # pylint: disable=import-outside-toplevel @@ -506,6 +506,7 @@ def get_curvature(nodes, tangent_vec, s): .. doctest:: get-curvature :options: +NORMALIZE_WHITESPACE + >>> import numpy as np >>> nodes = np.asfortranarray([ ... [1.0, 0.75, 0.5, 0.25, 0.0], ... [0.0, 2.0 , -2.0, 2.0 , 0.0], @@ -611,6 +612,7 @@ def newton_refine(nodes, point, s): .. doctest:: newton-refine-curve :options: +NORMALIZE_WHITESPACE + >>> import bezier >>> nodes = np.asfortranarray([ ... [0.0, 1.0, 3.0], ... [0.0, 2.0, 1.0], From baaa93a50767dda84568d4188d09e1fe0a432488 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Wed, 17 Mar 2021 22:29:30 -0500 Subject: [PATCH 10/15] Making sure imports appear at least once in `bezier.hazmat.clipping`. --- src/python/bezier/hazmat/clipping.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/python/bezier/hazmat/clipping.py b/src/python/bezier/hazmat/clipping.py index 4af5a31c..15b6b941 100644 --- a/src/python/bezier/hazmat/clipping.py +++ b/src/python/bezier/hazmat/clipping.py @@ -66,12 +66,12 @@ def compute_implicit_line(nodes): .. testsetup:: compute-implicit-line import numpy as np - import bezier from bezier.hazmat.clipping import compute_implicit_line .. doctest:: compute-implicit-line :options: +NORMALIZE_WHITESPACE + >>> import numpy as np >>> nodes = np.asfortranarray([ ... [0.0, 1.0, 3.0, 4.0], ... [0.0, 2.5, 0.5, 3.0], @@ -127,7 +127,6 @@ def compute_fat_line(nodes): .. testsetup:: compute-fat-line import numpy as np - import bezier from bezier.hazmat.clipping import compute_fat_line .. doctest:: compute-fat-line @@ -341,7 +340,6 @@ def clip_range(nodes1, nodes2): .. testsetup:: clip-range-start, clip-range import numpy as np - import bezier from bezier.hazmat.clipping import clip_range nodes1 = np.asfortranarray([ From 2b0f65859252a875064152166c1be4172a50156d Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Wed, 17 Mar 2021 22:33:09 -0500 Subject: [PATCH 11/15] Making sure imports appear at least once in `bezier.hazmat.algebraic_intersection`. --- src/python/bezier/hazmat/algebraic_intersection.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/python/bezier/hazmat/algebraic_intersection.py b/src/python/bezier/hazmat/algebraic_intersection.py index bb4a7065..341c35ae 100644 --- a/src/python/bezier/hazmat/algebraic_intersection.py +++ b/src/python/bezier/hazmat/algebraic_intersection.py @@ -781,6 +781,7 @@ def bezier_roots(coeffs): .. doctest:: bezier-roots0 + >>> import numpy as np >>> coeffs0 = np.asfortranarray([12.0, 11.0, 8.0]) >>> companion0, _, _ = bernstein_companion(coeffs0) >>> companion0 From 6d28a117c9b63197dc200704638b461cdc203c81 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Wed, 17 Mar 2021 22:34:13 -0500 Subject: [PATCH 12/15] Making sure imports appear at least once in `bezier.curved_polygon`. --- src/python/bezier/curved_polygon.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/python/bezier/curved_polygon.py b/src/python/bezier/curved_polygon.py index 2f973897..d0935ffa 100644 --- a/src/python/bezier/curved_polygon.py +++ b/src/python/bezier/curved_polygon.py @@ -48,6 +48,7 @@ class CurvedPolygon: .. doctest:: curved-polygon-constructor >>> import bezier + >>> import numpy as np >>> nodes0 = np.asfortranarray([ ... [0.0, 1.0, 2.0], ... [0.0, -1.0, 0.0], From 1326a4b107bf3a45db0247bd10fe4765fd0cfe40 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Wed, 17 Mar 2021 22:35:16 -0500 Subject: [PATCH 13/15] Making sure imports appear at least once in `bezier.curve`. --- src/python/bezier/curve.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/python/bezier/curve.py b/src/python/bezier/curve.py index 2f9a868a..24ae53d5 100644 --- a/src/python/bezier/curve.py +++ b/src/python/bezier/curve.py @@ -61,6 +61,7 @@ class Curve(_base.Base): .. doctest:: curve-constructor >>> import bezier + >>> import numpy as np >>> nodes = np.asfortranarray([ ... [0.0, 0.625, 1.0], ... [0.0, 0.5 , 0.5], From de81d1c87c36c74612435f5d8a9fdd3801ea70b0 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Wed, 17 Mar 2021 22:36:02 -0500 Subject: [PATCH 14/15] Making sure imports appear at least once in `algorithms/curve-curve-intersection`. --- docs/algorithms/curve-curve-intersection.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/algorithms/curve-curve-intersection.rst b/docs/algorithms/curve-curve-intersection.rst index 31894578..929b24da 100644 --- a/docs/algorithms/curve-curve-intersection.rst +++ b/docs/algorithms/curve-curve-intersection.rst @@ -25,6 +25,8 @@ Curve-Line Intersection .. doctest:: intersect-1-8 :options: +NORMALIZE_WHITESPACE + >>> import bezier + >>> import numpy as np >>> nodes1 = np.asfortranarray([ ... [0.0, 0.5, 1.0], ... [0.0, 1.0, 0.0], From 9fe35028409590d716355c3ea76dfd2eec6415b4 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Wed, 17 Mar 2021 22:39:16 -0500 Subject: [PATCH 15/15] Updating release notes with this PR. --- docs/releases/latest.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/releases/latest.rst b/docs/releases/latest.rst index b40fca27..146901c2 100644 --- a/docs/releases/latest.rst +++ b/docs/releases/latest.rst @@ -34,6 +34,13 @@ Additive Changes ``Curve.intersect()`` (`doc `__) +Documentation +------------- + +- Making all docs pages import external packages at least once + (`#257 `__). Fixed + `#210 `__. + .. |pypi| image:: https://img.shields.io/pypi/v/bezier/2021.2.13.dev1.svg :target: https://pypi.org/project/bezier/2021.2.13.dev1/ :alt: PyPI link to release 2021.2.13.dev1