Radioddity FS-T3 family lacks roger beep capability. To avoid confusing users, in drivers/radtel_t18.py I enclosed the roger beep setting in an "if" statement. That meant it needed another level of indenting.
if self.MODEL != "BF-T12" and self.MODEL != "FS-T3" and \ self.MODEL != "PR-T3": rs = RadioSetting("rogerbeep", "Roger beep", RadioSettingValueBoolean(_settings.rogerbeep)) basic.append(rs)
(Pretend there are 12 more spaces at the start of each line.)
Ran "tox -e style" to test for code standards. Error message:
./chirp/drivers/radtel_t18.py:873:80: E501 line too long (80 > 79 characters)
One character too long! Backed off the RadioSettingValueBoolean indent by one space. Ran it again:
./chirp/drivers/radtel_t18.py:873:34: E128 continuation line under-indented for visual indent
So it can meet style standards for line length or visual indent, but not both at the same time. Tried to trick it by adding \ to the previous line, turning it into a continuation that might have different indent rules. Didn't work.
./chirp/drivers/radtel_t18.py:872:62: E502 the backslash is redundant between brackets
How much of a problem is this really? Any suggestions to make it pass tests?
---- Charles Terrell tachyon@pobox.com
Radioddity FS-T3 family lacks roger beep capability. To avoid confusing users, in drivers/radtel_t18.py I enclosed the roger beep setting in an "if" statement. That meant it needed another level of indenting.
if self.MODEL != "BF-T12" and self.MODEL != "FS-T3" and \ self.MODEL != "PR-T3": rs = RadioSetting("rogerbeep", "Roger beep", RadioSettingValueBoolean(_settings.rogerbeep)) basic.append(rs)
(Pretend there are 12 more spaces at the start of each line.)
Ran "tox -e style" to test for code standards. Error message:
./chirp/drivers/radtel_t18.py:873:80: E501 line too long (80 > 79 characters)
One character too long! Backed off the RadioSettingValueBoolean indent by one space. Ran it again:
./chirp/drivers/radtel_t18.py:873:34: E128 continuation line under-indented for visual indent
So it can meet style standards for line length or visual indent, but not both at the same time. Tried to trick it by adding \ to the previous line, turning it into a continuation that might have different indent rules. Didn't work.
./chirp/drivers/radtel_t18.py:872:62: E502 the backslash is redundant between brackets
How much of a problem is this really? Any suggestions to make it pass tests?
It's a big problem, indentation is important in python as is reasonably consistent style in a project. The rules being enforced aren't even ours, they're from PEP8, which is the bare minimum standard formatting recommendation from the python project itself. The newer (and much uglier) set is about a billion times more strict (also about the same amount uglier too).
Just break the line at the open-paren, either for RadioSetting or RadioSettingValueBoolean, as is recommended by PEP8:
if self.MODEL != "BF-T12" and self.MODEL != "FS-T3" and \ self.MODEL != "PR-T3": rs = RadioSetting( "rogerbeep", "Roger beep", RadioSettingValueBoolean(_settings.rogerbeep)) basic.append(rs)
--Dan
On Fri, Apr 5, 2024 at 2:36 PM Dan Smith via Developers developers@lists.chirpmyradio.com wrote:
How much of a problem is this really? Any suggestions to make it pass tests?
It's a big problem, indentation is important in python as is reasonably consistent style in a project. The rules being enforced aren't even ours, they're from PEP8, which is the bare minimum standard formatting recommendation from the python project itself. The newer (and much uglier) set is about a billion times more strict (also about the same amount uglier too).
Just break the line at the open-paren, either for RadioSetting or RadioSettingValueBoolean, as is recommended by PEP8:
Thanks! That worked. Hadn't read PEP8 in a long time, so I forgot about the peculiar line length. Usually for bash or C-like languages I assume 80 chars unless specifically told otherwise.
Reviewing PEP8 gave me a lot to think about.
---- Charles Terrell tachyon@pobox.com
participants (2)
-
Charles Terrell
-
Dan Smith