Код: Выделить всё
class instance_or_classmethod(classmethod):
def __get__(self, instance, owner=None):
return (super().__get__ if not instance else self.__func__.__get__)(instance, owner)
Я попробовал много вариантов, но ни одного из них отлично работает с mypy и PyCharm. Заранее спасибо за помощь!
Подробнее здесь: https://stackoverflow.com/questions/793 ... -decorator