python-redux 0.25.4__tar.gz → 0.25.5.dev126050210397555751__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 (24) hide show
  1. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/PKG-INFO +29 -27
  2. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/README.md +28 -26
  3. python_redux-0.25.5.dev126050210397555751/redux/_version.py +24 -0
  4. python_redux-0.25.4/redux/_version.py +0 -34
  5. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/.gitignore +0 -0
  6. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/LICENSE +0 -0
  7. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/pyproject.toml +0 -0
  8. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux/__init__.py +0 -0
  9. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux/autorun.py +0 -0
  10. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux/basic_types.py +0 -0
  11. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux/combine_reducers.py +0 -0
  12. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux/main.py +0 -0
  13. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux/py.typed +0 -0
  14. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux/serialization_mixin.py +0 -0
  15. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux/side_effect_runner.py +0 -0
  16. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux/utils.py +0 -0
  17. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux_pytest/__init__.py +0 -0
  18. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux_pytest/fixtures/__init__.py +0 -0
  19. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux_pytest/fixtures/event_loop.py +0 -0
  20. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux_pytest/fixtures/monitor.py +0 -0
  21. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux_pytest/fixtures/snapshot.py +0 -0
  22. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux_pytest/fixtures/store.py +0 -0
  23. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux_pytest/fixtures/wait_for.py +0 -0
  24. {python_redux-0.25.4 → python_redux-0.25.5.dev126050210397555751}/redux_pytest/plugin.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-redux
3
- Version: 0.25.4
3
+ Version: 0.25.5.dev126050210397555751
4
4
  Summary: Redux implementation for Python
5
5
  Project-URL: homepage, https://github.com/sassanh/python-redux/
6
6
  Project-URL: repository, https://github.com/sassanh/python-redux/
@@ -98,34 +98,36 @@ def reducer(
98
98
  ),
99
99
  ],
100
100
  )
101
- if isinstance(action, AddTodoItemAction):
102
- return replace(
103
- state,
104
- items=[
105
- *state.items,
106
- ToDoItem(
107
- id=uuid.uuid4().hex,
108
- content=action.content,
109
- ),
110
- ],
111
- )
112
- if isinstance(action, RemoveTodoItemAction):
113
- return replace(
114
- state,
115
- actions=[item for item in state.items if item.id != action.id],
116
- )
117
- if isinstance(action, MarkTodoItemDone):
118
- return CompleteReducerResult(
119
- state=replace(
101
+ match action:
102
+ case AddTodoItemAction():
103
+ return replace(
120
104
  state,
121
105
  items=[
122
- replace(item, is_done=True) if item.id == action.id else item
123
- for item in state.items
106
+ *state.items,
107
+ ToDoItem(
108
+ id=uuid.uuid4().hex,
109
+ content=action.content,
110
+ ),
124
111
  ],
125
- ),
126
- events=[CallApi(parameters={})],
127
- )
128
- return state
112
+ )
113
+ case RemoveTodoItemAction():
114
+ return replace(
115
+ state,
116
+ actions=[item for item in state.items if item.id != action.id],
117
+ )
118
+ case MarkTodoItemDone():
119
+ return CompleteReducerResult(
120
+ state=replace(
121
+ state,
122
+ items=[
123
+ replace(item, is_done=True) if item.id == action.id else item
124
+ for item in state.items
125
+ ],
126
+ ),
127
+ events=[CallApi(parameters={})],
128
+ )
129
+ case _:
130
+ return state
129
131
 
130
132
 
131
133
  store = Store(reducer)
@@ -177,7 +179,7 @@ store.dispatch(FinishAction())
177
179
  - Reduce boilerplate by dropping `type` property, payload classes and action creators:
178
180
 
179
181
  - Each action is a subclass of `BaseAction`.
180
- - Its type is checked by utilizing `isinstance` (no need for `type` property).
182
+ - Its type is checked by using Python's `match` statement (no need for `type` property).
181
183
  - Its payload are its direct properties (no need for a separate `payload` object).
182
184
  - Its creator is its auto-generated constructor.
183
185
 
@@ -75,34 +75,36 @@ def reducer(
75
75
  ),
76
76
  ],
