/ src / python / txtai / util / template.py
template.py
 1  """
 2  Template module
 3  """
 4  
 5  from string import Formatter
 6  
 7  
 8  class TemplateFormatter(Formatter):
 9      """
10      Custom Formatter that requires each argument to be consumed.
11      """
12  
13      def check_unused_args(self, used_args, args, kwargs):
14          difference = set(kwargs).difference(used_args)
15          if difference:
16              raise KeyError(difference)