I'm not sure if understood the question correctly! 1 - if the value is 0 it will be converted always successfully to on of the types : Int, UInt, Float. 2 - There is bool ok which will be set if the value cannot be converted. 3 - if conversion is not successful, an empty QBytearray will return (shows the error happened in conversion because even a value of zero has a bytearray len of 1) which will be tested against another criteria for required length for a message. 4 - because the type has been checked first there should never happen any error according to documents. I hope the explanation helped
Add function header with inputs, outputs, and params
Also, is this a set function? If so, please call it setPressureOcclusionData otherwise its current name makes the reviewer guess what this function does.
We should use the build server combined with the build flags to build whatever is needed. Is the diversity of the various builds that great? My understanding is P-BB (v0.3, same as evel kit), P-BETA (v0.4), P-DVT (v0.7), and P-RELEASE (v1.0).
This functions shall be updated because there are more details to the various DG states and related modes of operation (not as simple as fill and drain).
Hey Peter, Thanks for the comments and all the testing . This function doesn't mean to be used the way you tested it. But anyway I came up with a better solution.
def partition(vString, vPart, vRightDirection=True):
return [vString[i: i + vPart] for i in range(0, len(vString), vPart)][::-1 if vRightDirection else 1]
Actually my first thought was not correct on how this portion of the code should work.
We are following Qt coding standard for most of our codes. https://wiki.qt.io/Qt_Coding_Style If our coding style documentation needs to be updated let me know.
the test names follow the pattern below : tst_<function name>_<test case> if is a unit test for a specific function. and function names start with non capital cases.
def partition(vString, vPart, vRightDirection = True):
if vRightDirection:
vString = vString[::-1]
return [vString[i : i + vPart][::-1] for i in range(0, len(vString), vPart)]
What is so special about this line that it needs this comment? And, what guarantees that there are not going be other lines in the future that also need to be found? I suggest finding a better method than adding comments in the code.
def partition1(vString, vPart, vRightDirection=True): mString = vString if vRightDirection: mString = vString[::-1] else: mString = vString list = [mString[i: i + vPart] for i in range(0, len(mString), vPart)] return list
if _name_ == "_main_": vString = "TESTING" vPart = 3
list = partition1(vString, vPart, True) print(list)
list = partition1(vString, vPart, False) print(list)
Thank you so much Peter. This is exactly the kind of code review I really like. I looked at the code you sent and tried to test it. At a first glance I saw a misbehavior.
your code is partition2. list = partition2("TESTING", 2, False) print(list)
list = partition("TESTING", 2, False) print(list) // — The output is different : ['ET', 'TS', 'NI', 'G'] partition2 ['TE', 'ST', 'IN', 'G'] partition
Looking at our coding standard, cases within a switch are always indented. Looked also at latest and greatest coding standards online. Please indent all cases across the entire code base. This will make them not only consistent with our C++ coding standard, but also more legible and compliant with the latest and greatest trends on C++ programming community.