- Timestamp:
- 12/07/13 03:18:24 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
etherws/trunk/etherws.py
r265 r266 50 50 import hashlib 51 51 import getpass 52 import operator 52 53 import argparse 53 54 import traceback … … 188 189 self.shut = False 189 190 190 @staticmethod191 def cmp_by_number(x, y):192 return cmp(x.number, y.number)193 194 191 def __init__(self, fdb, debug): 195 192 self.fdb = fdb … … 200 197 @property 201 198 def portlist(self): 202 return sorted(self._table.itervalues(), cmp=self.Port.cmp_by_number) 199 return sorted(self._table.itervalues(), 200 key=operator.attrgetter('number')) 203 201 204 202 def get_port(self, portnum): … … 223 221 ports = (self._table[n] for n in portnums) 224 222 ports = (p for p in ports if not p.shut) 225 ports = sorted(ports, cmp=self.Port.cmp_by_number)223 ports = sorted(ports, key=operator.attrgetter('number')) 226 224 227 225 for p in ports:
Note: See TracChangeset
for help on using the changeset viewer.