Skip to content

Type annotate valkey.utils - #319

Open
kurtmckee wants to merge 1 commit into
valkey-io:mainfrom
kurtmckee:type-annotate-utils
Open

kurtmckee wants to merge 1 commit into
valkey-io:mainfrom
kurtmckee:type-annotate-utils

Conversation

@kurtmckee

Copy link
Copy Markdown
Contributor

Pull Request check-list

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?

Description of change

This PR adds type annotations to valkey.utils. During this work, several functions were found to be unnecessary:

  • The pipeline() context manager is not used anywhere in the codebase and is not documented anywhere. Rather than trying to add type annotations, it has been removed.
  • list_keys_to_dict() is an unnecessary pass-through function to dict.fromkeys(). Rather than trying to add type annotations, it has been removed.
  • from_url() is a pass-through function to Valkey.from_url(), but it creates a circular import. Its definition has been moved to valkey/__init__.py.

Running mypy --strict shows that there are no remaining errors in valkey.utils.

Running `mypy --strict` shows that
there are no remaining errors in `valkey.utils`.

The `pipeline()` context manager is not used anywhere
in the codebase and is not documented anywhere.
Rather than trying to add type annotations,
it has been removed.

`list_keys_to_dict()` is an unnecessary pass-through function.
Rather than trying to add type annotations,
it has also been removed.

`from_url()` is a pass-through function
that creates a circular import.
It has been moved to `valkey/__init__.py`.

Signed-off-by: Kurt McKee <contactme@kurtmckee.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant