#NEWLINE# def _f_list_parser( fl , ref_frame ) : #NEWLINE# #INDENT# 'Parses the provided forcelist composed of items\n    of the form (obj, force).\n    Returns a tuple containing:\n        vel_list: The velocity (ang_vel for Frames, vel for Points) in\n                the provided reference frame.\n        f_list: The forces.\n\n    Used internally in the KanesMethod and LagrangesMethod classes.\n    ' #NEWLINE# def flist_iter( ) : #NEWLINE# #INDENT# for pair in fl : #NEWLINE# #INDENT# ( obj , force ) = pair #NEWLINE# if isinstance ( obj , ReferenceFrame ) : #NEWLINE# #INDENT# ( yield ( obj . ang_vel_in ( ref_frame ) , force ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( obj , Point ) : #NEWLINE# #INDENT# ( yield ( obj . vel ( ref_frame ) , force ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise TypeError ( 'First entry in each forcelist pair must be a point or frame.' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( not fl ) : #NEWLINE# #INDENT# ( vel_list , f_list ) = ( ( ) , ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# unzip = ( lambda l : ( list ( zip ( * l ) ) if l [ 0 ] else [ ( ) , ( ) ] ) ) #NEWLINE# ( vel_list , f_list ) = unzip ( list ( flist_iter ( ) ) ) #NEWLINE# #UNINDENT# return ( vel_list , f_list )