code: def declare_op_types(locals_, all_, name_):
      op_types = set(
          v
          for v in locals_.values()
          if isinstance(v, type) and issubclass(v, Op)
      )
      # Adds all op types to __all__, and fix their modules.
      for typ in op_types:
          if typ.__module__ == name_:
              typ.__module__ = "funsor.ops"
          all_.append(typ.__name__)
      # Adds type(op) to locals, for each op in locals.
      for name, op in list(locals_.items()):
          if isinstance(op, Op) and type(op) not in op_types:
              locals_[type(op).__name__] = type(op)
              all_.append(type(op).__name__)
      all_.sort()
  
imports: import contextlib
  import functools
  import inspect
  import weakref
  from collections import OrderedDict
  from funsor.registry import PartialDispatcher
  from funsor.util import methodof
label_desc: Use image node_id 6 for calling a global function with example usage: declare_op_types(locals_, all_, name_) without return types