code: def nodefault_used_not_only_for_typing(
      file_obj: IO[str],
  ) -> Iterable[tuple[int, str]]:
      """Test case where pandas._libs.lib.NoDefault is not used for typing.
  
      Parameters
      ----------
      file_obj : IO
          File-like object containing the Python code to validate.
  
      Yields
      ------
      line_number : int
          Line number of misused lib.NoDefault.
      msg : str
          Explanation of the error.
      """
      contents = file_obj.read()
      tree = ast.parse(contents)
      in_annotation = False
      nodes: list[tuple[bool, ast.AST]] = [(in_annotation, tree)]
  
      while nodes:
          in_annotation, node = nodes.pop()
          if not in_annotation and (
              isinstance(node, ast.Name)  # Case `NoDefault`
              and node.id == "NoDefault"
              or isinstance(
                  node, ast.Attribute
              )  # Cases e.g. `lib.NoDefault`
              and node.attr == "NoDefault"
          ):
              yield (
                  node.lineno,
                  "NoDefault is used not only for typing",
              )
  
          # This part is adapted from
          # https://github.com/asottile/pyupgrade/blob/5495a248f2165941c5d3b82ac3226ba7ad1fa59d/pyupgrade/_data.py#L70-L113
          for name in reversed(node._fields):
              value = getattr(node, name)
              if name in {"annotation", "returns"}:
                  next_in_annotation = True
              else:
                  next_in_annotation = in_annotation
              if isinstance(value, ast.AST):
                  nodes.append((next_in_annotation, value))
              elif isinstance(value, list):
                  nodes.extend(
                      (next_in_annotation, value)
                      for value in reversed(value)
                      if isinstance(value, ast.AST)
                  )
  
file_path: pandas/scripts/validate_unwanted_patterns.py
imports: import argparse
  import ast
  from collections.abc import Iterable
  import sys
  import token
  import tokenize
  from typing import IO, Callable
label_desc: Use image node_id 5 for calling a global function with example usage: nodefault_used_not_only_for_typing(file_obj) without return types