MCPcopy Create free account
hub / github.com/ZeroIntensity/pointers.py / __init__

Method __init__

src/pointers/base_pointers.py:183–199  ·  view source on GitHub ↗

Args: address: Address of the underlying value. increment_ref: Should the reference count on the target object get incremented.

(
        self,
        address: Optional[int],
        increment_ref: bool = False,
    )

Source from the content-addressed store, hash-verified

181 """Abstract class for a pointer to a Python object."""
182
183 def __init__(
184 self,
185 address: Optional[int],
186 increment_ref: bool = False,
187 ) -> None:
188 """
189 Args:
190 address: Address of the underlying value.
191 increment_ref: Should the reference count on the target object get incremented.
192 """ # noqa
193 self._address: Optional[int] = address
194
195 if increment_ref and address:
196 add_ref(~self)
197
198 self._origin_size = sys.getsizeof(~self if address else None)
199 weakref.finalize(self, self._cleanup)
200
201 @handle
202 def set_attr(self, key: str, value: Any) -> None:

Callers

nothing calls this directly

Calls 2

add_refFunction · 0.85
finalizeMethod · 0.80

Tested by

no test coverage detected