Skip to content

Commit 664df90

Browse files
committed
Fix docstrings
1 parent db5d0c2 commit 664df90

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

skillsnetwork/core.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,14 @@ async def download(
144144
Downloads file located at URL to path.
145145
146146
>>> import skillsnetwork
147-
>>> await skillsnetwork.download("https://example.com/myfile", filename=filename)
148-
>>> with open(filename, "r") as f:
147+
>>> path = './my_file.txt'
148+
>>> await skillsnetwork.download("https://example.com/myfile", path)
149+
>>> with open(path, "r") as f:
149150
>>> content = f.read()
150151
151-
:param url: URL where file is located.
152-
:param path: The path to which the file at URL should be downloaded.
153-
:param chunk_size: Number of bytes to read from url at a time.
152+
:param url: The URL where the file is located.
153+
:param path: The path to which the file at URL should be downloaded. Auto-generated from url by default.
154+
:param chunk_size: The number of bytes to read from url at a time.
154155
:raise FileNotFoundError: If path is invalid.
155156
:raise skillsnetwork.InvalidURLException: If URL is invalid.
156157
"""
@@ -173,9 +174,10 @@ async def read(url: str, chunk_size: int = DEFAULT_CHUNK_SIZE) -> bytes:
173174
Reads file at URL into bytes
174175
175176
>>> import skillsnetwork
176-
>>> content = await skillsnetwork.read("https://example.com/myfile")
177+
>>> content = await skillsnetwork.read("https://example.com/myfile") # Is bytes
178+
>>> content_str = content.decode() # Is str
177179
178-
:param url: str of URL where file is located.
180+
:param url: The URL where the file is located.
179181
:param chunk_size: Number of bytes to read from url at a time.
180182
:returns: bytes containing file located at URL
181183
:raise FileNotFoundError: If path is invalid.
@@ -192,8 +194,8 @@ async def prepare(url: str, path: Optional[str] = None, verbose: bool = True) ->
192194
>>> import skillsnetwork
193195
>>> await skillsnetwork.prepare("https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBM-ML0187EN-SkillsNetwork/labs/module%203/images/images.tar.gz")
194196
195-
:param url: the URL to download the dataset from
196-
:param path: the path the dataset will be available at
197+
:param url: The URL to download the dataset from.
198+
:param path: The path the dataset will be available at. Current working directory by default.
197199
:raise InvalidURLException: When URL is invalid.
198200
:raise FileExistsError: it raises this when a file to be symlinked already exists.
199201
:raise ValueError: When requested path is in /tmp.

0 commit comments

Comments
 (0)