valanga 0.1.6__py3-none-any.whl → 0.1.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,23 +3,35 @@ Factory for creating content representations from game states and state modifica
3
3
  """
4
4
 
5
5
  from dataclasses import dataclass
6
- from typing import Callable, TypeVar
6
+ from typing import Protocol
7
7
 
8
- from .game import State, StateModifications
8
+ from .game import State
9
9
  from .represention_for_evaluation import ContentRepresentation
10
10
 
11
- StateT = TypeVar("StateT", bound=State)
12
- EvalIn = TypeVar("EvalIn")
13
11
 
14
- CreateFromState = Callable[[StateT], ContentRepresentation[StateT, EvalIn]]
15
- CreateFromStateAndMods = Callable[
16
- [StateT, StateModifications, ContentRepresentation[StateT, EvalIn]],
17
- ContentRepresentation[StateT, EvalIn],
18
- ]
12
+ class CreateFromState[StateT: State, EvalIn](Protocol):
13
+ """
14
+ Protocol for creating a state representation from a state.
15
+ """
16
+
17
+ def __call__(self, state: StateT) -> ContentRepresentation[StateT, EvalIn]: ...
18
+
19
+
20
+ class CreateFromStateAndModifications[StateT: State, EvalIn, StateModT](Protocol):
21
+ """
22
+ Protocol for creating a state representation from a state and modifications.
23
+ """
24
+
25
+ def __call__(
26
+ self,
27
+ state: StateT,
28
+ state_modifications: StateModT,
29
+ previous_state_representation: ContentRepresentation[StateT, EvalIn],
30
+ ) -> ContentRepresentation[StateT, EvalIn]: ...
19
31
 
20
32
 
21
33
  @dataclass
22
- class RepresentationFactory[StateT: State, EvalIn]:
34
+ class RepresentationFactory[StateT: State, EvalIn, StateModT]:
23
35
  """Factory for creating content representations from states and state modifications.
24
36
  Attributes:
25
37
  create_from_state: Function to create a content representation from a state.
@@ -27,13 +39,15 @@ class RepresentationFactory[StateT: State, EvalIn]:
27
39
  """
28
40
 
29
41
  create_from_state: CreateFromState[StateT, EvalIn]
30
- create_from_state_and_modifications: CreateFromStateAndMods[StateT, EvalIn]
42
+ create_from_state_and_modifications: CreateFromStateAndModifications[
43
+ StateT, EvalIn, StateModT
44
+ ]
31
45
 
32
46
  def create_from_transition(
33
47
  self,
34
48
  state: StateT,
35
49
  previous_state_representation: ContentRepresentation[StateT, EvalIn] | None,
36
- modifications: StateModifications | None,
50
+ modifications: StateModT | None,
37
51
  ) -> ContentRepresentation[StateT, EvalIn]:
38
52
  """Creates a content representation from a state transition.
39
53
  Args:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: valanga
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: Shared types and utilities for evaluation
5
5
  Author-email: Victor Gabillon <victorgabillon@gmail.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -6,10 +6,10 @@ valanga/over_event.py,sha256=jUqN3CXq3e55TvDZatZKFlEOzJfho7M1Zr7VjZUhP6M,7908
6
6
  valanga/policy.py,sha256=TkqcOSePRhHqtuoMbCKe5qZbizvF5H9uG1_oEcIZsuA,1229
7
7
  valanga/progress_messsage.py,sha256=3LnOXSgyU84UkwcpsakcbPt_d3el2ojRSUClAwoPyEk,361
8
8
  valanga/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- valanga/representation_factory.py,sha256=w1RKwuDec-imp5NmB3rg-e5iiuEScbHCX8tnBeXeVgQ,2117
9
+ valanga/representation_factory.py,sha256=LAIfLCBKTMVPDCZbcRtMQs_VIJwIHeaEH86BWV8PgTc,2456
10
10
  valanga/represention_for_evaluation.py,sha256=9yCCOuN-h9FnoLJrffKGQ-oXiiXzZT3rP4e5wwMYfys,1135
11
- valanga-0.1.6.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
12
- valanga-0.1.6.dist-info/METADATA,sha256=cMwv58HEFZHTEmRujAzCRcnU0uL24voleiQV7OVCZDE,44645
13
- valanga-0.1.6.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
14
- valanga-0.1.6.dist-info/top_level.txt,sha256=cKFLhxKDTqygHnc0xc_L8jDx6oNu5hSHqZ4UExU4xPo,8
15
- valanga-0.1.6.dist-info/RECORD,,
11
+ valanga-0.1.7.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
12
+ valanga-0.1.7.dist-info/METADATA,sha256=4qCW9MTi80M1_3RJSi2hNiQlqV70UbzaZ0_YbdRvjTU,44645
13
+ valanga-0.1.7.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
14
+ valanga-0.1.7.dist-info/top_level.txt,sha256=cKFLhxKDTqygHnc0xc_L8jDx6oNu5hSHqZ4UExU4xPo,8
15
+ valanga-0.1.7.dist-info/RECORD,,