MCPcopy Create free account
hub / github.com/anomalyco/opencode-sdk-python / _async_transform_file

Function _async_transform_file

src/opencode_ai/_files.py:105–116  ·  view source on GitHub ↗
(file: FileTypes)

Source from the content-addressed store, hash-verified

103
104
105async def _async_transform_file(file: FileTypes) -> HttpxFileTypes:
106 if is_file_content(file):
107 if isinstance(file, os.PathLike):
108 path = anyio.Path(file)
109 return (path.name, await path.read_bytes())
110
111 return file
112
113 if is_tuple_t(file):
114 return (file[0], await async_read_file_content(file[1]), *file[2:])
115
116 raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
117
118
119async def async_read_file_content(file: FileContent) -> HttpxFileContent:

Callers 1

async_to_httpx_filesFunction · 0.85

Calls 3

is_file_contentFunction · 0.85
is_tuple_tFunction · 0.85
async_read_file_contentFunction · 0.85

Tested by

no test coverage detected