From 81c7bbd8811148e1f722da3358d9bfc0da3cc766 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 22 Aug 2022 00:08:31 +0200 Subject: [PATCH] chore(deps): update devdependencies (non-major) (#366) --- dockertidy/autostop.py | 6 +-- dockertidy/garbage_collector.py | 6 +-- dockertidy/logger.py | 18 ++++--- dockertidy/test/unit/test_garbagecollector.py | 4 +- poetry.lock | 54 ++++++++++--------- pyproject.toml | 6 +-- setup.cfg | 6 ++- 7 files changed, 54 insertions(+), 46 deletions(-) diff --git a/dockertidy/autostop.py b/dockertidy/autostop.py index 9eec3d6..25396e3 100644 --- a/dockertidy/autostop.py +++ b/dockertidy/autostop.py @@ -58,9 +58,9 @@ class AutoStop: try: client.stop(cid) except requests.exceptions.Timeout as e: - self.logger.warn("Failed to stop container {id}: {msg}".format(id=cid, msg=str(e))) + self.logger.warning("Failed to stop container {id}: {msg}".format(id=cid, msg=str(e))) except docker.errors.APIError as e: - self.logger.warn("Error stopping {id}: {msg}".format(id=cid, msg=str(e))) + self.logger.warning("Error stopping {id}: {msg}".format(id=cid, msg=str(e))) def _build_container_matcher(self, prefixes): @@ -89,4 +89,4 @@ class AutoStop: self.stop_containers() if not config["stop"]["max_run_time"]: - self.logger.warn("Skipped, no arguments given") + self.logger.warning("Skipped, no arguments given") diff --git a/dockertidy/garbage_collector.py b/dockertidy/garbage_collector.py index 3b73981..f45dd59 100644 --- a/dockertidy/garbage_collector.py +++ b/dockertidy/garbage_collector.py @@ -252,14 +252,14 @@ class GarbageCollector: return func(**kwargs) except requests.exceptions.Timeout as e: params = ",".join("%s=%s" % item for item in kwargs.items()) # noqa - self.logger.warn( + self.logger.warning( "Failed to call {name} {params} {msg}".format( name=func.__name__, params=params, msg=str(e) ) ) except docker.errors.APIError as e: params = ",".join("%s=%s" % item for item in kwargs.items()) # noqa - self.logger.warn( + self.logger.warning( "Error calling {name} {params} {msg}".format( name=func.__name__, params=params, msg=str(e) ) @@ -330,4 +330,4 @@ class GarbageCollector: not config["gc"]["max_container_age"] and not config["gc"]["max_image_age"] and not config["gc"]["dangling_volumes"] ): - self.logger.warn("Skipped, no arguments given") + self.logger.ing("Skipped, no arguments given") diff --git a/dockertidy/logger.py b/dockertidy/logger.py index 4a35668..d80ddb8 100644 --- a/dockertidy/logger.py +++ b/dockertidy/logger.py @@ -63,11 +63,11 @@ class MultilineJsonFormatter(jsonlogger.JsonFormatter): class Log: """Base logging object.""" - def __init__(self, level=logging.WARN, name="dockertidy", json=False): + def __init__(self, level=logging.WARNING, name="dockertidy", json=False): self.logger = logging.getLogger(name) self.logger.setLevel(level) self.logger.addHandler(self._get_error_handler(json=json)) - self.logger.addHandler(self._get_warn_handler(json=json)) + self.logger.addHandler(self._get_warning_handler(json=json)) self.logger.addHandler(self._get_info_handler(json=json)) self.logger.addHandler(self._get_critical_handler(json=json)) self.logger.addHandler(self._get_debug_handler(json=json)) @@ -88,13 +88,15 @@ class Log: return handler - def _get_warn_handler(self, json=False): + def _get_warning_handler(self, json=False): handler = logging.StreamHandler(sys.stdout) - handler.setLevel(logging.WARN) - handler.addFilter(LogFilter(logging.WARN)) + handler.setLevel(logging.WARNING) + handler.addFilter(LogFilter(logging.WARNING)) handler.setFormatter( MultilineFormatter( - self.warn(CONSOLE_FORMAT.format(colorama.Fore.YELLOW, colorama.Style.RESET_ALL)) + self.warning( + CONSOLE_FORMAT.format(colorama.Fore.YELLOW, colorama.Style.RESET_ALL) + ) ) ) @@ -164,8 +166,8 @@ class Log: """Format error messages and return string.""" return msg - def warn(self, msg): - """Format warn messages and return string.""" + def warning(self, msg): + """Format warning messages and return string.""" return msg def info(self, msg): diff --git a/dockertidy/test/unit/test_garbagecollector.py b/dockertidy/test/unit/test_garbagecollector.py index 6efa0b9..1f2f39b 100644 --- a/dockertidy/test/unit/test_garbagecollector.py +++ b/dockertidy/test/unit/test_garbagecollector.py @@ -358,7 +358,7 @@ def test_api_call_with_timeout(mocker, gc): gc._api_call(func, image=image) func.assert_called_once_with(image="abcd") - mock_log.warn.assert_called_once_with("Failed to call remove_image " + "image=abcd msg") + mock_log.warning.assert_called_once_with("Failed to call remove_image " + "image=abcd msg") def test_api_call_with_api_error(mocker, gc): @@ -376,7 +376,7 @@ def test_api_call_with_api_error(mocker, gc): gc._api_call(func, image=image) func.assert_called_once_with(image="abcd") - mock_log.warn.assert_called_once_with( + mock_log.warning.assert_called_once_with( "Error calling remove_image image=abcd " '409 Client Error for dummy: Conflict ("failed")' ) diff --git a/poetry.lock b/poetry.lock index 1f038a0..771be8e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -38,10 +38,10 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [package.extras] -dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit", "cloudpickle"] -docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"] -tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "cloudpickle"] -tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "cloudpickle"] +tests_no_zope = ["cloudpickle", "pytest-mypy-plugins", "mypy", "six", "pytest (>=4.3.0)", "pympler", "hypothesis", "coverage[toml] (>=5.0.2)"] +tests = ["cloudpickle", "zope.interface", "pytest-mypy-plugins", "mypy", "six", "pytest (>=4.3.0)", "pympler", "hypothesis", "coverage[toml] (>=5.0.2)"] +docs = ["sphinx-notfound-page", "zope.interface", "sphinx", "furo"] +dev = ["cloudpickle", "pre-commit", "sphinx-notfound-page", "sphinx", "furo", "zope.interface", "pytest-mypy-plugins", "mypy", "six", "pytest (>=4.3.0)", "pympler", "hypothesis", "coverage[toml] (>=5.0.2)"] [[package]] name = "backports.zoneinfo" @@ -69,9 +69,9 @@ PyYAML = ">=5.3.1" stevedore = ">=1.20.0" [package.extras] -test = ["coverage (>=4.5.4)", "fixtures (>=3.0.0)", "flake8 (>=4.0.0)", "stestr (>=2.5.0)", "testscenarios (>=0.5.0)", "testtools (>=2.3.0)", "toml", "beautifulsoup4 (>=4.8.0)", "pylint (==1.9.4)"] -toml = ["toml"] yaml = ["pyyaml"] +toml = ["toml"] +test = ["pylint (==1.9.4)", "beautifulsoup4 (>=4.8.0)", "toml", "testtools (>=2.3.0)", "testscenarios (>=0.5.0)", "stestr (>=2.5.0)", "flake8 (>=4.0.0)", "fixtures (>=3.0.0)", "coverage (>=4.5.4)"] [[package]] name = "certifi" @@ -238,7 +238,7 @@ pydocstyle = ">=2.1" [[package]] name = "flake8-eradicate" -version = "1.2.1" +version = "1.3.0" description = "Flake8 plugin to find commented out code" category = "dev" optional = false @@ -247,7 +247,7 @@ python-versions = ">=3.6,<4.0" [package.dependencies] attrs = "*" eradicate = ">=2.0,<3.0" -flake8 = ">=3.5,<5" +flake8 = ">=3.5,<6" [[package]] name = "flake8-isort" @@ -266,12 +266,16 @@ test = ["pytest-cov"] [[package]] name = "flake8-logging-format" -version = "0.6.0" -description = "Flake8 extension to validate (lack of) logging format strings" +version = "0.7.5" +description = "" category = "dev" optional = false python-versions = "*" +[package.extras] +lint = ["flake8"] +test = ["pytest", "pytest-cov", "pyhamcrest"] + [[package]] name = "flake8-pep3101" version = "1.3.0" @@ -352,8 +356,8 @@ typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} zipp = ">=0.5" [package.extras] -docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] +testing = ["importlib-resources (>=1.3)", "pytest-mypy", "pytest-black (>=0.3.7)", "flufl.flake8", "pyfakefs", "pep517", "packaging", "pytest-enabler (>=1.0.1)", "pytest-cov", "pytest-flake8", "pytest-checkdocs (>=2.4)", "pytest (>=4.6)"] +docs = ["rst.linker (>=1.9)", "jaraco.packaging (>=8.2)", "sphinx"] [[package]] name = "importlib-resources" @@ -485,11 +489,11 @@ python-versions = ">=2.6" [[package]] name = "pep8-naming" -version = "0.13.1" +version = "0.13.2" description = "Check PEP-8 naming conventions, plugin for flake8" category = "dev" optional = false -python-versions = "*" +python-versions = ">=3.7" [package.dependencies] flake8 = ">=3.9.1" @@ -564,7 +568,7 @@ optional = false python-versions = ">=3.6.8" [package.extras] -diagrams = ["railroad-diagrams", "jinja2"] +diagrams = ["jinja2", "railroad-diagrams"] [[package]] name = "pyrsistent" @@ -594,7 +598,7 @@ py = ">=1.8.2" tomli = ">=1.0.0" [package.extras] -testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] +testing = ["xmlschema", "requests", "pygments (>=2.7.2)", "nose", "mock", "hypothesis (>=3.56)", "argcomplete"] [[package]] name = "pytest-cov" @@ -714,8 +718,8 @@ idna = ">=2.5,<4" urllib3 = ">=1.21.1,<1.27" [package.extras] -socks = ["PySocks (>=1.5.6,!=1.5.7)"] use_chardet_on_py3 = ["chardet (>=3.0.2,<6)"] +socks = ["PySocks (>=1.5.6,!=1.5.7)"] [[package]] name = "ruamel.yaml" @@ -834,9 +838,9 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" [package.extras] -brotli = ["brotlicffi (>=0.8.0)", "brotli (>=1.0.9)", "brotlipy (>=0.6.0)"] -secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] +secure = ["ipaddress", "certifi", "idna (>=2.0.0)", "cryptography (>=1.3.4)", "pyOpenSSL (>=0.14)"] +brotli = ["brotlipy (>=0.6.0)", "brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] [[package]] name = "websocket-client" @@ -874,7 +878,7 @@ docs = ["jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "jaraco.packaging (>=9) [metadata] lock-version = "1.1" python-versions = "^3.7.0" -content-hash = "cab75f3e436ccd9e08aab397aac9598df95cc3d6cec766ef419b547cda4f39b9" +content-hash = "ce03a1f3623894bc8ba7409e83dc3aa80776ab3703ce4204c78bc254ebe7fb40" [metadata.files] anyconfig = [ @@ -1015,15 +1019,15 @@ flake8-docstrings = [ {file = "flake8_docstrings-1.6.0-py2.py3-none-any.whl", hash = "sha256:99cac583d6c7e32dd28bbfbef120a7c0d1b6dde4adb5a9fd441c4227a6534bde"}, ] flake8-eradicate = [ - {file = "flake8-eradicate-1.2.1.tar.gz", hash = "sha256:e486f8ab7e2dba3667223688e9239158fbf4ecaa88125e2283bcda81171412b7"}, - {file = "flake8_eradicate-1.2.1-py3-none-any.whl", hash = "sha256:00d77faefb64cef18b3c1b48a004c3a2ad663aa3cf85650f422437d25ece6441"}, + {file = "flake8-eradicate-1.3.0.tar.gz", hash = "sha256:e4c98f00d17dc8653e3388cac2624cd81e9735de2fd4a8dcf99029633ebd7a63"}, + {file = "flake8_eradicate-1.3.0-py3-none-any.whl", hash = "sha256:85a71e0c5f4e07f7c6c5fec520483561fd6bd295417d622855bdeade99242e3d"}, ] flake8-isort = [ {file = "flake8-isort-4.2.0.tar.gz", hash = "sha256:26571500cd54976bbc0cf1006ffbcd1a68dd102f816b7a1051b219616ba9fee0"}, {file = "flake8_isort-4.2.0-py3-none-any.whl", hash = "sha256:5b87630fb3719bf4c1833fd11e0d9534f43efdeba524863e15d8f14a7ef6adbf"}, ] flake8-logging-format = [ - {file = "flake8-logging-format-0.6.0.tar.gz", hash = "sha256:ca5f2b7fc31c3474a0aa77d227e022890f641a025f0ba664418797d979a779f8"}, + {file = "flake8-logging-format-0.7.5.tar.gz", hash = "sha256:54f7e349c934ce5c594f251885bc2240e99f6b48752a672a8fc7e3d1388352bb"}, ] flake8-pep3101 = [ {file = "flake8-pep3101-1.3.0.tar.gz", hash = "sha256:86e3eb4e42de8326dcd98ebdeaf9a3c6854203a48f34aeb3e7e8ed948107f512"}, @@ -1096,8 +1100,8 @@ pbr = [ {file = "pbr-5.9.0.tar.gz", hash = "sha256:e8dca2f4b43560edef58813969f52a56cef023146cbb8931626db80e6c1c4308"}, ] pep8-naming = [ - {file = "pep8-naming-0.13.1.tar.gz", hash = "sha256:3af77cdaa9c7965f7c85a56cd579354553c9bbd3fdf3078a776f12db54dd6944"}, - {file = "pep8_naming-0.13.1-py3-none-any.whl", hash = "sha256:f7867c1a464fe769be4f972ef7b79d6df1d9aff1b1f04ecf738d471963d3ab9c"}, + {file = "pep8-naming-0.13.2.tar.gz", hash = "sha256:93eef62f525fd12a6f8c98f4dcc17fa70baae2f37fa1f73bec00e3e44392fa48"}, + {file = "pep8_naming-0.13.2-py3-none-any.whl", hash = "sha256:59e29e55c478db69cffbe14ab24b5bd2cd615c0413edf790d47d3fb7ba9a4e23"}, ] pkgutil-resolve-name = [ {file = "pkgutil_resolve_name-1.3.10-py3-none-any.whl", hash = "sha256:ca27cc078d25c5ad71a9de0a7a330146c4e014c2462d9af19c6b828280649c5e"}, diff --git a/pyproject.toml b/pyproject.toml index 521dffe..ca58d72 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,13 +62,13 @@ flake8 = "4.0.1" flake8-blind-except = "0.2.1" flake8-builtins = "1.5.3" flake8-docstrings = "1.6.0" -flake8-eradicate = "1.2.1" +flake8-eradicate = "1.3.0" flake8-isort = "4.2.0" -flake8-logging-format = "0.6.0" +flake8-logging-format = "0.7.5" flake8-pep3101 = "1.3.0" flake8-polyfill = "1.0.2" flake8-quotes = "3.3.1" -pep8-naming = "0.13.1" +pep8-naming = "0.13.2" pydocstyle = "6.1.1" pytest = "7.1.2" pytest-cov = "3.0.0" diff --git a/setup.cfg b/setup.cfg index 439b889..595f550 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,8 +6,10 @@ # D105: Missing docstring in magic method # D107: Missing docstring in __init__ # D202: No blank lines allowed after function docstring -# W503:Line break occurred before a binary operator -ignore = D102, D103, D105, D107, D202, W503 +# G001: Logging statements should not use string.format() for their first argument +# G004: Logging statements should not use f"..." for their first argument +# W503: Line break occurred before a binary operator +ignore = D102, D103, D105, D107, D202, G001, G004, W503 max-line-length = 99 inline-quotes = double exclude = .git, __pycache__, build, dist, test, *.pyc, *.egg-info, .cache, .eggs, env*