fix: wrong type hinting and redundant 'kwargs' in '_Redis.get()'
See original GitHub issueWrong:
class _Redis(Backend):
async def get(self, key: str, **kwargs) -> Any:
return await self._client.get(key, **kwargs)
Correct:
class _Redis(Backend):
async def get(self, key: str) -> bytes:
return await self._client.get(key)
Problems:
key()
does not acceptkwargs
key()
always returnsbytes
By the way, not related to this issue, but super().__init__()
is missing in _Redis.__init__
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
python type hinting not generating error for wrong type
It's called type hinting for a reason: you're giving a hint about what a variable should be to the IDE or to anyone...
Read more >Unexpected keyword argument 'total' prevents events from ...
+1, I'm seeing "Unhandled exception in event processor. Analytics events were not processed. [init() got an unexpected keyword argument 'total'] ...
Read more >python/typing - Gitter
I'm struggling to find type hints that will work with a generic factory function I've built (I was referred to the mypy issue...
Read more >Error codes for optional checks - mypy 0.991 documentation
Check that type arguments exist [type-arg] For example, the types list or dict would be rejected. You should instead use types like list[int]...
Read more >PyModbus Documentation - Read the Docs
Fix type hints for port and timeout (#1147). • Start/stop multiple servers. (#1138). • Server/asyncio.py correct logging when disconnecting ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
About type hints. You write everywhere
something: Union[float, int]
, but this is redundant becausesomething: float
is the same. When you writefloat
, it also says thatint
is accepted too. See https://www.python.org/dev/peps/pep-0484/#the-numeric-towerI’ll close this issue. Some problems already fixed and some should be done with typing support issue https://github.com/Krukov/cashews/issues/66