Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_render_list_index():
from iredis.config import config
config.raw = False
raw = ["hello", "world", "foo"]
out = renders._render_list([item.encode() for item in raw], raw)
out = strip_formatted_text(out)
assert isinstance(out, str)
assert "3)" in out
assert "1)" in out
assert "4)" not in out
host=self.host,
port=self.port,
db=self.db,
password=password,
decode_responses=False,
)
# all command upper case
self.answer_callbacks = command2callback
self.callbacks = self.reder_funcname_mapping()
self.connection.connect()
if get_info:
try:
self.get_server_info()
except Exception as e:
logger.warn(f"[After Connection] {str(e)}")
config.no_version_reason = str(e)
else:
config.no_version_reason = "--no-info flag activated"
def greetings():
iredis_version = f"iredis {__version__}"
if config.no_version_reason:
reason = f"({config.no_version_reason})"
else:
reason = ""
server_version = f"redis-server {config.version} {reason}"
home_page = "Home: https://iredis.io"
issues = "Issues: https://iredis.io/issues"
display = "\n".join([iredis_version, server_version, home_page, issues])
write_result(display)
def render_unixtime(value, completers=None):
rendered_int = render_int(value, completers)
if config.raw:
return rendered_int
explained_date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(int(value)))
rendered_int.extend(
[NEWLINE_TUPLE, ("class:type", "(local time)"), ("", " "), ("", explained_date)]
)
return rendered_int
db=self.db,
password=password,
decode_responses=False,
)
# all command upper case
self.answer_callbacks = command2callback
self.callbacks = self.reder_funcname_mapping()
self.connection.connect()
if get_info:
try:
self.get_server_info()
except Exception as e:
logger.warn(f"[After Connection] {str(e)}")
config.no_version_reason = str(e)
else:
config.no_version_reason = "--no-info flag activated"