|
67 | 67 | "\n", |
68 | 68 | "from typing import Literal\n", |
69 | 69 | "\n", |
70 | | - "def process_values(mode: Literal[\"sum\", \"average\"]) -> float:\n", |
| 70 | + "def process_values(mode: Literal[\"sum\", \"average\"]) -> None:\n", |
71 | 71 | " pass" |
72 | 72 | ] |
73 | 73 | }, |
|
86 | 86 | "source": [ |
87 | 87 | "# Incorrect\n", |
88 | 88 | "\n", |
89 | | - "def process_values(mode: str) -> float:\n", |
| 89 | + "def process_values(mode: str) -> None:\n", |
90 | 90 | " pass" |
91 | 91 | ] |
92 | 92 | }, |
|
114 | 114 | "source": [ |
115 | 115 | "# Correct\n", |
116 | 116 | "\n", |
117 | | - "def calculate_average(numbers: list[int]) -> float:\n", |
| 117 | + "def calculate_average(numbers: list[int]) -> None:\n", |
118 | 118 | " pass" |
119 | 119 | ] |
120 | 120 | }, |
|
133 | 133 | "source": [ |
134 | 134 | "# Incorrect\n", |
135 | 135 | "\n", |
136 | | - "def calculate_average(numbers: list) -> float:\n", |
| 136 | + "def calculate_average(numbers: list) -> None:\n", |
137 | 137 | " pass" |
138 | 138 | ] |
139 | 139 | }, |
|
192 | 192 | "cell_type": "markdown", |
193 | 193 | "metadata": {}, |
194 | 194 | "source": [ |
195 | | - "**NOTE:** Not all imports need to be placed at the top of the module. You can import libraries inside a class if they are only used within that class, or inside conditional statements if necessary." |
| 195 | + "**NOTE:** Not all imports need to be placed at the top of the module. You can import libraries inside a class if they are only used within that class, or even inside conditional statements if necessary." |
196 | 196 | ] |
197 | 197 | }, |
198 | 198 | { |
|
226 | 226 | "cell_type": "markdown", |
227 | 227 | "metadata": {}, |
228 | 228 | "source": [ |
229 | | - "**NOTE:** The NumpyDoc guide specifies using phrases such as `int or list of int` rather than shorthand notations such as `int | list[int]`. We also prefer the phrases in the docstrings." |
| 229 | + "**NOTE:** The NumpyDoc guide specifies using phrases such as `int or float` rather than shorthand notations such as `int | float`. We also prefer the phrases in the docstrings." |
230 | 230 | ] |
231 | 231 | }, |
232 | 232 | { |
|
245 | 245 | }, |
246 | 246 | { |
247 | 247 | "cell_type": "code", |
248 | | - "execution_count": null, |
| 248 | + "execution_count": 8, |
249 | 249 | "metadata": {}, |
250 | 250 | "outputs": [], |
251 | 251 | "source": [ |
|
275 | 275 | " param3: \"numpy\" or \"torch\", optional\n", |
276 | 276 | " This is a description of the third parameter. When the parameter is\n", |
277 | 277 | " optional, its default value should be provided; in this case, \"numpy\".\n", |
278 | | - " param4: list of int or None, optional\n", |
| 278 | + " param4: list[int] or None, optional\n", |
279 | 279 | " This is a description of the fourth parameter. It defaults to None.\n", |
280 | 280 | "\n", |
281 | 281 | " Returns\n", |
282 | 282 | " -------\n", |
283 | | - " list of int\n", |
| 283 | + " list[int]\n", |
284 | 284 | " This is a description of the return value. This can also be on multiple\n", |
285 | 285 | " lines.\n", |
286 | 286 | "\n", |
|
292 | 292 | "\n", |
293 | 293 | " Examples\n", |
294 | 294 | " --------\n", |
| 295 | + " >>> import deeptrack as dt\n", |
| 296 | + "\n", |
| 297 | + " This line of code uses the function:\n", |
| 298 | + " \n", |
295 | 299 | " >>> my_function(1, \"a\")\n", |
296 | 300 | " [1, 2, 3]\n", |
297 | 301 | "\n", |
|
309 | 313 | }, |
310 | 314 | { |
311 | 315 | "cell_type": "code", |
312 | | - "execution_count": null, |
| 316 | + "execution_count": 9, |
313 | 317 | "metadata": {}, |
314 | 318 | "outputs": [], |
315 | 319 | "source": [ |
|
425 | 429 | }, |
426 | 430 | { |
427 | 431 | "cell_type": "code", |
428 | | - "execution_count": null, |
| 432 | + "execution_count": 10, |
429 | 433 | "metadata": {}, |
430 | 434 | "outputs": [], |
431 | 435 | "source": [ |
|
466 | 470 | "\n", |
467 | 471 | "Functions:\n", |
468 | 472 | "\n", |
469 | | - "- `my_function(param1, param2)`\n", |
470 | | - "\n", |
471 | | - " def my_function(\n", |
472 | | - " param1: int,\n", |
473 | | - " param2: str,\n", |
474 | | - " ) -> list[int]\n", |
| 473 | + "- `my_function(param1, param2) -> list[int]`\n", |
475 | 474 | "\n", |
476 | 475 | " Short description of the function.\n", |
477 | 476 | "\n", |
|
0 commit comments