summaryrefslogtreecommitdiffstats
path: root/iredis
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-20 09:32:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-20 09:32:29 +0000
commit014c400849f01582f958e1a729ce239ffd7b2268 (patch)
treee30eac025e81b68a50ad7d167270bda28ee3ce21 /iredis
parentReleasing debian version 1.14.0-1. (diff)
downloadiredis-014c400849f01582f958e1a729ce239ffd7b2268.tar.xz
iredis-014c400849f01582f958e1a729ce239ffd7b2268.zip
Merging upstream version 1.14.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'iredis')
-rw-r--r--iredis/__init__.py2
-rw-r--r--iredis/client.py1
-rw-r--r--iredis/commands.py2
-rw-r--r--iredis/completers.py5
-rw-r--r--iredis/config.py6
-rw-r--r--iredis/entry.py1
-rw-r--r--iredis/markdown.py4
-rw-r--r--iredis/renders.py1
-rw-r--r--iredis/utils.py13
-rw-r--r--iredis/warning.py4
10 files changed, 18 insertions, 21 deletions
diff --git a/iredis/__init__.py b/iredis/__init__.py
index b9f68ed..4454c8d 100644
--- a/iredis/__init__.py
+++ b/iredis/__init__.py
@@ -1 +1 @@
-__version__ = "1.14.0"
+__version__ = "1.14.1"
diff --git a/iredis/client.py b/iredis/client.py
index f7164b8..a952638 100644
--- a/iredis/client.py
+++ b/iredis/client.py
@@ -1,6 +1,7 @@
"""
IRedis client.
"""
+
import re
import os
import sys
diff --git a/iredis/commands.py b/iredis/commands.py
index cf21a54..3580cdb 100644
--- a/iredis/commands.py
+++ b/iredis/commands.py
@@ -120,7 +120,7 @@ def split_command_args(command):
# `command` with `args` is ('in') which is an invalid case.
normalized_input_command = " ".join(command.split()).upper()
if (
- re.search("\s", command)
+ re.search(r"\s", command)
and command_name.startswith(normalized_input_command)
and command_name != normalized_input_command
):
diff --git a/iredis/completers.py b/iredis/completers.py
index 6f9ecac..b17d3cc 100644
--- a/iredis/completers.py
+++ b/iredis/completers.py
@@ -139,8 +139,7 @@ class TimestampCompleter(Completer):
)
# here we yield bigger timestamp first.
- for completion in sorted(completions, key=lambda a: a.text):
- yield completion
+ yield from sorted(completions, key=lambda a: a.text)
class IRedisCompleter(Completer):
@@ -290,7 +289,7 @@ class IRedisCompleter(Completer):
self.key_completer.touch_words(ensure_str(items))
def __repr__(self) -> str:
- return "DynamicCompleter(%r -> %r)" % (
+ return "DynamicCompleter({!r} -> {!r})".format(
self.get_completer,
self.current_completer,
)
diff --git a/iredis/config.py b/iredis/config.py
index 4041bb6..7a54220 100644
--- a/iredis/config.py
+++ b/iredis/config.py
@@ -88,13 +88,13 @@ def read_config_file(f):
config = ConfigObj(f, interpolation=False, encoding="utf8")
except ConfigObjError as e:
logger.error(
- "Unable to parse line {0} of config file " "'{1}'.".format(e.line_number, f)
+ "Unable to parse line {} of config file " "'{}'.".format(e.line_number, f)
)
logger.error("Using successfully parsed config values.")
return e.config
- except (IOError, OSError) as e:
+ except OSError as e:
logger.error(
- "You don't have permission to read " "config file '{0}'.".format(e.filename)
+ "You don't have permission to read " "config file '{}'.".format(e.filename)
)
return None
diff --git a/iredis/entry.py b/iredis/entry.py
index 0799a07..b4615bb 100644
--- a/iredis/entry.py
+++ b/iredis/entry.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
import os
import logging
import sys
diff --git a/iredis/markdown.py b/iredis/markdown.py
index 89297ec..a24b793 100644
--- a/iredis/markdown.py
+++ b/iredis/markdown.py
@@ -39,7 +39,7 @@ class TerminalRender(mistune.HTMLRenderer):
tag = "ul"
if ordered:
tag = "ol"
- return "<%s>%s</%s>\n" % (tag, body, tag)
+ return "<{}>{}</{}>\n".format(tag, body, tag)
def list_item(self, text, *args):
"""Rendering list item snippet. Like ``<li>``."""
@@ -62,5 +62,5 @@ def replace_to_markdown_title(original):
def render(text):
replaced = replace_to_markdown_title(text)
html_text = markdown_render(replaced)
- logger.debug("[Document] {} ...".format(html_text)[:20])
+ logger.debug(f"[Document] {html_text} ..."[:20])
return to_formatted_text(HTML(html_text))
diff --git a/iredis/renders.py b/iredis/renders.py
index d695407..9458263 100644
--- a/iredis/renders.py
+++ b/iredis/renders.py
@@ -4,6 +4,7 @@ This module will be auto loaded to callbacks.
func(redis-response) -> formatted result(str)
"""
+
import logging
import time
from packaging.version import parse as version_parse
diff --git a/iredis/utils.py b/iredis/utils.py
index 5a61425..aa00533 100644
--- a/iredis/utils.py
+++ b/iredis/utils.py
@@ -39,10 +39,11 @@ def literal_bytes(b):
return b
-def _valid_token(words):
- token = "".join(words).strip()
- if token:
- yield token
+def nappend(word, c, pre_back_slash):
+ if pre_back_slash and c == "n": # \n
+ word[-1] = "\n"
+ else:
+ word.append(c)
def strip_quote_args(s):
@@ -69,7 +70,7 @@ def strip_quote_args(s):
# previous char is \ , merge with current "
word[-1] = char
else:
- word.append(char)
+ nappend(word, char, pre_back_slash)
# not in quote
else:
# separator
@@ -81,7 +82,7 @@ def strip_quote_args(s):
elif char in ["'", '"']:
in_quote = char
else:
- word.append(char)
+ nappend(word, char, pre_back_slash)
if char == "\\" and not pre_back_slash:
pre_back_slash = True
else:
diff --git a/iredis/warning.py b/iredis/warning.py
index bb8231e..0217a29 100644
--- a/iredis/warning.py
+++ b/iredis/warning.py
@@ -1,7 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-
import sys
import click
from .commands import dangerous_commands