Restructured text fixes so that pydoctor would return without an error

This commit is contained in:
Julian Stirling 2025-07-09 23:55:46 +01:00
parent 58b056988a
commit a84a916719
31 changed files with 269 additions and 256 deletions

View file

@ -13,5 +13,5 @@ class MockAutoFocusThing:
mock_call_count = {"looping_autofocus": 0}
def looping_autofocus(self, dz: int = 2000, start: str = "centre") -> None: # noqa: ARG002
"""This function mocks autofocus with no return"""
"""Mock autofocus with no return"""
self.mock_call_count["looping_autofocus"] += 1

View file

@ -68,7 +68,6 @@ def _make_fake_dzi(scan_dir: ScanDirectory, n_layers: int = 8) -> None:
:param n_layers: The number of layers of tiles. I.e. tile directories numbered
0...(n_layers-1) will be created. Default 8
"""
# Add an a dzi image
dzi_fname = scan_dir.name + ".dzi"
dzi_path = os.path.join(scan_dir.images_dir, dzi_fname)
@ -309,7 +308,6 @@ def test_empty_scan_info():
def test_zipping_scan_data():
"""Test zipping the scan images with fake image data"""
# Run twice, once calling the ScanDirectory directly,
# Once calling the ScanDirectoryManager
for caller in ["scan_dir", "manager"]:

View file

@ -257,7 +257,8 @@ def test_example_smart_spiral():
below and defined in scan_test_helpers.load_sample_points
Will fail if the locations or path between locations visited has changed
for any of the samples listed"""
for any of the samples listed
"""
example_samples = [
"regular",
"lobed",

View file

@ -65,7 +65,8 @@ def test_initial_properties(smart_scan_thing):
def test_inaccessible_scan_methods(smart_scan_thing):
"""The @_scan_running decorator should make some methods
inaccessible unless a scan is running"""
inaccessible unless a scan is running
"""
with pytest.raises(ScanNotRunningError):
smart_scan_thing._run_scan()
with pytest.raises(ScanNotRunningError):
@ -74,7 +75,6 @@ def test_inaccessible_scan_methods(smart_scan_thing):
def test_private_delete_scan(smart_scan_thing, caplog):
"""Test the private _delete_scan method deletes directories or warns if it can't"""
_clear_scan_dir()
with caplog.at_level(logging.INFO):
fake_scan_name = "fake_scan_0001"
@ -101,7 +101,6 @@ def test_private_delete_scan(smart_scan_thing, caplog):
def test_public_delete_scan(smart_scan_thing, caplog):
"""Test the delete_scan API call deletes directories or warns if it can't"""
_clear_scan_dir()
with caplog.at_level(logging.INFO):
fake_scan_name = "fake_scan_0001"
@ -166,7 +165,6 @@ def _run_only_outer_scan(adjust_inital_state: Optional[Callable] = None):
This seems hard to do with a fixture so it is being done with a private
function
"""
# cancel handle shouldn't be used. Set to arbitrary value for checking
cancel_mock = 1 # not called
af_mock = MockAutoFocusThing()

View file

@ -23,7 +23,7 @@ RANDOM_GENERATOR = np.random.default_rng()
def odd_integers(min_value=0, max_value=1000):
"""A hypothesis strategy for odd integers"""
"""Return a hypothesis strategy for odd integers."""
min_base = (min_value) // 2
max_base = (max_value - 1) // 2
# Ensure the range allows at least one odd number
@ -33,7 +33,7 @@ def odd_integers(min_value=0, max_value=1000):
def even_integers(min_value=0, max_value=1000):
"""A hypothesis strategy for even integers"""
"""Return a hypothesis strategy for even integers."""
min_base = (min_value + 1) // 2
max_base = (max_value) // 2
# Ensure the range allows at least one even number
@ -54,7 +54,6 @@ def test_stack_params_validation(save_ims, extra_ims):
images_to_save. (even so that, min_images_to_test is odd and larger than
images_to_save
"""
StackParams(
stack_dz=50,
images_to_save=save_ims,

View file

@ -12,7 +12,8 @@ from collections.abc import Hashable
class SizedIterableHashable(Iterable[Hashable], Protocol):
"""A protocol for sized iterable of hashable objects"""
def __len__(self) -> int: ...
def __len__(self) -> int:
"""Add a len function to protocol so Python knows the object is sized."""
def assert_unique_of_length(data: SizedIterableHashable, length: int) -> None:

View file

@ -91,7 +91,6 @@ def interp_closed_path(xy_points: list[tuple[int, int]], n_points: int) -> MatPa
Modified from:
https://stackoverflow.com/questions/33962717/interpolating-a-closed-curve-using-scipy
"""
# Use zip to seperate x and y points into tuples
x, y = zip(*xy_points)