Skip to content

Commit

Permalink
sort imports w/ isort & format w/ black
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Hoß <seb@xn--ho-hia.de>
  • Loading branch information
sebhoss committed Aug 18, 2024
1 parent 4c9a725 commit 541a78d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 9 additions & 5 deletions rss/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@
import asyncio
import hashlib
import html
import re

import aiohttp
import attr
import feedparser

import re

from maubot import MessageEvent, Plugin, __version__ as maubot_version
from maubot.handlers import command, event
from mautrix.types import (
Expand Down Expand Up @@ -110,7 +109,9 @@ async def poll_feeds(self) -> None:
async def _send(self, feed: Feed, entry: Entry, sub: Subscription) -> EventID | None:
title_exclude_filter = sub.title_exclude_filter
if title_exclude_filter:
self.log.debug(f"Feed '{feed.id}' ({feed.title}) has exclude filter '{title_exclude_filter}'")
self.log.debug(
f"Feed '{feed.id}' ({feed.title}) has exclude filter '{title_exclude_filter}'"
)
if re.search(title_exclude_filter, entry.title):
self.log.info(f"Excluded '{entry.title}'")
return None
Expand Down Expand Up @@ -400,7 +401,9 @@ async def set_filter(self, evt: MessageEvent, feed_id: int, title_exclude_filter
return
await self.dbm.update_title_filter(feed.id, evt.room_id, title_exclude_filter)
if title_exclude_filter:
await evt.reply(f"Feed {feed_id} will now exclude titles matching: {title_exclude_filter}")
await evt.reply(
f"Feed {feed_id} will now exclude titles matching: {title_exclude_filter}"
)
else:
await evt.reply(f"Removed title exclude filter from feed {feed_id}")

Expand Down Expand Up @@ -501,7 +504,8 @@ async def command_subscriptions(self, evt: MessageEvent) -> None:
await evt.reply(
"**Subscriptions in this room:**\n\n"
+ "\n".join(
self._format_subscription(feed, subscriber, title_exclude_filter) for feed, subscriber, title_exclude_filter in subscriptions
self._format_subscription(feed, subscriber, title_exclude_filter)
for feed, subscriber, title_exclude_filter in subscriptions
)
)

Expand Down
4 changes: 3 additions & 1 deletion rss/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ async def set_send_notice(self, feed_id: int, room_id: RoomID, send_notice: bool
q = "UPDATE subscription SET send_notice=$3 WHERE feed_id=$1 AND room_id=$2"
await self.db.execute(q, feed_id, room_id, send_notice)

async def update_title_filter(self, feed_id: int, room_id: RoomID, title_exclude_filter: str) -> None:
async def update_title_filter(
self, feed_id: int, room_id: RoomID, title_exclude_filter: str
) -> None:
q = "UPDATE subscription SET title_exclude_filter=$3 WHERE feed_id=$1 AND room_id=$2"
await self.db.execute(q, feed_id, room_id, title_exclude_filter)

0 comments on commit 541a78d

Please sign in to comment.