#NEWLINE# def calculate_priority( self , view , given ) : #NEWLINE# #INDENT# 'Returns a priority based on @view and @given.\n\n        If @view is a view and is the active view, @given is bumped. The same\n        happens if @view is a path and is the path to the current view.\n\n        @view\n          Can be a view or a path.\n\n        @given\n          The given `TaskPriority`.\n        ' #NEWLINE# if ( ( not view ) or ( given == TaskPriority . HIGHEST ) ) : #NEWLINE# #INDENT# return self #NEWLINE# #UNINDENT# if self . is_active ( view ) : #NEWLINE# #INDENT# return max ( ( given - 50 ) , TaskPriority . HIGHEST )