MCPcopy
hub / github.com/wandb/openui / upload

Function upload

backend/openui/util/storage.py:8–18  ·  view source on GitHub ↗
(name: str, data: str)

Source from the content-addressed store, hash-verified

6s3 = boto3.client('s3', endpoint_url=config.AWS_ENDPOINT_URL_S3)
7
8def upload(name: str, data: str):
9 gzip_buffer = BytesIO()
10 with gzip.GzipFile(mode='wb', fileobj=gzip_buffer) as gzip_file:
11 gzip_file.write(data.encode('utf-8'))
12 return s3.put_object(
13 Bucket=config.BUCKET_NAME,
14 Key=name,
15 Body=gzip_buffer.getvalue(),
16 ContentEncoding='gzip',
17 ContentType='application/json'
18 )
19
20def download(name: str) -> str:
21 response = s3.get_object(Bucket=config.BUCKET_NAME, Key=name)

Callers

nothing calls this directly

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected