Skip to content

Avoid deprecation warnings on redis-py 3.5.0 hmset#1253

Merged
selwin merged 1 commit intorq:masterfrom
bbayles:redis-3.5.0-hmset
May 16, 2020
Merged

Avoid deprecation warnings on redis-py 3.5.0 hmset#1253
selwin merged 1 commit intorq:masterfrom
bbayles:redis-3.5.0-hmset

Conversation

@bbayles
Copy link
Copy Markdown
Contributor

@bbayles bbayles commented May 15, 2020

Re: #1244, this PR adds an hmset function to the compatibility module such that hset is preferred over hmset when running redis-py 3.5.0+.

def hmset(pipe_or_connection, name, mapping):
# redis-py versions 3.5.0 and above accept a mapping parameter for hset
try:
return pipe_or_connection.hset(name, mapping=mapping)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This signature for hset changed in redis-py 3.5.0, so this will immediately raise a TypeError if it's wrong.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

An alternative would be to check redis.__version__.

@codecov
Copy link
Copy Markdown

codecov bot commented May 15, 2020

Codecov Report

Merging #1253 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1253   +/-   ##
=======================================
  Coverage   93.83%   93.83%           
=======================================
  Files          22       22           
  Lines        2319     2319           
=======================================
  Hits         2176     2176           
  Misses        143      143           
Impacted Files Coverage Δ
rq/job.py 97.46% <100.00%> (ø)
rq/worker.py 91.01% <100.00%> (ø)

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 e6e5703...5daf1bd. Read the comment docs.

@selwin selwin merged commit 5859339 into rq:master May 16, 2020
@selwin
Copy link
Copy Markdown
Collaborator

selwin commented May 16, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants