8000 python2.6 string formatting. style more uniform · matplotlib/matplotlib@d6c3c32 · GitHub
[go: up one dir, main page]

Skip to content

Commit d6c3c32

Browse files
committed
python2.6 string formatting. style more uniform
1 parent 7ea5c1a commit d6c3c32

File tree

15 files changed

+52
-50
lines changed
  • tri
  • 15 files changed

    +52
    -50
    lines changed

    lib/matplotlib/axes/_base.py

    Lines changed: 4 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -2105,8 +2105,8 @@ def draw_artist(self, a):
    21052105
    data (axis ticks, labels, etc are not updated)
    21062106
    """
    21072107
    if self._cachedRenderer is None:
    2108-
    msg = '''draw_artist can only be used after an initial draw which
    2109-
    caches the render'''
    2108+
    msg = ('draw_artist can only be used after an initial draw which'
    2109+
    ' caches the render')
    21102110
    raise AttributeError(msg)
    21112111
    a.draw(self._cachedRenderer)
    21122112

    @@ -2117,8 +2117,8 @@ def redraw_in_frame(self):
    21172117
    data (axis ticks, labels, etc are not updated)
    21182118
    """
    21192119
    if self._cachedRenderer is None:
    2120-
    msg = '''redraw_in_frame can only be used after an initial draw
    2121-
    which caches the render'''
    2120+
    msg = ('redraw_in_frame can only be used after an initial draw'
    2121+
    ' which caches the render')
    21222122
    raise AttributeError(msg)
    21232123
    self.draw(self._cachedRenderer, inframe=True)
    21242124

    < 67E6 div class="Diff-module__diffHeaderWrapper--rsdD4" style="--header-sticky-offset:0px">

    lib/matplotlib/contour.py

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -858,8 +858,8 @@ def __init__(self, ax, *args, **kwargs):
    858858
    self.logscale = False
    859859

    860860
    if self.origin not in [None, 'lower', 'upper', 'image']:
    861-
    raise ValueError("If given, *origin* must be one of ['lower',"
    862-
    " 'upper', 'image']")
    861+
    raise ValueError("If given, *origin* must be one of [ 'lower' |"
    862+
    " 'upper' | 'image']")
    863863
    if self.extent is not None and len(self.extent) != 4:
    864864
    raise ValueError("If given, *extent* must be '[ *None* |"
    865865
    " (x0,x1,y0,y1) ]'")

    lib/matplotlib/figure.py

    Lines changed: 4 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -949,8 +949,8 @@ def add_subplot(self, *args, **kwargs):
    949949

    950950
    a = args[0]
    951951
    if a.get_figure() is not self:
    952-
    msg = "The Subplot must have been created in the present"
    953-
    msg += " figure"
    952+
    msg = ("The Subplot must have been created in the present"
    953+
    " figure")
    954954
    raise ValueError(msg)
    955955
    # make a key for the subplot (which includes the axes object id
    956956
    # in the hash)
    @@ -1110,8 +1110,8 @@ def draw_artist(self, a):
    11101110
    this is available only after the figure is drawn
    11111111
    """
    11121112
    if self._cachedRenderer is None:
    1113-
    msg = '''draw_artist can only be used after an initial draw which \
    1114-
    caches the render'''
    1113+
    msg = ('draw_artist can only be used after an initial draw which'
    1114+
    ' caches the render')
    11151115
    raise AttributeError(msg)
    11161116
    a.draw(self._cachedRenderer)
    11171117

    lib/matplotlib/finance.py

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -869,7 +869,7 @@ def _missing(sequence, miss=-1):
    869869
    if not (same_length and same_missing):
    870870
    msg = ("*opens*, *highs*, *lows* and *closes* must have the same"
    871871
    " length. NOTE: this code assumes if any value open, high,"
    872-
    "low, close is missing (*-1*) they all must be missing.")
    872+
    " low, close is missing (*-1*) they all must be missing.")
    873873
    raise ValueError(msg)
    874874

    875875

    lib/matplotlib/path.py

    Lines changed: 4 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -143,12 +143,12 @@ def __init__(self, vertices, codes=None, _interpolation_steps=1,
    143143
    if codes is not None:
    144144
    codes = np.asarray(codes, self.code_type)
    145145
    if (codes.ndim != 1) or len(codes) != len(vertices):
    146-
    msg = "'codes' must be a 1D list or array with the same length"
    147-
    msg += "of 'vertices'"
    146+
    msg = ("'codes' must be a 1D list or array with the same"
    147+
    " length of 'vertices'")
    148148
    raise ValueError(msg)
    149149
    if len(codes) and codes[0] != self.MOVETO:
    150-
    msg = "The first element of 'code' must be equal to 'MOVETO':"
    151-
    msg += " {}"
    150+
    msg = ("The first element of 'code' must be equal to 'MOVETO':"
    151+
    " {0}")
    152152
    raise ValueError(msg.format(self.MOVETO))
    153153
    elif closed:
    154154
    codes = np.empty(len(vertices), dtype=self.code_type)

    lib/matplotlib/projections/geo.py

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -130,7 +130,7 @@ def _get_affine_transform(self):
    130130

    131131
    def get_xaxis_transform(self,which='grid'):
    132132
    if which not in ['tick1','tick2','grid']:
    133-
    msg = "'which' must be on of ['tick1','tick2','grid']"
    133+
    msg = "'which' must be on of [ 'tick1' | 'tick2' | 'grid' ]"
    134134
    raise ValueError(msg)
    135135
    return self._xaxis_transform
    136136

    @@ -142,7 +142,7 @@ def get_xaxis_text2_transform(self, pad):
    142142

    143143
    def get_yaxis_transform(self,which='grid'):
    144144
    if which not in ['tick1','tick2','grid']:
    145-
    msg = "'which' must be on of ['tick1','tick2','grid']"
    145+
    msg = "'which' must be one of [ 'tick1' | 'tick2' | 'grid' ]"
    146146
    raise ValueError(msg)
    147147
    return self._yaxis_transform
    148148

    lib/matplotlib/projections/polar.py

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -341,7 +341,7 @@ def _set_lim_and_transforms(self):
    341341

    342342
    def get_xaxis_transform(self,which='grid'):
    343343
    if which not in ['tick1','tick2','grid']:
    344-
    msg = "'which' must be on of ['tick1','tick2','grid']"
    344+
    msg = "'which' must be one of [ 'tick1' | 'tick2' | 'grid' ]"
    345345
    raise ValueError(msg)
    346346
    return self._xaxis_transform
    347347

    @@ -353,7 +353,7 @@ def get_xaxis_text2_transform(self, pad):
    353353

    354354
    def get_yaxis_transform(self,which='grid'):
    355355
    if which not in ['tick1','tick2','grid']:
    356-
    msg = "'which' must be on of ['tick1','tick2','grid']"
    356+
    msg = "'which' must be on of [ 'tick1' | 'tick2' | 'grid' ]"
    357357
    raise ValueError(msg)
    358358
    return self._yaxis_transform
    359359

    lib/matplotlib/rcsetup.py

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -275,7 +275,7 @@ def validate_colorlist(s):
    275275
    elif type(s) in (list, tuple):
    276276
    return [validate_color(c) for c in s]
    277277
    else:
    278-
    msg = "'s' must be of type [string | list | tuple]"
    278+
    msg = "'s' must be of type [ string | list | tuple ]"
    279279
    raise ValueError(msg)
    280280

    281281
    def validate_stringlist(s):
    @@ -285,7 +285,7 @@ def validate_stringlist(s):
    285285
    elif type(s) in (list, tuple):
    286286
    return [six.text_type(v) for v in s if v]
    287287
    else:
    288-
    msg = "'s' must be of type [string | list | tuple]"
    288+
    msg = "'s' must be of type [ string | list | tuple ]"
    289289
    raise ValueError(msg)
    290290

    291291
    validate_orientation = ValidateInStrings(

    lib/matplotlib/sankey.py

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -574,7 +574,7 @@ def add(self, patchlabel='', flows=None, orientations=None, labels='',
    574574
    if orient != -1:
    575575
    raise ValueError(
    576576
    "The value of orientations[%d] is %d, "
    577-
    "but it must be -1, 0, or 1." % (i, orient))
    577+
    "but it must be [ -1 | 0 | 1 ]." % (i, orient))
    578578
    if is_input:
    579579
    angles[i] = UP
    580580
    elif not is_input:

    lib/matplotlib/spines.py

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -378,7 +378,8 @@ def set_position(self, position):
    378378
    if len(position) != 2:
    379379
    raise ValueError("position should be 'center' or 2-tuple")
    380380
    if position[0] not in ['outward', 'axes', 'data']:
    381-
    msg = "position[0] should be in ['outward', 'axes', 'data']"
    381+
    msg = ("position[0] should be in [ 'outward' | 'axes' |"
    382+
    " 'data' ]")
    382383
    raise ValueError(msg)
    383384
    self._position = position
    384385
    self._calc_offset_transform()

    lib/matplotlib/table.py

    Lines changed: 4 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -483,15 +483,15 @@ def table(ax,
    483483
    cols = len(cellText[0])
    484484
    for row in cellText:
    485485
    if len(row) != cols:
    486-
    msg = "Each row in 'cellText' must have {} columns"
    486+
    msg = "Each row in 'cellText' must have {0} columns"
    487487
    raise ValueError(msg.format(cols))
    488488

    489489
    if cellColours is not None:
    490490
    if len(cellColours) != rows:
    491-
    raise ValueError("'cellColours' must have {} rows".format(rows))
    491+
    raise ValueError("'cellColours' must have {0} rows".format(rows))
    492492
    for row in cellColours:
    493493
    if len(row) != cols:
    494-
    msg = "Each row in 'cellColours' must have {} columns"
    494+
    msg = "Each row in 'cellColours' must have {0} columns"
    495495
    raise ValueError(msg.format(cols))
    496496
    else:
    497497
    cellColours = ['w' * cols] * rows
    @@ -512,7 +512,7 @@ def table(ax,
    512512

    513513
    if rowLabels is not None:
    514514
    if len(rowLabels) != rows:
    515-
    raise ValueError("'rowLabels' must be of length {}".format(rows))
    515+
    raise ValueError("'rowLabels' must be of length {0}".format(rows))
    516516

    517517
    # If we have column labels, need to shift
    518518
    # the text and colour arrays down 1 row

    lib/matplotlib/text.py

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -1475,7 +1475,7 @@ def __init__(self, artist, ref_coord, unit="points"):
    14751475

    14761476
    def set_unit(self, unit):
    14771477
    if unit not in ["points", "pixels"]:
    1478-
    raise ValueError("'unit' must be one of ['points', 'pixels']")
    1478+
    raise ValueError("'unit' must be one of [ 'points' | 'pixels' ]")
    14791479
    self._unit = unit
    14801480

    14811481
    def get_unit(self):

    lib/matplotlib/transforms.py

    Lines changed: 18 additions & 18 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1067,8 +1067,8 @@ def __init__(self, bbox, transform, **kwargs):
    10671067
    if not bbox.is_bbox:
    10681068
    raise ValueError("'bbox' is not a bbox")
    10691069
    if not isinstance(transform, Transform):
    1070-
    msg = "'transform' must be an instance of"
    1071-
    msg += " 'matplotlib.transform.Transform'"
    1070+
    msg = ("'transform' must be an instance of"
    1071+
    " 'matplotlib.transform.Transform'")
    10721072
    raise ValueError(msg)
    10731073
    if transform.input_dims != 2 or transform.output_dims != 2:
    10741074
    msg = "The input and output dimensions of 'transform' must be 2"
    @@ -1526,8 +1526,8 @@ def __init__(self, child):
    15261526
    be replaced with :meth:`set`.
    15271527
    """
    15281528
    if not isinstance(child, Transform):
    1529-
    msg = "'child' must be an instance of"
    1530-
    msg += " 'matplotlib.transform.Transform'"
    1529+
    msg = ("'child' must be an instance of"
    1530+
    " 'matplotlib.transform.Transform'")
    15311531
    raise ValueError(msg)
    15321532
    Transform.__init__(self)
    15331533
    self.input_dims = child.input_dims
    @@ -1583,10 +1583,10 @@ def set(self, child):
    15831583
    The new child must have the same number of input and output
    15841584
    dimensions as the current child.
    15851585
    """
    1586-
    if child.input_dims != self.input_dims or \
    1587-
    child.output_dims != self.output_dims:
    1588-
    msg = "The new child must have the same number of input and output"
    1589-
    msg += " dimensions as the current child."
    1586+
    if (child.input_dims != self.input_dims or
    1587+
    child.output_dims != self.output_dims):
    1588+
    msg = ("The new child must have the same number of input and"
    1589+
    " output dimensions as the current child.")
    15901590
    raise ValueError(msg)
    15911591

    15921592
    self._set(child)
    @@ -1838,8 +1838,8 @@ def set(self, oth 10000 er):
    18381838
    :class:`Affine2DBase` object.
    18391839
    """
    18401840
    if not isinstance(other, Affine2DBase):
    1841-
    msg = "'other' must be an instance of"
    1842-
    msg += " 'matplotlib.transform.Affine2DBase'"
    1841+
    msg = ("'other' must be an instance of"
    1842+
    " 'matplotlib.transform.Affine2DBase'")
    18431843
    raise ValueError(msg)
    18441844
    self._mtx = other.get_matrix()
    18451845
    self.invalidate()
    @@ -2174,8 +2174,8 @@ def __init__(self, x_transform, y_transform, **kwargs):
    21742174
    is_separable = x_transform.is_separable and y_transform.is_separable
    21752175
    is_correct = is_affine and is_separable
    21762176
    if not is_correct:
    2177-
    msg = "Both *x_transform* and *y_transform* must be 2D affine"
    2178-
    msg += " transforms."
    2177+
    msg = ("Both *x_transform* and *y_transform* must be 2D affine"
    2178+
    " transforms.")
    21792179
    raise ValueError(msg)
    21802180

    21812181
    Transform.__init__(self, **kwargs)
    @@ -2254,8 +2254,8 @@ def __init__(self, a, b, **kwargs):
    22542254
    transform instance to create.
    22552255
    """
    22562256
    if a.output_dims != b.input_dims:
    2257-
    msg = "The output dimension of 'a' must be equal to the input"
    2258-
    msg += " dimensions of 'b'"
    2257+
    msg = ("The output dimension of 'a' must be equal to the input"
    2258+
    " dimensions of 'b'")
    22592259
    raise ValueError(msg)
    22602260
    self.input_dims = a.input_dims
    22612261
    self.output_dims = b.output_dims
    @@ -2384,8 +2384,8 @@ def __init__(self, a, b, **kwargs):
    23842384
    if not a.is_affine or not b.is_affine:
    23852385
    raise ValueError("'a' and 'b' must be affine transforms")
    23862386
    if a.output_dims != b.input_dims:
    2387-
    msg = "The output dimension of 'a' must be equal to the input"
    2388-
    msg += " dimensions of 'b'"
    2387+
    msg = ("The output dimension of 'a' must be equal to the input"
    2388+
    " dimensions of 'b'")
    23892389
    raise ValueError(msg)
    23902390
    self.input_dims = a.input_dims
    23912391
    self.output_dims = b.output_dims
    @@ -2644,8 +2644,8 @@ def __init__(self, path, transform):
    26442644
    :class:`~matplotlib.path.Path` and :class:`Transform`.
    26452645
    """
    26462646
    if not isinstance(transform, Transform):
    2647-
    msg = "'transform' must be an instance of"
    2648-
    msg += " 'matplotlib.transform.Transform'"
    2647+
    msg = ("'transform' must be an instance of"
    2648+
    " 'matplotlib.transform.Transform'")
    26492649
    raise ValueError(msg)
    26502650
    TransformNode.__init__(self)
    26512651

    lib/matplotlib/tri/tripcolor.py

    Lines changed: 1 addition & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -139,8 +139,7 @@ def tripcolor(ax, *args, **kwargs):
    139139
    collection.set_array(C)
    140140
    if norm is not None:
    141141
    if not isinstance(norm, Normalize):
    142-
    msg = "'norm' must be an instance of"
    143-
    msg += " 'Normalize'"
    142+
    msg = "'norm' must be an instance of 'Normalize'"
    144143
    raise ValueError(msg)
    145144
    collection.set_cmap(cmap)
    146145
    collection.set_norm(norm)

    lib/matplotlib/widgets.py

    Lines changed: 4 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1307,7 +1307,8 @@ def __init__(self, ax, onselect, direction, minspan=None, useblit=False,
    13071307
    rectprops = dict(facecolor='red', alpha=0.5)
    13081308

    13091309
    if direction not in ['horizontal', 'vertical']:
    1310-
    raise ValueError("direction must be in ['horizontal', 'vertical']")
    1310+
    msg = "direction must be in [ 'horizontal' | 'vertical' ]"
    1311+
    raise ValueError(msg)
    13111312
    self.direction = direction
    13121313

    13131314
    self.rect = None
    @@ -1560,7 +1561,8 @@ def __init__(self, ax, onselect, drawtype='box',
    15601561
    self.minspany = minspan 6408 y
    15611562

    15621563
    if spancoords not in ('data', 'pixels'):
    1563-
    raise ValueError("'spancoords' must be one of ['data', 'pixels']")
    1564+
    msg = "'spancoords' must be one of [ 'data' | 'pixels' ]"
    1565+
    raise ValueError(msg)
    15641566

    15651567
    self.spancoords = spancoords
    15661568
    self.drawtype = drawtype

    0 commit comments

    Comments
     (0)
    0