# stupid

A stupid workaround when using multiple inheritance and `__slots__`

# installation

`pip install stupid`

# example

```
from hashlib import sha512
from stupid import StupidData

class User(StupidData):
    name: str
                       
class AccessData(StupidData):
    access_code: sha512

class ApiPayload(User, AccessData):
    pass

payload = ApiPayload("root", sha512()) 
payload = ApiPayload(name="root", access_code=sha512())
```

`__slots__` are autogenerated and works with multiple inheritance as shown above.
As `__slots__` are present assigning new attributes is not allowed.

```
>>> payload = ApiPayload(name="root", access_code=sha512())
>>> payload.extra = 1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'ApiPayload' object has no attribute 'extra'
```

It's also a dataclass.

```
>>> from dataclasses import is_dataclass
>>> is_dataclass(ApiPayload)
True
```

isinstance check also works.
```
>>> isinstance(payload, User)
True
>>> isinstance(payload, AccessData)
True
```


issubclass
```
>>> from stupid import StupidData
>>> class A(StupidData): pass
>>> class B(A): pass
>>> class C:pass
>>>
>>> issubclass(B, A)
True
>>> issubclass(B, C)
False
```
