Zhou Zheng Sheng has posted comments on this change.

Change subject: add a new tool for auto-generate python entities from schema
......................................................................


Patch Set 5: (13 inline comments)

function "main" is too long.

....................................................
File src/codegen/genparams.py
Line 124:     cmd = " ".join([argv for argv in args])
Why not

cmd = " ".join(args)

args is already a list. If you want to copy the args, you can use "args[:]".

Line 159:     rule = '|'.join([rule1, rule2, attrrule])
Where is the definition of "attrrule"?

Line 284:         if getIndentsOfString(symbols[i]) <= indents:
Not quite understand the algorithm here, I think it would be ">=" here. Why 
"<="?

Line 343:             getIndentsOfString(fileLinesList[i]) <= indents):
Same as line 284.

Line 355:         preSpace += " "
preSpace = " " * indents

Line 366:     return "\n".join([val for val in fileList])
If filelist is already a list, why not

"\n".join(fileList)

Line 470:       #will support get the schema from the engine server
There is a tab before "#will"

Line 490:         f.close()
"f.close()" is not necessary here, because file object "f" will close 
automatically when "with" statement ends.

Line 504:                     (classname, lastAttr))
Firstly, it seems that it should be "(lastAttr, classname)".
Secondly, "lastAttr" is empty in this "if" statement, you might want to log the 
error as

"[ERROR] can not find the last attribute of class %s" % classname

Line 516:         logging.info("[INFO] add import module")
"[INFO] add function"

Line 538:         filelist[begidx:begidx] = vallist
There is no need to first "filelist[begidx:endidx+1] = []" then 
"filelist[begidx:begidx] = vallist". It could be:

filelist[begidx:endidx+1] = vallist

Line 539:         filelines = "\n".join([val for val in filelist])
Same as line 124

Line 571:         f.close()
"f" will close automatically when "with" ends.

--
To view, visit http://gerrit.ovirt.org/4880
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I916f63f1ac68ce2e31456a90c1291997f671af99
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine-sdk
Gerrit-Branch: master
Gerrit-Owner: ShaoHe Feng <shao...@linux.vnet.ibm.com>
Gerrit-Reviewer: Adam Litke <a...@us.ibm.com>
Gerrit-Reviewer: Mark Wu <wu...@linux.vnet.ibm.com>
Gerrit-Reviewer: Michael Pasternak <mpast...@redhat.com>
Gerrit-Reviewer: ShaoHe Feng <shao...@linux.vnet.ibm.com>
Gerrit-Reviewer: Shu Ming <shum...@linux.vnet.ibm.com>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshz...@linux.vnet.ibm.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to