freemyipod r579 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r578‎ | r579 | r580 >
Date:17:34, 9 February 2011
Author:farthen
Status:new
Tags:
Comment:
emcore tools: getfuncdoc(): fix default argument order being scrambled
Modified paths:
  • /emcore/trunk/tools/emcore.py (modified) (history)
  • /emcore/trunk/tools/misc.py (modified) (history)

Diff [purge]

Index: emcore/trunk/tools/emcore.py
@@ -59,7 +59,7 @@
6060 for arg in doc[function]['args']:
6161 logger.write("<" + arg + "> ")
6262 if doc[function]['kwargs']:
63 - for kwarg, kwvalue in doc[function]['kwargs'].iteritems():
 63+ for kwarg, kwvalue in doc[function]['kwargs']:
6464 logger.write("[" + kwarg + " = " + str(kwvalue) + "] ")
6565 if doc[function]['varargs']:
6666 logger.write("<db1> ... <dbN>")
Index: emcore/trunk/tools/misc.py
@@ -281,17 +281,18 @@
282282 function = funcdict[function].func
283283 docinfo = Bunch()
284284 name = function.__name__
285 - args = inspect.getargspec(function)[0]
 285+ argspec = inspect.getargspec(function)
 286+ args = argspec[0]
286287 docinfo['varargs'] = False
287 - if inspect.getargspec(function)[1]:
 288+ if argspec[1]:
288289 docinfo['varargs'] = True
289 - kwargvalues = inspect.getargspec(function)[3]
290 - kwargs = Bunch()
 290+ kwargvalues = argspec[3]
 291+ kwargs = []
291292 if args:
292293 if kwargvalues:
293294 argnum = len(args) - len(kwargvalues)
294295 kwargnum = len(kwargvalues)
295 - kwargs = dict(zip(args[argnum:], kwargvalues))
 296+ kwargs = list(zip(args[argnum:], kwargvalues))
296297 else:
297298 argnum = len(args)
298299 else: