old_contents: # Copyright (c) 2018 Renata Hodovan, Akos Kiss.
  #
  # Licensed under the BSD 3-Clause License
  # <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
  # This file may not be copied, modified, or distributed except
  # according to those terms.
  
  from string import Formatter
  
  from . import TemplateFormatter
  
  
  class StringFormatter(TemplateFormatter):
      """
      A simple string-template-based issue formatter.
  
      The formatter renders both the ``short`` and ``long`` versions
      of the issue according to the user-defined templates. If either of
      the templates is missing, then that version will be presented as an
      empty string (default).
  
      The user-defined templates should follow the syntax expected by
      the ``format`` method of :class:`string.Formatter`.
  
      **Optional parameters of the formatter:**
  
        - ``short``: the issue summary template string (default: empty string).
  
        - ``short_file``: path to a file containing the issue summary template
          (default: ``None``).
  
        - ``long``: the detailed issue template string (default: empty string).
  
        - ``long_file``: path to a file containing the detailed issue template
          (default: ``None``).
  
      **Example configuration snippet:**
  
          .. code-block:: ini
  
              [sut.foo]
              # see fuzzinator.call.*
              formatter=fuzzinator.formatter.StringFormatter
  
              [sut.foo.formatter.init]
              short={id}
              long_file=/path/to/templates/foo.md
      """
  
      def __call__(self, issue, format='long'):
          template = self.templates[format]
          return template.format(**{key: issue.get(key, '') for _, key, _, _ in Formatter().parse(template)})
  
new_contents: # Copyright (c) 2018-2020 Renata Hodovan, Akos Kiss.
  #
  # Licensed under the BSD 3-Clause License
  # <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
  # This file may not be copied, modified, or distributed except
  # according to those terms.
  
  from string import Formatter
  
  from . import TemplateFormatter
  
  
  class StringFormatter(TemplateFormatter):
      """
      A simple string-template-based issue formatter.
  
      The formatter renders both the ``short`` and ``long`` versions
      of the issue according to the user-defined templates. If either of
      the templates is missing, then that version will be presented as an
      empty string (default).
  
      The user-defined templates should follow the syntax expected by
      the ``format`` method of :class:`string.Formatter`.
  
      **Optional parameters of the formatter:**
  
        - ``short``: the issue summary template string (default: empty string).
  
        - ``short_file``: path to a file containing the issue summary template
          (default: ``None``).
  
        - ``long``: the detailed issue template string (default: empty string).
  
        - ``long_file``: path to a file containing the detailed issue template
          (default: ``None``).
  
      **Example configuration snippet:**
  
          .. code-block:: ini
  
              [sut.foo]
              # see fuzzinator.call.*
              formatter=fuzzinator.formatter.StringFormatter
  
              [sut.foo.formatter.init]
              short={id}
              long_file=/path/to/templates/foo.md
      """
  
      def __call__(self, issue, format='long'):
          template = self.templates[format]
          return template.format_map({key: issue.get(key, '') for _, key, _, _ in Formatter().parse(template)})
  
subject: Improve StringFormatter to use str.format_map instead of str.format