parse the fru information
766381
def parse(data)
      return unless data
      parsed_data = []
      data.lines.each do |line|
        if line =~ /^FRU.*/
          # this is the either the first line of of the fru or another fru
          if parsed_data.count != 0
            # we have reached a new fru device so lets record the previous fru
            new_fru = FruData.new(parsed_data)
            parsed_data = []
            @list[new_fru[:name]] = new_fru
          end

        end
        parsed_data << line
      end
      # process the last fru
      return if parsed_data.count == 0
      # we have reached a new fru device so lets record the previous fru
      new_fru = FruData.new(parsed_data)
      parsed_data = []
      @list[new_fru[:name]] = new_fru
    end
1366878
def parse(cls, uri):
        """"""
        match = _URI_FORMAT.search(uri)
        return cls(match.group(1), match.group(2), match.group(3), match.group(4))
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)
109783
def parse_FreqDist_interChr(self, f):
        
        parsed_data = dict()
        firstline = True
        for l in f['f']:
            if firstline:
                firstline = False
                interChr = float(re.sub("\)", "", l.split(":")[1]))
            else:
                break
        parsed_data['interChr'] = interChr
        return parsed_data
1261930
def parse(self, rrstr):
        # type: (bytes) -> None
        '''
        
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('PD record already initialized!')

        (su_len_unused, su_entry_version_unused) = struct.unpack_from('=BB', rrstr[:4], 2)

        self.padding = rrstr[4:]

        # We assume that the caller has already checked the su_entry_version,
        # so we don't bother.

        self._initialized = True
540335
function parse(data){
			var out = {};
        	if(data.type && data.type === 'User'){

        		// map data into ufData format from api json
        		if(data.name && data.name !== '') {out.name = data.name};
        		if(data.username && data.username !== '') {out.nickname = data.username};
        		if(data.blog && data.blog !== '') {
        			if(!out.url) {out.url =[]}
        			out.url.push(data.blog);
        		};
        		if(data.html_url && data.html_url !== '') {
        			if(!out.url) {out.url =[]}
        			out.url.push(data.html_url);
        		};
        		if(data.bio !== null) {out.note = [data.bio]};
        		if(data.location && data.location !== '') {out.label = [data.location]};
				if(data.company && data.company !== '') {out['organization-name'] = [data.company]};
				if(data.avatar_url && data.avatar_url !== '') {out.photo = [data.avatar_url]}; 
				if(data.email && data.email !== '') {out.email = [data.email]};
        		
			}
			return {type: ['h-card'], properties: out};
		}
931912
def user_parse(data):
        """"""
        resp = data.get('response', [{}])[0]
        yield 'id', resp.get('uid')
        yield 'first_name', resp.get('first_name')
        yield 'last_name', resp.get('last_name')
        yield 'username', resp.get('nickname')
        yield 'city', resp.get('city')
        yield 'country', resp.get('country')
        yield 'picture', resp.get('photo_big')
1343159
def parse(self, rrstr):
        # type: (bytes) -> None
        '''
        
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('ST record already initialized!')

        (su_len, su_entry_version_unused) = struct.unpack_from('=BB', rrstr[:4], 2)

        # We assume that the caller has already checked the su_entry_version,
        # so we don't bother.

        if su_len != 4:
            raise pycdlibexception.PyCdlibInvalidISO('Invalid length on rock ridge extension')

        self._initialized = True
1359800
def parse_tag_info_chrs(self, f, convChr=True):
        
        parsed_data_total = OrderedDict()
        parsed_data_uniq = OrderedDict()
        remove = ["hap", "random", "chrUn", "cmd", "EBV", "GL", "NT_"]
        for l in f['f']:
            s = l.split("\t")
            key = s[0].strip()
            # skip header
            if '=' in l or len(s) != 3:
                continue
            if convChr:
                if any(x in key for x in remove):
                    continue
            try:
                vT = float(s[1].strip())
                vU = float(s[2].strip())
            except ValueError:
                continue

            parsed_data_total[key] = vT
            parsed_data_uniq[key] = vU

        return [parsed_data_total, parsed_data_uniq]
