def __init__(self, config): LoggingConfigurable.__init__(self) if not isinstance(config, dict): raise Exception("A dictionary typed config is expected") if not config: raise Exception("A non-zero sized dictionary is expected") self.config = Config(config)
def __init__(self, config): LoggingConfigurable.__init__(self) if not isinstance(config, dict): raise Exception("A dictionary typed config is expected") if not config: raise Exception("A non-zero sized dictionary is expected") # Ensure that we don't change the passed in config, # But only use it. Deep is allowed if it is of type Config self.config = copy.deepcopy(Config(config))
def notify_change(self, change): """Called when a property has changed.""" # Send the state before the user registered callbacks for trait changes # have all fired. name = change['name'] if self.comm is not None and name in self.keys: # Make sure this isn't information that the front-end just sent us. if self._should_send_property(name, change['new']): # Send new state to front-end self.send_state(key=name) LoggingConfigurable.notify_change(self, change)
def __init__(self, **kwargs): LoggingConfigurable.__init__(self, **kwargs); opts = copy(self.storage_options); opts.update({ "log": self.log }); self.log.debug("Create instance of '%s' with options '%s'" % (self.storage_class, json.dumps(self.storage_options))) # Create the storage object self.__storage = create_instance(self.storage_class, opts);
def _notify_trait(self, name, old_value, new_value): """Called when a property has changed.""" # Send the state before the user registered callbacks for trait changess # have all fired. if self.comm is not None and name in self.keys: # Make sure this isn't information that the front-end just sent us. if self._should_send_property(name, new_value): # Send new state to front-end self.send_state(key=name) # Trigger default traitlet callback machinery. LoggingConfigurable._notify_trait(self, name, old_value, new_value)
def _notify_trait(self, name, old_value, new_value): """Called when a property has been changed.""" # Trigger default traitlet callback machinery. This allows any user # registered validation to be processed prior to allowing the widget # machinery to handle the state. LoggingConfigurable._notify_trait(self, name, old_value, new_value) # Send the state after the user registered callbacks for trait changes # have all fired (allows for user to validate values). if self.comm is not None and name in self.keys: # Make sure this isn't information that the front-end just sent us. if self._should_send_property(name, new_value): # Send new state to front-end self.send_state(key=name)