class documentation

A Git Tag object.

Class Method from_path Read a tag from a file on disk.
Method __init__ Initialize a new Tag object.
Method check Check this object for internal consistency.
Method extract_signature Extract the payload, signature, and signature type from this tag.
Method raw_without_sig Return raw string serialization without the GPG/SSH signature.
Class Variable __slots__ Undocumented
Class Variable message Undocumented
Class Variable name Undocumented
Class Variable object Undocumented
Class Variable signature Undocumented
Class Variable tag_time Undocumented
Class Variable tag_timezone Undocumented
Class Variable tagger Undocumented
Class Variable type_name Undocumented
Class Variable type_num Undocumented
Method _deserialize Grab the metadata attached to the tag.
Method _get_object Get the object pointed to by this tag.
Method _serialize Undocumented
Method _set_object Undocumented
Class Variable _message Undocumented
Class Variable _name Undocumented
Instance Variable _needs_serialization Undocumented
Instance Variable _object_class Undocumented
Instance Variable _object_sha Undocumented
Instance Variable _signature Undocumented
Instance Variable _tag_time Undocumented
Instance Variable _tag_timezone Undocumented
Instance Variable _tag_timezone_neg_utc Undocumented
Instance Variable _tagger Undocumented

Inherited from ShaFile:

Class Method from_file Get the contents of a SHA file on disk.
Class Method from_string Create a ShaFile from a string.
Static Method from_raw_chunks Creates an object of the indicated type from the raw chunks given.
Static Method from_raw_string Creates an object of the indicated type from the raw string given.
Method __bytes__ Return raw string serialization of this object.
Method __eq__ Return True if the SHAs of the two objects match.
Method __hash__ Return unique hash for this object.
Method __le__ Check whether SHA of this object is less than or equal to the other.
Method __lt__ Return whether SHA of this object is less than the other.
Method __ne__ Check whether this object does not match the other.
Method __repr__ Return string representation of this object.
Method as_legacy_object Return string representing the object in the experimental format.
Method as_legacy_object_chunks Return chunks representing the object in the experimental format.
Method as_pretty_string Return a string representing this object, fit for display.
Method as_raw_chunks Return chunks with serialization of the object.
Method as_raw_string Return raw string with serialization of the object.
Method copy Create a new copy of this SHA1 object from its raw string.
Method get_id Get the hex SHA of this object using the specified hash algorithm.
Method raw_length Returns the length of the raw string of this object.
Method set_raw_chunks Set the contents of this object from a list of chunks.
Method set_raw_string Set the contents of this object from a serialized string.
Method sha The SHA object that is the name of this object.
Instance Variable object_format Undocumented
Property id The hex SHA1 of this object.
Class Method _is_legacy_object Undocumented
Class Method _parse_file Undocumented
Static Method _parse_legacy_object_header Parse a legacy object, creating it but not reading the file.
Static Method _parse_object_header Parse a new style object, creating it but not reading the file.
Method _check_has_member Check that the object has a given member variable.
Method _header Undocumented
Method _parse_legacy_object Parse a legacy object, setting the raw string.
Method _parse_object Parse a new style object, setting self._text.
Instance Variable _chunked_text Undocumented
Instance Variable _sha Undocumented
def from_path(cls, filename: str | bytes, sha: ObjectID | None = None, *, object_format: ObjectFormat | None = None) -> Tag:

Read a tag from a file on disk.

Parameters
filename:str | bytesPath to the tag file
sha:ObjectID | NoneOptional known SHA for the object
object_format:ObjectFormat | NoneOptional object format to use
Returns
TagA Tag object
Raises
NotTagErrorIf the file is not a tag
def __init__(self):

Initialize a new Tag object.

def check(self):

Check this object for internal consistency.

Raises
ObjectFormatExceptionif the object is malformed in some way
def extract_signature(self) -> tuple[bytes, bytes | None, bytes | None]:

Extract the payload, signature, and signature type from this tag.

Returns
tuple of (payload, signature, signature_type) where
  • payload: The raw tag data without the signature
  • signature: The signature bytes if present, None otherwise
  • signature_type: SIGNATURE_PGP for PGP, SIGNATURE_SSH for SSH, None if no signature
Raises
ObjectFormatExceptionIf signature has unknown format
def raw_without_sig(self) -> bytes:

Return raw string serialization without the GPG/SSH signature.

self.signature is a signature for the returned raw byte string serialization.

__slots__: tuple[str, ...] =

Undocumented

message =

Undocumented

name =

Undocumented

object =

Undocumented

signature =

Undocumented

tag_time =

Undocumented

tag_timezone =

Undocumented

tagger =

Undocumented

type_name: bytes =

Undocumented

type_num: int =

Undocumented

def _deserialize(self, chunks: list[bytes]):

Grab the metadata attached to the tag.

def _get_object(self) -> tuple[type[ShaFile], bytes]:

Get the object pointed to by this tag.

Returns: tuple of (object class, sha).

def _serialize(self) -> list[bytes]:

Undocumented

def _set_object(self, value: tuple[type[ShaFile], bytes]):

Undocumented

_message: bytes | None =

Undocumented

_name: bytes | None =

Undocumented

_needs_serialization: bool =
_object_class: type[ShaFile] | None =

Undocumented

_object_sha: bytes | None =

Undocumented

_signature: bytes | None =

Undocumented

_tag_time: int | None =

Undocumented

_tag_timezone: int | None =

Undocumented

_tag_timezone_neg_utc: bool | None =

Undocumented

_tagger: bytes | None =

Undocumented