The hotshot module used there only works for Python 2.
BTW the profiling turned out not be necessary.
As a case in point Python 3.13 is twice as fast as Python 3.6 when using
lyx2lyx. Not only that but Python 3 is almost 10 times faster than using
Python 2 for this particular case.
The functions were selected from the parser files where document is
always defined.
The only case was this code was used was on document.warning.
Since our documents are well formed this code was never active and thus
the reason why we did not saw this before.
One possible solution to assure that these type of errors do not occur
is to make the convention that all the functions in lyx2lyx_tools have
as the first argument document.
The only difference from regular letter is the alignment of
"Send To Address" layout, but it no longer reflect the output
corrctly, probably because LyX revert the alignment of layouts
in RTL context now.
This is in line with the current hints for better readability:
* one import per line;
* order the imports alphabetically to be easier to search;
Take the chance to remove unused imports.
This routine assumed \linenumbers to be preceded by \usepackage{lineno}
and that by a lyx2lyx comment.
Of course, this is not the case if users loaded lineno manually.
Fix 12966. A few notes:
* we need to consider both regular insets and argument insets.
* in passthru layouts (such as verbatim) parentheses still need
to be reversed.
* all arguments of type 'listpreamble' are passthru (this isn't a rule,
this is just what happen in practice).
* custom layout and insets from the local layout, or a custom module
are not considered.
Signed-off-by: Udi-Fogiel <udifoglle@gmail.com>
See here:
https://www.mail-archive.com/search?l=mid&q=a7960223ee91696e916b281d1d9fc55df10a9480.camel%40gmail.com
Description from José pasted below:
Functions `length_in_bp` and `revert_flex_inset` have an error in a
(almost) never used path. The reason why this was never triggered is
because this is part of the code where we try all the best efforts
to recover from an ill-formed LyX file.
The problem is that the functions call the `document` variable to
issue an warning if the file does not follow the usual structure.
The simple fix is to add that variable (as the first for the
functions) and to add them at all the places where the functions are
called.
For reference this code was introduced by Georg (Baum) more than 8
years ago and it was never reported. So the issue is not urgent in
any meaningful way. :-)
In `lyx2lyx/lyx_2_0.py`, in the function `revert_nameref`, there is
a call to the document variable. The same as all the above.
In `lyx2lyx/lyx_2_4.py`, in the `class fontmapping`. Similar to the
above but now for error.
Remove acknowledgment theorem types
As we have learned, these shouldn't have been added from the get go.
Documents having it get a local layout definition.
Also, perform the URL fixing magic for DocBook and XHTML.
As it was, it was impossible to enter e.g. "tel:" type links. Now
choosing the "Other" type just outputs the URL as given.
Also, the addition of "http" or "file" was not being done for
DocBook and XHTML. Now it is.