fsrs 2.2.0__tar.gz → 2.3.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.
- {fsrs-2.2.0/src/fsrs.egg-info → fsrs-2.3.0}/PKG-INFO +12 -4
- {fsrs-2.2.0 → fsrs-2.3.0}/README.md +11 -3
- {fsrs-2.2.0 → fsrs-2.3.0}/pyproject.toml +1 -1
- fsrs-2.3.0/src/fsrs/__init__.py +3 -0
- {fsrs-2.2.0 → fsrs-2.3.0}/src/fsrs/models.py +46 -17
- {fsrs-2.2.0 → fsrs-2.3.0/src/fsrs.egg-info}/PKG-INFO +12 -4
- {fsrs-2.2.0 → fsrs-2.3.0}/tests/test_fsrs.py +47 -1
- fsrs-2.2.0/src/fsrs/__init__.py +0 -5
- {fsrs-2.2.0 → fsrs-2.3.0}/LICENSE +0 -0
- {fsrs-2.2.0 → fsrs-2.3.0}/setup.cfg +0 -0
- {fsrs-2.2.0 → fsrs-2.3.0}/setup.py +0 -0
- {fsrs-2.2.0 → fsrs-2.3.0}/src/fsrs/fsrs.py +0 -0
- {fsrs-2.2.0 → fsrs-2.3.0}/src/fsrs.egg-info/SOURCES.txt +0 -0
- {fsrs-2.2.0 → fsrs-2.3.0}/src/fsrs.egg-info/dependency_links.txt +0 -0
- {fsrs-2.2.0 → fsrs-2.3.0}/src/fsrs.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fsrs
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
4
4
|
Summary: Free Spaced Repetition Scheduler
|
|
5
5
|
Author-email: Jarrett Ye <jarrett.ye@outlook.com>
|
|
6
6
|
License: MIT License
|
|
@@ -36,7 +36,11 @@ License-File: LICENSE
|
|
|
36
36
|
<div align="center">
|
|
37
37
|
<img src="https://avatars.githubusercontent.com/u/96821265?s=200&v=4" height="100" alt="Open Spaced Repetition logo"/>
|
|
38
38
|
</div>
|
|
39
|
-
<
|
|
39
|
+
<div align="center">
|
|
40
|
+
|
|
41
|
+
# Py-FSRS
|
|
42
|
+
|
|
43
|
+
</div>
|
|
40
44
|
<div align="center">
|
|
41
45
|
<em>🧠🔄 Build your own Spaced Repetition System in Python 🧠🔄 </em>
|
|
42
46
|
</div>
|
|
@@ -56,7 +60,7 @@ License-File: LICENSE
|
|
|
56
60
|
|
|
57
61
|
|
|
58
62
|
## Installation
|
|
59
|
-
You can install the `fsrs` python package from PyPI using pip:
|
|
63
|
+
You can install the `fsrs` python package from [PyPI](https://pypi.org/project/fsrs/) using pip:
|
|
60
64
|
```
|
|
61
65
|
pip install fsrs
|
|
62
66
|
```
|
|
@@ -143,6 +147,10 @@ Get the schdeduled days after rating a card
|
|
|
143
147
|
scheduled_days = card_object.scheduled_days
|
|
144
148
|
```
|
|
145
149
|
|
|
150
|
+
## Contribute
|
|
151
|
+
|
|
152
|
+
Checkout [CONTRIBUTING](CONTRIBUTING.md) to help improve Py-FSRS!
|
|
153
|
+
|
|
146
154
|
## License
|
|
147
155
|
|
|
148
|
-
Distributed under the MIT License. See
|
|
156
|
+
Distributed under the MIT License. See [LICENSE](LICENSE) for more information.
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<img src="https://avatars.githubusercontent.com/u/96821265?s=200&v=4" height="100" alt="Open Spaced Repetition logo"/>
|
|
3
3
|
</div>
|
|
4
|
-
<
|
|
4
|
+
<div align="center">
|
|
5
|
+
|
|
6
|
+
# Py-FSRS
|
|
7
|
+
|
|
8
|
+
</div>
|
|
5
9
|
<div align="center">
|
|
6
10
|
<em>🧠🔄 Build your own Spaced Repetition System in Python 🧠🔄 </em>
|
|
7
11
|
</div>
|
|
@@ -21,7 +25,7 @@
|
|
|
21
25
|
|
|
22
26
|
|
|
23
27
|
## Installation
|
|
24
|
-
You can install the `fsrs` python package from PyPI using pip:
|
|
28
|
+
You can install the `fsrs` python package from [PyPI](https://pypi.org/project/fsrs/) using pip:
|
|
25
29
|
```
|
|
26
30
|
pip install fsrs
|
|
27
31
|
```
|
|
@@ -108,6 +112,10 @@ Get the schdeduled days after rating a card
|
|
|
108
112
|
scheduled_days = card_object.scheduled_days
|
|
109
113
|
```
|
|
110
114
|
|
|
115
|
+
## Contribute
|
|
116
|
+
|
|
117
|
+
Checkout [CONTRIBUTING](CONTRIBUTING.md) to help improve Py-FSRS!
|
|
118
|
+
|
|
111
119
|
## License
|
|
112
120
|
|
|
113
|
-
Distributed under the MIT License. See
|
|
121
|
+
Distributed under the MIT License. See [LICENSE](LICENSE) for more information.
|
|
@@ -39,6 +39,35 @@ class ReviewLog:
|
|
|
39
39
|
self.review = review
|
|
40
40
|
self.state = state
|
|
41
41
|
|
|
42
|
+
def to_dict(self):
|
|
43
|
+
|
|
44
|
+
return_dict = {
|
|
45
|
+
"rating": self.rating,
|
|
46
|
+
"scheduled_days": self.scheduled_days,
|
|
47
|
+
"elapsed_days": self.elapsed_days,
|
|
48
|
+
"review": self.review.isoformat(),
|
|
49
|
+
"state": self.state,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return return_dict
|
|
53
|
+
|
|
54
|
+
@staticmethod
|
|
55
|
+
def from_dict(source_dict):
|
|
56
|
+
|
|
57
|
+
rating = source_dict["rating"]
|
|
58
|
+
scheduled_days = source_dict["scheduled_days"]
|
|
59
|
+
elapsed_days = source_dict["elapsed_days"]
|
|
60
|
+
review = datetime.fromisoformat(source_dict["review"])
|
|
61
|
+
state = source_dict["state"]
|
|
62
|
+
|
|
63
|
+
return ReviewLog(
|
|
64
|
+
rating,
|
|
65
|
+
scheduled_days,
|
|
66
|
+
elapsed_days,
|
|
67
|
+
review,
|
|
68
|
+
state,
|
|
69
|
+
)
|
|
70
|
+
|
|
42
71
|
|
|
43
72
|
class Card:
|
|
44
73
|
due: datetime
|
|
@@ -250,21 +279,21 @@ class Parameters:
|
|
|
250
279
|
self.request_retention = 0.9
|
|
251
280
|
self.maximum_interval = 36500
|
|
252
281
|
self.w = (
|
|
253
|
-
0.
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
0.
|
|
260
|
-
0.
|
|
261
|
-
1.
|
|
262
|
-
0.
|
|
263
|
-
|
|
264
|
-
2.
|
|
265
|
-
0.
|
|
266
|
-
0.
|
|
267
|
-
1.
|
|
268
|
-
0.
|
|
269
|
-
2.
|
|
282
|
+
0.4872,
|
|
283
|
+
1.4003,
|
|
284
|
+
3.7145,
|
|
285
|
+
13.8206,
|
|
286
|
+
5.1618,
|
|
287
|
+
1.2298,
|
|
288
|
+
0.8975,
|
|
289
|
+
0.031,
|
|
290
|
+
1.6474,
|
|
291
|
+
0.1367,
|
|
292
|
+
1.0461,
|
|
293
|
+
2.1072,
|
|
294
|
+
0.0793,
|
|
295
|
+
0.3246,
|
|
296
|
+
1.587,
|
|
297
|
+
0.2272,
|
|
298
|
+
2.8755,
|
|
270
299
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fsrs
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
4
4
|
Summary: Free Spaced Repetition Scheduler
|
|
5
5
|
Author-email: Jarrett Ye <jarrett.ye@outlook.com>
|
|
6
6
|
License: MIT License
|
|
@@ -36,7 +36,11 @@ License-File: LICENSE
|
|
|
36
36
|
<div align="center">
|
|
37
37
|
<img src="https://avatars.githubusercontent.com/u/96821265?s=200&v=4" height="100" alt="Open Spaced Repetition logo"/>
|
|
38
38
|
</div>
|
|
39
|
-
<
|
|
39
|
+
<div align="center">
|
|
40
|
+
|
|
41
|
+
# Py-FSRS
|
|
42
|
+
|
|
43
|
+
</div>
|
|
40
44
|
<div align="center">
|
|
41
45
|
<em>🧠🔄 Build your own Spaced Repetition System in Python 🧠🔄 </em>
|
|
42
46
|
</div>
|
|
@@ -56,7 +60,7 @@ License-File: LICENSE
|
|
|
56
60
|
|
|
57
61
|
|
|
58
62
|
## Installation
|
|
59
|
-
You can install the `fsrs` python package from PyPI using pip:
|
|
63
|
+
You can install the `fsrs` python package from [PyPI](https://pypi.org/project/fsrs/) using pip:
|
|
60
64
|
```
|
|
61
65
|
pip install fsrs
|
|
62
66
|
```
|
|
@@ -143,6 +147,10 @@ Get the schdeduled days after rating a card
|
|
|
143
147
|
scheduled_days = card_object.scheduled_days
|
|
144
148
|
```
|
|
145
149
|
|
|
150
|
+
## Contribute
|
|
151
|
+
|
|
152
|
+
Checkout [CONTRIBUTING](CONTRIBUTING.md) to help improve Py-FSRS!
|
|
153
|
+
|
|
146
154
|
## License
|
|
147
155
|
|
|
148
|
-
Distributed under the MIT License. See
|
|
156
|
+
Distributed under the MIT License. See [LICENSE](LICENSE) for more information.
|
|
@@ -117,7 +117,7 @@ class TestPyFSRS:
|
|
|
117
117
|
# card object's due datetime should be later than its last review
|
|
118
118
|
assert card.due >= card.last_review
|
|
119
119
|
|
|
120
|
-
def
|
|
120
|
+
def test_Card_serialize(self):
|
|
121
121
|
|
|
122
122
|
f = FSRS()
|
|
123
123
|
|
|
@@ -156,3 +156,49 @@ class TestPyFSRS:
|
|
|
156
156
|
# original card and repeated card are different
|
|
157
157
|
assert vars(card) != vars(repeated_card)
|
|
158
158
|
assert card.to_dict() != repeated_card.to_dict()
|
|
159
|
+
|
|
160
|
+
def test_ReviewLog_serialize(self):
|
|
161
|
+
|
|
162
|
+
f = FSRS()
|
|
163
|
+
|
|
164
|
+
card = Card()
|
|
165
|
+
|
|
166
|
+
# repeat a card to get the review_log
|
|
167
|
+
scheduling_cards = f.repeat(card)
|
|
168
|
+
rating = Rating.Again
|
|
169
|
+
card = scheduling_cards[rating].card
|
|
170
|
+
review_log = scheduling_cards[rating].review_log
|
|
171
|
+
|
|
172
|
+
# ReviewLog object is not naturally JSON serializable
|
|
173
|
+
with pytest.raises(TypeError):
|
|
174
|
+
json.dumps(review_log.__dict__)
|
|
175
|
+
|
|
176
|
+
# review_log object's to_dict() method makes it JSON serializable
|
|
177
|
+
assert type(json.dumps(review_log.to_dict())) == str
|
|
178
|
+
|
|
179
|
+
# we can reconstruct a copy of the review_log object equivalent to the original
|
|
180
|
+
review_log_dict = review_log.to_dict()
|
|
181
|
+
copied_review_log = ReviewLog.from_dict(review_log_dict)
|
|
182
|
+
assert vars(review_log) == vars(copied_review_log)
|
|
183
|
+
assert review_log.to_dict() == copied_review_log.to_dict()
|
|
184
|
+
|
|
185
|
+
# (x2) perform the above tests once more with a review_log from a repeated card
|
|
186
|
+
scheduling_cards = f.repeat(card, datetime.now(timezone.utc))
|
|
187
|
+
rating = Rating.Good
|
|
188
|
+
card = scheduling_cards[rating].card
|
|
189
|
+
next_review_log = scheduling_cards[rating].review_log
|
|
190
|
+
|
|
191
|
+
with pytest.raises(TypeError):
|
|
192
|
+
json.dumps(next_review_log.__dict__)
|
|
193
|
+
|
|
194
|
+
assert type(json.dumps(next_review_log.to_dict())) == str
|
|
195
|
+
|
|
196
|
+
next_review_log_dict = next_review_log.to_dict()
|
|
197
|
+
copied_next_review_log = ReviewLog.from_dict(next_review_log_dict)
|
|
198
|
+
|
|
199
|
+
assert vars(next_review_log) == vars(copied_next_review_log)
|
|
200
|
+
assert next_review_log.to_dict() == copied_next_review_log.to_dict()
|
|
201
|
+
|
|
202
|
+
# original review log and next review log are different
|
|
203
|
+
assert vars(review_log) != vars(next_review_log)
|
|
204
|
+
assert review_log.to_dict() != next_review_log.to_dict()
|
fsrs-2.2.0/src/fsrs/__init__.py
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|