Skip to content

Commit

Permalink
Merge pull request #468 from jGaboardi/dep_cg_geom
Browse files Browse the repository at this point in the history
Update deprecation warnings (shape.py, locators.py)
  • Loading branch information
sjsrey authored Jun 13, 2022
2 parents f72e3a1 + 788dd0f commit cd96518
Show file tree
Hide file tree
Showing 3 changed files with 238 additions and 235 deletions.
10 changes: 5 additions & 5 deletions libpysal/cg/locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

__all__ = ["Grid", "BruteForcePointLocator", "PointLocator", "PolygonLocator"]

dep_msg = "is deprecated and will be reoved in libpysal 4.4.0"
dep_msg = "is deprecated and will be removed in a future version of libpysal"


class Grid:
Expand All @@ -38,7 +38,7 @@ def __init__(self, bounds, resolution):
TODO: complete this doctest
>>> g = Grid(Rectangle(0, 0, 10, 10), 1)
"""
warnings.warn("Grid " + dep_msg, DeprecationWarning)
warnings.warn("Grid " + dep_msg, FutureWarning)
if resolution == 0:
raise Exception("Cannot create grid with resolution 0")
self.res = resolution
Expand Down Expand Up @@ -294,7 +294,7 @@ def __init__(self, points):
--------
>>> pl = BruteForcePointLocator([Point((0, 0)), Point((5, 0)), Point((0, 10))])
"""
warnings.warn("BruteForcePointLocator " + dep_msg, DeprecationWarning)
warnings.warn("BruteForcePointLocator " + dep_msg, FutureWarning)
self._points = points

def nearest(self, query_point):
Expand Down Expand Up @@ -388,7 +388,7 @@ def __init__(self, points):
>>> points = [Point((0, 0)), Point((1, 6)), Point((5.4, 1.4))]
>>> pl = PointLocator(points)
"""
warnings.warn("PointLocator " + dep_msg, DeprecationWarning)
warnings.warn("PointLocator " + dep_msg, FutureWarning)
self._locator = BruteForcePointLocator(points)

def nearest(self, query_point):
Expand Down Expand Up @@ -486,7 +486,7 @@ def __init__(self, polygons):
>>> isinstance(pl, PolygonLocator)
True
"""
warnings.warn("PolygonLocator " + dep_msg, DeprecationWarning)
warnings.warn("PolygonLocator " + dep_msg, FutureWarning)
self._locator = polygons
# create and rtree
self._rtree = RTree()
Expand Down
10 changes: 4 additions & 6 deletions libpysal/cg/segmentLocator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import warnings


dep_msg = "is deprecated and will be reoved in libpysal 4.4.0."
dep_msg = "is deprecated and will be removed in a future version of libpysal"

__all__ = ["SegmentGrid", "SegmentLocator", "Polyline_Shapefile_SegmentLocator"]
DEBUG = False
Expand All @@ -27,7 +27,7 @@ def nearest(self, pt):

class SegmentLocator(object):
def __init__(self, segments, nbins=500):
warnings.warn("SegmentLocator " + dep_msg, DeprecationWarning)
warnings.warn("SegmentLocator " + dep_msg, FutureWarning)
self.data = segments
if hasattr(segments, "bounding_box"):
bbox = segment.bounding_box
Expand All @@ -51,9 +51,7 @@ def nearest(self, pt):

class Polyline_Shapefile_SegmentLocator(object):
def __init__(self, shpfile, nbins=500):
warnings.warn(
"Polyline_Shapefile_SegmentLocator " + dep_msg, DeprecationWarning
)
warnings.warn("Polyline_Shapefile_SegmentLocator " + dep_msg, FutureWarning)
self.data = shpfile
bbox = Rectangle(*shpfile.bbox)
res = max((bbox.right - bbox.left), (bbox.upper - bbox.lower)) / float(nbins)
Expand Down Expand Up @@ -101,7 +99,7 @@ def __init__(self, bounds, resolution):
TODO: complete this doctest
>>> g = SegmentGrid(Rectangle(0, 0, 10, 10), 1)
"""
warnings.warn("SegmentGrid " + dep_msg, DeprecationWarning)
warnings.warn("SegmentGrid " + dep_msg, FutureWarning)
if resolution == 0:
raise Exception("Cannot create grid with resolution 0")
self.res = resolution
Expand Down
Loading

0 comments on commit cd96518

Please sign in to comment.