Interesting discovery from automatic tools (python code)
José Matos
jaomatos at gmail.com
Sun Jul 31 06:15:29 UTC 2022
On Sun, 2022-07-31 at 00:44 +0200, Pavel Sanda wrote:
> Good. This one applies, so it's in now.
> Now that I have you on hotline, any chance to have a look at the
> configure patch we discussed in March? :)
> (Was: LyX 2.4.0 (IM policy.xml ban on eps/pdf conversions))
>
> Pavel
That was the next item in my list, really. :-)
Now in the context of the pyupgrade fixes this is applied to top /lib
scripts. I need this before working on configure.py.
The idea, of course, is to separate different changes in different
commits.
Again the changes are related with fixing escape sequences.
The two options are either add an r prefix indicating that the string
is raw, thus no escape is performed, or to double the backslash.
Most of the time I would use raw strings with the exception being the
addition of newline \n. The added complication here is that since we
support python 2 some strings need to be marked as unicode, with a u
prefix. In order to keep some sanity Python does not allow to stack
prefixes, like
fur"\begin_layout {layout}"
The f refers to formatted strings, and thus inside the string {layout}
is replaced with the value of the layout expression, u makes the string
unicode (the default in Python 3 and thus a no-op in Python3) and r
would mean raw string and thus the first backslash is not escaped.
--
José Abílio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: python-fix2.patch
Type: text/x-patch
Size: 7750 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20220731/e123e212/attachment-0001.bin>
More information about the lyx-devel
mailing list