Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: Add FUNCTION LIST command. #1738

Merged
merged 36 commits into from
Jul 2, 2024

Conversation

Cole-Greer
Copy link
Contributor

@Cole-Greer Cole-Greer commented Jul 1, 2024

Issue #, if available: N/A

Description of changes:
https://redis.io/docs/latest/commands/function-list/

This is based off of the Java implementation from #1452

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Cole-Greer Cole-Greer changed the title FUNCTION LIST tracer code Python: Add FUNCTION LIST command. Jul 1, 2024
@Yury-Fridlyand Yury-Fridlyand added the python Python wrapper label Jul 1, 2024
python/python/glide/async_commands/cluster_commands.py Outdated Show resolved Hide resolved
python/python/glide/async_commands/cluster_commands.py Outdated Show resolved Hide resolved
python/python/glide/async_commands/cluster_commands.py Outdated Show resolved Hide resolved
python/python/glide/async_commands/cluster_commands.py Outdated Show resolved Hide resolved
python/python/glide/async_commands/standalone_commands.py Outdated Show resolved Hide resolved
python/python/tests/test_async_client.py Outdated Show resolved Hide resolved
python/python/tests/test_async_client.py Outdated Show resolved Hide resolved
python/python/tests/test_async_client.py Show resolved Hide resolved
python/python/tests/utils/utils.py Show resolved Hide resolved
python/python/tests/utils/utils.py Outdated Show resolved Hide resolved
library_name: Optional[str] = None,
with_code: bool = False,
route: Optional[Route] = None,
) -> List[Mapping[bytes, Any]]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I guess you can use str for now (and for simplicity)
  2. Replace Any with a real type (union of union of union ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the exact return type should be List[Mapping[bytes, List[Mapping[bytes, Union[bytes, List[Mapping[bytes, Union[bytes, Set[bytes]]]]]]]]]. Is this preferred over List[Mapping[bytes, Any]]?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I introduced TFunctionListResponse to constants.py to ease usage of this return type.

python/python/tests/test_async_client.py Outdated Show resolved Hide resolved
python/python/tests/test_async_client.py Outdated Show resolved Hide resolved
python/python/tests/utils/utils.py Show resolved Hide resolved
@Cole-Greer Cole-Greer marked this pull request as ready for review July 2, 2024 01:28
@Cole-Greer Cole-Greer requested a review from a team as a code owner July 2, 2024 01:28
@acarbonetto acarbonetto merged commit b46591d into valkey-io:main Jul 2, 2024
8 checks passed
@acarbonetto acarbonetto deleted the python/integ_cole_function-list branch July 2, 2024 17:16
cyip10 pushed a commit to Bit-Quill/valkey-glide that referenced this pull request Jul 16, 2024
* FUNCTION LIST tracer code

* update defaults

* fix type hints

* add tests

* add client tests

* update client tests with FUNCTION LIST

* fix formatting

* fix typing

* update typing

* typing updates

* fix formatting

* Apply suggestions from code review

Co-authored-by: Aaron <[email protected]>

* update response type to use bytes instead of str

* formatting

* add routing to function list tests

* fix routing tests

* update routing tests

* fix tests

* formatting

* rename args, add docstrings, update tests

* formatting

* updated docstrings and tests

* changelog

* fix tests

* update type definitions

* Apply suggestions from code review

Co-authored-by: Yury-Fridlyand <[email protected]>

* update docstrings

* Apply suggestions from code review

Co-authored-by: Aaron <[email protected]>

* minor cleanup

* black fixes

* fix typing

* update to use TEncodable

* introduce TFunctionListResponse to abstract away complex return type

---------

Co-authored-by: Aaron <[email protected]>
Co-authored-by: Yury-Fridlyand <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Python wrapper
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

5 participants