Skip to content

Commit cc8c2e7

Browse files
committed
Remove six
1 parent 88c0d48 commit cc8c2e7

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

fakeredis/_fakesocket.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import time
88

99
import redis
10-
import six
1110

1211
from . import _msgs as msgs
1312
from ._basefakesocket import BaseFakeSocket
@@ -1518,10 +1517,15 @@ def _convert_lua_result(self, result, nested=True):
15181517
return 1 if result else None
15191518
return result
15201519

1520+
def ensure_str(self, s):
1521+
return (s.decode(encoding='utf-8', errors='replace')
1522+
if isinstance(s, bytes)
1523+
else str(s).encode(encoding='utf-8', errors='replace'))
1524+
15211525
def _check_for_lua_globals(self, lua_runtime, expected_globals):
15221526
actual_globals = set(lua_runtime.globals().keys())
15231527
if actual_globals != expected_globals:
1524-
unexpected = [six.ensure_str(var, 'utf-8', 'replace')
1528+
unexpected = [self.ensure_str(var, 'utf-8', 'replace')
15251529
for var in actual_globals - expected_globals]
15261530
raise SimpleError(msgs.GLOBAL_VARIABLE_MSG.format(", ".join(unexpected)))
15271531

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ name = "fakeredis"
88
packages = [
99
{ include = "fakeredis" },
1010
]
11-
version = "1.9.2"
11+
version = "1.9.3"
1212
description = "Fake implementation of redis API for testing purposes."
1313
readme = "README.md"
1414
keywords = ["redis", "rq", "django-rq", "rq-scheduler"]

test/test_fakeredis6.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import pytest
1010
import redis
1111
import redis.client
12-
import six
1312
from packaging.version import Version
1413
from redis.exceptions import ResponseError
1514

@@ -3001,7 +3000,7 @@ def test_pipeline_raises_when_watched_key_changed(r):
30013000
p = r.pipeline()
30023001
try:
30033002
p.watch('greet', 'foo')
3004-
nextf = six.ensure_binary(p.get('foo')) + b'baz'
3003+
nextf = bytes(p.get('foo')) + b'baz'
30053004
# Simulate change happening on another thread.
30063005
r.rpush('greet', 'world')
30073006
# Begin pipelining.
@@ -3022,7 +3021,7 @@ def test_pipeline_succeeds_despite_unwatched_key_changed(r):
30223021
try:
30233022
# Only watch one of the 2 keys.
30243023
p.watch('foo')
3025-
nextf = six.ensure_binary(p.get('foo')) + b'baz'
3024+
nextf = bytes(p.get('foo')) + b'baz'
30263025
# Simulate change happening on another thread.
30273026
r.rpush('greet', 'world')
30283027
p.multi()
@@ -3042,7 +3041,7 @@ def test_pipeline_succeeds_when_watching_nonexistent_key(r):
30423041
try:
30433042
# Also watch a nonexistent key.
30443043
p.watch('foo', 'bam')
3045-
nextf = six.ensure_binary(p.get('foo')) + b'baz'
3044+
nextf = bytes(p.get('foo')) + b'baz'
30463045
# Simulate change happening on another thread.
30473046
r.rpush('greet', 'world')
30483047
p.multi()

0 commit comments

Comments
 (0)