Skip to content

Commit

Permalink
not enough to be useful rn but I'm pushing anyway
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiDuncan committed Nov 25, 2023
1 parent cc789a9 commit ddd6fc8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions sizebot/lib/betterstats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from typing import Union
from decimal import Decimal
from sizebot.lib.units import SV, TV, WV
from sizebot.lib.userdb import User


Unit = Union[SV, TV, WV, Decimal, bool, str]

class Stat:
def __init__(self, key: str, name: str, equation: callable[[User], Unit], exponent: int = 1):
self.key = key
self.name = name
self.equation = equation
self.exponent = exponent

def from_user(self, user: User) -> Unit:
return self.equation(user)

0 comments on commit ddd6fc8

Please sign in to comment.