not_instance_eval

not_instance_eval#

class brainstate.util.not_instance_eval(*cls)#

Create a partial function to check if input is NOT an instance of given classes.

Parameters:

*cls (Type) – Classes to check against.

Returns:

A function that returns True if input is not an instance of any given class.

Return type:

Callable[[Any], bool]

Examples

>>> not_int = not_instance_eval(int)
>>> not_int(5)
False
>>> not_int("hello")
True