Fixed CI, reformatted code, sorted imports

This commit is contained in:
Ari Archer 2021-12-04 22:19:55 +02:00
parent 94ce9fe73c
commit a6fc06fcc7
Signed by untrusted user who does not match committer: ari
GPG key ID: A50D5B4B599AF8A2
5 changed files with 28 additions and 13 deletions

View file

@ -1,9 +1,8 @@
import json
import logging
import os
import random
import shlex
import json
import pyperclip
import webbrowser
from datetime import datetime
from functools import partial, wraps
@ -12,6 +11,7 @@ from tempfile import NamedTemporaryFile
from typing import Any, Callable, Dict, List, Optional
import pyfzf
import pyperclip
from telegram.utils import AsyncResult
from arigram import config

View file

@ -282,7 +282,7 @@ class Model:
return {
chat["title"]: f"{basic_info['member_count']} members",
"Info": chat_info["description"],
#"Share link": chat_info["invite_link"],
# "Share link": chat_info["invite_link"],
}
def get_supergroup_info(self, chat: Dict[str, Any]) -> Dict[str, Any]:
@ -291,11 +291,11 @@ class Model:
)
result.wait()
chat_info = result.update
log.exception(str(chat_info))
return {
chat["title"]: f"{chat_info['member_count']} members",
"Info": chat_info["description"],
#"Share link": chat_info["invite_link"],
# "Share link": chat_info["invite_link"],
}
def get_channel_info(self, chat: Dict[str, Any]) -> Dict[str, Any]:
@ -307,7 +307,7 @@ class Model:
return {
chat["title"]: "subscribers",
"Info": chat_info["description"],
#"Share link": chat_info["invite_link"],
# "Share link": chat_info["invite_link"],
}
def get_secret_chat_info(self, chat: Dict[str, Any]) -> Dict[str, Any]:

View file

@ -1,13 +1,13 @@
import json
import logging
import os
import json
from functools import wraps
from typing import Any, Callable, Dict
from arigram import config, utils
from arigram.config import DRAFTS_FILE
from arigram.controllers import Controller
from arigram.msg import MsgProxy
from arigram.config import DRAFTS_FILE
log = logging.getLogger(__name__)
@ -194,10 +194,11 @@ def update_chat_draft_message(
) -> None:
chat_id = update["chat_id"]
# FIXME: ignoring draft message itself for now because UI can't show it
draft_message = update["draft_message"]["input_message_text"]["text"]["text"]
draft_message = update["draft_message"]["input_message_text"]["text"][
"text"
]
order = update["positions"][0]["order"]
if not os.path.exists(DRAFTS_FILE):
with open(DRAFTS_FILE, "w") as nf:
nf.write("{}")
@ -212,7 +213,6 @@ def update_chat_draft_message(
with open(DRAFTS_FILE, "w") as wdf:
json.dump(dj, wdf)
current_chat_id = controller.model.current_chat_id
if controller.model.chats.update_chat(chat_id, order=order):
controller.refresh_current_chat(current_chat_id)

13
poetry.lock generated
View file

@ -156,6 +156,14 @@ python-versions = "*"
[package.dependencies]
plumbum = "*"
[[package]]
name = "pyperclip"
version = "1.8.2"
description = "A cross-platform clipboard module for Python. (Only handles plain text for now.)"
category = "main"
optional = false
python-versions = "*"
[[package]]
name = "pypiwin32"
version = "223"
@ -218,7 +226,7 @@ python-versions = ">=3.6"
[metadata]
lock-version = "1.1"
python-versions = "^3.8"
content-hash = "327722354091af1dbf3712b1673fc07f68c0e4d4293aac7c8c9733069d1503c8"
content-hash = "061484270c70aa1136531e656408afb105e5d532473e9a642961595878ecbde9"
[metadata.files]
appdirs = [
@ -296,6 +304,9 @@ pyfzf = [
{file = "pyfzf-0.2.2-py3-none-any.whl", hash = "sha256:1f324717fcae6746c05094be09b36f45412f0965b2d718c8d2352877ae20df69"},
{file = "pyfzf-0.2.2.tar.gz", hash = "sha256:8a35234fd6b3d6abca2b9971c5b27e157cfd878ee3ee9f707ddf6373438ad541"},
]
pyperclip = [
{file = "pyperclip-1.8.2.tar.gz", hash = "sha256:105254a8b04934f0bc84e9c24eb360a591aaf6535c9def5f29d92af107a9bf57"},
]
pypiwin32 = [
{file = "pypiwin32-223-py3-none-any.whl", hash = "sha256:67adf399debc1d5d14dffc1ab5acacb800da569754fafdc576b2a039485aa775"},
{file = "pypiwin32-223.tar.gz", hash = "sha256:71be40c1fbd28594214ecaecb58e7aa8b708eabfa0125c8a109ebd51edbd776a"},

View file

@ -23,5 +23,9 @@ setup(
packages=["arigram"],
entry_points={"console_scripts": ["arigram = arigram.__main__:main"]},
python_requires=">=3.8",
install_requires=["python-telegram>=0.15.0", "pyfzf>=0.2.2", "pyperclip>=1.8.2"],
install_requires=[
"python-telegram>=0.15.0",
"pyfzf>=0.2.2",
"pyperclip>=1.8.2",
],
)