import sys
import re
from xc_exception import TestFailureError
from colors import Colors
from meta_line import MetaLine
from line import Line

class OutputPipe:
  meta_lines = []
  verbose = True
  pretty = True
  unacceptable_output = []

# unacceptable_output is usful for failing based on command output, rather than
# exitcode
  def __init__(self, verbose = True, pretty = True, unacceptable_output=[]):
    self.verbose = verbose
    self.pretty = pretty
    self.unacceptable_output = unacceptable_output

  def put_line(self, line):
    m_line = MetaLine(line)
    self.meta_lines.append(m_line)

    if self.verbose:
      if self.pretty:
        output = m_line.str()
      else:
        output = line

      sys.stdout.write(output)

    for uo in self.unacceptable_output:
      if re.compile(uo).match(line):
        raise TestFailureError(line)


import sys
import re
from xc_exception import TestFailureError
from colors import Colors
from meta_line import MetaLine
from line import Line

class OutputPipe:
  meta_lines = []
  verbose = True
  pretty = True
  unacceptable_output = []

# unacceptable_output is usful for failing based on command output, rather than
# exitcode
  def __init__(self, verbose = True, pretty = True, unacceptable_output=[]):
    self.verbose = verbose
    self.pretty = pretty
    self.unacceptable_output = unacceptable_output
    self.meta_lines = []

  def put_line(self, line):
    m_line = MetaLine(line)
    self.meta_lines.append(m_line)

    if self.verbose:
      if self.pretty:
        output = m_line.str()
      else:
        output = line

      sys.stdout.write(output)

    for uo in self.unacceptable_output:
      if re.compile(uo).match(line):
        raise TestFailureError(line)


Fix bug where previous instances would populate the new OutputPipe
Fix bug where previous instances would populate the new OutputPipe

  import sys
  import re
  from xc_exception import TestFailureError
  from colors import Colors
  from meta_line import MetaLine
  from line import Line
  
  class OutputPipe:
    meta_lines = []
    verbose = True
    pretty = True
    unacceptable_output = []
  
  # unacceptable_output is usful for failing based on command output, rather than
  # exitcode
    def __init__(self, verbose = True, pretty = True, unacceptable_output=[]):
      self.verbose = verbose
      self.pretty = pretty
      self.unacceptable_output = unacceptable_output
+     self.meta_lines = []
  
    def put_line(self, line):
      m_line = MetaLine(line)
      self.meta_lines.append(m_line)
  
      if self.verbose:
        if self.pretty:
          output = m_line.str()
        else:
          output = line
  
        sys.stdout.write(output)
  
      for uo in self.unacceptable_output:
        if re.compile(uo).match(line):
          raise TestFailureError(line)
  
  
Fix bug where previous instances would populate the new OutputPipe
## Code Before:
import sys
import re
from xc_exception import TestFailureError
from colors import Colors
from meta_line import MetaLine
from line import Line

class OutputPipe:
  meta_lines = []
  verbose = True
  pretty = True
  unacceptable_output = []

# unacceptable_output is usful for failing based on command output, rather than
# exitcode
  def __init__(self, verbose = True, pretty = True, unacceptable_output=[]):
    self.verbose = verbose
    self.pretty = pretty
    self.unacceptable_output = unacceptable_output

  def put_line(self, line):
    m_line = MetaLine(line)
    self.meta_lines.append(m_line)

    if self.verbose:
      if self.pretty:
        output = m_line.str()
      else:
        output = line

      sys.stdout.write(output)

    for uo in self.unacceptable_output:
      if re.compile(uo).match(line):
        raise TestFailureError(line)


## Instruction:
Fix bug where previous instances would populate the new OutputPipe
## Code After:
import sys
import re
from xc_exception import TestFailureError
from colors import Colors
from meta_line import MetaLine
from line import Line

class OutputPipe:
  meta_lines = []
  verbose = True
  pretty = True
  unacceptable_output = []

# unacceptable_output is usful for failing based on command output, rather than
# exitcode
  def __init__(self, verbose = True, pretty = True, unacceptable_output=[]):
    self.verbose = verbose
    self.pretty = pretty
    self.unacceptable_output = unacceptable_output
    self.meta_lines = []

  def put_line(self, line):
    m_line = MetaLine(line)
    self.meta_lines.append(m_line)

    if self.verbose:
      if self.pretty:
        output = m_line.str()
      else:
        output = line

      sys.stdout.write(output)

    for uo in self.unacceptable_output:
      if re.compile(uo).match(line):
        raise TestFailureError(line)

