From d4fd8f3f0d0ec943fa8d4c76a561d701a42bf80e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 10 Feb 2022 14:13:40 +0100 Subject: [PATCH] Bump black from 21.12b0 to 22.1.0 (#3425) * Bump black from 21.12b0 to 22.1.0 Bumps [black](https://github.com/psf/black) from 21.12b0 to 22.1.0. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/commits/22.1.0) --- updated-dependencies: - dependency-name: black dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Update black Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Pascal Vizeli --- .pre-commit-config.yaml | 2 +- requirements_tests.txt | 2 +- supervisor/api/__init__.py | 2 +- supervisor/hardware/disk.py | 6 +++--- tests/hardware/test_disk.py | 6 +++--- tests/host/test_info.py | 2 +- tests/jobs/test_job_decorator.py | 4 ++-- tests/misc/test_filter_data.py | 12 ++++++------ tests/resolution/check/test_check.py | 2 +- tests/resolution/check/test_check_free_space.py | 4 ++-- tests/resolution/fixup/test_store_execute_reload.py | 2 +- tests/resolution/fixup/test_store_execute_reset.py | 2 +- 12 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 603b178db..86b601ec7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 21.12b0 + rev: 22.1.0 hooks: - id: black args: diff --git a/requirements_tests.txt b/requirements_tests.txt index 888fb8119..d19446c02 100644 --- a/requirements_tests.txt +++ b/requirements_tests.txt @@ -1,4 +1,4 @@ -black==21.12b0 +black==22.1.0 codecov==2.1.12 coverage==6.2 flake8-docstrings==1.6.0 diff --git a/supervisor/api/__init__.py b/supervisor/api/__init__.py index 71213935b..3f79ebae2 100644 --- a/supervisor/api/__init__.py +++ b/supervisor/api/__init__.py @@ -35,7 +35,7 @@ from .supervisor import APISupervisor _LOGGER: logging.Logger = logging.getLogger(__name__) -MAX_CLIENT_SIZE: int = 1024 ** 2 * 16 +MAX_CLIENT_SIZE: int = 1024**2 * 16 class RestAPI(CoreSysAttributes): diff --git a/supervisor/hardware/disk.py b/supervisor/hardware/disk.py index 3666f74a3..3fc1605c2 100644 --- a/supervisor/hardware/disk.py +++ b/supervisor/hardware/disk.py @@ -52,17 +52,17 @@ class HwDisk(CoreSysAttributes): def get_disk_total_space(self, path: Union[str, Path]) -> float: """Return total space (GiB) on disk for path.""" total, _, _ = shutil.disk_usage(path) - return round(total / (1024.0 ** 3), 1) + return round(total / (1024.0**3), 1) def get_disk_used_space(self, path: Union[str, Path]) -> float: """Return used space (GiB) on disk for path.""" _, used, _ = shutil.disk_usage(path) - return round(used / (1024.0 ** 3), 1) + return round(used / (1024.0**3), 1) def get_disk_free_space(self, path: Union[str, Path]) -> float: """Return free space (GiB) on disk for path.""" _, _, free = shutil.disk_usage(path) - return round(free / (1024.0 ** 3), 1) + return round(free / (1024.0**3), 1) def _get_mountinfo(self, path: str) -> str: mountinfo = _MOUNTINFO.read_text(encoding="utf-8") diff --git a/tests/hardware/test_disk.py b/tests/hardware/test_disk.py index 84e8e0ef6..ad48b8665 100644 --- a/tests/hardware/test_disk.py +++ b/tests/hardware/test_disk.py @@ -52,7 +52,7 @@ def test_system_partition_disk(coresys: CoreSys): def test_free_space(coresys): """Test free space helper.""" - with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0 ** 3))): + with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0**3))): free = coresys.hardware.disk.get_disk_free_space("/data") assert free == 2.0 @@ -60,7 +60,7 @@ def test_free_space(coresys): def test_total_space(coresys): """Test total space helper.""" - with patch("shutil.disk_usage", return_value=(10 * (1024.0 ** 3), 42, 42)): + with patch("shutil.disk_usage", return_value=(10 * (1024.0**3), 42, 42)): total = coresys.hardware.disk.get_disk_total_space("/data") assert total == 10.0 @@ -68,7 +68,7 @@ def test_total_space(coresys): def test_used_space(coresys): """Test used space helper.""" - with patch("shutil.disk_usage", return_value=(42, 8 * (1024.0 ** 3), 42)): + with patch("shutil.disk_usage", return_value=(42, 8 * (1024.0**3), 42)): used = coresys.hardware.disk.get_disk_used_space("/data") assert used == 8.0 diff --git a/tests/host/test_info.py b/tests/host/test_info.py index 664f65056..630780a3c 100644 --- a/tests/host/test_info.py +++ b/tests/host/test_info.py @@ -7,7 +7,7 @@ from supervisor.host.info import InfoCenter def test_host_free_space(coresys): """Test host free space.""" info = InfoCenter(coresys) - with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0 ** 3))): + with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0**3))): free = info.free_space assert free == 2.0 diff --git a/tests/jobs/test_job_decorator.py b/tests/jobs/test_job_decorator.py index 0e21ce184..3bb5bc920 100644 --- a/tests/jobs/test_job_decorator.py +++ b/tests/jobs/test_job_decorator.py @@ -96,10 +96,10 @@ async def test_free_space(coresys: CoreSys): return True test = TestClass(coresys) - with patch("shutil.disk_usage", return_value=(42, 42, (1024.0 ** 3))): + with patch("shutil.disk_usage", return_value=(42, 42, (1024.0**3))): assert await test.execute() - with patch("shutil.disk_usage", return_value=(42, 42, (512.0 ** 3))): + with patch("shutil.disk_usage", return_value=(42, 42, (512.0**3))): assert not await test.execute() diff --git a/tests/misc/test_filter_data.py b/tests/misc/test_filter_data.py index a6335fb3c..d2b6d61fb 100644 --- a/tests/misc/test_filter_data.py +++ b/tests/misc/test_filter_data.py @@ -68,7 +68,7 @@ def test_defaults(coresys): coresys.config.diagnostics = True coresys.core.state = CoreState.RUNNING - with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0 ** 3))): + with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0**3))): filtered = filter_data(coresys, SAMPLE_EVENT, {}) assert ["installation_type", "supervised"] in filtered["tags"] @@ -97,7 +97,7 @@ def test_sanitize(coresys): coresys.config.diagnostics = True coresys.core.state = CoreState.RUNNING - with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0 ** 3))): + with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0**3))): filtered = filter_data(coresys, event, {}) assert ["url", "https://example.com"] in filtered["tags"] @@ -120,7 +120,7 @@ def test_issues_on_report(coresys): coresys.config.diagnostics = True coresys.core.state = CoreState.RUNNING - with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0 ** 3))): + with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0**3))): event = filter_data(coresys, SAMPLE_EVENT, {}) assert "issues" in event["contexts"]["resolution"] @@ -140,7 +140,7 @@ def test_suggestions_on_report(coresys): coresys.config.diagnostics = True coresys.core.state = CoreState.RUNNING - with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0 ** 3))): + with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0**3))): event = filter_data(coresys, SAMPLE_EVENT, {}) assert "issues" in event["contexts"]["resolution"] @@ -163,7 +163,7 @@ def test_unhealthy_on_report(coresys): coresys.core.state = CoreState.RUNNING coresys.resolution.unhealthy = UnhealthyReason.DOCKER - with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0 ** 3))): + with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0**3))): event = filter_data(coresys, SAMPLE_EVENT, {}) assert "issues" in event["contexts"]["resolution"] @@ -177,7 +177,7 @@ def test_images_report(coresys): coresys.core.state = CoreState.RUNNING coresys.resolution.evaluate.cached_images.add("my/test:image") - with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0 ** 3))): + with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0**3))): event = filter_data(coresys, SAMPLE_EVENT, {}) assert "issues" in event["contexts"]["resolution"] diff --git a/tests/resolution/check/test_check.py b/tests/resolution/check/test_check.py index 65715fd95..0c1e50781 100644 --- a/tests/resolution/check/test_check.py +++ b/tests/resolution/check/test_check.py @@ -54,7 +54,7 @@ async def test_if_check_cleanup_issue(coresys: CoreSys): assert coresys.resolution.issues[-1].type == IssueType.FREE_SPACE - with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0 ** 3))): + with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0**3))): await coresys.resolution.check.check_system() assert len(coresys.resolution.issues) == 0 diff --git a/tests/resolution/check/test_check_free_space.py b/tests/resolution/check/test_check_free_space.py index ea626eafe..5829dbd61 100644 --- a/tests/resolution/check/test_check_free_space.py +++ b/tests/resolution/check/test_check_free_space.py @@ -22,7 +22,7 @@ async def test_check(coresys: CoreSys): assert len(coresys.resolution.issues) == 0 - with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0 ** 3))): + with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0**3))): await free_space.run_check() assert len(coresys.resolution.issues) == 0 @@ -41,7 +41,7 @@ async def test_approve(coresys: CoreSys): with patch("shutil.disk_usage", return_value=(1, 1, 1)): assert await free_space.approve_check() - with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0 ** 3))): + with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0**3))): assert not await free_space.approve_check() diff --git a/tests/resolution/fixup/test_store_execute_reload.py b/tests/resolution/fixup/test_store_execute_reload.py index 3048cffcc..5ecd7e612 100644 --- a/tests/resolution/fixup/test_store_execute_reload.py +++ b/tests/resolution/fixup/test_store_execute_reload.py @@ -24,7 +24,7 @@ async def test_fixup(coresys: CoreSys): mock_repositorie = AsyncMock() coresys.store.repositories["test"] = mock_repositorie - with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0 ** 3))): + with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0**3))): await store_execute_reload() assert mock_repositorie.load.called diff --git a/tests/resolution/fixup/test_store_execute_reset.py b/tests/resolution/fixup/test_store_execute_reset.py index c307581d0..9137f8877 100644 --- a/tests/resolution/fixup/test_store_execute_reset.py +++ b/tests/resolution/fixup/test_store_execute_reset.py @@ -30,7 +30,7 @@ async def test_fixup(coresys: CoreSys, tmp_path): mock_repositorie.git.path = test_repo coresys.store.repositories["test"] = mock_repositorie - with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0 ** 3))): + with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0**3))): await store_execute_reset() assert not test_repo.exists()