diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 445c21f..8aa8066 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,18 +36,23 @@ Now you're ready to make changes to `src/fsrs` and see your changes reflected im This project follows [semantic versioning](https://semver.org/), so please make sure to increment the version number in [pyproject.toml](pyproject.toml) when contributing new code. -### Format and test +### Lint, format and test -Py-FSRS follows the [black](https://github.com/psf/black) code formatting style and uses [pytest](https://docs.pytest.org) to run its tests. In order for your contribution to be accepted, your code must be properly formatted and be able to pass the tests. +Py-FSRS uses [Ruff](https://github.com/astral-sh/ruff) for linting and formatting and uses [pytest](https://docs.pytest.org) to run its tests. In order for your contribution to be accepted, your code must pass linting/formatting checks and be able to pass the tests. You can install these packages with ``` -pip install black pytest +pip install ruff pytest +``` + +Lint your code with: +``` +ruff check --fix ``` Format your code with: ``` -black . +ruff format ``` Run the tests with: diff --git a/README.md b/README.md index 6d1c230..3d86439 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@
- +

@@ -177,8 +177,4 @@ Rating.Easy # recall; perfect response ## Contribute -Checkout [CONTRIBUTING](CONTRIBUTING.md) to help improve Py-FSRS! - -## License - -Distributed under the MIT License. See [LICENSE](LICENSE) for more information. +Checkout [CONTRIBUTING](CONTRIBUTING.md) to help improve Py-FSRS! \ No newline at end of file diff --git a/src/fsrs/fsrs.py b/src/fsrs/fsrs.py index 0d211c7..2259060 100644 --- a/src/fsrs/fsrs.py +++ b/src/fsrs/fsrs.py @@ -22,7 +22,6 @@ def __init__( def review_card( self, card: Card, rating: Rating, now: Optional[datetime] = None ) -> tuple[Card, ReviewLog]: - scheduling_cards = self.repeat(card, now) card = scheduling_cards[rating].card @@ -30,8 +29,9 @@ def review_card( return card, review_log - def repeat(self, card: Card, now: Optional[datetime] = None) -> dict[int, SchedulingInfo]: - + def repeat( + self, card: Card, now: Optional[datetime] = None + ) -> dict[int, SchedulingInfo]: if now is None: now = datetime.now(timezone.utc) diff --git a/tests/test_fsrs.py b/tests/test_fsrs.py index 7ea270b..23134c9 100644 --- a/tests/test_fsrs.py +++ b/tests/test_fsrs.py @@ -17,7 +17,6 @@ def print_scheduling_cards(scheduling_cards): class TestPyFSRS: - def test_repeat(self): f = FSRS() f.p.w = ( @@ -73,7 +72,6 @@ def test_repeat(self): assert ivl_history == [0, 5, 16, 43, 106, 236, 0, 0, 12, 25, 47, 85, 147] def test_repeat_default_arg(self): - f = FSRS() card_object = Card() @@ -92,7 +90,6 @@ def test_repeat_default_arg(self): assert time_delta.seconds > 500 # due in approx. 8-10 minutes def test_datetime(self): - f = FSRS() card = Card() @@ -118,7 +115,6 @@ def test_datetime(self): assert card.due >= card.last_review def test_Card_serialize(self): - f = FSRS() # create card object the normal way @@ -158,7 +154,6 @@ def test_Card_serialize(self): assert card.to_dict() != repeated_card.to_dict() def test_ReviewLog_serialize(self): - f = FSRS() card = Card() @@ -204,7 +199,6 @@ def test_ReviewLog_serialize(self): assert review_log.to_dict() != next_review_log.to_dict() def test_review_card(self): - f = FSRS() f.p.w = ( 1.14, @@ -260,7 +254,6 @@ def test_review_card(self): assert ivl_history == [0, 5, 16, 43, 106, 236, 0, 0, 12, 25, 47, 85, 147] def test_custom_scheduler_args(self): - f = FSRS( w=( 1.14,