]> git.lyx.org Git - features.git/commitdiff
Some python cleanup from Thibault.
authorRichard Kimberly Heck <rikiheck@lyx.org>
Sun, 21 Jun 2020 15:37:23 +0000 (11:37 -0400)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Sun, 21 Jun 2020 15:37:23 +0000 (11:37 -0400)
lib/lyx2lyx/lyx_2_4.py
lib/scripts/layout2layout.py

index f3c2fdc1c35d6d5ea1b41e8dc6d324727c34452e..206365185e937a63eb97ceb96f008d1227613dce 100644 (file)
@@ -1747,11 +1747,13 @@ ruby_inset_def = [
     r'End',
 ]
 
+
 def convert_ruby_module(document):
     """Use ruby module instead of local module definition"""
     if document.del_local_layout(ruby_inset_def):
         document.add_module("ruby")
 
+
 def revert_ruby_module(document):
     """Replace ruby module with local module definition"""
     if document.del_module("ruby"):
@@ -1768,6 +1770,7 @@ def convert_utf8_japanese(document):
         or (lang == "japanese-cjk" and inputenc == "utf8-cjk")):
         document.set_parameter("inputencoding", "utf8")
 
+
 def revert_utf8_japanese(document):
     """Use Japanese utf8 variants with Japanese documents."""
     inputenc = get_value(document.header, "\\inputencoding")
index 5b7b4ff762936f7889297cb18e986fc043a3340b..a8c1451d4054fe014cadc292fb54fcbc17c14bbf 100644 (file)
@@ -392,7 +392,7 @@ def convert(lines, end_format):
     # for categories
     re_Declaration = re.compile(b'^#\\s*\\Declare\\w+Class.*$')
     re_ExtractCategory = re.compile(b'^(#\\s*\\Declare\\w+Class(?:\\[[^]]*?\\])?){([^(]+?)\\s+\\(([^)]+?)\\)\\s*}\\s*$')
-    ConvDict = {"article": "Articles", "book" : "Books", "letter" : "Letters", "report": "Reports", \
+    ConvDict = {"article": "Articles", "book" : "Books", "letter" : "Letters", "report": "Reports",
                 "presentation" : "Presentations", "curriculum vitae" : "Curricula Vitae", "handout" : "Handouts"}
     # Arguments
     re_OptArgs = re.compile(b'^(\\s*)OptionalArgs(\\s+)(\\d+)\\D*$', re.IGNORECASE)
@@ -485,12 +485,12 @@ def convert(lines, end_format):
           continue
 
         # insert file format if not already there
-        if (only_comment):
+        if only_comment:
             match = re_Format.match(lines[i])
             if match:
                 formatline = i
                 format = int(match.group(4))
-                if format > 1 and format < end_format:
+                if 1 < format < end_format:
                     lines[i] = b"Format %d" % (format + 1)
                     only_comment = 0
                 elif format == end_format:
@@ -545,7 +545,7 @@ def convert(lines, end_format):
             i += 1
             continue
 
-        if format >= 60 and format <= 62:
+        if 60 <= format <= 62:
             # nothing to do.
             i += 1
             continue
@@ -578,7 +578,7 @@ def convert(lines, end_format):
             i += 1
             continue
 
-        if format >= 50 and format <= 56:
+        if 50 <= format <= 56:
             # nothing to do.
             i += 1
             continue
@@ -676,7 +676,7 @@ def convert(lines, end_format):
 
             continue
 
-        if format >= 44 and format <= 47:
+        if 44 <= format <= 47:
             # nothing to do.
             i += 1
             continue
@@ -795,7 +795,7 @@ def convert(lines, end_format):
             continue
 
         if format == 36:
-            match = re_CiteFormat.match(lines[i]);
+            match = re_CiteFormat.match(lines[i])
             if match and match.group(4) == b"":
                 lines[i] = match.group(0) + b" default"
             i += 1
@@ -864,7 +864,7 @@ def convert(lines, end_format):
           continue
 
         # Only new features
-        if format >= 29 and format <= 31:
+        if 29 <= format <= 31:
           i += 1
           continue
 
@@ -888,7 +888,7 @@ def convert(lines, end_format):
           continue
 
         # Only new features
-        if format >= 24 and format <= 27:
+        if 24 <= format <= 27:
           i += 1
           continue
 
@@ -934,7 +934,7 @@ def convert(lines, end_format):
           continue
 
         # This just involved new features, not any changes to old ones
-        if format >= 14 and format <= 22:
+        if 14 <= format <= 22:
           i += 1
           continue
 
@@ -1011,7 +1011,7 @@ def convert(lines, end_format):
             continue
 
         # These just involved new features, not any changes to old ones
-        if format >= 5 and format <= 7:
+        if 5 <= format <= 7:
           i += 1
           continue