From 461148a17b0b374404557eca2d7b4e4526c4a572 Mon Sep 17 00:00:00 2001 From: Adib Kabir Date: Tue, 1 Dec 2026 08:29:58 -0800 Subject: [PATCH] chore: clear the template example code but keep its files (IN-1.3) --- .../diffpy.diffchooser.example_package.rst | 31 -------------- docs/source/api/diffpy.diffchooser.rst | 26 ++++++------ news/in-1-3-remove-template.rst | 23 +++++++++++ src/diffpy/diffchooser/functions.py | 32 +-------------- tests/test_functions.py | 40 +------------------ 5 files changed, 38 insertions(+), 114 deletions(-) delete mode 100644 docs/source/api/diffpy.diffchooser.example_package.rst create mode 100644 news/in-1-3-remove-template.rst diff --git a/docs/source/api/diffpy.diffchooser.example_package.rst b/docs/source/api/diffpy.diffchooser.example_package.rst deleted file mode 100644 index 6620d27..0000000 --- a/docs/source/api/diffpy.diffchooser.example_package.rst +++ /dev/null @@ -1,31 +0,0 @@ -.. _example_package documentation: - -|title| -======= - -.. |title| replace:: diffpy.diffchooser.example_package package - -.. automodule:: diffpy.diffchooser.example_package - :members: - :undoc-members: - :show-inheritance: - -|foo| ------ - -.. |foo| replace:: diffpy.diffchooser.example_package.foo module - -.. automodule:: diffpy.diffchooser.example_package.foo - :members: - :undoc-members: - :show-inheritance: - -|bar| ------ - -.. |bar| replace:: diffpy.diffchooser.example_package.bar module - -.. automodule:: diffpy.diffchooser.example_package.foo - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/api/diffpy.diffchooser.rst b/docs/source/api/diffpy.diffchooser.rst index 6195e6e..08c431a 100644 --- a/docs/source/api/diffpy.diffchooser.rst +++ b/docs/source/api/diffpy.diffchooser.rst @@ -1,30 +1,28 @@ :tocdepth: -1 -|title| -======= - -.. |title| replace:: diffpy.diffchooser package +diffpy.diffchooser package +========================== .. automodule:: diffpy.diffchooser :members: :undoc-members: :show-inheritance: -Subpackages ------------ - -.. toctree:: - diffpy.diffchooser.example_package - Submodules ---------- -|module| --------- +diffpy.diffchooser.functions module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.diffchooser.functions + :members: + :undoc-members: + :show-inheritance: -.. |module| replace:: diffpy.diffchooser.example_submodule module +diffpy.diffchooser.diffchooser_app module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. automodule:: diffpy.diffchooser.example_submodule +.. automodule:: diffpy.diffchooser.diffchooser_app :members: :undoc-members: :show-inheritance: diff --git a/news/in-1-3-remove-template.rst b/news/in-1-3-remove-template.rst new file mode 100644 index 0000000..b4fcad8 --- /dev/null +++ b/news/in-1-3-remove-template.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* The ``dot_product`` example and its tests from the scikit-package template. ``functions.py`` and ``test_functions.py`` are kept for later use. + +**Fixed:** + +* + +**Security:** + +* diff --git a/src/diffpy/diffchooser/functions.py b/src/diffpy/diffchooser/functions.py index e7e2c8e..e115262 100644 --- a/src/diffpy/diffchooser/functions.py +++ b/src/diffpy/diffchooser/functions.py @@ -1,31 +1 @@ -import numpy as np - - -def dot_product(a, b): - """Compute the dot product of two vectors of any size. - - Ensure that the inputs, a and b, are of the same size. - The supported types are "array_like" objects, which can - be converted to a NumPy array. Examples include lists and tuples. - - Parameters - ---------- - a : array_like - The first input vector. - b : array_like - The second input vector. - - Returns - ------- - float - The dot product of the two vectors. - - Examples - -------- - Compute the dot product of two lists: - >>> a = [1, 2, 3] - >>> b = [4, 5, 6] - >>> dot_product(a, b) - 32.0 - """ - return float(np.dot(a, b)) +import numpy as np # noqa: F401 diff --git a/tests/test_functions.py b/tests/test_functions.py index df19e46..2a6a45a 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -1,40 +1,4 @@ -import numpy as np -import pytest +import numpy as np # noqa: F401 +import pytest # noqa: F401 from diffpy.diffchooser import functions # noqa - - -def test_dot_product_2D_list(): - a = [1, 2] - b = [3, 4] - expected = 11.0 - actual = functions.dot_product(a, b) - assert actual == expected - - -def test_dot_product_3D_list(): - a = [1, 2, 3] - b = [4, 5, 6] - expected = 32.0 - actual = functions.dot_product(a, b) - assert actual == expected - - -@pytest.mark.parametrize( - "a, b, expected", - [ - # Test whether the dot product function works with 2D and 3D vectors - # C1: lists, expect correct float output - ([1, 2], [3, 4], 11.0), - ([1, 2, 3], [4, 5, 6], 32.0), - # C2: tuples, expect correct float output - ((1, 2), (3, 4), 11.0), - ((1, 2, 3), (4, 5, 6), 32.0), - # C3: numpy arrays, expect correct float output - (np.array([1, 2]), np.array([3, 4]), 11.0), - (np.array([1, 2, 3]), np.array([4, 5, 6]), 32.0), - ], -) -def test_dot_product(a, b, expected): - actual = functions.dot_product(a, b) - assert actual == expected