Add the ruff linter and formatter to recceiver#98
Add the ruff linter and formatter to recceiver#98jacomago merged 16 commits intoChannelFinder:masterfrom
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.
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.
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.
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.
I think unpack returns a tuple (can actually see in the docs)
There was a problem hiding this comment.
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.
|
|
|
||
| # 0x0002 | ||
| def recvPong(self, body): | ||
| nonce, = _ping.unpack(body[:_ping.size]) |
There was a problem hiding this comment.
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