Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

aioredis.from_url() is missing type annotation #1349

Open
1 task done
guludo opened this issue Apr 18, 2022 · 1 comment
Open
1 task done

aioredis.from_url() is missing type annotation #1349

guludo opened this issue Apr 18, 2022 · 1 comment
Labels

Comments

@guludo
Copy link

guludo commented Apr 18, 2022

Describe the bug

The function aioredis.from_url() is not type-annotated and that causes checks with mypy --strict to fail in user code.

To Reproduce

  1. Create a file (e.g. foo.py) containing the following:
    import aioredis
    redis = aioredis.from_url('redis://localhost')
  2. Check that file with mypy in strict mode (e.g. mypy --strict foo.py). That will cause the following error: error: Call to untyped function "from_url" in typed context.

Expected behavior

The expected behavior is to have mypy approving the example file in strict mode.

Logs/tracebacks

N/A

Python Version

$ python --version
Python 3.10.4

aioredis Version

$ python -m pip show aioredis
Name: aioredis
Version: 2.0.1
Summary: asyncio (PEP 3156) Redis support
Home-page: https://github.com/aio-libs/aioredis-py
Author:
Author-email:
License: MIT
Location: <prefix-removed-by-the-author>/venv/lib/python3.10/site-packages
Requires: async-timeout, typing-extensions
Required-by:

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@guludo guludo added the bug label Apr 18, 2022
@guludo guludo changed the title from_url() is missing annotation for return type aioredis.from_url() is missing type annotation Apr 18, 2022
@fdev31
Copy link

fdev31 commented Aug 18, 2022

It looks like it's a few bytes fix...
Changing

def from_url(url, **kwargs):

into

def from_url(url: str, **kwargs) -> Redis:

in the utils.py seem to do the job... in a project the only warnings were coming from this function and with the patch it's all fine.

Is there any reason for this to not be done while it looks really trivial?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants