Skip to content

PyoContainer

Bases: Checkable, Protocol


              flowchart TD
              pyochain.abc._collection.PyoContainer[PyoContainer]
              pyochain.abc._mixins.Checkable[Checkable]

                              pyochain.abc._mixins.Checkable --> pyochain.abc._collection.PyoContainer
                


              click pyochain.abc._collection.PyoContainer href "" "pyochain.abc._collection.PyoContainer"
              click pyochain.abc._mixins.Checkable href "" "pyochain.abc._mixins.Checkable"
            

ABC for collections.abc.Container Protocol.

Source code in pyochain/abc/_collection.pyi
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@runtime_checkable
class PyoContainer[T](Checkable, Protocol):
    """ABC for `collections.abc.Container` Protocol."""
    @abstractmethod
    def __contains__(self, x: T, /) -> bool: ...
    def contains(self, value: T) -> bool:
        """Check if the `Container` contains the specified **value**.

        This is equivalent to `value in self`, but as a method.

        Args:
            value (T): The value to check for existence.

        Returns:
            bool: True if the value exists in the Collection, False otherwise.

        Example:
            ```python
            from pyochain import Dict

            data = Dict(a=1, b=2)

            assert data.contains("a")
            assert not data.contains("c")
            ```
        """

contains(value)

Check if the Container contains the specified value.

This is equivalent to value in self, but as a method.

Parameters:

Name Type Description Default
value T

The value to check for existence.

required

Returns:

Name Type Description
bool bool

True if the value exists in the Collection, False otherwise.

Example
from pyochain import Dict

data = Dict(a=1, b=2)

assert data.contains("a")
assert not data.contains("c")
Source code in pyochain/abc/_collection.pyi
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
def contains(self, value: T) -> bool:
    """Check if the `Container` contains the specified **value**.

    This is equivalent to `value in self`, but as a method.

    Args:
        value (T): The value to check for existence.

    Returns:
        bool: True if the value exists in the Collection, False otherwise.

    Example:
        ```python
        from pyochain import Dict

        data = Dict(a=1, b=2)

        assert data.contains("a")
        assert not data.contains("c")
        ```
    """