# Path: impala/util.py
# def _escape(s):
#     e = s
#     e = e.replace('\\', '\\\\')
#     e = e.replace('\n', '\\n')
#     e = e.replace('\r', '\\r')
#     e = e.replace("'", "\\'")
#     e = e.replace('"', '\\"')
#     log.debug('%s => %s', s, e)
#     return e
# 
# Path: impala/error.py
# class Error(Exception):
#     pass
# 
# class Warning(Exception):
#     pass
# 
# class InterfaceError(Error):
#     pass
# 
# class DatabaseError(Error):
#     pass
# 
# class InternalError(DatabaseError):
#     pass
# 
# class OperationalError(DatabaseError):
#     pass
# 
# class ProgrammingError(DatabaseError):
#     pass
# 
# class IntegrityError(DatabaseError):
#     pass
# 
# class DataError(DatabaseError):
#     pass
# 
# class NotSupportedError(DatabaseError):
#     pass


import datetime
import re
import six
from six import reraise
from impala.util import _escape
from impala.error import (  # pylint: disable=unused-import
    Error, Warning, InterfaceError, DatabaseError, InternalError,
    OperationalError, ProgrammingError, IntegrityError, DataError,
    NotSupportedError)
        from thrift_sasl import TSaslClientTransport

    def reconnect(self):
        raise NotImplementedError

    def kerberized(self):
        # pylint: disable=protected-access
        # returns bool whether underlying service is kerberized or not
        if isinstance(self.service._iprot.trans, TSaslClientTransport):
            if self.service._iprot.trans.mechanism == 'GSSAPI':
                return True
        return False

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        self.close()
        if exc_type is not None:
            reraise(exc_type, exc_val, exc_tb)

    # optional DB API addition to make the errors attributes of Connection
    Error = Error
    Warning = Warning
    InterfaceError = InterfaceError
    DatabaseError = DatabaseError
    InternalError = InternalError
    OperationalError = OperationalError
    ProgrammingError = ProgrammingError
    IntegrityError = IntegrityError
    DataError = DataError

# Path: impala/util.py
# def _escape(s):
#     e = s
#     e = e.replace('\\', '\\\\')
#     e = e.replace('\n', '\\n')
#     e = e.replace('\r', '\\r')
#     e = e.replace("'", "\\'")
#     e = e.replace('"', '\\"')
#     log.debug('%s => %s', s, e)
#     return e
# 
# Path: impala/error.py
# class Error(Exception):
#     pass
# 
# class Warning(Exception):
#     pass
# 
# class InterfaceError(Error):
#     pass
# 
# class DatabaseError(Error):
#     pass
# 
# class InternalError(DatabaseError):
#     pass
# 
# class OperationalError(DatabaseError):
#     pass
# 
# class ProgrammingError(DatabaseError):
#     pass
# 
# class IntegrityError(DatabaseError):
#     pass
# 
# class DataError(DatabaseError):
#     pass
# 
# class NotSupportedError(DatabaseError):
#     pass


# Path: impala/interface.py
import datetime
import re
import six
from six import reraise
from impala.util import _escape
from impala.error import (  # pylint: disable=unused-import
    Error, Warning, InterfaceError, DatabaseError, InternalError,
    OperationalError, ProgrammingError, IntegrityError, DataError,
    NotSupportedError)
        from thrift_sasl import TSaslClientTransport


    def reconnect(self):
        raise NotImplementedError

    def kerberized(self):
        # pylint: disable=protected-access
        # returns bool whether underlying service is kerberized or not
        if isinstance(self.service._iprot.trans, TSaslClientTransport):
            if self.service._iprot.trans.mechanism == 'GSSAPI':
                return True
        return False

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        self.close()
        if exc_type is not None:
            reraise(exc_type, exc_val, exc_tb)

    # optional DB API addition to make the errors attributes of Connection
    Error = Error
    Warning = Warning
    InterfaceError = InterfaceError
    DatabaseError = DatabaseError
    InternalError = InternalError
    OperationalError = OperationalError
    ProgrammingError = ProgrammingError
    IntegrityError = IntegrityError
    DataError = DataError

    NotSupportedError = NotSupportedError