How to use the iredis.config.config function in iredis

To help you get started, we’ve selected a few iredis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github laixintao / iredis / tests / test_render_functions.py View on Github external
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
github laixintao / iredis / iredis / client.py View on Github external
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"
github laixintao / iredis / iredis / entry.py View on Github external
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)
github laixintao / iredis / iredis / renders.py View on Github external
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
github laixintao / iredis / iredis / client.py View on Github external
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"