Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 723f889

Browse filesBrowse files
NelleVQuLogic
authored andcommitted
Merge pull request matplotlib#7288 from mherkazandjian/style_typos_fixes
Style typos fixes
1 parent 135576e commit 723f889
Copy full SHA for 723f889

File tree

Expand file treeCollapse file tree

1 file changed

+45
-49
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+45
-49
lines changed

‎lib/matplotlib/cbook.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook.py
+45-49Lines changed: 45 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,13 @@ def is_missing(self, s):
278278

279279

280280
class tostr(converter):
281-
'convert to string or None'
281+
"""convert to string or None"""
282282
def __init__(self, missing='Null', missingval=''):
283283
converter.__init__(self, missing=missing, missingval=missingval)
284284

285285

286286
class todatetime(converter):
287-
'convert to a datetime or None'
287+
"""convert to a datetime or None"""
288288
def __init__(self, fmt='%Y-%m-%d', missing='Null', missingval=None):
289289
'use a :func:`time.strptime` format string for conversion'
290290
converter.__init__(self, missing, missingval)
@@ -298,9 +298,9 @@ def __call__(self, s):
298298

299299

300300
class todate(converter):
301-
'convert to a date or None'
301+
"""convert to a date or None"""
302302
def __init__(self, fmt='%Y-%m-%d', missing='Null', missingval=None):
303-
'use a :func:`time.strptime` format string for conversion'
303+
"""use a :func:`time.strptime` format string for conversion"""
304304
converter.__init__(self, missing, missingval)
305305
self.fmt = fmt
306306

@@ -312,7 +312,7 @@ def __call__(self, s):
312312

313313

314314
class tofloat(converter):
315-
'convert to a float or None'
315+
"""convert to a float or None"""
316316
def __init__(self, missing='Null', missingval=None):
317317
converter.__init__(self, missing)
318318
self.missingval = missingval
@@ -324,7 +324,7 @@ def __call__(self, s):
324324

325325

326326
class toint(converter):
327-
'convert to an int or None'
327+
"""convert to an int or None"""
328328
def __init__(self, missing='Null', missingval=None):
329329
converter.__init__(self, missing)
330330

@@ -335,7 +335,7 @@ def __call__(self, s):
335335

336336

337337
class _BoundMethodProxy(object):
338-
'''
338+
"""
339339
Our own proxy object which enables weak references to bound and unbound
340340
methods and arbitrary callables. Pulls information about the function,
341341
class, and instance out of a bound method. Stores a weak reference to the
@@ -346,7 +346,7 @@ class _BoundMethodProxy(object):
346346
@license: The BSD License
347347
348348
Minor bugfixes by Michael Droettboom
349-
'''
349+
"""
350350
def __init__(self, cb):
351351
self._hash = hash(cb)
352352
self._destroy_callbacks = []
@@ -395,13 +395,13 @@ def __setstate__(self, statedict):
395395
self.inst = ref(inst)
396396

397397
def __call__(self, *args, **kwargs):
398-
'''
398+
"""
399399
Proxy for a call to the weak referenced object. Take
400400
arbitrary params to pass to the callable.
401401
402402
Raises `ReferenceError`: When the weak reference refers to
403403
a dead object
404-
'''
404+
"""
405405
if self.inst is not None and self.inst() is None:
406406
raise ReferenceError
407407
elif self.inst is not None:
@@ -417,10 +417,10 @@ def __call__(self, *args, **kwargs):
417417
return mtd(*args, **kwargs)
418418

419419
def __eq__(self, other):
420-
'''
420+
"""
421421
Compare the held function and instance with that held by
422422
another proxy.
423-
'''
423+
"""
424424
try:
425425
if self.inst is None:
426426
return self.func == other.func and other.inst is None
@@ -430,9 +430,9 @@ def __eq__(self, other):
430430
return False
431431

