0
  #   9ˆÌËÐ‚lBÊa–Ãa¾”Ò~êqA
à\¸ÐTÅ£Î 
    9‹      Õ•QoÓ0Çß÷)Œxk/éÊ�c4šJTtmÕ!„rb·±–Ø•í´”O�Ó¤´L+b<ù|ùûî~—ÄGžÄ“þüýt€^Ï¯GhúöÕhØG¸ðî¼ÏãúA·„ ƒ1F8snÕØl6íÍy[›%Ìg�¹"ï‚uF¦®ÍÇôŒT>z†H&÷+"Nº\Ð¡ââ3ÒºtVráÏm-p±–©°•íD…(´Ù6K”æ"hvØ2©eê˜>4iH¢ù¶ÊþáL>à‚%»„•i(qZ³\.U„�^aJd±DÖ¤™je!É™ºm/å#–»ö'½\V�¦„¡ÌˆE„_ö£ñå$Š1³B`÷k®½æ
Ó³šË…ü¤ø¦ßÈ/§Æµ&65rå¤V)xÄcÔTçvÅ<ë3O�™cU-á?ëK¿kÆôj6Ïãá¬n	¯Bªûý÷†é”¡Š¥©ó¾ªÎðT%vu¹ß¢¦d#—™Ã¡ºWùœ�saŽIO1î©0Ý[Ç•Þ)­t.ZaØ
_ ðy/¸@èq0¹fÇÐX�…¡T·JoÔ1„ÿœñ‰•>”Ñ‰øFsp= « NØÂ“Xþ*}ó°î ý¯8¥XûßÓzýû ¼ü vã‡@=ü¾&¹ýn_    8   ;ˆl–Ðz¾”ªe¶¥	@ŠãNÜlJbÑ¿�þE’,ÙDä�³,ƒ(üÿÓ„D'ÿÒÂ¿Ï +Ý    ;from collections import OrderedDict

# from prettytable import PrettyTable
from redis import ResponseError

from .edge import Edge
from .exceptions import VersionMismatchException
from .node import Node
from .path import Path

LABELS_ADDED = "Labels added"
NODES_CREATED = "Nodes created"
NODES_DELETED = "Nodes deleted"
RELATIONSHIPS_DELETED = "Relationships deleted"
PROPERTIES_SET = "Properties set"
RELATIONSHIPS_CREATED = "Relationships created"
INDICES_CREATED = "Indices created"
INDICES_DELETED = "Indices deleted"
CACHED_EXECUTION = "Cached execution"
INTERNAL_EXECUTION_TIME = "internal execution time"

STATS = [
    LABELS_ADDED,
    NODES_CREATED,
    PROPERTIES_SET,
    RELATIONSHIPS_CREATED,
    NODES_DELETED,
    RELATIONSHIPS_DELETED,
    INDICES_CREATED,
    INDICES_DELETED,
    CACHED_EXECUTION,
    INTERNAL_EXECUTION_TIME,
]


class ResultSetColumnTypes:
    COLUMN_UNKNOWN = 0
    COLUMN_SCALAR = 1
    COLUMN_NODE = 2  # Unused as of RedisGraph v2.1.0, retained for backwards compatibility. # noqa
    COLUMN_RELATION = 3  # Unused as of RedisGraph v2.1.0, retained for backwards compatibility. # noqa


class ResultSetScalarTypes:
    VALUE_UNKNOWN = 0
    VALUE_NULL = 1
    VALUE_STRING = 2
    VALUE_INTEGER = 3
    VALUE_BOOLEAN = 4
    VALUE_DOUBLE = 5
    VALUE_ARRAY = 6
    VALUE_EDGE = 7
    VALUE_NODE = 8
    VALUE_PATH = 9
    VALUE_MAP = 10
    VALUE_POINT = 11


class QueryResult:
    def __init__(self, graph, response, profile=False):
        """
        A class that represents a result of the query operation.

        Args:

        graph:
            The graph on which the query was executed.
        response:
            The response from the server.
        profile:
            A boolean indicating if the query command was "GRAPH.PROFILE"
        """
        self.graph = graph
        self.header = []
        self.result_set = []

        # in case of an error an exception will be raised
        self._check_for_errors(response)

        if len(response) == 1:
            self.parse_statistics(response[0])
        elif profile:
            self.parse_profile(response)
        else:
            # start by parsing statistics, matches the one we have
            self.parse_statistics(response[-1])  # Last element.
            self.parse_results(response)

    def _check_for_errors(self, response):
        if isinstance(response[0], ResponseError):
            error = response[0]
            if str(error) == "version mismatch":
                version = response[1]
                error = VersionMismatchException(version)
            raise error

        # If we encountered a run-time error, the last response
        # element will be an exception
        if isinstance(response[-1], ResponseError):
            raise response[-1]

    def parse_results(self, raw_result_set):
        self.header = self.parse_header(raw_result_set)

        # Empty header.
        if len(self.header) == 0:
            return

        self.result_set = self.parse_records(raw_result_set)

    def parse_statistics(self, raw_statistics):
        self.statistics = {}

        # decode statistics
        for idx, stat in enumerate(raw_statistics):
            if isinstance(stat, bytes):
                raw_statistics[idx] = stat.decode()

        for s in STATS:
            v = self._get_value(s, raw_statistics)
            if v is not None:
                self.statistics[s] = v

    def 