def __init__(self, bits, length=None):
        if isinstance(bits, numpy.ndarray):
            if bits.dtype == numpy.bool:
                if bits.flags.writeable:
                    # If it's writable, we need to make a copy
                    bits = bits.copy()

                    # Make sure our copy isn't writable
                    bits.writeable = False
            else:
                # Make a new bit array from the given values
                bits = numpy.array(bits, bool)

                # Make sure the bit array isn't writable
                bits.flags.writeable = False
            hash_value = None
        elif isinstance(bits, int):
            if length is None:
                length = bits.bit_length()
            else:
                assert bits.bit_length() >= length

            if bits < 0:
                bits &= (1 << length) - 1

            # Progressively chop off low-end bits from the int, adding them
            # to the bits list, until we have reached the given length (if
            # provided) or no more non-zero bits remain (if length was not
            # specified).
            bit_values = []
            for _ in range(length):
                bit_values.append(bits % 2)
                bits >>= 1

            # Reverse the order of the bits, so the high-order bits go on
            # the left and the low- order bits go on the right, just as a
            # person would expect when looking at the number written out in
            # binary.
            bit_values.reverse()
            bits = numpy.array(bit_values, bool)

            # Make sure the bit array isn't writable
            bits.flags.writeable = False

            hash_value = None
        elif isinstance(bits, BitString):
            # No need to make a copy because we use immutable bit arrays
            # We can just grab a reference to the same bit array the other
            # bitstring is using
            bits, hash_value = bits._bits, bits._hash
        elif isinstance(bits, str):
            bit_list = []
            for char in bits:
                if char == '1':
                    bit_list.append(True)
                elif char == '0':
                    bit_list.append(False)
                elif char == '#':
                    raise ValueError(
                        "BitStrings cannot contain wildcards. Did you "
                        "mean to create a BitCondition?"
                    )
                else:
                    raise ValueError("Invalid character: " + repr(char))
            bits = numpy.array(bit_list, bool)
            bits.flags.writeable = False
            hash_value = None
        else:
            # Make a new bit array from the given values
            bits = numpy.array(bits, bool)

            # Make sure the bit array isn't writable
            bits.flags.writeable = False

            hash_value = None

        if length is not None and len(bits) != length:
            raise ValueError("Sequence has incorrect length.")

        super().__init__(bits, hash_value)
dataset/ETHPy150Open hosford42/xcs/xcs/_numpy_bitstrings.py/BitString.__init__/swapped operands of `>=`