Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add numpydoc validation to pre-commit #1272

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ repos:
- id: yamllint
args: [--strict, --config-file=./tests/.yamllint.yml]

- repo: https://github.com/numpy/numpydoc
rev: v1.8.0
hooks:
- id: numpydoc-validation

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.1
hooks:
Expand Down
3 changes: 2 additions & 1 deletion environments/make-env-files.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def make_requirement(
Parameters
----------
requirement
A requirement object
A requirement object.
pin_exact
If True, pin requirement to version rather than using existing
specifier. Allows you to convert minimum versions to pinned versions.
Expand All @@ -49,6 +49,7 @@ def make_requirement(
Returns
-------
requirement_str
The requirement's name and its specifier(s).
"""
specifiers = list(requirement.specifier)
if pin_exact and len(specifiers) == 1:
Expand Down
1 change: 0 additions & 1 deletion osmnx/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ def _validate_node_edge_gdfs(
GeoDataFrame of graph nodes uniquely indexed by `osmid`.
gdf_edges
GeoDataFrame of graph edges uniquely multi-indexed by `(u, v, key)`.
graph_attrs

Returns
-------
Expand Down
4 changes: 2 additions & 2 deletions osmnx/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,10 @@ def features_from_xml(
----------
filepath
Path to file containing OSM XML data.
tags
Query tags to optionally filter the final GeoDataFrame.
polygon
Spatial boundaries to optionally filter the final GeoDataFrame.
tags
Query tags to optionally filter the final GeoDataFrame.
encoding
The OSM XML file's character encoding.

Expand Down
3 changes: 0 additions & 3 deletions osmnx/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,9 +599,6 @@ def _create_graph(
----------
response_jsons
Iterable of JSON responses from the Overpass API.
retain_all
If True, return the entire graph even if it is not connected.
Otherwise, retain only the largest weakly connected component.
bidirectional
If True, create bidirectional edges for one-way streets.
Expand Down
6 changes: 3 additions & 3 deletions osmnx/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def plot_graph_route(
Size of the origin and destination nodes.
ax
If not None, plot on this pre-existing axes instance.
pg_kwargs
**pg_kwargs
Keyword arguments to pass to `plot_graph`.

Returns
Expand Down Expand Up @@ -394,7 +394,7 @@ def plot_graph_routes(
route_linewidths
If float, the one linewidth for all routes. Otherwise, the linewidth
for each route.
pgr_kwargs
**pgr_kwargs
Keyword arguments to pass to `plot_graph_route`.

Returns
Expand Down Expand Up @@ -487,7 +487,7 @@ def plot_figure_ground(
Fallback width, in pixels, for any street type not in `street_widths`.
color
The color of the streets.
pg_kwargs
**pg_kwargs
Keyword arguments to pass to `plot_graph`.

Returns
Expand Down
2 changes: 1 addition & 1 deletion osmnx/projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def is_projected(crs: Any) -> bool: # noqa: ANN401
Returns
-------
projected
True if `crs` is projected, otherwise False
True if `crs` is projected, otherwise False.
"""
return bool(gpd.GeoSeries(crs=crs).crs.is_projected)

Expand Down
2 changes: 1 addition & 1 deletion osmnx/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def shortest_path(
Parameters
----------
G
Input graph,
Input graph.
orig
Origin node ID(s).
dest
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ strict = true
warn_no_return = true
warn_unreachable = true

[tool.numpydoc_validation]
checks = ["all", "ES01", "EX01", "GL08", "PR04", "RT03", "SA01"]

[tool.ruff]
cache-dir = "~/.cache/pre-commit/ruff"
exclude = ["build/*"]
Expand Down
Loading