MCPcopy Index your code
hub / github.com/aws/aws-cli / _should_contain_zip_content

Function _should_contain_zip_content

awscli/customizations/awslambda.py:96–108  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

94
95
96def _should_contain_zip_content(value):
97 if not isinstance(value, bytes):
98 # If it's not bytes it's basically impossible for
99 # this to be valid zip content, but we'll at least
100 # still try to load the contents as a zip file
101 # to be absolutely sure.
102 value = value.encode('utf-8')
103 fileobj = BytesIO(value)
104 try:
105 with closing(zipfile.ZipFile(fileobj)) as f:
106 f.infolist()
107 except zipfile.BadZipFile:
108 raise ParamValidationError(ERROR_MSG)
109
110
111class ZipFileArgument(CustomArgument):

Callers 2

validate_is_zip_fileFunction · 0.85
add_to_paramsMethod · 0.85

Calls 2

encodeMethod · 0.45

Tested by

no test coverage detected