Closed
Conversation
Bibo-Joshi
requested changes
Oct 16, 2020
Member
Bibo-Joshi
left a comment
There was a problem hiding this comment.
Thanks for the PR! I didn't go over in in detail, yet, but I have some more general remarks:
- Please have a look at our contribution guide on how to run the tests locally
- Please merge from master (so, we can see code coverage results here, see #2127)
- Tuples should only be allowed where it really doesn't matter if it's a tuple or a list and for interal stuff we should stick to one. I saw some private methods (with leading underscore) changed, where that should be double checked (ignore this comment, if you already did that ;) )
- I might be a good idea to add a custom type
StrInput = Union[str, List[str], Tuple[str]](or similar namingtotelegram.utils.typingand same forint`
Comment on lines
+1594
to
+1599
| elif isinstance(lang, List[str]): | ||
| lang = cast(List[str], lang) | ||
| self.lang = lang | ||
| else: | ||
| lang = cast(Tuple[str], lang) | ||
| self.lang = lang |
Member
There was a problem hiding this comment.
This change is responsible for the failing tests ;) Probably change it to something like
Suggested change
| elif isinstance(lang, List[str]): | |
| lang = cast(List[str], lang) | |
| self.lang = lang | |
| else: | |
| lang = cast(Tuple[str], lang) | |
| self.lang = lang | |
| elif isinstance(lang, list): | |
| self.lang = lang | |
| else: | |
| lang = cast(Tuple[str], lang) | |
| self.lang = list(lang) |
Contributor
Author
There was a problem hiding this comment.
Oh, sorry. I did change that but I think it got stashed when I was fixing something. I'll do that right now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes Issue #2125
A better type hinting to allow Tuples along with Lists wherever it can be used that way.