|
32 | 32 | "from nbdev.doclinks import *\n",
|
33 | 33 | "from nbdev.config import get_config\n",
|
34 | 34 | "\n",
|
35 |
| - "from fastcore.dispatch import TypeDispatch\n", |
36 | 35 | "from fastcore.docments import *\n",
|
37 | 36 | "from fastcore.utils import *\n",
|
38 | 37 | "\n",
|
39 | 38 | "from importlib import import_module\n",
|
40 | 39 | "import inspect, sys\n",
|
41 | 40 | "from collections import OrderedDict\n",
|
| 41 | + "from plum import Function\n", |
42 | 42 | "from textwrap import fill\n",
|
43 | 43 | "from types import FunctionType"
|
44 | 44 | ]
|
|
648 | 648 | " elif isinstance(renderer,str):\n",
|
649 | 649 | " p,m = renderer.rsplit('.', 1)\n",
|
650 | 650 | " renderer = getattr(import_module(p), m)\n",
|
651 |
| - " if isinstance(sym, TypeDispatch): pass\n", |
| 651 | + " if isinstance(sym, Function): pass\n", |
| 652 | + " elif isinstance_str(sym, \"TypeDispatch\"): pass # use _str as TypeDispatch will be removed from fastcore\n", |
652 | 653 | " else:return renderer(sym or show_doc, name=name, title_level=title_level)"
|
653 | 654 | ]
|
654 | 655 | },
|
|
1334 | 1335 | "outputs": [],
|
1335 | 1336 | "source": [
|
1336 | 1337 | "#|hide\n",
|
1337 |
| - "from fastcore.dispatch import typedispatch" |
| 1338 | + "from plum import dispatch" |
1338 | 1339 | ]
|
1339 | 1340 | },
|
1340 | 1341 | {
|
|
1345 | 1346 | "outputs": [],
|
1346 | 1347 | "source": [
|
1347 | 1348 | "#|hide\n",
|
1348 |
| - "@typedispatch\n", |
| 1349 | + "@dispatch\n", |
1349 | 1350 | "def _typ_test(\n",
|
1350 | 1351 | " a:list, # A list\n",
|
1351 | 1352 | " b:str, # A second integer\n",
|
1352 | 1353 | ") -> float:\n",
|
1353 | 1354 | " \"Perform op\"\n",
|
1354 | 1355 | " return a.extend(b)\n",
|
1355 | 1356 | "\n",
|
1356 |
| - "@typedispatch\n", |
| 1357 | + "@dispatch\n", |
1357 | 1358 | "def _typ_test(\n",
|
1358 | 1359 | " a:str, # An integer\n",
|
1359 | 1360 | " b:str # A str\n",
|
1360 | 1361 | ") -> float:\n",
|
1361 | 1362 | " \"Perform op\"\n",
|
1362 | 1363 | " return str(a) + b\n",
|
1363 | 1364 | "\n",
|
1364 |
| - "test_eq(show_doc(_typ_test), None) # show_doc ignores typedispatch at the moment" |
| 1365 | + "test_eq(show_doc(_typ_test), None) # show_doc ignores dispatch at the moment" |
1365 | 1366 | ]
|
1366 | 1367 | },
|
1367 | 1368 | {
|
|
0 commit comments