Interesting discovery from automatic tools (python code)
José Matos
jaomatos at gmail.com
Sat Jul 30 11:31:57 UTC 2022
Yesterday I found a tool to upgrade the python code to new versions.
https://github.com/asottile/pyupgrade
This is interesting in itself. :-)
First because it allows to upgrade the code to a given version, such as
it is I have applied in a way that it is compatible with python 2.7
that we support for lyx 2.4.
I have applied it to lyx2lyx code and the result is attached.
Other than the change to lyx2lyx_tools.py that changes from the dict
call to a dictionary comprehension the other changes corresponds to
bugs in the present code:
For example:
"\label{" -> "\\label{"
You do not need to be a python expert to understand why the initial
code is wrong. The python strings use the same escape sequences as
C/C++.
In this case the code just works because "\l" is not an escape sequence
and is thus it is ignored.
I think that this should be applied.
Due to the issue with the supported version of keys in ssh I can not
commit directly. :-(
Have a nice weekend,
--
José Abílio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: python-fix.patch
Type: text/x-patch
Size: 25304 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20220730/ab0f4657/attachment-0001.bin>
More information about the lyx-devel
mailing list