question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fix: wrong type hinting and redundant 'kwargs' in '_Redis.get()'

See original GitHub issue

Wrong:

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)

‘Redis.key()’ signature

Problems:

  1. key() does not accept kwargs
  2. key() always returns bytes

By the way, not related to this issue, but super().__init__() is missing in _Redis.__init__.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
AIGeneratedUsernamecommented, Feb 16, 2022

About type hints. You write everywhere something: Union[float, int], but this is redundant because something: float is the same. When you write float, it also says that int is accepted too. See https://www.python.org/dev/peps/pep-0484/#the-numeric-tower

0reactions
Krukovcommented, May 21, 2022

I’ll close this issue. Some problems already fixed and some should be done with typing support issue https://github.com/Krukov/cashews/issues/66

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found