Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d9fb2f4

Browse filesBrowse files
committed
Further git.util docstring revisions
That I had missed in 1cd73ba.
1 parent 37011bf commit d9fb2f4
Copy full SHA for d9fb2f4

File tree

1 file changed

+27
-25
lines changed
Filter options

1 file changed

+27
-25
lines changed

‎git/util.py

Copy file name to clipboardExpand all lines: git/util.py
+27-25Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ def patch_env(name: str, value: str) -> Generator[None, None, None]:
201201
def rmtree(path: PathLike) -> None:
202202
"""Remove the given directory tree recursively.
203203
204-
:note: We use :func:`shutil.rmtree` but adjust its behaviour to see whether files
205-
that couldn't be deleted are read-only. Windows will not remove them in that
206-
case.
204+
:note:
205+
We use :func:`shutil.rmtree` but adjust its behaviour to see whether files that
206+
couldn't be deleted are read-only. Windows will not remove them in that case.
207207
"""
208208

209209
def handler(function: Callable, path: PathLike, _excinfo: Any) -> None:
@@ -241,8 +241,8 @@ def rmfile(path: PathLike) -> None:
241241

242242

243243
def stream_copy(source: BinaryIO, destination: BinaryIO, chunk_size: int = 512 * 1024) -> int:
244-
"""Copy all data from the source stream into the destination stream in chunks
245-
of size chunk_size.
244+
"""Copy all data from the `source` stream into the `destination` stream in chunks
245+
of size `chunk_size`.
246246
247247
:return:
248248
Number of bytes written
@@ -259,8 +259,8 @@ def stream_copy(source: BinaryIO, destination: BinaryIO, chunk_size: int = 512 *
259259

260260

261261
def join_path(a: PathLike, *p: PathLike) -> PathLike:
262-
R"""Join path tokens together similar to osp.join, but always use
263-
``/`` instead of possibly ``\`` on Windows."""
262+
R"""Join path tokens together similar to osp.join, but always use ``/`` instead of
263+
possibly ``\`` on Windows."""
264264
path = str(a)
265265
for b in p:
266266
b = str(b)
@@ -297,7 +297,7 @@ def to_native_path_linux(path: PathLike) -> str:
297297

298298

299299
def join_path_native(a: PathLike, *p: PathLike) -> PathLike:
300-
R"""Like join_path, but makes sure an OS native path is returned.
300+
R"""Like :func:`join_path`, but makes sure an OS native path is returned.
301301
302302
This is only needed to play it safe on Windows and to ensure nice paths that only
303303
use ``\``.
@@ -308,10 +308,12 @@ def join_path_native(a: PathLike, *p: PathLike) -> PathLike:
308308
def assure_directory_exists(path: PathLike, is_file: bool = False) -> bool:
309309
"""Make sure that the directory pointed to by path exists.
310310
311-
:param is_file: If True, ``path`` is assumed to be a file and handled correctly.
311+
:param is_file:
312+
If True, `path` is assumed to be a file and handled correctly.
312313
Otherwise it must be a directory.
313314
314-
:return: True if the directory was created, False if it already existed.
315+
:return:
316+
True if the directory was created, False if it already existed.
315317
"""
316318
if is_file:
317319
path = osp.dirname(path)
@@ -339,7 +341,8 @@ def py_where(program: str, path: Optional[PathLike] = None) -> List[str]:
339341
:func:`is_cygwin_git`. When a search following all shell rules is needed,
340342
:func:`shutil.which` can be used instead.
341343
342-
:note: Neither this function nor :func:`shutil.which` will predict the effect of an
344+
:note:
345+
Neither this function nor :func:`shutil.which` will predict the effect of an
343346
executable search on a native Windows system due to a :class:`subprocess.Popen`
344347
call without ``shell=True``, because shell and non-shell executable search on
345348
Windows differ considerably.
@@ -550,8 +553,7 @@ def remove_password_if_present(cmdline: Sequence[str]) -> List[str]:
550553
class RemoteProgress:
551554
"""Handler providing an interface to parse progress information emitted by
552555
``git push`` and ``git fetch`` and to dispatch callbacks allowing subclasses to
553-
react to the progress.
554-
"""
556+
react to the progress."""
555557

556558
_num_op_codes: int = 9
557559
(
@@ -761,8 +763,8 @@ def update(self, *args: Any, **kwargs: Any) -> None:
761763

762764
class Actor:
763765
"""Actors hold information about a person acting on the repository. They
764-
can be committers and authors or anything with a name and an email as
765-
mentioned in the git log entries."""
766+
can be committers and authors or anything with a name and an email as mentioned in
767+
the git log entries."""
766768

767769
# PRECOMPILED REGEX
768770
name_only_regex = re.compile(r"<(.*)>")
@@ -802,7 +804,7 @@ def __repr__(self) -> str:
802804

803805
@classmethod
804806
def _from_string(cls, string: str) -> "Actor":
805-
"""Create an Actor from a string.
807+
"""Create an :class:`Actor` from a string.
806808
807809
:param string:
808810
The string, which is expected to be in regular git format::
@@ -868,10 +870,11 @@ def default_name() -> str:
868870
@classmethod
869871
def committer(cls, config_reader: Union[None, "GitConfigParser", "SectionConstraint"] = None) -> "Actor":
870872
"""
871-
:return: Actor instance corresponding to the configured committer. It behaves
872-
similar to the git implementation, such that the environment will override
873-
configuration values of `config_reader`. If no value is set at all, it will
874-
be generated.
873+
:return:
874+
:class:`Actor` instance corresponding to the configured committer. It
875+
behaves similar to the git implementation, such that the environment will
876+
override configuration values of `config_reader`. If no value is set at all,
877+
it will be generated.
875878
876879
:param config_reader:
877880
ConfigReader to use to retrieve the values from in case they are not set in
@@ -887,8 +890,7 @@ def author(cls, config_reader: Union[None, "GitConfigParser", "SectionConstraint
887890

888891

889892
class Stats:
890-
"""
891-
Represents stat information as presented by git at the end of a merge. It is
893+
"""Represents stat information as presented by git at the end of a merge. It is
892894
created from the output of a diff operation.
893895
894896
Example::
@@ -949,9 +951,9 @@ def _list_from_string(cls, repo: "Repo", text: str) -> "Stats":
949951

950952

951953
class IndexFileSHA1Writer:
952-
"""Wrapper around a file-like object that remembers the SHA1 of
953-
the data written to it. It will write a sha when the stream is closed
954-
or if asked for explicitly using :meth:`write_sha`.
954+
"""Wrapper around a file-like object that remembers the SHA1 of the data written to
955+
it. It will write a sha when the stream is closed or if asked for explicitly using
956+
:meth:`write_sha`.
955957
956958
Only useful to the index file.
957959

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.