(cls, uci)
Parses an UCI string.

        :raises ValueError: If the UCI string is invalid.
Parses an UCI string.
Parses an UCI string .
def from_uci(cls, uci):
        """
        Parses an UCI string.

        :raises ValueError: If the UCI string is invalid.
        """
        if uci == "0000":
            return cls.null()
        elif len(uci) == 4:
            return cls(SQUARE_NAMES.index(uci[0:2]), SQUARE_NAMES.index(uci[2:4]))
        elif len(uci) == 5:
            promotion = PIECE_SYMBOLS.index(uci[4])
            return cls(SQUARE_NAMES.index(uci[0:2]), SQUARE_NAMES.index(uci[2:4]), promotion)
        else:
            raise ValueError("Expected UCI string to be of length 4 or 5.")
def from_uci ( cls , uci ) : if uci == "0000" : return cls . null ( ) elif len ( uci ) == 4 : return cls ( SQUARE_NAMES . index ( uci [ 0 : 2 ] ) , SQUARE_NAMES . index ( uci [ 2 : 4 ] ) ) elif len ( uci ) == 5 : promotion = PIECE_SYMBOLS . index ( uci [ 4 ] ) return cls ( SQUARE_NAMES . index ( uci [ 0 : 2 ] ) , SQUARE_NAMES . index ( uci [ 2 : 4 ] ) , promotion ) else : raise ValueError ( "Expected UCI string to be of length 4 or 5." )