MCPcopy Create free account
hub / github.com/libgit2/pygit2 / __init__

Method __init__

pygit2/blob.py:127–148  ·  view source on GitHub ↗

Wrap the specified blob. Parameters: blob: The blob to wrap. as_path: Filter the contents of the blob as if it had the specified path. If `as_path` is None, the raw contents of the blob will be read. flags: A combination of

(
        self,
        blob: Blob,
        as_path: Optional[str] = None,
        flags: BlobFilter = BlobFilter.CHECK_FOR_BINARY,
        commit_id: Optional[Oid] = None,
    )

Source from the content-addressed store, hash-verified

125 """
126
127 def __init__(
128 self,
129 blob: Blob,
130 as_path: Optional[str] = None,
131 flags: BlobFilter = BlobFilter.CHECK_FOR_BINARY,
132 commit_id: Optional[Oid] = None,
133 ):
134 """Wrap the specified blob.
135
136 Parameters:
137 blob: The blob to wrap.
138 as_path: Filter the contents of the blob as if it had the specified
139 path. If `as_path` is None, the raw contents of the blob will
140 be read.
141 flags: A combination of enums.BlobFilter constants
142 (only applicable when `as_path` is set).
143 commit_id: Commit to load attributes from when
144 ATTRIBUTES_FROM_COMMIT is specified in `flags`
145 (only applicable when `as_path` is set).
146 """
147 raw = _BlobIO(blob, as_path=as_path, flags=flags, commit_id=commit_id)
148 super().__init__(raw)
149
150 def __exit__(self, exc_type, exc_value, traceback):
151 self.close()

Callers 1

__init__Method · 0.45

Calls 1

_BlobIOClass · 0.85

Tested by

no test coverage detected