@@ -29,7 +29,7 @@ def __new__(metacls, name, bases, clsdict):
29
29
if kmm in clsdict :
30
30
mutating_methods = clsdict [kmm ]
31
31
for base in bases :
32
- methods = ( t for t in inspect .getmembers (base , inspect .ismethod ) if not t [0 ].startswith ("_" ) )
32
+ methods = (t for t in inspect .getmembers (base , inspect .ismethod ) if not t [0 ].startswith ("_" ))
33
33
for name , method in methods :
34
34
if name in clsdict :
35
35
continue
@@ -89,7 +89,7 @@ def __init__(self, config, section):
89
89
def __getattr__ (self , attr ):
90
90
if attr in self ._valid_attrs_ :
91
91
return lambda * args , ** kwargs : self ._call_config (attr , * args , ** kwargs )
92
- return super (SectionConstraint ,self ).__getattribute__ (attr )
92
+ return super (SectionConstraint , self ).__getattribute__ (attr )
93
93
94
94
def _call_config (self , method , * args , ** kwargs ):
95
95
"""Call the configuration at the given method which must take a section name
@@ -140,7 +140,7 @@ class GitConfigParser(cp.RawConfigParser, object):
140
140
141
141
# list of RawConfigParser methods able to change the instance
142
142
_mutating_methods_ = ("add_section" , "remove_section" , "remove_option" , "set" )
143
- __slots__ = ("_sections" , "_defaults" , "_file_or_files" , "_read_only" ,"_is_initialized" , '_lock' )
143
+ __slots__ = ("_sections" , "_defaults" , "_file_or_files" , "_read_only" , "_is_initialized" , '_lock' )
144
144
145
145
def __init__ (self , file_or_files , read_only = True ):
146
146
"""Initialize a configuration reader to read the given file_or_files and to
@@ -187,7 +187,7 @@ def __del__(self):
187
187
try :
188
188
try :
189
189
self .write ()
190
- except IOError ,e :
190
+ except IOError , e :
191
191
print "Exception during destruction of GitConfigParser: %s" % str (e )
192
192
finally :
193
193
self ._lock ._release_lock ()
@@ -246,7 +246,7 @@ def _read(self, fp, fpname):
246
246
optname , vi , optval = mo .group ('option' , 'vi' , 'value' )
247
247
if vi in ('=' , ':' ) and ';' in optval :
248
248
pos = optval .find (';' )
249
- if pos != - 1 and optval [pos - 1 ].isspace ():
249
+ if pos != - 1 and optval [pos - 1 ].isspace ():
250
250
optval = optval [:pos ]
251
251
optval = optval .strip ()
252
252
if optval == '""' :
@@ -276,7 +276,7 @@ def read(self):
276
276
277
277
files_to_read = self ._file_or_files
278
278
if not isinstance (files_to_read , (tuple , list )):
279
- files_to_read = [ files_to_read ]
279
+ files_to_read = [files_to_read ]
280
280
281
281
for file_object in files_to_read :
282
282
fp = file_object
@@ -286,7 +286,7 @@ def read(self):
286
286
try :
287
287
fp = open (file_object )
288
288
close_fp = True
289
- except IOError ,e :
289
+ except IOError , e :
290
290
continue
291
291
# END fp handling
292
292
@@ -312,7 +312,7 @@ def write_section(name, section_dict):
312
312
313
313
if self ._defaults :
314
314
write_section (cp .DEFAULTSECT , self ._defaults )
315
- map (lambda t : write_section (t [0 ],t [1 ]), self ._sections .items ())
315
+ map (lambda t : write_section (t [0 ], t [1 ]), self ._sections .items ())
316
316
317
317
@needs_values
318
318
def write (self ):
@@ -368,7 +368,7 @@ def read_only(self):
368
368
""":return: True if this instance may change the configuration file"""
369
369
return self ._read_only
370
370
371
- def get_value (self , section , option , default = None ):
371
+ def get_value (self , section , option , default = None ):
372
372
"""
373
373
:param default:
374
374
If not None, the given default value will be returned in case
@@ -384,17 +384,17 @@ def get_value(self, section, option, default = None):
384
384
return default
385
385
raise
386
386
387
- types = ( long , float )
387
+ types = (long , float )
388
388
for numtype in types :
389
389
try :
390
- val = numtype ( valuestr )
390
+ val = numtype (valuestr )
391
391
392
392
# truncated value ?
393
- if val != float ( valuestr ):
393
+ if val != float (valuestr ):
394
394
continue
395
395
396
396
return val
397
- except (ValueError ,TypeError ):
397
+ except (ValueError , TypeError ):
398
398
continue
399
399
# END for each numeric type
400
400
@@ -405,8 +405,8 @@ def get_value(self, section, option, default = None):
405
405
if vl == 'true' :
406
406
return True
407
407
408
- if not isinstance ( valuestr , basestring ):
409
- raise TypeError ( "Invalid value type: only int, long, float and str are allowed" , valuestr )
408
+ if not isinstance (valuestr , basestring ):
409
+ raise TypeError ("Invalid value type: only int, long, float and str are allowed" , valuestr )
410
410
411
411
return valuestr
412
412
0 commit comments