class_docstr: A singleton application with full configuration support.
class_docstr_tok: ["A","singleton","application","with","full","configuration","support","."]
docstr: Parse the command line arguments.
code: def parse_command_line(self, argv=None):
      """Parse the command line arguments."""
      argv = sys.argv[1:] if argv is None else argv
      self.argv = [py3compat.cast_unicode(arg) for arg in argv]
  
      if argv and argv[0] == "help":
          # turn `ipython help notebook` into `ipython notebook -h`
          argv = argv[1:] + ["-h"]
  
      if self.subcommands and len(argv) > 0:
          # we have subcommands, and one may have been specified
          subc, subargv = argv[0], argv[1:]
          if (
              re.match(r"^\w(\-?\w)*$", subc)
              and subc in self.subcommands
          ):
              # it's a subcommand, and *not* a flag or class parameter
              return self.initialize_subcommand(subc, subargv)
  
      # Arguments after a '--' argument are for the script IPython may be
      # about to run, not IPython iteslf. For arguments parsed here (help and
      # version), we want to only search the arguments up to the first
      # occurrence of '--', which we're calling interpreted_argv.
      try:
          interpreted_argv = argv[: argv.index("--")]
      except ValueError:
          interpreted_argv = argv
  
      if any(
          x in interpreted_argv for x in ("-h", "--help-all", "--help")
      ):
          self.print_help("--help-all" in interpreted_argv)
          self.exit(0)
  
      if "--version" in interpreted_argv or "-V" in interpreted_argv:
          self.print_version()
          self.exit(0)
  
      # flatten flags&aliases, so cl-args get appropriate priority:
      flags, aliases = self.flatten_flags()
      loader = KVArgParseConfigLoader(
          argv=argv, aliases=aliases, flags=flags, log=self.log
      )
      self.cli_config = deepcopy(loader.load_config())
      self.update_config(self.cli_config)
      # store unparsed args in extra_args
      self.extra_args = loader.extra_args
  
imports: from __future__ import print_function
  from copy import deepcopy
  import json
  import logging
  import os
  import re
  import sys
  from collections import defaultdict, OrderedDict
  from decorator import decorator
  from traitlets.config.configurable import Configurable, SingletonConfigurable
  from traitlets.config.loader import KVArgParseConfigLoader, PyFileConfigLoader, Config, ArgumentError, ConfigFileNotFound, JSONFileConfigLoader
  from traitlets.traitlets import Bool, Unicode, List, Enum, Dict, Instance, TraitError, observe, observe_compat, default
  from ipython_genutils.importstring import import_item
  from ipython_genutils.text import indent, wrap_paragraphs, dedent
  from ipython_genutils import py3compat
  import six
label_desc: Use image node_id 21 for calling the Application obj's underlying member method code with example usage: obj.parse_command_line(argv) and returns: self