<commit_before>"""
The Builder is responsible for finding and building docker images in
the correct order

Building an image requires building all dependent images, creating the necessary
context, and actually building the current image.
"""

from harpoon.ship.builders.persistence import PersistenceBuilder
from harpoon.ship.builders.squashed import SquashedBuilder
from harpoon.ship.builders.normal import NormalBuilder
from harpoon.ship.builders.base import BuilderBase

from harpoon.errors import NoSuchImage, BadCommand, UserQuit
from harpoon.ship.progress_stream import ProgressStream
from harpoon.option_spec import command_objs
from harpoon.ship.runner import Runner
from harpoon.layers import Layers

from input_algorithms.spec_base import NotSpecified
from itertools import chain
import logging
import six
import sys

log = logging.getLogger("harpoon.ship.builder")

########################
###   PROGRESS STREAM
########################

class BuildProgressStream(ProgressStream):
    def setup(self):
        self.last_line = ""
        self.current_action = ""
        self.current_container = None

    def interpret_line(self, line_detail):
        if "stream" in line_detail:
            self.interpret_stream(line_detail["stream"])
            self.last_line = line_detail["stream"]
        elif "status" in line_detail:
            self.interpret_status(line_detail["status"])
            self.last_line = line_detail["status"]
        else:
            self.interpret_unknown(line_detail)
            self.last_line = str(line_detail)

    def interpret_stream(self, line):
        if line.startswith("Step "):
            action = line[line.find(":")+1:].strip()
            self.current_action = action[:action.find(" ")].strip()<commit_msg>Be aware of the aux line_detail<commit_after>"""
The Builder is responsible for finding and building docker images in
the correct order

Building an image requires building all dependent images, creating the necessary
context, and actually building the current image.
"""

from harpoon.ship.builders.persistence import PersistenceBuilder
from harpoon.ship.builders.squashed import SquashedBuilder
from harpoon.ship.builders.normal import NormalBuilder
from harpoon.ship.builders.base import BuilderBase

from harpoon.errors import NoSuchImage, BadCommand, UserQuit
from harpoon.ship.progress_stream import ProgressStream
from harpoon.option_spec import command_objs
from harpoon.ship.runner import Runner
from harpoon.layers import Layers

from input_algorithms.spec_base import NotSpecified
from itertools import chain
import logging
import six
import sys

log = logging.getLogger("harpoon.ship.builder")

########################
###   PROGRESS STREAM
########################

class BuildProgressStream(ProgressStream):
    def setup(self):
        self.last_line = ""
        self.current_action = ""
        self.current_container = None

    def interpret_line(self, line_detail):
        if "stream" in line_detail:
            self.interpret_stream(line_detail["stream"])
            self.last_line = line_detail["stream"]
        elif "status" in line_detail:
            self.interpret_status(line_detail["status"])
            self.last_line = line_detail["status"]
        elif "aux" in line_detail:
            log.info("Created image\t%s", line_detail["aux"].get("ID", ""))
        else:
            self.interpret_unknown(line_detail)
            self.last_line = str(line_detail)

    def interpret_stream(self, line):
        if line.startswith("Step "):
            action = line[line.find(":")+1:].strip()
            self.current_action = action[:action.find(" ")].strip()
{'fraction_non_alphanumeric': 0.11025991792065663, 'fraction_numerical': 0.0005471956224350205, 'mean_word_length': 3.868175765645806, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1842022', 'n_tokens_mistral': 976, 'n_tokens_neox': 969, 'n_words': 267}