-
Notifications
You must be signed in to change notification settings - Fork 28
Add the ruff linter and formatter to recceiver #98
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
Conversation
5562d04 to
47ca0f1
Compare
server/recceiver/cfstore.py
Outdated
| pvInfo[rid] = {"pvName": rname} | ||
| if (self.conf.get('recordType', 'default' == 'on')): | ||
| pvInfo[rid]['recordType'] = rtype | ||
| if self.conf.get("recordType", "default" == "on"): |
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.
This looks... weird. Should this be instead
if self.conf.get("recordType", default="on"):Otherwise, this is just equivalent to
if self.conf.get("recordType", False):???
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.
Fixed by swapping to just if self.conf.get("recordType")
|
|
||
| # 0x0002 | ||
| def recvPong(self, body): | ||
| nonce, = _ping.unpack(body[:_ping.size]) |
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.
This looks odd to me, why is it not just
nonce = _ping.unpack(...)Or is the point that it is a list with a single element? I guess then
nonce, *_ = _ping.unpack(...)but maybe this doesn't matter...
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 think unpack returns a tuple (can actually see in the docs)
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 though the convention was to prefer foo, over (foo,)
Pretty clear this has been broken for the "alias" and "recordType" settings for a long time. I've set both options now that if they are set, then they are on. I expect most people turn both options on.
|
anderslindho
left a comment
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.
LGTM
|
|
||
| # 0x0002 | ||
| def recvPong(self, body): | ||
| nonce, = _ping.unpack(body[:_ping.size]) |
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 though the convention was to prefer foo, over (foo,)



Adds the ruff linter and formatter https://docs.astral.sh/ruff/
Checks for problematic code and auto formats code.
Removes unused code