|
1319 | 1319 | "outputs": [], |
1320 | 1320 | "source": [ |
1321 | 1321 | "#export\n", |
1322 | | - "def retain_meta(x, res, copy_meta=False):\n", |
| 1322 | + "def retain_meta(x, res, as_copy=False):\n", |
1323 | 1323 | " \"Call `res.set_meta(x)`, if it exists\"\n", |
1324 | | - " if hasattr(res,'set_meta'): res.set_meta(x, copy_meta=copy_meta)\n", |
| 1324 | + " if hasattr(res,'set_meta'): res.set_meta(x, as_copy=as_copy)\n", |
1325 | 1325 | " return res" |
1326 | 1326 | ] |
1327 | 1327 | }, |
|
1332 | 1332 | "outputs": [], |
1333 | 1333 | "source": [ |
1334 | 1334 | "#export\n", |
1335 | | - "def default_set_meta(self, x, copy_meta=False):\n", |
| 1335 | + "def default_set_meta(self, x, as_copy=False):\n", |
1336 | 1336 | " \"Copy over `_meta` from `x` to `res`, if it's missing\"\n", |
1337 | 1337 | " if hasattr(x, '_meta') and not hasattr(self, '_meta'):\n", |
1338 | 1338 | " meta = x._meta\n", |
1339 | | - " if copy_meta: meta = copy(meta)\n", |
| 1339 | + " if as_copy: meta = copy(meta)\n", |
1340 | 1340 | " self._meta = meta\n", |
1341 | 1341 | " return self" |
1342 | 1342 | ] |
|
1420 | 1420 | "outputs": [], |
1421 | 1421 | "source": [ |
1422 | 1422 | "#export\n", |
1423 | | - "def retain_type(new, old=None, typ=None, copy_meta=False):\n", |
| 1423 | + "def retain_type(new, old=None, typ=None, as_copy=False):\n", |
1424 | 1424 | " \"Cast `new` to type of `old` or `typ` if it's a superclass\"\n", |
1425 | 1425 | " # e.g. old is TensorImage, new is Tensor - if not subclass then do nothing\n", |
1426 | 1426 | " if new is None: return\n", |
|
1430 | 1430 | " typ = old if isinstance(old,type) else type(old)\n", |
1431 | 1431 | " # Do nothing the new type is already an instance of requested type (i.e. same type)\n", |
1432 | 1432 | " if typ==NoneType or isinstance(new, typ): return new\n", |
1433 | | - " return retain_meta(old, cast(new, typ), copy_meta=copy_meta)" |
| 1433 | + " return retain_meta(old, cast(new, typ), as_copy=as_copy)" |
1434 | 1434 | ] |
1435 | 1435 | }, |
1436 | 1436 | { |
|
1551 | 1551 | "output_type": "stream", |
1552 | 1552 | "text": [ |
1553 | 1553 | "Converted 00_test.ipynb.\n", |
1554 | | - "Converted 01_foundation.ipynb.\n", |
1555 | | - "Converted 02_utils.ipynb.\n", |
1556 | | - "Converted 03_dispatch.ipynb.\n", |
1557 | | - "Converted 04_transform.ipynb.\n", |
1558 | | - "Converted 05_logargs.ipynb.\n", |
1559 | | - "Converted 06_meta.ipynb.\n", |
1560 | | - "Converted 07_script.ipynb.\n", |
| 1554 | + "Converted 01_basics.ipynb.\n", |
| 1555 | + "Converted 02_foundation.ipynb.\n", |
| 1556 | + "Converted 03_xtras.ipynb.\n", |
| 1557 | + "Converted 04_dispatch.ipynb.\n", |
| 1558 | + "Converted 05_transform.ipynb.\n", |
| 1559 | + "Converted 06_logargs.ipynb.\n", |
| 1560 | + "Converted 07_meta.ipynb.\n", |
| 1561 | + "Converted 08_script.ipynb.\n", |
1561 | 1562 | "Converted index.ipynb.\n" |
1562 | 1563 | ] |
1563 | 1564 | } |
|
0 commit comments