#NEWLINE# @ staticmethod #NEWLINE# def calc_nesting( subrs ) : #NEWLINE# #INDENT# "Update each entry of subrs with their call depth. This\n        is stored in the '_max_call_depth' attribute of the subr" #NEWLINE# def increment_subr_depth( subr , depth ) : #NEWLINE# #INDENT# if ( ( not hasattr ( subr , '_max_call_depth' ) ) or ( subr . _max_call_depth < depth ) ) : #NEWLINE# #INDENT# subr . _max_call_depth = depth #NEWLINE# #UNINDENT# callees = deque ( [ it [ 1 ] for it in subr . _encoding ] ) #NEWLINE# while len ( callees ) : #NEWLINE# #INDENT# next_subr = callees . pop ( ) #NEWLINE# if next_subr . _flatten : #NEWLINE# #INDENT# callees . extend ( [ it [ 1 ] for it in next_subr . _encoding ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( not hasattr ( next_subr , '_max_call_depth' ) ) or ( next_subr . _max_call_depth < ( depth + 1 ) ) ) : #NEWLINE# #INDENT# increment_subr_depth ( next_subr , ( depth + 1 ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# for subr in subrs : #NEWLINE# #INDENT# if ( not hasattr ( subr , '_max_call_depth' ) ) : #NEWLINE# #INDENT# increment_subr_depth ( subr , 1 )