Source code for

"""Implements the :py:class:`` class and specializations
for it."""

import logging
import weakref
from typing import Any, Callable

from import PATH_JOIN_CHAR
from ..base import BaseDataContainer, BaseDataGroup
from ..mixins import ForwardAttrsMixin

log = logging.getLogger(__name__)

# -----------------------------------------------------------------------------

# -----------------------------------------------------------------------------

[docs]class _strongref: """Emulates part of the :py:class:`weakref.ref` interface but uses regular references instead of weak references. This is used *internally* by :py:class:`` and improves picklability. """ def __init__(self, obj: Any): self._obj = obj def __call__(self) -> Any: return self._obj
[docs] def __eq__(self, other) -> bool: """Two strong references are equal if and only if they point to the identical object. """ if type(self) is not type(other): return False return self._obj is other._obj