mirror of
https://github.com/mautrix/telegram.git
synced 2026-05-17 07:25:46 +03:00
Update black and fix version in CI
This commit is contained in:
3
.github/workflows/python-lint.yml
vendored
3
.github/workflows/python-lint.yml
vendored
@@ -13,9 +13,10 @@ jobs:
|
||||
- uses: isort/isort-action@master
|
||||
with:
|
||||
sortPaths: "./mautrix_telegram"
|
||||
- uses: psf/black@21.12b0
|
||||
- uses: psf/black@stable
|
||||
with:
|
||||
src: "./mautrix_telegram"
|
||||
version: "22.1.0"
|
||||
- name: pre-commit
|
||||
run: |
|
||||
pip install pre-commit
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
pre-commit>=2.10.1,<3
|
||||
isort>=5.10.1,<6
|
||||
black==21.12b2
|
||||
black==22.1.0
|
||||
|
||||
@@ -20,7 +20,7 @@ import logging
|
||||
from telethon import TelegramClient
|
||||
|
||||
from mautrix.types import RoomID, UserID
|
||||
from mautrix.util.formatter import MatrixParser as BaseMatrixParser, RecursionContext, HTMLNode
|
||||
from mautrix.util.formatter import HTMLNode, MatrixParser as BaseMatrixParser, RecursionContext
|
||||
from mautrix.util.logging import TraceLogger
|
||||
|
||||
from ... import portal as po, puppet as pu, user as u
|
||||
|
||||
@@ -1512,7 +1512,7 @@ class Portal(DBPortal, BasePortal):
|
||||
else:
|
||||
w = h = None
|
||||
file_name = content["net.maunium.telegram.internal.filename"]
|
||||
max_image_size = self.config["bridge.image_as_file_size"] * 1000 ** 2
|
||||
max_image_size = self.config["bridge.image_as_file_size"] * 1000**2
|
||||
|
||||
if self.config["bridge.parallel_file_transfer"] and content.url:
|
||||
file_handle, file_size = await util.parallel_transfer_to_telegram(
|
||||
@@ -2275,7 +2275,7 @@ class Portal(DBPortal, BasePortal):
|
||||
|
||||
attrs = self._parse_telegram_document_attributes(document.attributes)
|
||||
|
||||
if document.size > self.config["bridge.max_document_size"] * 1000 ** 2:
|
||||
if document.size > self.config["bridge.max_document_size"] * 1000**2:
|
||||
name = attrs.name or ""
|
||||
caption = f"\n{evt.message}" if evt.message else ""
|
||||
# TODO encrypt
|
||||
|
||||
@@ -40,7 +40,7 @@ class MautrixTelegramClient(TelegramClient):
|
||||
mime_type: str = None,
|
||||
attributes: List[TypeDocumentAttribute] = None,
|
||||
file_name: str = None,
|
||||
max_image_size: float = 10 * 1000 ** 2,
|
||||
max_image_size: float = 10 * 1000**2,
|
||||
) -> Union[InputMediaUploadedDocument, InputMediaUploadedPhoto]:
|
||||
file_handle = await super().upload_file(file, file_name=file_name)
|
||||
|
||||
|
||||
@@ -9,4 +9,4 @@ line_length = 99
|
||||
[tool.black]
|
||||
line-length = 99
|
||||
target-version = ["py38"]
|
||||
required-version = "21.12b0"
|
||||
required-version = "22.1.0"
|
||||
|
||||
Reference in New Issue
Block a user