Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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
  • Loading branch information
hashar committed Nov 16, 2014
commit 614907b7445e2ed8584c1c37df7e466e3b56170f
4 changes: 2 additions & 2 deletions git/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ def _init_externals():

#} END imports

__all__ = [ name for name, obj in locals().items()
if not (name.startswith('_') or inspect.ismodule(obj)) ]
__all__ = [name for name, obj in locals().items()
if not (name.startswith('_') or inspect.ismodule(obj))]
22 changes: 11 additions & 11 deletions git/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

execute_kwargs = ('istream', 'with_keep_cwd', 'with_extended_output',
'with_exceptions', 'as_process',
'output_stream' )
'output_stream')

__all__ = ('Git', )

Expand Down Expand Up @@ -49,7 +49,7 @@ class Git(LazyMixin):

# CONFIGURATION
# The size in bytes read from stdout when copying git's output to another stream
max_chunk_size = 1024*64
max_chunk_size = 1024 * 64

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

def __init__(self, proc, args ):
def __init__(self, proc, args):
self.proc = proc
self.args = args

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

@classmethod
def __unpack_args(cls, arg_list):
if not isinstance(arg_list, (list,tuple)):
if not isinstance(arg_list, (list, tuple)):
if isinstance(arg_list, unicode):
return [arg_list.encode('utf-8')]
return [ str(arg_list) ]
return [str(arg_list)]

outlist = list()
for arg in arg_list:
if isinstance(arg_list, (list, tuple)):
outlist.extend(cls.__unpack_args( arg ))
outlist.extend(cls.__unpack_args(arg))
elif isinstance(arg_list, unicode):
outlist.append(arg_list.encode('utf-8'))
# END recursion
Expand Down Expand Up @@ -563,16 +563,16 @@ def __prepare_ref(self, ref):
return refstr
return refstr + "\n"

def __get_persistent_cmd(self, attr_name, cmd_name, *args,**kwargs):
def __get_persistent_cmd(self, attr_name, cmd_name, *args, **kwargs):
cur_val = getattr(self, attr_name)
if cur_val is not None:
return cur_val

options = { "istream" : PIPE, "as_process" : True }
options.update( kwargs )
options = {"istream": PIPE, "as_process": True}
options.update(kwargs)

cmd = self._call_process( cmd_name, *args, **options )
setattr(self, attr_name, cmd )
cmd = self._call_process(cmd_name, *args, **options)
setattr(self, attr_name, cmd)
return cmd

def __get_object_header(self, cmd, ref):
Expand Down
30 changes: 15 additions & 15 deletions git/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __new__(metacls, name, bases, clsdict):
if kmm in clsdict:
mutating_methods = clsdict[kmm]
for base in bases:
methods = ( t for t in inspect.getmembers(base, inspect.ismethod) if not t[0].startswith("_") )
methods = (t for t in inspect.getmembers(base, inspect.ismethod) if not t[0].startswith("_"))
for name, method in methods:
if name in clsdict:
continue
Expand Down Expand Up @@ -89,7 +89,7 @@ def __init__(self, config, section):
def __getattr__(self, attr):
if attr in self._valid_attrs_:
return lambda *args, **kwargs: self._call_config(attr, *args, **kwargs)
return super(SectionConstraint,self).__getattribute__(attr)
return super(SectionConstraint, self).__getattribute__(attr)

def _call_config(self, method, *args, **kwargs):
"""Call the configuration at the given method which must take a section name
Expand Down Expand Up @@ -140,7 +140,7 @@ class GitConfigParser(cp.RawConfigParser, object):

# list of RawConfigParser methods able to change the instance
_mutating_methods_ = ("add_section", "remove_section", "remove_option", "set")
__slots__ = ("_sections", "_defaults", "_file_or_files", "_read_only","_is_initialized", '_lock')
__slots__ = ("_sections", "_defaults", "_file_or_files", "_read_only", "_is_initialized", '_lock')

def __init__(self, file_or_files, read_only=True):
"""Initialize a configuration reader to read the given file_or_files and to
Expand Down Expand Up @@ -187,7 +187,7 @@ def __del__(self):
try:
try:
self.write()
except IOError,e:
except IOError, e:
print "Exception during destruction of GitConfigParser: %s" % str(e)
finally:
self._lock._release_lock()
Expand Down Expand Up @@ -246,7 +246,7 @@ def _read(self, fp, fpname):
optname, vi, optval = mo.group('option', 'vi', 'value')
if vi in ('=', ':') and ';' in optval:
pos = optval.find(';')
if pos != -1 and optval[pos-1].isspace():
if pos != -1 and optval[pos - 1].isspace():
optval = optval[:pos]
optval = optval.strip()
if optval == '""':
Expand Down Expand Up @@ -276,7 +276,7 @@ def read(self):

