diff options
author | Chayim <chayim@users.noreply.github.com> | 2021-10-28 09:57:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-28 09:57:03 +0300 |
commit | eaa56b7d721182541bab087a6d61304c778f7ea9 (patch) | |
tree | 9ff017a9ef6f4fc9da152951a9939ef5297f8969 /redis/commands/helpers.py | |
parent | 1f11f8c4ecbc2227c28077b9e9764e543c38d0a5 (diff) | |
download | redis-py-eaa56b7d721182541bab087a6d61304c778f7ea9.tar.gz |
redis timeseries support (#1652)
Diffstat (limited to 'redis/commands/helpers.py')
-rw-r--r-- | redis/commands/helpers.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/redis/commands/helpers.py b/redis/commands/helpers.py index b012621..a92c025 100644 --- a/redis/commands/helpers.py +++ b/redis/commands/helpers.py @@ -23,3 +23,17 @@ def nativestr(x): def delist(x): """Given a list of binaries, return the stringified version.""" return [nativestr(obj) for obj in x] + + +def parse_to_list(response): + """Optimistally parse the response to a list. + """ + res = [] + for item in response: + try: + res.append(int(item)) + except ValueError: + res.append(nativestr(item)) + except TypeError: + res.append(None) + return res |