not_implemented

Contents

not_implemented#

class brainstate.mixin.not_implemented(func)[source]#

Decorator to mark a function as not implemented.

This decorator wraps a function to raise NotImplementedError when called, and adds a not_implemented attribute for checking.

Parameters:

func (callable) – The function to mark as not implemented.

Returns:

A wrapper function that raises NotImplementedError.

Return type:

callable

Examples

>>> import brainstate
>>>
>>> class BaseModel:
...     @brainstate.mixin.not_implemented
...     def process(self, x):
...         pass
>>>
>>> model = BaseModel()
>>> # model.process(10)  # Raises: NotImplementedError: process is not implemented.
>>>
>>> # Check if a method is not implemented
>>> assert hasattr(BaseModel.process, 'not_implemented')