Parse the volgroup line
332981
def parse_volgroup(rule):
    '''
    
    '''
    parser = argparse.ArgumentParser()
    rules = shlex.split(rule)
    rules.pop(0)

    partitions = []
    newrules = []
    for count in range(0, len(rules)):
        if count == 0:
            newrules.append(rules[count])
            continue
        elif rules[count].startswith('--'):
            newrules.append(rules[count])
            continue
        else:
            partitions.append(rules[count])
    rules = newrules

    parser.add_argument('name')
    parser.add_argument('--noformat', dest='noformat', action='store_true')
    parser.add_argument('--useexisting', dest='useexisting',
                        action='store_true')
    parser.add_argument('--pesize', dest='pesize', action='store')
    parser.add_argument('--reserved-space', dest='reserved-space',
                        action='store')
    parser.add_argument('--reserved-percent', dest='reserved-percent',
                        action='store')

    args = clean_args(vars(parser.parse_args(rules)))
    if partitions:
        args['partitions'] = partitions
    parser = None
    return args
718367
def parse_tree_line(line)
      mode, _type, sha, size, *name = line.split(/\s+/)
      BlobEntry.new(sha, name.join(' '), size.to_i, mode.to_i(8))
    end
609553
function parseItemOrGroup(tokenizer) {
  var tkn = tokenizer.next();
  if (!tkn) return null;
  if (tkn.typ == '{') {
    return parseGroup(tokenizer);
  }
  return {tag: tkn.typ, children: tkn.txt};
}
39754
def parse_line(self, line: str):
        
        for i in KEYPAIR_RE.finditer(line):
            key = i.group(1)
            value = urllib.parse.unquote(i.group(2))
            self[key] = value
614316
def parselinenos(spec, nlines=None):
    

    items = {}
    parts = spec.split(',')

    for part in parts:
        line_class = LINECLASS_RE.match(part)
        start = int(line_class.group('start'))

        if line_class.group('range'):
            if line_class.group('end'):
                end = int(line_class.group('end'))
            else:
                end = nlines

            for line_no in range(start, end + 1):
                items[line_no] = line_class.group('class')

        else:
            items[start] = line_class.group('class')

    return items
574147
def parse_groups(self, group, params):
        
        # When resuming upon throttling error, skip if already fetched
        if group['GroupName'] in self.groups:
            return
        api_client = params['api_client']
        # Ensure consistent attribute names across resource types
        group['id'] = group.pop('GroupId')
        group['name'] = group.pop('GroupName')
        group['arn'] = group.pop('Arn')
        # Get group's members
        group['users'] = self.__fetch_group_users(api_client, group['name']);
        # Get inline policies
        policies = self.__get_inline_policies(api_client, 'group', group['id'], group['name'])
        if len(policies):
            group['inline_policies'] = policies
        group['inline_policies_count'] = len(policies)
        self.groups[group['id']] = group
462172
def _Parse(self):
    """"""
    vslvm_logical_volume = self._file_entry.GetLVMLogicalVolume()

    volume_attribute = volume_system.VolumeAttribute(
        'identifier', vslvm_logical_volume.identifier)
    self._AddAttribute(volume_attribute)

    # TODO: implement in pyvslvm
    # TODO: add support for creation time
    # TODO: add support for logical volume extents
    volume_extent = volume_system.VolumeExtent(0, vslvm_logical_volume.size)
    self._extents.append(volume_extent)
1176683
def msvs_parse_version(s):
    
    num, suite = version_re.match(s).groups()
    return float(num), suite
1063558
def parse(self, file_handle):
        '''
        
        '''
        # open the VCD file and create a token generator
        lineIterator = iter(enumerate(file_handle))
        tokeniser = ((lineNo, word) for lineNo, line in lineIterator
                     for word in line.split() if word)

        while True:
            token = next(tokeniser)
            # parse VCD until the end of definitions
            self.keyword_dispatch[token[1]](tokeniser, token[1])
            if self.end_of_definitions:
                break

        while True:
            try:
                lineNo, token = next(lineIterator)
            except StopIteration:
                break

            # parse changes
            c = token[0]
            if c == '$':
                # skip $dump* tokens and $end tokens in sim section
                continue
            elif c == '#':
                # [TODO] may be a float
                self.now = int(token[1:])
            else:
                sp = token.split()
                sp_len = len(sp)
                if sp_len == 1:
                    # 1 bit value
                    value = c
                    vcdId = token[1:]
                elif sp_len == 2:
                    # vectors and strings
                    value, vcdId = sp
                else:
                    raise VcdSyntaxError(
                        "Line %d: Don't understand: %s " % (lineNo, token))

                self.value_change(vcdId.strip(), value.strip())
