valanga 0.1.4__py3-none-any.whl → 0.1.5__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.
@@ -9,42 +9,44 @@ from .game import State, StateModifications
9
9
  from .represention_for_evaluation import ContentRepresentation
10
10
 
11
11
 
12
- class CreateFromState[T: ContentRepresentation](Protocol):
12
+ class CreateFromState[StateT: State, RepT: ContentRepresentation](Protocol):
13
13
  """
14
14
  Protocol for creating a state representation from a state.
15
15
  """
16
16
 
17
- def __call__(self, state: State) -> T: ...
17
+ def __call__(self, state: StateT) -> RepT: ...
18
18
 
19
19
 
20
- class CreateFromStateAndModifications[T: ContentRepresentation](Protocol):
20
+ class CreateFromStateAndModifications[StateT: State, RepT: ContentRepresentation](
21
+ Protocol
22
+ ):
21
23
  """
22
24
  Protocol for creating a state representation from a state and modifications.
23
25
  """
24
26
 
25
27
  def __call__(
26
28
  self,
27
- state: State,
29
+ state: StateT,
28
30
  state_modifications: StateModifications,
29
- previous_state_representation: T,
30
- ) -> T: ...
31
+ previous_state_representation: RepT,
32
+ ) -> RepT: ...
31
33
 
32
34
 
33
35
  @dataclass
34
- class RepresentationFactory[T: ContentRepresentation = ContentRepresentation]:
36
+ class RepresentationFactory[StateT: State, RepT: ContentRepresentation]:
35
37
  """
36
38
  Factory class for creating state representations.
37
39
  """
38
40
 
39
- create_from_state: CreateFromState[T]
40
- create_from_state_and_modifications: CreateFromStateAndModifications[T]
41
+ create_from_state: CreateFromState[StateT, RepT]
42
+ create_from_state_and_modifications: CreateFromStateAndModifications[StateT, RepT]
41
43
 
42
44
  def create_from_transition(
43
45
  self,
44
- state: State,
45
- previous_state_representation: T | None,
46
+ state: StateT,
47
+ previous_state_representation: RepT | None,
46
48
  modifications: StateModifications | None,
47
- ) -> T:
49
+ ) -> RepT:
48
50
  """
49
51
  Create a Generic T_StateRepresentation object from a transition.
50
52
 
@@ -2,19 +2,21 @@
2
2
  Contains the definition of the ContentRepresentation protocol for content representations used in evaluations.
3
3
  """
4
4
 
5
- from typing import Protocol
5
+ from typing import Any, Protocol, TypeVar
6
6
 
7
7
  from .evaluator_types import EvaluatorInput
8
8
  from .game import State
9
9
 
10
+ StateT_contra = TypeVar("StateT_contra", bound=State, contravariant=True, default=Any)
10
11
 
11
- class ContentRepresentation(Protocol):
12
+
13
+ class ContentRepresentation(Protocol[StateT_contra]):
12
14
  """
13
15
  Protocol defining the interface for a content representation.
14
16
  It is a function returning the proper input for evaluation by the content evaluator.
15
17
  """
16
18
 
17
- def get_evaluator_input(self, state: State) -> EvaluatorInput:
19
+ def get_evaluator_input(self, state: StateT_contra) -> EvaluatorInput:
18
20
  """
19
21
  Returns the evaluator input tensor for the content. Content representations have generally a compressed view and complemetary view of state info so to avoid redundancy and have all the necessary info we also give the state as input.
20
22
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: valanga
3
- Version: 0.1.4
3
+ Version: 0.1.5
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=inM1mEd5Jot7Kx8OIdPltrBC8__wWwY7u8T1PqHfuF0,2480
10
- valanga/represention_for_evaluation.py,sha256=3EnImf4DcYla70LXb19unOzzhPYlnFzj-nl3KJdReWk,885
11
- valanga-0.1.4.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
12
- valanga-0.1.4.dist-info/METADATA,sha256=Ajx40UKCPLnzO6KX1fSQ_wiCikjNc1FxgkS_N6S3Cqk,44645
13
- valanga-0.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
- valanga-0.1.4.dist-info/top_level.txt,sha256=cKFLhxKDTqygHnc0xc_L8jDx6oNu5hSHqZ4UExU4xPo,8
15
- valanga-0.1.4.dist-info/RECORD,,
9
+ valanga/representation_factory.py,sha256=zTZEo_sfUYY6fnMHU1U_ToWIIpvXVCs707JKDH2cEKw,2556
10
+ valanga/represention_for_evaluation.py,sha256=4ZJhcmAcEAB2CkED9blu6RX3sY5LgVxHJ0p40Sujwn8,1010
11
+ valanga-0.1.5.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
12
+ valanga-0.1.5.dist-info/METADATA,sha256=7ZrF2SDwCyuXDXDTx98w8oLAmoLwx1vQpulXTxXVxQw,44645
13
+ valanga-0.1.5.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
14
+ valanga-0.1.5.dist-info/top_level.txt,sha256=cKFLhxKDTqygHnc0xc_L8jDx6oNu5hSHqZ4UExU4xPo,8
15
+ valanga-0.1.5.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5