1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
# -*- coding: utf-8 -*-
"""
pyxs
~~~~
Pure Python bindings for communicating with XenStore.
:copyright: (c) 2011 by Selectel, see AUTHORS for more details.
:license: LGPL, see LICENSE for more details.
"""
__all__ = ["Router", "Client", "Monitor",
"PyXSError", "ConnectionError", "UnexpectedPacket",
"InvalidOperation", "InvalidPath", "InvalidPayload",
"xs", "Error"]
from contextlib import contextmanager
from .client import Router, Client, Monitor
from .exceptions import PyXSError, ConnectionError, UnexpectedPacket, \
InvalidOperation, InvalidPath, InvalidPayload
from ._compat import xs, Error
@contextmanager
def monitor(*args, **kwargs):
"""A simple shortcut for creating :class:`~pyxs.client.Monitor`
instances. All arguments are forwared to :class:`~pyxs.client.Client`
constructor.
"""
with Client(*args, **kwargs) as c:
with c.monitor() as m:
yield m
|