valanga 0.1.6__tar.gz → 0.1.8__tar.gz

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.
Files changed (23) hide show
  1. {valanga-0.1.6 → valanga-0.1.8}/PKG-INFO +1 -1
  2. {valanga-0.1.6 → valanga-0.1.8}/pyproject.toml +1 -1
  3. {valanga-0.1.6 → valanga-0.1.8}/src/valanga/representation_factory.py +29 -16
  4. {valanga-0.1.6 → valanga-0.1.8}/src/valanga.egg-info/PKG-INFO +1 -1
  5. {valanga-0.1.6 → valanga-0.1.8}/LICENSE +0 -0
  6. {valanga-0.1.6 → valanga-0.1.8}/README.md +0 -0
  7. {valanga-0.1.6 → valanga-0.1.8}/setup.cfg +0 -0
  8. {valanga-0.1.6 → valanga-0.1.8}/src/valanga/__init__.py +0 -0
  9. {valanga-0.1.6 → valanga-0.1.8}/src/valanga/evaluations.py +0 -0
  10. {valanga-0.1.6 → valanga-0.1.8}/src/valanga/evaluator_types.py +0 -0
  11. {valanga-0.1.6 → valanga-0.1.8}/src/valanga/game.py +0 -0
  12. {valanga-0.1.6 → valanga-0.1.8}/src/valanga/over_event.py +0 -0
  13. {valanga-0.1.6 → valanga-0.1.8}/src/valanga/policy.py +0 -0
  14. {valanga-0.1.6 → valanga-0.1.8}/src/valanga/progress_messsage.py +0 -0
  15. {valanga-0.1.6 → valanga-0.1.8}/src/valanga/py.typed +0 -0
  16. {valanga-0.1.6 → valanga-0.1.8}/src/valanga/represention_for_evaluation.py +0 -0
  17. {valanga-0.1.6 → valanga-0.1.8}/src/valanga.egg-info/SOURCES.txt +0 -0
  18. {valanga-0.1.6 → valanga-0.1.8}/src/valanga.egg-info/dependency_links.txt +0 -0
  19. {valanga-0.1.6 → valanga-0.1.8}/src/valanga.egg-info/requires.txt +0 -0
  20. {valanga-0.1.6 → valanga-0.1.8}/src/valanga.egg-info/top_level.txt +0 -0
  21. {valanga-0.1.6 → valanga-0.1.8}/tests/test_over_event.py +0 -0
  22. {valanga-0.1.6 → valanga-0.1.8}/tests/test_placeholder.py +0 -0
  23. {valanga-0.1.6 → valanga-0.1.8}/tests/test_representation_factory.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: valanga
3
- Version: 0.1.6
3
+ Version: 0.1.8
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "valanga"
7
- version = "0.1.6"
7
+ version = "0.1.8"
8
8
  description = "Shared types and utilities for evaluation"
9
9
  requires-python = ">=3.13"
10
10
  dependencies = []
@@ -3,38 +3,51 @@ 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
9
- from .represention_for_evaluation import ContentRepresentation
8
+ from .game import State
10
9
 
11
- StateT = TypeVar("StateT", bound=State)
12
- EvalIn = TypeVar("EvalIn")
13
10
 
14
- CreateFromState = Callable[[StateT], ContentRepresentation[StateT, EvalIn]]
15
- CreateFromStateAndMods = Callable[
16
- [StateT, StateModifications, ContentRepresentation[StateT, EvalIn]],
17
- ContentRepresentation[StateT, EvalIn],
18
- ]
11
+ class CreateFromState[StateT: State, RepT](Protocol):
12
+ """
13
+ Protocol for creating a state representation from a state.
14
+ """
15
+
16
+ def __call__(self, state: StateT) -> RepT: ...
17
+
18
+
19
+ class CreateFromStateAndModifications[StateT: State, StateModT, RepT](Protocol):
20
+ """
21
+ Protocol for creating a state representation from a state and modifications.
22
+ """
23
+
24
+ def __call__(
25
+ self,
26
+ state: StateT,
27
+ state_modifications: StateModT,
28
+ previous_state_representation: RepT,
29
+ ) -> RepT: ...
19
30
 
20
31
 
21
32
  @dataclass
22
- class RepresentationFactory[StateT: State, EvalIn]:
33
+ class RepresentationFactory[StateT: State, StateModT, RepT]:
23
34
  """Factory for creating content representations from states and state modifications.
24
35
  Attributes:
25
36
  create_from_state: Function to create a content representation from a state.
26
37
  create_from_state_and_modifications: Function to create a content representation from a state and state modifications.
27
38
  """
28
39
 
29
- create_from_state: CreateFromState[StateT, EvalIn]
30
- create_from_state_and_modifications: CreateFromStateAndMods[StateT, EvalIn]
40
+ create_from_state: CreateFromState[StateT, RepT]
41
+ create_from_state_and_modifications: CreateFromStateAndModifications[
42
+ StateT, StateModT, RepT
43
+ ]
31
44
 
32
45
  def create_from_transition(
33
46
  self,
34
47
  state: StateT,
35
- previous_state_representation: ContentRepresentation[StateT, EvalIn] | None,
36
- modifications: StateModifications | None,
37
- ) -> ContentRepresentation[StateT, EvalIn]:
48
+ previous_state_representation: RepT | None,
49
+ modifications: StateModT | None,
50
+ ) -> RepT:
38
51
  """Creates a content representation from a state transition.
39
52
  Args:
40
53
  state: The current state of the game.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: valanga
3
- Version: 0.1.6
3
+ Version: 0.1.8
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes