drop long deprecated SCALING_FACTOR warnings

since we moved the extension module to an internal pyclipper._pyclipper submodule, setting SCALING_FACTOR on the parent pyclipper package won't work any more. We may as well remove the deprecation warnings altogether since they have been there for long time now.
This commit is contained in:
Cosimo Lupo 2021-06-25 17:15:52 +01:00
parent 8aefba84b5
commit 1d003cdeaf
2 changed files with 3 additions and 75 deletions

View file

@ -8,12 +8,6 @@ This wrapper was written by Maxime Chalton, Lukas Treyer and Gregor Ratajc.
SILENT = True
"""
SCALING_FACTOR has been deprecated. See https://github.com/greginvm/pyclipper/wiki/Deprecating-SCALING_FACTOR
for an explanation.
"""
SCALING_FACTOR = 1
def log_action(description):
if not SILENT:
@ -670,8 +664,6 @@ cdef class Pyclipper:
Returns:
PyIntRect with left, right, bottom, top vertices that define the axis-aligned bounding rectangle.
"""
_check_scaling_factor()
cdef IntRect rr
with nogil:
rr = <IntRect> self.thisptr.GetBounds()
@ -860,13 +852,9 @@ cdef class PyclipperOffset:
More info: http://www.angusj.com/delphi/clipper/documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Properties/ArcTolerance.htm
"""
def __get__(self):
_check_scaling_factor()
return self.thisptr.ArcTolerance
def __set__(self, value):
_check_scaling_factor()
self.thisptr.ArcTolerance = value
@ -926,8 +914,6 @@ cdef Paths _to_clipper_paths(object polygons):
cdef Path _to_clipper_path(object polygon):
_check_scaling_factor()
cdef Path path = Path()
cdef IntPoint p
for v in polygon:
@ -952,21 +938,9 @@ cdef object _from_clipper_paths(Paths paths):
cdef object _from_clipper_path(Path path):
_check_scaling_factor()
poly = []
cdef IntPoint point
for i in xrange(path.size()):
point = path[i]
poly.append([point.X, point.Y])
return poly
def _check_scaling_factor():
"""
Check whether SCALING_FACTOR has been set by the code using this library and warn the user that it has been
deprecated and it's value is ignored.
"""
if SCALING_FACTOR != 1:
_warnings.warn('SCALING_FACTOR is deprecated and it\'s value is ignored. See https://github.com/greginvm/pyclipper/wiki/Deprecating-SCALING_FACTOR for more information.', DeprecationWarning)

View file

@ -37,8 +37,6 @@ class TestPyclipperModule(TestCase):
class TestNamespaceMethods(TestCase):
def setUp(self):
pyclipper.SCALING_FACTOR = 1
def test_orientation(self):
self.assertFalse(pyclipper.Orientation(PATH_SUBJ_1))
@ -166,7 +164,6 @@ class TestFilterPyPolyNode(TestCase):
class TestPyclipperAddPaths(TestCase):
def setUp(self):
pyclipper.SCALING_FACTOR = 1
self.pc = pyclipper.Pyclipper()
def test_add_path(self):
@ -202,16 +199,13 @@ class TestClassProperties(TestCase):
self.check_property_assignment(pc, prop_name, [True, False])
def test_pyclipperoffset_properties(self):
for factor in range(6):
pyclipper.SCALING_FACTOR = 10 ** factor
pc = pyclipper.PyclipperOffset()
for prop_name in ('MiterLimit', 'ArcTolerance'):
self.check_property_assignment(pc, prop_name, [2.912, 132.12, 12, -123])
pc = pyclipper.PyclipperOffset()
for prop_name in ('MiterLimit', 'ArcTolerance'):
self.check_property_assignment(pc, prop_name, [2.912, 132.12, 12, -123])
class TestPyclipperExecute(TestCase):
def setUp(self):
pyclipper.SCALING_FACTOR = 1
self.pc = pyclipper.Pyclipper()
self.add_default_paths(self.pc)
self.default_args = [pyclipper.CT_INTERSECTION, pyclipper.PFT_EVENODD, pyclipper.PFT_EVENODD]
@ -285,8 +279,6 @@ class TestPyclipperExecute(TestCase):
class TestPyclipperOffset(TestCase):
def setUp(self):
pyclipper.SCALING_FACTOR = 1
@staticmethod
def add_path(pc, path):
@ -316,44 +308,6 @@ class TestPyclipperOffset(TestCase):
self.assertEqual(len(solution), 0)
class TestScalingFactorWarning(TestCase):
def setUp(self):
pyclipper.SCALING_FACTOR = 2.
self.pc = pyclipper.Pyclipper()
def test_orientation(self):
with self.assertWarns(DeprecationWarning):
pyclipper.Orientation(PATH_SUBJ_1)
def test_area(self):
with self.assertWarns(DeprecationWarning):
pyclipper.Area(PATH_SUBJ_1)
def test_point_in_polygon(self):
with self.assertWarns(DeprecationWarning):
self.assertEqual(pyclipper.PointInPolygon((180, 200), PATH_SUBJ_1), -1)
def test_minkowski_sum(self):
with self.assertWarns(DeprecationWarning):
pyclipper.MinkowskiSum(PATTERN, PATH_SIGMA, False)
def test_minkowski_sum2(self):
with self.assertWarns(DeprecationWarning):
pyclipper.MinkowskiSum2(PATTERN, [PATH_SIGMA], False)
def test_minkowski_diff(self):
with self.assertWarns(DeprecationWarning):
pyclipper.MinkowskiDiff(PATH_SUBJ_1, PATH_SUBJ_2)
def test_add_path(self):
with self.assertWarns(DeprecationWarning):
self.pc.AddPath(PATH_CLIP_1, poly_type=pyclipper.PT_CLIP)
def test_add_paths(self):
with self.assertWarns(DeprecationWarning):
self.pc.AddPaths([PATH_SUBJ_1, PATH_SUBJ_2], poly_type=pyclipper.PT_SUBJECT)
class TestScalingFunctions(TestCase):
scale = 2 ** 31
path = [(0, 0), (1, 1)]