1180518
def parse_entry(self, entry):
        """"""
        entry = entry.split('\t')
        self.chrom, self.pos, self.id, self.ref, alt_, self.qual, filter_, info, self.format = entry[:9]
        self.samples = entry[9:]
        self.alt = alt_.split(',')
        if filter_ == 'PASS' or filter_ == '.':
            self.passed = True
        else:
            self.passed = filter_.split(';')
        self.info = info
        # currently unused
        #if info != '.':
            #info_l = info.split(';')
            #self.info = [v.split('=') if '=' in v else (v,1) for v in info_l]
        self.format = self.format.split(':')
        if 'GT' in self.format:
            self.GT = self.format.index('GT')
        if 'GQ' in self.format:
            self.GQ = self.format.index('GQ')
        if 'DP' in self.format:
            self.DP = self.format.index('DP')
        if 'FT' in self.format:
            self.FT = self.format.index('FT')
1072443
def user_parse(data):
        """"""
        yield 'id', data.get('id')
        yield 'email', data.get('email')
        first_name, _, last_name = (data.get('name') or '').partition(' ')
        yield 'first_name', first_name
        yield 'last_name', last_name
        yield 'username', data.get('login')
        yield 'picture', data.get('avatar_url')
        yield 'link', data.get('html_url')
        location = data.get('location', '')
        if location:
            split_location = location.split(',')
            yield 'country', split_location[0].strip()
            if len(split_location) > 1:
                yield 'city', split_location[1].strip()
668920
def parse(data, datafile):
    """"""
    data._last_travel = [0, [0]]  # x and verbs used by section 3

    while True:
        section_number = int(datafile.readline())
        if not section_number:  # no further sections
            break
        store = globals().get('section%d' % section_number)
        while True:
            fields = [ (int(field) if field.lstrip('-').isdigit() else field)
                       for field in datafile.readline().strip().split('\t') ]
            if fields[0] == -1:  # end-of-section marker
                break
            store(data, *fields)

    del data._last_travel  # state used by section 3
    del data._object       # state used by section 5

    data.object_list = sorted(set(data.objects.values()), key=attrgetter('n'))
    #data.room_list = sorted(set(data.rooms.values()), key=attrgetter('n'))
    for obj in data.object_list:
        name = obj.names[0]
        if hasattr(data, name):
            name = name + '2'  # create identifiers like ROD2, PLANT2
        setattr(data, name, obj)

    return data
1070157
def parse(self):
        """"""
        plt = Plot(name_from_filename(self.pltfilename))

        with open(self.pltfilename, 'rb') as pltfile:
            segment = None

            for line in pltfile:
                if not line:
                    continue

                c, val = line[:1], line[1:]

                if c == 'Z':
                    edist = None
                    try:
                        ymin, ymax, xmin, xmax, zmin, zmax = (float(v) for v in val.split())
                    except ValueError:
                        ymin, ymax, xmin, xmax, zmin, zmax, _, edist = val.split()
                        ymin, ymax, xmin, xmax, zmin, zmax, edist = \
                            (float(v) for v in (ymin, ymax, xmin, xmax, zmin, zmax, edist))
                    plt.set_bounds(ymin, ymax, xmin, xmax, zmin, zmax, edist)

                elif c == 'S':
                    if not plt.name:
                        plt.name = val.strip()

                elif c == 'G':
                    plt.utm_zone = int(val)

                elif c == 'O':
                    plt.datum = val

                elif c == 'N':
                    date, comment = None, ''  # both date and comment are optional
                    try:
                        name, _, m, d, y, comment = val.split(None, 5)
                        date = datetime.date(int(y), int(m), int(d))
                    except ValueError:
                        try:
                            name, _, m, d, y = val.split()
                            date = datetime.date(int(y), int(m), int(d))
                        except ValueError:
                            name = val
                    comment = comment[1:].strip()
                    segment = Segment(name, date, comment)

                elif c == 'M':
                    flags = None  # flags are optional
                    try:
                        y, x, z, name, _, l, u, d, r, _, edist = val.split()
                    except ValueError:
                        y, x, z, name, _, l, u, d, r, _, edist, flags = val.split()
                    cmd = MoveCommand(float(y), float(x), float(z), name[1:],
                                      float(l), float(r), float(u), float(d), float(edist), flags)
                    segment.add_command(cmd)

                elif c in ('D', 'd'):
                    # 'D' for normal stations, 'd' for "hidden" stations with the 'P' flag
                    flags = None
                    try:
                        y, x, z, name, _, l, u, d, r, _, edist = val.split()
                    except ValueError:
                        y, x, z, name, _, l, u, d, r, _, edist, flags = val.split()
                    cmd = DrawCommand(float(y), float(x), float(z), name[1:],
                                      float(l), float(r), float(u), float(d), float(edist), flags)
                    cmd.cmd = c
                    segment.add_command(cmd)

                elif c == 'X':
                    segment.set_bounds(*(float(v) for v in val.split()))

                    # An X-bounds command signifies end of segment
                    plt.add_segment(segment)
                    segment = None

                elif c == 'P':
                    name, y, x, z = val.split()
                    plt.add_fixed_point(name, (float(y), float(x), float(z)))

                elif c == 'C':
                    plt.loop_count = int(val)

                elif c == 'R':
                    count, common, from_sta, to_sta, stations = val.split(None, 4)
                    plt.add_loop(int(count), common, from_sta, to_sta, stations.split())

                elif c == '\x1A':
                    continue  # "soft EOF" ascii SUB ^Z

                else:
                    msg = "Unknown PLT control code '%s': %s" % (c, val)
                    if self.strict_mode:
                        raise ParseException(msg)
                    else:
                        log.warning(msg)

        return plt
