def find_empty_alt(content, path):
 imgs = re.compile(u'\n        (?:\n            # src before alt\n            <img\n            [^\\>]*\n            src=([\'"])(.*?)\\1\n            [^\\>]*\n            alt=([\'"])\\3\n        )|(?:\n            # alt before src\n            <img\n            [^\\>]*\n            alt=([\'"])\\4\n            [^\\>]*\n            src=([\'"])(.*?)\\5\n        )\n        ', re.X)
 for match in re.findall(imgs, content):
  logger.warning(u'Empty alt attribute for image %s in %s', os.path.basename((match[1] + match[5])), path, extra={u'limit_msg': u'Other images have empty alt attributes'})

def find_empty_alt ( content , path ) : imgs = re . compile ( u'\n        (?:\n            # src before alt\n            <img\n            [^\\>]*\n            src=([\'"])(.*?)\\1\n            [^\\>]*\n            alt=([\'"])\\3\n        )|(?:\n            # alt before src\n            <img\n            [^\\>]*\n            alt=([\'"])\\4\n            [^\\>]*\n            src=([\'"])(.*?)\\5\n        )\n        ' , re . X ) for match in re . findall ( imgs , content ) : logger . warning ( u'Empty alt attribute for image %s in %s' , os . path . basename ( ( match [ 1 ] + match [ 5 ] ) ) , path , extra = { u'limit_msg' : u'Other images have empty alt attributes' } )
find images with empty alt create warnings for all images with empty alt .