switch from black to ruff for formatting

This commit is contained in:
Jörg Thalheim 2023-11-03 13:37:09 +01:00
parent 15dc4fd497
commit 5cb4019942
5 changed files with 38 additions and 69 deletions

View File

@ -21,11 +21,6 @@ line-length = 88
select = ["E", "F", "I", "U", "N"] select = ["E", "F", "I", "U", "N"]
ignore = ["E501"] ignore = ["E501"]
[tool.black]
line-length = 88
target-version = ['py39']
include = '\.pyi?$'
[tool.mypy] [tool.mypy]
python_version = "3.10" python_version = "3.10"
warn_redundant_casts = true warn_redundant_casts = true

View File

@ -46,7 +46,7 @@
"-eucx" "-eucx"
'' ''
${lib.getExe pkgs.ruff} --fix "$@" ${lib.getExe pkgs.ruff} --fix "$@"
${lib.getExe pkgs.black} "$@" ${lib.getExe pkgs.ruff} format "$@"
'' ''
"--" # this argument is ignored by bash "--" # this argument is ignored by bash
]; ];

View File

@ -153,27 +153,44 @@ class BuildVmTask(BaseTask):
"console=tty0", "console=tty0",
] ]
qemu_command = [ qemu_command = [
# fmt: off
"qemu-kvm", "qemu-kvm",
"-name", machine, "-name",
"-m", f'{vm_config["memorySize"]}M', machine,
"-smp", str(vm_config["cores"]), "-m",
"-device", "virtio-rng-pci", f'{vm_config["memorySize"]}M',
"-net", "nic,netdev=user.0,model=virtio", "-netdev", "user,id=user.0", "-smp",
"-virtfs", "local,path=/nix/store,security_model=none,mount_tag=nix-store", str(vm_config["cores"]),
"-virtfs", f"local,path={xchg_dir},security_model=none,mount_tag=shared", "-device",
"-virtfs", f"local,path={xchg_dir},security_model=none,mount_tag=xchg", "virtio-rng-pci",
"-virtfs", f"local,path={secrets_dir},security_model=none,mount_tag=secrets", "-net",
"-drive", f'cache=writeback,file={disk_img},format=raw,id=drive1,if=none,index=1,werror=report', "nic,netdev=user.0,model=virtio",
"-device", "virtio-blk-pci,bootindex=1,drive=drive1,serial=root", "-netdev",
"-device", "virtio-keyboard", "user,id=user.0",
"-vga", "virtio", "-virtfs",
"local,path=/nix/store,security_model=none,mount_tag=nix-store",
"-virtfs",
f"local,path={xchg_dir},security_model=none,mount_tag=shared",
"-virtfs",
f"local,path={xchg_dir},security_model=none,mount_tag=xchg",
"-virtfs",
f"local,path={secrets_dir},security_model=none,mount_tag=secrets",
"-drive",
f"cache=writeback,file={disk_img},format=raw,id=drive1,if=none,index=1,werror=report",
"-device",
"virtio-blk-pci,bootindex=1,drive=drive1,serial=root",
"-device",
"virtio-keyboard",
"-vga",
"virtio",
"-usb", "-usb",
"-device", "usb-tablet,bus=usb-bus.0", "-device",
"-kernel", f'{vm_config["toplevel"]}/kernel', "usb-tablet,bus=usb-bus.0",
"-initrd", vm_config["initrd"], "-kernel",
"-append", " ".join(cmdline), f'{vm_config["toplevel"]}/kernel',
# fmt: on "-initrd",
vm_config["initrd"],
"-append",
" ".join(cmdline),
] ]
if not self.vm.graphics: if not self.vm.graphics:
qemu_command.append("-nographic") qemu_command.append("-nographic")

View File

@ -58,25 +58,3 @@ line-length = 88
select = [ "E", "F", "I", "N"] select = [ "E", "F", "I", "N"]
ignore = [ "E501" ] ignore = [ "E501" ]
[tool.black]
line-length = 88
target-version = [ "py310" ]
include = "\\.pyi?$"
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
# The following are specific to Black, you probably don't want those.
| blib2to3
| tests/data
| profiling
)/
'''

View File

@ -1,5 +1,6 @@
[tool.mypy] [tool.mypy]
python_version = "3.10" python_version = "3.10"
pretty = true
warn_redundant_casts = true warn_redundant_casts = true
disallow_untyped_calls = true disallow_untyped_calls = true
disallow_untyped_defs = true disallow_untyped_defs = true
@ -11,25 +12,3 @@ line-length = 88
select = [ "E", "F", "I", "U", "N"] select = [ "E", "F", "I", "U", "N"]
ignore = [ "E501" ] ignore = [ "E501" ]
[tool.black]
line-length = 88
target-version = [ "py310" ]
include = "\\.pyi?$"
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
# The following are specific to Black, you probably don't want those.
| blib2to3
| tests/data
| profiling
)/
'''