| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f734bb5 commit dbad6cf
18 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -82,8 +82,8 @@ def __missing__(self, key): | |||
| 82 | 82 | name = key[:-len(":kwdoc")] | |
| 83 | 83 | from matplotlib.artist import Artist, kwdoc | |
| 84 | 84 | try: | |
| 85 | - cls, = [cls for cls in _api.recursive_subclasses(Artist) | ||
| 86 | - if cls.__name__ == name] | ||
| 85 | + cls, = (cls for cls in _api.recursive_subclasses(Artist) | ||
| 86 | + if cls.__name__ == name) | ||
| 87 | 87 | except ValueError as e: | |
| 88 | 88 | raise KeyError(key) from e | |
| 89 | 89 | return self.setdefault(key, kwdoc(cls)) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -376,7 +376,7 @@ def _get_info(self, fontname: str, font_class: str, sym: str, fontsize: float, | |||
| 376 | 376 | font.set_size(fontsize, dpi) | |
| 377 | 377 | glyph = font.load_char(num, flags=self.load_glyph_flags) | |
| 378 | 378 | ||
| 379 | - xmin, ymin, xmax, ymax = [val/64.0 for val in glyph.bbox] | ||
| 379 | + xmin, ymin, xmax, ymax = (val / 64 for val in glyph.bbox) | ||
| 380 | 380 | offset = self._get_offset(font, glyph, fontsize, dpi) | |
| 381 | 381 | metrics = FontMetrics( | |
| 382 | 382 | advance = glyph.linearHoriAdvance/65536.0, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,10 +1,11 @@ | |||
| 1 | 1 | from collections import namedtuple | |
| 2 | 2 | import contextlib | |
| 3 | - from functools import cache, wraps | ||
| 3 | + from functools import cache, reduce, wraps | ||
| 4 | 4 | import inspect | |
| 5 | 5 | from inspect import Signature, Parameter | |
| 6 | 6 | import logging | |
| 7 | 7 | from numbers import Number, Real | |
| 8 | + import operator | ||
| 8 | 9 | import re | |
| 9 | 10 | import warnings | |
| 10 | 11 | ||
@@ -1290,7 +1291,8 @@ def matchfunc(x): | |||
| 1290 | 1291 | raise ValueError('match must be None, a matplotlib.artist.Artist ' | |
| 1291 | 1292 | 'subclass, or a callable') | |
| 1292 | 1293 | ||
| 1293 | - artists = sum([c.findobj(matchfunc) for c in self.get_children()], []) | ||
| 1294 | + artists = reduce(operator.iadd, | ||
| 1295 | + [c.findobj(matchfunc) for c in self.get_children()], []) | ||
| 1294 | 1296 | if include_self and matchfunc(self): | |
| 1295 | 1297 | artists.append(self) | |
| 1296 | 1298 | return artists | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6000,7 +6000,7 @@ def _pcolorargs(self, funcname, *args, shading='auto', **kwargs): | |||
| 6000 | 6000 | # unit conversion allows e.g. datetime objects as axis values | |
| 6001 | 6001 | X, Y = args[:2] | |
| 6002 | 6002 | X, Y = self._process_unit_info([("x", X), ("y", Y)], kwargs) | |
| 6003 | - X, Y = [cbook.safe_masked_invalid(a, copy=True) for a in [X, Y]] | ||
| 6003 | + X, Y = (cbook.safe_masked_invalid(a, copy=True) for a in [X, Y]) | ||
| 6004 | 6004 | ||
| 6005 | 6005 | if funcname == 'pcolormesh': | |
| 6006 | 6006 | if np.ma.is_masked(X) or np.ma.is_masked(Y): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,7 +29,7 @@ | |||
| 29 | 29 | # allows all Line2D kwargs. | |
| 30 | 30 | _line_inspector = martist.ArtistInspector(mlines.Line2D) | |
| 31 | 31 | _line_param_names = _line_inspector.get_setters() | |
| 32 | - _line_param_aliases = [list(d)[0] for d in _line_inspector.aliasd.values()] | ||
| 32 | + _line_param_aliases = [next(iter(d)) for d in _line_inspector.aliasd.values()] | ||
| 33 | 33 | _gridline_param_names = ['grid_' + name | |
| 34 | 34 | for name in _line_param_names + _line_param_aliases] | |
| 35 | 35 | ||
@@ -728,8 +728,8 @@ def _get_shared_axis(self): | |||
| 728 | 728 | ||
| 729 | 729 | def _get_axis_name(self): | |
| 730 | 730 | """Return the axis name.""" | |
| 731 | - return [name for name, axis in self.axes._axis_map.items() | ||
| 732 | - if axis is self][0] | ||
| 731 | + return next(name for name, axis in self.axes._axis_map.items() | ||
| 732 | + if axis is self) | ||
| 733 | 733 | ||
| 734 | 734 | # During initialization, Axis objects often create ticks that are later | |
| 735 | 735 | # unused; this turns out to be a very slow step. Instead, use a custom | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -483,7 +483,7 @@ def blit(self, bbox=None): | |||
| 483 | 483 | if bbox is None and self.figure: | |
| 484 | 484 | bbox = self.figure.bbox # Blit the entire canvas if bbox is None. | |
| 485 | 485 | # repaint uses logical pixels, not physical pixels like the renderer. | |
| 486 | - l, b, w, h = [int(pt / self.device_pixel_ratio) for pt in bbox.bounds] | ||
| 486 | + l, b, w, h = (int(pt / self.device_pixel_ratio) for pt in bbox.bounds) | ||
| 487 | 487 | t = b + h | |
| 488 | 488 | self.repaint(l, self.rect().height() - t, w, h) | |
| 489 | 489 | ||
@@ -504,7 +504,7 @@ def drawRectangle(self, rect): | |||
| 504 | 504 | # Draw the zoom rectangle to the QPainter. _draw_rect_callback needs | |
| 505 | 505 | # to be called at the end of paintEvent. | |
| 506 | 506 | if rect is not None: | |
| 507 | - x0, y0, w, h = [int(pt / self.device_pixel_ratio) for pt in rect] | ||
| 507 | + x0, y0, w, h = (int(pt / self.device_pixel_ratio) for pt in rect) | ||
| 508 | 508 | x1 = x0 + w | |
| 509 | 509 | y1 = y0 + h | |
| 510 | 510 | def _draw_rect_callback(painter): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1197,8 +1197,8 @@ def _get_tool_pos(self, tool): | |||
| 1197 | 1197 | ``ToolBar.GetToolPos`` is not useful because wx assigns the same Id to | |
| 1198 | 1198 | all Separators and StretchableSpaces. | |
| 1199 | 1199 | """ | |
| 1200 | - pos, = [pos for pos in range(self.ToolsCount) | ||
| 1201 | - if self.GetToolByPos(pos) == tool] | ||
| 1200 | + pos, = (pos for pos in range(self.ToolsCount) | ||
| 1201 | + if self.GetToolByPos(pos) == tool) | ||
| 1202 | 1202 | return pos | |
| 1203 | 1203 | ||
| 1204 | 1204 | def add_toolitem(self, name, group, position, image_file, description, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,7 +54,7 @@ def get_intersection(cx1, cy1, cos_t1, sin_t1, | |||
| 54 | 54 | # rhs_inverse | |
| 55 | 55 | a_, b_ = d, -b | |
| 56 | 56 | c_, d_ = -c, a | |
| 57 | - a_, b_, c_, d_ = [k / ad_bc for k in [a_, b_, c_, d_]] | ||
| 57 | + a_, b_, c_, d_ = (k / ad_bc for k in [a_, b_, c_, d_]) | ||
| 58 | 58 | ||
| 59 | 59 | x = a_ * line1_rhs + b_ * line2_rhs | |
| 60 | 60 | y = c_ * line1_rhs + d_ * line2_rhs | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -424,13 +424,13 @@ def _parse_args(*args, caller_name='function'): | |||
| 424 | 424 | X = X.ravel() | |
| 425 | 425 | Y = Y.ravel() | |
| 426 | 426 | if len(X) == nc and len(Y) == nr: | |
| 427 | - X, Y = [a.ravel() for a in np.meshgrid(X, Y)] | ||
| 427 | + X, Y = (a.ravel() for a in np.meshgrid(X, Y)) | ||
| 428 | 428 | elif len(X) != len(Y): | |
| 429 | 429 | raise ValueError('X and Y must be the same size, but ' | |
| 430 | 430 | f'X.size is {X.size} and Y.size is {Y.size}.') | |
| 431 | 431 | else: | |
| 432 | 432 | indexgrid = np.meshgrid(np.arange(nc), np.arange(nr)) | |
| 433 | - X, Y = [np.ravel(a) for a in indexgrid] | ||
| 433 | + X, Y = (np.ravel(a) for a in indexgrid) | ||
| 434 | 434 | # Size validation for U, V, C is left to the set_UVC method. | |
| 435 | 435 | return X, Y, U, V, C | |
| 436 | 436 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3086,10 +3086,10 @@ def test_log_scales(): | |||
| 3086 | 3086 | ax.set_yscale('log', base=5.5) | |
| 3087 | 3087 | ax.invert_yaxis() | |
| 3088 | 3088 | ax.set_xscale('log', base=9.0) | |
| 3089 | - xticks, yticks = [ | ||
| 3089 | + xticks, yticks = ( | ||
| 3090 | 3090 | [(t.get_loc(), t.label1.get_text()) for t in axis._update_ticks()] | |
| 3091 | 3091 | for axis in [ax.xaxis, ax.yaxis] | |
| 3092 | - ] | ||
| 3092 | + ) | ||
| 3093 | 3093 | assert xticks == [ | |
| 3094 | 3094 | (1.0, '$\\mathdefault{9^{0}}$'), | |
| 3095 | 3095 | (9.0, '$\\mathdefault{9^{1}}$'), | |
| Back | FazBrowse Home | New Git URL |
0 commit comments