| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -41,8 +41,8 @@ def _init_externals(): | |||
| 41 | 41 | from git.remote import * | |
| 42 | 42 | from git.index import * | |
| 43 | 43 | from git.util import ( | |
| 44 | - LockFile, | ||
| 45 | - BlockingLockFile, | ||
| 44 | + LockFile, | ||
| 45 | + BlockingLockFile, | ||
| 46 | 46 | Stats, | |
| 47 | 47 | Actor | |
| 48 | 48 | ) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,19 +6,19 @@ | |||
| 6 | 6 | ||
| 7 | 7 | import os, sys | |
| 8 | 8 | from util import ( | |
| 9 | - LazyMixin, | ||
| 9 | + LazyMixin, | ||
| 10 | 10 | stream_copy | |
| 11 | 11 | ) | |
| 12 | 12 | from exc import GitCommandError | |
| 13 | 13 | ||
| 14 | 14 | from subprocess import ( | |
| 15 | - call, | ||
| 15 | + call, | ||
| 16 | 16 | Popen, | |
| 17 | 17 | PIPE | |
| 18 | 18 | ) | |
| 19 | 19 | ||
| 20 | 20 | execute_kwargs = ('istream', 'with_keep_cwd', 'with_extended_output', | |
| 21 | - 'with_exceptions', 'as_process', | ||
| 21 | + 'with_exceptions', 'as_process', | ||
| 22 | 22 | 'output_stream') | |
| 23 | 23 | ||
| 24 | 24 | __all__ = ('Git', ) | |
@@ -40,7 +40,7 @@ class Git(LazyMixin): | |||
| 40 | 40 | rval = g.ls_files() # calls 'git ls-files' program | |
| 41 | 41 | ||
| 42 | 42 | ``Debugging`` | |
| 43 | - Set the GIT_PYTHON_TRACE environment variable print each invocation | ||
| 43 | + Set the GIT_PYTHON_TRACE environment variable print each invocation | ||
| 44 | 44 | of the command to stdout. | |
| 45 | 45 | Set its value to 'full' to see details about the returned values. | |
| 46 | 46 | """ | |
@@ -63,7 +63,7 @@ class Git(LazyMixin): | |||
| 63 | 63 | ||
| 64 | 64 | class AutoInterrupt(object): | |
| 65 | 65 | ||
| 66 | - """Kill/Interrupt the stored process instance once this instance goes out of scope. It is | ||
| 66 | + """Kill/Interrupt the stored process instance once this instance goes out of scope. It is | ||
| 67 | 67 | used to prevent processes piling up in case iterators stop reading. | |
| 68 | 68 | Besides all attributes are wired through to the contained process object. | |
| 69 | 69 | ||
@@ -83,7 +83,7 @@ def __del__(self): | |||
| 83 | 83 | if self.proc.poll() is not None: | |
| 84 | 84 | return | |
| 85 | 85 | ||
| 86 | - # can be that nothing really exists anymore ... | ||
| 86 | + # can be that nothing really exists anymore ... | ||
| 87 | 87 | if os is None: | |
| 88 | 88 | return | |
| 89 | 89 | ||
@@ -94,34 +94,34 @@ def __del__(self): | |||
| 94 | 94 | except OSError: | |
| 95 | 95 | pass # ignore error when process already died | |
| 96 | 96 | except AttributeError: | |
| 97 | - # try windows | ||
| 98 | - # for some reason, providing None for stdout/stderr still prints something. This is why | ||
| 99 | - # we simply use the shell and redirect to nul. Its slower than CreateProcess, question | ||
| 97 | + # try windows | ||
| 98 | + # for some reason, providing None for stdout/stderr still prints something. This is why | ||
| 99 | + # we simply use the shell and redirect to nul. Its slower than CreateProcess, question | ||
| 100 | 100 | # is whether we really want to see all these messages. Its annoying no matter what. | |
| 101 | 101 | call(("TASKKILL /F /T /PID %s 2>nul 1>nul" % str(self.proc.pid)), shell=True) | |
| 102 | - # END exception handling | ||
| 102 | + # END exception handling | ||
| 103 | 103 | ||
| 104 | 104 | def __getattr__(self, attr): | |
| 105 | 105 | return getattr(self.proc, attr) | |
| 106 | 106 | ||
| 107 | 107 | def wait(self): | |
| 108 | - """Wait for the process and return its status code. | ||
| 108 | + """Wait for the process and return its status code. | ||
| 109 | 109 | ||
| 110 | 110 | :raise GitCommandError: if the return status is not 0""" | |
| 111 | 111 | status = self.proc.wait() | |
| 112 | 112 | if status != 0: | |
| 113 | 113 | raise GitCommandError(self.args, status, self.proc.stderr.read()) | |
| 114 | - # END status handling | ||
| 114 | + # END status handling | ||
| 115 | 115 | return status | |
| 116 | 116 | # END auto interrupt | |
| 117 | 117 | ||
| 118 | 118 | class CatFileContentStream(object): | |
| 119 | 119 | ||
| 120 | - """Object representing a sized read-only stream returning the contents of | ||
| 120 | + """Object representing a sized read-only stream returning the contents of | ||
| 121 | 121 | an object. | |
| 122 | - It behaves like a stream, but counts the data read and simulates an empty | ||
| 122 | + It behaves like a stream, but counts the data read and simulates an empty | ||
| 123 | 123 | stream once our sized content region is empty. | |
| 124 | - If not all data is read to the end of the objects's lifetime, we read the | ||
| 124 | + If not all data is read to the end of the objects's lifetime, we read the | ||
| 125 | 125 | rest to assure the underlying stream continues to work""" | |
| 126 | 126 | ||
| 127 | 127 | __slots__ = ('_stream', '_nbr', '_size') | |
@@ -131,7 +131,7 @@ def __init__(self, size, stream): | |||
| 131 | 131 | self._size = size | |
| 132 | 132 | self._nbr = 0 # num bytes read | |
| 133 | 133 | ||
| 134 | - # special case: if the object is empty, has null bytes, get the | ||
| 134 | + # special case: if the object is empty, has null bytes, get the | ||
| 135 | 135 | # final newline right away. | |
| 136 | 136 | if size == 0: | |
| 137 | 137 | stream.read(1) | |
@@ -220,9 +220,9 @@ def __init__(self, working_dir=None): | |||
| 220 | 220 | """Initialize this instance with: | |
| 221 | 221 | ||
| 222 | 222 | :param working_dir: | |
| 223 | - Git directory we should work in. If None, we always work in the current | ||
| 223 | + Git directory we should work in. If None, we always work in the current | ||
| 224 | 224 | directory as returned by os.getcwd(). | |
| 225 | - It is meant to be the working tree directory if available, or the | ||
| 225 | + It is meant to be the working tree directory if available, or the | ||
| 226 | 226 | .git directory in case of bare repositories.""" | |
| 227 | 227 | super(Git, self).__init__() | |
| 228 | 228 | self._working_dir = working_dir | |
@@ -233,7 +233,7 @@ def __init__(self, working_dir=None): | |||
| 233 | 233 | self.cat_file_all = None | |
| 234 | 234 | ||
| 235 | 235 | def __getattr__(self, name): | |
| 236 | - """A convenience method as it allows to call the command as if it was | ||
| 236 | + """A convenience method as it allows to call the command as if it was | ||
| 237 | 237 | an object. | |
| 238 | 238 | :return: Callable object that will execute call _call_process with your arguments.""" | |
| 239 | 239 | if name[0] == '_': | |
@@ -267,8 +267,8 @@ def execute(self, command, | |||
| 267 | 267 | with_keep_cwd=False, | |
| 268 | 268 | with_extended_output=False, | |
| 269 | 269 | with_exceptions=True, | |
| 270 | - as_process=False, | ||
| 271 | - output_stream=None, | ||
| 270 | + as_process=False, | ||
| 271 | + output_stream=None, | ||
| 272 | 272 | **subprocess_kwargs | |
| 273 | 273 | ): | |
| 274 | 274 | """Handles executing the command on the shell and consumes and returns | |
@@ -294,26 +294,26 @@ def execute(self, command, | |||
| 294 | 294 | Whether to raise an exception when git returns a non-zero status. | |
| 295 | 295 | ||
| 296 | 296 | :param as_process: | |
| 297 | - Whether to return the created process instance directly from which | ||
| 298 | - streams can be read on demand. This will render with_extended_output and | ||
| 299 | - with_exceptions ineffective - the caller will have | ||
| 297 | + Whether to return the created process instance directly from which | ||
| 298 | + streams can be read on demand. This will render with_extended_output and | ||
| 299 | + with_exceptions ineffective - the caller will have | ||
| 300 | 300 | to deal with the details himself. | |
| 301 | 301 | It is important to note that the process will be placed into an AutoInterrupt | |
| 302 | - wrapper that will interrupt the process once it goes out of scope. If you | ||
| 303 | - use the command in iterators, you should pass the whole process instance | ||
| 302 | + wrapper that will interrupt the process once it goes out of scope. If you | ||
| 303 | + use the command in iterators, you should pass the whole process instance | ||
| 304 | 304 | instead of a single stream. | |
| 305 | 305 | ||
| 306 | 306 | :param output_stream: | |
| 307 | - If set to a file-like object, data produced by the git command will be | ||
| 307 | + If set to a file-like object, data produced by the git command will be | ||
| 308 | 308 | output to the given stream directly. | |
| 309 | 309 | This feature only has any effect if as_process is False. Processes will | |
| 310 | 310 | always be created with a pipe due to issues with subprocess. | |
| 311 | - This merely is a workaround as data will be copied from the | ||
| 311 | + This merely is a workaround as data will be copied from the | ||
| 312 | 312 | output pipe to the given output stream directly. | |
| 313 | 313 | ||
| 314 | 314 | :param subprocess_kwargs: | |
| 315 | - Keyword arguments to be passed to subprocess.Popen. Please note that | ||
| 316 | - some of the valid kwargs are already set by this method, the ones you | ||
| 315 | + Keyword arguments to be passed to subprocess.Popen. Please note that | ||
| 316 | + some of the valid kwargs are already set by this method, the ones you | ||
| 317 | 317 | specify may not be the same ones. | |
| 318 | 318 | ||
| 319 | 319 | :return: | |
@@ -330,7 +330,7 @@ def execute(self, command, | |||
| 330 | 330 | :raise GitCommandError: | |
| 331 | 331 | ||
| 332 | 332 | :note: | |
| 333 | - If you add additional keyword arguments to the signature of this method, | ||
| 333 | + If you add additional keyword arguments to the signature of this method, | ||
| 334 | 334 | you must update the execute_kwargs tuple housed in this module.""" | |
| 335 | 335 | if self.GIT_PYTHON_TRACE and not self.GIT_PYTHON_TRACE == 'full': | |
| 336 | 336 | print ' '.join(command) | |
@@ -360,7 +360,7 @@ def execute(self, command, | |||
| 360 | 360 | stderr_value = '' | |
| 361 | 361 | try: | |
| 362 | 362 | if output_stream is None: | |
| 363 | - stdout_value, stderr_value = proc.communicate() | ||
| 363 | + stdout_value, stderr_value = proc.communicate() | ||
| 364 | 364 | # strip trailing "\n" | |
| 365 | 365 | if stdout_value.endswith("\n"): | |
| 366 | 366 | stdout_value = stdout_value[:-1] | |
@@ -434,7 +434,7 @@ def __unpack_args(cls, arg_list): | |||
| 434 | 434 | outlist.extend(cls.__unpack_args(arg)) | |
| 435 | 435 | elif isinstance(arg_list, unicode): | |
| 436 | 436 | outlist.append(arg_list.encode('utf-8')) | |
| 437 | - # END recursion | ||
| 437 | + # END recursion | ||
| 438 | 438 | else: | |
| 439 | 439 | outlist.append(str(arg)) | |
| 440 | 440 | # END for each arg | |
@@ -523,7 +523,7 @@ def make_call(): | |||
| 523 | 523 | finally: | |
| 524 | 524 | import warnings | |
| 525 | 525 | msg = "WARNING: Automatically switched to use git.cmd as git executable, which reduces performance by ~70%." | |
| 526 | - msg += "Its recommended to put git.exe into the PATH or to set the %s environment variable to the executable's location" % self._git_exec_env_var | ||
| 526 | + msg += "Its recommended to put git.exe into the PATH or to set the %s environment variable to the executable's location" % self._git_exec_env_var | ||
| 527 | 527 | warnings.warn(msg) | |
| 528 | 528 | #END print of warning | |
| 529 | 529 | #END catch first failure | |
@@ -541,7 +541,7 @@ def _parse_object_header(self, header_line): | |||
| 541 | 541 | ||
| 542 | 542 | :return: (hex_sha, type_string, size_as_int) | |
| 543 | 543 | ||
| 544 | - :raise ValueError: if the header contains indication for an error due to | ||
| 544 | + :raise ValueError: if the header contains indication for an error due to | ||
| 545 | 545 | incorrect input sha""" | |
| 546 | 546 | tokens = header_line.split() | |
| 547 | 547 | if len(tokens) != 3: | |
@@ -553,7 +553,7 @@ def _parse_object_header(self, header_line): | |||
| 553 | 553 | # END error handling | |
| 554 | 554 | ||
| 555 | 555 | if len(tokens[0]) != 40: | |
| 556 | - raise ValueError("Failed to parse header: %r" % header_line) | ||
| 556 | + raise ValueError("Failed to parse header: %r" % header_line) | ||
| 557 | 557 | return (tokens[0], tokens[1], int(tokens[2])) | |
| 558 | 558 | ||
| 559 | 559 | def __prepare_ref(self, ref): | |
@@ -581,11 +581,11 @@ def __get_object_header(self, cmd, ref): | |||
| 581 | 581 | return self._parse_object_header(cmd.stdout.readline()) | |
| 582 | 582 | ||
| 583 | 583 | def get_object_header(self, ref): | |
| 584 | - """ Use this method to quickly examine the type and size of the object behind | ||
| 585 | - the given ref. | ||
| 584 | + """ Use this method to quickly examine the type and size of the object behind | ||
| 585 | + the given ref. | ||
| 586 | 586 | ||
| 587 | - :note: The method will only suffer from the costs of command invocation | ||
| 588 | - once and reuses the command in subsequent calls. | ||
| 587 | + :note: The method will only suffer from the costs of command invocation | ||
| 588 | + once and reuses the command in subsequent calls. | ||
| 589 | 589 | ||
| 590 | 590 | :return: (hexsha, type_string, size_as_int)""" | |
| 591 | 591 | cmd = self.__get_persistent_cmd("cat_file_header", "cat_file", batch_check=True) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments