@@ -251,12 +251,12 @@ def hpilo_help(option, opt_str, value, parser, exitcode=0):
251251 else :
252252 if value in ilo_methods :
253253 import re , textwrap
254- func = getattr (hpilo .Ilo , value ).im_func
255- code = func .func_code
254+ func = getattr (hpilo .Ilo , value ) if PY3 else getattr ( hpilo . Ilo , value ) .im_func
255+ code = func .__code__ if PY3 else func . func_code
256256 args = ''
257257 if code .co_argcount > 1 :
258258 args = code .co_varnames [:code .co_argcount ]
259- defaults = func .func_defaults or []
259+ defaults = func .__defaults__ if PY3 else func . func_defaults or []
260260 args = ["%s=%s" % (x , x .upper ()) for x in args [:len (args )- len (defaults )]] + \
261261 ["[%s=%s]" % (x ,str (y )) for x , y in zip (args [len (args )- len (defaults ):], defaults ) if x != 'progress' ]
262262 args = ' ' + ' ' .join (args [1 :])
@@ -266,7 +266,7 @@ def hpilo_help(option, opt_str, value, parser, exitcode=0):
266266 doc = re .sub (r':[a-z]+:`(.*?)`' , r'\1' , doc )
267267 if 'API note' in doc :
268268 doc = doc [:doc .find ('API note' )].strip ()
269- doc = re .sub ('\s+' , ' ' , doc )
269+ doc = re .sub (r '\s+' , ' ' , doc )
270270 print (textwrap .fill (doc , 80 ))
271271 else :
272272 print ("No such method: %s" % value )
0 commit comments