Skip to content

Commit c57c7b0

Browse files
committed
Prefer closing brackets on new lines
1 parent db78bc0 commit c57c7b0

File tree

8 files changed

+667
-445
lines changed

8 files changed

+667
-445
lines changed

proplot/axes.py

Lines changed: 138 additions & 101 deletions
Large diffs are not rendered by default.

proplot/axistools.py

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ def Locator(locator, *args, **kwargs):
127127
if locator not in locators:
128128
raise ValueError(
129129
f'Unknown locator {locator!r}. Options are '
130-
+ ', '.join(map(repr, locators.keys())) + '.')
130+
+ ', '.join(map(repr, locators.keys())) + '.'
131+
)
131132
locator = locators[locator](*args, **kwargs)
132133
elif isinstance(locator, Number): # scalar variable
133134
locator = mticker.MultipleLocator(locator, *args, **kwargs)
@@ -266,7 +267,8 @@ def Formatter(formatter, *args, date=False, index=False, **kwargs):
266267
if formatter not in formatters:
267268
raise ValueError(
268269
f'Unknown formatter {formatter!r}. Options are '
269-
+ ', '.join(map(repr, formatters.keys())) + '.')
270+
+ ', '.join(map(repr, formatters.keys())) + '.'
271+
)
270272
formatter = formatters[formatter](*args, **kwargs)
271273
elif callable(formatter):
272274
formatter = mticker.FuncFormatter(formatter, *args, **kwargs)
@@ -348,7 +350,8 @@ def Scale(scale, *args, **kwargs):
348350
if args or kwargs:
349351
_warn_proplot(
350352
f'Scale {scale!r} is a scale *preset*. Ignoring positional '
351-
'argument(s): {args} and keyword argument(s): {kwargs}. ')
353+
'argument(s): {args} and keyword argument(s): {kwargs}. '
354+
)
352355
scale, *args = SCALE_PRESETS[scale]
353356
# Get scale
354357
scale = scale.lower()
@@ -357,7 +360,8 @@ def Scale(scale, *args, **kwargs):
357360
else:
358361
raise ValueError(
359362
f'Unknown scale or preset {scale!r}. Options are '
360-
+ ', '.join(map(repr, list(scales) + list(SCALE_PRESETS))) + '.')
363+
+ ', '.join(map(repr, list(scales) + list(SCALE_PRESETS))) + '.'
364+
)
361365
return scale(*args, **kwargs)
362366

363367

@@ -382,9 +386,11 @@ class AutoFormatter(mticker.ScalarFormatter):
382386
3. Allows user to add arbitrary prefix or suffix to every
383387
tick label string.
384388
"""
385-
def __init__(self, *args,
386-
zerotrim=None, precision=None, tickrange=None,
387-
prefix=None, suffix=None, negpos=None, **kwargs):
389+
def __init__(
390+
self, *args,
391+
zerotrim=None, precision=None, tickrange=None,
392+
prefix=None, suffix=None, negpos=None, **kwargs
393+
):
388394
"""
389395
Parameters
390396
----------
@@ -543,7 +549,8 @@ def _scale_factory(scale, axis, *args, **kwargs):
543549
if scale not in scales:
544550
raise ValueError(
545551
f'Unknown scale {scale!r}. Options are '
546-
+ ', '.join(map(repr, scales.keys())) + '.')
552+
+ ', '.join(map(repr, scales.keys())) + '.'
553+
)
547554
return scales[scale](*args, **kwargs)
548555

549556

@@ -761,11 +768,12 @@ class FuncScale(_ScaleBase, mscale.ScaleBase):
761768
name = 'function'
762769
"""The registered scale name."""
763770

