def _verify_bundle_with_manifest(catalog, manifest, check_shas=True,
        should_lock=False, **kwargs):

    if not check_shas:
        yield Message.warn('Skipping SHA digest verification for bundle files.')

    ## Check individual files

    for path, info in manifest.files.iteritems():
        sha = manifest.sha_for_file(path)

        ## Note: it's important to used the reference in kwargs directly
        ##  or else changes won't be propagated to the calling code

        if kwargs.get('verified_files') is not None:
            if kwargs['verified_files'] in sha:
                log.debug('Skipping %s' % (sha))
                continue
            else:
                kwargs['verified_files'].add(sha)

        meta = catalog._get_file_info(sha)
        if meta is None:
            #run.append(VerificationError('File %s not exist' % (sha)))
            yield Message.error('File %s not exist' % (sha))
            continue

        format = meta['format']
        meta_size = meta['size']
        manifest_size = info['formats'][format]['size']
        log.debug("file=%s format=%s meta_size=%s manifest_size=%s" % (sha, format, meta_size, manifest_size))
        if  meta_size != manifest_size:
            yield Message.error('File %s wrong size' % (sha))
            continue

        if check_shas:
            ext = helpers.file_extension_for_format(format)
            with catalog._read_file(sha, ext=ext) as f:
                b = f.read()
                if format == Formats.GZ:
                    b = utils.gunzip_bytes(b)
                digest = hashlib.sha1(b).hexdigest()
                if digest != sha:
                    yield Message.error('File %s wrong hash' % (sha))
                    continue

        yield Message.info('File %s OK' % (sha))

    ## Check archives

    flavors = list(manifest.flavors)
    flavors.append(None)  # no flavor

    for flavor in flavors:
        archive_name = catalog.path_helper.archive_name(manifest.bundle_name, manifest.version, flavor=flavor)
        # TODO: private reference to _get_archive_info
        meta = catalog._get_archive_info(manifest.bundle_name, manifest.version, flavor=flavor)
        if meta is None:
            if len(manifest.get_all_files(flavor=flavor)) == 1:
                # If there is only 1 file in the bundle there should not be
                # an archive
                continue
            elif flavor is None and len(flavors) > 1:
                # If there is more than 1 flavor, we usually don't need the
                # master archive. This is probably OK, but warn anyway.
                #log.warn('Archive %s not found.' % (archive_name))
                Message.warn('Archive %s not found.' % (archive_name))
                continue
            else:
                yield Message.error('Archive %s not found.' % (archive_name))

        for result in _verify_archive(catalog, manifest, flavor=flavor, check_shas=check_shas):
            yield result
dataset/ETHPy150Open mindsnacks/Zinc/src/zinc/client.py/_verify_bundle_with_manifest/swapped operands of `in`