-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scripts/update-image: fix lint errors #130
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Furthermore, rather than these faulty lints we should consider applying flake8
and some plugins to all our Python code, to enforce PEP8 guidelines and some other QA (import order, complexity requirements).
@attr.s | ||
class MountInfo: | ||
blockdev = attr.ib() | ||
mount_using = attr.ib() | ||
image = attr.ib() | ||
mountpoint = attr.ib() | ||
root_idx = attr.ib() | ||
efi_idx = attr.ib() | ||
root_uuid = attr.ib() | ||
|
||
@attr.s | ||
def __init__(self, blockdev, mount_using, image, mountpoint, root_idx, efi_idx, root_uuid): | ||
self.blockdev = blockdev | ||
self.mount_using = mount_using | ||
self.image = image | ||
self.mountpoint = mountpoint | ||
self.root_idx = root_idx | ||
self.efi_idx = efi_idx | ||
self.root_uuid = root_uuid | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, attr.ib is used for a reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get that. But AFAICT the only feature we use is __init__
. So I've just removed attrs entirely from this script.
class Partition: | ||
idx = attr.ib() | ||
type = attr.ib() | ||
uuid = attr.ib() | ||
def __init__(self, idx, type, uuid): | ||
self.idx = idx | ||
self.type = type | ||
self.uuid = uuid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise (is this missing an @attr.s
?)
@@ -299,9 +300,9 @@ def run(self): | |||
# Determine root uuid manually for mountpoint | |||
diskdev, partdev = dev_for_mountpoint(self.mountpoint) | |||
|
|||
if os.isdir('/dev/disk/by-uuid'): | |||
if os.path.isdir('/dev/disk/by-uuid'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import os.path as path
is a common convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can replace all instances of os.path
-> path
, if that's what you're suggesting?
I agree, we should really use PEP8. |
I'm fine with keeping |
Here? Nothing specifically, this just seemed like a naive lint. If the dep was there already, and it'd appear that it was, it's probably fine to keep it, though. As for |
Why did the linter complain about |
Don't know, I'm just going off the initial comment:
|
To be clear: it's definitely a false positive lint. The decorator seems to confuse it. There's nothing actually broken about attrs here, unlike the other lint errors. |
Alright, let's merge this now since there are no hard issues. |
Fix lint errors according to
pyright
.Possibly related to #103.