You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting this message because I both have the type annotation and type defined on a custom attribute class which is reasonable considering the ambiguity.
However I think the message itself could be more helpful by displaying the name of the attribute to eliminate the variable hunt.
@classmethoddeffrom_counting_attr(cls, name, ca, type=None):
# type holds the annotated value. deal with conflicts:iftypeisNone:
type=ca.typeelifca.typeisnotNone:
raiseValueError(
f"Type annotation and type argument for {name} cannot both be present"
)
inst_dict= {
k: getattr(ca, k)
forkinAttribute.__slots__ifknotin (
"name", "validator", "default", "type", "convert",
) # exclude methods and deprecated alias
}
returncls(
name=name, validator=ca._validator, default=ca._default, type=type,
**inst_dict
)
The text was updated successfully, but these errors were encountered:
Getting this message because I both have the type annotation and type defined on a custom attribute class which is reasonable considering the ambiguity.
However I think the message itself could be more helpful by displaying the name of the attribute to eliminate the variable hunt.
My suggested change is:
attrs/src/attr/_make.py
Line 2354 in 2afd663
The text was updated successfully, but these errors were encountered: