def __init__(self, rawByte = None, labelPrefix = "bit", labelList = None, zeroLabel = "0", oneLabel = "1"):
        """
        Name: BitField.__init__(rawByte = None, labelPrefix = "bit", 
                                labelList = None, zeroLabel = "0",
                                oneLabel = "1")
        Args: rawByte, a value to set the bit field values to.
              labelPrefix, what should go before the labels in labelList
              labelList, a list of labels to apply to each bit. If None, it
                            gets set to range(7,-1,-1).
              zeroLabel, bits with a value of 0 will have this label
              oneLabel, bits with a value of 1 will have this label
        Desc: Creates a new bitfield and sets up the labels.
        
        With out any arguments, you get a bit field that looks like this:
        >>> bf = BitField()
        >>> print bf
        [ bit7 = 0, bit6 = 0, bit5 = 0, bit4 = 0, bit3 = 0, bit2 = 0, bit1 = 0,
        bit0 = 0 ]
        
        To make the labels, it iterates over all the labelList and adds the 
        labelPrefix to them. If you have less than 8 labels, then your bit field
        will only work up to that many bits.
        
        To make a BitField with labels for FIO0-7 you can do the following:
        >>> bf = BitField(labelPrefix = "FIO")
        >>> print bf
        [ FIO7 = 0, FIO6 = 0, FIO5 = 0, FIO4 = 0, FIO3 = 0, FIO2 = 0, FIO1 = 0,
          FIO0 = 0 ]
        
        
        The labels don't have to be numbers, for example:
        >>> names = [ "Goodreau", "Jerri", "Selena", "Allan", "Tania",
                      "Kathrine", "Jessie", "Zelma" ]
        >>> bf = BitField( labelPrefix = "", labelList = names)
        >>> print bf
        [ Goodreau = 0, Jerri = 0, Selena = 0, Allan = 0, Tania = 0,
          Kathrine = 0, Jessie = 0, Zelma = 0 ]
          
        You can change the display value of zero and one to be whatever you 
        want. For example, if you have a BitField that represents FIO0-7 
        directions:
        >>> dirs = BitField(rawByte = 5, labelPrefix = "FIO", 
                              zeroLabel = "Output", oneLabel = "Input")
        >>> print dirs
        [ FIO7 = Output, FIO6 = Output, FIO5 = Output, FIO4 = Output, 
          FIO3 = Output, FIO2 = Input, FIO1 = Output, FIO0 = Input ]
        
        Note, that when you access the value, you will get 1 or 0, not "Input"
        or "Output. For example:
        >>> print dirs.FIO3
        0
        """
        # Do labels first, so that self.something = something works.
        self.__dict__['labels'] = []
        
        self.labelPrefix = labelPrefix
        
        if labelList is None:
            self.labelList = list(range(8))
        else:
            self.labelList = list(reversed(labelList))
        
        self.zeroLabel = zeroLabel
        self.oneLabel = oneLabel
        
        self.rawValue = 0
        self.rawBits = [ 0 ] * 8
        self.data = [ self.zeroLabel ] * 8
        
        items = min(8, len(self.labelList))
        for i in reversed(list(range(items))):
            self.labels.append((self.labelPrefix, self.labelList[i]) % "%s%s")
        
        if rawByte is not None:
            self.fromByte(rawByte)
dataset/ETHPy150Open LabPy/lantz/lantz/drivers/labjack/_internal/u12.py/BitField.__init__/swapped operands of `%`