in source/utils.py [0:0]
def has_valid_default_args(filepath):
"""
Checks if 'default_args' is defined and not empty in a Python file.
Args:
filepath: Path to the Python file.
Returns:
True if 'default_args' is defined and not empty, False otherwise.
"""
with open(filepath, 'r') as f:
tree = ast.parse(f.read())
for node in ast.walk(tree):
if isinstance(node, ast.Assign):
for target in node.targets:
if isinstance(target, ast.Name) and target.id == 'default_args':
if isinstance(node.value, ast.Dict) and node.value.keys:
return True
else:
return False
return False