Skip to content

Commit 17a8212

Browse files
PEP8 formatting fixes...
1 parent f3d1eac commit 17a8212

File tree

5 files changed

+45
-24
lines changed

5 files changed

+45
-24
lines changed

matplotview/__init__.py

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
from typing import Optional, Iterable, Type, Union
22
from matplotlib.artist import Artist
33
from matplotlib.axes import Axes
4-
from matplotview._view_axes import view_wrapper, ViewSpecification, DEFAULT_RENDER_DEPTH
4+
from matplotlib.transforms import Transform
5+
from matplotview._view_axes import (
6+
view_wrapper,
7+
ViewSpecification,
8+
DEFAULT_RENDER_DEPTH
9+
)
510
from matplotview._docs import dynamic_doc_string, get_interpolation_list_str
611

712

813
__all__ = ["view", "inset_zoom_axes", "ViewSpecification"]
914

1015

11-
@dynamic_doc_string(render_depth=DEFAULT_RENDER_DEPTH, interp_list=get_interpolation_list_str())
16+
@dynamic_doc_string(
17+
render_depth=DEFAULT_RENDER_DEPTH,
18+
interp_list=get_interpolation_list_str()
19+
)
1220
def view(
1321
axes: Axes,
1422
axes_to_view: Axes,
@@ -32,15 +40,15 @@ def view(
3240
3341
image_interpolation: string, default of '{image_interpolation}'
3442
The image interpolation method to use when displaying scaled images
35-
from the axes being viewed. Defaults to '{image_interpolation}'. Supported options
36-
are {interp_list}.
43+
from the axes being viewed. Defaults to '{image_interpolation}'.
44+
Supported options are {interp_list}.
3745
3846
render_depth: optional int, positive, defaults to None
3947
The number of recursive draws allowed for this view, this can happen
4048
if the view is a child of the axes (such as an inset axes) or if
4149
two views point at each other. If None, uses the default render depth
42-
of {render_depth}, unless the axes passed is already a view axes, in which case the
43-
render depth the view already has will be used.
50+
of {render_depth}, unless the axes passed is already a view axes, in
51+
which case the render depth the view already has will be used.
4452
4553
filter_set: Iterable[Union[Type[Artist], Artist]] or None
4654
An optional filter set, which can be used to select what artists
@@ -65,7 +73,10 @@ def view(
6573
return view_obj
6674

6775

68-
@dynamic_doc_string(render_depth=DEFAULT_RENDER_DEPTH, interp_list=get_interpolation_list_str())
76+
@dynamic_doc_string(
77+
render_depth=DEFAULT_RENDER_DEPTH,
78+
interp_list=get_interpolation_list_str()
79+
)
6980
def inset_zoom_axes(
7081
axes: Axes,
7182
bounds: Iterable,
@@ -74,7 +85,7 @@ def inset_zoom_axes(
7485
render_depth: Optional[int] = None,
7586
filter_set: Optional[Iterable[Union[Type[Artist], Artist]]] = None,
7687
scale_lines: bool = True,
77-
transform = None,
88+
transform: Transform = None,
7889
zorder: int = 5,
7990
**kwargs
8091
) -> Axes:
@@ -100,16 +111,16 @@ def inset_zoom_axes(
100111
parent Axes.
101112
102113
image_interpolation: string
103-
Supported options are {interp_list}. The default value is '{image_interpolation}'. This
104-
determines the interpolation used when attempting to render a
105-
zoomed version of an image.
114+
Supported options are {interp_list}. The default value is
115+
'{image_interpolation}'. This determines the interpolation
116+
used when attempting to render a zoomed version of an image.
106117
107118
render_depth: optional int, positive, defaults to None
108119
The number of recursive draws allowed for this view, this can happen
109120
if the view is a child of the axes (such as an inset axes) or if
110121
two views point at each other. If None, uses the default render depth
111-
of {render_depth}, unless the axes passed is already a view axes, in which case the
112-
render depth the view already has will be used.
122+
of {render_depth}, unless the axes passed is already a view axes,
123+
in which case the render depth the view already has will be used.
113124
114125
filter_set: Iterable[Union[Type[Artist], Artist]] or None
115126
An optional filter set, which can be used to select what artists

matplotview/_docs.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
def dynamic_doc_string(**kwargs):
66
def convert(func):
77
default_vals = {
8-
k: v.default for k, v in signature(func).parameters.items() if(v.default is not inspect.Parameter.empty)
8+
k: v.default for k, v in signature(func).parameters.items()
9+
if(v.default is not inspect.Parameter.empty)
910
}
1011
default_vals.update(kwargs)
1112
func.__doc__ = func.__doc__.format(**default_vals)
@@ -17,4 +18,7 @@ def convert(func):
1718

1819
def get_interpolation_list_str():
1920
from matplotlib.image import _interpd_
20-
return ", ".join([f"'{k}'" if(i != len(_interpd_) - 1) else f"or '{k}'" for i, k in enumerate(_interpd_)])
21+
return ", ".join([
22+
f"'{k}'" if(i != len(_interpd_) - 1) else f"or '{k}'"
23+
for i, k in enumerate(_interpd_)
24+
])

matplotview/_transform_renderer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ def __init__(
5252
axes will be clipped.
5353
5454
image_interpolation: string
55-
Supported options are {interp_list}. The default value is '{image_interpolation}'. This
56-
determines the interpolation used when attempting to render a
57-
zoomed version of an image.
55+
Supported options are {interp_list}. The default value is
56+
'{image_interpolation}'. This determines the interpolation
57+
used when attempting to render a zoomed version of an image.
5858
5959
scale_linewidths: bool, default is {scale_linewidths}
6060
Specifies if line widths should be scaled, in addition to the

matplotview/_view_axes.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ def _view_from_pickle(builder, args):
9797
return res
9898

9999

100-
@dynamic_doc_string(render_depth=DEFAULT_RENDER_DEPTH, interp_list=get_interpolation_list_str())
100+
@dynamic_doc_string(
101+
render_depth=DEFAULT_RENDER_DEPTH,
102+
interp_list=get_interpolation_list_str()
103+
)
101104
@dataclass
102105
class ViewSpecification:
103106
"""
@@ -107,9 +110,9 @@ class ViewSpecification:
107110
Parameters:
108111
-----------
109112
image_interpolation: string
110-
Supported options are {interp_list}. The default value is '{image_interpolation}'. This
111-
determines the interpolation used when attempting to render a
112-
zoomed version of an image.
113+
Supported options are {interp_list}. The default value is
114+
'{image_interpolation}'. This determines the interpolation
115+
used when attempting to render a zoomed version of an image.
113116
114117
filter_set: Iterable[Union[Type[Artist], Artist]] or {filter_set}
115118
An optional filter set, which can be used to select what artists
@@ -189,7 +192,8 @@ def __init__(
189192
render_depth: int, positive, defaults to {render_depth}
190193
The number of recursive draws allowed for this view, this can
191194
happen if the view is a child of the axes (such as an inset
192-
axes) or if two views point at each other. Defaults to {render_depth}.
195+
axes) or if two views point at each other. Defaults to
196+
{render_depth}.
193197
194198
**kwargs
195199
Other optional keyword arguments supported by the Axes
@@ -361,7 +365,8 @@ def from_axes(
361365
The number of recursive draws allowed for this view, this can
362366
happen if the view is a child of the axes (such as an inset
363367
axes) or if two views point at each other. If none, use the
364-
default value ({render_depth}) if the render depth is not already set.
368+
default value ({render_depth}) if the render depth is not
369+
already set.
365370
366371
Returns
367372
-------

matplotview/tests/test_view_obj.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from matplotview._view_axes import DEFAULT_RENDER_DEPTH, view_wrapper
66
import numpy as np
77

8+
89
def test_obj_comparison():
910
from matplotlib.axes import Subplot, Axes
1011

0 commit comments

Comments
 (0)