@@ -29,7 +29,7 @@ def __new__(metacls, name, bases, clsdict):
2929 if kmm in clsdict :
3030 mutating_methods = clsdict [kmm ]
3131 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 ("_" ))
3333 for name , method in methods :
3434 if name in clsdict :
3535 continue
@@ -89,7 +89,7 @@ def __init__(self, config, section):
8989 def __getattr__ (self , attr ):
9090 if attr in self ._valid_attrs_ :
9191 return lambda * args , ** kwargs : self ._call_config (attr , * args , ** kwargs )
92- return super (SectionConstraint ,self ).__getattribute__ (attr )
92+ return super (SectionConstraint , self ).__getattribute__ (attr )
9393
9494 def _call_config (self , method , * args , ** kwargs ):
9595 """Call the configuration at the given method which must take a section name
@@ -140,7 +140,7 @@ class GitConfigParser(cp.RawConfigParser, object):
140140
141141 # list of RawConfigParser methods able to change the instance
142142 _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' )
144144
145145 def __init__ (self , file_or_files , read_only = True ):
146146 """Initialize a configuration reader to read the given file_or_files and to
@@ -187,7 +187,7 @@ def __del__(self):
187187 try :
188188 try :
189189 self .write ()
190- except IOError ,e :
190+ except IOError , e :
191191 print "Exception during destruction of GitConfigParser: %s" % str (e )
192192 finally :
193193 self ._lock ._release_lock ()
@@ -246,7 +246,7 @@ def _read(self, fp, fpname):
246246 optname , vi , optval = mo .group ('option' , 'vi' , 'value' )
247247 if vi in ('=' , ':' ) and ';' in optval :
248248 pos = optval .find (';' )
249- if pos != - 1 and optval [pos - 1 ].isspace ():
249+ if pos != - 1 and optval [pos - 1 ].isspace ():
250250 optval = optval [:pos ]
251251 optval = optval .strip ()
252252 if optval == '""' :
@@ -276,7 +276,7 @@ def read(self):
276276
277277 files_to_read = self ._file_or_files
278278 if not isinstance (files_to_read , (tuple , list )):
279- files_to_read = [ files_to_read ]
279+ files_to_read = [files_to_read ]
280280
281281 for file_object in files_to_read :
282282 fp = file_object
@@ -286,7 +286,7 @@ def read(self):
286286 try :
287287 fp = open (file_object )
288288 close_fp = True
289- except IOError ,e :
289+ except IOError , e :
290290 continue
291291 # END fp handling
292292
@@ -312,7 +312,7 @@ def write_section(name, section_dict):
312312
313313 if self ._defaults :
314314 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 ())
316316
317317 @needs_values
318318 def write (self ):
@@ -368,7 +368,7 @@ def read_only(self):
368368 """:return: True if this instance may change the configuration file"""
369369 return self ._read_only
370370
371- def get_value (self , section , option , default = None ):
371+ def get_value (self , section , option , default = None ):
372372 """
373373 :param default:
374374 If not None, the given default value will be returned in case
@@ -384,17 +384,17 @@ def get_value(self, section, option, default = None):
384384 return default
385385 raise
386386
387- types = ( long , float )
387+ types = (long , float )
388388 for numtype in types :
389389 try :
390- val = numtype ( valuestr )
390+ val = numtype (valuestr )
391391
392392 # truncated value ?
393- if val != float ( valuestr ):
393+ if val != float (valuestr ):
394394 continue
395395
396396 return val
397- except (ValueError ,TypeError ):
397+ except (ValueError , TypeError ):
398398 continue
399399 # END for each numeric type
400400
@@ -405,8 +405,8 @@ def get_value(self, section, option, default = None):
405405 if vl == 'true' :
406406 return True
407407
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 )
410410
411411 return valuestr
412412
0 commit comments