Now parse the WMIC return
175872
function(psRec,sProcId){
            if(!sProcId){throw new Error("No Proc Id found in data");}
            var iFind,sArgs
            iFind=psRec.CommandLine.indexOf(psRec.Name);
            sArgs = psRec.CommandLine.substring(iFind+psRec.Name.length+1);
            psRecs[sProcId]={
                pid: psRec.ProcessId
               ,ppid: psRec.ParentProcessId
               ,commandPath: psRec.ExecutablePath
               ,command: psRec.Name
               ,args: sArgs
            }
        }
90318
def Parse(self, cmd, args, stdout, stderr, return_val, time_taken,
            knowledge_base):
    """"""
    _ = stderr, time_taken, args, knowledge_base  # Unused
    self.CheckReturn(cmd, return_val)

    plist = biplist.readPlist(io.BytesIO(stdout))

    if len(plist) > 1:
      raise parser.ParseError("SPHardwareDataType plist has too many items.")

    hardware_list = plist[0]["_items"][0]
    serial_number = hardware_list.get("serial_number", None)
    system_product_name = hardware_list.get("machine_model", None)
    bios_version = hardware_list.get("boot_rom_version", None)

    yield rdf_client.HardwareInfo(
        serial_number=serial_number,
        bios_version=bios_version,
        system_product_name=system_product_name)
314147
def msw(self):
        '''  '''
        return (t for t, c in self.tcmap().items() if len(c) > 1)
1041006
def _parse_return_code_powershell(string):
    '''
    
    '''

    regex = re.search(r'ReturnValue\s*: (\d*)', string)
    if not regex:
        return (False, 'Could not parse PowerShell return code.')
    else:
        return int(regex.group(1))
659363
function parse_HLinkTooltip(blob, length) {
	blob.read_shift(2);
	var ref = parse_Ref8U(blob, 8);
	var wzTooltip = blob.read_shift((length-10)/2, 'dbcs-cont');
	wzTooltip = wzTooltip.replace(chr0,"");
	return [ref, wzTooltip];
}
400292
function parse_wb_bin(data, opts) {
	var wb = { AppVersion:{}, WBProps:{}, WBView:[], Sheets:[], CalcPr:{}, xmlns: "" };
	var state = [];
	var pass = false;

	if(!opts) opts = {};
	opts.biff = 12;

	var Names = [];
	var supbooks = ([[]]);
	supbooks.SheetNames = [];
	supbooks.XTI = [];

	recordhopper(data, function hopper_wb(val, R_n, RT) {
		switch(RT) {
			case 0x009C: /* 'BrtBundleSh' */
				supbooks.SheetNames.push(val.name);
				wb.Sheets.push(val); break;

			case 0x0099: /* 'BrtWbProp' */
				wb.WBProps = val; break;

			case 0x0027: /* 'BrtName' */
				if(val.Sheet != null) opts.SID = val.Sheet;
				val.Ref = stringify_formula(val.Ptg, null, null, supbooks, opts);
				delete opts.SID;
				delete val.Ptg;
				Names.push(val);
				break;
			case 0x040C: /* 'BrtNameExt' */ break;

			case 0x0165: /* 'BrtSupSelf' */
			case 0x0166: /* 'BrtSupSame' */
			case 0x0163: /* 'BrtSupBookSrc' */
			case 0x029B: /* 'BrtSupAddin' */
				if(!supbooks[0].length) supbooks[0] = [RT, val];
				else supbooks.push([RT, val]);
				supbooks[supbooks.length - 1].XTI = [];
				break;
			case 0x016A: /* 'BrtExternSheet' */
				if(supbooks.length === 0) { supbooks[0] = []; supbooks[0].XTI = []; }
				supbooks[supbooks.length - 1].XTI = supbooks[supbooks.length - 1].XTI.concat(val);
				supbooks.XTI = supbooks.XTI.concat(val);
				break;
			case 0x0169: /* 'BrtPlaceholderName' */
				break;

			/* case 'BrtModelTimeGroupingCalcCol' */
			case 0x0C00: /* 'BrtUid' */
			case 0x0C01: /* 'BrtRevisionPtr' */
			case 0x0817: /* 'BrtAbsPath15' */
			case 0x0216: /* 'BrtBookProtection' */
			case 0x02A5: /* 'BrtBookProtectionIso' */
			case 0x009E: /* 'BrtBookView' */
			case 0x009D: /* 'BrtCalcProp' */
			case 0x0262: /* 'BrtCrashRecErr' */
			case 0x0802: /* 'BrtDecoupledPivotCacheID' */
			case 0x009B: /* 'BrtFileRecover' */
			case 0x0224: /* 'BrtFileSharing' */
			case 0x02A4: /* 'BrtFileSharingIso' */
			case 0x0080: /* 'BrtFileVersion' */
			case 0x0299: /* 'BrtFnGroup' */
			case 0x0850: /* 'BrtModelRelationship' */
			case 0x084D: /* 'BrtModelTable' */
			case 0x0225: /* 'BrtOleSize' */
			case 0x0805: /* 'BrtPivotTableRef' */
			case 0x0254: /* 'BrtSmartTagType' */
			case 0x081C: /* 'BrtTableSlicerCacheID' */
			case 0x081B: /* 'BrtTableSlicerCacheIDs' */
			case 0x0822: /* 'BrtTimelineCachePivotCacheID' */
			case 0x018D: /* 'BrtUserBookView' */
			case 0x009A: /* 'BrtWbFactoid' */
			case 0x045D: /* 'BrtWbProp14' */
			case 0x0229: /* 'BrtWebOpt' */
			case 0x082B: /* 'BrtWorkBookPr15' */
				break;

			case 0x0023: /* 'BrtFRTBegin' */
				state.push(R_n); pass = true; break;
			case 0x0024: /* 'BrtFRTEnd' */
				state.pop(); pass = false; break;
			case 0x0025: /* 'BrtACBegin' */
				state.push(R_n); pass = true; break;
			case 0x0026: /* 'BrtACEnd' */
				state.pop(); pass = false; break;

			case 0x0010: /* 'BrtFRTArchID$' */ break;

			default:
				if((R_n||"").indexOf("Begin") > 0){/* empty */}
				else if((R_n||"").indexOf("End") > 0){/* empty */}
				else if(!pass || (opts.WTF && state[state.length-1] != "BrtACBegin" && state[state.length-1] != "BrtFRTBegin")) throw new Error("Unexpected record " + RT + " " + R_n);
		}
	}, opts);

	parse_wb_defaults(wb);

	// $FlowIgnore
	wb.Names = Names;

	(wb).supbooks = supbooks;
	return wb;
}
1174089
private Context translateReturn(WyilFile.Stmt.Return stmt, Context context) {
		//
		Tuple<WyilFile.Expr> returns = stmt.getReturns();
		//
		if (returns.size() > 0) {
			// There is at least one return value. Therefore, we need to check
			// any preconditions for those return expressions and, potentially,
			// ensure any postconditions of the cnlosing function/method are
			// met.
			Pair<Expr[], Context> p = translateExpressionsWithChecks(returns, context);
			Expr[] exprs = p.first();
			context = p.second();
			//
			generateReturnTypeInvariantCheck(stmt, exprs, context);
			generatePostconditionChecks(stmt, exprs, context);
		}
		// Return null to signal that execution does not continue after this
		// return statement.
		return null;
	}
1247168
def _parse_one_event(self):
        """"""
        # WVA includes \r\n between messages which the parser doesn't like, so we
        # throw away any data before a opening brace
        try:
            open_brace_idx = self._buf.index('{')
        except ValueError:
            self._buf = six.u('')  # no brace found
        else:
            if open_brace_idx > 0:
                self._buf = self._buf[open_brace_idx:]

        try:
            event, idx = self._decoder.raw_decode(self._buf)
            self._buf = self._buf[idx:]
            return event
        except ValueError:
            return None
817773
def ParseMultiple(self, result_dicts):
    """"""
    for result_dict in result_dicts:
      kb_user = rdf_client.User()
      for wmi_key, kb_key in iteritems(self.account_mapping):
        try:
          kb_user.Set(kb_key, result_dict[wmi_key])
        except KeyError:
          pass
      # We need at least a sid or a username.  If these are missing its likely
      # we retrieved just the userdomain for an AD account that has a name
      # collision with a local account that is correctly populated.  We drop the
      # bogus domain account.
      if kb_user.sid or kb_user.username:
        yield kb_user
260764
function () {
			process.stdin.resume();
			process.stdin.setEncoding('utf8');
			_execCtx = [self];
			process.stdin.on('data', function (chunk) {
				var ctx = _execCtx[0],
					cmd = chunk.substr(0,chunk.length-1);

				if (cmd.substr(0,2) == '..')
				{
					cmd = 'if (_execCtx.length>1) _execCtx.shift(); undefined;'
				} else if (cmd.substr(0,1) == ':')
				{
					cmd = 'var newCtx = '+cmd.substr(1)+'; _execCtx.unshift(newCtx); undefined;';
				} else if (cmd.substr(0,1) == '/')
				{
					cmd = '';
					_execCtx = [self];
				}

				self.exec(cmd,ctx?ctx:undefined);
				return false;
			});
		}
446170
def _parse_return(cls, result):
        

        return_value = None
        success = result['result']
        context = result['context']

        if 'return_value' in result:
            return_value = result['return_value']

        return success, return_value, context
1326722
function(d) {
    return d.wmExtent || (d.wmExtent = [1,
      (later.D.extent(d)[1] + (later.dw.val(later.M.start(d)) - 1) +
      (7 - later.dw.val(later.M.end(d)))) / 7]);
  }
128405
def async(self, space):
        ""
        return (self.match(space, space.w_SystemExit) or
                self.match(space, space.w_KeyboardInterrupt))
126626
def find_window_id(pattern, method='mru', error='raise'):
        
        import utool as ut
        winid_candidates = XCtrl.findall_window_ids(pattern)
        if len(winid_candidates) == 0:
            if error == 'raise':
                available_windows = ut.cmd2('wmctrl -l')['out']
                msg = 'No window matches pattern=%r' % (pattern,)
                msg += '\navailable windows are:\n%s' % (available_windows,)
                print(msg)
                raise Exception(msg)
            win_id = None
        elif len(winid_candidates) == 1:
            win_id = winid_candidates[0]
        else:
            # print('Multiple (%d) windows matches pattern=%r' % (
            #     len(winid_list), pattern,))
            # Find most recently used window with the focus name.
            win_id = XCtrl.sort_window_ids(winid_candidates, method)[0]
        return win_id
979117
def wstatus_to_str(status):
    
    if os.WIFEXITED(status):
        return 'exited with return code %d' % (os.WEXITSTATUS(status),)
    if os.WIFSIGNALED(status):
        n = os.WTERMSIG(status)
        return 'exited due to signal %d (%s)' % (n, SIGNAL_BY_NUM.get(n))
    if os.WIFSTOPPED(status):
        n = os.WSTOPSIG(status)
        return 'stopped due to signal %d (%s)' % (n, SIGNAL_BY_NUM.get(n))
    return 'unknown wait status (%d)' % (status,)
1078340
def getWmState(self, win, str=False):
        
        states = self._getProperty('_NET_WM_STATE', win) or []
        if not str:
            return states
        return [self._getAtomName(s) for s in states]
1089734
def parse(self, ps, **kw):
        '''
        
        '''
        namespaceURI = self.wsAddressURI
        elements = ("MessageID","Action","To","From","RelatesTo")
        d = {namespaceURI:elements}
        typecodes = self._getWSAddressTypeCodes(**d)
        pyobjs = ps.ParseHeaderElements(typecodes)
        self._messageID = pyobjs[(namespaceURI,elements[0])]
        self._action = pyobjs[(namespaceURI,elements[1])]
        self._addressTo = pyobjs[(namespaceURI,elements[2])]
        self._from = pyobjs[(namespaceURI,elements[3])]
        self._relatesTo = pyobjs[(namespaceURI,elements[4])]