diff --git a/README.md b/README.md index 51b77c84..f82c0310 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ See [https://github.com/camptocamp/c2cwsgiutils] for other parameters. ### Template engines * `type`: can be `mako` or `shell` -* `data`: a dictionay of key/value to pass as a parameter to the template engine +* `data`: a dictionary of key/value to pass as a parameter to the template engine * `environment_variables`: If `true`, take into account the process' environment variables if not found in `data`. Only variables starting with a prefix listed in `SCM_ENV_PREFIXES` (list separated by `:`) are allowed. diff --git a/acceptance_tests/acceptance/normal/conftest.py b/acceptance_tests/acceptance/normal/conftest.py index d866472d..56bc5bfa 100644 --- a/acceptance_tests/acceptance/normal/conftest.py +++ b/acceptance_tests/acceptance/normal/conftest.py @@ -16,7 +16,9 @@ def what() -> bool: if r.status_code == 200: json = r.json() if len(json["slaves"]) != 3: - raise Exception(f"Not seeing 3 slaves but {len(json['slaves'])}.",) + raise Exception( + f"Not seeing 3 slaves but {len(json['slaves'])}.", + ) for name, status in json["slaves"].items(): if name == "slave-others": if set(status["sources"].keys()) != {"master"}: diff --git a/acceptance_tests/acceptance/normal/test_workflow.py b/acceptance_tests/acceptance/normal/test_workflow.py index 7c413f82..46b24966 100644 --- a/acceptance_tests/acceptance/normal/test_workflow.py +++ b/acceptance_tests/acceptance/normal/test_workflow.py @@ -3,7 +3,6 @@ import time import pytest - from acceptance import get_hash, wait_sync diff --git a/app/shared_config_manager/__init__.py b/app/shared_config_manager/__init__.py index 415363b6..97a20753 100644 --- a/app/shared_config_manager/__init__.py +++ b/app/shared_config_manager/__init__.py @@ -1,6 +1,7 @@ +import os + import c2cwsgiutils.pyramid from c2cwsgiutils.health_check import HealthCheck -import os from pyramid.config import Configurator from . import sources diff --git a/app/shared_config_manager/scripts/shared_config_slave.py b/app/shared_config_manager/scripts/shared_config_slave.py index 159ae98f..7ab74670 100755 --- a/app/shared_config_manager/scripts/shared_config_slave.py +++ b/app/shared_config_manager/scripts/shared_config_slave.py @@ -6,7 +6,8 @@ from c2cwsgiutils import setup_process -from shared_config_manager import slave_status # noqa: F401, pylint: disable=unused-import +from shared_config_manager import \ + slave_status # noqa: F401, pylint: disable=unused-import from shared_config_manager import sources setup_process.init() diff --git a/app/shared_config_manager/sources/__init__.py b/app/shared_config_manager/sources/__init__.py index 7454ac17..c7f324a1 100644 --- a/app/shared_config_manager/sources/__init__.py +++ b/app/shared_config_manager/sources/__init__.py @@ -7,9 +7,8 @@ from typing import Any, Dict, Mapping, Optional, Tuple import yaml -from pyramid.httpexceptions import HTTPBadRequest, HTTPForbidden, HTTPNotFound - from c2cwsgiutils import broadcast +from pyramid.httpexceptions import HTTPBadRequest, HTTPForbidden, HTTPNotFound from . import base, git, mode, rclone, rsync diff --git a/app/shared_config_manager/sources/base.py b/app/shared_config_manager/sources/base.py index bdc7f623..40811d18 100644 --- a/app/shared_config_manager/sources/base.py +++ b/app/shared_config_manager/sources/base.py @@ -88,8 +88,8 @@ def _do_fetch(self): while True: try: LOG.info("Doing a fetch of %s", self.get_id()) - responce = requests.get(url, stream=True) - responce.raise_for_status() + response = requests.get(url, stream=True) + response.raise_for_status() if os.path.exists(path): shutil.rmtree(path) os.makedirs(path, exist_ok=True) @@ -106,7 +106,7 @@ def _do_fetch(self): cwd=path, stdin=subprocess.PIPE, ) - shutil.copyfileobj(responce.raw, tar.stdin) # type: ignore + shutil.copyfileobj(response.raw, tar.stdin) # type: ignore tar.stdin.close() # type: ignore assert tar.wait() == 0 return diff --git a/app/shared_config_manager/sources/rclone.py b/app/shared_config_manager/sources/rclone.py index 7cd5277a..1c8276c9 100644 --- a/app/shared_config_manager/sources/rclone.py +++ b/app/shared_config_manager/sources/rclone.py @@ -1,8 +1,8 @@ -from .base import BaseSource - import os import re +from .base import BaseSource + class RcloneSource(BaseSource): def __init__(self, id_, config, is_master, default_key): diff --git a/app/shared_config_manager/template_engines/mako.py b/app/shared_config_manager/template_engines/mako.py index 00f79b20..93ba82d6 100644 --- a/app/shared_config_manager/template_engines/mako.py +++ b/app/shared_config_manager/template_engines/mako.py @@ -1,6 +1,7 @@ -from .base import BaseEngine import mako.template +from .base import BaseEngine + class MakoEngine(BaseEngine): def __init__(self, source_id, config): diff --git a/app/tests/sources/test_git.py b/app/tests/sources/test_git.py index 62b3af91..950c6f86 100644 --- a/app/tests/sources/test_git.py +++ b/app/tests/sources/test_git.py @@ -1,8 +1,9 @@ import os -import pytest import subprocess import tempfile +import pytest + from shared_config_manager import sources TEMP_DIR = tempfile.gettempdir() diff --git a/app/tests/template_engines/conftest.py b/app/tests/template_engines/conftest.py index fe19203d..fee827c1 100644 --- a/app/tests/template_engines/conftest.py +++ b/app/tests/template_engines/conftest.py @@ -1,7 +1,8 @@ -import pytest import shutil from tempfile import mkdtemp +import pytest + @pytest.yield_fixture() def temp_dir(): diff --git a/app/tests/template_engines/test_mako.py b/app/tests/template_engines/test_mako.py index dddbfcd0..ab9056a1 100644 --- a/app/tests/template_engines/test_mako.py +++ b/app/tests/template_engines/test_mako.py @@ -1,5 +1,5 @@ -import pathlib import os +import pathlib from shared_config_manager import template_engines