class_docstr: Helper class that handles syncing of a json and a dict.
class_docstr_tok: ["Helper","class","that","handles","syncing","of","a","json","and","a","dict","."]
docstr: Store back to file.
docstr_tok: ["Store","back","to","file","."]
code: def __exit__(
      self, exc_type: Any, exc_value: Any, exc_traceback: Any
  ) -> None:
      """Store back to file."""
      assert isinstance(self._s._json_dict, dict)
      if not self._readonly:
          with open(
              self._s._metadata_file_path, "w", encoding="utf-8"
          ) as f:
              json.dump(
                  self._s._json_dict, f, ensure_ascii=False, indent=2
              )
      self._s._json_dict = None
  
imports: import hashlib
  import json
  import logging
  import os
  from pathlib import Path
  import pickle
  import shutil
  import sys
  import tempfile
  import time
  from typing import Any, Dict, Optional, Tuple, Union, cast
  import pgzip
  import torch
  from torch import Tensor
  from fairscale.internal.containers import from_np, to_np
  from .utils import ExitCode
label_desc: Use image node_id 3 for calling the _JSON_DictContext obj's underlying member method code with example usage: obj.__exit__(exc_type, exc_value, exc_traceback) without return types