From 36bb28ee904908c69c64a92e4b6d5fd5768fb88d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Thu, 27 Jan 2022 17:57:35 +0100 Subject: [PATCH] double quote consistency --- kiwi_scp/_constants.py | 8 ++++---- kiwi_scp/commands/cmd_shell.py | 2 +- kiwi_scp/rootkit.py | 16 ++++++++-------- kiwi_scp/yaml.py | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/kiwi_scp/_constants.py b/kiwi_scp/_constants.py index 843e901..31de4c9 100644 --- a/kiwi_scp/_constants.py +++ b/kiwi_scp/_constants.py @@ -18,7 +18,7 @@ RE_VARNAME = r"^[A-Za-z](?:[A-Za-z0-9\._-]*[A-Za-z0-9])$" # location of "kiwi_scp" module KIWI_ROOT = os.path.dirname(__file__) # default name of kiwi-scp file -KIWI_CONF_NAME = os.getenv('KIWI_CONF_NAME', "kiwi.yml") +KIWI_CONF_NAME = os.getenv("KIWI_CONF_NAME", "kiwi.yml") # default name of compose files COMPOSE_FILE_NAME = "docker-compose.yml" @@ -31,7 +31,7 @@ DEFAULT_KIWI_CONF_NAME = f"{KIWI_ROOT}/data/etc/kiwi_default.yml" DEFAULT_DOCKER_COMPOSE_NAME = f"{KIWI_ROOT}/data/etc/docker-compose_default.yml" # special config directory -CONF_DIRECTORY_NAME = 'config' +CONFIG_DIRECTORY_NAME = "config" # location for auxiliary Dockerfiles IMAGES_DIRECTORY_NAME = f"{KIWI_ROOT}/data/images" @@ -45,5 +45,5 @@ RESERVED_PROJECT_NAMES = [ # DOCKER IMAGE NAMES # name for auxiliary docker images -LOCAL_IMAGES_NAME = 'localhost/kiwi-scp/auxiliary' -DEFAULT_IMAGE_NAME = 'alpine:latest' +LOCAL_IMAGES_NAME = "localhost/kiwi-scp/auxiliary" +DEFAULT_IMAGE_NAME = "alpine:latest" diff --git a/kiwi_scp/commands/cmd_shell.py b/kiwi_scp/commands/cmd_shell.py index 65c2f40..2d1ca23 100644 --- a/kiwi_scp/commands/cmd_shell.py +++ b/kiwi_scp/commands/cmd_shell.py @@ -39,7 +39,7 @@ class ShellCommand(KiwiCommand): # shells from KiwiConfig shells = [ *(str(path) for path in instance.config.shells), - # as a last resort, fall back to '/bin/sh' and 'sh' + # as a last resort, fall back to "/bin/sh" and "sh" "/bin/sh", "sh", ] diff --git a/kiwi_scp/rootkit.py b/kiwi_scp/rootkit.py index 112b078..1be6ab6 100644 --- a/kiwi_scp/rootkit.py +++ b/kiwi_scp/rootkit.py @@ -30,12 +30,12 @@ class Rootkit: @functools.lru_cache(maxsize=None) def __exists(image_tag: str) -> bool: ps = DOCKER_EXE.run([ - 'images', - '--filter', f"reference={Rootkit.__image_name(image_tag)}", - '--format', '{{.Repository}}:{{.Tag}}' + "images", + "--filter", f"reference={Rootkit.__image_name(image_tag)}", + "--format", "{{.Repository}}:{{.Tag}}" ], stdout=subprocess.PIPE) - return str(ps.stdout, 'utf-8').strip() == Rootkit.__image_name(image_tag) + return str(ps.stdout, "utf-8").strip() == Rootkit.__image_name(image_tag) def __build_image(self) -> None: if Rootkit.__exists(self.image_tag): @@ -44,15 +44,15 @@ class Rootkit: if self.image_tag is None: _logger.info(f"Pulling image {Rootkit.__image_name(self.image_tag)}") DOCKER_EXE.run([ - 'pull', Rootkit.__image_name(self.image_tag) + "pull", Rootkit.__image_name(self.image_tag) ], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) else: _logger.info(f"Building image {Rootkit.__image_name(self.image_tag)}") DOCKER_EXE.run([ - 'build', - '-t', Rootkit.__image_name(self.image_tag), - '-f', f"{IMAGES_DIRECTORY_NAME}/{self.image_tag}.Dockerfile", + "build", + "-t", Rootkit.__image_name(self.image_tag), + "-f", f"{IMAGES_DIRECTORY_NAME}/{self.image_tag}.Dockerfile", f"{IMAGES_DIRECTORY_NAME}" ], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) diff --git a/kiwi_scp/yaml.py b/kiwi_scp/yaml.py index 1b8729c..5caff50 100644 --- a/kiwi_scp/yaml.py +++ b/kiwi_scp/yaml.py @@ -25,7 +25,7 @@ class YAML(ruamel.yaml.YAML): @staticmethod def _format_kiwi_yml(yml_string: str) -> str: # insert newline before every main key - yml_string = re.sub(r'^(\S)', r'\n\1', yml_string, flags=re.MULTILINE) + yml_string = re.sub(r"^(\S)", r"\n\1", yml_string, flags=re.MULTILINE) # load header comment from file with open(HEADER_KIWI_CONF_NAME, 'r') as stream: