pgn_read/core/game.py
def append_pawn_promote_move(self, match):
        """Delegate lower case move with upper case promotion to superclass."""
        mgl = match.group().lower()
        if mgl.startswith(FEN_BLACK_BISHOP):

            # So the test on self._piece_placement_data gives a helpful answer.
            # Cannot wait for 'super().append_pawn_move(pgn_match)'.
            if self._movetext_offset is None:
                if not self.set_initial_position():
                    self.append_token_and_set_error(match)
                    self._bishop_or_bpawn = None
                    return
                self._ravstack.append([0])
                self._movetext_offset = len(self._text)

        if PGN_CAPTURE_MOVE in mgl:
            if PGN_PROMOTION in mgl:
                promotion_match = text_promotion_format.match(mgl[0]+mgl[-5:])
            else:
                promotion_match = text_promotion_format.match(mgl[0]+mgl[-4:])
        elif LAN_MOVE_SEPARATOR in mgl:
            if PGN_PROMOTION in mgl:
                promotion_match = text_promotion_format.match(mgl[-4:])
            else:
                promotion_match = text_promotion_format.match(mgl[-3:])
        else:
            promotion_match = text_promotion_format.match(mgl)
        if promotion_match is None:
            self.append_token_and_set_error(match)
            self._bishop_or_bpawn = None
            return
        pmg = promotion_match.group()
        promotion_match = import_format.match(pmg[:-1]+pmg[-1].upper())
        if promotion_match is None:
            self.append_token_and_set_error(match)
            self._bishop_or_bpawn = None
            return
        super(GameTextPGN, self).append_pawn_promote_move(promotion_match)
        self._bishop_or_bpawn = None
Delegate lower case move with upper case promotion to superclass.
Delegate lower case move with upper case promotion to superclass.
Delegate lower case move with upper case promotion to superclass .
def append_pawn_promote_move(self, match):
        mgl = match.group().lower()
        if mgl.startswith(FEN_BLACK_BISHOP):
            if self._movetext_offset is None:
                if not self.set_initial_position():
                    self.append_token_and_set_error(match)
                    self._bishop_or_bpawn = None
                    return
                self._ravstack.append([0])
                self._movetext_offset = len(self._text)
        if PGN_CAPTURE_MOVE in mgl:
            if PGN_PROMOTION in mgl:
                promotion_match = text_promotion_format.match(mgl[0]+mgl[-5:])
            else:
                promotion_match = text_promotion_format.match(mgl[0]+mgl[-4:])
        elif LAN_MOVE_SEPARATOR in mgl:
            if PGN_PROMOTION in mgl:
                promotion_match = text_promotion_format.match(mgl[-4:])
            else:
                promotion_match = text_promotion_format.match(mgl[-3:])
        else:
            promotion_match = text_promotion_format.match(mgl)
        if promotion_match is None:
            self.append_token_and_set_error(match)
            self._bishop_or_bpawn = None
            return
        pmg = promotion_match.group()
        promotion_match = import_format.match(pmg[:-1]+pmg[-1].upper())
        if promotion_match is None:
            self.append_token_and_set_error(match)
            self._bishop_or_bpawn = None
            return
        super(GameTextPGN, self).append_pawn_promote_move(promotion_match)
        self._bishop_or_bpawn = None
def append_pawn_promote_move ( self , match ) : mgl = match . group ( ) . lower ( ) if mgl . startswith ( FEN_BLACK_BISHOP ) : if self . _movetext_offset is None : if not self . set_initial_position ( ) : self . append_token_and_set_error ( match ) self . _bishop_or_bpawn = None return self . _ravstack . append ( [ 0 ] ) self . _movetext_offset = len ( self . _text ) if PGN_CAPTURE_MOVE in mgl : if PGN_PROMOTION in mgl : promotion_match = text_promotion_format . match ( mgl [ 0 ] + mgl [ - 5 : ] ) else : promotion_match = text_promotion_format . match ( mgl [ 0 ] + mgl [ - 4 : ] ) elif LAN_MOVE_SEPARATOR in mgl : if PGN_PROMOTION in mgl : promotion_match = text_promotion_format . match ( mgl [ - 4 : ] ) else : promotion_match = text_promotion_format . match ( mgl [ - 3 : ] ) else : promotion_match = text_promotion_format . match ( mgl ) if promotion_match is None : self . append_token_and_set_error ( match ) self . _bishop_or_bpawn = None return pmg = promotion_match . group ( ) promotion_match = import_format . match ( pmg [ : - 1 ] + pmg [ - 1 ] . upper ( ) ) if promotion_match is None : self . append_token_and_set_error ( match ) self . _bishop_or_bpawn = None return super ( GameTextPGN , self ) . append_pawn_promote_move ( promotion_match ) self . _bishop_or_bpawn = None
Delegate lower case move with upper case promotion to superclass.
Delegate lower case move with upper case promotion to superclass .
"""Delegate lower case move with upper case promotion to superclass.""" # So the test on self._piece_placement_data gives a helpful answer. # Cannot wait for 'super().append_pawn_move(pgn_match)'.
self
match