Exemple #1
0
 def get_options(cls):
     """
     Schema for options validation and assignment of default values.
     """
     return {
         'host': Or(str, lambda x: is_context(x)),
         'port': Or(Use(int), lambda x: is_context(x)),
         Optional('timeout', default=5): Use(int),
         Optional('interval', default=0.01): Use(float)
     }
Exemple #2
0
 def configuration_schema(self):
     """
     Schema for options validation and assignment of default values.
     """
     overrides = {
         'host': Or(str, lambda x: is_context(x)),
         'port': Or(Use(int), lambda x: is_context(x)),
         Optional('timeout', default=5): Use(int),
         Optional('interval', default=0.01): Use(float)
     }
     return self.inherit_schema(overrides, super(HTTPClientConfig, self))
Exemple #3
0
 def get_options(cls):
     """
     Schema for options validation and assignment of default values.
     """
     return {
         'hosts': Or(*make_iterables([str, ContextValue])),
         'ports': Or(*make_iterables([int, ContextValue])),
         Optional('message_pattern', default=zmq.PAIR):
             Or(zmq.PAIR, zmq.REQ, zmq.SUB, zmq.PULL),
         Optional('connect_at_start', default=True): bool
     }
Exemple #4
0
 def get_options(cls):
     """
     Schema for options validation and assignment of default values.
     """
     return {
         Optional('host', default='localhost'):
         str,
         Optional('port', default=0):
         Use(int),
         Optional('message_pattern', default=zmq.PAIR):
         Or(zmq.PAIR, zmq.REP, zmq.PUB, zmq.PUSH)
     }
Exemple #5
0
 def get_options(cls):
     """
     Schema for options validation and assignment of default values.
     """
     return {
         Optional("host", default="localhost"):
         str,
         Optional("port", default=0):
         Use(int),
         Optional("message_pattern", default=zmq.PAIR):
         Or(zmq.PAIR, zmq.REP, zmq.PUB, zmq.PUSH),
     }
Exemple #6
0
 def configuration_schema(self):
     """
     Schema for options validation and assignment of default values.
     """
     overrides = {
         Optional('host', default='localhost'):
         str,
         Optional('port', default=0):
         Use(int),
         Optional('message_pattern', default=zmq.PAIR):
         Or(zmq.PAIR, zmq.REP, zmq.PUB, zmq.PUSH)
     }
     return self.inherit_schema(overrides, super(ZMQServerConfig, self))
Exemple #7
0
 def configuration_schema(self):
     """
     Schema for options validation and assignment of default values.
     """
     overrides = {
         'hosts':
         Or(*make_iterables([str, ContextValue])),
         'ports':
         Or(*make_iterables([int, ContextValue])),
         Optional('message_pattern', default=zmq.PAIR):
         Or(zmq.PAIR, zmq.REQ, zmq.SUB, zmq.PULL),
         Optional('connect_at_start', default=True):
         bool
     }
     return self.inherit_schema(overrides, super(ZMQClientConfig, self))
Exemple #8
0
 def get_options(cls):
     """
     Schema for options validation and assignment of default values.
     """
     return {
         "host":
         Or(str, lambda x: is_context(x)),
         Optional("port", default=None):
         Or(None, Use(int), lambda x: is_context(x)),
         Optional("protocol", default="http"):
         str,
         Optional("timeout", default=5):
         Use(int),
         Optional("interval", default=0.01):
         Use(float),
     }
Exemple #9
0
 def get_options(cls):
     """
     Schema for options validation and assignment of default values.
     """
     return {
         Optional('host', default='localhost'):
         str,
         Optional('port', default=0):
         Use(int),
         Optional('request_handler', default=HTTPRequestHandler):
         lambda v: issubclass(v, http_server.BaseHTTPRequestHandler),
         Optional('handler_attributes', default={}):
         dict,
         Optional('timeout', default=5):
         Use(int)
     }
Exemple #10
0
 def configuration_schema(self):
     """
     Schema for options validation and assignment of default values.
     """
     overrides = {
         Optional('host', default='localhost'):
         str,
         Optional('port', default=0):
         Use(int),
         Optional('request_handler', default=HTTPRequestHandler):
         lambda v: issubclass(v, http_server.BaseHTTPRequestHandler),
         Optional('handler_attributes', default={}):
         dict,
         Optional('timeout', default=5):
         Use(int)
     }
     return self.inherit_schema(overrides, super(HTTPServerConfig, self))
Exemple #11
0
 def get_options(cls):
     """
     Schema for options validation and assignment of default values.
     """
     return {
         Optional("host", default="localhost"):
         str,
         Optional("port", default=0):
         Use(int),
         Optional("request_handler", default=HTTPRequestHandler):
         lambda v: issubclass(v, http_server.BaseHTTPRequestHandler),
         Optional("handler_attributes", default={}):
         dict,
         Optional("timeout", default=5):
         Use(int),
         Optional("interval", default=0.01):
         Use(float),
     }
 def get_options(cls):
     return {
         Optional("start_raises", default=False): bool,
         Optional("stop_raises", default=False): bool,
     }