77
77
  )
78
- if isinstance(action, AddTodoItemAction):
79
- return replace(
80
- state,
81
- items=[
82
- *state.items,
83
- ToDoItem(
84
- id=uuid.uuid4().hex,
85
- content=action.content,
86
- ),
87
- ],
88
- )
89
- if isinstance(action, RemoveTodoItemAction):
90
- return replace(
91
- state,
92
- actions=[item for item in state.items if item.id != action.id],
93
- )
94
- if isinstance(action, MarkTodoItemDone):
95
- return CompleteReducerResult(
96
- state=replace(
78
+ match action:
79
+ case AddTodoItemAction():
80
+ return replace(
97
81
  state,
98
82
  items=[
99
- replace(item, is_done=True) if item.id == action.id else item
100
- for item in state.items
83
+ *state.items,
84
+ ToDoItem(
85
+ id=uuid.uuid4().hex,
86
+ content=action.content,
87
+ ),
101
88
  ],
102
- ),
103
- events=[CallApi(parameters={})],
104
- )
105
- return state
89
+ )
90
+ case RemoveTodoItemAction():
91
+ return replace(
92
+ state,
93
+ actions=[item for item in state.items if item.id != action.id],
94
+ )
95
+ case MarkTodoItemDone():
96
+ return CompleteReducerResult(
97
+ state=replace(
98
+ state,
99
+ items=[
100
+ replace(item, is_done=True) if item.id == action.id else item
101
+ for item in state.items
102
+ ],
103
+ ),
104
+ events=[CallApi(parameters={})],
105
+ )
106
+ case _:
107
+ return state
106
108
 
107
109
 
108
110
  store = Store(reducer)
@@ -154,7 +156,7 @@ store.dispatch(FinishAction())
154
156
  - Reduce boilerplate by dropping `type` property, payload classes and action creators:
155
157
 
156
158
  - Each action is a subclass of `BaseAction`.
157
- - Its type is checked by utilizing `isinstance` (no need for `type` property).
159
+ - Its type is checked by using Python's `match` statement (no need for `type` property).
158
160
  - Its payload are its direct properties (no need for a separate `payload` object).
159
161
  - Its creator is its auto-generated constructor.
160
162
 
@@ -0,0 +1,24 @@
1
+ # file generated by vcs-versioning
2
+ # don't change, don't track in version control
3
+ from __future__ import annotations
4
+
5
+ __all__ = [
6
+ "__version__",
7
+ "__version_tuple__",
8
+ "version",
9
+ "version_tuple",
10
+ "__commit_id__",
11
+ "commit_id",
12
+ ]
13
+
14
+ version: str
15
+ __version__: str
16
+ __version_tuple__: tuple[int | str, ...]
17
+ version_tuple: tuple[int | str, ...]
18
+ commit_id: str | None
19
+ __commit_id__: str | None
20
+
21
+ __version__ = version = '0.25.5.dev126050210397555751'
22
+ __version_tuple__ = version_tuple = (0, 25, 5, 'dev126050210397555751')
23
+
24
+ __commit_id__ = commit_id = None
@@ -1,34 +0,0 @@
1
- # file generated by setuptools-scm
2
- # don't change, don't track in version control
3
-
4
- __all__ = [
5
- "__version__",
6
- "__version_tuple__",
7
- "version",
8
- "version_tuple",
9
- "__commit_id__",
10
- "commit_id",
11
- ]
12
-
13
- TYPE_CHECKING = False
14
- if TYPE_CHECKING:
15
- from typing import Tuple
16
- from typing import Union
17
-
18
- VERSION_TUPLE = Tuple[Union[int, str], ...]
19
- COMMIT_ID = Union[str, None]
20
- else:
21
- VERSION_TUPLE = object
22
- COMMIT_ID = object
23
-
24
- version: str
25
- __version__: str
26
- __version_tuple__: VERSION_TUPLE
27
- version_tuple: VERSION_TUPLE
28
- commit_id: COMMIT_ID
29
- __commit_id__: COMMIT_ID
30
-
31
- __version__ = version = '0.25.4'
32
- __version_tuple__ = version_tuple = (0, 25, 4)
33
-
34
- __commit_id__ = commit_id = None