def beginCatalog(d=None, u=None, h=None, c=None, f=None, **notes): return partial(_ctlgThisLine, merge(notes, catalogId=newCatalogId(), testCase=c or notes.get('testCase', 'ad_hoc_%s'%(time.time())), targetHost=h or notes.get('targetHost', h), targetUser=u or notes.get('targetUser', u)), _detDB(d), u, h)
def genRunner(username=None, hostname=None, **notes): #(!:2) if username or hostname: return _runner(**merge(notes, targetUser=username or environ.get("USER"), targetHost=hostname or gethostname(), preprocessor=makeRemoteCommand)) return _runner(**notes)
def _runner(preprocessor=lambda x,**y: split(x), **iNotes): return lambda cmd,**notes: _evoke(preprocessor(cmd,**iNotes), merge(iNotes, notes, command=cmd))
def _evoke(cmdLst, notes): #(!:2) return _execute(merge(notes, started=time()), _popen(cmdLst))
def _finalizeReport(obs, retGet, stdout, stderr, finishTime): return merge(obs, artificeBreed='observation', finished=finishTime, stdout=stdout, stderr=stderr, retCode=retGet(), duration=finishTime-obs.get('started',0))
def showAndRecord(reporter, artifice): #rig:3 if artifice: if "-q" not in argv: print "%s"%(artifice) return merge(artifice, _id=reporter(artifice)) return artifice
def _hf(fn): return map(beginCatalog(**merge(args, testCase=path.split(fn)[1])), readLines(fn))
def _ctlgThisLine(notes, rptf, user, host, lineTxt): global interruptSignalReceived if not interruptSignalReceived: return showAndRecord(rptf, _ctlgy(notes,user, host, *sliceTxt(subst(lineTxt, **notes)))) return merge(notes, artificeBreed="interrupted")
def dostep(**params): return merge(params, f(**params))