Blacken and isort code, add pre-commit and CI linting

This commit is contained in:
Tulir Asokan 2023-10-05 22:22:10 +03:00
parent 3507b3b63a
commit 3ca366fea9
8 changed files with 125 additions and 52 deletions

View file

@ -13,16 +13,15 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from typing import Optional, Match, Dict, List, Set, Union, Pattern, Any
from typing import Any, Dict, List, Match, Optional, Pattern, Set, Union
from attr import dataclass
from mautrix.types import RoomID, EventType
from maubot import MessageEvent
from mautrix.types import EventType, RoomID
from .template import Template, OmitValue
from .simplepattern import SimplePattern
from .template import OmitValue, Template
RPattern = Union[Pattern, SimplePattern]
@ -59,7 +58,7 @@ class Rule:
async def execute(self, evt: MessageEvent, match: Match) -> None:
extra_vars = {
"0": match.group(0),
**{str(i+1): val for i, val in enumerate(match.groups())},
**{str(i + 1): val for i, val in enumerate(match.groups())},
**match.groupdict(),
}
content = self.template.execute(evt=evt, rule_vars=self.variables, extra_vars=extra_vars)