code: def _add_annotations_import(path):
      """Appends a future annotations import to the file at the given path."""
      with open(path) as f:
          contents = f.read()
      # If we run sphinx multiple times then we will append the future import
      # multiple times too, so this check is here to prevent that.
      if contents.startswith("from __future__ import annotations"):
          return
  
      assert contents.startswith("#"), (path, contents.split("\n")[0])
      with open(path, "w") as f:
          # NOTE: This is subtle and not unit tested, we're prefixing the first line
          # in each Python file with this future import. It is important to prefix
          # not insert a newline such that source code locations are accurate (we link
          # to GitHub). The assertion above ensures that the first line in the file is
          # a comment so it is safe to prefix it.
          f.write("from __future__ import annotations  ")
          f.write(contents)
  
file_path: jraph/docs/conf.py
imports: import inspect
  import os
  import sys
  import typing
  import jraph
label_desc: Use image node_id 1 for calling a global function with example usage: _add_annotations_import(path) without return types