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`
docstr: Format the current template.
  
  Return a list of string where the arguments have been given the values inside
  the `configuration` argument.
  
  Parameters
  ----------
  configuration : dict
      Dictionary containing the keys and values for each argument of the commandline.
  
  Returns
  -------
  list
      A list resembling the one given to the `parse` method but with values of
      `configuration`.
docstr_tok: ["Format","the","current","template",".","Return","a","list","of","string","where","the","arguments","have","been","given","the","values","inside","the","`","configuration","`","argument",".","Parameters","--","--","--","--","--","configuration",":","dict","Dictionary","containing","the","keys","and","values","for","each","argument","of","the","commandline",".","Returns","--","--","--","-","list","A","list","resembling","the","one","given","to","the","`","parse","`","method","but","with","values","of","`","configuration","`","."]
code: def format(self, configuration):
      """Format the current template.
  
      Return a list of string where the arguments have been given the values inside
      the `configuration` argument.
  
      Parameters
      ----------
      configuration : dict
          Dictionary containing the keys and values for each argument of the commandline.
  
      Returns
      -------
      list
          A list resembling the one given to the `parse` method but with values of
          `configuration`.
  
      """
      # Arguments with spaces are broken if we use ' '.join(template).format().split(' ').
      # Hence we iterate over the list as-is and format on each item separately.
      formatted = []
      for item in self.template:
          if item.startswith("-"):
              formatted.append(item)
          elif (
              item.startswith("{")
              and item.endswith("}")
              and any(item == f"{{{key}}}" for key in configuration)
          ):
              # The argument has an entry with exactly matching name in the configuration.
              # Extract it from the configuration, rather than try to use `str.format`.
              # This solves bugs that arise from using strings that are invalid python expressions
              # (e.g. names with ".", "/", or ":").
              key = [
                  key for key in configuration if item == f"{{{key}}}"
              ][0]
              value = configuration[key]
              formatted.append(str(value))
          else:
              formatted.append(item.format(**configuration))
  
      return formatted
  
file_path: orion/src/orion/core/io/cmdline_parser.py
imports: import os
  from collections import OrderedDict
label_desc: Use image node_id 4 for calling the CmdlineParser obj's underlying member method code with example usage: obj.format(configuration) and returns: formatted