247928
def user_parse(data):
        """"""
        _user = data.get('query', {}).get('results', {}).get('profile', {})
        yield 'id', _user.get('guid')
        yield 'username', _user.get('username')
        yield 'link', _user.get('profileUrl')
        emails = _user.get('emails')
        if isinstance(emails, list):
            for email in emails:
                if 'primary' in list(email.keys()):
                    yield 'email', email.get('handle')
        elif isinstance(emails, dict):
            yield 'email', emails.get('handle')
        yield 'picture', _user.get('image', {}).get('imageUrl')
        city, country = map(lambda s: s.strip(),
                            _user.get('location', ',').split(','))
        yield 'city', city
        yield 'country', country
988050
def _parse_btrfs_info(data):
    '''
    
    '''
    ret = {}
    for line in [line for line in data.split("\n") if line][:-1]:
        if line.startswith("Label:"):
            line = re.sub(r"Label:\s+", "", line)
            label, uuid_ = [tkn.strip() for tkn in line.split("uuid:")]
            ret['label'] = label != 'none' and label or None
            ret['uuid'] = uuid_
            continue

        if line.startswith("\tdevid"):
            dev_data = re.split(r"\s+", line.strip())
            dev_id = dev_data[-1]
            ret[dev_id] = {
                'device_id': dev_data[1],
                'size': dev_data[3],
                'used': dev_data[5],
                }

    return ret
63391
def parse(line):
    ""
    # See ftp://cdsarc.u-strasbg.fr/cats/I/239/ReadMe
    star = Star(
        ra=Angle(degrees=float(line[51:63])),
        dec=Angle(degrees=float(line[64:76])),
        ra_mas_per_year=float(line[87:95]),
        dec_mas_per_year=float(line[96:104]),
        parallax_mas=float(line[79:86]),
        names=[('HIP', int(line[8:14]))],
        )
    star._position_au += star._velocity_au_per_d * days
    distance, dec, ra = to_polar(star._position_au)
    star.ra = Angle(radians=ra, preference='hours')
    star.dec = Angle(radians=dec)
    return star
253293
def parse_def(self, text):
        """"""
        self.__init__()

        if not is_start_of_function(text):
            return

        self.func_indent = get_indent(text)

        text = text.strip()
        text = text.replace('\r\n', '')
        text = text.replace('\n', '')

        return_type_re = re.search(r'->[ ]*([a-zA-Z0-9_,()\[\] ]*):$', text)
        if return_type_re:
            self.return_type_annotated = return_type_re.group(1)
            text_end = text.rfind(return_type_re.group(0))
        else:
            self.return_type_annotated = None
            text_end = len(text)

        pos_args_start = text.find('(') + 1
        pos_args_end = text.rfind(')', pos_args_start, text_end)

        self.args_text = text[pos_args_start:pos_args_end]

        args_list = self.split_args_text_to_list(self.args_text)
        if args_list is not None:
            self.has_info = True
            self.split_arg_to_name_type_value(args_list)