code: def list_subcommands():
      """List all jupyter subcommands
  
      searches PATH for `jupyter-name`
  
      Returns a list of jupyter's subcommand names, without the `jupyter-` prefix.
      Nested children (e.g. jupyter-sub-subsub) are not included.
      """
      subcommand_tuples = set()
      # construct a set of `('foo', 'bar') from `jupyter-foo-bar`
      for d in _path_with_self():
          try:
              names = os.listdir(d)
          except OSError:
              continue
          for name in names:
              if name.startswith("jupyter-"):
                  if sys.platform.startswith("win"):
                      # remove file-extension on Windows
                      name = os.path.splitext(name)[0]
                  subcommand_tuples.add(tuple(name.split("-")[1:]))
      # build a set of subcommand strings, excluding subcommands whose parents are defined
      subcommands = set()
      # Only include `jupyter-foo-bar` if `jupyter-foo` is not already present
      for sub_tup in subcommand_tuples:
          if not any(
              sub_tup[:i] in subcommand_tuples
              for i in range(1, len(sub_tup))
          ):
              subcommands.add("-".join(sub_tup))
      return sorted(subcommands)
  
file_path: catboost/contrib/python/jupyter-core/py2/jupyter_core/command.py
imports: from __future__ import print_function
  import argparse
  import errno
  import json
  import os
  import sys
  import sysconfig
  from subprocess import Popen
  from .None import paths
  from .version import __version__
label_desc: Use image node_id 2 for calling a global function with example usage: list_subcommands() and returns: sorted