:py:mod:`medkit.core.attribute_container`
=========================================

.. py:module:: medkit.core.attribute_container


Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   medkit.core.attribute_container.AttributeContainer




.. py:class:: AttributeContainer(owner_id: str)


   
   Manage a list of attributes attached to another data structure.

   For example, it may be a document or an annotation.

   This behaves more or less like a list: calling `len()` and iterating are
   supported. Additional filtering is available through the `get()` method.

   The attributes will be stored in a :class:`~medkit.core.Store`, which can
   rely on a simple dict or something more complicated like a database.

   This global store may be initialized using :class:~medkit.core.GlobalStore.
   Otherwise, a default one (i.e. dict store) is used.















   ..
       !! processed by numpydoc !!
   .. py:method:: __len__() -> int

      
      Add support for calling `len()`.
















      ..
          !! processed by numpydoc !!

   .. py:method:: __iter__() -> Iterator[medkit.core.attribute.Attribute]

      
      Add support for iterating over each attribute.
















      ..
          !! processed by numpydoc !!

   .. py:method:: __getitem__(key: int | slice) -> medkit.core.attribute.Attribute | list[medkit.core.attribute.Attribute]

      
      Add support for subscript access.
















      ..
          !! processed by numpydoc !!

   .. py:method:: get(*, label: str | None = None) -> list[medkit.core.attribute.Attribute]

      
      Return a list of the attributes of the annotation.


      :Parameters:

          **label** : str, optional
              Label to use to filter attributes.

      :Returns:

          list of Attribute
              The list of all attributes of the annotation, filtered by label if specified.













      ..
          !! processed by numpydoc !!

   .. py:method:: add(attr: medkit.core.attribute.Attribute)

      
      Attach an attribute to the annotation.


      :Parameters:

          **attr** : Attribute
              Attribute to add.





      :Raises:

          ValueError
              If the attribute is already attached to the annotation (based on
              `attr.uid`).









      ..
          !! processed by numpydoc !!

   .. py:method:: get_by_id(uid: str) -> medkit.core.attribute.Attribute

      
      Return the attribute corresponding to a specific identifier.


      :Parameters:

          **uid** : str
              Identifier of the attribute to return.

      :Returns:

          Attribute
              The attribute corresponding to the identifier













      ..
          !! processed by numpydoc !!

   .. py:method:: __eq__(other: object) -> bool

      
      Return self==value.
















      ..
          !! processed by numpydoc !!

   .. py:method:: __repr__() -> str

      
      Return repr(self).
















      ..
          !! processed by numpydoc !!


