diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 34ccc28..1e78284 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -17,7 +17,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: '3.8' + python-version: '3.11' - name: Install dependencies run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ba32405..b2893a0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,16 +23,16 @@ repos: # run pylint across multiple cpu cores to speed it up- - --jobs=0 # See https://pylint.pycqa.org/en/latest/user_guide/run.html?#parallel-execution to know more additional_dependencies: - - python-telegram-bot~=20.0 - - plotly~=5.11 + - python-telegram-bot~=20.4 + - plotly~=5.16 - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.4.1 hooks: - id: mypy files: ^ptbstats/.*\.py$ additional_dependencies: - - python-telegram-bot~=20.0 - - plotly~=5.11 + - python-telegram-bot~=20.4 + - plotly~=5.16 - repo: https://github.com/asottile/pyupgrade rev: v3.10.1 hooks: @@ -52,5 +52,5 @@ repos: hooks: - id: ruff additional_dependencies: - - python-telegram-bot~=20.0 - - plotly~=5.11 + - python-telegram-bot~=20.4 + - plotly~=5.16 diff --git a/README.rst b/README.rst index e9fcee8..1224c4a 100644 --- a/README.rst +++ b/README.rst @@ -35,26 +35,27 @@ Here is an example setup using the very basic `SimpleStats _T: + instance = super().__new__(cls) orig_check_update = instance.check_update - def check_update(update: Update) -> Optional[bool]: + def check_update(update: object) -> Optional[bool]: return isinstance(update, Update) and orig_check_update(update) - instance.check_update = check_update + instance.check_update = check_update # type: ignore[method-assign] return instance def __init__(self, command: str, block_stats: bool = True, block_command: bool = True): diff --git a/ptbstats/_simplestats.py b/ptbstats/_simplestats.py index 8b14c1d..ed093c4 100644 --- a/ptbstats/_simplestats.py +++ b/ptbstats/_simplestats.py @@ -154,7 +154,7 @@ def store_data(self, context: _CCT) -> None: Assumes that ``context.bot_data`` is a dict and stores the data in ``context.bot_data['SimpleStats'][self.command]``. Override to customize the behavior. """ - context.bot_data["SimpleStats"][self.command] = self.records + context.bot_data.setdefault("SimpleStats", {})[self.command] = self.records def load_data(self, application: Application[Any, _CCT, Any, Any, Any, Any]) -> None: """Loads the data stored by :meth:`store_data`. diff --git a/requirements.txt b/requirements.txt index 77d4b3d..f7ecc0a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -python-telegram-bot~=20.0 +python-telegram-bot~=20.4 plotly~=5.16