Skip to content

Commit 614907b

Browse files
committed
pep8 linting (whitespace before/after)
E201 whitespace after '(' E202 whitespace before ')' E203 whitespace before ':' E225 missing whitespace around operator E226 missing whitespace around arithmetic operator E227 missing whitespace around bitwise or shift operator E228 missing whitespace around modulo operator E231 missing whitespace after ',' E241 multiple spaces after ',' E251 unexpected spaces around keyword / parameter equals
1 parent be34ec2 commit 614907b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+410
-410
lines changed

‎git/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ def _init_externals():
4949

5050
#} END imports
5151

52-
__all__ = [ name for name, obj in locals().items()
53-
if not (name.startswith('_') or inspect.ismodule(obj)) ]
52+
__all__ = [name for name, obj in locals().items()
53+
if not (name.startswith('_') or inspect.ismodule(obj))]

‎git/cmd.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
execute_kwargs = ('istream', 'with_keep_cwd', 'with_extended_output',
2121
'with_exceptions', 'as_process',
22-
'output_stream' )
22+
'output_stream')
2323

2424
__all__ = ('Git', )
2525

@@ -49,7 +49,7 @@ class Git(LazyMixin):
4949

5050
# CONFIGURATION
5151
# The size in bytes read from stdout when copying git's output to another stream
52-
max_chunk_size = 1024*64
52+
max_chunk_size = 1024 * 64
5353

5454
git_exec_name = "git" # default that should work on linux and windows
5555
git_exec_name_win = "git.cmd" # alternate command name, windows only
@@ -71,7 +71,7 @@ class AutoInterrupt(object):
7171
and possibly raise."""
7272
__slots__ = ("proc", "args")
7373

74-
def __init__(self, proc, args ):
74+
def __init__(self, proc, args):
7575
self.proc = proc
7676
self.args = args
7777

@@ -423,15 +423,15 @@ def transform_kwargs(self, split_single_char_options=False, **kwargs):
423423

424424
@classmethod
425425
def __unpack_args(cls, arg_list):
426-
if not isinstance(arg_list, (list,tuple)):
426+
if not isinstance(arg_list, (list, tuple)):
427427
if isinstance(arg_list, unicode):
428428
return [arg_list.encode('utf-8')]
429-
return [ str(arg_list) ]
429+
return [str(arg_list)]
430430

431431
outlist = list()
432432
for arg in arg_list:
433433
if isinstance(arg_list, (list, tuple)):
434-
outlist.extend(cls.__unpack_args( arg ))
434+
outlist.extend(cls.__unpack_args(arg))
435435
elif isinstance(arg_list, unicode):
436436
outlist.append(arg_list.encode('utf-8'))
437437
# END recursion
@@ -563,16 +563,16 @@ def __prepare_ref(self, ref):
563563
return refstr
564564
return refstr + "\n"
565565

566-
def __get_persistent_cmd(self, attr_name, cmd_name, *args,**kwargs):
566+
def __get_persistent_cmd(self, attr_name, cmd_name, *args, **kwargs):
567567
cur_val = getattr(self, attr_name)
568568
if cur_val is not None:
569569
return cur_val
570570

571-
options = { "istream" : PIPE, "as_process" : True }
572-
options.update( kwargs )
571+
options = {"istream": PIPE, "as_process": True}
572+
options.update(kwargs)
573573

574-
cmd = self._call_process( cmd_name, *args, **options )
575-
setattr(self, attr_name, cmd )
574+
cmd = self._call_process(cmd_name, *args, **options)
575+
setattr(self, attr_name, cmd)
576576
return cmd
577577

578578
def __get_object_header(self, cmd, ref):

‎git/config.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -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

‎git/db.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from gitdb.db import LooseObjectDB
1818

1919

20-
__all__ = ('GitCmdObjectDB', 'GitDB' )
20+
__all__ = ('GitCmdObjectDB', 'GitDB')
2121

2222
#class GitCmdObjectDB(CompoundDB, ObjectDBW):
2323

‎git/diff.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def diff(self, other=Index, paths=None, create_patch=False, **kwargs):
6969
On a bare repository, 'other' needs to be provided as Index or as
7070
as Tree/Commit, or a git command error will occour"""
7171
args = list()
72-
args.append( "--abbrev=40" ) # we need full shas
73-
args.append( "--full-index" ) # get full index paths, not only filenames
72+
args.append("--abbrev=40") # we need full shas
73+
args.append("--full-index") # get full index paths, not only filenames
7474

