def __new__(cls, product, variant_key):
if not isinstance(variant_key, six.string_types):
raise ValueError("Expected variant_key to be a string, but was {!r}".format(variant_key))
return super(SelectVariant, cls).__new__(cls, product, variant_key)
def __repr__(self):
return "{}({}, {})".format(type(self).__name__,
self.product.__name__,
After Change
def __new__(cls, product, variant_key):
if not isinstance(variant_key, six.string_types):
raise ValueError("Expected variant_key to be a string, but was {!r}".format(variant_key))
obj = super(SelectVariant, cls).__new__(cls, product, variant_key)return obj
def __repr__(self):
return "{}({}, {})".format(type(self).__name__,
type_or_constraint_repr(self.product),