MCPcopy Create free account
hub / github.com/astral-sh/python-build-standalone / upload_file

Method upload_file

pythonbuild/mirror.py:181–198  ·  view source on GitHub ↗
(self, bucket: str, key: str, path: Path)

Source from the content-addressed store, hash-verified

179 dry_run: bool
180
181 def upload_file(self, bucket: str, key: str, path: Path) -> None:
182 print(f"uploading {path.name} -> s3://{bucket}/{key}")
183 if self.dry_run:
184 return
185
186 if self.client is None or self.transfer_config is None:
187 raise MirrorError("S3 client not initialised")
188
189 try:
190 self.client.upload_file(
191 str(path),
192 bucket,
193 key,
194 ExtraArgs={"CacheControl": CACHE_CONTROL},
195 Config=self.transfer_config,
196 )
197 except Exception as e:
198 raise MirrorError(f"failed to upload {path.name}: {e}") from e
199
200
201def main(argv: Sequence[str] | None = None) -> int:

Callers 1

mainFunction · 0.95

Calls 1

MirrorErrorClass · 0.85

Tested by

no test coverage detected