tasking 2.0.0__tar.gz → 2.1.0__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 (38) hide show
  1. {tasking-2.0.0 → tasking-2.1.0}/PKG-INFO +3 -3
  2. {tasking-2.0.0 → tasking-2.1.0}/README.rst +1 -1
  3. {tasking-2.0.0 → tasking-2.1.0}/doc/conf.py +2 -2
  4. {tasking-2.0.0 → tasking-2.1.0}/doc/readme.rst +1 -1
  5. {tasking-2.0.0 → tasking-2.1.0}/pyproject.toml +2 -2
  6. {tasking-2.0.0 → tasking-2.1.0}/src/tasking/task.py +4 -1
  7. {tasking-2.0.0 → tasking-2.1.0}/src/tasking/version.py +1 -1
  8. {tasking-2.0.0 → tasking-2.1.0}/src/tasking.egg-info/PKG-INFO +3 -3
  9. {tasking-2.0.0 → tasking-2.1.0}/test/test_task.py +17 -13
  10. {tasking-2.0.0 → tasking-2.1.0}/AUTHORS.rst +0 -0
  11. {tasking-2.0.0 → tasking-2.1.0}/CONTRIBUTING.rst +0 -0
  12. {tasking-2.0.0 → tasking-2.1.0}/HISTORY.rst +0 -0
  13. {tasking-2.0.0 → tasking-2.1.0}/LICENSE +0 -0
  14. {tasking-2.0.0 → tasking-2.1.0}/doc/Makefile +0 -0
  15. {tasking-2.0.0 → tasking-2.1.0}/doc/authors.rst +0 -0
  16. {tasking-2.0.0 → tasking-2.1.0}/doc/badges/listing.rst +0 -0
  17. {tasking-2.0.0 → tasking-2.1.0}/doc/biblio/biblio.rst +0 -0
  18. {tasking-2.0.0 → tasking-2.1.0}/doc/contributing.rst +0 -0
  19. {tasking-2.0.0 → tasking-2.1.0}/doc/history.rst +0 -0
  20. {tasking-2.0.0 → tasking-2.1.0}/doc/index.rst +0 -0
  21. {tasking-2.0.0 → tasking-2.1.0}/doc/installation.rst +0 -0
  22. {tasking-2.0.0 → tasking-2.1.0}/doc/make.bat +0 -0
  23. {tasking-2.0.0 → tasking-2.1.0}/doc/management.rst +0 -0
  24. {tasking-2.0.0 → tasking-2.1.0}/doc/usage.rst +0 -0
  25. {tasking-2.0.0 → tasking-2.1.0}/doc/user/index.rst +0 -0
  26. {tasking-2.0.0 → tasking-2.1.0}/doc/user/overview.rst +0 -0
  27. {tasking-2.0.0 → tasking-2.1.0}/requirements.txt +0 -0
  28. {tasking-2.0.0 → tasking-2.1.0}/requirements_minimal.txt +0 -0
  29. {tasking-2.0.0 → tasking-2.1.0}/setup.cfg +0 -0
  30. {tasking-2.0.0 → tasking-2.1.0}/src/tasking/__init__.py +0 -0
  31. {tasking-2.0.0 → tasking-2.1.0}/src/tasking/scheduler.py +0 -0
  32. {tasking-2.0.0 → tasking-2.1.0}/src/tasking.egg-info/SOURCES.txt +0 -0
  33. {tasking-2.0.0 → tasking-2.1.0}/src/tasking.egg-info/dependency_links.txt +0 -0
  34. {tasking-2.0.0 → tasking-2.1.0}/src/tasking.egg-info/requires.txt +0 -0
  35. {tasking-2.0.0 → tasking-2.1.0}/src/tasking.egg-info/top_level.txt +0 -0
  36. {tasking-2.0.0 → tasking-2.1.0}/test/conftest.py +0 -0
  37. {tasking-2.0.0 → tasking-2.1.0}/test/test_packaging.py +0 -0
  38. {tasking-2.0.0 → tasking-2.1.0}/test/test_scheduler.py +0 -0
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tasking
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Perform time simulation, using scheduled tasks to update current state
5
5
  Author-email: revesansparole <revesansparole@gmail.com>
