diff --git a/lib/scripts/fig2pdftex.py b/lib/scripts/fig2pdftex.py index b458ccd8f3..10e9c5a89d 100644 --- a/lib/scripts/fig2pdftex.py +++ b/lib/scripts/fig2pdftex.py @@ -78,7 +78,7 @@ else: # with tetex. epsfile = outbase + '.pstex' tmp = mkstemp() - boundingboxline = re.compile(b'%%BoundingBox:\s+(\d*)\s+(\d*)\s+(\d*)\s+(\d*)') + boundingboxline = re.compile(br'%%BoundingBox:\s+(\d*)\s+(\d*)\s+(\d*)\s+(\d*)') for line in open(epsfile, 'rb'): if line[:13] == b'%%BoundingBox': (llx, lly, urx, ury) = list(map(int, boundingboxline.search(line).groups())) diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py index 88ada1213e..c2fc7c20a7 100644 --- a/lib/scripts/layout2layout.py +++ b/lib/scripts/layout2layout.py @@ -457,10 +457,10 @@ def convert(lines, end_format): re_ChapterStyle = re.compile(b'^\\s*Style\\s+Chapter\\s*$', re.IGNORECASE) re_InsetLayout_CaptionLTNN = re.compile(b'^(\\s*InsetLayout\\s+)(Caption:LongTableNonumber)', re.IGNORECASE) # for format 64 - re_trimLabelString = re.compile(b'^(\\s*LabelString\s+)"\\s*(.*?)\\s*"\\s*$') - re_trimLabelStringAppendix = re.compile(b'^(\\s*LabelStringAppendix\s+)"\\s*(.*?)\\s*"\\s*$') - re_trimEndLabelString = re.compile(b'^(\\s*EndLabelString\s+)"\\s*(.*?)\\s*"\\s*$') - re_trimLabelCounter = re.compile(b'^(\\s*LabelCounter\s+)"\\s*(.*?)\\s*"\\s*$') + re_trimLabelString = re.compile(b'^(\\s*LabelString\\s+)"\\s*(.*?)\\s*"\\s*$') + re_trimLabelStringAppendix = re.compile(b'^(\\s*LabelStringAppendix\\s+)"\\s*(.*?)\\s*"\\s*$') + re_trimEndLabelString = re.compile(b'^(\\s*EndLabelString\\s+)"\\s*(.*?)\\s*"\\s*$') + re_trimLabelCounter = re.compile(b'^(\\s*LabelCounter\\s+)"\\s*(.*?)\\s*"\\s*$') # counters for sectioning styles (hardcoded in 1.3) diff --git a/lib/scripts/legacy_lyxpreview2ppm.py b/lib/scripts/legacy_lyxpreview2ppm.py index 8effd5bd00..29eb833f54 100644 --- a/lib/scripts/legacy_lyxpreview2ppm.py +++ b/lib/scripts/legacy_lyxpreview2ppm.py @@ -156,7 +156,7 @@ def legacy_extract_metrics_info(log_file): def extract_resolution(log_file, dpi): fontsize_re = re.compile(b"Preview: Fontsize") magnification_re = re.compile(b"Preview: Magnification") - extract_decimal_re = re.compile(b"([0-9\.]+)") + extract_decimal_re = re.compile(br"([0-9\.]+)") extract_integer_re = re.compile(b"([0-9]+)") found_fontsize = 0 diff --git a/lib/scripts/lyxpak.py b/lib/scripts/lyxpak.py index 2aaf2db42b..affef65644 100755 --- a/lib/scripts/lyxpak.py +++ b/lib/scripts/lyxpak.py @@ -37,7 +37,7 @@ if running_on_windows: from tempfile import NamedTemporaryFile # Pre-compiled regular expressions. -re_lyxfile = re.compile(b"\.lyx$") +re_lyxfile = re.compile(br"\.lyx$") re_input = re.compile(b'^(.*)\\\\(input|include){(\\s*)(.+)(\\s*)}.*$') re_ertinput = re.compile(b'^(input|include)({)(\\s*)(.+)(\\s*)}.*$') re_package = re.compile(b'^(.*)\\\\(usepackage){(\\s*)(.+)(\\s*)}.*$') diff --git a/lib/scripts/lyxpaperview.py b/lib/scripts/lyxpaperview.py index 09256da7cb..a0f2bedfe1 100755 --- a/lib/scripts/lyxpaperview.py +++ b/lib/scripts/lyxpaperview.py @@ -78,7 +78,7 @@ def find(args, path): # use locate if possible (faster) if find_exe(['locate']): p1 = subprocess.Popen(['locate', '-i', args[0].lower()], stdout=subprocess.PIPE) - px = subprocess.Popen(['grep', '-Ei', '\.pdf$|\.ps$'], stdin=p1.stdout, stdout=subprocess.PIPE) + px = subprocess.Popen(['grep', '-Ei', r'\.pdf$|\.ps$'], stdin=p1.stdout, stdout=subprocess.PIPE) for arg in args: if arg == args[0]: # have this already diff --git a/lib/scripts/lyxpreview2bitmap.py b/lib/scripts/lyxpreview2bitmap.py index eee000deea..719738d002 100755 --- a/lib/scripts/lyxpreview2bitmap.py +++ b/lib/scripts/lyxpreview2bitmap.py @@ -120,7 +120,7 @@ def extract_metrics_info(dvipng_stdout): # "\[[0-9]+" can match two kinds of numbers: page numbers from dvipng # and glyph numbers from mktexpk. The glyph numbers always match # "\[[0-9]+\]" while the page number never is followed by "\]". Thus: - page_re = re.compile("\[([0-9]+)[^]]"); + page_re = re.compile(r"\[([0-9]+)[^]]"); metrics_re = re.compile("depth=(-?[0-9]+) height=(-?[0-9]+)") success = 0 @@ -197,7 +197,7 @@ def fix_latex_file(latex_file, pdf_output): def convert_to_ppm_format(pngtopnm, basename): - png_file_re = re.compile("\.png$") + png_file_re = re.compile(r"\.png$") for png_file in glob.glob("%s*.png" % basename): ppm_file = png_file_re.sub(".ppm", png_file) diff --git a/lib/scripts/lyxpreview_tools.py b/lib/scripts/lyxpreview_tools.py index 7783fe2b7d..cca359e7c4 100644 --- a/lib/scripts/lyxpreview_tools.py +++ b/lib/scripts/lyxpreview_tools.py @@ -1,4 +1,3 @@ - # file lyxpreview_tools.py # This file is part of LyX, the document processor. # Licence details can be found in the file COPYING. diff --git a/lib/scripts/prefs2prefs_prefs.py b/lib/scripts/prefs2prefs_prefs.py index 08c1f386b5..78870a3402 100644 --- a/lib/scripts/prefs2prefs_prefs.py +++ b/lib/scripts/prefs2prefs_prefs.py @@ -223,7 +223,7 @@ def remove_obsolete(line): def language_use_babel(line): - if not line.lower().startswith("\language_use_babel"): + if not line.lower().startswith(r"\language_use_babel"): return no_match re_lub = re.compile(r'^\\language_use_babel\s+"?(true|false)', re.IGNORECASE) m = re_lub.match(line) @@ -364,7 +364,7 @@ def split_pdf_format(line): viewer = '' else: viewer = entries[5] - converted = line.replace('application/pdf', '') + ''' + converted = line.replace('application/pdf', '') + r''' \Format pdf6 pdf "PDF (graphics)" "" "''' + viewer + '" "" "vector" "application/pdf"' return (True, converted) elif line.lower().startswith("\\viewer_alternatives") or \