764-
def __init__(self, arg, invert=False, parent_scale=None,
765-
major_locator=None, minor_locator=None,
766-
major_formatter=None, minor_formatter=None,
767-
smart_bounds=None,
768-
):
771+
def __init__(
772+
self, arg, invert=False, parent_scale=None,
773+
major_locator=None, minor_locator=None,
774+
major_formatter=None, minor_formatter=None,
775+
smart_bounds=None,
776+
):
769777
"""
770778
Parameters
771779
----------
@@ -1014,8 +1022,8 @@ class ExpScale(_ScaleBase, mscale.ScaleBase):
10141022
"""The registered scale name."""
10151023

10161024
def __init__(
1017-
self, a=np.e, b=1, c=1, inverse=False, minpos=1e-300,
1018-
**kwargs):
1025+
self, a=np.e, b=1, c=1, inverse=False, minpos=1e-300, **kwargs
1026+
):
10191027
"""
10201028
Parameters
10211029
----------
@@ -1320,7 +1328,8 @@ def __init__(self, threshs, scales, zero_dists=None):
13201328
any((dists == 0) != (scales == 0)) or zero_dists is None):
13211329
raise ValueError(
13221330
'Got zero scales and distances in different places or '
1323-
'zero_dists is None.')
1331+
'zero_dists is None.'
1332+
)
13241333
self._scales = scales
13251334
self._threshs = threshs
13261335
with np.errstate(divide='ignore', invalid='ignore'):

