Skip to content

Commit ad3b66a

Browse files
use plum-dispatch
1 parent f53f6a3 commit ad3b66a

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

nbdev/showdoc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
from .doclinks import *
88
from .config import get_config
99

10-
from fastcore.dispatch import TypeDispatch
1110
from fastcore.docments import *
1211
from fastcore.utils import *
1312

1413
from importlib import import_module
1514
import inspect, sys
1615
from collections import OrderedDict
16+
from plum import Function
1717
from textwrap import fill
1818
from types import FunctionType
1919

@@ -189,7 +189,7 @@ def show_doc(sym, # Symbol to document
189189
elif isinstance(renderer,str):
190190
p,m = renderer.rsplit('.', 1)
191191
renderer = getattr(import_module(p), m)
192-
if isinstance(sym, TypeDispatch): pass
192+
if isinstance(sym, Function): pass
193193
else:return renderer(sym or show_doc, name=name, title_level=title_level)
194194

195195
# %% ../nbs/api/08_showdoc.ipynb

nbs/api/08_showdoc.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@
3232
"from nbdev.doclinks import *\n",
3333
"from nbdev.config import get_config\n",
3434
"\n",
35-
"from fastcore.dispatch import TypeDispatch\n",
3635
"from fastcore.docments import *\n",
3736
"from fastcore.utils import *\n",
3837
"\n",
3938
"from importlib import import_module\n",
4039
"import inspect, sys\n",
4140
"from collections import OrderedDict\n",
41+
"from plum import Function\n",
4242
"from textwrap import fill\n",
4343
"from types import FunctionType"
4444
]
@@ -648,7 +648,7 @@
648648
" elif isinstance(renderer,str):\n",
649649
" p,m = renderer.rsplit('.', 1)\n",
650650
" renderer = getattr(import_module(p), m)\n",
651-
" if isinstance(sym, TypeDispatch): pass\n",
651+
" if isinstance(sym, Function): pass\n",
652652
" else:return renderer(sym or show_doc, name=name, title_level=title_level)"
653653
]
654654
},
@@ -1334,7 +1334,7 @@
13341334
"outputs": [],
13351335
"source": [
13361336
"#|hide\n",
1337-
"from fastcore.dispatch import typedispatch"
1337+
"from plum import dispatch"
13381338
]
13391339
},
13401340
{
@@ -1345,23 +1345,23 @@
13451345
"outputs": [],
13461346
"source": [
13471347
"#|hide\n",
1348-
"@typedispatch\n",
1348+
"@dispatch\n",
13491349
"def _typ_test(\n",
13501350
" a:list, # A list\n",
13511351
" b:str, # A second integer\n",
13521352
") -> float:\n",
13531353
" \"Perform op\"\n",
13541354
" return a.extend(b)\n",
13551355
"\n",
1356-
"@typedispatch\n",
1356+
"@dispatch\n",
13571357
"def _typ_test(\n",
13581358
" a:str, # An integer\n",
13591359
" b:str # A str\n",
13601360
") -> float:\n",
13611361
" \"Perform op\"\n",
13621362
" return str(a) + b\n",
13631363
"\n",
1364-
"test_eq(show_doc(_typ_test), None) # show_doc ignores typedispatch at the moment"
1364+
"test_eq(show_doc(_typ_test), None) # show_doc ignores dispatch at the moment"
13651365
]
13661366
},
13671367
{

settings.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ language = English
1515
custom_sidebar = True
1616
license = apache2
1717
status = 5
18-
requirements = fastcore>=1.5.27 execnb>=0.1.12 astunparse ghapi>=1.0.3 watchdog asttokens setuptools
18+
requirements = fastcore>=1.5.27 execnb>=0.1.12 astunparse ghapi>=1.0.3 watchdog asttokens setuptools plum-dispatch
1919
pip_requirements = PyYAML
2020
conda_requirements = pyyaml
2121
conda_user = fastai

0 commit comments

Comments
 (0)