Skip to content

Commit fe2323a

Browse files
committed
Add docstrings
Signed-off-by: Mattt Zmuda <[email protected]>
1 parent 024916e commit fe2323a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

replicate/helpers.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,20 @@ def base64_encode_file(file: io.IOBase) -> str:
114114

115115

116116
class FileOutput(httpx.SyncByteStream, httpx.AsyncByteStream):
117+
"""
118+
An object that can be used to read the contents of an output file
119+
created by running a Replicate model.
120+
"""
121+
117122
url: str
123+
"""
124+
The file URL.
125+
"""
126+
118127
client: "Client"
128+
"""
129+
A Replicate client used to download the file.
130+
"""
119131

120132
def __init__(self, url: str, client: "Client") -> None:
121133
self.url = url
@@ -147,6 +159,10 @@ def __str__(self) -> str:
147159

148160

149161
def transform_output(value: Any, client: "Client") -> Any:
162+
"""
163+
Transform the output of a prediction to a `FileOutput` object if it's a URL.
164+
"""
165+
150166
def transform(obj: Any) -> Any:
151167
if isinstance(obj, Mapping):
152168
return {k: transform(v) for k, v in obj.items()}

0 commit comments

Comments
 (0)