tools: wasptool: Sneaky hack to avoid copying docstrings to the device
This commit is contained in:
parent
3ded49c5ef
commit
321484b845
1 changed files with 17 additions and 4 deletions
|
@ -27,16 +27,29 @@ def unsync(c):
|
||||||
c.sendline('wasp.run()')
|
c.sendline('wasp.run()')
|
||||||
|
|
||||||
def paste(c, f, verbose=False):
|
def paste(c, f, verbose=False):
|
||||||
|
docstring = False
|
||||||
for ln in f.readlines():
|
for ln in f.readlines():
|
||||||
ln = ln.rstrip()
|
ln = ln.rstrip()
|
||||||
if not ln.lstrip().startswith('#'):
|
|
||||||
c.sendline(ln)
|
# This is a bit loose (definitely not PEP-257 compliant) but
|
||||||
c.expect('=== ')
|
# is enough for most code.
|
||||||
|
if ln.lstrip().startswith('"""'):
|
||||||
|
docstring = True
|
||||||
|
if docstring:
|
||||||
|
if ln.rstrip().endswith('"""'):
|
||||||
|
docstring = False
|
||||||
|
continue
|
||||||
|
|
||||||
|
if ln.lstrip().startswith('#'):
|
||||||
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
c.sendline(ln)
|
||||||
|
c.expect('=== ')
|
||||||
|
|
||||||
if not verbose:
|
if not verbose:
|
||||||
print('.', end='', flush=True)
|
print('.', end='', flush=True)
|
||||||
|
|
||||||
|
|
||||||
def handle_eval(c, cmd):
|
def handle_eval(c, cmd):
|
||||||
verbose = bool(c.logfile)
|
verbose = bool(c.logfile)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue