[docs]@finalclass_LawSpec(LawSpecDef):"""Laws for :class:`~SwappableN` type."""__slots__=()
[docs]@law_definitiondefdouble_swap_law(container:'SwappableN[_FirstType, _SecondType, _ThirdType]',)->None:""" Swapping container twice. It ensure that we get the initial value back. In other words, swapping twice does nothing. """assert_equal(container,container.swap().swap(),)
[docs]classSwappableN(bimappable.BiMappableN[_FirstType,_SecondType,_ThirdType],Lawful['SwappableN[_FirstType, _SecondType, _ThirdType]'],):"""Interface that allows swapping first and second type values."""__slots__=()_laws:ClassVar[Sequence[Law]]=(Law1(_LawSpec.double_swap_law),)
[docs]@abstractmethoddefswap(self:_SwappableType,)->KindN[_SwappableType,_SecondType,_FirstType,_ThirdType]:"""Swaps first and second types in ``SwappableN``."""
#: Type alias for kinds with two type arguments.Swappable2=SwappableN[_FirstType,_SecondType,Never]#: Type alias for kinds with three type arguments.Swappable3=SwappableN[_FirstType,_SecondType,_ThirdType]