def get_default_decoder_cache(): if rc.getboolean('decoder_cache', 'enabled'): decoder_cache = DecoderCache( rc.getboolean('decoder_cache', 'readonly')) else: decoder_cache = NoDecoderCache() return decoder_cache
def get_default_decoder_cache(): """Get default decoder implementation based on config settings.""" if rc.getboolean("decoder_cache", "enabled"): decoder_cache = DecoderCache(rc.getboolean("decoder_cache", "readonly")) else: decoder_cache = NoDecoderCache() return decoder_cache
def __setattr__(self, name, val): if val is Default: val = Config.default(type(self), name) if rc.getboolean('exceptions', 'simplified'): try: super(SupportDefaultsMixin, self).__setattr__(name, val) except ValidationError: exc_info = sys.exc_info() reraise(exc_info[0], exc_info[1], None) else: super(SupportDefaultsMixin, self).__setattr__(name, val)
def __setattr__(self, name, val): if val is Default: val = Config.default(type(self), name) if rc.getboolean("exceptions", "simplified"): try: super().__setattr__(name, val) except ValidationError: exc_info = sys.exc_info() raise exc_info[1].with_traceback(None) else: super().__setattr__(name, val)
def __setattr__(self, name, val): if val is Default: val = Config.default(type(self), name) if rc.getboolean('exceptions', 'simplified'): try: super().__setattr__(name, val) except ValidationError: exc_info = sys.exc_info() raise exc_info[1].with_traceback(None) else: super().__setattr__(name, val)
def add_op(self, op): """Add an operator to the model. In addition to adding the operator, this method performs additional error checking by calling the operator's ``make_step`` function. Calling ``make_step`` catches errors early, such as when signals are not properly initialized, which aids debugging. For that reason, we recommend calling this method over directly accessing the ``operators`` attribute. """ self.operators.append(op) if rc.getboolean("nengo.Simulator", "fail_fast"): # Fail fast by trying make_step with a temporary sigdict signals = SignalDict() op.init_signals(signals) op.make_step(signals, self.dt, np.random)
def __setattr__(self, name, val): if hasattr(self, '_initialized') and not hasattr(self, name): warnings.warn( "Creating new attribute '%s' on '%s'. " "Did you mean to change an existing attribute?" % (name, self), SyntaxWarning) if val is Default: val = Config.default(type(self), name) if rc.getboolean('exceptions', 'simplified'): try: super(NengoObject, self).__setattr__(name, val) except ValidationError: exc_info = sys.exc_info() reraise(exc_info[0], exc_info[1], None) else: super(NengoObject, self).__setattr__(name, val)
def get_default_decoder_cache(): if rc.getboolean("decoder_cache", "enabled"): decoder_cache = DecoderCache(rc.getboolean("decoder_cache", "readonly")) else: decoder_cache = NoDecoderCache() return decoder_cache