Enable the E128 flake8 rule for all code except for __init__.py (#2827)

This commit also fixes a few files that had non-uniform indentation.
This commit is contained in:
correctmost 2024-11-16 03:34:29 -05:00 committed by GitHub
parent 6102a08c6d
commit 2408b597be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 10 additions and 8 deletions

View File

@ -1,11 +1,11 @@
[flake8]
count = True
# Several of the following could be autofixed or improved by running the code through psf/black
ignore = E128,E722,W191,W503
ignore = E722,W191,W503
max-complexity = 40
max-line-length = 220
show-source = True
statistics = True
builtins = _
per-file-ignores = __init__.py:F401
per-file-ignores = __init__.py:E128,F401
exclude = .git,__pycache__,build,docs,actions-runner

View File

@ -1,5 +1,5 @@
on: [ push, pull_request ]
name: flake8 linting (4 ignores)
name: flake8 linting (3 ignores)
jobs:
flake8:
runs-on: ubuntu-latest

View File

@ -174,8 +174,10 @@ class DeviceHandler(object):
def get_unique_path_for_device(self, dev_path: Path) -> Optional[Path]:
paths = Path('/dev/disk/by-id').glob('*')
linked_targets = {p.resolve(): p for p in paths}
linked_wwn_targets = {p: linked_targets[p] for p in linked_targets
if p.name.startswith('wwn-') or p.name.startswith('nvme-eui.')}
linked_wwn_targets = {
p: linked_targets[p] for p in linked_targets
if p.name.startswith('wwn-') or p.name.startswith('nvme-eui.')
}
if dev_path in linked_wwn_targets:
return linked_wwn_targets[dev_path]

View File

@ -345,7 +345,8 @@ class SysCommandWorker:
class SysCommand:
def __init__(self,
def __init__(
self,
cmd: Union[str, list[str]],
callbacks: dict[str, Callable[[Any], Any]] = {},
start_callback: Optional[Callable[[Any], Any]] = None,

View File

@ -1512,8 +1512,7 @@ Exec = /bin/sh -c "{hook_command}"
for user in users:
self.user_create(user.username, user.password, user.groups, user.sudo)
def user_create(self, user: str, password: Optional[str] = None, groups: Optional[list[str]] = None,
sudo: bool = False) -> None:
def user_create(self, user: str, password: Optional[str] = None, groups: Optional[list[str]] = None, sudo: bool = False) -> None:
if groups is None:
groups = []