Skip to content

Commit

Permalink
Merge pull request #1274 from gboeing/docs
Browse files Browse the repository at this point in the history
remove "return None" from docstrings
  • Loading branch information
gboeing authored Jan 25, 2025
2 parents 5aac9c1 + c2ee963 commit b8f100c
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 65 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 2.0.2 (TBD)

- improve docstrings (#1272)
- improve docstrings (#1272 #1274)
- fix bug where consolidate_intersections function would mutate the passed-in graph (#1273)
- provide user-friendly error message if consolidate_intersections is run more than once (#1273)

Expand Down
4 changes: 0 additions & 4 deletions environments/make-env-files.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ def make_file(env: dict[str, Any]) -> None:
----------
env
An environment configuration dictionary.
Returns
-------
None
"""
depends_on = []
output_path = Path(env["output_path"])
Expand Down
8 changes: 0 additions & 8 deletions osmnx/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ def _save_to_cache(
The JSON response from the server.
ok
A `requests.response.ok` value.
Returns
-------
None
"""
if settings.use_cache:
if not ok: # pragma: no cover
Expand Down Expand Up @@ -251,10 +247,6 @@ def _config_dns(url: str) -> None:
----------
url
The URL to consistently resolve the IP address of.
Returns
-------
None
"""
hostname = _hostname_from_url(url)
try:
Expand Down
12 changes: 0 additions & 12 deletions osmnx/_osm_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,6 @@ def _save_graph_xml(
attribute will be assigned the value of the first edge of the way.
encoding
The character encoding of the saved OSM XML file.
Returns
-------
None
"""
# default "oneway" value used to fill this tag where missing
ONEWAY = False
Expand Down Expand Up @@ -291,10 +287,6 @@ def _add_nodes_xml(
The XML parent element.
gdf_nodes
A GeoDataFrame of graph nodes.
Returns
-------
None
"""
node_tags = set(settings.useful_tags_node)
node_attrs = {"id", "lat", "lon"}.union(ATTR_DEFAULTS)
Expand Down Expand Up @@ -336,10 +328,6 @@ def _add_ways_xml(
aggregate graph edge attribute values into single OSM way values. If
None, or if some tag's key does not exist in the dict, the way
attribute will be assigned the value of the first edge of the way.
Returns
-------
None
"""
way_tags = set(settings.useful_tags_way)
way_attrs = list({"id"}.union(ATTR_DEFAULTS))
Expand Down
5 changes: 1 addition & 4 deletions osmnx/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +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)`.
Returns
-------
None
"""
# ensure gdf_nodes contains x and y columns representing node geometries
if not ("x" in gdf_nodes.columns and "y" in gdf_nodes.columns): # pragma: no cover
Expand Down Expand Up @@ -505,6 +501,7 @@ def _is_same_geometry(ls1: LineString, ls2: LineString) -> bool:
Returns
-------
is_same
True if geometries are the same in either direction, otherwise False.
"""
# extract coordinates from each LineString geometry
geom1 = [tuple(coords) for coords in ls1.xy]
Expand Down
4 changes: 0 additions & 4 deletions osmnx/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,10 +823,6 @@ def _add_paths(
Iterable of paths' `tag:value` attribute data dicts.
bidirectional
If True, create bidirectional edges for one-way streets.
Returns
-------
None
"""
# the values OSM uses in its 'oneway' tag to denote True, and to denote
# travel can only occur in the opposite direction of the node order. see:
Expand Down
12 changes: 0 additions & 12 deletions osmnx/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ def save_graph_geopackage(
True, save one edge for each directed edge in the graph.
encoding
The character encoding of the saved GeoPackage file.
Returns
-------
None
"""
# default filepath if none was provided
filepath = Path(settings.data_folder) / "graph.gpkg" if filepath is None else Path(filepath)
Expand Down Expand Up @@ -95,10 +91,6 @@ def save_graphml(
interpretation of the GraphML specification.
encoding
The character encoding of the saved GraphML file.
Returns
-------
None
"""
# default filepath if none was provided
filepath = Path(settings.data_folder) / "graph.graphml" if filepath is None else Path(filepath)
Expand Down Expand Up @@ -292,10 +284,6 @@ def save_graph_xml(
attribute will be assigned the value of the first edge of the way.
encoding
The character encoding of the saved OSM XML file.
Returns
-------
None
"""
_osm_xml._save_graph_xml(G, filepath, way_tag_aggs, encoding)

Expand Down
8 changes: 1 addition & 7 deletions osmnx/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1061,13 +1061,7 @@ def _get_fig_ax(


def _verify_mpl() -> None:
"""
Verify that matplotlib is installed and imported.
Returns
-------
None
"""
"""Verify that matplotlib is installed and imported."""
if not mpl_available: # pragma: no cover
msg = "matplotlib must be installed as an optional dependency for visualization."
raise ImportError(msg)
4 changes: 0 additions & 4 deletions osmnx/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,6 @@ def _verify_edge_attribute(G: nx.MultiDiGraph, attr: str) -> None:
Input graph.
attr
Name of the edge attribute to verify.
Returns
-------
None
"""
try:
values_float = (np.array(tuple(G.edges(data=attr)))[:, 2]).astype(float)
Expand Down
8 changes: 0 additions & 8 deletions osmnx/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ def citation(style: str = "bibtex") -> None:
style
{"apa", "bibtex", "ieee"}
The citation format, either APA or BibTeX or IEEE.
Returns
-------
None
"""
if style == "apa":
msg = (
Expand Down Expand Up @@ -116,10 +112,6 @@ def log(
filename
The name of the log file, without file extension. If None, set to
`settings.log_filename` value.
Returns
-------
None
"""
if level is None:
level = settings.log_level
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ warn_no_return = true
warn_unreachable = true

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

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

0 comments on commit b8f100c

Please sign in to comment.