module documentation

Object format abstraction for Git objects.

This module provides an abstraction layer for different object formats used in Git repositories (SHA-1 and SHA-256).

Class ObjectFormat Object format (hash algorithm) used in Git.
Function get_object_format Get an object format by name.
Function verify_same_object_format Verify that all provided object formats are the same.
Constant OBJECT_FORMAT_TYPE_NUMS Undocumented
Constant OBJECT_FORMATS Undocumented
Constant SHA1 Undocumented
Constant SHA256 Undocumented
def get_object_format(name: str | None = None) -> ObjectFormat:

Get an object format by name.

Parameters
name:str | NoneFormat name ("sha1" or "sha256"). If None, returns default.
Returns
ObjectFormatObjectFormat instance
Raises
ValueErrorIf the format name is not supported
def verify_same_object_format(*formats: ObjectFormat) -> ObjectFormat:

Verify that all provided object formats are the same.

Parameters
*formats:ObjectFormatObject format instances to verify
Returns
ObjectFormatThe common object format
Raises
ValueErrorIf formats don't match or no formats provided
OBJECT_FORMAT_TYPE_NUMS =

Undocumented

Value
{1: SHA1, 2: SHA256}
OBJECT_FORMATS =

Undocumented

Value
{'sha1': SHA1, 'sha256': SHA256}
SHA1 =

Undocumented

Value
ObjectFormat('sha1',
             type_num=1, oid_length=20, hex_length=40, hash_func=sha1)
SHA256 =

Undocumented

Value
ObjectFormat('sha256',
             type_num=20, oid_length=32, hex_length=64, hash_func=sha256)