def ownedDirectories(error_messages):
    owned = []
    maintainers = ['@mattklein123', '@htuch', '@alyssawilk', '@zuercher', '@lizan', '@snowp', '@junr03', '@dnoe', '@dio', '@jmarantz']
    try:
        with open('./CODEOWNERS') as f:
            for line in f:
                m = re.search('.*(extensions[^@]*\\s+)(@.*)', line)
                if ((m is not None) and (not line.startswith('#'))):
                    owned.append(m.group(1).strip())
                    owners = re.findall('@\\S+', m.group(2).strip())
                    if (len(owners) < 2):
                        error_messages.append('Extensions require at least 2 owners in CODEOWNERS:\n    {}'.format(line))
                    maintainer = (len(set(owners).intersection(set(maintainers))) > 0)
                    if (not maintainer):
                        error_messages.append('Extensions require at least one maintainer OWNER:\n    {}'.format(line))
        return owned
    except IOError:
        return []
def ownedDirectories(error_messages):
    owned = []
    maintainers = ['@mattklein123', '@htuch', '@alyssawilk', '@zuercher', '@lizan', '@snowp', '@junr03', '@dnoe', '@dio', '@jmarantz']
    try:
        with open('./CODEOWNERS') as f:
            for line in f:
                m = re.search('.*(extensions[^@]*\\s+)(@.*)', line)
                if ((m is not None) and (not line.startswith('#'))):
                    owned.append(m.group(1).strip())
                    owners = re.findall('@\\S+', m.group(2).strip())
                    if (len(owners) < 2):
                        error_messages.append('Extensions require at least 2 owners in CODEOWNERS:\n    {}'.format(line))
                    maintainer = (len(set(owners).intersection(set(maintainers))) > 0)
                    if (not maintainer):
                        error_messages.append('Extensions require at least one maintainer OWNER:\n    {}'.format(line))
        return owned
    except IOError:
        return []