]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
No longer mention black and fix indentation
authorPyfisch <pyfisch@posteo.org>
Sun, 11 Sep 2022 12:25:14 +0000 (14:25 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 18 Sep 2022 07:15:40 +0000 (09:15 +0200)
Mkosi uses 4 spaces for indentation, fix 2 functions with 8 spaces.
Since #779 formatting with black wasn't enforced but still mentioned as required in README.

README.md
mkosi/backend.py
pyproject.toml
tests/test_init.py
tests/test_parse_load_args.py

index bc4cea7be040a82b36e51e80e6fe4c45305f9039..9e386b2415957da63f91dbd598dffeaa0a740e36 100644 (file)
--- a/README.md
+++ b/README.md
@@ -33,9 +33,8 @@ This will install mkosi in editable mode to `~/.local/bin/mkosi`, allowing you
 to use your own changes right away.
 
 For development you also need [mypy](https://github.com/python/mypy), for type
-checking, [pytest](https://github.com/pytest-dev/pytest), to run tests, and
-[black](https://github.com/psf/black), for code formatting. We check tests,
-typing and code formatting in CI (see `.github/workflows`), but you can run the
+checking, and [pytest](https://github.com/pytest-dev/pytest), to run tests.
+We check tests and typing in CI (see `.github/workflows`), but you can run the
 tests locally as well.
 
 ## zipapp
index 25f024513b01854c90be74955b2d4a2862a88d35..6ca98f315bea54d6c718115d291c7d55bc1013eb 100644 (file)
@@ -680,10 +680,10 @@ def nspawn_knows_arg(arg: str) -> bool:
 
 
 def format_rlimit(rlimit: int) -> str:
-        limits = resource.getrlimit(rlimit)
-        soft = "infinity" if limits[0] == resource.RLIM_INFINITY else str(limits[0])
-        hard = "infinity" if limits[1] == resource.RLIM_INFINITY else str(limits[1])
-        return f"{soft}:{hard}"
+    limits = resource.getrlimit(rlimit)
+    soft = "infinity" if limits[0] == resource.RLIM_INFINITY else str(limits[0])
+    hard = "infinity" if limits[1] == resource.RLIM_INFINITY else str(limits[1])
+    return f"{soft}:{hard}"
 
 
 def nspawn_rlimit_params() -> Sequence[str]:
index cd461cf7e1f87460811b937baff018cc23d027bf..831ee4ab9a084614a6b49cbd92839db110d1dc2b 100644 (file)
@@ -1,7 +1,3 @@
-[tool.black]
-line-length = 119
-target-version = ['py37']
-
 [tool.isort]
 profile = "black"
 multi_line_output = 3
index 7c65ca39e52410ca6acf1735083775644ca265a0..5cda63385a553211ea12386a64b31e359eba13aa 100644 (file)
@@ -32,29 +32,29 @@ def test_strip_suffixes() -> None:
 
 
 def test_copy_file(tmpdir: Path) -> None:
-        dir_path = Path(tmpdir)
-        file_1 = Path(dir_path) / "file_1.txt"
-        file_2 = Path(dir_path) / "file_2.txt"
-        file_1.touch()
-        file_2.touch()
-
-        # Copying two empty files.
-        mkosi.copy_file(file_1, file_2)
-        assert filecmp.cmp(file_1, file_2)
-
-        # Copying content from one file.
-        file_1.write_text("Testing copying content from this file to file_2.")
-        mkosi.copy_file(file_1, file_2)
-        assert filecmp.cmp(file_1, file_2)
-
-        # Giving a non existing path/file.
-        with pytest.raises(OSError):
-            mkosi.copy_file("nullFilePath", file_1)
-
-        # Copying when there's already content in both files.
-        file_2.write_text("Testing copying content from file_1 to file_2, with previous data.")
-        mkosi.copy_file(file_1, file_2)
-        assert filecmp.cmp(file_1, file_2)
+    dir_path = Path(tmpdir)
+    file_1 = Path(dir_path) / "file_1.txt"
+    file_2 = Path(dir_path) / "file_2.txt"
+    file_1.touch()
+    file_2.touch()
+
+    # Copying two empty files.
+    mkosi.copy_file(file_1, file_2)
+    assert filecmp.cmp(file_1, file_2)
+
+    # Copying content from one file.
+    file_1.write_text("Testing copying content from this file to file_2.")
+    mkosi.copy_file(file_1, file_2)
+    assert filecmp.cmp(file_1, file_2)
+
+    # Giving a non existing path/file.
+    with pytest.raises(OSError):
+        mkosi.copy_file("nullFilePath", file_1)
+
+    # Copying when there's already content in both files.
+    file_2.write_text("Testing copying content from file_1 to file_2, with previous data.")
+    mkosi.copy_file(file_1, file_2)
+    assert filecmp.cmp(file_1, file_2)
 
 
 def test_parse_bytes() -> None:
index b86dc15368acea0499dd3278a9ba204e72b6f03f..7ded908c265a0e6ff4e907429bd51c464b34a4e5 100644 (file)
@@ -104,7 +104,7 @@ def test_centos_brtfs() -> None:
     with cd_temp_dir():
         config = Path("mkosi.conf")
         for dist in (Distribution.centos, Distribution.centos_epel):
-            for release in range (2, 9):
+            for release in range(2, 9):
                 config.write_text(
                     textwrap.dedent(
                         f"""