#NEWLINE# def endpoints( self , requesting_shape_index = None ) : #NEWLINE# #INDENT# 'Return the xy, xy end points of this edge.\n\n        kwargs: requesting_shape_index - if the clockwise order of vertices is\n                    desired, provide this so the edge knows which way to sort\n        ' #NEWLINE# other_side_lookup = { #NEWLINE# #INDENT# self . _neighbor_1_index : self . _neighbor_2_index , #NEWLINE# self . _neighbor_2_index : self . _neighbor_1_index , #NEWLINE# #UNINDENT# } #NEWLINE# if requesting_shape_index : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# n_index = other_side_lookup [ requesting_shape_index ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# raise ValueError ( 'The requesting shape is not one of the sharing neighbors of this edge.' ) #NEWLINE# #UNINDENT# requesting_shape = self . _grid . get ( requesting_shape_index ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# requesting_shape = self . _grid . get ( self . _neighbor_1_index ) #NEWLINE# if ( not requesting_shape ) : #NEWLINE# #INDENT# requesting_shape = self . _grid . get ( self . _neighbor_2_index ) #NEWLINE# #UNINDENT# #UNINDENT# n_index = other_side_lookup [ requesting_shape . index ( ) ] #NEWLINE# ( v1 , v2 ) = ( requesting_shape . _edge_data [ n_index ] [ 'counter_vertex' ] , requesting_shape . _edge_data [ n_index ] [ 'clock_vertex' ] ) #NEWLINE# return ( v1 , v2 )