mirror of
https://github.com/onyx-and-iris/lottery-tui.git
synced 2026-02-26 02:59:10 +00:00
get Result kind name from class type, it's more flexible to change.
patch bump
This commit is contained in:
parent
67b3887bc8
commit
56028b2c52
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "lottery-tui"
|
name = "lottery-tui"
|
||||||
version = "0.2.4"
|
version = "0.2.5"
|
||||||
description = "A terminal user interface for lottery games."
|
description = "A terminal user interface for lottery games."
|
||||||
authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
|
authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
|
||||||
dependencies = ["textual>=8.0.0", "loguru>=0.7.3"]
|
dependencies = ["textual>=8.0.0", "loguru>=0.7.3"]
|
||||||
@ -13,6 +13,7 @@ classifiers = [
|
|||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
"Programming Language :: Python :: 3.12",
|
"Programming Language :: Python :: 3.12",
|
||||||
|
"Programming Language :: Python :: 3.13",
|
||||||
"Programming Language :: Python :: Implementation :: CPython",
|
"Programming Language :: Python :: Implementation :: CPython",
|
||||||
"Programming Language :: Python :: Implementation :: PyPy",
|
"Programming Language :: Python :: Implementation :: PyPy",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -45,10 +45,10 @@ class Lottery(ABC):
|
|||||||
|
|
||||||
|
|
||||||
@register_lottery
|
@register_lottery
|
||||||
class UKlotto(Lottery):
|
class UKLotto(Lottery):
|
||||||
"""A class representing the UK Lotto lottery.
|
"""A class representing the UK Lotto lottery.
|
||||||
|
|
||||||
Uk Lotto draws 6 numbers from a pool of 1 to 59, without replacement.
|
UK Lotto draws 6 numbers from a pool of 1 to 59, without replacement.
|
||||||
There is no bonus number in UK Lotto.
|
There is no bonus number in UK Lotto.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -56,8 +56,8 @@ class UKlotto(Lottery):
|
|||||||
|
|
||||||
def draw(self) -> Result:
|
def draw(self) -> Result:
|
||||||
"""Perform a UK Lotto draw."""
|
"""Perform a UK Lotto draw."""
|
||||||
result = random.sample(UKlotto.POSSIBLE_NUMBERS, 6)
|
result = random.sample(UKLotto.POSSIBLE_NUMBERS, 6)
|
||||||
return Result(kind='UK Lotto', numbers=result, bonus=None)
|
return Result(kind=type(self).__name__, numbers=result, bonus=None)
|
||||||
|
|
||||||
|
|
||||||
@register_lottery
|
@register_lottery
|
||||||
@ -75,7 +75,7 @@ class EuroMillions(Lottery):
|
|||||||
"""Perform a EuroMillions draw."""
|
"""Perform a EuroMillions draw."""
|
||||||
numbers = random.sample(EuroMillions.POSSIBLE_NUMBERS, 5)
|
numbers = random.sample(EuroMillions.POSSIBLE_NUMBERS, 5)
|
||||||
bonus = random.sample(EuroMillions.POSSIBLE_BONUS_NUMBERS, 2)
|
bonus = random.sample(EuroMillions.POSSIBLE_BONUS_NUMBERS, 2)
|
||||||
return Result(kind='EuroMillions', numbers=numbers, bonus=bonus)
|
return Result(kind=type(self).__name__, numbers=numbers, bonus=bonus)
|
||||||
|
|
||||||
|
|
||||||
@register_lottery
|
@register_lottery
|
||||||
@ -92,7 +92,7 @@ class SetForLife(Lottery):
|
|||||||
"""Perform a Set For Life draw."""
|
"""Perform a Set For Life draw."""
|
||||||
numbers = random.sample(SetForLife.POSSIBLE_NUMBERS, 5)
|
numbers = random.sample(SetForLife.POSSIBLE_NUMBERS, 5)
|
||||||
life_ball = [random.randint(1, 10)]
|
life_ball = [random.randint(1, 10)]
|
||||||
return Result(kind='Set For Life', numbers=numbers, bonus=life_ball)
|
return Result(kind=type(self).__name__, numbers=numbers, bonus=life_ball)
|
||||||
|
|
||||||
|
|
||||||
@register_lottery
|
@register_lottery
|
||||||
@ -109,7 +109,7 @@ class Thunderball(Lottery):
|
|||||||
"""Perform a Thunderball draw."""
|
"""Perform a Thunderball draw."""
|
||||||
numbers = random.sample(Thunderball.POSSIBLE_NUMBERS, 5)
|
numbers = random.sample(Thunderball.POSSIBLE_NUMBERS, 5)
|
||||||
thunderball = [random.randint(1, 14)]
|
thunderball = [random.randint(1, 14)]
|
||||||
return Result(kind='Thunderball', numbers=numbers, bonus=thunderball)
|
return Result(kind=type(self).__name__, numbers=numbers, bonus=thunderball)
|
||||||
|
|
||||||
|
|
||||||
def request_lottery_obj(lottery_name: str) -> Lottery:
|
def request_lottery_obj(lottery_name: str) -> Lottery:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user