From 22d1d15f054f03f0f3b50fe0bffaa76f65b78f85 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 9 Jul 2019 19:35:25 +0300 Subject: [PATCH] PEP8 --- royalnet/commands/diario.py | 10 +++++++--- royalnet/database/tables/diario.py | 11 +++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/royalnet/commands/diario.py b/royalnet/commands/diario.py index d960dbd6..a7cfd609 100644 --- a/royalnet/commands/diario.py +++ b/royalnet/commands/diario.py @@ -79,7 +79,8 @@ class DiarioCommand(Command): quoted_alias = None quoted_account = quoted_alias.royal if quoted_alias is not None else None if quoted_alias is not None and quoted_account is None: - await call.reply("⚠️ Il nome dell'autore è ambiguo, quindi la riga non è stata aggiunta.\nPer piacere, ripeti il comando con un nome più specifico!") + await call.reply("⚠️ Il nome dell'autore è ambiguo, quindi la riga non è stata aggiunta.\n" + "Per piacere, ripeti il comando con un nome più specifico!") return # Create the diario quote diario = call.alchemy.Diario(creator=creator, @@ -132,7 +133,9 @@ class DiarioCommand(Command): if not (text or media_url): raise InvalidInputError("Missing text.") # Find the Royalnet account associated with the sender - quoted_tg = await asyncify(call.session.query(call.alchemy.Telegram).filter_by(tg_id=reply.from_user.id).one_or_none) + quoted_tg = await asyncify(call.session.query(call.alchemy.Telegram) + .filter_by(tg_id=reply.from_user.id) + .one_or_none) quoted_account = quoted_tg.royal if quoted_tg is not None else None # Find the quoted name to assign quoted_user: telegram.User = reply.from_user @@ -178,7 +181,8 @@ class DiarioCommand(Command): # Find if there's a Royalnet account associated with the quoted name if quoted is not None: quoted_alias = await asyncify( - call.session.query(call.alchemy.Alias).filter_by(alias=quoted.lower()).one_or_none) + call.session.query(call.alchemy.Alias) + .filter_by(alias=quoted.lower()).one_or_none) else: quoted_alias = None quoted_account = quoted_alias.royal if quoted_alias is not None else None diff --git a/royalnet/database/tables/diario.py b/royalnet/database/tables/diario.py index 1f6a374e..44fc8ebd 100644 --- a/royalnet/database/tables/diario.py +++ b/royalnet/database/tables/diario.py @@ -60,10 +60,17 @@ class Diario: return relationship("Royal", foreign_keys=self.quoted_account_id, backref="diario_quoted") def __repr__(self): - return f"" + return f"" def __str__(self): - # TODO: support media_url text = f"Riga #{self.diario_id}" text += f" (salvata da {str(self.creator)}" text += f" il {self.timestamp.strftime('%Y-%m-%d %H:%M')}):\n"