Merging upstream version 1.14.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
bd96b2e60a
commit
e30705f8de
24 changed files with 55 additions and 96 deletions
|
@ -1,5 +1,5 @@
|
|||
[bumpversion]
|
||||
current_version = 1.14.0
|
||||
current_version = 1.14.1
|
||||
commit = True
|
||||
tag = True
|
||||
|
||||
|
|
4
.github/workflows/release.yaml
vendored
4
.github/workflows/release.yaml
vendored
|
@ -23,7 +23,7 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7
|
||||
python-version: 3.8
|
||||
architecture: 'x64'
|
||||
- name: Cache venv
|
||||
uses: actions/cache@v1
|
||||
|
@ -77,7 +77,7 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7
|
||||
python-version: 3.8
|
||||
architecture: 'x64'
|
||||
- name: Cache venv
|
||||
uses: actions/cache@v1
|
||||
|
|
2
.github/workflows/test-binary-build.yaml
vendored
2
.github/workflows/test-binary-build.yaml
vendored
|
@ -24,7 +24,7 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7
|
||||
python-version: 3.8
|
||||
architecture: 'x64'
|
||||
- name: Cache venv
|
||||
uses: actions/cache@v1
|
||||
|
|
4
.github/workflows/test.yaml
vendored
4
.github/workflows/test.yaml
vendored
|
@ -13,7 +13,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os: ["ubuntu-20.04"]
|
||||
python: ["3.7", "3.8", "3.9", "3.10", "3.11.1"]
|
||||
python: ["3.8", "3.9", "3.10", "3.11.1"]
|
||||
redis: [5, 6, 7, 7.2]
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
|
@ -65,7 +65,7 @@ jobs:
|
|||
skip: ./docs/assets/demo.svg,./iredis/data/commands.json,./iredis/data/commands/*,./tests/unittests/*
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.7
|
||||
python-version: 3.8
|
||||
architecture: "x64"
|
||||
- name: Cache venv
|
||||
uses: actions/cache@v2
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
## UPCOMING
|
||||
|
||||
### 1.14.1
|
||||
|
||||
- Bugfix: fix argument parsing, `"foo\nbar"` will be parsed to `foo` and `\`
|
||||
and `n` and `bar`, the `\` and `n` should be one character `\n` instead.
|
||||
|
||||
## 1.14
|
||||
|
||||
- Dependency: upgrade redis-py to 5 (thanks to [chayim])
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<p align="center">
|
||||
<a href="https://github.com/laixintao/iredis/actions"><img src="https://github.com/laixintao/iredis/workflows/Test/badge.svg" alt="Github Action"></a>
|
||||
<a href="https://badge.fury.io/py/iredis"><img src="https://badge.fury.io/py/iredis.svg" alt="PyPI version"></a>
|
||||
<img src="https://badgen.net/badge/python/3.7%20%7C%203.8%20%7C%203.9%20%7C%203.10%20%7C%203.11" alt="Python version">
|
||||
<img src="https://badgen.net/badge/python/3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11" alt="Python version">
|
||||
<a href="https://pepy.tech/project/iredis"><img src="https://pepy.tech/badge/iredis" alt="Download stats"></a>
|
||||
</p>
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
__version__ = "1.14.0"
|
||||
__version__ = "1.14.1"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""
|
||||
IRedis client.
|
||||
"""
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
|
|
|
@ -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
|
||||
):
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import logging
|
||||
import sys
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import sys
|
||||
import click
|
||||
from .commands import dangerous_commands
|
||||
|
|
62
poetry.lock
generated
62
poetry.lock
generated
|
@ -1,4 +1,4 @@
|
|||
# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand.
|
||||
# This file is automatically @generated by Poetry 1.7.0 and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "async-timeout"
|
||||
|
@ -11,9 +11,6 @@ files = [
|
|||
{file = "async_timeout-4.0.3-py3-none-any.whl", hash = "sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
typing-extensions = {version = ">=3.6.5", markers = "python_version < \"3.8\""}
|
||||
|
||||
[[package]]
|
||||
name = "click"
|
||||
version = "8.1.7"
|
||||
|
@ -27,7 +24,6 @@ files = [
|
|||
|
||||
[package.dependencies]
|
||||
colorama = {version = "*", markers = "platform_system == \"Windows\""}
|
||||
importlib-metadata = {version = "*", markers = "python_version < \"3.8\""}
|
||||
|
||||
[[package]]
|
||||
name = "colorama"
|
||||
|
@ -68,26 +64,6 @@ files = [
|
|||
[package.extras]
|
||||
test = ["pytest (>=6)"]
|
||||
|
||||
[[package]]
|
||||
name = "importlib-metadata"
|
||||
version = "6.7.0"
|
||||
description = "Read metadata from Python packages"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "importlib_metadata-6.7.0-py3-none-any.whl", hash = "sha256:cb52082e659e97afc5dac71e79de97d8681de3aa07ff18578330904a9d18e5b5"},
|
||||
{file = "importlib_metadata-6.7.0.tar.gz", hash = "sha256:1aaf550d4f73e5d6783e7acb77aec43d49da8017410afae93822cc9cca98c4d4"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""}
|
||||
zipp = ">=0.5"
|
||||
|
||||
[package.extras]
|
||||
docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"]
|
||||
perf = ["ipython"]
|
||||
testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)", "pytest-ruff"]
|
||||
|
||||
[[package]]
|
||||
name = "iniconfig"
|
||||
version = "2.0.0"
|
||||
|
@ -180,9 +156,6 @@ files = [
|
|||
{file = "pluggy-1.2.0.tar.gz", hash = "sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||
|
||||
[package.extras]
|
||||
dev = ["pre-commit", "tox"]
|
||||
testing = ["pytest", "pytest-benchmark"]
|
||||
|
@ -240,7 +213,6 @@ files = [
|
|||
[package.dependencies]
|
||||
colorama = {version = "*", markers = "sys_platform == \"win32\""}
|
||||
exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
|
||||
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||
iniconfig = "*"
|
||||
packaging = "*"
|
||||
pluggy = ">=0.12,<2.0"
|
||||
|
@ -287,8 +259,6 @@ files = [
|
|||
|
||||
[package.dependencies]
|
||||
async-timeout = {version = ">=4.0.2", markers = "python_full_version <= \"3.11.2\""}
|
||||
importlib-metadata = {version = ">=1.0", markers = "python_version < \"3.8\""}
|
||||
typing-extensions = {version = "*", markers = "python_version < \"3.8\""}
|
||||
|
||||
[package.extras]
|
||||
hiredis = ["hiredis (>=1.0.0)"]
|
||||
|
@ -316,17 +286,6 @@ files = [
|
|||
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typing-extensions"
|
||||
version = "4.7.1"
|
||||
description = "Backported and Experimental Type Hints for Python 3.7+"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "typing_extensions-4.7.1-py3-none-any.whl", hash = "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36"},
|
||||
{file = "typing_extensions-4.7.1.tar.gz", hash = "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wcwidth"
|
||||
version = "0.1.9"
|
||||
|
@ -338,22 +297,7 @@ files = [
|
|||
{file = "wcwidth-0.1.9.tar.gz", hash = "sha256:ee73862862a156bf77ff92b09034fc4825dd3af9cf81bc5b360668d425f3c5f1"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zipp"
|
||||
version = "3.15.0"
|
||||
description = "Backport of pathlib-compatible object wrapper for zip files"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "zipp-3.15.0-py3-none-any.whl", hash = "sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556"},
|
||||
{file = "zipp-3.15.0.tar.gz", hash = "sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"]
|
||||
testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"]
|
||||
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.7"
|
||||
content-hash = "33eaaf0e62340be5fa5c74233fd0760e61c9635cbad8f38d625f3c253fb9df4c"
|
||||
python-versions = "^3.8"
|
||||
content-hash = "6237a8e8d2a29bc969f11386bfb6b7fca4006212b57e91f3e120cc7353e36e55"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "iredis"
|
||||
version = "1.14.0"
|
||||
version = "1.14.1"
|
||||
description = "Terminal client for Redis with auto-completion and syntax highlighting."
|
||||
authors = ["laixintao <laixintao1995@163.com>"]
|
||||
readme = 'README.md'
|
||||
|
@ -15,7 +15,6 @@ classifiers = [
|
|||
"Environment :: Console :: Curses",
|
||||
"Environment :: MacOS X",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
|
@ -31,7 +30,7 @@ packages = [
|
|||
]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.7"
|
||||
python = "^3.8"
|
||||
prompt_toolkit = "^3"
|
||||
Pygments = "^2"
|
||||
mistune = "^3.0"
|
||||
|
|
|
@ -19,7 +19,7 @@ def test_log_location_config():
|
|||
|
||||
log = Path("/tmp/iredis1.log")
|
||||
assert log.exists()
|
||||
with open(log, "r") as logfile:
|
||||
with open(log) as logfile:
|
||||
content = logfile.read()
|
||||
|
||||
assert len(content) > 100
|
||||
|
|
|
@ -10,7 +10,7 @@ def test_history_not_log_auth(cli):
|
|||
cli.sendline("set foo bar")
|
||||
cli.expect("OK")
|
||||
|
||||
with open(os.path.expanduser("~/.iredis_history"), "r") as history_file:
|
||||
with open(os.path.expanduser("~/.iredis_history")) as history_file:
|
||||
content = history_file.read()
|
||||
|
||||
assert "set foo bar" in content
|
||||
|
@ -36,7 +36,7 @@ def test_history_create_and_writing_with_config():
|
|||
log = Path("/tmp/iredis_history.txt")
|
||||
assert log.exists()
|
||||
|
||||
with open(log, "r") as logfile:
|
||||
with open(log) as logfile:
|
||||
content = logfile.read()
|
||||
|
||||
assert "set hello world" in content
|
||||
|
|
|
@ -13,12 +13,12 @@ TEST_IREDISRC = "/tmp/.iredisrc.test"
|
|||
TEST_PAGER_BOUNDARY = "---boundary---"
|
||||
TEST_PAGER_BOUNDARY_NUMBER = "---88938347271---"
|
||||
|
||||
env_pager = "{0} {1} {2}".format(
|
||||
env_pager = "{} {} {}".format(
|
||||
sys.executable,
|
||||
os.path.join(pathlib.Path(__file__).parent, "wrappager.py"),
|
||||
TEST_PAGER_BOUNDARY,
|
||||
)
|
||||
env_pager_numbers = "{0} {1} {2}".format(
|
||||
env_pager_numbers = "{} {} {}".format(
|
||||
sys.executable,
|
||||
os.path.join(pathlib.Path(__file__).parent, "wrappager.py"),
|
||||
TEST_PAGER_BOUNDARY_NUMBER,
|
||||
|
|
|
@ -53,7 +53,7 @@ def judge_command():
|
|||
return
|
||||
|
||||
variables = m.variables()
|
||||
print("Found variables: {}".format(variables))
|
||||
print(f"Found variables: {variables}")
|
||||
for expect_token, expect_value in expect.items():
|
||||
all_variables = variables.getall(expect_token)
|
||||
if len(all_variables) > 1:
|
||||
|
|
|
@ -174,6 +174,19 @@ def test_command_shell_options_higher_priority():
|
|||
verify_ssl=None,
|
||||
),
|
||||
),
|
||||
(
|
||||
"redis://username:pass@word@localhost:12345/2",
|
||||
DSN(
|
||||
scheme="redis",
|
||||
host="localhost",
|
||||
port=12345,
|
||||
path=None,
|
||||
db=2,
|
||||
username="username",
|
||||
password="pass@word",
|
||||
verify_ssl=None,
|
||||
),
|
||||
),
|
||||
(
|
||||
"redis://username@localhost:12345",
|
||||
DSN(
|
||||
|
|
|
@ -55,6 +55,7 @@ def test_timer():
|
|||
(r'""', [""]), # set foo "" is a legal command
|
||||
(r"\\", ["\\\\"]), # backslash are legal
|
||||
("\\hello\\", ["\\hello\\"]), # backslash are legal
|
||||
('foo "bar\\n1"', ["foo", "bar\n1"]),
|
||||
],
|
||||
)
|
||||
def test_stripe_quote_escape_in_quote(test_input, expected):
|
||||
|
|
Loading…
Add table
Reference in a new issue