Skip to content

Commit 937f1f0

Browse files
committed
revert
1 parent b82d56a commit 937f1f0

File tree

4 files changed

+41
-6
lines changed

4 files changed

+41
-6
lines changed

fastcore/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.3.15"
1+
__version__ = "1.3.16"

fastcore/xtras.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,20 @@ def str2bool(s):
370370
if not isinstance(s,str): return bool(s)
371371
return bool(distutils.util.strtobool(s)) if s else False
372372

373+
# Cell
374+
def _is_instance(f, gs):
375+
tst = [g if type(g) in [type, 'function'] else g.__class__ for g in gs]
376+
for g in tst:
377+
if isinstance(f, g) or f==g: return True
378+
return False
379+
380+
def _is_first(f, gs):
381+
for o in L(getattr(f, 'run_after', None)):
382+
if _is_instance(o, gs): return False
383+
for g in gs:
384+
if _is_instance(f, L(getattr(g, 'run_before', None))): return False
385+
return True
386+
373387
# Cell
374388
def sort_by_run(fs):
375389
end = L(fs).attrgot('toward_end')

nbs/03_xtras.ipynb

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@
618618
{
619619
"data": {
620620
"text/plain": [
621-
"['b', 'a', 'd', 'e', 'f', 'h', 'g', 'c']"
621+
"['a', 'b', 'd', 'c', 'h', 'e', 'f', 'g']"
622622
]
623623
},
624624
"execution_count": null,
@@ -1528,8 +1528,8 @@
15281528
"name": "stdout",
15291529
"output_type": "stream",
15301530
"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"
15331533
]
15341534
}
15351535
],
@@ -1835,7 +1835,7 @@
18351835
"text/markdown": [
18361836
"<h4 id=\"ContextManagers\" class=\"doc_header\"><code>class</code> <code>ContextManagers</code><a href=\"\" class=\"source_link\" style=\"float:right\">[source]</a></h4>\n",
18371837
"\n",
1838-
"> <code>ContextManagers</code>(**`mgrs`**) :: [`GetAttr`](/foundation.html#GetAttr)\n",
1838+
"> <code>ContextManagers</code>(**`mgrs`**) :: [`GetAttr`](/basics.html#GetAttr)\n",
18391839
"\n",
18401840
"Wrapper for `contextlib.ExitStack` which enters a collection of context managers"
18411841
],
@@ -1876,6 +1876,27 @@
18761876
"for o in 1,True: assert str2bool(o)"
18771877
]
18781878
},
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+
},
18791900
{
18801901
"cell_type": "code",
18811902
"execution_count": null,

settings.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author = Jeremy Howard and Sylvain Gugger
77
author_email = [email protected]
88
copyright = fast.ai
99
branch = master
10-
version = 1.3.15
10+
version = 1.3.16
1111
min_python = 3.6
1212
audience = Developers
1313
language = English

0 commit comments

Comments
 (0)