Skip to content

Commit 4463624

Browse files
stephan-crByron
authored andcommitted
Fix Sphinx rendering errors
These errors are mostly fixed by either adding blank lines or single spaces for Sphinx documentation key words. The commit solely includes documentation changes, no functional changes.
1 parent 141cd65 commit 4463624

File tree

12 files changed

+37
-17
lines changed

12 files changed

+37
-17
lines changed

Diff for: git/cmd.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,7 @@ def __init__(self, working_dir: Union[None, PathLike] = None):
735735
def __getattr__(self, name: str) -> Any:
736736
"""A convenience method as it allows to call the command as if it was
737737
an object.
738+
738739
:return: Callable object that will execute call _call_process with your arguments."""
739740
if name[0] == "_":
740741
return LazyMixin.__getattr__(self, name)
@@ -915,7 +916,7 @@ def execute(
915916
render the repository incapable of accepting changes until the lock is manually
916917
removed.
917918
:param strip_newline_in_stdout:
918-
Whether to strip the trailing `\n` of the command stdout.
919+
Whether to strip the trailing ``\\n`` of the command stdout.
919920
:return:
920921
* str(output) if extended_output = False (Default)
921922
* tuple(int(status), str(stdout), str(stderr)) if extended_output = True
@@ -1384,7 +1385,8 @@ def get_object_header(self, ref: str) -> Tuple[str, str, int]:
13841385

13851386
def get_object_data(self, ref: str) -> Tuple[str, str, int, bytes]:
13861387
"""As get_object_header, but returns object data as well
1387-
:return: (hexsha, type_string, size_as_int,data_string)
1388+
1389+
:return: (hexsha, type_string, size_as_int, data_string)
13881390
:note: not threadsafe"""
13891391
hexsha, typename, size, stream = self.stream_object_data(ref)
13901392
data = stream.read(size)

Diff for: git/index/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -982,12 +982,12 @@ def move(
982982
Additional arguments you would like to pass to git-mv, such as dry_run
983983
or force.
984984
985-
:return:List(tuple(source_path_string, destination_path_string), ...)
985+
:return: List(tuple(source_path_string, destination_path_string), ...)
986986
A list of pairs, containing the source file moved as well as its
987987
actual destination. Relative to the repository root.
988988
989989
:raise ValueError: If only one item was given
990-
GitCommandError: If git could not handle your request"""
990+
:raise GitCommandError: If git could not handle your request"""
991991
args = []
992992
if skip_errors:
993993
args.append("-k")

Diff for: git/index/fun.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def _has_file_extension(path):
8282

8383
def run_commit_hook(name: str, index: "IndexFile", *args: str) -> None:
8484
"""Run the commit hook of the given name. Silently ignores hooks that do not exist.
85+
8586
:param name: name of hook, like 'pre-commit'
8687
:param index: IndexFile instance
8788
:param args: arguments passed to hook file
@@ -234,11 +235,13 @@ def read_cache(
234235
stream: IO[bytes],
235236
) -> Tuple[int, Dict[Tuple[PathLike, int], "IndexEntry"], bytes, bytes]:
236237
"""Read a cache file from the given stream
238+
237239
:return: tuple(version, entries_dict, extension_data, content_sha)
238-
* version is the integer version number
239-
* entries dict is a dictionary which maps IndexEntry instances to a path at a stage
240-
* extension_data is '' or 4 bytes of type + 4 bytes of size + size bytes
241-
* content_sha is a 20 byte sha on all cache file contents"""
240+
241+
* version is the integer version number
242+
* entries dict is a dictionary which maps IndexEntry instances to a path at a stage
243+
* extension_data is '' or 4 bytes of type + 4 bytes of size + size bytes
244+
* content_sha is a 20 byte sha on all cache file contents"""
242245
version, num_entries = read_header(stream)
243246
count = 0
244247
entries: Dict[Tuple[PathLike, int], "IndexEntry"] = {}

Diff for: git/objects/base.py

+1
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def data_stream(self) -> "OStream":
143143

144144
def stream_data(self, ostream: "OStream") -> "Object":
145145
"""Writes our data directly to the given output stream
146+
146147
:param ostream: File object compatible stream object.
147148
:return: self"""
148149
istream = self.repo.odb.stream(self.binsha)

Diff for: git/objects/fun.py

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
def tree_to_stream(entries: Sequence[EntryTup], write: Callable[["ReadableBuffer"], Union[int, None]]) -> None:
3939
"""Write the give list of entries into a stream using its write method
40+
4041
:param entries: **sorted** list of tuples with (binsha, mode, name)
4142
:param write: write method which takes a data string"""
4243
ord_zero = ord("0")
@@ -68,6 +69,7 @@ def tree_to_stream(entries: Sequence[EntryTup], write: Callable[["ReadableBuffer
6869

6970
def tree_entries_from_data(data: bytes) -> List[EntryTup]:
7071
"""Reads the binary representation of a tree and returns tuples of Tree items
72+
7173
:param data: data block with tree data (as bytes)
7274
:return: list(tuple(binsha, mode, tree_relative_path), ...)"""
7375
ord_zero = ord("0")

Diff for: git/objects/tree.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def set_done(self) -> "TreeModifier":
128128
"""Call this method once you are done modifying the tree information.
129129
It may be called several times, but be aware that each call will cause
130130
a sort operation
131+
131132
:return self:"""
132133
merge_sort(self._cache, git_cmp)
133134
return self
@@ -175,6 +176,7 @@ def add_unchecked(self, binsha: bytes, mode: int, name: str) -> None:
175176
"""Add the given item to the tree, its correctness is assumed, which
176177
puts the caller into responsibility to assure the input is correct.
177178
For more information on the parameters, see ``add``
179+
178180
:param binsha: 20 byte binary sha"""
179181
assert isinstance(binsha, bytes) and isinstance(mode, int) and isinstance(name, str)
180182
tree_cache = (binsha, mode, name)
@@ -259,8 +261,8 @@ def _iter_convert_to_object(self, iterable: Iterable[TreeCacheTup]) -> Iterator[
259261

260262
def join(self, file: str) -> IndexObjUnion:
261263
"""Find the named object in this tree's contents
262-
:return: ``git.Blob`` or ``git.Tree`` or ``git.Submodule``
263264
265+
:return: ``git.Blob`` or ``git.Tree`` or ``git.Submodule``
264266
:raise KeyError: if given file or tree does not exist in tree"""
265267
msg = "Blob or Tree named %r not found"
266268
if "/" in file:

Diff for: git/objects/util.py

+1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def utctz_to_altz(utctz: str) -> int:
140140
"""we convert utctz to the timezone in seconds, it is the format time.altzone
141141
returns. Git stores it as UTC timezone which has the opposite sign as well,
142142
which explains the -1 * ( that was made explicit here )
143+
143144
:param utctz: git utc timezone string, i.e. +0200"""
144145
return -1 * int(float(utctz) / 100 * 3600)
145146

Diff for: git/refs/log.py

+2
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ def entry_at(cls, filepath: PathLike, index: int) -> "RefLogEntry":
253253

254254
def to_file(self, filepath: PathLike) -> None:
255255
"""Write the contents of the reflog instance to a file at the given filepath.
256+
256257
:param filepath: path to file, parent directories are assumed to exist"""
257258
lfd = LockedFD(filepath)
258259
assure_directory_exists(filepath, is_file=True)
@@ -326,6 +327,7 @@ def append_entry(
326327

327328
def write(self) -> "RefLog":
328329
"""Write this instance's data to the file we are originating from
330+
329331
:return: self"""
330332
if self._path is None:
331333
raise ValueError("Instance was not initialized with a path, use to_file(...) instead")

Diff for: git/refs/reference.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ class Reference(SymbolicReference, LazyMixin, IterableObj):
4949

5050
def __init__(self, repo: "Repo", path: PathLike, check_path: bool = True) -> None:
5151
"""Initialize this instance
52-
:param repo: Our parent repository
5352
53+
:param repo: Our parent repository
5454
:param path:
5555
Path relative to the .git/ directory pointing to the ref in question, i.e.
5656
refs/heads/master
@@ -73,6 +73,7 @@ def set_object(
7373
logmsg: Union[str, None] = None,
7474
) -> "Reference":
7575
"""Special version which checks if the head-log needs an update as well
76+
7677
:return: self"""
7778
oldbinsha = None
7879
if logmsg is not None:

Diff for: git/remote.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,7 @@ def stale_refs(self) -> IterableList[Reference]:
756756
@classmethod
757757
def create(cls, repo: "Repo", name: str, url: str, allow_unsafe_protocols: bool = False, **kwargs: Any) -> "Remote":
758758
"""Create a new remote to the given repository
759+
759760
:param repo: Repository instance that is to receive the new remote
760761
:param name: Desired name of the remote
761762
:param url: URL which corresponds to the remote's name
@@ -778,6 +779,7 @@ def add(cls, repo: "Repo", name: str, url: str, **kwargs: Any) -> "Remote":
778779
@classmethod
779780
def remove(cls, repo: "Repo", name: str) -> str:
780781
"""Remove the remote with the given name
782+
781783
:return: the passed remote name to remove
782784
"""
783785
repo.git.remote("rm", name)
@@ -790,6 +792,7 @@ def remove(cls, repo: "Repo", name: str) -> str:
790792

791793
def rename(self, new_name: str) -> "Remote":
792794
"""Rename self to the given new_name
795+
793796
:return: self"""
794797
if self.name == new_name:
795798
return self
@@ -1021,11 +1024,11 @@ def pull(
10211024
"""Pull changes from the given branch, being the same as a fetch followed
10221025
by a merge of branch with your local branch.
10231026
1024-
:param refspec: see 'fetch' method
1025-
:param progress: see 'push' method
1026-
:param kill_after_timeout: see 'fetch' method
1027+
:param refspec: see :meth:`fetch` method
1028+
:param progress: see :meth:`push` method
1029+
:param kill_after_timeout: see :meth:`fetch` method
10271030
:param kwargs: Additional arguments to be passed to git-pull
1028-
:return: Please see 'fetch' method"""
1031+
:return: Please see :meth:`fetch` method"""
10291032
if refspec is None:
10301033
# No argument refspec, then ensure the repo's config has a fetch refspec.
10311034
self._assert_refspec()

Diff for: git/repo/base.py

+3
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ def head(self) -> "HEAD":
403403
@property
404404
def remotes(self) -> "IterableList[Remote]":
405405
"""A list of Remote objects allowing to access and manipulate remotes
406+
406407
:return: ``git.IterableList(Remote, ...)``"""
407408
return Remote.list_items(self)
408409

@@ -443,6 +444,7 @@ def create_submodule(self, *args: Any, **kwargs: Any) -> Submodule:
443444
def iter_submodules(self, *args: Any, **kwargs: Any) -> Iterator[Submodule]:
444445
"""An iterator yielding Submodule instances, see Traversable interface
445446
for a description of args and kwargs
447+
446448
:return: Iterator"""
447449
return RootModule(self).traverse(*args, **kwargs)
448450

@@ -457,6 +459,7 @@ def submodule_update(self, *args: Any, **kwargs: Any) -> Iterator[Submodule]:
457459
@property
458460
def tags(self) -> "IterableList[TagReference]":
459461
"""A list of ``Tag`` objects that are available in this repo
462+
460463
:return: ``git.IterableList(TagReference, ...)``"""
461464
return TagReference.list_items(self)
462465

Diff for: git/util.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131

132132

133133
def unbare_repo(func: Callable[..., T]) -> Callable[..., T]:
134-
"""Methods with this decorator raise InvalidGitRepositoryError if they
134+
"""Methods with this decorator raise :class:`.exc.InvalidGitRepositoryError` if they
135135
encounter a bare repository"""
136136

137137
from .exc import InvalidGitRepositoryError
@@ -1152,7 +1152,7 @@ def list_items(cls, repo: "Repo", *args: Any, **kwargs: Any) -> Any:
11521152
11531153
:note: Favor the iter_items method as it will
11541154
1155-
:return:list(Item,...) list of item instances"""
1155+
:return: list(Item,...) list of item instances"""
11561156
out_list: Any = IterableList(cls._id_attribute_)
11571157
out_list.extend(cls.iter_items(repo, *args, **kwargs))
11581158
return out_list
@@ -1184,7 +1184,7 @@ def list_items(cls, repo: "Repo", *args: Any, **kwargs: Any) -> IterableList[T_I
11841184
11851185
:note: Favor the iter_items method as it will
11861186
1187-
:return:list(Item,...) list of item instances"""
1187+
:return: list(Item,...) list of item instances"""
11881188
out_list: IterableList = IterableList(cls._id_attribute_)
11891189
out_list.extend(cls.iter_items(repo, *args, **kwargs))
11901190
return out_list

0 commit comments

Comments
 (0)