memoize open_script
This commit is contained in:
4
pier.py
4
pier.py
@ -3,6 +3,7 @@
|
||||
from glob import glob
|
||||
from io import StringIO
|
||||
from contextlib import redirect_stdout, redirect_stderr
|
||||
from functools import lru_cache
|
||||
|
||||
import http.server
|
||||
import socketserver
|
||||
@ -49,7 +50,10 @@ def run_script(fn):
|
||||
exec(code)
|
||||
return sio.getvalue()
|
||||
|
||||
@lru_cache()
|
||||
def open_script(fn):
|
||||
print("reading", fn)
|
||||
print("_" * 80)
|
||||
with open(fn) as f:
|
||||
src = f.read()
|
||||
code = compile(src, fn, "exec")
|
||||
|
Reference in New Issue
Block a user