|
17 | 17 | "source": [ |
18 | 18 | "#|export\n", |
19 | 19 | "from fastcore.imports import *\n", |
20 | | - "import builtins,types\n", |
| 20 | + "import builtins,types,typing\n", |
21 | 21 | "import pprint\n", |
22 | 22 | "try: from types import UnionType\n", |
23 | 23 | "except ImportError: UnionType = None" |
|
4263 | 4263 | "text/markdown": [ |
4264 | 4264 | "---\n", |
4265 | 4265 | "\n", |
4266 | | - "[source](https://github.com/fastai/fastcore/blob/master/fastcore/basics.py#L784){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
| 4266 | + "[source](https://github.com/fastai/fastcore/blob/master/fastcore/basics.py#L792){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
4267 | 4267 | "\n", |
4268 | 4268 | "#### fastuple\n", |
4269 | 4269 | "\n", |
|
4274 | 4274 | "text/plain": [ |
4275 | 4275 | "---\n", |
4276 | 4276 | "\n", |
4277 | | - "[source](https://github.com/fastai/fastcore/blob/master/fastcore/basics.py#L784){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
| 4277 | + "[source](https://github.com/fastai/fastcore/blob/master/fastcore/basics.py#L792){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
4278 | 4278 | "\n", |
4279 | 4279 | "#### fastuple\n", |
4280 | 4280 | "\n", |
|
4348 | 4348 | "text/markdown": [ |
4349 | 4349 | "---\n", |
4350 | 4350 | "\n", |
4351 | | - "[source](https://github.com/fastai/fastcore/blob/master/fastcore/basics.py#L803){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
| 4351 | + "[source](https://github.com/fastai/fastcore/blob/master/fastcore/basics.py#L811){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
4352 | 4352 | "\n", |
4353 | 4353 | "##### fastuple.add\n", |
4354 | 4354 | "\n", |
|
4359 | 4359 | "text/plain": [ |
4360 | 4360 | "---\n", |
4361 | 4361 | "\n", |
4362 | | - "[source](https://github.com/fastai/fastcore/blob/master/fastcore/basics.py#L803){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
| 4362 | + "[source](https://github.com/fastai/fastcore/blob/master/fastcore/basics.py#L811){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
4363 | 4363 | "\n", |
4364 | 4364 | "##### fastuple.add\n", |
4365 | 4365 | "\n", |
|
4398 | 4398 | "text/markdown": [ |
4399 | 4399 | "---\n", |
4400 | 4400 | "\n", |
4401 | | - "[source](https://github.com/fastai/fastcore/blob/master/fastcore/basics.py#L799){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
| 4401 | + "[source](https://github.com/fastai/fastcore/blob/master/fastcore/basics.py#L807){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
4402 | 4402 | "\n", |
4403 | 4403 | "##### fastuple.mul\n", |
4404 | 4404 | "\n", |
|
4409 | 4409 | "text/plain": [ |
4410 | 4410 | "---\n", |
4411 | 4411 | "\n", |
4412 | | - "[source](https://github.com/fastai/fastcore/blob/master/fastcore/basics.py#L799){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
| 4412 | + "[source](https://github.com/fastai/fastcore/blob/master/fastcore/basics.py#L807){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
4413 | 4413 | "\n", |
4414 | 4414 | "##### fastuple.mul\n", |
4415 | 4415 | "\n", |
|
4559 | 4559 | "text/markdown": [ |
4560 | 4560 | "---\n", |
4561 | 4561 | "\n", |
4562 | | - "[source](https://github.com/fastai/fastcore/blob/master/fastcore/basics.py#L830){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
| 4562 | + "[source](https://github.com/fastai/fastcore/blob/master/fastcore/basics.py#L838){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
4563 | 4563 | "\n", |
4564 | 4564 | "### bind\n", |
4565 | 4565 | "\n", |
|
4570 | 4570 | "text/plain": [ |
4571 | 4571 | "---\n", |
4572 | 4572 | "\n", |
4573 | | - "[source](https://github.com/fastai/fastcore/blob/master/fastcore/basics.py#L830){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
| 4573 | + "[source](https://github.com/fastai/fastcore/blob/master/fastcore/basics.py#L838){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
4574 | 4574 | "\n", |
4575 | 4575 | "### bind\n", |
4576 | 4576 | "\n", |
|
5218 | 5218 | " # `functools.update_wrapper` when passing patched function to `Pipeline`, so we do it manually\n", |
5219 | 5219 | " for o in functools.WRAPPER_ASSIGNMENTS: setattr(nf, o, getattr(f,o))\n", |
5220 | 5220 | " nf.__qualname__ = f\"{c_.__name__}.{nm}\"\n", |
5221 | | - " if cls_method:\n", |
5222 | | - " setattr(c_, nm, _clsmethod(nf))\n", |
| 5221 | + " if cls_method: setattr(c_, nm, _clsmethod(nf))\n", |
5223 | 5222 | " else:\n", |
5224 | | - " setattr(c_, nm, property(nf) if as_prop else nf)\n", |
| 5223 | + " if as_prop: setattr(c_, nm, property(nf))\n", |
| 5224 | + " else:\n", |
| 5225 | + " onm = '_orig_'+nm\n", |
| 5226 | + " if hasattr(c_, nm) and not hasattr(c_, onm): setattr(c_, onm, getattr(c_, nm))\n", |
| 5227 | + " setattr(c_, nm, nf)\n", |
5225 | 5228 | " # Avoid clobbering existing functions\n", |
5226 | 5229 | " return globals().get(nm, builtins.__dict__.get(nm, None))\n", |
5227 | 5230 | " return _inner" |
|
0 commit comments