mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-07 17:26:32 +00:00
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:
parent
199b57c833
commit
d4fd8f3f0d
@ -1,6 +1,6 @@
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 21.12b0
|
||||
rev: 22.1.0
|
||||
hooks:
|
||||
- id: black
|
||||
args:
|
||||
|
@ -1,4 +1,4 @@
|
||||
black==21.12b0
|
||||
black==22.1.0
|
||||
codecov==2.1.12
|
||||
coverage==6.2
|
||||
flake8-docstrings==1.6.0
|
||||
|
@ -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):
|
||||
|
@ -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")
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
||||
|
||||
|
@ -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"]
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user