Code Duplication    Length = 11-20 lines in 2 locations

src/aiscalator/jupyter/docker_image.py 2 locations

@@ 160-179 (lines=20) @@
157
    -------
158
        path to the resulting dockerfile
159
    """
160
    if conf.has_step_field("docker_image.apt_package_path"):
161
        content = conf.step_file_path("docker_image.apt_package_path")
162
        value = utils.format_file_content(content, suffix="\\\n")
163
        if value:
164
            value = ("RUN apt-get install -yqq \\\n" + value + """
165
    && apt-get purge --auto-remove -yqq $buildDeps \\
166
    && apt-get autoremove -yqq --purge \\
167
    && apt-get clean \\
168
    && rm -rf \\
169
        /var/lib/apt/lists/* \\
170
        /tmp/* \\
171
        /var/tmp/* \\
172
        /usr/share/man \\
173
        /usr/share/doc \\
174
        /usr/share/doc-base
175
        """)
176
            utils.copy_replace(dockerfile, tmp,
177
                               pattern="# apt_packages.txt #",
178
                               replace_value=value)
179
            return tmp
180
    return dockerfile
181
182
@@ 232-242 (lines=11) @@
229
        -------
230
            path to the resulting dockerfile
231
        """
232
    if conf.has_step_field("docker_image.lab_extension_path"):
233
        content = conf.step_file_path("docker_image.lab_extension_path")
234
        prefix = "&& jupyter labextension install "
235
        value = utils.format_file_content(content,
236
                                          prefix=prefix, suffix=" \\\n")
237
        if value:
238
            value = "RUN echo 'Installing Jupyter Extensions' \\\n" + value
239
            utils.copy_replace(dockerfile, tmp,
240
                               pattern="# lab_extensions.txt #",
241
                               replace_value=value)
242
            return tmp
243
    return dockerfile
244
245