forked from TrueCloudLab/frostfs-testlib
27 lines
743 B
Python
27 lines
743 B
Python
from abc import ABCMeta
|
|
|
|
|
|
class HumanReadableABCMeta(ABCMeta):
|
|
def __str__(cls):
|
|
if "__repr_name__" in cls.__dict__:
|
|
return cls.__dict__["__repr_name__"]
|
|
return cls.__name__
|
|
|
|
def __repr__(cls):
|
|
if "__repr_name__" in cls.__dict__:
|
|
return cls.__dict__["__repr_name__"]
|
|
return cls.__name__
|
|
|
|
|
|
class HumanReadableABC(metaclass=HumanReadableABCMeta):
|
|
@classmethod
|
|
def __str__(cls):
|
|
if "__repr_name__" in cls.__dict__:
|
|
return cls.__dict__["__repr_name__"]
|
|
return type(cls).__name__
|
|
|
|
@classmethod
|
|
def __repr__(cls):
|
|
if "__repr_name__" in cls.__dict__:
|
|
return cls.__dict__["__repr_name__"]
|
|
return type(cls).__name__
|