summaryrefslogtreecommitdiffstats
path: root/iredis
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-20 05:58:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-20 05:58:47 +0000
commita18cd2460ab7b3123402eb2eb10c42a0b73257de (patch)
treec89e5f1866cba0c0521970bbbc5c538ad7b308b6 /iredis
parentReleasing debian version 1.14.1-1. (diff)
downloadiredis-a18cd2460ab7b3123402eb2eb10c42a0b73257de.tar.xz
iredis-a18cd2460ab7b3123402eb2eb10c42a0b73257de.zip
Merging upstream version 1.15.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'iredis')
-rw-r--r--iredis/__init__.py2
-rw-r--r--iredis/commands.py2
-rw-r--r--iredis/completers.py17
3 files changed, 11 insertions, 10 deletions
diff --git a/iredis/__init__.py b/iredis/__init__.py
index 4454c8d..6b0872c 100644
--- a/iredis/__init__.py
+++ b/iredis/__init__.py
@@ -1 +1 @@
-__version__ = "1.14.1"
+__version__ = "1.15.0"
diff --git a/iredis/commands.py b/iredis/commands.py
index 3580cdb..481fc74 100644
--- a/iredis/commands.py
+++ b/iredis/commands.py
@@ -115,7 +115,7 @@ def split_command_args(command):
command = command.strip()
for command_name in all_commands:
- # for command that is paritaly input, like `command in`, we should
+ # for command that is partially input, like `command in`, we should
# match with `command info`, otherwise, `command in` will result in
# `command` with `args` is ('in') which is an invalid case.
normalized_input_command = " ".join(command.split()).upper()
diff --git a/iredis/completers.py b/iredis/completers.py
index b17d3cc..b412010 100644
--- a/iredis/completers.py
+++ b/iredis/completers.py
@@ -1,7 +1,8 @@
import logging
from typing import Iterable
+from datetime import datetime, timezone
-import pendulum
+from dateutil.relativedelta import relativedelta
from prompt_toolkit.completion import (
CompleteEvent,
Completer,
@@ -102,19 +103,19 @@ class TimestampCompleter(Completer):
if not text.isnumeric():
return
current = int(text)
- now = pendulum.now()
+ now = datetime.now()
for unit, minimum in self.when_lower_than.items():
if current <= minimum:
if self.future_time:
- dt = now.add(**{f"{unit}s": current})
+ dt = now + relativedelta(**{f"{unit}s": current})
offset_text = "later"
else:
- dt = now.subtract(**{f"{unit}s": current})
+ dt = now - relativedelta(**{f"{unit}s": current})
offset_text = "ago"
- meta = f"{text} {unit}{'s' if current > 1 else ''} {offset_text} ({dt.format('YYYY-MM-DD HH:mm:ss')})"
+ meta = f"{text} {unit}{'s' if current > 1 else ''} {offset_text} ({dt.strftime('%Y-%m-%d %H:%M:%S')})"
yield Completion(
- str(dt.int_timestamp * self.factor),
+ str(int(dt.timestamp()) * self.factor),
start_position=-len(document.text_before_cursor),
display_meta=meta,
)
@@ -122,11 +123,11 @@ class TimestampCompleter(Completer):
def _completion_formatted_time(self, document: Document) -> Iterable[Completion]:
text = document.text
try:
- dt = pendulum.parse(text)
+ dt = datetime.fromisoformat(text).replace(tzinfo=timezone.utc)
except Exception:
return
yield Completion(
- str(dt.int_timestamp * self.factor),
+ str(int(dt.timestamp()) * self.factor),
start_position=-len(document.text_before_cursor),
display_meta=str(dt),
)