Override logic does not belong here. I would replace this entire if...else... with the following statement: result |= ( getValveState( i ) == 1 ? 0x0001 << i : 0 );
I believe it should be consistent throughout the code. It makes the review of it easier for everyone. Ultimately, this should be driven by the C++ coding standard.
def partition_orig(vString, vPart, vRightDirection = True):
if vRightDirection:
list = [vString[i - vPart : i] for i in range(len(vString), 0, -vPart)]
else:
list = [vString[i : i + vPart] for i in range(0, len(vString), vPart)]
return list
def partition_2(vString, vPart, vRightDirection = True):
if vRightDirection:
vString = vString[::-1]
return [vString[i : i + vPart][::-1] for i in range(0, len(vString), vPart)]
print(partition_orig("TESTING123", 3))
print(partition_2("TESTING123", 3))
def partition_2(vString, vPart, vRightDirection = True):
if vRightDirection:
vString = vString[::-1]
return [vString[i : i + vPart] for i in range(0, len(vString), vPart)]
outputs
['321', 'GNI', 'TSE', 'T']
I think you're saying you want to do the second one right? I think that would be better too!
Edit: Also I don't think you need the mString because in python immutable types (e.g. string, number, tuple) behave like call by value
There may be other conditions added later, but these are what I know so far. To accept a fill command, you have to be in recirculate mode and the requested fill to volume must be in valid range.