809351
public static MatchGroup parseString(String raw)
  {
    MatchGroup saltIDs = new MatchGroup();
    for (String group : lineSplitter.split(raw))
    {
      saltIDs.matches.add(Match.parseFromString(group));
    }
    
    return saltIDs;
  }
478280
function parseGroup(tokenizer) {
  // Group this functon will return.
  var mrow = {tag: 'mrow', children: []};
  // Last child of mrow.
  var lastItem;
  // Current token.
  var tkn;
  // Current tag.
  var tag;
  // Macro. This is a function with this prototype: (tokenizer, mrow).
  var macro;

  for(;;) {
    tkn = tokenizer.next();
    // End of stream.
    if (!tkn) break;
    // End of block.
    if (tkn.typ == '}') break;
    // Deal with msup.
    if (tkn.typ == '^') {
      if (mrow.children.length == 0) {
        mrow.children.push({tag: 'mrow', children: []});
      }
      lastItem = mrow.children[mrow.children.length - 1];
      if (lastItem.msup) {
        tokenizer.fatal("Double superscript.", tkn.idx);
      }
      lastItem.msup = parseItemOrGroup(tokenizer);
    }
    else if (tkn.typ == '_') {
      if (mrow.children.length == 0) {
        mrow.children.push({tag: 'mrow', children: []});
      }
      lastItem = mrow.children[mrow.children.length - 1];
      if (lastItem.msub) {
        tokenizer.fatal("Double subscript.", tkn.idx);
      }
      lastItem.msub = parseItemOrGroup(tokenizer);
    }
    // Prime, double, triple or quadruple prime.
    else if (tkn.typ == 'prime') {
      lastItem = mrow.children[mrow.children.length - 1];
      if (lastItem.msup) {
        tokenizer.fatal("Double superscript because of a prime.", tkn.idx);
      }
      lastItem.msup = {tag: 'mo', children: tkn.txt};
    }
    // Beginning of a new group.
    else if (tkn.typ == '{') {
      mrow.children.push( parseGroup(tokenizer) );
    }
    // Add this leaf in the tree.
    else {
      tag = tokenToTag(tkn);
      if (typeof tag === 'function') {
        // This is a macro.
        macro = tag;
        tag = macro(tokenizer, mrow, tkn.idx);
        if (tag) {
          mrow.children.push(tag);
        }
      } else {
        mrow.children.push(tag);
      }
    }
  }
  return mrow;
}
549835
def group_lines(lines):
    """"""
    groups = []
    group = []

    for line in lines:
        if line.strip() == "":
            groups.append(group[:])
            group = []
            continue
        group.append(line)

    if group:
        groups.append(group[:])

    return groups
849840
def get_group_key_line(self, data, key):
        
        idx = -1
        for i, line in enumerate(data.splitlines()):
            if isin_start(self.groups[key], line):
                idx = i
        return idx
1048163
private String parseParse(VTDNav vn) throws NavException,
            PilotException {
        require (vn.matchElement(AgigaConstants.SENTENCE));

        // Move to the <parse> tag
        require (vn.toElement(VTDNav.FC, AgigaConstants.PARSE));
        String parseText = vn.toString(vn.getText());
        
        return parseText;
    }