6
6
  Maintainer-email: revesansparole <revesansparole@gmail.com>, Jerome Chopard <revesansparole@gmail.com>
7
7
  License: cc_by_nc
8
8
  Project-URL: repository, https://gitlab.com/revesansparole/tasking
9
- Project-URL: pip, https://pypi.org/project/tasking/2.0.0/
9
+ Project-URL: pip, https://pypi.org/project/tasking/2.1.0/
10
10
  Project-URL: conda, https://anaconda.org/revesansparole/tasking
11
11
  Project-URL: documentation, https://revesansparole.gitlab.io/tasking/
12
12
  Project-URL: pypi, https://badge.fury.io/py/tasking
@@ -48,7 +48,7 @@ tasking
48
48
 
49
49
  .. image:: https://revesansparole.gitlab.io/tasking/_images/badge_pkging_pip.svg
50
50
  :alt: PyPI version
51
- :target: https://pypi.org/project/tasking/2.0.0/
51
+ :target: https://pypi.org/project/tasking/2.1.0/
52
52
 
53
53
  .. image:: https://revesansparole.gitlab.io/tasking/_images/badge_pkging_conda.svg
54
54
  :alt: Conda version
@@ -6,7 +6,7 @@ tasking
6
6
 
7
7
  .. image:: https://revesansparole.gitlab.io/tasking/_images/badge_pkging_pip.svg
8
8
  :alt: PyPI version
9
- :target: https://pypi.org/project/tasking/2.0.0/
9
+ :target: https://pypi.org/project/tasking/2.1.0/
10
10
 
11
11
  .. image:: https://revesansparole.gitlab.io/tasking/_images/badge_pkging_conda.svg
12
12
  :alt: Conda version
@@ -89,9 +89,9 @@ copyright = "2021, tasking"
89
89
  #
90
90
 
91
91
  # The short X.Y version.
92
- version = "2.0.0"
92
+ version = "2.1.0"
93
93
  # The full version, including alpha/beta/rc tags.
94
- release = "2.0.0"
94
+ release = "2.1.0"
95
95
 
96
96
 
97
97
  exclude_patterns = ['build', 'dist']
@@ -5,7 +5,7 @@ Overview
5
5
 
6
6
  .. image:: https://revesansparole.gitlab.io/tasking/_images/badge_pkging_pip.svg
7
7
  :alt: PyPI version
8
- :target: https://pypi.org/project/tasking/2.0.0/
8
+ :target: https://pypi.org/project/tasking/2.1.0/
9
9
 
10
10
 
11
11
  .. image:: https://revesansparole.gitlab.io/tasking/_images/badge_pkging_conda.svg
@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta" # we don't know if we need it
8
8
  # {# pkglts, pyproject.project
9
9
  [project] # https://packaging.python.org/en/latest/specifications/pyproject-toml/
10
10
  name = "tasking"
11
- version = "2.0.0"
11
+ version = "2.1.0"
12
12
  description = "Perform time simulation, using scheduled tasks to update current state"
13
13
  readme = "README.rst"
14
14
  requires-python = ">= 3.7"
