-
Notifications
You must be signed in to change notification settings - Fork 6k
Move handler related files to _handlers subdirectory #4064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move handler related files to _handlers subdirectory #4064
Conversation
Bibo-Joshi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to use from telegram.ext.filters import MessageFilter with the filters.py inside the _handlers directory? For now all from telegram.ext imports are working, except this one.
I tried around a bit and couldn't get it to work either. Also tried to find an explanation for the issue on the web, but didn't really get that far either. Sometimes, Python import behavior remains a mystery :D
Note that from telegram.ext import filters or import telegram.ext and then telegram.ext.filters will both still work. However, I wouldn't want to break anything here, so I propose that we just have the filters module at tg/ext/filters.py.
telegram/ext/__init__.py
Outdated
|
|
||
| from . import filters | ||
| from ._handlers import filters | ||
| from ._handlers._basehandler import BaseHandler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| from ._handlers._basehandler import BaseHandler | |
| from ._handlers.basehandler import BaseHandler |
Since the _handler module itself is marked as protected via the leading underscore, it would be fine with me to treat the individual files within as "public" content of that module.
I searched too, there is literally nothing about that in the web, at least I couldn't find it. Tried with AI too but I didn't got lucky :[ I did what you suggested and moved the filters module to Since we are here, are these merge checks supposed to be succesful? Did I messed something up for that to not be working? At least the required ones seems to be fine. |
The
DeepSource reports "Function with cyclomatic complexity higher than threshold" for |
|
There it is, sorry about the commits that are only about formatting. First time working with pre-commit :) |
|
Only three commits from fighting pre-commit? What are you, some kind of wizard? I usually need at least five. Don't worry we all started at some point, you get used to it. If you install it locally, git runs it before the actual commit, so you know it breaks before the commit goes through |
|
Thank you both for been supportive. Learned a lot with this simple contribution, next time will be easier! |
Bibo-Joshi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :) Thanks for the work! @Poolitzer or maybe @clot27 would you mind giving it a once-over as well?
clot27
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @lucasmolinari, LGTM!
|
Thanks for the contribution! |
closes #4060.
Created a new directory
telegram/ext/_handlerswhere all_*handlerrelated files were moved, includingfilters.py.Modified
telegram/ext/__init__.pyto point to the new directory.Some files where pointing exactly to the handlers, for e.g
telegram\ext\_application.pywith the import statementfrom telegram.ext._basehandler import BaseHandlerso I modified those too.