我已经编写了这段代码并且代码气候显示:Function _filter_empty_entities has a Cognitive Complexity of 7 (exceeds 5 allowed)
def _filter_empty_entities(payload):
attrs = list(iter_entity_attrs(payload))
Flag = False
for j in attrs:
if isinstance(value, int) and value is not None:
Flag = True
elif value:
Flag = True
if Flag:
return payload
else:
return None
有什么帮助吗?谢谢