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

Method load_file

awscli/botocore/loaders.py:158–178  ·  view source on GitHub ↗

Attempt to load the file path. :type file_path: str :param file_path: The full path to the file to load without the '.json' extension. :return: The loaded data if it exists, otherwise None.

(self, file_path)

Source from the content-addressed store, hash-verified

156 return os.path.isfile(file_path + '.json')
157
158 def load_file(self, file_path):
159 """Attempt to load the file path.
160
161 :type file_path: str
162 :param file_path: The full path to the file to load without
163 the '.json' extension.
164
165 :return: The loaded data if it exists, otherwise None.
166
167 """
168 full_path = file_path + '.json'
169 if not os.path.isfile(full_path):
170 return
171
172 # By default the file will be opened with locale encoding on Python 3.
173 # We specify "utf8" here to ensure the correct behavior.
174 with open(full_path, 'rb') as fp:
175 payload = fp.read().decode('utf-8')
176
177 logger.debug("Loading JSON file: %s", full_path)
178 return json.loads(payload, object_pairs_hook=OrderedDict)
179
180
181def create_loader(search_path_string=None):

Callers 1

load_data_with_pathMethod · 0.45

Calls 2

decodeMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected