Skip to content

Conversation

@fengxiaohu
Copy link
Contributor

Summary

This PR improves the gender input handling in examples/conversationbot.py by using a case-insensitive regex.
It also corrects a pre-commit hook configuration issue in .pre-commit-config.yaml (invalid stages field in isort).

Changes

  • Made gender selection case-insensitive using (?i) regex.
  • Updated .pre-commit-config.yaml to fix isort hook crash due to invalid stages.
  • Verified pre-commit hook passes for ruff, black, flake8, isort, and mypy.

Check-list

  • Created/adapted unit test or verified functionality manually
  • Documented behavior change in example
  • All pre-commit hooks pass (pre-commit run -a)
  • Added .. versionchanged:: NEXT.VERSION to example function (optional)
  • Added myself to AUTHORS.rst (optional)
  • No breaking changes or violations of stability policy

Copy link
Member

@harshil21 harshil21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@harshil21 harshil21 added the ⚙️ examples affected functionality: examples label Jul 7, 2025
@harshil21 harshil21 linked an issue Jul 7, 2025 that may be closed by this pull request
@fengxiaohu
Copy link
Contributor Author

can not pass CI.
I guess change the .pre-commit-config.yaml.
however when i use the normal .pre-commit-config.yaml. I can not pass the precommit
run pre-commit run -a

output looks like

An error has occurred: InvalidManifestError: ==> File /Users/xiaohufeng/.cache/pre-commit/repooacu36pw/.pre-commit-hooks.yaml ==> At Hook(id='isort') ==> At key: stages ==> At index 0 =====> Expected one of commit, commit-msg, manual, merge-commit, post-checkout, post-commit, post-merge, post-rewrite, prepare-commit-msg, push but got: 'pre-commit' Check the log at /Users/xiaohufeng/.cache/pre-commit/pre-commit.log

@harshil21
Copy link
Member

I'm not sure what could be causing that. Maybe run: pre-commit uninstall, pre-commit clean, and then reinstall with pre-commit install. If that doesn't work, just commit without running pre-commit, e.g. git commit -n -a -m "commit msg".

@fengxiaohu fengxiaohu closed this Jul 8, 2025
@fengxiaohu fengxiaohu reopened this Jul 8, 2025
Copy link
Member

@Bibo-Joshi Bibo-Joshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kindly also add a new file changes/unreleased/4855.8hCFRFMeMaRWpBEYaxrTMq.toml with the following content:

other= "Make Gender Input Case-Insensitive in ``conversationbot.py``"
[[pull_requests]]
uid = "4855"
author_uid = "fengxiaohu"
closes_threads = ["4846"]

@Bibo-Joshi Bibo-Joshi merged commit e9dd490 into python-telegram-bot:master Jul 15, 2025
6 checks passed
@Bibo-Joshi
Copy link
Member

Thank you very much for the contribution!

@github-actions github-actions bot locked and limited conversation to collaborators Jul 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

⚙️ examples affected functionality: examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

case-insensitive in conversationbot.py bot demo

3 participants