Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit723f889

Browse files
NelleVQuLogic
authored andcommitted
Merge pull request#7288 from mherkazandjian/style_typos_fixes
Style typos fixes
1 parent135576e commit723f889

File tree

1 file changed

+45
-49
lines changed

1 file changed

+45
-49
lines changed

‎lib/matplotlib/cbook.py

Lines 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
classtostr(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
classtodatetime(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
classtodate(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
classtofloat(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
classtoint(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
ifself.instisnotNoneandself.inst()isNone:
406406
raiseReferenceError
407407
elifself.instisnotNone:
@@ -417,10 +417,10 @@ def __call__(self, *args, **kwargs):
417417
returnmtd(*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
ifself.instisNone:
426426
returnself.func==other.funcandother.instisNone
@@ -430,9 +430,9 @@ def __eq__(self, other):
430430
returnFalse
431431

432432
def__ne__(self,other):
433-
'''
433+
"""
434434
Inverse of __eq__.
435-
'''
435+
"""
436436
returnnotself.__eq__(other)
437437

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

636636

637637
defstrip_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
forrinremove:
@@ -667,12 +667,12 @@ def __repr__(self):
667667

668668

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

673673

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

682682

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

699699

700700
defis_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
ifnotiterable(obj):
705703
returnFalse
706704
ifis_string_like(obj)andnotisinstance(obj,np.ndarray):
@@ -716,9 +714,7 @@ def is_sequence_of_strings(obj):
716714

717715

718716
defis_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
exceptTypeError:
@@ -727,7 +723,7 @@ def is_hashable(obj):
727723

728724

729725
defis_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
returnhasattr(obj,'write')andsix.callable(obj.write)
732728

733729

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

746742

747743
defis_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
returnnotis_string_like(obj)andnotiterable(obj)
750746

751747

752748
defis_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
defdict_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
forkeyinkeys:
10461042
try:
10471043
deld[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)inzip(seq,xrange(len(seq))):
1097-
sLen+=len(word)+1# +1 to account for the len(' ')
1098-
ifsLen>=N:
1093+
s_len+=len(word)+1# +1 to account for the len(' ')
1094+
ifs_len>=N:
10991095
returnind
11001096
returnlen(seq)
11011097

11021098

11031099
defwrap(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
defpieces(seq,num=2):
1218-
"Break up the *seq* into *num* tuples"
1214+
"""Break up the *seq* into *num* tuples"""
12191215
start=0
12201216
while1:
12211217
item=seq[start:start+num]
@@ -1291,7 +1287,7 @@ def allpairs(x):
12911287
classmaxdict(dict):
12921288
"""
12931289
A dictionary with a maximum size; this doesn't override all the
1294-
relevant methods tocontrain size, just setitem, so use with
1290+
relevant methods toconstrain 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
ifnotlen(self._elements):
13251321
returnself._default
13261322
else:
@@ -1333,14 +1329,14 @@ def __getitem__(self, ind):
13331329
returnself._elements.__getitem__(ind)
13341330

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

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

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

13681364
defclear(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
defreverse_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
returndict([(v,k)fork,vinsix.iteritems(d)])
14291425

14301426

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

14381434

14391435
defreport_memory(i=0):# argument may go away
1440-
'return the memory consumed by process'
1436+
"""return the memory consumed by process"""
14411437
frommatplotlib.compat.subprocessimportPopen,PIPE
14421438
pid=os.getpid()
14431439
ifsys.platform=='sunos5':
@@ -1485,7 +1481,7 @@ def report_memory(i=0): # argument may go away
14851481

14861482

14871483
defsafezip(*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
fori,arginenumerate(args[1:]):
14911487
iflen(arg)!=Nx:
@@ -1494,7 +1490,7 @@ def safezip(*args):
14941490

14951491

14961492
defissubclass_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
returnissubclass(x,klass)
@@ -2184,7 +2180,7 @@ def __call__(self, key):
21842180
# iteration
21852181
iters= [myiter(it)foritiniterables]
21862182
minvals=minkey=True
2187-
while1:
2183+
whileTrue:
21882184
minvals= ([_ffor_fin [it.keyforitiniters]if_f])
21892185
ifminvals:
21902186
minkey=min(minvals)
@@ -2262,7 +2258,7 @@ def _reshape_2D(X):
22622258

22632259

22642260
defviolin_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)foryinargs)
23832379
x=np.asanyarray(x)
23842380
ifx.ndim!=1:
2385-
raiseValueError("x must be 1dimenional")
2381+
raiseValueError("x must be 1dimensional")
23862382
iflen(args)==0:
23872383
raiseValueError("At least one Y value must be passed")
23882384

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp