Parses an output, which is generally a switch controlling a set of
    lights/outlets, etc.
517331
def _parse_output(self, output_xml):
    """"""
    output = Output(self._lutron,
                    name=output_xml.get('Name'),
                    watts=int(output_xml.get('Wattage')),
                    output_type=output_xml.get('OutputType'),
                    integration_id=int(output_xml.get('IntegrationID')))
    return output
29592
function parseOutput(str, callback) {
  var err = null;

  try {
    var lines      = str.split('\n');
    var wifis = [];
    
    for (var i = 1, l = lines.length; i < l; i++) {
      var mac = lines[i].match(macRegex);
      if (!mac) {
        continue;
      }
      var macStart = lines[i].indexOf(mac[0]);
      var elements = lines[i].substr(macStart).split(/[ ]+/);
      wifis.push({
        'ssid'    : lines[i].substr(0, macStart).trim(),
        'mac'     : elements[0].trim(),
        'channel' : parseInt(elements[2].trim(), 10),
        'rssi'    : parseInt(elements[1].trim(), 10)
      });
    }
  }
  catch (ex) {
    err = ex;
  }

  callback(err, wifis);
}
1165840
def _nested_output(obj):
    '''
    
    '''
    nested.__opts__ = __opts__
    ret = nested.output(obj).rstrip()
    return ret
149306
def print_lamps():
    """"""
    print("Printing information about all lamps paired to the Gateway")
    lights = [dev for dev in devices if dev.has_light_control]
    if len(lights) == 0:
        exit(bold("No lamps paired"))

    container = []
    for l in lights:
        container.append(l.raw)
    print(jsonify(container))
826367
public function parseOutput($output)
    {
        //if error code is returned, api OR the app will return an integer error code
        if ($this->isnum($output)) {
            switch ($output) {

                case 20:
                    return $this->lang['reports']['20'];
                    break;

                case 21:
                    return $this->lang['reports']['21'];
                    break;

                case 22:
                    return $this->lang['reports']['22'];
                    break;

                case 23:
                    return $this->lang['reports']['23'];
                    break;

                case 24:
                    return $this->lang['reports']['24'];
                    break;

                case 25:
                    return $this->lang['reports']['25'];
                    break;

                case 30:
                    return $this->lang['reports']['30'];
                    break;


                //In-app messages:
                case 100:
                    return $this->lang['app'][0];
                    break;

                case 101:
                    return $this->lang['app'][1];
                    break;

                case 102:
                    return $this->lang['app'][2];
                    break;

                default:
                    return $this->lang['reports']['999'];
                    break;

            }

            //returns from Mutlucell
        } elseif (preg_match('/(\$[0-9]+\#[0-9]+\.[0-9]+)/i', $output)) {
            //returned output is formatted like $ID#STATUS
            //E.g: $1234567#1.0
            $output = explode('#', $output);

            $status = $output[1];
            if ($status == '0.0') {
                return $this->lang['app']['101'];
            } else {
                return $this->lang['app']['100'];
            }

            //Unknown error
        } else {
            return $output;
        }
    }
797725
function parse(str, options, callback) {
	if (typeof options === 'function') {
		callback = options
		options = {}
	}
	process.nextTick(() => {
		const output = parseSync(str, options)
		callback(output)
	})
}
1235019
function parse(input, done) {
  if (input && input.args) return done(undefined, input);
  if (input) done(undefined, {args: [].concat(input)});
  cmd([], done);
}
1331128
def set_output(self, state, channel=2):
        """"""
        if state:
            self.instr.write(':OUTP{0} ON'.format(channel))
        else:
            self.instr.write(':OUTP{0} OFF'.format(channel))
819185
function parseOptions(options) {
  let separator
  let transformer

  if (2 === options.length) {
    [separator, transformer] = options
    if (defaultTransformers[transformer]) {
      transformer = defaultTransformers[transformer] /* Don't validate */
      validate({ separator })
    } else {
      validate({ separator, transformer })
    }
  } else if (1 === options.length) {
    const option = options[0]
    if (false === option || 'function' === typeof option) {
      transformer = option /* Don't validate */
    } else if (defaultTransformers[option]) {
      transformer = defaultTransformers[option] /* Don't validate */
    } else {
      separator = option
      validate({ separator })
    }
  }

  return { separator, transformer }
}
693284
def set_back_led_output(self, value):
        """"""
        return self.write(request.SetBackLEDOutput(self.seq, value))
885308
def _parse(self, registers):
        """"""
        result = {'ip': self.ip, 'connected': True}
        decoder = BinaryPayloadDecoder.fromRegisters(registers,
                                                     byteorder=Endian.Big,
                                                     wordorder=Endian.Little)
        # Register 40001 is a collection of alarm status signals
        b = [decoder.decode_bits(), decoder.decode_bits()]
        reg_40001 = b[1] + b[0]
        # Bits 0-3 map to the monitor state
        monitor_integer = sum(1 << i for i, b in enumerate(reg_40001[:4]) if b)
        result['state'] = options['monitor state'][monitor_integer]
        # Bits 4-5 map to fault status
        fault_integer = sum(1 << i for i, b in enumerate(reg_40001[4:6]) if b)
        result['fault'] = {'status': options['fault status'][fault_integer]}
        # Bits 6 and 7 tell if low and high alarms are active
        low, high = reg_40001[6:8]
        result['alarm'] = options['alarm level'][low + high]
        # Bits 8-10 tell if internal sensor relays 1-3 are energized. Skipping.
        # Bit 11 is a heartbeat bit that toggles every two seconds. Skipping.
        # Bit 12 tells if relays are under modbus control. Skipping.
        # Remaining bits are empty. Skipping.
        # Register 40002 has a gas ID and a sensor cartridge ID. Skipping.
        decoder._pointer += 2
        # Registers 40003-40004 are the gas concentration as a float
        result['concentration'] = decoder.decode_32bit_float()
        # Register 40005 is the concentration as an int. Skipping.
        decoder._pointer += 2
        # Register 40006 is the number of the most important fault.
        fault_number = decoder.decode_16bit_uint()
        if fault_number != 0:
            code = ('m' if fault_number < 30 else 'F') + str(fault_number)
            result['fault']['code'] = code
            result['fault'].update(faults[code])
        # Register 40007 holds the concentration unit in the second byte
        # Instead of being an int, it's the position of the up bit
        unit_bit = decoder.decode_bits().index(True)
        result['units'] = options['concentration unit'][unit_bit]
        decoder._pointer += 1
        # Register 40008 holds the sensor temperature in Celsius
        result['temperature'] = decoder.decode_16bit_int()
        # Register 40009 holds number of hours remaining in cell life
        result['life'] = decoder.decode_16bit_uint() / 24.0
        # Register 40010 holds the number of heartbeats (16 LSB). Skipping.
        decoder._pointer += 2
        # Register 40011 is the sample flow rate in cc / min
        result['flow'] = decoder.decode_16bit_uint()
        # Register 40012 is blank. Skipping.
        decoder._pointer += 2
        # Registers 40013-40016 are the alarm concentration thresholds
        result['low-alarm threshold'] = round(decoder.decode_32bit_float(), 6)
        result['high-alarm threshold'] = round(decoder.decode_32bit_float(), 6)
        # Despite what the manual says, thresholds are always reported in ppm.
        # Let's fix that to match the concentration units.
        if result['units'] == 'ppb':
            result['concentration'] *= 1000
            result['low-alarm threshold'] *= 1000
            result['high-alarm threshold'] *= 1000
        return result
577015
def _parse_output_keys(val):
    
    out = {}
    for k in val.split(","):
        # record output
        if ":" in k:
            name, attrs = k.split(":")
            out[name] = attrs.split(";")
        else:
            out[k] = None
    return out
676298
def socket_parse(self, astr_destination):
        '''
        
        
        '''
        t_socketInfo = astr_destination.partition(':')
        if len(t_socketInfo[1]):
            self._b_isSocket    = True
            self._socketRemote  = t_socketInfo[0]
            self._socketPort    = t_socketInfo[2]
        else:
            self._b_isSocket    = False
        return self._b_isSocket
38641
def set_output(self, state):
        """"""
        if state:
            self.instr.write('OUTP ON')
        else:
            self.instr.write('OUTP OFF')
398866
def readin():
    """"""

    selection = sys.stdin.readline().strip("\n")
    MyBulbs.bulbs.sort(key=lambda x: x.label or x.mac_addr)
    lov=[ x for x in selection.split(" ") if x != ""]
    if lov:
        if MyBulbs.boi:
            #try:
            if True:
                if int(lov[0]) == 0:
                    MyBulbs.boi=None
                elif int(lov[0]) == 1:
                    if len(lov) >1:
                        MyBulbs.boi.set_power(lov[1].lower() in ["1","on","true"]) 
                        MyBulbs.boi=None
                    else:
                        print("Error: For power you must indicate on or off\n")
                elif int(lov[0]) == 2:
                    if len(lov) >2:
                        try:
                            MyBulbs.boi.set_color([58275,0, 
                                    int(round((float(lov[1])*65365.0)/100.0)),
                                    int(round(float(lov[2])))])
                            
                            MyBulbs.boi=None
                        except:
                            print("Error: For white brightness (0-100) and temperature (2500-9000) must be numbers.\n")
                    else:
                        print("Error: For white you must indicate brightness (0-100) and temperature (2500-9000)\n")
                elif int(lov[0]) == 3:
                    if len(lov) >3:
                        try:
                            MyBulbs.boi.set_color([int(round((float(lov[1])*65535.0)/360.0)),
                                    int(round((float(lov[2])*65535.0)/100.0)),
                                    int(round((float(lov[3])*65535.0)/100.0)),3500])
                            MyBulbs.boi=None
                        except:
                            print("Error: For colour hue (0-360), saturation (0-100) and brightness (0-100)) must be numbers.\n")
                    else:
                        print("Error: For colour you must indicate hue (0-360), saturation (0-100) and brightness (0-100))\n")
                        
                elif int(lov[0]) == 4: 
                    print(MyBulbs.boi.device_characteristics_str("    "))
                    print(MyBulbs.boi.device_product_str("    "))
                    MyBulbs.boi=None
                elif int(lov[0]) == 5: 
                    print(MyBulbs.boi.device_firmware_str("   "))
                    MyBulbs.boi=None
                elif int(lov[0]) == 6: 
                    mypartial=partial(MyBulbs.boi.device_radio_str)
                    MyBulbs.boi.get_wifiinfo(callb=lambda x,y:print("\n"+mypartial(y)))
                    MyBulbs.boi=None
                elif int(lov[0]) == 7: 
                    mypartial=partial(MyBulbs.boi.device_time_str)
                    MyBulbs.boi.get_hostinfo(callb=lambda x,y:print("\n"+mypartial(y)))
                    MyBulbs.boi=None
                elif int(lov[0]) == 8: 
                    if len(lov) >3:
                        try:
                            print ( "Sending {}".format([int(round((float(lov[1])*65535.0)/360.0)),
                                    int(round((float(lov[2])*65535.0)/100.0)),
                                    int(round((float(lov[3])*65535.0)/100.0)),3500]))
                            MyBulbs.boi.set_waveform({"color":[int(round((float(lov[1])*65535.0)/360.0)),
                                                               int(round((float(lov[2])*65535.0)/100.0)),
                                                               int(round((float(lov[3])*65535.0)/100.0)),
                                                               3500],
                                                      "transient":1, "period":100, "cycles":30,
                                                      "skew_ratio":0,"waveform":0})
                            MyBulbs.boi=None
                        except:
                            print("Error: For pulse hue (0-360), saturation (0-100) and brightness (0-100)) must be numbers.\n")
                    else:
                        print("Error: For pulse you must indicate hue (0-360), saturation (0-100) and brightness (0-100))\n")
            #except:
                #print ("\nError: Selection must be a number.\n")  
        else:
            try:
                if int(lov[0]) > 0:
                    if int(lov[0]) <=len(MyBulbs.bulbs):
                        MyBulbs.boi=MyBulbs.bulbs[int(lov[0])-1]
                    else:
                        print("\nError: Not a valid selection.\n")
            
            except:
                print ("\nError: Selection must be a number.\n")
        
    if MyBulbs.boi:
        print("Select Function for {}:".format(MyBulbs.boi.label))
        print("\t[1]\tPower (0 or 1)")
        print("\t[2]\tWhite (Brigthness Temperature)")
        print("\t[3]\tColour (Hue Saturation Brightness)")
        print("\t[4]\tInfo")
        print("\t[5]\tFirmware")
        print("\t[6]\tWifi")
        print("\t[7]\tUptime")
        print("\t[8]\tPulse")
        print("")
        print("\t[0]\tBack to bulb selection")
    else:
        idx=1
        print("Select Bulb:")
        for x in MyBulbs.bulbs:
            print("\t[{}]\t{}".format(idx,x.label or x.mac_addr))
            idx+=1
    print("")
    print("Your choice: ", end='',flush=True)
681537
def parse_result(cls, result):
        
        if len(result) == 3:
            items, count, context = result
        else:
            context = {}
            items, count = result
        return items, count, context
133659
def _parse_status(self, output):
        '''
        
        '''
        parsed = self._parse_machine_readable_output(output)
        statuses = []
        # group tuples by target name
        # assuming tuples are sorted by target name, this should group all
        # the tuples with info for each target.
        for target, tuples in itertools.groupby(parsed, lambda tup: tup[1]):
            # transform tuples into a dict mapping "type" to "data"
            info = {kind: data for timestamp, _, kind, data in tuples}
            status = Status(name=target, state=info.get('state'),
                            provider=info.get('provider-name'))
            statuses.append(status)

        return statuses