@@ -59,7 +59,7 @@ test = [
59
59
 
60
60
  [project.urls]
61
61
  repository = "https://gitlab.com/revesansparole/tasking"
62
- pip = "https://pypi.org/project/tasking/2.0.0/"
62
+ pip = "https://pypi.org/project/tasking/2.1.0/"
63
63
  conda = "https://anaconda.org/revesansparole/tasking"
64
64
  documentation = "https://revesansparole.gitlab.io/tasking/"
65
65
  pypi = "https://badge.fury.io/py/tasking"
@@ -84,7 +84,10 @@ class TaskCached(Task):
84
84
  self.need_update(clock, prev_clock, state, params)
85
85
  self._need_update = False
86
86
 
87
- return clock + state.duration # TODO don't rely on state.duration
87
+ if clock == prev_clock:
88
+ return None # last call to this task
89
+
90
+ return clock + (clock - prev_clock) # heuristic to ensure this task is called each time step
88
91
 
89
92
  def need_update(self, clock, prev_clock, state, params):
90
93
  pass
@@ -9,7 +9,7 @@ Do not edit this file, use 'version' section of config.
9
9
  MAJOR = 2
10
10
  """(int) Version major component."""
11
11
 
12
- MINOR = 0
12
+ MINOR = 1
13
13
  """(int) Version minor component."""
14
14
 
15
15
  POST = 0
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tasking
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Perform time simulation, using scheduled tasks to update current state
5
5
  Author-email: revesansparole <revesansparole@gmail.com>
6
6
  Maintainer-email: revesansparole <revesansparole@gmail.com>, Jerome Chopard <revesansparole@gmail.com>
7
7
  License: cc_by_nc
8
8
  Project-URL: repository, https://gitlab.com/revesansparole/tasking
9
- Project-URL: pip, https://pypi.org/project/tasking/2.0.0/
9
+ Project-URL: pip, https://pypi.org/project/tasking/2.1.0/
10
10
  Project-URL: conda, https://anaconda.org/revesansparole/tasking
11
11
  Project-URL: documentation, https://revesansparole.gitlab.io/tasking/
12
12
  Project-URL: pypi, https://badge.fury.io/py/tasking
@@ -48,7 +48,7 @@ tasking
48
48
 
49
49
  .. image:: https://revesansparole.gitlab.io/tasking/_images/badge_pkging_pip.svg
50
50
  :alt: PyPI version
51
- :target: https://pypi.org/project/tasking/2.0.0/
51
+ :target: https://pypi.org/project/tasking/2.1.0/
52
52
 
53
53
  .. image:: https://revesansparole.gitlab.io/tasking/_images/badge_pkging_conda.svg
54
54
  :alt: Conda version
@@ -1,17 +1,13 @@
1
1
  from tasking.task import TaskCached, TaskRecord
2
2
 
3
3
 
4
- class TotoState:
5
- duration: int = 1
6
-
7
-
8
4
  class Toto(TaskCached):
9
5
  def __init__(self):
10
6
  super().__init__()
11
7
  self.a = -1
12
8
 
13
- def need_update(self, t, prev_t, state, params):
14
- self.a = t
9
+ def need_update(self, clock, prev_clock, state, params):
10
+ self.a = clock
15
11
 
16
12
 
17
13
  def test_task_record_stores_data():
@@ -38,16 +34,24 @@ def test_task_cached_only_update_when_required():
38
34
  t = Toto()
39
35
  assert t.a == -1
40
36
 
41
- state = TotoState()
42
- next_t = t.update(0, None, state, None)
43
- assert next_t == 1
37
+ prev_clock = -1
38
+ clock = 0
39
+ next_clock = t.update(clock, prev_clock, None, None)
40
+ assert next_clock == 1
44
41
  assert t.a == 0
45
42
 
46
- next_t = t.update(next_t, None, state, None)
47
- assert next_t == 2
43
+ prev_clock = clock
44
+ clock = next_clock
45
+ next_clock = t.update(clock, prev_clock, None, None)
46
+ assert next_clock == 2
48
47
  assert t.a == 0
49
48
 
50
49
  t.invalidate()
51
- next_t = t.update(next_t, None, state, None)
52
- assert next_t == 3
50
+ prev_clock = clock
51
+ clock = next_clock
52
+ next_clock = t.update(clock, prev_clock, None, None)
53
+ assert next_clock == 3
53
54
  assert t.a == 2
55
+
56
+ clock = next_clock
57
+ assert t.update(clock, clock, None, None) is None
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes