def assure_value_variable(all_data_dict, variable_nodes, fixed_nodes, n_pages):
    """Makes sure all values are in the variable nodes by updating sets.

    Args:
      all_data_dict: the dictionary saving all data with groundtruth.
      variable_nodes: the current set of variable nodes.
      fixed_nodes: the current set of fixed nodes.
      n_pages: to assume we only process first n_pages pages from each website.
    """
    for index in all_data_dict:
        if not index.isdigit() or int(index) >= n_pages:
            # the key should be an integer, to exclude "fixed/variable nodes" entries.
            # n_pages to stop for only process part of the website.
            continue
        for field in all_data_dict[index]:
            if not field.startswith("field-"):
                continue
            xpaths = all_data_dict[index][field]["groundtruth_xpaths"]
            if not xpaths:  # There are zero value for this field in this page.
                continue
            flag = False
            for xpath in xpaths:
                if flag:  # The value's xpath is in the variable_nodes.
                    break
                flag = xpath in variable_nodes
            variable_nodes.update(xpaths)  # Add new xpaths if they are not in.
            fixed_nodes.difference_update(xpaths)
Makes sure all values are in the variable nodes by updating sets.

    Args:
      all_data_dict: the dictionary saving all data with groundtruth.
      variable_nodes: the current set of variable nodes.
      fixed_nodes: the current set of fixed nodes.
      n_pages: to assume we only process first n_pages pages from each website.
    
markuplm/examples/fine_tuning/run_swde/prepare_data.py