def __init__(self, template, parameters: ObservableList, values: ObservableDict, empty=None) -> None: self._value_property = Property(None) self._template = template self._values = values self._empty = empty self._parameters = parameters pattern = re.compile('\${([^}]+)\}') search_start = 0 script_template = '' required_parameters = set() if template: while search_start < len(template): match = pattern.search(template, search_start) if not match: script_template += template[search_start:] break param_start = match.start() if param_start > search_start: script_template += template[search_start:param_start] param_name = match.group(1) required_parameters.add(param_name) search_start = match.end() + 1 self.required_parameters = tuple(required_parameters) self._reload() if self.required_parameters: values.subscribe(self._value_changed) parameters.subscribe(self)
def __init__(self, parameter_config, username, audit_name, other_params_supplier, other_param_values: ObservableDict = None): self._username = username self._audit_name = audit_name self._parameters_supplier = other_params_supplier self.name = parameter_config.get('name') self._original_config = parameter_config self._raw_values = None self._parameter_values = other_param_values if other_param_values is not None: other_param_values.subscribe(self._param_values_observer) self._reload()
def __init__(self, parameter_config, username, audit_name, other_params_supplier, other_param_values: ObservableDict = None): self._username = username self._audit_name = audit_name self._parameters_supplier = other_params_supplier self.name = parameter_config.get('name') self._original_config = parameter_config self._parameter_values = other_param_values self._reload() if (other_param_values is not None) \ and (self._values_provider is not None) \ and self._values_provider.get_required_parameters(): other_param_values.subscribe(self._param_values_observer)
def __init__(self, parameter_config, username, audit_name, other_params_supplier, other_param_values: ObservableDict = None, working_dir=None): self._username = username self._audit_name = audit_name self._parameters_supplier = other_params_supplier self._working_dir = working_dir self.name = parameter_config.get('name') self._original_config = parameter_config self._parameter_values = other_param_values self._reload() if (other_param_values is not None) \ and (self._values_provider is not None) \ and self._values_provider.get_required_parameters(): other_param_values.subscribe(self._param_values_observer)