Apply black on code

This commit is contained in:
Griatch 2025-04-26 14:07:38 +02:00
parent 04ce4f6c5e
commit 0779ec82b6
70 changed files with 184 additions and 85 deletions

View file

@ -1,4 +1,4 @@
"""Tests for text2bbcode """
"""Tests for text2bbcode"""
import mock
from django.test import TestCase

View file

@ -65,6 +65,7 @@ class GodotWebSocketClient(webclient.WebSocketClient):
def start_plugin_services(portal):
class GodotWebsocket(WebSocketServerFactory):
"Only here for better naming in logs"
pass
factory = GodotWebsocket()

View file

@ -7,13 +7,18 @@ default ones in evennia core.
"""
from evennia.objects.objects import DefaultCharacter, DefaultExit, DefaultObject, DefaultRoom
from evennia.contrib.base_systems.ingame_python.callbackhandler import CallbackHandler
from evennia.contrib.base_systems.ingame_python.utils import (
phrase_event,
register_events,
time_event,
)
from evennia.objects.objects import (
DefaultCharacter,
DefaultExit,
DefaultObject,
DefaultRoom,
)
from evennia.utils.utils import inherits_from, lazy_property
# Character help

View file

@ -7,12 +7,15 @@ These functions are to be used by developers to customize events and callbacks.
from django.conf import settings
from evennia.scripts.models import ScriptDB
from evennia.utils import logger
from evennia.contrib.base_systems.custom_gametime import UNITS, gametime_to_realtime
from evennia.contrib.base_systems.custom_gametime import (
UNITS,
gametime_to_realtime,
)
from evennia.contrib.base_systems.custom_gametime import (
real_seconds_until as custom_rsu,
)
from evennia.scripts.models import ScriptDB
from evennia.utils import logger
from evennia.utils.create import create_script
from evennia.utils.gametime import real_seconds_until as standard_rsu
from evennia.utils.utils import class_from_module

View file

@ -32,6 +32,7 @@ The contrib can be further configured through two settings, `INGAME_REPORT_TYPES
"""
from django.conf import settings
from evennia import CmdSet
from evennia.commands.default.muxcommand import MuxCommand
from evennia.comms.models import Msg

View file

@ -1,6 +1,7 @@
from unittest.mock import Mock, patch, MagicMock
from evennia.utils import create
from unittest.mock import MagicMock, Mock, patch
from evennia.comms.models import TempMsg
from evennia.utils import create
from evennia.utils.test_resources import EvenniaCommandTest
from . import menu, reports

View file

@ -232,6 +232,7 @@ class MenuLoginEvMenu(EvMenu):
class UnloggedinCmdSet(CmdSet):
"Cmdset for the unloggedin state"
key = "DefaultUnloggedin"
priority = 0

View file

@ -29,8 +29,9 @@ Admin/development commands
import re
import evennia
from django.conf import settings
import evennia
from evennia import default_cmds, syscmdkeys
from evennia.commands.cmdset import CmdSet
from evennia.commands.command import Command, InterruptCommand

View file

@ -23,7 +23,7 @@ The recognized fields for an achievement are:
- name (str): The name of the achievement. This is not the key and does not need to be unique.
- desc (str): The longer description of the achievement. Common uses for this would be flavor text
or hints on how to complete it.
- category (str): The category of conditions which this achievement tracks. It will most likely be
- category (str): The category of conditions which this achievement tracks. It will most likely be
an action and you will most likely specify it based on where you're checking from.
e.g. killing 10 rats might have a category of "defeat", which you'd then check from your code
that runs when a player defeats something.

View file

@ -85,7 +85,9 @@ class TestClothingCmd(BaseEvenniaCommandTest):
)
# Test remove command.
self.call(clothing.CmdRemove(), "", "Usage: remove <worn clothing object>", caller=self.wearer)
self.call(
clothing.CmdRemove(), "", "Usage: remove <worn clothing object>", caller=self.wearer
)
self.call(
clothing.CmdRemove(),
"hat",

View file

@ -11,7 +11,7 @@ To install, import and add the `ContainerCmdSet` to `CharacterCmdSet` in your `d
class CharacterCmdSet(default_cmds.CharacterCmdSet):
# ...
def at_cmdset_creation(self):
# ...
self.add(ContainerCmdSet)

View file

@ -41,6 +41,7 @@ _RE_KEYS = re.compile(r"([\w\s]+)(?:\+*?)", re.U + re.I)
class DescValidateError(ValueError):
"Used for tracebacks from desc systems"
pass

View file

@ -1,7 +1,7 @@
from evennia import CmdSet
from evennia.commands.default.muxcommand import MuxCommand
from evennia.utils import list_to_string
from evennia.utils.search import search_object_by_tag
from evennia.commands.default.muxcommand import MuxCommand
SHARED_TAG_PREFIX = "shared"

View file

@ -33,7 +33,7 @@ class TestIngameMap(BaseEvenniaCommandTest):
create_object(
exits.Exit,
key="shopfront",
aliases=["w","west"],
aliases=["w", "west"],
location=self.east_room,
destination=self.west_room,
)

View file

@ -1,7 +1,7 @@
"""
Buffs - Tegiminis 2022
A buff is a timed object, attached to a game entity, that modifies values, triggers
A buff is a timed object, attached to a game entity, that modifies values, triggers
code, or both. It is a common design pattern in RPGs, particularly action games.
This contrib gives you a buff handler to apply to your objects, a buff class to extend them,
@ -25,7 +25,7 @@ To make use of the handler, you will need:
### Applying a Buff
Call the handler `add(BuffClass)` method. This requires a class reference, and also contains a number of
Call the handler `add(BuffClass)` method. This requires a class reference, and also contains a number of
optional arguments to customize the buff's duration, stacks, and so on.
```python
@ -36,8 +36,8 @@ self.buffs.add(ReflectBuff, to_cache={'reflect': 0.5}) # A single stack of Refl
### Modify
Call the handler `check(value, stat)` method wherever you want to see the modified value.
This will return the value, modified by and relevant buffs on the handler's owner (identified by
Call the handler `check(value, stat)` method wherever you want to see the modified value.
This will return the value, modified by and relevant buffs on the handler's owner (identified by
the `stat` string). For example:
```python
@ -49,7 +49,7 @@ def take_damage(self, source, damage):
### Trigger
Call the handler `trigger(triggerstring)` method wherever you want an event call. This
Call the handler `trigger(triggerstring)` method wherever you want an event call. This
will call the `at_trigger` hook method on all buffs with the relevant trigger.
```python

View file

@ -9,9 +9,10 @@ Unit test module for Trait classes.
from copy import copy
from anything import Something
from mock import MagicMock, patch
from evennia.objects.objects import DefaultCharacter
from evennia.utils.test_resources import BaseEvenniaTestCase, EvenniaTest
from mock import MagicMock, patch
from . import traits

View file

@ -456,9 +456,15 @@ from functools import total_ordering
from time import time
from django.conf import settings
from evennia.utils import logger
from evennia.utils.dbserialize import _SaverDict
from evennia.utils.utils import class_from_module, inherits_from, list_to_string, percent
from evennia.utils.utils import (
class_from_module,
inherits_from,
list_to_string,
percent,
)
# Available Trait classes.
# This way the user can easily supply their own. Each

View file

@ -123,6 +123,7 @@ class CmdTalk(default_cmds.MuxCommand):
class TalkingCmdSet(CmdSet):
"Stores the talk command."
key = "talkingcmdset"
def at_cmdset_creation(self):