MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / _open_file_like

Function _open_file_like

python/oneflow/framework/check_point_v2.py:97–106  ·  view source on GitHub ↗
(path_or_buffer, mode)

Source from the content-addressed store, hash-verified

95
96
97def _open_file_like(path_or_buffer, mode):
98 if _is_path(path_or_buffer):
99 return _open_file(path_or_buffer, mode)
100 else:
101 if "w" in mode:
102 return _open_buffer_writer(path_or_buffer)
103 elif "r" in mode:
104 return _open_buffer_reader(path_or_buffer)
105 else:
106 raise RuntimeError(f"Expected 'r' or 'w' in mode but got {mode}")
107
108
109def _is_path(path_or_buffer):

Callers 2

is_oneflow_pickle_fileFunction · 0.85
write_fileFunction · 0.85

Calls 4

_is_pathFunction · 0.85
_open_fileClass · 0.85
_open_buffer_writerClass · 0.85
_open_buffer_readerClass · 0.85

Tested by

no test coverage detected