class_docstr: Simple class for commandline arguments parsing.
  
  `CmdlineParser` provides a simple interface to interpret commandline arguments
  and create new commandlines. This class exposes an interface to transform a list of strings
  representing the commandline in a dictionary of key-value conserving the order of
  the arguments, the value of named arguments, be it boolean, single-valued or multiple ones,
  as well as handling the definition of argument through the `=` sign.
  
  Attributes
  ----------
  arguments : dict
      Commandline arguments' name and value(s).
  template : list
      List of template-ready strings for formatting.
  
  See Also
  --------
  parse : Parse the list of string and defines the form of the template.
  
  Notes
  -----
  Subcommands are not supported and will be likely lead to bad interpretation of the commandline.
  Aggregation of single characters arguments is not supported yet. Ex: `-xzvf`
code: def _parse_arguments(self, commandline):
      arguments = OrderedDict()
      keys = OrderedDict()
      key = None
  
      for item in commandline:
          # Handle keyworded arguments
          if item.startswith("-"):
              # Make sure we're not defining the same argument twice
              # If the argument is in the form of `--name=value`
              argument_parts = item.split("=")
              argument_name = argument_parts[0]
              key = argument_name.lstrip("-")
  
              if key in keys:
                  raise ValueError(
                      f"Conflict: two arguments have the same name: {key}"
                  )
  
              arguments[key] = []
              keys[key] = argument_name
  
              if len(argument_parts) > 1:
                  arguments[key].append(argument_parts[-1])
  
          # If the argument did not start with `-` but we have an argument name
          # That means that this value belongs to that argument name list
          elif key is not None and item.strip(" "):
              arguments[key].append(item)
  
          # No argument name means we have not reached them yet, so we're still in the
          # Positional arguments part
          elif key is None:
              _pos_key = f"_pos_{len(arguments)}"
              keys[_pos_key] = _pos_key
              arguments[_pos_key] = item
  
      for key, value in arguments.items():
          # Loop through the items and check if their value is a list
          # If it is, and the length is 0, that means it is a boolean args.
          # If its value is 1, it only has a single element and we unpack it.
          if isinstance(value, list):
              if not value:
                  value = True
              elif len(value) == 1:
                  value = value[0]
  
          value = self._parse_paths(value)
          arguments[key] = value
  
      return keys, arguments
  
file_path: orion/src/orion/core/io/cmdline_parser.py
imports: import os
  from collections import OrderedDict
label_desc: Use image node_id 7 for calling the CmdlineParser obj's underlying member method code with example usage: obj._parse_arguments(commandline) and returns: keys,  arguments