Skip to content

Commit

Permalink
Merge pull request #1111 from gboeing/dep
Browse files Browse the repository at this point in the history
deprecation refinements
  • Loading branch information
gboeing authored Jan 16, 2024
2 parents 18a1746 + 8c5999c commit c25f083
Show file tree
Hide file tree
Showing 17 changed files with 53 additions and 50 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- fix a bug in the features module's polygon handling (#1104)
- update obsolete numpy random number generation (#1108)
- update warning messages to note that deprecated code will be removed in v2.0.0 (#1111)
- deprecate return_coords argument in graph.graph_from_address function (#1105)
- deprecate return_hex argument in plot.get_colors function (#1109)

Expand Down
6 changes: 3 additions & 3 deletions osmnx/bearing.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def add_edge_bearings(G, precision=None):
precision = 1
else:
warn(
"the `precision` parameter is deprecated and will be removed in a future release",
"The `precision` parameter is deprecated and will be removed in the v2.0.0 release.",
stacklevel=2,
)

Expand Down Expand Up @@ -257,7 +257,7 @@ def plot_orientation(
Do not use: deprecated.
The plot_orientation function moved to the plot module. Calling it via the
bearing module will raise an error in a future release.
bearing module will raise an error starting in the v2.0.0 release.
Parameters
----------
Expand Down Expand Up @@ -299,7 +299,7 @@ def plot_orientation(
"""
warn(
"The `plot_orientation` function moved to the `plot` module. Calling it "
"via the `bearing` module will cause an exception in a future release.",
"via the `bearing` module will raise an exception starting with the v2.0.0 release.",
stacklevel=2,
)
return plot.plot_orientation(
Expand Down
23 changes: 12 additions & 11 deletions osmnx/distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def great_circle_vec(lat1, lng1, lat2, lng2, earth_radius=EARTH_RADIUS_M):
Do not use, deprecated.
The `great_circle_vec` function has been renamed `great_circle`. Calling
`great_circle_vec` will raise an error in a future release.
`great_circle_vec` will raise an error in the v2.0.0 release.
Parameters
----------
Expand All @@ -130,7 +130,7 @@ def great_circle_vec(lat1, lng1, lat2, lng2, earth_radius=EARTH_RADIUS_M):
"""
warn(
"The `great_circle_vec` function has been renamed `great_circle`. Calling "
"`great_circle_vec` will raise an error in a future release.",
"`great_circle_vec` will raise an error starting in the v2.0.0 release.",
stacklevel=2,
)
return great_circle(lat1, lng1, lat2, lng2, earth_radius)
Expand All @@ -141,7 +141,7 @@ def euclidean_dist_vec(y1, x1, y2, x2):
Do not use, deprecated.
The `euclidean_dist_vec` function has been renamed `euclidean`. Calling
`euclidean_dist_vec` will raise an error in a future release.
`euclidean_dist_vec` will raise an error in the v2.0.0 release.
Parameters
----------
Expand All @@ -161,7 +161,7 @@ def euclidean_dist_vec(y1, x1, y2, x2):
"""
warn(
"The `euclidean_dist_vec` function has been renamed `euclidean`. Calling "
"`euclidean_dist_vec` will raise an error in a future release.",
"`euclidean_dist_vec` will raise an error starting in the v2.0.0 release.",
stacklevel=2,
)
return euclidean(y1, x1, y2, x2)
Expand Down Expand Up @@ -206,7 +206,7 @@ def add_edge_lengths(G, precision=None, edges=None):
precision = 3
else:
warn(
"the `precision` parameter is deprecated and will be removed in a future release",
"The `precision` parameter is deprecated and will be removed in the v2.0.0 release.",
stacklevel=2,
)

Expand Down Expand Up @@ -372,7 +372,8 @@ def nearest_edges(G, X, Y, interpolate=None, return_dist=False):
# otherwise, if interpolation distance was provided
else:
warn(
"The `interpolate` parameter has been deprecated and will be removed in a future release",
"The `interpolate` parameter has been deprecated and will be "
"removed in the v2.0.0 release.",
stacklevel=2,
)

Expand Down Expand Up @@ -422,7 +423,7 @@ def shortest_path(G, orig, dest, weight="length", cpus=1):
Do not use, deprecated.
The `shortest_path` function has moved to the `routing` module. Calling
it via the `distance` module will raise an error in a future release.
it via the `distance` module will raise an error in the v2.0.0 release.
Parameters
----------
Expand All @@ -444,8 +445,8 @@ def shortest_path(G, orig, dest, weight="length", cpus=1):
are lists, then a list of path lists
"""
warn(
"The `shortest_path` function has moved to the `routing` module. "
"Calling it via the `distance` module will raise an error in a future release.",
"The `shortest_path` function has moved to the `routing` module. Calling it "
"via the `distance` module will raise an error starting in the v2.0.0 release.",
stacklevel=2,
)
return routing.shortest_path(G, orig, dest, weight, cpus)
Expand All @@ -456,7 +457,7 @@ def k_shortest_paths(G, orig, dest, k, weight="length"):
Do not use, deprecated.
The `k_shortest_paths` function has moved to the `routing` module. Calling
it via the `distance` module will raise an error in a future release.
it via the `distance` module will raise an error in the v2.0.0 release.
Parameters
----------
Expand All @@ -480,7 +481,7 @@ def k_shortest_paths(G, orig, dest, k, weight="length"):
"""
warn(
"The `k_shortest_paths` function has moved to the `routing` module. "
"Calling it via the `distance` module will raise an error in a future release.",
"Calling it via the `distance` module will raise an error in the v2.0.0 release.",
stacklevel=2,
)
return routing.k_shortest_paths(G, orig, dest, k, weight)
12 changes: 6 additions & 6 deletions osmnx/elevation.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def add_edge_grades(G, add_absolute=True, precision=None):
precision = 3
else:
warn(
"the `precision` parameter is deprecated and will be removed in a future release",
"The `precision` parameter is deprecated and will be removed in the v2.0.0 release.",
stacklevel=2,
)

Expand Down Expand Up @@ -209,25 +209,25 @@ def add_node_elevations_google(
max_locations_per_batch = batch_size
else:
warn(
"the `max_locations_per_batch` parameter is deprecated and will be "
"removed in a future release, use the `batch_size` parameter instead",
"The `max_locations_per_batch` parameter is deprecated and will be "
"removed the v2.0.0 release, use the `batch_size` parameter instead",
stacklevel=2,
)

if precision is None:
precision = 3
else:
warn(
"the `precision` parameter is deprecated and will be removed in a future release",
"The `precision` parameter is deprecated and will be removed in the v2.0.0 release.",
stacklevel=2,
)

if url_template is None:
url_template = settings.elevation_url_template
else:
warn(
"the `url_template` parameter is deprecated and will be removed "
"in a future release, configure the `settings` module's "
"The `url_template` parameter is deprecated and will be removed "
"in the v2.0.0 release. Configure the `settings` module's "
"`elevation_url_template` instead",
stacklevel=2,
)
Expand Down
2 changes: 1 addition & 1 deletion osmnx/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def features_from_place(query, tags, which_result=None, buffer_dist=None):
if buffer_dist is not None:
warn(
"The buffer_dist argument has been deprecated and will be removed "
"in a future release. Buffer your query area directly, if desired.",
"in the v2.0.0 release. Buffer your query area directly, if desired.",
stacklevel=2,
)

Expand Down
6 changes: 3 additions & 3 deletions osmnx/folium.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Create interactive Leaflet web maps of graphs and routes via folium.
This module is deprecated. Do not use. It will be removed in a future release.
This module is deprecated. Do not use. It will be removed in the v2.0.0 release.
You can generate and explore interactive web maps of graph nodes, edges,
and/or routes automatically using GeoPandas.GeoDataFrame.explore instead, for
example like: `ox.graph_to_gdfs(G, nodes=False).explore()`. See the OSMnx
Expand Down Expand Up @@ -58,7 +58,7 @@ def plot_graph_folium(
folium.folium.Map
"""
warn(
"The `folium` module has been deprecated and will be removed in a future release. "
"The `folium` module has been deprecated and will be removed in the v2.0.0 release. "
"You can generate and explore interactive web maps of graph nodes, edges, "
"and/or routes automatically using GeoPandas.GeoDataFrame.explore instead, "
"for example like: `ox.graph_to_gdfs(G, nodes=False).explore()`. See the "
Expand Down Expand Up @@ -112,7 +112,7 @@ def plot_route_folium(
folium.folium.Map
"""
warn(
"The `folium` module has been deprecated and will be removed in a future release. "
"The `folium` module has been deprecated and will be removed in the v2.0.0 release. "
"You can generate and explore interactive web maps of graph nodes, edges, "
"and/or routes automatically using GeoPandas.GeoDataFrame.explore instead, "
"for example like: `ox.graph_to_gdfs(G, nodes=False).explore()`. See the "
Expand Down
2 changes: 1 addition & 1 deletion osmnx/geocoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def geocode_to_gdf(query, which_result=None, by_osmid=False, buffer_dist=None):
if buffer_dist is not None:
warn(
"The buffer_dist argument has been deprecated and will be removed "
"in a future release. Buffer your results directly, if desired.",
"in the v2.0.0 release. Buffer your results directly, if desired.",
stacklevel=2,
)

Expand Down
16 changes: 8 additions & 8 deletions osmnx/geometries.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Do not use: deprecated.
The `geometries` module has been renamed the `features` module. The
`geometries` module is deprecated and will be removed in a future release.
`geometries` module is deprecated and will be removed in the v2.0.0 release.
"""

from warnings import warn
Expand All @@ -13,7 +13,7 @@
"The `geometries` module and `geometries_from_X` functions have been "
"renamed the `features` module and `features_from_X` functions. Use these "
"instead. The `geometries` module and function names are deprecated and "
"will be removed in a future release."
"will be removed in the v2.0.0 release."
)


Expand All @@ -24,7 +24,7 @@ def geometries_from_bbox(north, south, east, west, tags):
The `geometries` module and `geometries_from_X` functions have been
renamed the `features` module and `features_from_X` functions. Use these
instead. The `geometries` module and functions are deprecated and will be
removed in a future release.
removed in the v2.0.0 release.
Parameters
----------
Expand Down Expand Up @@ -54,7 +54,7 @@ def geometries_from_point(center_point, tags, dist=1000):
The `geometries` module and `geometries_from_X` functions have been
renamed the `features` module and `features_from_X` functions. Use these
instead. The `geometries` module and functions are deprecated and will be
removed in a future release.
removed in the v2.0.0 release.
Parameters
----------
Expand All @@ -80,7 +80,7 @@ def geometries_from_address(address, tags, dist=1000):
The `geometries` module and `geometries_from_X` functions have been
renamed the `features` module and `features_from_X` functions. Use these
instead. The `geometries` module and functions are deprecated and will be
removed in a future release.
removed in the v2.0.0 release.
Parameters
----------
Expand All @@ -106,7 +106,7 @@ def geometries_from_place(query, tags, which_result=None, buffer_dist=None):
The `geometries` module and `geometries_from_X` functions have been
renamed the `features` module and `features_from_X` functions. Use these
instead. The `geometries` module and functions are deprecated and will be
removed in a future release.
removed in the v2.0.0 release.
Parameters
----------
Expand Down Expand Up @@ -134,7 +134,7 @@ def geometries_from_polygon(polygon, tags):
The `geometries` module and `geometries_from_X` functions have been
renamed the `features` module and `features_from_X` functions. Use these
instead. The `geometries` module and functions are deprecated and will be
removed in a future release.
removed in the v2.0.0 release.
Parameters
----------
Expand All @@ -158,7 +158,7 @@ def geometries_from_xml(filepath, polygon=None, tags=None):
The `geometries` module and `geometries_from_X` functions have been
renamed the `features` module and `features_from_X` functions. Use these
instead. The `geometries` module and functions are deprecated and will be
removed in a future release.
removed in the v2.0.0 release.
Parameters
----------
Expand Down
8 changes: 4 additions & 4 deletions osmnx/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ def graph_from_address(
else:
warn(
"The `return_coords` argument has been deprecated and will be removed in "
"a future release. Future behavior will be as though `return_coords=False`. "
"If you want the address's geocoded coordinates, use the `geocode` module.",
"the v2.0.0 release. Future behavior will be as though `return_coords=False`. "
"If you want the address's geocoded coordinates, use the `geocode` function.",
stacklevel=2,
)
# geocode the address string to a (lat, lon) point
Expand Down Expand Up @@ -358,7 +358,7 @@ def graph_from_place(
if buffer_dist is not None:
warn(
"The buffer_dist argument has been deprecated and will be removed "
"in a future release. Buffer your query area directly, if desired.",
"in the v2.0.0 release. Buffer your query area directly, if desired.",
stacklevel=2,
)

Expand Down Expand Up @@ -449,7 +449,7 @@ def graph_from_polygon(
else:
warn(
"The clean_periphery argument has been deprecated and will be removed in "
"a future release. Future behavior will be as though clean_periphery=True.",
"the v2.0.0 release. Future behavior will be as though clean_periphery=True.",
stacklevel=2,
)

Expand Down
2 changes: 1 addition & 1 deletion osmnx/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def save_graph_shapefile(G, filepath=None, encoding="utf-8", directed=False):
"""
warn(
"The `save_graph_shapefile` function is deprecated and will be removed "
"in a future release. Instead, use the `save_graph_geopackage` function "
"in the v2.0.0 release. Instead, use the `save_graph_geopackage` function "
"to save graphs as GeoPackage files for subsequent GIS analysis.",
stacklevel=2,
)
Expand Down
6 changes: 3 additions & 3 deletions osmnx/osm_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def save_graph_xml(
The `save_graph_xml` has moved from the `osm_xml` module to the `io`
module. `osm_xml.save_graph_xml` has been deprecated and will be removed
in a future release. Access the function via the `io` module instead.
in the v2.0.0 release. Access the function via the `io` module instead.
Parameters
----------
Expand Down Expand Up @@ -157,8 +157,8 @@ def save_graph_xml(
"""
warn(
"The save_graph_xml function has moved from the osm_xml module to the io module. "
" osm_xml.save_graph_xml has been deprecated and will be removed in a "
" future release. Access the function via the io module instead.",
"osm_xml.save_graph_xml has been deprecated and will be removed in the v2.0.0 "
"release. Access the function via the io module instead.",
stacklevel=2,
)
_save_graph_xml(
Expand Down
2 changes: 1 addition & 1 deletion osmnx/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_colors(n, cmap="viridis", start=0.0, stop=1.0, alpha=1.0, return_hex=Fal
return_hex = False
else:
warn(
"The `return_hex` function has been deprecated and will be removed "
"The `return_hex` parameter has been deprecated and will be removed "
"in the v2.0.0 release.",
stacklevel=2,
)
Expand Down
4 changes: 2 additions & 2 deletions osmnx/speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def add_edge_speeds(G, hwy_speeds=None, fallback=None, precision=None, agg=np.me
precision = 1
else:
warn(
"the `precision` parameter is deprecated and will be removed in a future release",
"The `precision` parameter is deprecated and will be removed in the v2.0.0 release.",
stacklevel=2,
)

Expand Down Expand Up @@ -150,7 +150,7 @@ def add_edge_travel_times(G, precision=None):
precision = 1
else:
warn(
"the `precision` parameter is deprecated and will be removed in a future release",
"The `precision` parameter is deprecated and will be removed in the v2.0.0 release.",
stacklevel=2,
)

Expand Down
4 changes: 2 additions & 2 deletions osmnx/truncate.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def truncate_graph_polygon(
"""
if quadrat_width is not None or min_num is not None:
warn(
"the `quadrat_width` and `min_num` parameters are deprecated and "
"will be removed in a future release",
"The `quadrat_width` and `min_num` parameters are deprecated and "
"will be removed in the v2.0.0 release.",
stacklevel=2,
)

Expand Down
4 changes: 2 additions & 2 deletions osmnx/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ def config(
None
"""
warn(
"The `utils.config` function is deprecated and will be removed in a "
"future release. Instead, use the `settings` module directly to "
"The `utils.config` function is deprecated and will be removed in "
"the v2.0.0 release. Instead, use the `settings` module directly to "
"configure a global setting's value. For example, "
"`ox.settings.log_console=True`.",
stacklevel=2,
Expand Down
Loading

0 comments on commit c25f083

Please sign in to comment.