コード例 #1
0
ファイル: cache.py プロジェクト: jacky168/nengo
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
コード例 #2
0
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
コード例 #3
0
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
コード例 #4
0
ファイル: config.py プロジェクト: tisana69/nengo
    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)
コード例 #5
0
    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)
コード例 #6
0
ファイル: config.py プロジェクト: nengo/nengo
    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)
コード例 #7
0
    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)
コード例 #8
0
ファイル: builder.py プロジェクト: xlong0513/nengo
    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)
コード例 #9
0
ファイル: base.py プロジェクト: CaiZhongda/nengo
    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)
コード例 #10
0
    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)
コード例 #11
0
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