Thanks for the tips. I'm aware of Grep, but I barely understand it. I've no doubt I could figure out how to extract the Python out of the database, one way or another. But doesn't all the Python (as did AppleScript) get re-formatted into one long string somehow? Perhaps line breaks and indents are replaced, and later "reconstituted" by Indigo? I just assumed that, because while looking at the database I can see the scripts, but not formatted as they are in the Indigo editor, only always on one line in the database.. Anyway, not knowing how that actually works, or how to get it back into that one-line format after "fixing" errant Python 2, I didn't explore that. Perhaps I have that all wrong?
I examined one external file last night with pylint, and found errors, mostly indent errors that I didn't understand. Several errors regarding the formatting of constants not in all-caps, extra spaces and returns at the end of lines, things of that nature. Nothing that appears to keep the script from working (because it
is working). pylint gave me a score. I got 0.0/10.0 or something like that. Is that the worst, or the best possible?
(I actually don't know!) And pylint doesn't find everything, right?
I think I understand that Indigo is currently executing all my internal and include scripts in Python 3, not 2. Only plug-ins are temporarily allowed to call to Python 2, in this "transition" period. But my scripts don't get to call Python 2, right? So if they're working they're working? I suppose the next iteration of Python could break many of my scripts, if it is more strict about some of the code-foibles that Python 3 seems to be ignoring. Is that possible?
To be honest, based on what it took to examine that one include last night, I wouldn't want to have to do that across all my dozens and dozens of scripts. I just counted: Triggers and Actions and Includes that I tagged as utilizing Python number about 270!! Granted, many are near duplicates, with only a few words altered. Many or very short. But there are also many that are quite involved, pages long. Just opening and copy-pasting 270 code snippets into 270 files that could be examined by pylint would be a daunting task!
There's got to be a better way. I wasn't kidding about building some sort of code extractor into Indigo...
I've obviously spent a lot of time scripting. TWICE, because most of these scripts were once AppleScript. I realize I've brought some of this pain on myself, complicating my HA in this way, but it is what it is. There's no going back now. But I have to ask myself, how many more times will I have the energy (or brain-capacity) to completely overhaul hundreds scripts?