432432
def __ne__(self, other):
433-
'''
433+
"""
434434
Inverse of __eq__.
435-
'''
435+
"""
436436
return not self.__eq__(other)
437437

438438
def __hash__(self):
@@ -635,7 +635,7 @@ def local_over_kwdict(local_var, kwargs, *keys):
635635

636636

637637
def strip_math(s):
638-
'remove latex formatting from mathtext'
638+
"""remove latex formatting from mathtext"""
639639
remove = (r'\mathdefault', r'\rm', r'\cal', r'\tt', r'\it', '\\', '{', '}')
640640
s = s[1:-1]
641641
for r in remove:
@@ -667,12 +667,12 @@ def __repr__(self):
667667

668668

669669
def unique(x):
670-
'Return a list of unique elements of *x*'
670+
"""Return a list of unique elements of *x*"""
671671
return list(six.iterkeys(dict([(val, 1) for val in x])))
672672

673673

674674
def iterable(obj):
675-
'return true if *obj* is iterable'
675+
"""return true if *obj* is iterable"""
676676
try:
677677
iter(obj)
678678
except TypeError:
@@ -681,7 +681,7 @@ def iterable(obj):
681681

682682

683683
def is_string_like(obj):
684-
'Return True if *obj* looks like a string'
684+
"""Return True if *obj* looks like a string"""
685685
if isinstance(obj, six.string_types):
686686
return True
687687
# numpy strings are subclass of str, ma strings are not
@@ -698,9 +698,7 @@ def is_string_like(obj):
698698

699699

700700
def is_sequence_of_strings(obj):
701-
"""
702-
Returns true if *obj* is iterable and contains strings
703-
"""
701+
"""Returns true if *obj* is iterable and contains strings"""
704702
if not iterable(obj):
705703
return False
706704
if is_string_like(obj) and not isinstance(obj, np.ndarray):
@@ -716,9 +714,7 @@ def is_sequence_of_strings(obj):
716714

717715

718716
def is_hashable(obj):
719-
"""
720-
Returns true if *obj* can be hashed
721-
"""
717+
"""Returns true if *obj* can be hashed"""
722718
try:
723719
hash(obj)
724720
except TypeError:
@@ -727,7 +723,7 @@ def is_hashable(obj):
727723

728724

729725
def is_writable_file_like(obj):
730-
'return true if *obj* looks like a file object with a *write* method'
726+
"""return true if *obj* looks like a file object with a *write* method"""
731727
return hasattr(obj, 'write') and six.callable(obj.write)
732728

733729

@@ -745,12 +741,12 @@ def file_requires_unicode(x):
745741

746742

747743
def is_scalar(obj):
748-
'return true if *obj* is not string like and is not iterable'
744+
"""return true if *obj* is not string like and is not iterable"""
749745
return not is_string_like(obj) and not iterable(obj)
750746

751747

752748
def is_numlike(obj):
753-
'return true if *obj* looks like a number'
749+
"""return true if *obj* looks like a number"""
754750
try:
755751
obj + 1
756752
except:
@@ -1041,7 +1037,7 @@ def __call__(self, path):
10411037

10421038

10431039
def dict_delall(d, keys):
1044-
'delete all of the *keys* from the :class:`dict` *d*'
1040+
"""delete all of the *keys* from the :class:`dict` *d*"""
10451041
for key in keys:
10461042
try:
10471043
del d[key]
@@ -1091,17 +1087,17 @@ def get_split_ind(seq, N):
10911087
.
10921088
"""
10931089

1094-
sLen = 0
1090+
s_len = 0
10951091
# todo: use Alex's xrange pattern from the cbook for efficiency
10961092
for (word, ind) in zip(seq, xrange(len(seq))):
1097-
sLen += len(word) + 1 # +1 to account for the len(' ')
1098-
if sLen >= N:
1093+
s_len += len(word) + 1 # +1 to account for the len(' ')
1094+
if s_len >= N:
10991095
return ind
11001096
return len(seq)
11011097

11021098

11031099
def wrap(prefix, text, cols):
1104-
'wrap *text* with *prefix* at length *cols*'
1100+
"""wrap *text* with *prefix* at length *cols*"""
11051101
pad = ' ' * len(prefix.expandtabs())
11061102
available = cols - len(pad)
11071103

@@ -1215,7 +1211,7 @@ def get_recursive_filelist(args):
12151211

12161212

12171213
def pieces(seq, num=2):
1218-
"Break up the *seq* into *num* tuples"
1214+
"""Break up the *seq* into *num* tuples"""
12191215
start = 0
12201216
while 1:
12211217
item = seq[start:start + num]
@@ -1291,7 +1287,7 @@ def allpairs(x):
12911287
class maxdict(dict):
12921288
"""
12931289
A dictionary with a maximum size; this doesn't override all the
1294-
relevant methods to contrain size, just setitem, so use with
1290+
relevant methods to constrain the size, just setitem, so use with
12951291
caution
12961292
"""
12971293
def __init__(self, maxsize):
@@ -1320,7 +1316,7 @@ def __init__(self, default=None):
13201316
self._default = default
13211317

