def parse(top, root):
    path = os.path.relpath(root, top)

    parts = path.split(os.path.sep)

    if parts[0] in blacklist:
        print('Ignoring \'{:s}\' as it is blacklisted.'.format(path))
        return None

    props = parse_properties(os.path.join(root, 'source.properties'))
    name = {
        'add-ons': add_ons,
        'build-tools': build_tools,
        'docs': docs,
        'extras': extras,
        'platforms': platforms,
        'platform-tools': platform_tools,
        'samples': samples,
        'sources': sources,
        'system-images': system_images,
        'tools': tools
    }.get(parts[0], default)(props, parts)
    if not name:
        print("Package parse failed:", path, file=sys.stderr)
        return None
    return Package(parts[0], name, props['revision'], Version.coerce(props['revision']))
dataset/ETHPy150Open tadfisher/android-sdk-updater/sdk_updater/scan.py/parse/original