Revision eb62069e

b/lib/build/sphinx_ext.py
44 44
import ganeti.rapi.rlib2 # pylint: disable-msg=W0611
45 45

  
46 46

  
47
COMMON_PARAM_NAMES = map(operator.itemgetter(0), opcodes.OpCode.OP_PARAMS)
47
COMMON_PARAM_NAMES = map(compat.fst, opcodes.OpCode.OP_PARAMS)
48 48

  
49 49
#: Namespace for evaluating expressions
50 50
EVAL_NS = dict(compat=compat, constants=constants, utils=utils, errors=errors,
......
98 98
  params_with_alias = \
99 99
    utils.NiceSort([(alias.get(name, name), name, default, test, doc)
100 100
                    for (name, default, test, doc) in op_cls.GetAllParams()],
101
                   key=operator.itemgetter(0))
101
                   key=compat.fst)
102 102

  
103 103
  for (rapi_name, name, default, test, doc) in params_with_alias:
104 104
    # Hide common parameters if not explicitely included
......
227 227

  
228 228
  """
229 229
  for (_, (fdef, _, _, _)) in utils.NiceSort(fields.items(),
230
                                             key=operator.itemgetter(0)):
230
                                             key=compat.fst):
231 231
    assert len(fdef.doc.splitlines()) == 1
232 232
    yield "``%s``" % fdef.name
233 233
    yield "  %s" % fdef.doc
b/lib/compat.py
1 1
#
2 2
#
3 3

  
4
# Copyright (C) 2010 Google Inc.
4
# Copyright (C) 2010, 2011 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
24 24
"""
25 25

  
26 26
import itertools
27
import operator
27 28

  
28 29
try:
29 30
  # pylint: disable-msg=F0401
......
143 144
  else:
144 145
    return val
145 146

  
147
#: returns the first element of a list-like value
148
fst = operator.itemgetter(0)
149

  
150
#: returns the second element of a list-like value
151
snd = operator.itemgetter(1)
b/lib/locking.py
1 1
#
2 2
#
3 3

  
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc.
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
1729 1729
                      key=_MonitorSortKey)
1730 1730

  
1731 1731
    # Extract lock information and build query data
1732
    return (qobj, query.LockQueryData(map(operator.itemgetter(0), lockinfo)))
1732
    return (qobj, query.LockQueryData(map(compat.fst, lockinfo)))
1733 1733

  
1734 1734
  def QueryLocks(self, fields):
1735 1735
    """Queries information from all locks.
b/lib/opcodes.py
37 37
import re
38 38
import operator
39 39

  
40
from ganeti import compat
40 41
from ganeti import constants
41 42
from ganeti import errors
42 43
from ganeti import ht
......
135 136
#: Utility function for L{OpClusterSetParams}
136 137
_TestClusterOsList = ht.TOr(ht.TNone,
137 138
  ht.TListOf(ht.TAnd(ht.TList, ht.TIsLength(2),
138
    ht.TMap(ht.WithDesc("GetFirstItem")(operator.itemgetter(0)),
139
    ht.TMap(ht.WithDesc("GetFirstItem")(compat.fst),
139 140
            ht.TElemOf(constants.DDMS_VALUES)))))
140 141

  
141 142

  
b/lib/query.py
2018 2018
     None, 0, _ConvWrap(sorted, _GetItemAttr("api_versions"))),
2019 2019
    (_MakeField("parameters", "Parameters", QFT_OTHER,
2020 2020
                "Operating system parameters"),
2021
     None, 0, _ConvWrap(compat.partial(utils.NiceSort,
2022
                                       key=operator.itemgetter(0)),
2021
     None, 0, _ConvWrap(compat.partial(utils.NiceSort, key=compat.fst),
2023 2022
                        _GetItemAttr("parameters"))),
2024 2023
    (_MakeField("node_status", "NodeStatus", QFT_OTHER,
2025 2024
                "Status from node"),

Also available in: Unified diff