diff --git a/repo2docker/app.py b/repo2docker/app.py index 63643da23..c7f3ab819 100755 --- a/repo2docker/app.py +++ b/repo2docker/app.py @@ -7,6 +7,7 @@ python -m repo2docker https://github.com/you/your-repo """ + import getpass import json import logging diff --git a/repo2docker/buildpacks/_r_base.py b/repo2docker/buildpacks/_r_base.py index 8c87f63f9..de2b7fcb2 100644 --- a/repo2docker/buildpacks/_r_base.py +++ b/repo2docker/buildpacks/_r_base.py @@ -3,6 +3,7 @@ Keeping this in r.py would lead to cyclic imports. """ + from ..semver import parse_version as V diff --git a/repo2docker/buildpacks/conda/__init__.py b/repo2docker/buildpacks/conda/__init__.py index aed5de6f6..2a3e694df 100644 --- a/repo2docker/buildpacks/conda/__init__.py +++ b/repo2docker/buildpacks/conda/__init__.py @@ -1,4 +1,5 @@ """BuildPack for conda environments""" + import os import re import warnings @@ -193,15 +194,15 @@ def get_build_script_files(self): raise ValueError( f"Python version {py_version} on {conda_platform} is not supported!" ) - files[ - f"conda/{lockfile_name}" - ] = self._kernel_environment_file = "/tmp/env/kernel-environment.lock" + files[f"conda/{lockfile_name}"] = self._kernel_environment_file = ( + "/tmp/env/kernel-environment.lock" + ) requirements_file_name = f"requirements.py-{py_version}.pip" if os.path.exists(os.path.join(HERE, requirements_file_name)): - files[ - f"conda/{requirements_file_name}" - ] = self._kernel_requirements_file = "/tmp/env/kernel-requirements.txt" + files[f"conda/{requirements_file_name}"] = ( + self._kernel_requirements_file + ) = "/tmp/env/kernel-requirements.txt" else: # server and kernel are the same server_py_version = py_version @@ -216,15 +217,15 @@ def get_build_script_files(self): f"Python version {server_py_version} on {conda_platform} is not supported!" ) - files[ - "conda/" + conda_frozen_name - ] = self._nb_environment_file = "/tmp/env/environment.lock" + files["conda/" + conda_frozen_name] = self._nb_environment_file = ( + "/tmp/env/environment.lock" + ) # add requirements.txt, if present if os.path.exists(os.path.join(HERE, pip_frozen_name)): - files[ - "conda/" + pip_frozen_name - ] = self._nb_requirements_file = "/tmp/env/requirements.txt" + files["conda/" + pip_frozen_name] = self._nb_requirements_file = ( + "/tmp/env/requirements.txt" + ) files.update(super().get_build_script_files()) return files diff --git a/repo2docker/buildpacks/docker.py b/repo2docker/buildpacks/docker.py index d1dfe4926..9185307ad 100644 --- a/repo2docker/buildpacks/docker.py +++ b/repo2docker/buildpacks/docker.py @@ -1,5 +1,6 @@ """Generates a variety of Dockerfiles based on an input matrix """ + import os import docker diff --git a/repo2docker/buildpacks/julia/julia_project.py b/repo2docker/buildpacks/julia/julia_project.py index 7b6771c28..0985a33e6 100644 --- a/repo2docker/buildpacks/julia/julia_project.py +++ b/repo2docker/buildpacks/julia/julia_project.py @@ -1,4 +1,5 @@ """Generates a Dockerfile based on an input matrix for Julia""" + import functools import os from functools import lru_cache diff --git a/repo2docker/buildpacks/julia/julia_require.py b/repo2docker/buildpacks/julia/julia_require.py index ab41ffc26..cfea13440 100644 --- a/repo2docker/buildpacks/julia/julia_require.py +++ b/repo2docker/buildpacks/julia/julia_require.py @@ -175,7 +175,7 @@ def get_assemble_scripts(self): r""" julia /tmp/install-repo-dependencies.jl "%(require)s" """ - % {"require": require} + % {"require": require}, # TODO: For some reason, `rm`ing the file fails with permission denied. # && rm /tmp/install-repo-dependencies.jl ) diff --git a/repo2docker/buildpacks/legacy/__init__.py b/repo2docker/buildpacks/legacy/__init__.py index 31980f9f7..36bdb8f28 100644 --- a/repo2docker/buildpacks/legacy/__init__.py +++ b/repo2docker/buildpacks/legacy/__init__.py @@ -7,6 +7,7 @@ Note: This buildpack has been deprecated. """ + import logging diff --git a/repo2docker/buildpacks/nix/__init__.py b/repo2docker/buildpacks/nix/__init__.py index 94fd7b7c5..7da3be603 100644 --- a/repo2docker/buildpacks/nix/__init__.py +++ b/repo2docker/buildpacks/nix/__init__.py @@ -1,4 +1,5 @@ """BuildPack for nixpkgs environments""" + import os from functools import lru_cache diff --git a/repo2docker/buildpacks/pipfile/__init__.py b/repo2docker/buildpacks/pipfile/__init__.py index 4b86eed1a..cb6d1ef2b 100644 --- a/repo2docker/buildpacks/pipfile/__init__.py +++ b/repo2docker/buildpacks/pipfile/__init__.py @@ -173,9 +173,11 @@ def get_assemble_scripts(self): pipenv --clear \\ )""".format( working_directory=working_directory, - install_option="--ignore-pipfile" - if os.path.exists(pipfile_lock) - else "--skip-lock", + install_option=( + "--ignore-pipfile" + if os.path.exists(pipfile_lock) + else "--skip-lock" + ), ), ) ) diff --git a/repo2docker/buildpacks/python/__init__.py b/repo2docker/buildpacks/python/__init__.py index 188e8e9cf..36740795a 100644 --- a/repo2docker/buildpacks/python/__init__.py +++ b/repo2docker/buildpacks/python/__init__.py @@ -1,4 +1,5 @@ """Generates Dockerfiles based on an input matrix based on Python.""" + import os from functools import lru_cache diff --git a/repo2docker/contentproviders/base.py b/repo2docker/contentproviders/base.py index 672c39733..45baf272d 100644 --- a/repo2docker/contentproviders/base.py +++ b/repo2docker/contentproviders/base.py @@ -4,6 +4,7 @@ ContentProviders accept a `spec` of various kinds, and provide the contents from the spec to a given output directory. """ + import logging import os diff --git a/repo2docker/semver.py b/repo2docker/semver.py index d0a2a5b86..97650fa66 100644 --- a/repo2docker/semver.py +++ b/repo2docker/semver.py @@ -10,7 +10,6 @@ constraints. """ - import re from functools import lru_cache diff --git a/tests/unit/test_args.py b/tests/unit/test_args.py index 53913d944..d3e304f00 100644 --- a/tests/unit/test_args.py +++ b/tests/unit/test_args.py @@ -1,6 +1,7 @@ """ Test argument parsing and r2d construction """ + import os import pytest diff --git a/tests/unit/test_clone_depth.py b/tests/unit/test_clone_depth.py index 55102eac1..933a18ff8 100644 --- a/tests/unit/test_clone_depth.py +++ b/tests/unit/test_clone_depth.py @@ -6,6 +6,7 @@ and that is the only thing that is tested. """ + import os import subprocess from tempfile import TemporaryDirectory diff --git a/tests/unit/test_connect_url.py b/tests/unit/test_connect_url.py index dbc0c2608..dc72c181b 100644 --- a/tests/unit/test_connect_url.py +++ b/tests/unit/test_connect_url.py @@ -1,6 +1,7 @@ """ Test if the explict hostname is supplied correctly to the container """ + import time import requests diff --git a/tests/unit/test_env.py b/tests/unit/test_env.py index fde4aed43..01dd5c724 100644 --- a/tests/unit/test_env.py +++ b/tests/unit/test_env.py @@ -1,6 +1,7 @@ """ Test that environment variables may be defined """ + import os import subprocess import sys diff --git a/tests/unit/test_external_scripts.py b/tests/unit/test_external_scripts.py index 278707c87..f33b326f8 100644 --- a/tests/unit/test_external_scripts.py +++ b/tests/unit/test_external_scripts.py @@ -1,4 +1,5 @@ """Test if assemble scripts from outside of r2d repo are accepted.""" + import time from repo2docker.app import Repo2Docker diff --git a/tests/unit/test_labels.py b/tests/unit/test_labels.py index e6e1f2e9e..c6d3a7e28 100644 --- a/tests/unit/test_labels.py +++ b/tests/unit/test_labels.py @@ -1,6 +1,7 @@ """ Test if labels are supplied correctly to the container """ + from unittest.mock import Mock import pytest diff --git a/tests/unit/test_subdir.py b/tests/unit/test_subdir.py index 4e7007311..5a4e7a38b 100644 --- a/tests/unit/test_subdir.py +++ b/tests/unit/test_subdir.py @@ -1,6 +1,7 @@ """ Test if the subdirectory is correctly navigated to """ + import os import escapism diff --git a/tests/unit/test_users.py b/tests/unit/test_users.py index 642e4f3b2..89bee96f9 100644 --- a/tests/unit/test_users.py +++ b/tests/unit/test_users.py @@ -1,6 +1,7 @@ """ Test that User name and ID mapping works """ + import os import subprocess import tempfile diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index c518bbd23..6ce9c2546 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -1,6 +1,7 @@ """ Tests for repo2docker/utils.py """ + import os import platform import subprocess