class Collector(object):
    def __init__(self):
        self._groups = []
        self._current_group = None

    def add_input(self, new_input):
        if self._current_group is None:
            self._current_group = []
        self._current_group.append(new_input)

    def finalise_group(self):
        self._groups.append(self._current_group)
        self._current_group = None

    @property
    def groups(self):
        return self._groups

    @property
    def current_group(self):
        return self._current_group

    def __str__(self):
        temp = ""
        for group in self._groups:
            for text in group:
                temp += text + "\n"
            temp += "\n"
        return temp

class Collector(object):
    def __init__(self):
        self._groups = []
        self._current_group = None

    def add_input(self, new_input):
        if self._current_group is None:
            self._current_group = []
            self._groups.append(self._current_group)
        self._current_group.append(new_input)

    def finalise_group(self):
        self._current_group = None

    @property
    def groups(self):
        return self._groups

    @property
    def current_group(self):
        return self._current_group

    def __str__(self):
        temp = ""
        for group in self._groups:
            for text in group:
                temp += text + "\n"
            temp += "\n"
        return temp

Fix bug with collector losing last group of input
Fix bug with collector losing last group of input

This means the script runner doesn't have to manually finalise the last
input, which was always a bit silly. In fact, the whole metaphor is
rather silly. I should change it to be "start new group" instead.

  class Collector(object):
      def __init__(self):
          self._groups = []
          self._current_group = None
  
      def add_input(self, new_input):
          if self._current_group is None:
              self._current_group = []
+             self._groups.append(self._current_group)
          self._current_group.append(new_input)
  
      def finalise_group(self):
-         self._groups.append(self._current_group)
          self._current_group = None
  
      @property
      def groups(self):
          return self._groups
  
      @property
      def current_group(self):
          return self._current_group
  
      def __str__(self):
          temp = ""
          for group in self._groups:
              for text in group:
                  temp += text + "\n"
              temp += "\n"
          return temp
  
Fix bug with collector losing last group of input
## Code Before:
class Collector(object):
    def __init__(self):
        self._groups = []
        self._current_group = None

    def add_input(self, new_input):
        if self._current_group is None:
            self._current_group = []
        self._current_group.append(new_input)

    def finalise_group(self):
        self._groups.append(self._current_group)
        self._current_group = None

    @property
    def groups(self):
        return self._groups

    @property
    def current_group(self):
        return self._current_group

    def __str__(self):
        temp = ""
        for group in self._groups:
            for text in group:
                temp += text + "\n"
            temp += "\n"
        return temp

## Instruction:
Fix bug with collector losing last group of input
## Code After:
class Collector(object):
    def __init__(self):
        self._groups = []
        self._current_group = None

    def add_input(self, new_input):
        if self._current_group is None:
            self._current_group = []
            self._groups.append(self._current_group)
        self._current_group.append(new_input)

    def finalise_group(self):
        self._current_group = None

    @property
    def groups(self):
        return self._groups

    @property
    def current_group(self):
        return self._current_group

    def __str__(self):
        temp = ""
        for group in self._groups:
            for text in group:
                temp += text + "\n"
            temp += "\n"
        return temp
