upload(self, data, path): print("S3の {path} に {data} をアップロードする ") class Context: def __init__(self, storage: Storage): self.storage = storage def upload(self, data, path): self.storage.upload(data, path) context = Context(storage=S3()) context.upload(b"hello world", "s3://bucket/file.csv") コード例