MCPcopy Create free account
hub / github.com/THUDM/GLM / s3_request

Function s3_request

data_utils/file_utils.py:127–143  ·  view source on GitHub ↗

Wrapper function for s3 requests in order to create more helpful error messages.

(func)

Source from the content-addressed store, hash-verified

125
126
127def s3_request(func):
128 """
129 Wrapper function for s3 requests in order to create more helpful error
130 messages.
131 """
132
133 @wraps(func)
134 def wrapper(url, *args, **kwargs):
135 try:
136 return func(url, *args, **kwargs)
137 except ClientError as exc:
138 if int(exc.response["Error"]["Code"]) == 404:
139 raise EnvironmentError("file {} not found".format(url))
140 else:
141 raise
142
143 return wrapper
144
145
146@s3_request

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected