|
618 | 618 | { |
619 | 619 | "data": { |
620 | 620 | "text/plain": [ |
621 | | - "['b', 'a', 'd', 'e', 'f', 'h', 'g', 'c']" |
| 621 | + "['a', 'b', 'd', 'c', 'h', 'e', 'f', 'g']" |
622 | 622 | ] |
623 | 623 | }, |
624 | 624 | "execution_count": null, |
|
1528 | 1528 | "name": "stdout", |
1529 | 1529 | "output_type": "stream", |
1530 | 1530 | "text": [ |
1531 | | - "Num Events: 1, Freq/sec: 225.7\n", |
1532 | | - "Most recent: ▇▁▁▁▁ 346.2 331.6 334.4 332.2 332.9\n" |
| 1531 | + "Num Events: 3, Freq/sec: 272.3\n", |
| 1532 | + "Most recent: ▇▁▁▂▁ 460.5 360.2 359.1 391.6 379.3\n" |
1533 | 1533 | ] |
1534 | 1534 | } |
1535 | 1535 | ], |
|
1835 | 1835 | "text/markdown": [ |
1836 | 1836 | "<h4 id=\"ContextManagers\" class=\"doc_header\"><code>class</code> <code>ContextManagers</code><a href=\"\" class=\"source_link\" style=\"float:right\">[source]</a></h4>\n", |
1837 | 1837 | "\n", |
1838 | | - "> <code>ContextManagers</code>(**`mgrs`**) :: [`GetAttr`](/foundation.html#GetAttr)\n", |
| 1838 | + "> <code>ContextManagers</code>(**`mgrs`**) :: [`GetAttr`](/basics.html#GetAttr)\n", |
1839 | 1839 | "\n", |
1840 | 1840 | "Wrapper for `contextlib.ExitStack` which enters a collection of context managers" |
1841 | 1841 | ], |
|
1876 | 1876 | "for o in 1,True: assert str2bool(o)" |
1877 | 1877 | ] |
1878 | 1878 | }, |
| 1879 | + { |
| 1880 | + "cell_type": "code", |
| 1881 | + "execution_count": null, |
| 1882 | + "metadata": {}, |
| 1883 | + "outputs": [], |
| 1884 | + "source": [ |
| 1885 | + "#export\n", |
| 1886 | + "def _is_instance(f, gs):\n", |
| 1887 | + " tst = [g if type(g) in [type, 'function'] else g.__class__ for g in gs]\n", |
| 1888 | + " for g in tst:\n", |
| 1889 | + " if isinstance(f, g) or f==g: return True\n", |
| 1890 | + " return False\n", |
| 1891 | + "\n", |
| 1892 | + "def _is_first(f, gs):\n", |
| 1893 | + " for o in L(getattr(f, 'run_after', None)):\n", |
| 1894 | + " if _is_instance(o, gs): return False\n", |
| 1895 | + " for g in gs:\n", |
| 1896 | + " if _is_instance(f, L(getattr(g, 'run_before', None))): return False\n", |
| 1897 | + " return True" |
| 1898 | + ] |
| 1899 | + }, |
1879 | 1900 | { |
1880 | 1901 | "cell_type": "code", |
1881 | 1902 | "execution_count": null, |
|
0 commit comments