568523
def parse(self, line):
        """"""
        tokens = []

        self.idx = -1   # Bogus value to ensure idx = 0 after first iteration
        self.characters = iter(line)
        self.update_chars()

        while self.char != '\n':
            # Update namelist group status
            if self.char in ('&', '$'):
                self.group_token = self.char

            if self.group_token and (
                    (self.group_token, self.char) in (('&', '/'), ('$', '$'))):
                self.group_token = False

            word = ''
            if self.char in self.whitespace:
                while self.char in self.whitespace:
                    word += self.char
                    self.update_chars()

            elif self.char in ('!', '#') or self.group_token is None:
                # Abort the iteration and build the comment token
                word = line[self.idx:-1]
                self.char = '\n'

            elif self.char in '"\'' or self.prior_delim:
                word = self.parse_string()

            elif self.char.isalpha():
                word = self.parse_name(line)

            elif self.char in ('+', '-'):
                # Lookahead to check for IEEE value
                self.characters, lookahead = itertools.tee(self.characters)
                ieee_val = ''.join(itertools.takewhile(str.isalpha, lookahead))
                if ieee_val.lower() in ('inf', 'infinity', 'nan'):
                    word = self.char + ieee_val
                    self.characters = lookahead
                    self.prior_char = ieee_val[-1]
                    self.char = next(lookahead, '\n')
                else:
                    word = self.parse_numeric()

            elif self.char.isdigit():
                word = self.parse_numeric()

            elif self.char == '.':
                self.update_chars()
                if self.char.isdigit():
                    frac = self.parse_numeric()
                    word = '.' + frac
                else:
                    word = '.'
                    while self.char.isalpha():
                        word += self.char
                        self.update_chars()
                    if self.char == '.':
                        word += self.char
                        self.update_chars()

            elif self.char in Tokenizer.punctuation:
                word = self.char
                self.update_chars()

            else:
                # This should never happen
                raise ValueError

            tokens.append(word)

        return tokens
295914
def _parse_docline(self, line, container):
        """"""
        match = self.RE_DECOR.match(line)
        if match is not None:
            return "{}.{}".format(container.name, match.group("name"))
        else:
            return container.name
301196
def _parse_progenitor_dim(self,d1,ts,ro=None,vo=None,obs=None,
                              phys=False):
        """"""
        if d1.lower() == 'x':
            tx= self._progenitor.x(ts,ro=ro,vo=vo,obs=obs,use_physical=False)
        elif d1.lower() == 'y':
            tx= self._progenitor.y(ts,ro=ro,vo=vo,obs=obs,use_physical=False)
        elif d1.lower() == 'z':
            tx= self._progenitor.z(ts,ro=ro,vo=vo,obs=obs,use_physical=False)
        elif d1.lower() == 'r':
            tx= self._progenitor.R(ts,ro=ro,vo=vo,obs=obs,use_physical=False)
        elif d1.lower() == 'phi':
            tx= self._progenitor.phi(ts,ro=ro,vo=vo,obs=obs)
        elif d1.lower() == 'vx': 
            tx= self._progenitor.vx(ts,ro=ro,vo=vo,obs=obs,use_physical=False)
        elif d1.lower() == 'vy':
            tx= self._progenitor.vy(ts,ro=ro,vo=vo,obs=obs,use_physical=False)
        elif d1.lower() == 'vz':
            tx= self._progenitor.vz(ts,ro=ro,vo=vo,obs=obs,use_physical=False)
        elif d1.lower() == 'vr':
            tx= self._progenitor.vR(ts,ro=ro,vo=vo,obs=obs,use_physical=False)
        elif d1.lower() == 'vt':
            tx= self._progenitor.vT(ts,ro=ro,vo=vo,obs=obs,use_physical=False)
        elif d1.lower() == 'll':
            tx= self._progenitor.ll(ts,ro=ro,vo=vo,obs=obs)
        elif d1.lower() == 'bb':
            tx= self._progenitor.bb(ts,ro=ro,vo=vo,obs=obs)
        elif d1.lower() == 'dist':
            tx= self._progenitor.dist(ts,ro=ro,vo=vo,obs=obs)
        elif d1.lower() == 'pmll':
            tx= self._progenitor.pmll(ts,ro=ro,vo=vo,obs=obs)
        elif d1.lower() == 'pmbb':
            tx= self._progenitor.pmbb(ts,ro=ro,vo=vo,obs=obs)
        elif d1.lower() == 'vlos':
            tx= self._progenitor.vlos(ts,ro=ro,vo=vo,obs=obs)
        if phys and (d1.lower() == 'x' or d1.lower() == 'y' \
                         or d1.lower() == 'z' or d1.lower() == 'r'):
            tx= copy.copy(tx)
            tx*= self._ro
        if phys and (d1.lower() == 'vx' or d1.lower() == 'vy' \
                         or d1.lower() == 'vz' or d1.lower() == 'vr' \
                         or d1.lower() == 'vt'):
            tx= copy.copy(tx)
            tx*= self._vo
        return tx