Skip to content

Commit b79198a

Browse files
committed
Document Git.execute parameters in definition order
- Reorder the items in the git.cmd.Git.execute docstring that document its parameters, to be in the same order the parameters are actually defined in. - Use consistent spacing, by having a blank line between successive items that document parameters. Before, most of them were separated this way, but some of them were not. - Reorder the elements of execute_kwargs (which list all those parameters except the first parameter, command) to be listed in that order as well. These were mostly in order, but a couple were out of order. This is just about the order they appear in the definition, since sets in Python (unlike dicts) have no key order guarantees.
1 parent 874f0bf commit b79198a

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

git/cmd.py

+26-20
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@
6666
"with_extended_output",
6767
"with_exceptions",
6868
"as_process",
69-
"stdout_as_string",
7069
"output_stream",
71-
"with_stdout",
70+
"stdout_as_string",
7271
"kill_after_timeout",
72+
"with_stdout",
7373
"universal_newlines",
7474
"shell",
7575
"env",
@@ -883,6 +883,27 @@ def execute(
883883
decoded into a string using the default encoding (usually utf-8).
884884
The latter can fail, if the output contains binary data.
885885
886+
:param kill_after_timeout:
887+
To specify a timeout in seconds for the git command, after which the process
888+
should be killed. This will have no effect if as_process is set to True. It is
889+
set to None by default and will let the process run until the timeout is
890+
explicitly specified. This feature is not supported on Windows. It's also worth
891+
noting that kill_after_timeout uses SIGKILL, which can have negative side
892+
effects on a repository. For example, stale locks in case of git gc could
893+
render the repository incapable of accepting changes until the lock is manually
894+
removed.
895+
896+
:param with_stdout:
897+
If True, default True, we open stdout on the created process
898+
899+
:param universal_newlines:
900+
if True, pipes will be opened as text, and lines are split at
901+
all known line endings.
902+
903+
:param shell:
904+
Whether to invoke commands through a shell (see `Popen(..., shell=True)`).
905+
It overrides :attr:`USE_SHELL` if it is not `None`.
906+
886907
:param env:
887908
A dictionary of environment variables to be passed to `subprocess.Popen`.
888909
@@ -891,29 +912,14 @@ def execute(
891912
one invocation of write() method. If the given number is not positive then
892913
the default value is used.
893914
915+
:param strip_newline_in_stdout:
916+
Whether to strip the trailing ``\\n`` of the command stdout.
917+
894918
:param subprocess_kwargs:
895919
Keyword arguments to be passed to subprocess.Popen. Please note that
896920
some of the valid kwargs are already set by this method, the ones you
897921
specify may not be the same ones.
898922
899-
:param with_stdout: If True, default True, we open stdout on the created process
900-
:param universal_newlines:
901-
if True, pipes will be opened as text, and lines are split at
902-
all known line endings.
903-
:param shell:
904-
Whether to invoke commands through a shell (see `Popen(..., shell=True)`).
905-
It overrides :attr:`USE_SHELL` if it is not `None`.
906-
:param kill_after_timeout:
907-
To specify a timeout in seconds for the git command, after which the process
908-
should be killed. This will have no effect if as_process is set to True. It is
909-
set to None by default and will let the process run until the timeout is
910-
explicitly specified. This feature is not supported on Windows. It's also worth
911-
noting that kill_after_timeout uses SIGKILL, which can have negative side
912-
effects on a repository. For example, stale locks in case of git gc could
913-
render the repository incapable of accepting changes until the lock is manually
914-
removed.
915-
:param strip_newline_in_stdout:
916-
Whether to strip the trailing ``\\n`` of the command stdout.
917923
:return:
918924
* str(output) if extended_output = False (Default)
919925
* tuple(int(status), str(stdout), str(stderr)) if extended_output = True

0 commit comments

Comments
 (0)