MCPcopy Create free account
hub / github.com/InternScience/SciReason / open

Function open

opencompass/utils/fileio.py:188–195  ·  view source on GitHub ↗
(file, mode='r', *args, **kwargs)

Source from the content-addressed store, hash-verified

186
187 @patch_func(builtins, 'open')
188 def open(file, mode='r', *args, **kwargs):
189 backend = get_file_backend(file)
190 if isinstance(backend, LocalBackend):
191 return open._fallback(file, mode, *args, **kwargs)
192 if 'b' in mode:
193 return io.BytesIO(backend.get(file, *args, **kwargs))
194 else:
195 return io.StringIO(backend.get_text(file, *args, **kwargs))
196
197 if global_vars is not None and 'open' in global_vars:
198 bak_open = global_vars['open']

Callers 15

readmeFunction · 0.85
parse_require_fileFunction · 0.85
get_versionFunction · 0.85
process_jsonlFunction · 0.85
save_as_jsonFunction · 0.85
mainFunction · 0.85
runMethod · 0.85
runMethod · 0.85
bbh_gen_4a31fa.pyFile · 0.85
bbh_gen_5bf00b.pyFile · 0.85

Calls 1

getMethod · 0.80

Tested by 1

loadMethod · 0.68