I'm looking over the yaesu_clone superclass with FT1D subclass as a suggested example. I'm confused by the conflicting naming conventions. In yaesu_clone.py line 231 the superclass begins with these class fields: VENDOR = "Yaesu" NEEDS_COMPAT_SERIAL = False _model = b"ABCDE" Why are the first two all caps, but the third is lowercase with a leading underscore? Is this documented somewhere that I missed?
There's no hard and fast rule, but the ones in caps are generally those that are defined in the top-level Radio class or the common base subclasses in chirp_common. The convention is that model or driver-specific things are prefixed by underscore and in lower case. In the above case, _model is used by that driver internally (i.e. things in the driver file or related modules) for file detection and the cloning routines.
Normally, a leading underscore means the variable is local to the current scope and shouldn't be accessed outside of it. But in this case, VENDOR and _model are both overridden in the subclass. I didn't think that a subclass still counts as local. Also, normally all caps means it's a constant. Yet, again, the VENDOR gets overridden. So, to my mind all of these variables should be lowercase with no leading underscore. Just "vendor", just "model". (Or, leading underscores with corresponding @property accessors.)
The ones in caps (that are inherited from the common base classes) are part of the interface that the rest of the application needs to be correct - you don't get to rename them.
--Dan