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] <support@github.com>

* Update black

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
This commit is contained in:
dependabot[bot] 2022-02-10 14:13:40 +01:00 committed by GitHub
parent 199b57c833
commit d4fd8f3f0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 23 additions and 23 deletions

View File

@ -1,6 +1,6 @@
repos: repos:
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 21.12b0 rev: 22.1.0
hooks: hooks:
- id: black - id: black
args: args:

View File

@ -1,4 +1,4 @@
black==21.12b0 black==22.1.0
codecov==2.1.12 codecov==2.1.12
coverage==6.2 coverage==6.2
flake8-docstrings==1.6.0 flake8-docstrings==1.6.0

View File

@ -35,7 +35,7 @@ from .supervisor import APISupervisor
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)
MAX_CLIENT_SIZE: int = 1024 ** 2 * 16 MAX_CLIENT_SIZE: int = 1024**2 * 16
class RestAPI(CoreSysAttributes): class RestAPI(CoreSysAttributes):

View File

@ -52,17 +52,17 @@ class HwDisk(CoreSysAttributes):
def get_disk_total_space(self, path: Union[str, Path]) -> float: def get_disk_total_space(self, path: Union[str, Path]) -> float:
"""Return total space (GiB) on disk for path.""" """Return total space (GiB) on disk for path."""
total, _, _ = shutil.disk_usage(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: def get_disk_used_space(self, path: Union[str, Path]) -> float:
"""Return used space (GiB) on disk for path.""" """Return used space (GiB) on disk for path."""
_, used, _ = shutil.disk_usage(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: def get_disk_free_space(self, path: Union[str, Path]) -> float:
"""Return free space (GiB) on disk for path.""" """Return free space (GiB) on disk for path."""
_, _, free = shutil.disk_usage(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: def _get_mountinfo(self, path: str) -> str:
mountinfo = _MOUNTINFO.read_text(encoding="utf-8") mountinfo = _MOUNTINFO.read_text(encoding="utf-8")

View File

@ -52,7 +52,7 @@ def test_system_partition_disk(coresys: CoreSys):
def test_free_space(coresys): def test_free_space(coresys):
"""Test free space helper.""" """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") free = coresys.hardware.disk.get_disk_free_space("/data")
assert free == 2.0 assert free == 2.0
@ -60,7 +60,7 @@ def test_free_space(coresys):
def test_total_space(coresys): def test_total_space(coresys):
"""Test total space helper.""" """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") total = coresys.hardware.disk.get_disk_total_space("/data")
assert total == 10.0 assert total == 10.0
@ -68,7 +68,7 @@ def test_total_space(coresys):
def test_used_space(coresys): def test_used_space(coresys):
"""Test used space helper.""" """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") used = coresys.hardware.disk.get_disk_used_space("/data")
assert used == 8.0 assert used == 8.0

View File

@ -7,7 +7,7 @@ from supervisor.host.info import InfoCenter
def test_host_free_space(coresys): def test_host_free_space(coresys):
"""Test host free space.""" """Test host free space."""
info = InfoCenter(coresys) 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 free = info.free_space
assert free == 2.0 assert free == 2.0

View File

@ -96,10 +96,10 @@ async def test_free_space(coresys: CoreSys):
return True return True
test = TestClass(coresys) 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() 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() assert not await test.execute()

View File

@ -68,7 +68,7 @@ def test_defaults(coresys):
coresys.config.diagnostics = True coresys.config.diagnostics = True
coresys.core.state = CoreState.RUNNING 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, {}) filtered = filter_data(coresys, SAMPLE_EVENT, {})
assert ["installation_type", "supervised"] in filtered["tags"] assert ["installation_type", "supervised"] in filtered["tags"]
@ -97,7 +97,7 @@ def test_sanitize(coresys):
coresys.config.diagnostics = True coresys.config.diagnostics = True
coresys.core.state = CoreState.RUNNING 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, {}) filtered = filter_data(coresys, event, {})
assert ["url", "https://example.com"] in filtered["tags"] assert ["url", "https://example.com"] in filtered["tags"]
@ -120,7 +120,7 @@ def test_issues_on_report(coresys):
coresys.config.diagnostics = True coresys.config.diagnostics = True
coresys.core.state = CoreState.RUNNING 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, {}) event = filter_data(coresys, SAMPLE_EVENT, {})
assert "issues" in event["contexts"]["resolution"] assert "issues" in event["contexts"]["resolution"]
@ -140,7 +140,7 @@ def test_suggestions_on_report(coresys):
coresys.config.diagnostics = True coresys.config.diagnostics = True
coresys.core.state = CoreState.RUNNING 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, {}) event = filter_data(coresys, SAMPLE_EVENT, {})
assert "issues" in event["contexts"]["resolution"] assert "issues" in event["contexts"]["resolution"]
@ -163,7 +163,7 @@ def test_unhealthy_on_report(coresys):
coresys.core.state = CoreState.RUNNING coresys.core.state = CoreState.RUNNING
coresys.resolution.unhealthy = UnhealthyReason.DOCKER 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, {}) event = filter_data(coresys, SAMPLE_EVENT, {})
assert "issues" in event["contexts"]["resolution"] assert "issues" in event["contexts"]["resolution"]
@ -177,7 +177,7 @@ def test_images_report(coresys):
coresys.core.state = CoreState.RUNNING coresys.core.state = CoreState.RUNNING
coresys.resolution.evaluate.cached_images.add("my/test:image") 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, {}) event = filter_data(coresys, SAMPLE_EVENT, {})
assert "issues" in event["contexts"]["resolution"] assert "issues" in event["contexts"]["resolution"]

View File

@ -54,7 +54,7 @@ async def test_if_check_cleanup_issue(coresys: CoreSys):
assert coresys.resolution.issues[-1].type == IssueType.FREE_SPACE 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() await coresys.resolution.check.check_system()
assert len(coresys.resolution.issues) == 0 assert len(coresys.resolution.issues) == 0

View File

@ -22,7 +22,7 @@ async def test_check(coresys: CoreSys):
assert len(coresys.resolution.issues) == 0 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() await free_space.run_check()
assert len(coresys.resolution.issues) == 0 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)): with patch("shutil.disk_usage", return_value=(1, 1, 1)):
assert await free_space.approve_check() 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() assert not await free_space.approve_check()

View File

@ -24,7 +24,7 @@ async def test_fixup(coresys: CoreSys):
mock_repositorie = AsyncMock() mock_repositorie = AsyncMock()
coresys.store.repositories["test"] = mock_repositorie 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() await store_execute_reload()
assert mock_repositorie.load.called assert mock_repositorie.load.called

View File

@ -30,7 +30,7 @@ async def test_fixup(coresys: CoreSys, tmp_path):
mock_repositorie.git.path = test_repo mock_repositorie.git.path = test_repo
coresys.store.repositories["test"] = mock_repositorie 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() await store_execute_reset()
assert not test_repo.exists() assert not test_repo.exists()