code: def get_dirs_from_args(args: Iterable[str]) -> List[Path]:
      def is_option(x: str) -> bool:
          return x.startswith("-")
  
      def get_file_part_from_node_id(x: str) -> str:
          return x.split("::")[0]
  
      def get_dir_from_path(path: Path) -> Path:
          if path.is_dir():
              return path
          return path.parent
  
      # These look like paths but may not exist
      possible_paths = (
          absolutepath(get_file_part_from_node_id(arg))
          for arg in args
          if not is_option(arg)
      )
  
      return [
          get_dir_from_path(path)
          for path in possible_paths
          if safe_exists(path)
      ]
  
imports: import os
  import sys
  from pathlib import Path
  from typing import Dict
  from typing import Iterable
  from typing import List
  from typing import Optional
  from typing import Sequence
  from typing import Tuple
  from typing import TYPE_CHECKING
  from typing import Union
  import iniconfig
  from .exceptions import UsageError
  from _pytest.outcomes import fail
  from _pytest.pathlib import absolutepath
  from _pytest.pathlib import commonpath
  from _pytest.pathlib import safe_exists
label_desc: Use image node_id 5 for calling a global function with example usage: get_dirs_from_args(args) and returns: unknown, x, x, path, path