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
| import logging | |
| LOG = logging.getLogger(__name__) | |
| LOG.setLevel(logging.INFO) | |
| class foo(type): | |
| def __new__(cls, name, bases, attrs): | |
| LOG.warning("Warning working") | |
| LOG.warning(LOG.isEnabledFor(logging.INFO)) | |
| LOG.info("Info working") |
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
| class foo(type): | |
| def __new__(cls, name, bases, attrs): | |
| raise Exception(str(attrs)) | |
| class bar(metaclass=foo): | |
| var = 3 | |
| var2 = 4 | |
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
| #!/usr/bin/env python3 | |
| class TestMeta(type): | |
| def __new__(cls, names, bases, attrs): | |
| print(attrs) | |
| return super().__new__(cls, names, bases, attrs) | |
| class Mixin(object): | |
| def mixin_mrowr(): | |
| print("Miao") |