files_to_read = self._file_or_files
if not isinstance(files_to_read, (tuple, list)):
files_to_read = [ files_to_read ]
files_to_read = [files_to_read]

for file_object in files_to_read:
fp = file_object
Expand All @@ -286,7 +286,7 @@ def read(self):
try:
fp = open(file_object)
close_fp = True
except IOError,e:
except IOError, e:
continue
# END fp handling

Expand All @@ -312,7 +312,7 @@ def write_section(name, section_dict):

if self._defaults:
write_section(cp.DEFAULTSECT, self._defaults)
map(lambda t: write_section(t[0],t[1]), self._sections.items())
map(lambda t: write_section(t[0], t[1]), self._sections.items())

@needs_values
def write(self):
Expand Down Expand Up @@ -368,7 +368,7 @@ def read_only(self):
""":return: True if this instance may change the configuration file"""
return self._read_only

def get_value(self, section, option, default = None):
def get_value(self, section, option, default=None):
"""
:param default:
If not None, the given default value will be returned in case
Expand All @@ -384,17 +384,17 @@ def get_value(self, section, option, default = None):
return default
raise

types = ( long, float )
types = (long, float)
for numtype in types:
try:
val = numtype( valuestr )
val = numtype(valuestr)

# truncated value ?
if val != float( valuestr ):
if val != float(valuestr):
continue

return val
except (ValueError,TypeError):
except (ValueError, TypeError):
continue
# END for each numeric type

Expand All @@ -405,8 +405,8 @@ def get_value(self, section, option, default = None):
if vl == 'true':
return True

if not isinstance( valuestr, basestring ):
raise TypeError( "Invalid value type: only int, long, float and str are allowed", valuestr )
if not isinstance(valuestr, basestring):
raise TypeError("Invalid value type: only int, long, float and str are allowed", valuestr)

return valuestr

Expand Down
2 changes: 1 addition & 1 deletion git/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from gitdb.db import LooseObjectDB


__all__ = ('GitCmdObjectDB', 'GitDB' )
__all__ = ('GitCmdObjectDB', 'GitDB')

#class GitCmdObjectDB(CompoundDB, ObjectDBW):

Expand Down
24 changes: 12 additions & 12 deletions git/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def diff(self, other=Index, paths=None, create_patch=False, **kwargs):
On a bare repository, 'other' needs to be provided as Index or as
as Tree/Commit, or a git command error will occour"""
args = list()
args.append( "--abbrev=40" ) # we need full shas
args.append( "--full-index" ) # get full index paths, not only filenames
args.append("--abbrev=40") # we need full shas
args.append("--full-index") # get full index paths, not only filenames

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

if paths is not None and not isinstance(paths, (tuple,list)):
paths = [ paths ]
if paths is not None and not isinstance(paths, (tuple, list)):
paths = [paths]

if other is not None and other is not self.Index:
args.insert(0, other)
if other is self.Index:
args.insert(0, "--cached")

args.insert(0,self)
args.insert(0, self)

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

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

__slots__ = ("a_blob", "b_blob", "a_mode", "b_mode", "new_file", "deleted_file",
"rename_from", "rename_to", "diff")
Expand Down Expand Up @@ -239,10 +239,10 @@ def __eq__(self, other):
return True

def __ne__(self, other):
return not ( self == other )
return not (self == other)

def __hash__(self):
return hash(tuple(getattr(self,n) for n in self.__slots__))
return hash(tuple(getattr(self, n) for n in self.__slots__))

def __str__(self):
h = "%s"
Expand All @@ -254,7 +254,7 @@ def __str__(self):
msg = ''
l = None # temp line
ll = 0 # line length
for b,n in zip((self.a_blob, self.b_blob), ('lhs', 'rhs')):
for b, n in zip((self.a_blob, self.b_blob), ('lhs', 'rhs')):
if b:
l = "\n%s: %o | %s" % (n, b.mode, b.hexsha)
else:
Expand All @@ -265,7 +265,7 @@ def __str__(self):
# END for each blob

# add headline
h += '\n' + '='*ll
h += '\n' + '=' * ll

if self.deleted_file:
msg += '\nfile deleted in rhs'
Expand Down
2 changes: 1 addition & 1 deletion git/exc.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __str__(self):
return ret


class CheckoutError( Exception ):
class CheckoutError(Exception):

"""Thrown if a file could not be checked out from the index as it contained
changes.
Expand Down
Loading