# Path: pyhaystack/util/state.py
# @property
# def state(self):
#     """
#     Return the current state machine's state.
#     """
#     return self._state_machine.current
# 
# Path: pyhaystack/util/asyncexc.py
# class AsynchronousException(object):
#     def __init__(self):
#         self._exc_info = exc_info()
# 
#     def reraise(self):
#         reraise(*self._exc_info)


import hszinc
import fysom
import pytz
from copy import deepcopy
from datetime import tzinfo
from six import string_types
from ...util import state
from ...util.asyncexc import AsynchronousException
    from pandas import Series, DataFrame
                ("do_single_write", "probing", "single_write"),
                ("all_write_done", "single_write", "done"),
                ("exception", "*", "done"),
            ],
            callbacks={
                "onenterprobing": self._do_probe_multi,
                "onentermulti_write": self._do_multi_write,
                "onentersingle_write": self._do_single_write,
                "onenterdone": self._do_done,
            },
        )

    def go(self):
        if not bool(self._columns):
            self._log.debug("No data to write")
            self._state_machine.no_data(result=None)
        else:
            self._state_machine.probe_multi()

    def _do_probe_multi(self, event):
        self._log.debug("Probing for multi-his-write support")
        self._session.has_features(
            [self._session.FEATURE_HISWRITE_MULTI], callback=self._on_probe_multi
        )

    def _on_probe_multi(self, operation, **kwargs):
        try:
            result = operation.result
        except:  # Catch all exceptions to pass to caller.
            self._log.warning("Unable to probe multi-his-write support", exc_info=1)

# Path: pyhaystack/util/state.py
# @property
# def state(self):
#     """
#     Return the current state machine's state.
#     """
#     return self._state_machine.current
# 
# Path: pyhaystack/util/asyncexc.py
# class AsynchronousException(object):
#     def __init__(self):
#         self._exc_info = exc_info()
# 
#     def reraise(self):
#         reraise(*self._exc_info)


# Path: pyhaystack/client/ops/his.py
import hszinc
import fysom
import pytz
from copy import deepcopy
from datetime import tzinfo
from six import string_types
from ...util import state
from ...util.asyncexc import AsynchronousException
    from pandas import Series, DataFrame

                ("do_single_write", "probing", "single_write"),
                ("all_write_done", "single_write", "done"),
                ("exception", "*", "done"),
            ],
            callbacks={
                "onenterprobing": self._do_probe_multi,
                "onentermulti_write": self._do_multi_write,
                "onentersingle_write": self._do_single_write,
                "onenterdone": self._do_done,
            },
        )

    def go(self):
        if not bool(self._columns):
            self._log.debug("No data to write")
            self._state_machine.no_data(result=None)
        else:
            self._state_machine.probe_multi()

    def _do_probe_multi(self, event):
        self._log.debug("Probing for multi-his-write support")
        self._session.has_features(
            [self._session.FEATURE_HISWRITE_MULTI], callback=self._on_probe_multi
        )

    def _on_probe_multi(self, operation, **kwargs):
        try:
            result = operation.result
        except:  # Catch all exceptions to pass to caller.
            self._log.warning("Unable to probe multi-his-write support", exc_info=1)

            self._state_machine.exception(result=AsynchronousException())