#NEWLINE# def _calculate_inter_tree_move_values( self , node , target , position ) : #NEWLINE# #INDENT# '\n        Calculates values required when moving ``node`` relative to\n        ``target`` as specified by ``position``.\n        ' #NEWLINE# left = getattr ( node , self . left_attr ) #NEWLINE# level = getattr ( node , self . level_attr ) #NEWLINE# target_left = getattr ( target , self . left_attr ) #NEWLINE# target_right = getattr ( target , self . right_attr ) #NEWLINE# target_level = getattr ( target , position . level_attr ) #NEWLINE# if ( ( position == 'last-child' ) or ( position == 'first-child' ) ) : #NEWLINE# #INDENT# if ( position == 'last-child' ) : #NEWLINE# #INDENT# space_target = ( target_right - 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# space_target = target_left #NEWLINE# #UNINDENT# level_change = ( ( level - target_level ) - 1 ) #NEWLINE# parent = target #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( position == 'left' ) or ( position == 'right' ) ) : #NEWLINE# #INDENT# if ( position == 'left' ) : #NEWLINE# #INDENT# space_target = ( target_left - 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# space_target = target_right #NEWLINE# #UNINDENT# level_change = ( level - target_level ) #NEWLINE# parent = getattr ( target , self . parent_attr ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ( _ ( 'An invalid position was given: %s.' ) % position ) ) #NEWLINE# #UNINDENT# #UNINDENT# left_right_change = ( ( left - space_target ) - 1 ) #NEWLINE# return ( space_target , level_change , left_right_change , parent )