| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent be34ec2 commit 614907b
54 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,5 +49,5 @@ def _init_externals(): | |||
| 49 | 49 | ||
| 50 | 50 | #} END imports | |
| 51 | 51 | ||
| 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))] | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | 20 | execute_kwargs = ('istream', 'with_keep_cwd', 'with_extended_output', | |
| 21 | 21 | 'with_exceptions', 'as_process', | |
| 22 | - 'output_stream' ) | ||
| 22 | + 'output_stream') | ||
| 23 | 23 | ||
| 24 | 24 | __all__ = ('Git', ) | |
| 25 | 25 | ||
@@ -49,7 +49,7 @@ class Git(LazyMixin): | |||
| 49 | 49 | ||
| 50 | 50 | # CONFIGURATION | |
| 51 | 51 | # 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 | ||
| 53 | 53 | ||
| 54 | 54 | git_exec_name = "git" # default that should work on linux and windows | |
| 55 | 55 | git_exec_name_win = "git.cmd" # alternate command name, windows only | |
@@ -71,7 +71,7 @@ class AutoInterrupt(object): | |||
| 71 | 71 | and possibly raise.""" | |
| 72 | 72 | __slots__ = ("proc", "args") | |
| 73 | 73 | ||
| 74 | - def __init__(self, proc, args ): | ||
| 74 | + def __init__(self, proc, args): | ||
| 75 | 75 | self.proc = proc | |
| 76 | 76 | self.args = args | |
| 77 | 77 | ||
@@ -423,15 +423,15 @@ def transform_kwargs(self, split_single_char_options=False, **kwargs): | |||
| 423 | 423 | ||
| 424 | 424 | @classmethod | |
| 425 | 425 | def __unpack_args(cls, arg_list): | |
| 426 | - if not isinstance(arg_list, (list,tuple)): | ||
| 426 | + if not isinstance(arg_list, (list, tuple)): | ||
| 427 | 427 | if isinstance(arg_list, unicode): | |
| 428 | 428 | return [arg_list.encode('utf-8')] | |
| 429 | - return [ str(arg_list) ] | ||
| 429 | + return [str(arg_list)] | ||
| 430 | 430 | ||
| 431 | 431 | outlist = list() | |
| 432 | 432 | for arg in arg_list: | |
| 433 | 433 | if isinstance(arg_list, (list, tuple)): | |
| 434 | - outlist.extend(cls.__unpack_args( arg )) | ||
| 434 | + outlist.extend(cls.__unpack_args(arg)) | ||
| 435 | 435 | elif isinstance(arg_list, unicode): | |
| 436 | 436 | outlist.append(arg_list.encode('utf-8')) | |
| 437 | 437 | # END recursion | |
@@ -563,16 +563,16 @@ def __prepare_ref(self, ref): | |||
| 563 | 563 | return refstr | |
| 564 | 564 | return refstr + "\n" | |
| 565 | 565 | ||
| 566 | - def __get_persistent_cmd(self, attr_name, cmd_name, *args,**kwargs): | ||
| 566 | + def __get_persistent_cmd(self, attr_name, cmd_name, *args, **kwargs): | ||
| 567 | 567 | cur_val = getattr(self, attr_name) | |
| 568 | 568 | if cur_val is not None: | |
| 569 | 569 | return cur_val | |
| 570 | 570 | ||
| 571 | - options = { "istream" : PIPE, "as_process" : True } | ||
| 572 | - options.update( kwargs ) | ||
| 571 | + options = {"istream": PIPE, "as_process": True} | ||
| 572 | + options.update(kwargs) | ||
| 573 | 573 | ||
| 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) | ||
| 576 | 576 | return cmd | |
| 577 | 577 | ||
| 578 | 578 | def __get_object_header(self, cmd, ref): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -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 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,7 @@ | |||
| 17 | 17 | from gitdb.db import LooseObjectDB | |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | - __all__ = ('GitCmdObjectDB', 'GitDB' ) | ||
| 20 | + __all__ = ('GitCmdObjectDB', 'GitDB') | ||
| 21 | 21 | ||
| 22 | 22 | #class GitCmdObjectDB(CompoundDB, ObjectDBW): | |
| 23 | 23 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -69,8 +69,8 @@ def diff(self, other=Index, paths=None, create_patch=False, **kwargs): | |||
| 69 | 69 | On a bare repository, 'other' needs to be provided as Index or as | |
| 70 | 70 | as Tree/Commit, or a git command error will occour""" | |
| 71 | 71 | 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 | ||
| 74 | 74 | ||
| 75 | 75 | if create_patch: | |
| 76 | 76 | args.append("-p") | |
@@ -82,15 +82,15 @@ def diff(self, other=Index, paths=None, create_patch=False, **kwargs): | |||
| 82 | 82 | # fixes https://github.com/gitpython-developers/GitPython/issues/172 | |
| 83 | 83 | args.append('--no-color') | |
| 84 | 84 | ||
| 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] | ||
| 87 | 87 | ||
| 88 | 88 | if other is not None and other is not self.Index: | |
| 89 | 89 | args.insert(0, other) | |
| 90 | 90 | if other is self.Index: | |
| 91 | 91 | args.insert(0, "--cached") | |
| 92 | 92 | ||
| 93 | - args.insert(0,self) | ||
| 93 | + args.insert(0, self) | ||
| 94 | 94 | ||
| 95 | 95 | # paths is list here or None | |
| 96 | 96 | if paths: | |
@@ -136,7 +136,7 @@ def iter_change_type(self, change_type): | |||
| 136 | 136 | * 'R' for renamed paths | |
| 137 | 137 | * 'M' for paths with modified data""" | |
| 138 | 138 | 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) | ||
| 140 | 140 | ||
| 141 | 141 | for diff in self: | |
| 142 | 142 | if change_type == "A" and diff.new_file: | |
@@ -195,8 +195,8 @@ class Diff(object): | |||
| 195 | 195 | \.\.(?P<b_blob_id>[0-9A-Fa-f]+)[ ]?(?P<b_mode>.+)?(?:\n|$))? | |
| 196 | 196 | """, re.VERBOSE | re.MULTILINE) | |
| 197 | 197 | # 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 | ||
| 200 | 200 | ||
| 201 | 201 | __slots__ = ("a_blob", "b_blob", "a_mode", "b_mode", "new_file", "deleted_file", | |
| 202 | 202 | "rename_from", "rename_to", "diff") | |
@@ -239,10 +239,10 @@ def __eq__(self, other): | |||
| 239 | 239 | return True | |
| 240 | 240 | ||
| 241 | 241 | def __ne__(self, other): | |
| 242 | - return not ( self == other ) | ||
| 242 | + return not (self == other) | ||
| 243 | 243 | ||
| 244 | 244 | 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__)) | ||
| 246 | 246 | ||
| 247 | 247 | def __str__(self): | |
| 248 | 248 | h = "%s" | |
@@ -254,7 +254,7 @@ def __str__(self): | |||
| 254 | 254 | msg = '' | |
| 255 | 255 | l = None # temp line | |
| 256 | 256 | 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')): | ||
| 258 | 258 | if b: | |
| 259 | 259 | l = "\n%s: %o | %s" % (n, b.mode, b.hexsha) | |
| 260 | 260 | else: | |
@@ -265,7 +265,7 @@ def __str__(self): | |||
| 265 | 265 | # END for each blob | |
| 266 | 266 | ||
| 267 | 267 | # add headline | |
| 268 | - h += '\n' + '='*ll | ||
| 268 | + h += '\n' + '=' * ll | ||
| 269 | 269 | ||
| 270 | 270 | if self.deleted_file: | |
| 271 | 271 | msg += '\nfile deleted in rhs' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,7 @@ def __str__(self): | |||
| 36 | 36 | return ret | |
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | - class CheckoutError( Exception ): | ||
| 39 | + class CheckoutError(Exception): | ||
| 40 | 40 | ||
| 41 | 41 | """Thrown if a file could not be checked out from the index as it contained | |
| 42 | 42 | changes. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments