#NEWLINE# def forward( self , amount = 1 ) : #NEWLINE# #INDENT# ' Attempt to move the cursor one position forward (or by\n        another amount if explicitly specified). The cursor will move\n        position by up to, but never more than, the amount specified.\n        If not enough scope for movement remains, only that remainder\n        will be consumed. The total amount moved is returned.\n\n        :param amount: the amount to move the cursor\n        :returns: the amount that the cursor was able to move\n        ' #NEWLINE# if ( amount == 0 ) : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# assert ( amount > 0 ) #NEWLINE# amount = int ( amount ) #NEWLINE# moved = 0 #NEWLINE# fetch = self . _source . fetch #NEWLINE# while ( moved != amount ) : #NEWLINE# #INDENT# new_current = fetch ( ) #NEWLINE# if ( new_current is None ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _current = new_current #NEWLINE# moved += 1 #NEWLINE# #UNINDENT# #UNINDENT# return moved