From 087c16000667782da8f77d06b651c127734ac02b Mon Sep 17 00:00:00 2001 From: Steve C Date: Sun, 29 Sep 2024 03:26:10 -0400 Subject: [PATCH] remove numpy --- examples/max_ter_example.py | 9 +++++---- neofoodclub/__init__.py | 2 -- neofoodclub/utils.py | 28 ---------------------------- requirements.txt | 1 - requirements_dev.txt | 1 - tests/test_neofoodclub.py | 19 ------------------- 6 files changed, 5 insertions(+), 55 deletions(-) delete mode 100644 neofoodclub/utils.py diff --git a/examples/max_ter_example.py b/examples/max_ter_example.py index 716de40..893706d 100644 --- a/examples/max_ter_example.py +++ b/examples/max_ter_example.py @@ -1,4 +1,4 @@ -from neofoodclub import NeoFoodClub +from neofoodclub import Modifier, NeoFoodClub if __name__ == "__main__": # if you happen to have a valid "loaded" NeoFoodClub URL handy, @@ -13,11 +13,12 @@ # generate max TER bets tailored to your bet amount max_ter_bets = nfc.make_max_ter_bets() - print(nfc.make_url(max_ter_bets)) + print(nfc.make_url(bets=max_ter_bets)) # let's say Charity Corner (https://www.jellyneo.net/?go=charity_corner) is back up and you've got the FC perk! # we can generate 15 bets if you just tell the modifier to do so! - nfc.modifier.cc_perk = True + # nfc.modifier.cc_perk = True + nfc.with_modifier(Modifier(Modifier.CHARITY_CORNER)) max_ter_bets = nfc.make_max_ter_bets() - print(nfc.make_url(max_ter_bets)) + print(nfc.make_url(bets=max_ter_bets)) diff --git a/neofoodclub/__init__.py b/neofoodclub/__init__.py index ba849f2..394f05f 100644 --- a/neofoodclub/__init__.py +++ b/neofoodclub/__init__.py @@ -6,7 +6,6 @@ from .neofoodclub import * # noqa from .probability_model import * # noqa -from .utils import * # noqa __all__ = ( # noqa "Math", @@ -20,5 +19,4 @@ "Pirate", "PartialPirate", "ProbabilityModel", - "utils", ) diff --git a/neofoodclub/utils.py b/neofoodclub/utils.py deleted file mode 100644 index 0ca2347..0000000 --- a/neofoodclub/utils.py +++ /dev/null @@ -1,28 +0,0 @@ -import numpy as np - -from neofoodclub import Bets, NeoFoodClub - -# fmt: off -__all__ = ( - "make_max_ter_bets_numpy", -) -# fmt: on - - -def make_max_ter_bets_numpy(nfc: NeoFoodClub) -> Bets: - """A convenience method to make max-ter bets with numpy. - - The way to implement the underlying sorting algorithm that - numpy uses for argsort escapes me, so in the meantime, - we just use it. - - We do this because somehow it's got the best ROI. - """ - - values = nfc.max_ters() - sorted_values = np.argsort(values) - - if not nfc.modifier.is_reverse: - sorted_values = sorted_values[::-1] - - return nfc.make_bets_from_array_indices(sorted_values[: nfc.max_amount_of_bets]) # type: ignore diff --git a/requirements.txt b/requirements.txt index a4cdf40..ee983b0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -numpy<2.0.0 orjson python-dateutil setuptools-rust diff --git a/requirements_dev.txt b/requirements_dev.txt index 02ef70b..33c5305 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,5 +1,4 @@ coverage -numpy<2.0.0 orjson pytest python-dateutil diff --git a/tests/test_neofoodclub.py b/tests/test_neofoodclub.py index f53db9f..0b06a1d 100644 --- a/tests/test_neofoodclub.py +++ b/tests/test_neofoodclub.py @@ -5,7 +5,6 @@ import pytest from neofoodclub import Modifier, NeoFoodClub -from neofoodclub.utils import make_max_ter_bets_numpy def test_nfc_reset(nfc: NeoFoodClub) -> None: @@ -289,21 +288,3 @@ def test_error_cases_in_from_url(url: str) -> None: def test_make_url_kwargs(nfc: NeoFoodClub) -> None: assert nfc.make_url(include_domain=False) == f"/#round={nfc.round}" assert nfc.make_url() == f"https://neofood.club/#round={nfc.round}" - - -def test_make_bets_with_numpy(test_round_data_round_7315: str) -> None: - nfc = NeoFoodClub.from_json(test_round_data_round_7315, bet_amount=8000) - bets = make_max_ter_bets_numpy(nfc) - - assert bets.bets_hash == "cauueepukadauujbauuacpauy" - - -def test_make_bets_with_numpy_reverse(test_round_data_round_7315: str) -> None: - nfc = NeoFoodClub.from_json( - test_round_data_round_7315, - bet_amount=8000, - modifier=Modifier(Modifier.REVERSE), - ) - bets = make_max_ter_bets_numpy(nfc) - - assert bets.bets_hash == "kwrekuwnemuwieluwsenuwdek"