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