Skip to content

Commit

Permalink
format snake case PLEASE
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiDuncan committed Nov 26, 2023
1 parent 9547299 commit b54e1c3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
4 changes: 2 additions & 2 deletions sizebot/cogs/change.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async def eatme(self, ctx):

userdata = userdb.load(guildid, userid)
randmult = round(random.randint(2, 20), 1)
proportions.changeUser(guildid, userid, "multiply", randmult)
proportions.change_user(guildid, userid, "multiply", randmult)
await nickmanager.nick_update(ctx.author)
userdata = userdb.load(guildid, userid)

Expand All @@ -156,7 +156,7 @@ async def drinkme(self, ctx):

userdata = userdb.load(guildid, userid)
randmult = round(random.randint(2, 20), 1)
proportions.changeUser(guildid, ctx.author.id, "divide", randmult)
proportions.change_user(guildid, ctx.author.id, "divide", randmult)
await nickmanager.nick_update(ctx.author)
userdata = userdb.load(guildid, userid)

Expand Down
24 changes: 11 additions & 13 deletions sizebot/lib/proportions.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@


class Stat:
def __init__(self, name:str,
sets:Optional[str]=None,
userkey:Optional[str]=None,
default_from:Optional[Callable]=None,
power:Optional[int]=None,
requires:list[str]=None):
def __init__(self, name: str,
sets: Optional[str] = None,
userkey: Optional[str] = None,
default_from: Optional[Callable] = None,
power: Optional[int] = None,
requires: list[str] = None):
self.sets = sets
self.requires = requires or []
self.power = power
Expand All @@ -56,7 +56,7 @@ def set(self, user):
if self.default_from is not None and value is None:
value = self.default_from(user.baseheight)
return StatValue(self, value)

def scale_value(self, value, scale):
if self.power is None:
raise NotImplementedError
Expand All @@ -70,7 +70,7 @@ def __init__(self, stat: Stat, value: any):

def scale(self, scale):
return self.stat.scale_value(self.value, scale)

def __str__(self):
return f"{self.stat.name}: {self.value}"

Expand Down Expand Up @@ -125,11 +125,9 @@ def __str__(self):
Stat("Visibility", sets="visibility", requires=["height"], default_from=lambda s: calcVisibility(s["height"]))
]

# allStatValues = [
# s.set(user) for s in allStats
# ]

def changeUser(guildid: int, userid: int, changestyle: str, amount: SV):

def change_user(guildid: int, userid: int, changestyle: str, amount: SV):
changestyle = changestyle.lower()
if changestyle in ["add", "+", "a", "plus"]:
changestyle = "add"
Expand Down Expand Up @@ -977,4 +975,4 @@ def calcVisibility(height: SV):
visibility = "a magnifying glass"
else:
visibility = "only the naked eye"
return visibility
return visibility

0 comments on commit b54e1c3

Please sign in to comment.