Skip to content

Commit e166a0a

Browse files
committedFeb 29, 2024
More docstring revisions within git.objects
1 parent 231c3ef commit e166a0a

File tree

6 files changed

+25
-23
lines changed

6 files changed

+25
-23
lines changed
 

‎git/objects/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def new_from_sha(cls, repo: "Repo", sha1: bytes) -> Commit_ish:
9898
New object instance of a type appropriate to represent the given binary sha1
9999
100100
:param sha1:
101-
20 byte binary sha1
101+
20 byte binary sha1.
102102
"""
103103
if sha1 == cls.NULL_BIN_SHA:
104104
# The NULL binsha is always the root commit.

‎git/objects/commit.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def iter_items(
298298
The :class:`~git.repo.base.Repo`.
299299
300300
:param rev:
301-
Revision specifier, see git-rev-parse for viable options.
301+
Revision specifier. See git-rev-parse for viable options.
302302
303303
:param paths:
304304
An optional path or list of paths. If set only :class:`Commit`\s that
@@ -309,7 +309,7 @@ def iter_items(
309309
310310
* ``max_count`` is the maximum number of commits to fetch.
311311
* ``skip`` is the number of commits to skip.
312-
* ``since`` all commits since e.g. '1970-01-01'.
312+
* ``since`` selects all commits since some date, e.g. ``"1970-01-01"``.
313313
314314
:return:
315315
Iterator yielding :class:`Commit` items.
@@ -380,12 +380,13 @@ def stats(self) -> Stats:
380380
def trailers(self) -> Dict[str, str]:
381381
"""Deprecated. Get the trailers of the message as a dictionary.
382382
383-
:note: This property is deprecated, please use either :attr:`trailers_list` or
384-
:attr:`trailers_dict``.
383+
:note:
384+
This property is deprecated, please use either :attr:`trailers_list` or
385+
:attr:`trailers_dict`.
385386
386387
:return:
387-
Dictionary containing whitespace stripped trailer information. Only contains
388-
the latest instance of each trailer key.
388+
Dictionary containing whitespace stripped trailer information.
389+
Only contains the latest instance of each trailer key.
389390
"""
390391
return {k: v[0] for k, v in self.trailers_dict.items()}
391392

@@ -539,7 +540,7 @@ def create_from_tree(
539540
author_date: Union[None, str, datetime.datetime] = None,
540541
commit_date: Union[None, str, datetime.datetime] = None,
541542
) -> "Commit":
542-
"""Commit the given tree, creating a commit object.
543+
"""Commit the given tree, creating a :class:`Commit` object.
543544
544545
:param repo:
545546
:class:`~git.repo.base.Repo` object the commit should be part of.

‎git/objects/fun.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ def traverse_trees_recursive(
186186
given tree.
187187
188188
:param tree_shas:
189-
Iterable of shas pointing to trees. All trees must be on the same level. A
190-
tree-sha may be ``None`` in which case ``None``.
189+
Iterable of shas pointing to trees. All trees must be on the same level.
190+
A tree-sha may be ``None``, in which case ``None``.
191191
192192
:param path_prefix:
193193
A prefix to be added to the returned paths on this level.

‎git/objects/tag.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This module is part of GitPython and is released under the
44
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
55

6-
"""Provides an :class:`git.objects.base.Object`-based type for annotated tags.
6+
"""Provides an :class:`~git.objects.base.Object`-based type for annotated tags.
77
88
This defines the :class:`TagReference` class, which represents annotated tags.
99
For lightweight tags, see the :mod:`git.refs.tag` module.

‎git/objects/tree.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class Tree(IndexObject, git_diff.Diffable, util.Traversable, util.Serializable):
166166
167167
Tree as a list:
168168
169-
* Access a specific blob using the ``tree['filename']`` notation.
169+
* Access a specific blob using the ``tree["filename"]`` notation.
170170
* You may likewise access by index, like ``blob = tree[0]``.
171171
"""
172172

@@ -215,8 +215,8 @@ def _set_cache_(self, attr: str) -> None:
215215
# END handle attribute
216216

217217
def _iter_convert_to_object(self, iterable: Iterable[TreeCacheTup]) -> Iterator[IndexObjUnion]:
218-
"""Iterable yields tuples of (binsha, mode, name), which will be converted
219-
to the respective object representation.
218+
"""Iterable yields tuples of (binsha, mode, name), which will be converted to
219+
the respective object representation.
220220
"""
221221
for binsha, mode, name in iterable:
222222
path = join_path(self.path, name)
@@ -338,8 +338,8 @@ def traverse(
338338
def list_traverse(self, *args: Any, **kwargs: Any) -> IterableList[IndexObjUnion]:
339339
"""
340340
:return:
341-
:class:`~git.util.IterableList`IterableList with the results of the
342-
traversal as produced by :meth:`traverse`
341+
:class:`~git.util.IterableList` with the results of the traversal as
342+
produced by :meth:`traverse`
343343
344344
Tree -> IterableList[Union[Submodule, Tree, Blob]]
345345
"""

‎git/objects/util.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def _traverse(
474474
ignore_self: int = 1,
475475
as_edge: bool = False,
476476
) -> Union[Iterator[Union["Traversable", "Blob"]], Iterator[TraversedTup]]:
477-
"""Iterator yielding items found when traversing self.
477+
"""Iterator yielding items found when traversing `self`.
478478
479479
:param predicate:
480480
A function ``f(i,d)`` that returns ``False`` if item i at depth ``d`` should
@@ -485,9 +485,10 @@ def _traverse(
485485
item ``i`` at depth ``d``. Item ``i`` will not be returned.
486486
487487
:param depth:
488-
Defines at which level the iteration should not go deeper if -1, there is no
489-
limit if 0, you would effectively only get self, the root of the iteration
490-
i.e. if 1, you would only get the first level of predecessors/successors.
488+
Defines at which level the iteration should not go deeper if -1. There is no
489+
limit if 0, you would effectively only get `self`, the root of the
490+
iteration. If 1, you would only get the first level of
491+
predecessors/successors.
491492
492493
:param branch_first:
493494
If ``True``, items will be returned branch first, otherwise depth first.
@@ -497,8 +498,8 @@ def _traverse(
497498
encountered several times. Loops are prevented that way.
498499
499500
:param ignore_self:
500-
If ``True``, self will be ignored and automatically pruned from the result.
501-
Otherwise it will be the first item to be returned. If `as_edge` is
501+
If ``True``, `self` will be ignored and automatically pruned from the
502+
result. Otherwise it will be the first item to be returned. If `as_edge` is
502503
``True``, the source of the first edge is ``None``.
503504
504505
:param as_edge:
@@ -507,7 +508,7 @@ def _traverse(
507508
destination.
508509
509510
:return:
510-
Iterator yielding items found when traversing self::
511+
Iterator yielding items found when traversing `self`::
511512
512513
Commit -> Iterator[Union[Commit, Tuple[Commit, Commit]] Submodule ->
513514
Iterator[Submodule, Tuple[Submodule, Submodule]] Tree ->

0 commit comments

Comments
 (0)
Please sign in to comment.