Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4699c0c

Browse files
committed
FIX: remove LinearTransform
1 parent 2a2a68f commit 4699c0c

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

lib/matplotlib/scale.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ def __deepcopy__(self, memo):
9090
__copy__ = __deepcopy__
9191

9292

93-
class LinearTransform(_CopyableTransformMixin, IdentityTransform):
94-
pass
95-
96-
9793
class LinearScale(ScaleBase):
9894
"""
9995
The default linear scale.
@@ -125,7 +121,7 @@ def get_transform(self):
125121
Return the transform for linear scaling, which is just the
126122
`~matplotlib.transforms.IdentityTransform`.
127123
"""
128-
return LinearTransform()
124+
return IdentityTransform()
129125

130126

131127
class FuncTransform(_CopyableTransformMixin, Transform):

lib/matplotlib/tests/test_transforms.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,8 @@ def test_str_transform():
501501
CompositeGenericTransform(
502502
TransformWrapper(
503503
BlendedAffine2D(
504-
LinearTransform(),
505-
LinearTransform())),
504+
IdentityTransform(),
505+
IdentityTransform())),
506506
CompositeAffine2D(
507507
Affine2D(
508508
[[1. 0. 0.]
@@ -521,8 +521,8 @@ def test_str_transform():
521521
PolarAffine(
522522
TransformWrapper(
523523
BlendedAffine2D(
524-
LinearTransform(),
525-
LinearTransform())),
524+
IdentityTransform(),
525+
IdentityTransform())),
526526
LockableBbox(
527527
Bbox(x0=0.0, y0=0.0, x1=6.283185307179586, y1=1.0),
528528
[[-- --]

lib/matplotlib/transforms.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,6 +2062,14 @@ def frozen(self):
20622062
# docstring inherited
20632063
return self
20642064

2065+
def __deepcopy__(self, memo):
2066+
"""
2067+
The identity transform does not need to lock out deepcopy
2068+
"""
2069+
return self.frozen()
2070+
2071+
__copy__ = __deepcopy__
2072+
20652073
__str__ = _make_str_method()
20662074

20672075
def get_matrix(self):

0 commit comments

Comments
 (0)