
from __future__ import absolute_import, print_function

from cameo.visualization import ProgressBar


class ProgressObserver():
    """
    Progress bar to in command line
    """
    __name__ = "Progress Observer"

    def __init__(self):
        self.progress = None

    def __call__(self, population, num_generations, num_evaluations, args):
        if self.progress is None:
            self.max_evaluations = args.get('max_evaluations', 50000)
            self.progress = ProgressBar()
            self.progress.start()

        if num_evaluations % args.get('n', 1) == 0:
            if num_evaluations < self.max_evaluations:
                self.progress.update(self.max_evaluations)
            else:
                self.progress.update(num_evaluations)

    def reset(self):
        self.progress = None

    def end(self):
        self.progress.end()

from __future__ import absolute_import, print_function

from cameo.visualization import ProgressBar


class ProgressObserver():
    """
    Progress bar to in command line
    """
    __name__ = "Progress Observer"

    def __init__(self):
        self.progress = None

    def __call__(self, population, num_generations, num_evaluations, args):
        if self.progress is None:
            self.max_evaluations = args.get('max_evaluations', 50000)
            self.progress = ProgressBar(self.max_evaluations)
            self.progress.start()

        if num_evaluations % args.get('n', 1) == 0:
            if num_evaluations > self.max_evaluations:
                self.progress.update(self.max_evaluations)
            else:
                self.progress.update(num_evaluations)

    def reset(self):
        self.progress = None

    def end(self):
        self.progress.end()
Fix the bug fix. Now is really fixed.
Fix the bug fix. Now is really fixed.

  
  from __future__ import absolute_import, print_function
  
  from cameo.visualization import ProgressBar
  
  
  class ProgressObserver():
      """
      Progress bar to in command line
      """
      __name__ = "Progress Observer"
  
      def __init__(self):
          self.progress = None
  
      def __call__(self, population, num_generations, num_evaluations, args):
          if self.progress is None:
              self.max_evaluations = args.get('max_evaluations', 50000)
-             self.progress = ProgressBar()
+             self.progress = ProgressBar(self.max_evaluations)
              self.progress.start()
  
          if num_evaluations % args.get('n', 1) == 0:
-             if num_evaluations < self.max_evaluations:
+             if num_evaluations > self.max_evaluations:
                  self.progress.update(self.max_evaluations)
              else:
                  self.progress.update(num_evaluations)
  
      def reset(self):
          self.progress = None
  
      def end(self):
          self.progress.end()
Fix the bug fix. Now is really fixed.
## Code Before:

from __future__ import absolute_import, print_function

from cameo.visualization import ProgressBar


class ProgressObserver():
    """
    Progress bar to in command line
    """
    __name__ = "Progress Observer"

    def __init__(self):
        self.progress = None

    def __call__(self, population, num_generations, num_evaluations, args):
        if self.progress is None:
            self.max_evaluations = args.get('max_evaluations', 50000)
            self.progress = ProgressBar()
            self.progress.start()

        if num_evaluations % args.get('n', 1) == 0:
            if num_evaluations < self.max_evaluations:
                self.progress.update(self.max_evaluations)
            else:
                self.progress.update(num_evaluations)

    def reset(self):
        self.progress = None

    def end(self):
        self.progress.end()
## Instruction:
Fix the bug fix. Now is really fixed.
## Code After:

from __future__ import absolute_import, print_function

from cameo.visualization import ProgressBar


class ProgressObserver():
    """
    Progress bar to in command line
    """
    __name__ = "Progress Observer"

    def __init__(self):
        self.progress = None

    def __call__(self, population, num_generations, num_evaluations, args):
        if self.progress is None:
            self.max_evaluations = args.get('max_evaluations', 50000)
            self.progress = ProgressBar(self.max_evaluations)
            self.progress.start()

        if num_evaluations % args.get('n', 1) == 0:
            if num_evaluations > self.max_evaluations:
                self.progress.update(self.max_evaluations)
            else:
                self.progress.update(num_evaluations)

    def reset(self):
        self.progress = None

    def end(self):
        self.progress.end()