chessai.core.isolation.level

 1import enum
 2import typing
 3
 4import chessai.core.isolation.isolator
 5import chessai.core.isolation.none
 6
 7class Level(enum.Enum):
 8    """ An enum representing the different isolation levels supported by the engine. """
 9
10    NONE = 'none'
11
12    def get_isolator(self, **kwargs: typing.Any) -> chessai.core.isolation.isolator.AgentIsolator:
13        """ Get an isolator matching the given level. """
14
15        isolator: chessai.core.isolation.isolator.AgentIsolator | None = None
16
17        if (self == Level.NONE):
18            isolator = chessai.core.isolation.none.NoneIsolator(**kwargs)
19
20        if (isolator is None):
21            raise ValueError(f"Unknown isolation level '{self}'.")
22
23        return isolator
24
25LEVELS: list[str] = [item.value for item in Level]
class Level(enum.Enum):
 8class Level(enum.Enum):
 9    """ An enum representing the different isolation levels supported by the engine. """
10
11    NONE = 'none'
12
13    def get_isolator(self, **kwargs: typing.Any) -> chessai.core.isolation.isolator.AgentIsolator:
14        """ Get an isolator matching the given level. """
15
16        isolator: chessai.core.isolation.isolator.AgentIsolator | None = None
17
18        if (self == Level.NONE):
19            isolator = chessai.core.isolation.none.NoneIsolator(**kwargs)
20
21        if (isolator is None):
22            raise ValueError(f"Unknown isolation level '{self}'.")
23
24        return isolator

An enum representing the different isolation levels supported by the engine.

NONE = <Level.NONE: 'none'>
def get_isolator(self, **kwargs: Any) -> chessai.core.isolation.isolator.AgentIsolator:
13    def get_isolator(self, **kwargs: typing.Any) -> chessai.core.isolation.isolator.AgentIsolator:
14        """ Get an isolator matching the given level. """
15
16        isolator: chessai.core.isolation.isolator.AgentIsolator | None = None
17
18        if (self == Level.NONE):
19            isolator = chessai.core.isolation.none.NoneIsolator(**kwargs)
20
21        if (isolator is None):
22            raise ValueError(f"Unknown isolation level '{self}'.")
23
24        return isolator

Get an isolator matching the given level.

LEVELS: list[str] = ['none']