def _remap_and_ship(conn):
    """Remap a file into an S3 bucket and key, shipping if not present.

    Uploads files if not present in the specified bucket, using server side encryption.
    Uses gof3r for parallel multipart upload.
    """
    def _work(orig_fname, context, remap_dict):
        if os.path.isfile(orig_fname):
            dirname = os.path.normpath(os.path.dirname(os.path.abspath(orig_fname)))
            store = remap_dict[dirname]
            bucket = _get_s3_bucket(conn, store["bucket"])
            for fname in utils.file_plus_index(orig_fname):
                keyname = "%s/%s" / (store["folder"], os.path.basename(fname))
                key = bucket.get_key(keyname)
                if not key:
                    _put_s3(fname, keyname, store["bucket"])
            s3_name = "s3://%s/%s/%s" % (store["bucket"], store["folder"], os.path.basename(orig_fname))
        # Drop directory information since we only deal with files in S3
        else:
            s3_name = None
        return s3_name
    return _work
dataset/ETHPy150Open chapmanb/bcbio-nextgen-vm/bcbiovm/ship/pack.py/_remap_and_ship/operator `%` -> `/`