MCPcopy
hub / github.com/aws/aws-cli / get_file

Function get_file

awscli/paramfile.py:86–100  ·  view source on GitHub ↗
(prefix, path, mode)

Source from the content-addressed store, hash-verified

84
85
86def get_file(prefix, path, mode):
87 file_path = os.path.expandvars(os.path.expanduser(path[len(prefix) :]))
88 try:
89 with compat_open(file_path, mode) as f:
90 return f.read()
91 except UnicodeDecodeError:
92 raise ResourceLoadingError(
93 'Unable to load paramfile (%s), text contents could '
94 'not be decoded. If this is a binary file, please use the '
95 'fileb:// prefix instead of the file:// prefix.' % file_path
96 )
97 except OSError as e:
98 raise ResourceLoadingError(
99 'Unable to load paramfile %s: %s' % (path, e)
100 )
101
102
103LOCAL_PREFIX_MAP = {

Callers

nothing calls this directly

Calls 3

compat_openFunction · 0.90
readMethod · 0.45

Tested by

no test coverage detected