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

Add AsyncFunctionCommands #2009

Merged
merged 1 commit into from
Feb 24, 2022
Merged

Add AsyncFunctionCommands #2009

merged 1 commit into from
Feb 24, 2022

Conversation

Andrew-Chen-Wang
Copy link
Contributor

Pull Request check-list

Please make sure to review and check all of these items:

  • Does $ tox pass with this change (including linting)?
  • 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)?
  • Is the changes added to CHANGES file?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

Please provide a description of the change here.

@codecov-commenter
Copy link

codecov-commenter commented Feb 22, 2022

Codecov Report

Merging #2009 (efa5599) into master (4a714aa) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2009   +/-   ##
=======================================
  Coverage   92.63%   92.63%           
=======================================
  Files         100      100           
  Lines       20909    20910    +1     
=======================================
+ Hits        19369    19370    +1     
  Misses       1540     1540           
Impacted Files Coverage Δ
redis/commands/core.py 87.23% <100.00%> (+<0.01%) ⬆️
redis/asyncio/client.py 90.45% <0.00%> (-0.18%) ⬇️
redis/asyncio/connection.py 82.65% <0.00%> (-0.12%) ⬇️
tests/test_cluster.py 98.42% <0.00%> (+0.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4a714aa...efa5599. Read the comment docs.

"""
Kill a function that is currently executing.

For more information check https://redis.io/commands/function-kill
"""
return self.execute_command("FUNCTION KILL")

def function_stats(self) -> list:
def function_stats(self) -> Union[Awaitable[list], list]:
Copy link
Contributor

Choose a reason for hiding this comment

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

@Andrew-Chen-Wang Can you educate me. Why don't we use Union[Awaitable[List], List]

As you know type hints aren't my jam ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They're basically the same. In Python 3.6, you can only do List[element type], but in 3.7+ you can use the built in list like list[element type]. However, in this case, I'm not using the getattr method at all so either List or list works.

Also this was before I found out the other type hints were merged 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

HAHAHA Awesome. Thanks again @Andrew-Chen-Wang. I will always appreciate the education here.

@chayim chayim added the maintenance Maintenance (CI, Releases, etc) label Feb 24, 2022
@chayim chayim merged commit afc83e1 into redis:master Feb 24, 2022
dvora-h pushed a commit to jakebarnwell/redis-py that referenced this pull request Mar 1, 2022
dvora-h added a commit that referenced this pull request Mar 1, 2022
* Add support for .lock() for RedisCluster

* Update changelog with lua scripting and lock() changes

* Also update asyncio client .lock() doc

* Add Python 3.6 back to hash verify CI (#2008)

* Renaming chore as maintenance (#2015)

* Add AsyncFunctionCommands (#2009)

* Also update asyncio client .lock() doc

Co-authored-by: Chayim <chayim@users.noreply.github.com>
Co-authored-by: Andrew Chen Wang <60190294+Andrew-Chen-Wang@users.noreply.github.com>
Co-authored-by: dvora-h <dvora.heller@redis.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Maintenance (CI, Releases, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants