parameters: (s, **kwargs)
return_statement: return output()[:-1]
docstring: Perform str.format-like substitution, except:
        * The strings substituted must be on lines by
          themselves.  (This line is the "source line".)
        * If the substitution text is empty, the source line
          is removed in the output.
        * If the field is not recognized, the original line
          is passed unmodified through to the output.
        * If the substitution text is not empty:
            * Each line of the substituted text is indented
              by the indent of the source line.
            * A newline will be added to the end.
docstring_summary: Perform str.format-like substitution, except:
        * The strings substituted must be on lines by
          themselves.  (This line is the "source line".)
        * If the substitution text is empty, the source line
          is removed in the output.
        * If the field is not recognized, the original line
          is passed unmodified through to the output.
        * If the substitution text is not empty:
            * Each line of the substituted text is indented
              by the indent of the source line.
            * A newline will be added to the end.
docstring_tokens: Perform str . format - like substitution except : * The strings substituted must be on lines by themselves . ( This line is the source line . ) * If the substitution text is empty the source line is removed in the output . * If the field is not recognized the original line is passed unmodified through to the output . * If the substitution text is not empty : * Each line of the substituted text is indented by the indent of the source line . * A newline will be added to the end .
function: def linear_format(s, **kwargs):
      """
      Perform str.format-like substitution, except:
        * The strings substituted must be on lines by
          themselves.  (This line is the "source line".)
        * If the substitution text is empty, the source line
          is removed in the output.
        * If the field is not recognized, the original line
          is passed unmodified through to the output.
        * If the substitution text is not empty:
            * Each line of the substituted text is indented
              by the indent of the source line.
            * A newline will be added to the end.
      """
  
      add, output = text_accumulator()
      for line in s.split('\n'):
          indent, curly, trailing = line.partition('{')
          if not curly:
              add(line)
              add('\n')
              continue
  
          name, curly, trailing = trailing.partition('}')
          if not curly or name not in kwargs:
              add(line)
              add('\n')
              continue
  
          if trailing:
              fail("Text found after {" + name + "} block marker!  It must be on a line by itself.")
          if indent.strip():
              fail("Non-whitespace characters found before {" + name + "} block marker!  It must be on a line by itself.")
  
          value = kwargs[name]
          if not value:
              continue
  
          value = textwrap.indent(rstrip_lines(value), indent)
          add(value)
          add('\n')
  
      return output()[:-1]
function_tokens: def linear_format ( s , * * kwargs ) : add , output = text_accumulator ( ) for line in s . split ( '\n' ) : indent , curly , trailing = line . partition ( '{' ) if not curly : add ( line ) add ( '\n' ) continue name , curly , trailing = trailing . partition ( '}' ) if not curly or name not in kwargs : add ( line ) add ( '\n' ) continue if trailing : fail ( "Text found after {" + name + "} block marker!  It must be on a line by itself." ) if indent . strip ( ) : fail ( "Non-whitespace characters found before {" + name + "} block marker!  It must be on a line by itself." ) value = kwargs [ name ] if not value : continue value = textwrap . indent ( rstrip_lines ( value ) , indent ) add ( value ) add ( '\n' ) return output ( ) [ : - 1 ]