Revision 45317e3a lib/rapi/baserlib.py

b/lib/rapi/baserlib.py
85 85
  return map(_MapId, ids)
86 86

  
87 87

  
88
def ExtractField(sequence, index):
89
  """Creates a list containing one column out of a list of lists.
90

  
91
  @param sequence: sequence of lists
92
  @param index: index of field
93

  
94
  """
95
  return map(lambda item: item[index], sequence)
96

  
97

  
98 88
def MapFields(names, data):
99 89
  """Maps two lists into one dictionary.
100 90

  
......
127 117
  return items_details
128 118

  
129 119

  
130
def MakeParamsDict(opts, params):
131
  """Makes params dictionary out of a option set.
132

  
133
  This function returns a dictionary needed for hv or be parameters. But only
134
  those fields which provided in the option set. Takes parameters frozensets
135
  from constants.
136

  
137
  @type opts: dict
138
  @param opts: selected options
139
  @type params: frozenset
140
  @param params: subset of options
141
  @rtype: dict
142
  @return: dictionary of options, filtered by given subset.
143

  
144
  """
145
  result = {}
146

  
147
  for p in params:
148
    try:
149
      value = opts[p]
150
    except KeyError:
151
      continue
152
    result[p] = value
153

  
154
  return result
155

  
156

  
157 120
def FillOpcode(opcls, body, static, rename=None):
158 121
  """Fills an opcode with body parameters.
159 122

  

Also available in: Unified diff