Update Code Quality Dependencies (#2748)

This commit is contained in:
Harshil 2021-10-30 13:00:12 +04:00 committed by Hinrich Mahler
parent 42df3f471d
commit 44f1ce3784
8 changed files with 15 additions and 17 deletions

View file

@ -3,18 +3,18 @@
# * the additional_dependencies here match requirements.txt
repos:
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 21.9b0
hooks:
- id: black
args:
- --diff
- --check
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/PyCQA/pylint
rev: v2.10.2
rev: v2.11.1
hooks:
- id: pylint
files: ^(telegram|examples)/.*\.py$
@ -56,7 +56,7 @@ repos:
- cachetools==4.2.2
- . # this basically does `pip install -e .`
- repo: https://github.com/asottile/pyupgrade
rev: v2.24.0
rev: v2.29.0
hooks:
- id: pyupgrade
files: ^(telegram|examples|tests)/.*\.py$

View file

@ -3,13 +3,13 @@ cryptography!=3.4,!=3.4.1,!=3.4.2,!=3.4.3
pre-commit
# Make sure that the versions specified here match the pre-commit settings!
black==20.8b1
flake8==3.9.2
pylint==2.10.2
black==21.9b0
flake8==4.0.1
pylint==2.11.1
mypy==0.910
pyupgrade==2.24.0
pyupgrade==2.29.0
pytest==6.2.4
pytest==6.2.5
flaky
beautifulsoup4

View file

@ -2376,9 +2376,7 @@ class Bot(TelegramObject):
if result.get('file_path') and not is_local_file( # type: ignore[union-attr]
result['file_path'] # type: ignore[index]
):
result['file_path'] = '{}/{}'.format( # type: ignore[index]
self.base_file_url, result['file_path'] # type: ignore[index]
)
result['file_path'] = f"{self.base_file_url}/{result['file_path']}" # type: ignore
return File.de_json(result, self) # type: ignore[return-value, arg-type]

View file

@ -54,7 +54,7 @@ class TelegramError(Exception):
self.message = msg
def __str__(self) -> str:
return '%s' % self.message
return self.message
def __reduce__(self) -> Tuple[type, Tuple[str]]:
return self.__class__, (self.message,)

View file

@ -133,7 +133,6 @@ _TWO_ARGS_REQ = "The parameter `{}` may only be set, if no {} was set."
# the UpdaterBuilder has all method that the DispatcherBuilder has
class _BaseBuilder(Generic[ODT, BT, CCT, UD, CD, BD, JQ, PT]):
# pylint reports false positives here:
# pylint: disable=unused-private-member
__slots__ = (
'_token',

View file

@ -51,8 +51,8 @@ from telegram.ext._utils.types import CCT, UD, CD, BD, BT, JQ, PT
from telegram.ext._utils.stack import was_called_by
if TYPE_CHECKING:
from .jobqueue import Job
from .builders import InitDispatcherBuilder
from telegram.ext._jobqueue import Job
from telegram.ext._builders import InitDispatcherBuilder
DEFAULT_GROUP: int = 0

View file

@ -46,7 +46,7 @@ from telegram.ext._utils.stack import was_called_by
from telegram.ext._utils.types import BT
if TYPE_CHECKING:
from .builders import InitUpdaterBuilder
from telegram.ext._builders import InitUpdaterBuilder
DT = TypeVar('DT', bound=Union[None, Dispatcher])

View file

@ -2101,6 +2101,7 @@ officedocument.wordprocessingml.document")``.
class _Dice(_DiceEmoji):
__slots__ = ()
# pylint: disable=no-member
dice = _DiceEmoji(DiceEmoji.DICE, DiceEmoji.DICE.name.lower())
darts = _DiceEmoji(DiceEmoji.DARTS, DiceEmoji.DARTS.name.lower())
basketball = _DiceEmoji(DiceEmoji.BASKETBALL, DiceEmoji.BASKETBALL.name.lower())