nodes: 0, module; 1, function_definition; 2, function_name:__update_display_items_model; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, typed_parameter; 8, typed_parameter; 9, typed_parameter; 10, None; 11, expression_statement; 12, with_statement; 13, identifier:display_items_model; 14, type; 15, identifier:data_group; 16, type; 17, identifier:filter_id; 18, type; 19, comment:"""Update the data item model with a new container, filter, and sorting.
  
          This is called when the data item model is created or when the user changes
          the data group or sorting settings.
          """; 20, with_clause; 21, comment:# change filter and sort together; 22, block; 23, attribute; 24, subscript; 25, subscript; 26, with_item; 27, if_statement; 28, identifier:ListModel; 29, identifier:FilteredListModel; 30, attribute; 31, attribute; 32, attribute; 33, identifier:str; 34, call; 35, comparison_operator:data_group is not None; 36, block; 37, elif_clause; 38, elif_clause; 39, elif_clause; 40, else_clause; 41, identifier:typing; 42, identifier:Optional; 43, identifier:DataGroup; 44, identifier:DataGroup; 45, identifier:typing; 46, identifier:Optional; 47, attribute; 48, argument_list; 49, identifier:data_group; 50, None; 51, expression_statement; 52, expression_statement; 53, expression_statement; 54, expression_statement; 55, comparison_operator:filter_id == "latest-session"; 56, block; 57, comparison_operator:filter_id == "temporary"; 58, block; 59, comparison_operator:filter_id == "none"; 60, comment:# not intended to be used directly; 61, block; 62, comment:# "all"; 63, block; 64, identifier:display_items_model; 65, identifier:changes; 66, assignment; 67, assignment; 68, assignment; 69, assignment; 70, identifier:filter_id; 71, string:"latest-session"; 72, expression_statement; 73, expression_statement; 74, expression_statement; 75, expression_statement; 76, expression_statement; 77, identifier:filter_id; 78, string:"temporary"; 79, expression_statement; 80, expression_statement; 81, expression_statement; 82, expression_statement; 83, expression_statement; 84, identifier:filter_id; 85, string:"none"; 86, expression_statement; 87, expression_statement; 88, expression_statement; 89, expression_statement; 90, expression_statement; 91, expression_statement; 92, expression_statement; 93, expression_statement; 94, expression_statement; 95, expression_statement; 96, attribute; 97, identifier:data_group; 98, attribute; 99, call; 100, attribute; 101, None; 102, attribute; 103, None; 104, assignment; 105, assignment; 106, assignment; 107, assignment; 108, assignment; 109, assignment; 110, assignment; 111, assignment; 112, assignment; 113, assignment; 114, assignment; 115, assignment; 116, assignment; 117, assignment; 118, assignment; 119, assignment; 120, assignment; 121, assignment; 122, assignment; 123, assignment; 124, identifier:display_items_model; 125, identifier:container; 126, identifier:display_items_model; 127, identifier:filter; 128, attribute; 129, argument_list; 130, identifier:display_items_model; 131, identifier:sort_key; 132, identifier:display_items_model; 133, identifier:filter_id; 134, attribute; 135, attribute; 136, attribute; 137, call; 138, attribute; 139, attribute; 140, attribute; 141, True; 142, attribute; 143, identifier:filter_id; 144, attribute; 145, attribute; 146, attribute; 147, call; 148, attribute; 149, attribute; 150, attribute; 151, True; 152, attribute; 153, identifier:filter_id; 154, attribute; 155, attribute; 156, attribute; 157, call; 158, attribute; 159, attribute; 160, attribute; 161, True; 162, attribute; 163, identifier:filter_id; 164, attribute; 165, attribute; 166, attribute; 167, call; 168, attribute; 169, attribute; 170, attribute; 171, True; 172, attribute; 173, None; 174, identifier:ListModel; 175, identifier:Filter; 176, True; 177, identifier:display_items_model; 178, identifier:container; 179, identifier:self; 180, identifier:document_model; 181, identifier:display_items_model; 182, identifier:filter; 183, attribute; 184, argument_list; 185, identifier:display_items_model; 186, identifier:sort_key; 187, identifier:DataItem; 188, identifier:sort_by_date_key; 189, identifier:display_items_model; 190, identifier:sort_reverse; 191, identifier:display_items_model; 192, identifier:filter_id; 193, identifier:display_items_model; 194, identifier:container; 195, identifier:self; 196, identifier:document_model; 197, identifier:display_items_model; 198, identifier:filter; 199, attribute; 200, argument_list; 201, identifier:display_items_model; 202, identifier:sort_key; 203, identifier:DataItem; 204, identifier:sort_by_date_key; 205, identifier:display_items_model; 206, identifier:sort_reverse; 207, identifier:display_items_model; 208, identifier:filter_id; 209, identifier:display_items_model; 210, identifier:container; 211, identifier:self; 212, identifier:document_model; 213, identifier:display_items_model; 214, identifier:filter; 215, attribute; 216, argument_list; 217, identifier:display_items_model; 218, identifier:sort_key; 219, identifier:DataItem; 220, identifier:sort_by_date_key; 221, identifier:display_items_model; 222, identifier:sort_reverse; 223, identifier:display_items_model; 224, identifier:filter_id; 225, identifier:display_items_model; 226, identifier:container; 227, identifier:self; 228, identifier:document_model; 229, identifier:display_items_model; 230, identifier:filter; 231, attribute; 232, argument_list; 233, identifier:display_items_model; 234, identifier:sort_key; 235, identifier:DataItem; 236, identifier:sort_by_date_key; 237, identifier:display_items_model; 238, identifier:sort_reverse; 239, identifier:display_items_model; 240, identifier:filter_id; 241, identifier:ListModel; 242, identifier:EqFilter; 243, string:"session_id"; 244, attribute; 245, identifier:ListModel; 246, identifier:NotEqFilter; 247, string:"category"; 248, string:"persistent"; 249, identifier:ListModel; 250, identifier:Filter; 251, False; 252, identifier:ListModel; 253, identifier:EqFilter; 254, string:"category"; 255, string:"persistent"; 256, attribute; 257, identifier:session_id; 258, identifier:self; 259, identifier:document_model
code: def __update_display_items_model(self, display_items_model: ListModel.FilteredListModel, data_group: typing.Optional[DataGroup.DataGroup], filter_id: typing.Optional[str]) -> None:
          """Update the data item model with a new container, filter, and sorting.
  
          This is called when the data item model is created or when the user changes
          the data group or sorting settings.
          """
  
          with display_items_model.changes():  # change filter and sort together
              if data_group is not None:
                  display_items_model.container = data_group
                  display_items_model.filter = ListModel.Filter(True)
                  display_items_model.sort_key = None
                  display_items_model.filter_id = None
              elif filter_id == "latest-session":
                  display_items_model.container = self.document_model
                  display_items_model.filter = ListModel.EqFilter("session_id", self.document_model.session_id)
                  display_items_model.sort_key = DataItem.sort_by_date_key
                  display_items_model.sort_reverse = True
                  display_items_model.filter_id = filter_id
              elif filter_id == "temporary":
                  display_items_model.container = self.document_model
                  display_items_model.filter = ListModel.NotEqFilter("category", "persistent")
                  display_items_model.sort_key = DataItem.sort_by_date_key
                  display_items_model.sort_reverse = True
                  display_items_model.filter_id = filter_id
              elif filter_id == "none":  # not intended to be used directly
                  display_items_model.container = self.document_model
                  display_items_model.filter = ListModel.Filter(False)
                  display_items_model.sort_key = DataItem.sort_by_date_key
                  display_items_model.sort_reverse = True
                  display_items_model.filter_id = filter_id
              else:  # "all"
                  display_items_model.container = self.document_model
                  display_items_model.filter = ListModel.EqFilter("category", "persistent")
                  display_items_model.sort_key = DataItem.sort_by_date_key
                  display_items_model.sort_reverse = True
                  display_items_model.filter_id = None