code: def test_datasetsaver():
      # test on graph classification
      # ogbg-molhiv
  
      test_task = "link"
  
      # testing all the dataset objects are working.
      if test_task == "graph":
          from ogb.graphproppred import (
              PygGraphPropPredDataset,
              DglGraphPropPredDataset,
              GraphPropPredDataset,
          )
  
          dataset_name = "ogbg-molhiv"
          dataset = PygGraphPropPredDataset(dataset_name)
          dataset.get_idx_split()
          dataset = DglGraphPropPredDataset(dataset_name)
          dataset.get_idx_split()
          dataset = GraphPropPredDataset(dataset_name)
          dataset.get_idx_split()
      elif test_task == "node":
          from ogb.nodeproppred import (
              NodePropPredDataset,
              PygNodePropPredDataset,
              DglNodePropPredDataset,
          )
  
          dataset_name = "ogbn-arxiv"  # test ogbn-proteins
          dataset = PygNodePropPredDataset(dataset_name)
          dataset.get_idx_split()
          dataset = DglNodePropPredDataset(dataset_name)
          dataset.get_idx_split()
          dataset = NodePropPredDataset(dataset_name)
          dataset.get_idx_split()
      elif test_task == "link":
          from ogb.linkproppred import (
              LinkPropPredDataset,
              PygLinkPropPredDataset,
              DglLinkPropPredDataset,
          )
  
          dataset_name = "ogbl-collab"
          dataset = PygLinkPropPredDataset(dataset_name)
          dataset.get_edge_split()
          dataset = DglLinkPropPredDataset(dataset_name)
          dataset.get_edge_split()
          dataset = LinkPropPredDataset(dataset_name)
          dataset.get_edge_split()
      elif test_task == "heteronode":
          from ogb.nodeproppred import (
              NodePropPredDataset,
              PygNodePropPredDataset,
              DglNodePropPredDataset,
          )
  
          dataset_name = "ogbn-mag"
          dataset = PygNodePropPredDataset(dataset_name)
          dataset.get_idx_split()
          dataset = DglNodePropPredDataset(dataset_name)
          dataset.get_idx_split()
          dataset = NodePropPredDataset(dataset_name)
          dataset.get_idx_split()
      elif test_task == "heterolink":
          from ogb.linkproppred import (
              LinkPropPredDataset,
              PygLinkPropPredDataset,
              DglLinkPropPredDataset,
          )
  
          dataset_name = "ogbl-biokg"
          dataset = PygLinkPropPredDataset(dataset_name)
          dataset.get_edge_split()
          dataset = DglLinkPropPredDataset(dataset_name)
          dataset.get_edge_split()
          dataset = LinkPropPredDataset(dataset_name)
          dataset.get_edge_split()
      else:
          raise ValueError("Invalid task category")
  
      print(dataset[0])
      if "link" in test_task:
          print(dataset.get_edge_split())
      else:
          print(dataset.get_idx_split())
  
      if "graph" in test_task:
          graph_list = dataset.graphs
      else:
          graph_list = [dataset.graph]
  
      if "link" not in test_task:
          labels = dataset.labels
  
      is_hetero = "hetero" in test_task
      version = 2 if dataset_name == "ogbn-mag" else 1
      saver = DatasetSaver(dataset_name, is_hetero, version=version)
  
      # saving graph objects
      saver.save_graph_list(graph_list)
      # saving target labels
      if "link" not in test_task:
          saver.save_target_labels(labels)
      # saving split
      if "link" in test_task:
          split_idx = dataset.get_edge_split()
      else:
          split_idx = dataset.get_idx_split()
      # second argument must be the name of the split
      saver.save_split(split_idx, dataset.meta_info["split"])
      # copying mapping dir
      saver.copy_mapping_dir(
          f"dataset/{'_'.join(dataset_name.split('-'))}/mapping/"
      )
  
      saver.save_task_info(
          dataset.task_type,
          dataset.eval_metric,
          dataset.num_classes
          if hasattr(dataset, "num_classes")
          else None,
      )
  
      meta_dict = saver.get_meta_dict()
  
      print(meta_dict)
  
      print("Now testing.")
  
      if "graph" in test_task:
          print("library agnostic")
          dataset = GraphPropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          dataset = GraphPropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          print(dataset[0])
          print(dataset.get_idx_split())
          print("Pytorch Geometric")
          dataset = PygGraphPropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          dataset = PygGraphPropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          print(dataset[0])
          print(dataset.get_idx_split())
          print("DGL")
          dataset = DglGraphPropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          dataset = DglGraphPropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          print(dataset[0])
          print(dataset.get_idx_split())
      elif "node" in test_task:
          print("library agnostic")
          dataset = NodePropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          dataset = NodePropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          print(dataset[0])
          print(dataset.get_idx_split())
          print("Pytorch Geometric")
          dataset = PygNodePropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          dataset = PygNodePropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          print(dataset[0])
          print(dataset.get_idx_split())
          print("DGL")
          dataset = DglNodePropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          dataset = DglNodePropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          print(dataset[0])
          print(dataset.get_idx_split())
  
      elif "link" in test_task:
          print("library agnostic")
          dataset = LinkPropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          dataset = LinkPropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          print(dataset[0])
          # print(dataset.get_edge_split())
          print("Pytorch Geometric")
          dataset = PygLinkPropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          dataset = PygLinkPropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          print(dataset[0])
          # print(dataset.get_edge_split())
          print("DGL")
          dataset = DglLinkPropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          dataset = DglLinkPropPredDataset(
              dataset_name, meta_dict=meta_dict
          )
          print(dataset[0])
          # print(dataset.get_edge_split())
      else:
          raise ValueError("Invalid task category")
  
      # zip
      saver.zip()
      print("Finished zipping!")
  
      saver.cleanup()
  
imports: import torch
  import pandas
  import os
  import os.path
  from datetime import date
  import shutil
  from tqdm.auto import tqdm
  import numpy
  from ogb.io.read_graph_raw import read_binary_graph_raw, read_binary_heterograph_raw
  from ogb.utils.torch_util import all_numpy
label_desc: Use image node_id 1 for calling a global function with example usage: test_datasetsaver() without return types