Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ repos:
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
groups: [format]
- repo: https://github.com/jsh9/pydoclint
rev: 0.12.0
hooks:
# Checks docstring parameters against signatures. Options live in [tool.pydoclint] in pyproject.toml.
- id: pydoclint
files: ^src/
- repo: local
hooks:
- id: mypy
Expand Down
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,24 @@ lint.per-file-ignores."tests/*" = [ "B024", "D", "PT" ]
lint.per-file-ignores."tests/conftest.py" = [ "E402" ]
lint.per-file-ignores."tests/test_models/test_models.py" = [ "NPY002" ]
lint.unfixable = [ "B", "BLE", "C4", "RET", "T20", "UP" ]
lint.external = [ "DOC1" ] # pydoclint parameter checks, see [tool.pydoclint]
lint.isort.required-imports = [ "from __future__ import annotations" ]
lint.pydocstyle.convention = "numpy"

[tool.pydoclint]
# Check that documented parameters match the function signature (missing or stale names, #1303),
# and that Returns/Yields sections exist. Types (they live in the signatures), order and raises are not checked.
# Docstrings with only a summary (no Parameters section) are skipped.
style = "numpy"
allow-init-docstring = true
arg-type-hints-in-docstring = false
check-return-types = false
check-yield-types = false
skip-checking-raises = true
check-class-attributes = false
check-arg-order = false
omit-stars-when-documenting-varargs = true

[tool.mypy]
# TODO: extend to "tests" once the test suite carries type annotations.
files = [ "src" ]
Expand Down
2 changes: 1 addition & 1 deletion src/spatialdata/_core/query/spatial_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ def bounding_box_query(
Shapes are not cut to the bounding box: a shape that intersects it is returned whole. For a `MultiPolygon` this
includes components that lie entirely outside the bounding box. To cut the shapes to the bounding box, use
:func:`polygon_query` with `clip=True` and the bounding box as polygon, e.g. `shapely.box(xmin, ymin, xmax, ymax)`.
"""
""" # noqa: DOC101, DOC103 (**kwargs only exists for singledispatch; nothing extra is accepted)
raise RuntimeError("Unsupported type for bounding_box_query: " + str(type(element)) + ".")


Expand Down
4 changes: 2 additions & 2 deletions src/spatialdata/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ def parse(cls, data: Any, **kwargs: Any) -> GeoDataFrame:
Returns
-------
:class:`geopandas.GeoDataFrame`
"""
""" # noqa: DOC102, DOC103 (parameters of the registered implementations)
raise TypeError(f"ShapesModel.parse() does not support the type {type(data)}")

@parse.register(np.ndarray)
Expand Down Expand Up @@ -802,7 +802,7 @@ def parse(cls, data: Any, **kwargs: Any) -> DaskDataFrame:
-----
The order of the columns of the dataframe returned by the parser is not guaranteed to be the same as the order
of the columns in the dataframe passed as an argument.
"""
""" # noqa: DOC102, DOC103 (parameters of the registered implementations)
raise TypeError(f"PointsModel.parse() does not support the type {type(data)}")

@parse.register(np.ndarray)
Expand Down
Loading