13221318
def __call__(self):
1323-
'return the current element, or None'
1319+
"""return the current element, or None"""
13241320
if not len(self._elements):
13251321
return self._default
13261322
else:
@@ -1333,14 +1329,14 @@ def __getitem__(self, ind):
13331329
return self._elements.__getitem__(ind)
13341330

13351331
def forward(self):
1336-
'move the position forward and return the current element'
1337-
N = len(self._elements)
1338-
if self._pos < N - 1:
1332+
"""move the position forward and return the current element"""
1333+
n = len(self._elements)
1334+
if self._pos < n - 1:
13391335
self._pos += 1
13401336
return self()
13411337

13421338
def back(self):
1343-
'move the position back and return the current element'
1339+
"""move the position back and return the current element"""
13441340
if self._pos > 0:
13451341
self._pos -= 1
13461342
return self()
@@ -1356,7 +1352,7 @@ def push(self, o):
13561352
return self()
13571353

13581354
def home(self):
1359-
'push the first element onto the top of the stack'
1355+
"""push the first element onto the top of the stack"""
13601356
if not len(self._elements):
13611357
return
13621358
self.push(self._elements[0])
@@ -1366,7 +1362,7 @@ def empty(self):
13661362
return len(self._elements) == 0
13671363

13681364
def clear(self):
1369-
'empty the stack'
1365+
"""empty the stack"""
13701366
self._pos = -1
13711367
self._elements = []
13721368

@@ -1424,7 +1420,7 @@ def finddir(o, match, case=False):
14241420

14251421

14261422
def reverse_dict(d):
1427-
'reverse the dictionary -- may lose data if values are not unique!'
1423+
"""reverse the dictionary -- may lose data if values are not unique!"""
14281424
return dict([(v, k) for k, v in six.iteritems(d)])
14291425

14301426

@@ -1437,7 +1433,7 @@ def restrict_dict(d, keys):
14371433

14381434

14391435
def report_memory(i=0): # argument may go away
1440-
'return the memory consumed by process'
1436+
"""return the memory consumed by process"""
14411437
from matplotlib.compat.subprocess import Popen, PIPE
14421438
pid = os.getpid()
14431439
if sys.platform == 'sunos5':
@@ -1485,7 +1481,7 @@ def report_memory(i=0): # argument may go away
14851481

14861482

14871483
def safezip(*args):
1488-
'make sure *args* are equal len before zipping'
1484+
"""make sure *args* are equal len before zipping"""
14891485
Nx = len(args[0])
14901486
for i, arg in enumerate(args[1:]):
14911487
if len(arg) != Nx:
@@ -1494,7 +1490,7 @@ def safezip(*args):
14941490

14951491

14961492
def issubclass_safe(x, klass):
1497-
'return issubclass(x, klass) and return False on a TypeError'
1493+
"""return issubclass(x, klass) and return False on a TypeError"""
14981494

14991495
try:
15001496
return issubclass(x, klass)
@@ -2184,7 +2180,7 @@ def __call__(self, key):
21842180
# iteration
21852181
iters = [myiter(it) for it in iterables]
21862182
minvals = minkey = True
2187-
while 1:
2183+
while True:
21882184
minvals = ([_f for _f in [it.key for it in iters] if _f])
21892185
if minvals:
21902186
minkey = min(minvals)
@@ -2262,7 +2258,7 @@ def _reshape_2D(X):
22622258

22632259

22642260
def violin_stats(X, method, points=100):
2265-
'''
2261+
"""
22662262
Returns a list of dictionaries of data which can be used to draw a series
22672263
of violin plots. See the `Returns` section below to view the required keys
22682264
of the dictionary. Users can skip this function and pass a user-defined set
@@ -2299,7 +2295,7 @@ def violin_stats(X, method, points=100):
22992295
- median: The median value for this column of data.
23002296
- min: The minimum value for this column of data.
23012297
- max: The maximum value for this column of data.
2302-
'''
2298+
"""
23032299

23042300
# List of dictionaries describing each of the violins.
23052301
vpstats = []
@@ -2382,7 +2378,7 @@ def _step_validation(x, *args):
23822378
args = tuple(np.asanyarray(y) for y in args)
23832379
x = np.asanyarray(x)
23842380
if x.ndim != 1:
2385-
raise ValueError("x must be 1 dimenional")
2381+
raise ValueError("x must be 1 dimensional")
23862382
if len(args) == 0:
23872383
raise ValueError("At least one Y value must be passed")
23882384

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.