Compare commits

..

5 Commits

Author SHA1 Message Date
Tulir Asokan 92a6afdd2f Hacky fix for null m.relates_to's and bump version to 0.5.2 2019-05-25 16:03:15 +03:00
Tulir Asokan 41b8292f25 Bump version to 0.5.1 2019-03-21 15:32:37 +02:00
Tulir Asokan 366b95c8e8 Fix Python 3.5 compatibility 2019-03-21 14:42:18 +02:00
Tulir Asokan fecf068455 Revert switching to @as_declarative for SQLAlchemy base class
This reverts commit 1da1133934 and a part of 2cf9dcafd9
2019-03-21 13:48:53 +02:00
Tulir Asokan 1da1133934 Fix reference to old BaseBase class in dbms migration script 2019-03-21 12:10:43 +02:00
5 changed files with 13 additions and 18 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
__version__ = "0.5.0" __version__ = "0.5.2"
__author__ = "Tulir Asokan <tulir@maunium.net>" __author__ = "Tulir Asokan <tulir@maunium.net>"
+4 -9
View File
@@ -285,15 +285,10 @@ class CommandHandler:
def command_handler(_func: Optional[Callable[[CommandEvent], Awaitable[Dict]]] = None, *, def command_handler(_func: Optional[Callable[[CommandEvent], Awaitable[Dict]]] = None, *,
needs_auth: bool = True, needs_auth: bool = True, needs_puppeting: bool = True,
needs_puppeting: bool = True, needs_matrix_puppeting: bool = False, needs_admin: bool = False,
needs_matrix_puppeting: bool = False, management_only: bool = False, name: Optional[str] = None,
needs_admin: bool = False, help_text: str = "", help_args: str = "", help_section: HelpSection = None
management_only: bool = False,
name: Optional[str] = None,
help_text: str = "",
help_args: str = "",
help_section: HelpSection = None,
) -> Callable[[Callable[[CommandEvent], Awaitable[Optional[Dict]]]], ) -> Callable[[Callable[[CommandEvent], Awaitable[Optional[Dict]]]],
CommandHandler]: CommandHandler]:
def decorator(func: Callable[[CommandEvent], Awaitable[Optional[Dict]]]) -> CommandHandler: def decorator(func: Callable[[CommandEvent], Awaitable[Optional[Dict]]]) -> CommandHandler:
+4 -3
View File
@@ -20,11 +20,10 @@ from sqlalchemy import Table
from sqlalchemy.engine.base import Engine from sqlalchemy.engine.base import Engine
from sqlalchemy.engine.result import RowProxy from sqlalchemy.engine.result import RowProxy
from sqlalchemy.sql.base import ImmutableColumnCollection from sqlalchemy.sql.base import ImmutableColumnCollection
from sqlalchemy.ext.declarative import as_declarative from sqlalchemy.ext.declarative import declarative_base
@as_declarative() class BaseBase:
class Base:
db = None # type: Engine db = None # type: Engine
t = None # type: Table t = None # type: Table
__table__ = None # type: Table __table__ = None # type: Table
@@ -55,3 +54,5 @@ class Base:
def delete(self) -> None: def delete(self) -> None:
with self.db.begin() as conn: with self.db.begin() as conn:
conn.execute(self.t.delete().where(self._edit_identity)) conn.execute(self.t.delete().where(self._edit_identity))
Base = declarative_base(cls=BaseBase)
+3 -4
View File
@@ -44,7 +44,6 @@ try:
except ImportError: except ImportError:
htmldiff = None # type: ignore htmldiff = None # type: ignore
log = logging.getLogger("mau.fmt.tg") # type: logging.Logger log = logging.getLogger("mau.fmt.tg") # type: logging.Logger
should_highlight_edits = False # type: bool should_highlight_edits = False # type: bool
@@ -258,9 +257,9 @@ def _telegram_entities_to_matrix(text: str, entities: List[TypeMessageEntity]) -
elif entity_type == MessageEntityItalic: elif entity_type == MessageEntityItalic:
html.append(f"<em>{entity_text}</em>") html.append(f"<em>{entity_text}</em>")
elif entity_type == MessageEntityCode: elif entity_type == MessageEntityCode:
html.append(f"<pre><code>{entity_text}</code></pre>" html.append(("<pre><code>{entity_text}</code></pre>"
if "\n" in entity_text if "\n" in entity_text
else f"<code>{entity_text}</code>") else "<code>{entity_text}</code>").format(entity_text=entity_text))
elif entity_type == MessageEntityPre: elif entity_type == MessageEntityPre:
skip_entity = _parse_pre(html, entity_text, entity.language) skip_entity = _parse_pre(html, entity_text, entity.language)
elif entity_type == MessageEntityMention: elif entity_type == MessageEntityMention:
+1 -1
View File
@@ -31,7 +31,7 @@ setuptools.setup(
install_requires=[ install_requires=[
"aiohttp>=3.0.1,<4", "aiohttp>=3.0.1,<4",
"mautrix-appservice>=0.3.8,<0.4.0", "mautrix-appservice>=0.3.10.dev1,<0.4.0",
"SQLAlchemy>=1.2.3,<2", "SQLAlchemy>=1.2.3,<2",
"alembic>=1.0.0,<2", "alembic>=1.0.0,<2",
"commonmark>=0.8.1,<1", "commonmark>=0.8.1,<1",