7575
if create_patch:
7676
args.append("-p")
@@ -82,15 +82,15 @@ def diff(self, other=Index, paths=None, create_patch=False, **kwargs):
8282
# fixes https://github.com/gitpython-developers/GitPython/issues/172
8383
args.append('--no-color')
8484

85-
if paths is not None and not isinstance(paths, (tuple,list)):
86-
paths = [ paths ]
85+
if paths is not None and not isinstance(paths, (tuple, list)):
86+
paths = [paths]
8787

8888
if other is not None and other is not self.Index:
8989
args.insert(0, other)
9090
if other is self.Index:
9191
args.insert(0, "--cached")
9292

93-
args.insert(0,self)
93+
args.insert(0, self)
9494

9595
# paths is list here or None
9696
if paths:
@@ -136,7 +136,7 @@ def iter_change_type(self, change_type):
136136
* 'R' for renamed paths
137137
* 'M' for paths with modified data"""
138138
if change_type not in self.change_type:
139-
raise ValueError( "Invalid change type: %s" % change_type )
139+
raise ValueError("Invalid change type: %s" % change_type)
140140

141141
for diff in self:
142142
if change_type == "A" and diff.new_file:
@@ -195,8 +195,8 @@ class Diff(object):
195195
\.\.(?P<b_blob_id>[0-9A-Fa-f]+)[ ]?(?P<b_mode>.+)?(?:\n|$))?
196196
""", re.VERBOSE | re.MULTILINE)
197197
# can be used for comparisons
198-
NULL_HEX_SHA = "0"*40
199-
NULL_BIN_SHA = "\0"*20
198+
NULL_HEX_SHA = "0" * 40
199+
NULL_BIN_SHA = "\0" * 20
200200

201201
__slots__ = ("a_blob", "b_blob", "a_mode", "b_mode", "new_file", "deleted_file",
202202
"rename_from", "rename_to", "diff")
@@ -239,10 +239,10 @@ def __eq__(self, other):
239239
return True
240240

241241
def __ne__(self, other):
242-
return not ( self == other )
242+
return not (self == other)
243243

244244
def __hash__(self):
245-
return hash(tuple(getattr(self,n) for n in self.__slots__))
245+
return hash(tuple(getattr(self, n) for n in self.__slots__))
246246

247247
def __str__(self):
248248
h = "%s"
@@ -254,7 +254,7 @@ def __str__(self):
254254
msg = ''
255255
l = None # temp line
256256
ll = 0 # line length
257-
for b,n in zip((self.a_blob, self.b_blob), ('lhs', 'rhs')):
257+
for b, n in zip((self.a_blob, self.b_blob), ('lhs', 'rhs')):
258258
if b:
259259
l = "\n%s: %o | %s" % (n, b.mode, b.hexsha)
260260
else:
@@ -265,7 +265,7 @@ def __str__(self):
265265
# END for each blob
266266

267267
# add headline
268-
h += '\n' + '='*ll
268+
h += '\n' + '=' * ll
269269

270270
if self.deleted_file:
271271
msg += '\nfile deleted in rhs'

‎git/exc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __str__(self):
3636
return ret
3737

3838

39-
class CheckoutError( Exception ):
39+
class CheckoutError(Exception):
4040

4141
"""Thrown if a file could not be checked out from the index as it contained
4242
changes.

0 commit comments

Comments
 (0)