Patches for Python scripts
Kornel Benko
kornel at lyx.org
Fri Jan 29 11:48:40 UTC 2021
Am Fri, 29 Jan 2021 11:07:43 +0000
schrieb José Abílio Matos <jamatos at lyx.org>:
> 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*(\[([^,]*)(,.*)*])*$')
Right, the last one should be escaped.
Given the line
# \DeclareLaTeXClass[revtex,revtex.sty]{REVTeX (Obsolete Version)}
and the original regex
'\\s*#\\s*\\\\DeclareLaTeXClass\\s*(\[([^,]*)(,.*)*\])*\\s*{(.*)}\\s*$'
the result in found(1) would be "revtex"
and found(2) would be the rest inside the escaped brackets, e.g. "revtex.sty"
Not escaping the last ']' probably not intended.
(I would escape also '{' and '}' if that were a perl regex)
> 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/
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: Digitale Signatur von OpenPGP
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20210129/b6d3b1ff/attachment.asc>
More information about the lyx-devel
mailing list