-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Refactor how InputMedia* subclasses handle inits #2573
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
Comments
i'm on it |
question regrading |
IIRC we added |
Why are the So i suggest to extend the scope of this task to creating a base class, or using the |
@eldbud A |
@Poolitzer Mh, I see how a common base class for all objects that have But IMO this class should be private and be considered an implementation detail, because So if we want to do this, the docs of @Poolitzer can you agree with my thoughts or do you have a different opinion on this? |
@Bibo-Joshi This is pretty much the EXACT implementation i have been working on since @Poolitzer 's comment.
|
Right, I forgot about Regarding the namings: I think the class name should be private rather then the module. Also IMO naming it e.g. |
Im good with that implementation jup |
regarding module/class as protected - i made the module protected, because that way already on import it will raise a warning the a protected module is being imported. |
I see your point. However, none of the existing modules are marked private even though the module structure is not considered to be part of the public API. If we want to change that, I suggest to do that coordinated in a single PR. For now, I'd vote to stick to the existing convention :) |
FYI: I've just openend #2680 ;) |
oh i got my eyes on it alright. if no one will take it by then, i may give it a try after completing the current task. |
question regarding usage of I see that in some of the subclasses the |
IISC in the cases where it's not provided, this is already handled in another python-telegram-bot/telegram/files/inputmedia.py Lines 143 to 149 in c3e3bb7
the point is here that we can extract additional information from the TG-Type-input. |
so as i mentioned in the Dataclasses discussion, i tried using mixin classes to refrain from repeating |
Okay, I understand the idea 👍 |
yep, boilerplate it will remain. |
Since we are giving out compliments here, let me agree to that one: I noticed the PRs from you, well done. Its a great feeling if you get a new face in an OS project because they want to contribute. Thank you very much. |
wow thank you very much @Poolitzer! We all benefit from better apps, and my added benefit is that i get to practice and learn a lot in the process of contributing, for which i get to thank everyone maintaining here 😃 |
going back to the subject, i'm still having some I checked, and the I hope the articulation above is not too confusing... Any suggestions as to how to approach this? |
I'm not sure if I can follow. Why do you want to call |
i'm not calling either, |
I'm a bit confused on which class this method is in and where it's called from. Maybe you can publish the changes that you have so far? |
nevermind joshi, i found my error, just deleted my last comment after realizing my mistake... sorry for the hassle, i'm on it. |
@Bibo-Joshi when i try to commit i am getting this message:
which is not code i wrote, not even a module i touched. not sure what to do about this or how to commit, any idea? |
Mh, the author of #2700 has a similar situation … You can commit with |
getting this:
|
Sounds like something went wrong with that submodule … Try running |
yeah still same issue, i'll try to reach you later on on TG |
could use a bit of help, i am getting failure in all
|
This tells you that one of the shortcut method has a signature that looks like def get_file(…, api_kwargs: JSONDict, …): while it should look like def get_file(…, api_kwargs: Dict[str, Any], …): This methods makes sure that the arguments of shortcut methods have the same type hints as the underlying bot methods (in this case |
ok, this is strange, because i did not change the signature of
what could be the reason for this error then? |
Mh, maybe it was a bit late for me yesterday 😬 You're right, |
if it helps in any way, this is the failing line in |
how can i link this issue to the pr? there is "closes #2573" text in the pr description, but the link is not made also now added commit with message as per instructions, but does not link. |
Currently all the subclasses handle the init completely on their own, while it would make more sense to move all attributes shared between the subclasses to
InputMedia
, i.e. callsuper().__init__
like we do forInlineQueryResult*
. This includes the attributescaption_entities
,parse_mode
,type
,media
&caption
See https://t.me/c/1494805131/16382 + replies for discussion.
The text was updated successfully, but these errors were encountered: