@@ -53,14 +53,14 @@ def draw(self, renderer: RendererBase):
53
53
54
54
# If we are working with a 3D object, swap out it's axes with
55
55
# this zoom axes (swapping out the 3d transform) and reproject it.
56
- if (hasattr (self ._artist , "do_3d_projection" )):
56
+ if (hasattr (self ._artist , "do_3d_projection" )):
57
57
self .do_3d_projection ()
58
58
59
59
# Check and see if the passed limiting box and extents of the
60
60
# artist intersect, if not don't bother drawing this artist.
61
61
# First 2 checks are a special case where we received a bad clip box.
62
62
# (those can happen when we try to get the bounds of a map projection)
63
- if (
63
+ if (
64
64
self ._clip_box .width == 0 or self ._clip_box .height == 0 or
65
65
Bbox .intersection (full_extents , self ._clip_box ) is not None
66
66
):
@@ -128,7 +128,7 @@ class ViewSpecification:
128
128
129
129
def __post_init__ (self ):
130
130
self .image_interpolation = str (self .image_interpolation )
131
- if (self .filter_set is not None ):
131
+ if (self .filter_set is not None ):
132
132
self .filter_set = set (self .filter_set )
133
133
self .scale_lines = bool (self .scale_lines )
134
134
@@ -138,7 +138,6 @@ class __ViewType:
138
138
PRIVATE: A simple identifier class for identifying view types, a view
139
139
will inherit from the axes class it is wrapping and this type...
140
140
"""
141
- ...
142
141
143
142
144
143
# Cache classes so grabbing the same type twice leads to actually getting the
@@ -162,7 +161,7 @@ def view_wrapper(axes_class: Type[Axes]) -> Type[Axes]:
162
161
another axes contents...
163
162
"""
164
163
# If the passed class is a view, simply return it.
165
- if (issubclass (axes_class , Axes ) and issubclass (axes_class , __ViewType )):
164
+ if (issubclass (axes_class , Axes ) and issubclass (axes_class , __ViewType )):
166
165
return axes_class
167
166
168
167
class View (axes_class , __ViewType ):
@@ -228,14 +227,14 @@ def get_children(self) -> List[Artist]:
228
227
child_list = super ().get_children ()
229
228
230
229
def filter_check (artist , filter_set ):
231
- if (filter_set is None ):
230
+ if (filter_set is None ):
232
231
return True
233
232
return (
234
233
(artist not in filter_set )
235
234
and (type (artist ) not in filter_set )
236
235
)
237
236
238
- if (self .__renderer is not None ):
237
+ if (self .__renderer is not None ):
239
238
for ax , spec in self .view_specifications .items ():
240
239
mock_renderer = _TransformRenderer (
241
240
self .__renderer , ax .transData , self .transData ,
@@ -253,7 +252,7 @@ def filter_check(artist, filter_set):
253
252
for a in itertools .chain (
254
253
ax ._children ,
255
254
ax .child_axes
256
- ) if (filter_check (a , spec .filter_set ))
255
+ ) if (filter_check (a , spec .filter_set ))
257
256
])
258
257
259
258
return child_list
@@ -262,7 +261,7 @@ def draw(self, renderer: RendererBase = None):
262
261
# It is possible to have two axes which are views of each other
263
262
# therefore we track the number of recursions and stop drawing
264
263
# at a certain depth
265
- if (self .figure ._current_render_depth >= self .__max_render_depth ):
264
+ if (self .figure ._current_render_depth >= self .__max_render_depth ):
266
265
return
267
266
self .figure ._current_render_depth += 1
268
267
# Set the renderer, causing get_children to return the view's
@@ -281,7 +280,7 @@ def __reduce__(self):
281
280
cls = type (self )
282
281
283
282
args = tuple (
284
- arg if (arg != cls ) else cls .__bases__ [0 ] for arg in args
283
+ arg if (arg != cls ) else cls .__bases__ [0 ] for arg in args
285
284
)
286
285
287
286
return (
@@ -318,7 +317,7 @@ def set_max_render_depth(self, val: int):
318
317
allow. Zero and negative values are invalid, and will raise a
319
318
ValueError.
320
319
"""
321
- if (val <= 0 ):
320
+ if (val <= 0 ):
322
321
raise ValueError (f"Render depth must be positive, not { val } ." )
323
322
self .__max_render_depth = val
324
323
@@ -376,20 +375,20 @@ def from_axes(
376
375
If the provided axes to convert has an Axes type which does
377
376
not match the axes class this view type wraps.
378
377
"""
379
- if (isinstance (axes , cls )):
380
- if (render_depth is not None ):
378
+ if (isinstance (axes , cls )):
379
+ if (render_depth is not None ):
381
380
axes .set_max_render_depth (render_depth )
382
381
return axes
383
382
384
- if (type (axes ) != axes_class ):
383
+ if (type (axes ) is not axes_class ):
385
384
raise TypeError (
386
385
f"Can't convert { type (axes ).__name__ } to { cls .__name__ } "
387
386
)
388
387
389
388
axes .__class__ = cls
390
389
axes ._init_vars (
391
390
DEFAULT_RENDER_DEPTH
392
- if (render_depth is None )
391
+ if (render_depth is None )
393
392
else render_depth
394
393
)
395
394
return axes
0 commit comments