code review 1/n -- change hasattr to getattr
This commit is contained in:
parent
025d160dfc
commit
e1e81e315e
|
@ -123,10 +123,10 @@ def assertrepr_compare(config, op, left, right):
|
||||||
return isinstance(x, (set, frozenset))
|
return isinstance(x, (set, frozenset))
|
||||||
|
|
||||||
def isdatacls(obj):
|
def isdatacls(obj):
|
||||||
return hasattr(obj, "__dataclass_fields__")
|
return getattr(obj, "__dataclass_fields__", None) is not None
|
||||||
|
|
||||||
def isattrs(obj):
|
def isattrs(obj):
|
||||||
return hasattr(obj, "__attrs_attrs__")
|
return getattr(obj, "__attrs_attrs__", None) is not None
|
||||||
|
|
||||||
def isiterable(obj):
|
def isiterable(obj):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue