code: def test_view_granular_dir(tmp_dir, scm, dvc, run_copy):
      tmp_dir.dvc_gen(
          {
              "dir": {
                  "subdir": {"in-subdir": "in-subdir"},
                  "in-dir": "in-dir",
              }
          },
          commit="init",
      )
      index = Index.from_repo(dvc)
  
      # view should include the specific target, parent dirs, and children
      # view should exclude any siblings of the target
      view = index.targets_view("dir/subdir")
  
      assert view.data_keys == {
          "repo": {
              ("dir", "subdir"),
          }
      }
  
      data_index = view.data["repo"]
      assert ("dir",) in data_index
      assert (
          "dir",
          "subdir",
      ) in data_index
      assert ("dir", "subdir", "in-subdir") in data_index
      assert (
          "dir",
          "in-dir",
      ) not in data_index
  
imports: import os
  from itertools import chain
  import pytest
  from pygtrie import Trie
  from dvc.repo.index import Index
  from dvc.stage import Stage
label_desc: Use image node_id 9 for calling a global function with example usage: test_view_granular_dir(tmp_dir, scm, dvc, run_copy) without return types