Skip to content

Commit 6126997

Browse files
committed
Improve docstrings about tags
- Fix long-outdated information in the git.objects.tag docstring that seems to have been left over from when there was no such separate module. This module has only a tag-related class, not all classes that derive from git.object.base.Object. - Expand the git.objects.tag docstring to clarify what the module provides, add a git.refs.tag module docstring explaining what that provides, and cross-reference them with an explanation of how they differ (mentioning how this relates to git concepts). - Expand thie git.object.tag.TagObject class docstring to include the term "annotated" (retaining "non-lightweight" in parentheses).
1 parent 30f7da5 commit 6126997

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

git/objects/tag.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
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-
"""Object-based types."""
6+
"""Provides an :class:`git.objects.base.Object`-based type for annotated tags.
7+
8+
This defines the :class:`TagReference` class, which represents annotated tags.
9+
For lightweight tags, see the :mod:`git.refs.tag` module.
10+
"""
711

812
from . import base
913
from .util import get_object_type_by_name, parse_actor_and_date
@@ -25,8 +29,8 @@
2529

2630

2731
class TagObject(base.Object):
28-
"""Non-lightweight tag carrying additional information about an object we are
29-
pointing to."""
32+
"""Annotated (i.e. non-lightweight) tag carrying additional information about an
33+
object we are pointing to."""
3034

3135
type: Literal["tag"] = "tag"
3236

git/refs/tag.py

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

4+
"""Provides a :class:`~git.refs.reference.Reference`-based type for lightweight tags.
5+
6+
This defines the :class:`TagReference` class (and its alias :class:`Tag`), which
7+
represents lightweight tags. For annotated tags (which are git objects), see the
8+
:mod:`git.objects.tag` module.
9+
"""
10+
411
from .reference import Reference
512

613
__all__ = ["TagReference", "Tag"]

0 commit comments

Comments
 (0)