Skip to content

Commit abedf5e

Browse files
committed
cleanup
1 parent c2fde43 commit abedf5e

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

fastcore/xtras.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ def mk_dataclass(cls):
686686
setattr(cls, k, field(default=None))
687687
dataclass(cls, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False)
688688

689-
# %% ../nbs/03_xtras.ipynb 181
689+
# %% ../nbs/03_xtras.ipynb 179
690690
def flexicache(*funcs, maxsize=128):
691691
"Like `lru_cache`, but customisable with policy `funcs`"
692692
def _f(func):
@@ -711,23 +711,23 @@ def wrapper(*args, **kwargs):
711711
return wrapper
712712
return _f
713713

714-
# %% ../nbs/03_xtras.ipynb 183
714+
# %% ../nbs/03_xtras.ipynb 181
715715
def time_policy(seconds):
716716
"A `flexicache` policy that expires cached items after `seconds` have passed"
717717
def policy(last_time):
718718
now = time()
719719
return now if last_time is None or now-last_time>seconds else None
720720
return policy
721721

722-
# %% ../nbs/03_xtras.ipynb 184
722+
# %% ../nbs/03_xtras.ipynb 182
723723
def mtime_policy(filepath):
724724
"A `flexicache` policy that expires cached items after `filepath` modified-time changes"
725725
def policy(mtime):
726726
current_mtime = getmtime(filepath)
727727
return current_mtime if mtime is None or current_mtime>mtime else None
728728
return policy
729729

730-
# %% ../nbs/03_xtras.ipynb 187
730+
# %% ../nbs/03_xtras.ipynb 185
731731
def timed_cache(seconds=60, maxsize=128):
732732
"Like `lru_cache`, but also with time-based eviction"
733733
return flexicache(time_policy(seconds), maxsize=maxsize)

nbs/03_xtras.ipynb

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2840,24 +2840,6 @@
28402840
"Person(name=\"Bob\")"
28412841
]
28422842
},
2843-
{
2844-
"cell_type": "code",
2845-
"execution_count": null,
2846-
"metadata": {},
2847-
"outputs": [],
2848-
"source": [
2849-
"d = dict(a=1,b=2)"
2850-
]
2851-
},
2852-
{
2853-
"cell_type": "code",
2854-
"execution_count": null,
2855-
"metadata": {},
2856-
"outputs": [],
2857-
"source": [
2858-
"d.popitem()"
2859-
]
2860-
},
28612843
{
28622844
"cell_type": "code",
28632845
"execution_count": null,

0 commit comments

Comments
 (0)