Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcery AI committed Jan 17, 2024
1 parent 60aa524 commit d1b1ff9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
5 changes: 1 addition & 4 deletions tests/plugins/HydroRoll/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ def _init_directory(_prefix: str = ''):


def _load_models():
models = {}
models['hola'] = joblib.load(
join(HYDRO_DIR, 'models', 'hola.pkl'))
return models
return {'hola': joblib.load(join(HYDRO_DIR, 'models', 'hola.pkl'))}


def load_model(model):
Expand Down
17 changes: 6 additions & 11 deletions tests/plugins/HydroRoll/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ async def rule(self) -> bool:
or self.event.group_id in self.config.accept_group
):
return self.str_match(match_str)
elif self.config.handle_group_message:
if self.event.message_type == "guild":
return self.str_match(match_str)
return False

@abstractmethod
Expand Down Expand Up @@ -152,11 +149,9 @@ def roll_dice(

if streamline:
return str(total)
else:
if len(rolls) > int(threshold):
return str(total)
rolls_str = " + ".join(str(r) for r in rolls)
result_str = (
f"{total} = {rolls_str}" if is_reversed else f"{rolls_str} = {total}"
)
return result_str
if len(rolls) > int(threshold):
return str(total)
rolls_str = " + ".join(str(r) for r in rolls)
return (
f"{total} = {rolls_str}" if is_reversed else f"{rolls_str} = {total}"
)

0 comments on commit d1b1ff9

Please sign in to comment.