code: def _collect() -> list[type[Subcommand]]:
      from importlib import import_module
      from os import listdir
      from os.path import dirname
  
      # reference type by module as fully
      results: list[type[Subcommand]] = []
  
      for file in listdir(dirname(__file__)):
          if not file.endswith(".py") or file in (
              "__init__.py",
              "__main__.py",
          ):
              continue
  
          modname = file.rstrip(".py")
          mod = import_module("." + modname, __package__)
  
          for name in dir(mod):
              attr = getattr(mod, name)
              try:
                  if isinstance(attr, type) and issubclass(
                      attr, Subcommand
                  ):
                      if not getattr(attr, "name", None):
                          continue  # instance attribute not defined on abstract base class
                      results.append(attr)
              except TypeError:
                  # TypeAlias definition can raise in issubclass()
                  pass
  
      results = sorted(results, key=lambda attr: attr.name)
  
      return results
  
imports: from __future__ import annotations
  import logging
  from ..subcommand import Subcommand
label_desc: Use image node_id 1 for calling a global function with example usage: _collect() and returns: results