class documentation

A git SHA file.

Class Method from_file Get the contents of a SHA file on disk.
Class Method from_path Open a SHA file from 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 __init__ Don't call this directly
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__ Undocumented
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 check Check this object for internal consistency.
Method copy Create a new copy of this SHA1 object from its raw string
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 SHA1 object that is the name of this object.
Class Variable __slots__ Undocumented
Class Variable type_name Undocumented
Class Variable type_num Undocumented
Property id The hex SHA 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 _deserialize Undocumented
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.
Method _serialize Undocumented
Instance Variable _chunked_text Undocumented
Instance Variable _needs_serialization Undocumented
Instance Variable _sha Undocumented
@classmethod
def from_file(cls, f):

Get the contents of a SHA file on disk.

@classmethod
def from_path(cls, path):
@classmethod
def from_string(cls, string):

Create a ShaFile from a string.

@staticmethod
def from_raw_chunks(type_num, chunks, sha=None):

Creates an object of the indicated type from the raw chunks given.

Parameters
type_num:intThe numeric type of the object.
chunks:List[bytes]An iterable of the raw uncompressed contents.
sha:Optional[ObjectID]Optional known sha for the object
@staticmethod
def from_raw_string(type_num, string, sha=None):

Creates an object of the indicated type from the raw string given.

Parameters
type_numThe numeric type of the object.
stringThe raw uncompressed contents.
shaOptional known sha for the object
def __bytes__(self):

Return raw string serialization of this object.

Returns
bytesUndocumented
def __eq__(self, other):

Return True if the SHAs of the two objects match.

def __hash__(self):

Return unique hash for this object.

def __init__(self):
def __le__(self, other):

Check whether SHA of this object is less than or equal to the other.

def __lt__(self, other):

Return whether SHA of this object is less than the other.

def __ne__(self, other):

Check whether this object does not match the other.

def __repr__(self):

Undocumented

def as_legacy_object(self, compression_level=-1):

Return string representing the object in the experimental format.

Parameters
compression_level:intUndocumented
Returns
bytesUndocumented
def as_legacy_object_chunks(self, compression_level=-1):

Return chunks representing the object in the experimental format.

Returns: List of strings

Parameters
compression_level:intUndocumented
Returns
Iterator[bytes]Undocumented
def as_pretty_string(self):
overridden in dulwich.objects.Tree

Return a string representing this object, fit for display.

Returns
bytesUndocumented
def as_raw_chunks(self):

Return chunks with serialization of the object.

Returns: List of strings, not necessarily one per line

Returns
List[bytes]Undocumented
def as_raw_string(self):

Return raw string with serialization of the object.

Returns: String object

Returns
bytesUndocumented
def check(self):

Check this object for internal consistency.

Raises
ObjectFormatExceptionif the object is malformed in some way
ChecksumMismatchif the object was created with a SHA that does not match its contents
def copy(self):

Create a new copy of this SHA1 object from its raw string

def raw_length(self):

Returns the length of the raw string of this object.

Returns
intUndocumented
def set_raw_chunks(self, chunks, sha=None):

Set the contents of this object from a list of chunks.

Parameters
chunks:List[bytes]Undocumented
sha:Optional[ObjectID]Undocumented
def set_raw_string(self, text, sha=None):

Set the contents of this object from a serialized string.

Parameters
text:bytesUndocumented
sha:Optional[ObjectID]Undocumented
def sha(self):

The SHA1 object that is the name of this object.

The hex SHA of this object.

@classmethod
def _is_legacy_object(cls, magic):

Undocumented

Parameters
magic:bytesUndocumented
Returns
boolUndocumented
@classmethod
def _parse_file(cls, f):

Undocumented

@staticmethod
def _parse_legacy_object_header(magic, f):

Parse a legacy object, creating it but not reading the file.

Returns
ShaFileUndocumented
@staticmethod
def _parse_object_header(magic, f):

Parse a new style object, creating it but not reading the file.

def _check_has_member(self, member, error_msg):

Check that the object has a given member variable.

Parameters
memberthe member variable to check for
error_msgthe message for an error if the member is missing
Raises
ObjectFormatExceptionwith the given error_msg if member is missing or is None
def _deserialize(self, chunks):
def _header(self):

Undocumented

def _parse_legacy_object(self, map):

Parse a legacy object, setting the raw string.

def _parse_object(self, map):

Parse a new style object, setting self._text.

_chunked_text: list =
overridden in dulwich.objects.Blob

Undocumented

_sha =

Undocumented