proplot/projs.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,13 @@ def Proj(name, basemap=False, **kwargs):
171171
if 'boundinglat' in kwargs:
172172
raise ValueError(
173173
f'"boundinglat" must be passed to the ax.format() command '
174-
'for cartopy axes.')
174+
'for cartopy axes.'
175+
)
175176
if crs is None:
176177
raise ValueError(
177178
f'Unknown projection {name!r}. Options are: '
178-
+ ', '.join(map(repr, cartopy_names.keys())))
179+
+ ', '.join(map(repr, cartopy_names.keys()))
180+
)
179181
proj = crs(**kwargs)
180182
aspect = (np.diff(proj.x_limits) / np.diff(proj.y_limits))[0]
181183
return proj, aspect
@@ -197,8 +199,10 @@ def __init__(self, central_longitude=0, globe=None,
197199
a = globe.semimajor_axis or WGS84_SEMIMAJOR_AXIS
198200
b = globe.semiminor_axis or a
199201
if b != a or globe.ellipse is not None:
200-
_warn_proplot(f'The {self.name!r} projection does not handle '
201-
'elliptical globes.')
202+
_warn_proplot(
203+
f'The {self.name!r} projection does not handle '
204+
'elliptical globes.'
205+
)
202206

203207
proj4_params = {'proj': 'hammer', 'lon_0': central_longitude}
204208
super().__init__(proj4_params, central_longitude,
@@ -230,8 +234,10 @@ def __init__(self, central_longitude=0, globe=None,
230234
a = globe.semimajor_axis or WGS84_SEMIMAJOR_AXIS
231235
b = globe.semiminor_axis or a
232236
if b != a or globe.ellipse is not None:
233-
_warn_proplot(f'The {self.name!r} projection does not handle '
234-
'elliptical globes.')
237+
_warn_proplot(
238+
f'The {self.name!r} projection does not handle '
239+
'elliptical globes.'
240+
)
235241

236242
proj4_params = {'proj': 'aitoff', 'lon_0': central_longitude}
237243
super().__init__(proj4_params, central_longitude,
@@ -263,8 +269,10 @@ def __init__(self, central_longitude=0, globe=None,
263269
a = globe.semimajor_axis or WGS84_SEMIMAJOR_AXIS
264270
b = globe.semiminor_axis or a
265271
if b != a or globe.ellipse is not None:
266-
_warn_proplot(f'The {self.name!r} projection does not handle '
267-
'elliptical globes.')
272+
_warn_proplot(
273+
f'The {self.name!r} projection does not handle '
274+
'elliptical globes.'
275+
)
268276

269277
proj4_params = {'proj': 'kav7', 'lon_0': central_longitude}
270278
super().__init__(proj4_params, central_longitude,
@@ -296,8 +304,10 @@ def __init__(self, central_longitude=0, globe=None,
296304
a = globe.semimajor_axis or WGS84_SEMIMAJOR_AXIS
297305
b = globe.semiminor_axis or a
298306
if b != a or globe.ellipse is not None:
299-
_warn_proplot(f'The {self.name!r} projection does not handle '
300-
'elliptical globes.')
307+
_warn_proplot(
308+
f'The {self.name!r} projection does not handle '
309+
'elliptical globes.'
310+
)
301311

302312
proj4_params = {'proj': 'wintri', 'lon_0': central_longitude}
303313
super().__init__(proj4_params, central_longitude,
@@ -473,4 +483,5 @@ def __init__(self, central_longitude=0.0, globe=None):
473483
if _unavail:
474484
_warn_proplot(
475485
f'Cartopy projection(s) {", ".join(map(repr, _unavail))} are '
476-
f'unavailable. Consider updating to cartopy >= 0.17.0.')
486+
f'unavailable. Consider updating to cartopy >= 0.17.0.'
487+
)

proplot/rctools.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -448,14 +448,9 @@ def _tabulate(rcdict):
448448
'rivers.linewidth',
449449
'subplots.axpad',
450450
'subplots.axwidth',
451-
'subplots.innerspace',
452451
'subplots.pad',
453452
'subplots.panelpad',
454-
'subplots.panelspace',
455453
'subplots.panelwidth',
456-
'subplots.titlespace',
457-
'subplots.xlabspace',
458-
'subplots.ylabspace',
459454
'suptitle.color',
460455
'suptitle.size',
461456
'suptitle.weight',
@@ -551,7 +546,8 @@ def _get_synced_params(key, value):
551546
mcolors.ListedColormap))
552547
raise ValueError(
553548
f'Invalid cycle name {cycle!r}. Options are: '
554-
', '.join(map(repr, cycles)) + '.')
549+
', '.join(map(repr, cycles)) + '.'
550+
)
555551
if rgbcycle and cycle.lower() == 'colorblind':
556552
regcolors = colors + [(0.1, 0.1, 0.1)]
557553
elif mcolors.to_rgb('r') != (1.0, 0.0, 0.0): # reset
@@ -751,7 +747,8 @@ def __enter__(self):
751747
"""Apply settings from the most recent context block."""
752748
if not self._context:
753749
raise RuntimeError(
754-
f'rc context must be initialized with rc.context().')
750+
f'rc object must be initialized with rc.context().'
751+
)
755752
*_, kwargs, cache, restore = self._context[-1]
756753

757754
def _update(rcdict, newdict):
@@ -768,7 +765,8 @@ def __exit__(self, *args):
768765
"""Restore settings from the most recent context block."""
769766
if not self._context:
770767
raise RuntimeError(
771-
f'rc context must be initialized with rc.context().')
768+
f'rc object must be initialized with rc.context().'
769+
)
772770
*_, restore = self._context[-1]
773771
for key, value in restore.items():
774772
rc_short, rc_long, rc = _get_synced_params(key, value)
@@ -990,10 +988,7 @@ def fill(self, props, *, context=False):
990988
Parameters
991989
----------
992990
props : dict-like
993-
Dictionary whose values are names of settings. The values
994-
are replaced with the corresponding property only if
995-
`~rc_configurator.__getitem__` does not return ``None``. Otherwise,
996-
that key, value pair is omitted from the output dictionary.
991+
Dictionary whose values are `rc` setting names.
997992
context : bool, optional
998993
If ``True``, then each setting that is not found in the
999994
context mode dictionaries is omitted from the output dictionary.
@@ -1152,7 +1147,8 @@ def ipython_matplotlib(backend=None, fmt=None):
11521147
else:
11531148
raise ValueError(
11541149
f'Invalid inline backend format {fmt!r}. '
1155-
'Must be string or list thereof.')
1150+
'Must be string or list thereof.'
1151+
)
11561152
ipython.magic(f'config InlineBackend.figure_formats = {fmt!r}')
11571153
ipython.magic('config InlineBackend.rc = {}') # no notebook overrides
11581154
ipython.magic('config InlineBackend.close_figures = True') # memory issues

0 commit comments

Comments
 (0)