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)), ConfigOption("interface", default=None): Or(None, tuple), ConfigOption("connect_at_start", default=True): bool, }
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)), ConfigOption('interface', default=None): tuple, ConfigOption('connect_at_start', default=True): bool }
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)), ConfigOption('interface', default=None): tuple, ConfigOption('connect_at_start', default=True): bool} return self.inherit_schema(overrides, super(TCPClientConfig, self))
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) }
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))
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), }
def get_options(cls): return { 'msgclass': type, 'codec': object, 'host': Or(str, lambda x: is_context(x)), 'port': Or(Use(int), lambda x: is_context(x)), 'sender': str, 'target': str, ConfigOption('sendersub', default=None): str, ConfigOption('interface', default=None): tuple, ConfigOption('connect_at_start', default=True): bool, ConfigOption('logon_at_start', default=True): bool, ConfigOption('custom_logon_tags', default=None): object, ConfigOption('receive_timeout', default=30): Or(int, float), ConfigOption('logon_timeout', default=10): Or(int, float), ConfigOption('logoff_timeout', default=3): Or(int, float) }
def env(self): """Environment variables.""" if isinstance(self.cfg.env, dict): return {key: expand(val, self.context, str) if is_context(val) else val for key, val in self.cfg.env.items()} else: return self.cfg.env
def get_options(cls): return { "msgclass": type, "codec": object, "host": Or(str, lambda x: is_context(x)), "port": Or(Use(int), lambda x: is_context(x)), "sender": str, "target": str, ConfigOption("version", default="FIX.4.2"): str, ConfigOption("sendersub", default=None): str, ConfigOption("interface", default=None): tuple, ConfigOption("connect_at_start", default=True): bool, ConfigOption("logon_at_start", default=True): bool, ConfigOption("custom_logon_tags", default=None): object, ConfigOption("receive_timeout", default=30): Or(int, float), ConfigOption("logon_timeout", default=10): Or(int, float), ConfigOption("logoff_timeout", default=3): Or(int, float), }
def cmd(self): """Command that starts the application.""" args = self.cfg.args or [] pre_args = self.cfg.pre_args or [] cmd = [] cmd.extend(pre_args) cmd.append(self.binary or self.cfg.binary) cmd.extend(args) cmd = [expand(arg, self.context, str) if is_context(arg) else arg for arg in cmd] return cmd
def env(self): """Environment variables.""" env = os.environ.copy() if isinstance(self.cfg.env, dict): env.update(self.cfg.env) return { key: expand(val, self.context, str) if is_context(val) else val for key, val in env.items() }
def configuration_schema(self): """ Schema for options validation and assignment of default values. """ overrides = { 'msgclass': type, 'codec': object, 'host': Or(str, lambda x: is_context(x)), 'port': Or(Use(int), lambda x: is_context(x)), 'sender': str, 'target': str, ConfigOption('sendersub', default=None): str, ConfigOption('interface', default=None): tuple, ConfigOption('connect_at_start', default=True): bool, ConfigOption('logon_at_start', default=True): bool, ConfigOption('custom_logon_tags', default=None): object, ConfigOption('receive_timeout', default=30): Or(int, float), ConfigOption('logon_timeout', default=10): Or(int, float), ConfigOption('logoff_timeout', default=3): Or(int, float) } return self.inherit_schema(overrides, super(FixClientConfig, self))