From bc92b3b44753fe6aae2c0ed3256db7838c7e014c Mon Sep 17 00:00:00 2001 From: fengxiaohu <975326527@qq.com> Date: Mon, 7 Jul 2025 15:40:56 +0800 Subject: [PATCH 1/4] fix: make gender input case-insensitive and clean up pre-commit config --- .pre-commit-config.yaml | 15 ++++++++------- examples/conversationbot.py | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a6002c846bf..e6673bfd7a9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ ci: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.11.9' + rev: 'v0.12.2' hooks: - id: ruff name: ruff @@ -25,13 +25,14 @@ repos: - --diff - --check - repo: https://github.com/PyCQA/flake8 - rev: 7.2.0 + rev: 7.3.0 hooks: - id: flake8 - repo: https://github.com/PyCQA/pylint - rev: v3.3.6 + rev: v3.3.7 hooks: - id: pylint + args: ["--init-hook", "import sys; sys.path.append('src')"] files: ^(?!(tests|docs)).*\.py$ additional_dependencies: - httpx~=0.27 @@ -41,7 +42,7 @@ repos: - aiolimiter~=1.1,<1.3 - . # this basically does `pip install -e .` - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.15.0 + rev: v1.16.1 hooks: - id: mypy name: mypy-ptb @@ -68,16 +69,16 @@ repos: - cachetools>=5.3.3,<5.5.0 - . # this basically does `pip install -e .` - repo: https://github.com/asottile/pyupgrade - rev: v3.19.1 + rev: v3.20.0 hooks: - id: pyupgrade args: - --py39-plus - repo: https://github.com/pycqa/isort - rev: 6.0.1 + rev: 5.13.2 hooks: - id: isort name: isort args: - --diff - - --check + - --check \ No newline at end of file diff --git a/examples/conversationbot.py b/examples/conversationbot.py index 751f48f74e0..4399bea9741 100644 --- a/examples/conversationbot.py +++ b/examples/conversationbot.py @@ -145,7 +145,7 @@ def main() -> None: conv_handler = ConversationHandler( entry_points=[CommandHandler("start", start)], states={ - GENDER: [MessageHandler(filters.Regex("^(Boy|Girl|Other)$"), gender)], + GENDER: [MessageHandler(filters.Regex("(?i)^(Boy|Girl|Other)$"), gender)], PHOTO: [MessageHandler(filters.PHOTO, photo), CommandHandler("skip", skip_photo)], LOCATION: [ MessageHandler(filters.LOCATION, location), From 6013ae9416ca1ce0318a034d7999c8e42743403a Mon Sep 17 00:00:00 2001 From: fengxiaohu <975326527@qq.com> Date: Tue, 8 Jul 2025 23:51:00 +0800 Subject: [PATCH 2/4] fix: make gender input case-insensitive in conversation handler (#4846) --- .pre-commit-config.yaml | 13 ++++++------- examples/conversationbot.py | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e6673bfd7a9..8463f0e9bbb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ ci: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.12.2' + rev: 'v0.11.9' hooks: - id: ruff name: ruff @@ -25,14 +25,13 @@ repos: - --diff - --check - repo: https://github.com/PyCQA/flake8 - rev: 7.3.0 + rev: 7.2.0 hooks: - id: flake8 - repo: https://github.com/PyCQA/pylint - rev: v3.3.7 + rev: v3.3.6 hooks: - id: pylint - args: ["--init-hook", "import sys; sys.path.append('src')"] files: ^(?!(tests|docs)).*\.py$ additional_dependencies: - httpx~=0.27 @@ -42,7 +41,7 @@ repos: - aiolimiter~=1.1,<1.3 - . # this basically does `pip install -e .` - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.16.1 + rev: v1.15.0 hooks: - id: mypy name: mypy-ptb @@ -69,13 +68,13 @@ repos: - cachetools>=5.3.3,<5.5.0 - . # this basically does `pip install -e .` - repo: https://github.com/asottile/pyupgrade - rev: v3.20.0 + rev: v3.19.1 hooks: - id: pyupgrade args: - --py39-plus - repo: https://github.com/pycqa/isort - rev: 5.13.2 + rev: hooks: - id: isort name: isort diff --git a/examples/conversationbot.py b/examples/conversationbot.py index 4399bea9741..dbe637c1203 100644 --- a/examples/conversationbot.py +++ b/examples/conversationbot.py @@ -145,6 +145,8 @@ def main() -> None: conv_handler = ConversationHandler( entry_points=[CommandHandler("start", start)], states={ + # Use case-insensitive regex to accept gender input regardless of letter casing, + # e.g., "boy", "BOY", "Girl", etc., will all be matched GENDER: [MessageHandler(filters.Regex("(?i)^(Boy|Girl|Other)$"), gender)], PHOTO: [MessageHandler(filters.PHOTO, photo), CommandHandler("skip", skip_photo)], LOCATION: [ From ef8b4e3e9e2d860c9b876182d818b37a7f179868 Mon Sep 17 00:00:00 2001 From: fengxiaohu <975326527@qq.com> Date: Wed, 9 Jul 2025 00:36:02 +0800 Subject: [PATCH 3/4] fix: make gender input case-insensitive in conversation handler (#4846) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8463f0e9bbb..e2369acf2bc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -74,7 +74,7 @@ repos: args: - --py39-plus - repo: https://github.com/pycqa/isort - rev: + rev: 6.0.1 hooks: - id: isort name: isort From 2f0565eb283b3a2cdd7ff35a6559e9cf222a2610 Mon Sep 17 00:00:00 2001 From: fengxiaohu <975326527@qq.com> Date: Wed, 9 Jul 2025 01:46:53 +0800 Subject: [PATCH 4/4] fix: add empty line at the end of .pre-commit-config.yaml (#4846) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e2369acf2bc..a6002c846bf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -80,4 +80,4 @@ repos: name: isort args: - --diff - - --check \ No newline at end of file + - --check