Skip to content

Commit

Permalink
style(examples): ruff format code
Browse files Browse the repository at this point in the history
  • Loading branch information
HsiangNianian committed Jul 7, 2024
1 parent c6f28bd commit b06a62c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions examples/rules/COC7/Command.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
class Command: ...
16 changes: 9 additions & 7 deletions examples/rules/COC7/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@

from .Character import Attributes
from .Wiki import Wiki
from .Command import Command

core = Core()


class COC7(Rule):

# 规则、指令、词条,必须至少实现任意一个
attr: Attributes = Depends() # CharacterCard.Attribute
wiki: Wiki = Depends() # Wiki
cmd: Command = Depends() # Command
attr: Attributes = Depends() # CharacterCard.Attribute
wiki: Wiki = Depends() # Wiki
cmd: Command = Depends() # Command # noqa: F821

@core.event_postprocessor_hook
async def auto_card(self):
if self.session and self.session.gid and self.ac:
Expand All @@ -26,7 +27,8 @@ async def auto_card(self):
)

async def overview_card(self):
max_hp = math.floor((self.pc.get("CON", 0) + self.pc.get("SIZ", 0) / 10))
max_hp = math.floor(
(self.pc.get("CON", 0) + self.pc.get("SIZ", 0) / 10))
max_san = math.floor(99 - self.pc.get("CM", 0))
mp = self.pc.get("MP", 0)
mp_show = (
Expand All @@ -47,4 +49,4 @@ async def overview_card(self):
+ mp_show
+ " DEX"
+ str(self.pc.get("DEX", "?"))
)
)
4 changes: 2 additions & 2 deletions hrc/rule/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def state(self, value: StateT) -> None:
async def handle(self) -> None:
"""Method to handle events. iamai will call this method when the ``rule()`` method returns ``True``. Each plugin must implement this method."""
raise NotImplementedError

@abstractmethod
async def rule(self) -> bool:
"""Method to match the event. When the event is processed, this method will be called in sequence according to the priority of the plugin. When this method returns ``True``, the event will be handed over to this plugin for processing. Each plugin must implement this method.
Expand All @@ -162,4 +162,4 @@ def decorator(func):
func._ignore_case = ignore_case
return func

return decorator
return decorator

0 comments on commit b06a62c

Please sign in to comment.