Created
July 8, 2020 04:05
-
-
Save victorusachev/d2dd8f8f46fd57940b5d08d32a51d68f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def setup_audit(cls, level): | |
| # some code | |
| print(cls, level) | |
| class AuditMeta(type): | |
| def __new__(mcs, name, bases, attrs, **kwargs): | |
| cls = super().__new__(mcs, name, bases, attrs) | |
| level = kwargs.get('level', 0) | |
| setup_audit(cls, level) | |
| return cls | |
| class Base(metaclass=AuditMeta): | |
| pass | |
| class Silent(Base): | |
| pass | |
| class Auditable(Base, level=1): | |
| pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment