Conversation
12d6c19 to
5e4f5aa
Compare
twitchAPI/chat/__init__.py
Outdated
|
|
||
| @staticmethod | ||
| def _parse_irc_source(raw_source_component: str): | ||
| def _parse_irc_source(raw_source_component: str) -> dict[str, Optional[str]]: |
There was a problem hiding this comment.
If supporting 3.7+ then this needs to be Dict from typing and not builtin dict
twitchAPI/eventsub/webhook.py
Outdated
| } | ||
|
|
||
| async def _build_request_header(self) -> dict: | ||
| async def _build_request_header(self) -> dict[str,str]: |
There was a problem hiding this comment.
If supporting 3.7+ then this needs to be Dict from typing and not builtin dict
twitchAPI/chat/__init__.py
Outdated
| self.username: Optional[str] = None | ||
|
|
||
| def __await__(self): | ||
| def __await__(self) -> Generator[Any, Any, 'Chat']: |
There was a problem hiding this comment.
Should probably be Generator[Any, None, "Chat"]
|
I should note that I added |
|
I planned on dropping 3.7 compatibility with the next major release at the latest anyway since that python version is now long EOL. Not entirely sure which to target for now though. 3.10 would make sence as its the oldes version thats not EOL yet. |
|
Python 3.10 SGTM, should I change the version strings in this PR? Or is this good to merge as is? |
|
merge as is for now, gonna have to take a look if I want to go straight to 3.11 if I have to drop support rn anyway. And the change would not fit this PR anyway. |
twitchAPI/eventsub/webhook.py
Outdated
| self.logger.debug('eventsub shut down') | ||
|
|
||
| def _get_transport(self) -> dict: | ||
| def _get_transport(self) -> dict[str,str]: |
There was a problem hiding this comment.
this should also be Dict[str, str] like the other one
This is a first stab at completing type information for pyTwitchAPI to make mypy shut up when I'm using pyTwitchAPI. As this is my first contribution, I'm limiting this to low hanging fruit and a few of the files. If all goes well I'll do more. Signed-off-by: Cmdr. Emily <68452184+cmdremily@users.noreply.github.com>
What
This is a first stab at completing type information for pyTwitchAPI. As this is my first contribution, I'm limiting this to low hanging fruit and a few of the files. If all goes well I'll do more.
Also add explicit python version to
setup.pybased on comments about what the minimum version is inREADME.md.Why
When using
pyTwitchAPIin my project withmypyI get errors due to missing type information inpyTwitchAPI.How
I repeatedly ran
mypy --strict .from the project root and fixed easy, unmistakable missing type annotations, mainly on return types.