Fix code formatting

This commit is contained in:
Paul Nameless 2022-04-21 13:11:01 +04:00
parent 965045f714
commit 49981d1247
4 changed files with 9 additions and 8 deletions

View file

@ -1,6 +1,7 @@
import tg
from setuptools import setup from setuptools import setup
import tg
with open("readme.md", "r") as fh: with open("readme.md", "r") as fh:
readme = fh.read() readme = fh.read()

View file

@ -175,7 +175,9 @@ class Model:
return False return False
def can_be_deleted(self, chat_id: int, msg: Dict[str, Any]) -> bool: def can_be_deleted(self, chat_id: int, msg: Dict[str, Any]) -> bool:
c_id = msg["sender_id"].get("chat_id") or msg["sender_id"].get("user_id") c_id = msg["sender_id"].get("chat_id") or msg["sender_id"].get(
"user_id"
)
if chat_id == c_id: if chat_id == c_id:
return msg["can_be_deleted_only_for_self"] return msg["can_be_deleted_only_for_self"]
return msg["can_be_deleted_for_all_users"] return msg["can_be_deleted_for_all_users"]

View file

@ -220,9 +220,9 @@ class MsgProxy:
@property @property
def sender_id(self) -> int: def sender_id(self) -> int:
return self.msg["sender_id"].get("user_id") or self.msg["sender_id"].get( return self.msg["sender_id"].get("user_id") or self.msg[
"chat_id" "sender_id"
) ].get("chat_id")
@property @property
def forward(self) -> Optional[Dict[str, Any]]: def forward(self) -> Optional[Dict[str, Any]]:

View file

@ -85,9 +85,7 @@ def get_file_handler(file_path: str) -> str:
return config.DEFAULT_OPEN.format(file_path=shlex.quote(file_path)) return config.DEFAULT_OPEN.format(file_path=shlex.quote(file_path))
caps = get_mailcap() caps = get_mailcap()
handler, view = mailcap.findmatch( handler, view = mailcap.findmatch(caps, mtype, filename=file_path)
caps, mtype, filename=file_path
)
if not handler: if not handler:
return config.DEFAULT_OPEN.format(file_path=shlex.quote(file_path)) return config.DEFAULT_OPEN.format(file_path=shlex.quote(file_path))
return handler return handler