Patches for Python scripts

José Abílio Matos jamatos at lyx.org
Fri Jan 29 11:07:43 UTC 2021


On Friday, January 29, 2021 5:05:19 AM WET Richard Kimberly Heck wrote:
> José, can you look at these please?
> 
> Riki

I think that Thibaut wants to impose black[1] on us. :-D

Most of the changes are cosmetic, e.g. one import per line, or to use the same 
indentation for documentation.

The only bits where I am unsure are on the regular expressions (I am trimming 
the expression to make it easier to read):
-    declare = re.compile('\\s*(\[([^,]*)(,.*)*\])*$')
+    declare = re.compile('\\s*(\[([^,]*)(,.*)*])*$')

The left bracket is escaped but not the right one. What do other, more 
knowledgeable about the black magic of regular expressions think?

The are other issues like mistakes in the documentation strings. For the 
moment those are harmless, I am referring to e.g. "\c" since \c it is not an 
escape sequence it gets transformed to "\\c".


With the extent of the patches I fear that there could be bugs (unintended 
changes) lurking specially in relation to python 2.

In particular this just reinforces my feeling that configure.py should get an 
overhaul. :-)

This is my preliminary overview. I will keep looking into the patches.


[1] From Henry Ford's T model "You can choose any color as long as it is 
black".
https://black.readthedocs.io/en/stable/ 

-- 
José Abílio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20210129/c5f8bd75/attachment.html>


More information about the lyx-devel mailing list