librelogo/source/LibreLogo/LibreLogo.py                       |   33 ++++------
 wizards/com/sun/star/wizards/agenda/TopicsControl.py          |    2 
 wizards/com/sun/star/wizards/common/ConfigGroup.py            |    2 
 wizards/com/sun/star/wizards/common/Configuration.py          |    2 
 wizards/com/sun/star/wizards/common/SystemDialog.py           |    2 
 wizards/com/sun/star/wizards/fax/FaxWizardDialog.py           |    2 
 wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py |    2 
 wizards/com/sun/star/wizards/text/TextDocument.py             |    6 -
 8 files changed, 23 insertions(+), 28 deletions(-)

New commits:
commit 147063f58c6b7898e659321f581ea9551305a574
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Mar 28 09:39:31 2024 +0100
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Mar 28 10:10:32 2024 +0100

    Revert "tdf#158803 remove some unused imports, unnecessary semicolons and 
related styling"
    
    This reverts commit 9d4844374395ecce6b2ff4f9a71b3c8dae23050a.
    
    Reason for revert: fails in unit tests
    
    Change-Id: Icfaf6ab331ecce691b9a9462432e07c68d0fb40c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165417
    Tested-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/librelogo/source/LibreLogo/LibreLogo.py 
b/librelogo/source/LibreLogo/LibreLogo.py
index c60bbffa4cbf..dca6356026bb 100644
--- a/librelogo/source/LibreLogo/LibreLogo.py
+++ b/librelogo/source/LibreLogo/LibreLogo.py
@@ -6,16 +6,9 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
-import sys
-import os
-import uno
-import unohelper
-import re
-import random
-import traceback
-import itertools
-import threading
-import time as __time__
+import sys, os, uno, unohelper
+import re, random, traceback, itertools
+import threading, time as __time__
 
 __lng__ = {}
 
@@ -201,7 +194,7 @@ class __Doc__:
         self.fontstyle = 0
         self.points = []
 
-from math import pi, sin, cos, asin, hypot
+from math import pi, sin, cos, asin, log10, hypot, sqrt
 
 from com.sun.star.awt import Point as __Point__
 from com.sun.star.awt import Gradient as __Gradient__
@@ -224,6 +217,8 @@ from com.sun.star.drawing.LineStyle import NONE as 
__LineStyle_NONE__
 from com.sun.star.drawing.LineStyle import SOLID as __LineStyle_SOLID__
 from com.sun.star.drawing.LineStyle import DASH as __LineStyle_DASHED__
 from com.sun.star.drawing.DashStyle import RECT as __DashStyle_RECT__
+from com.sun.star.drawing.DashStyle import ROUND as __DashStyle_ROUND__
+from com.sun.star.drawing.DashStyle import ROUNDRELATIVE as 
__DashStyle_ROUNDRELATIVE__
 from com.sun.star.drawing.CircleKind import FULL as __FULL__
 from com.sun.star.drawing.CircleKind import SECTION as __SECTION__
 from com.sun.star.drawing.CircleKind import CUT as __CUT__
@@ -365,7 +360,7 @@ def Print(s):
 
 def MessageBox(parent, message, title, msgtype = "messbox", buttons = __OK__):
     msgtypes = ("messbox", "infobox", "errorbox", "warningbox", "querybox")
-    if msgtype not in msgtypes:
+    if not (msgtype in msgtypes):
         msgtype = "messbox"
     d = __WinDesc__()
     d.Type = __MODALTOP__
@@ -555,13 +550,13 @@ class LogoProgram(threading.Thread):
                     
_.doc.CurrentController.getViewCursor().gotoRange(_.origcursor[0], False)
                 except:
                     
_.doc.CurrentController.getViewCursor().gotoRange(_.origcursor[0].getStart(), 
False)
-        except Exception:
+        except Exception as e:
             try:
               __unlock__(all_levels = True)
               TRACEPATTERN = '"<string>", line '
               message = traceback.format_exc()
               l = re.findall(TRACEPATTERN + '[0-9]+', message)
-              if len(l) > 0 and "SystemExit" not in message:
+              if len(l) > 0 and not "SystemExit" in message:
                 line = len(re.findall(__LINEBREAK__, ''.join(self.code.split("
")[:int(l[-1][len(TRACEPATTERN):])]))) + 1
                 caption = __l12n__(_.lng)['LIBRELOGO']
                 if __prevcode__ and "
" in __prevcode__:
@@ -589,7 +584,7 @@ class LogoProgram(threading.Thread):
                     MessageBox(parent, __l12n__(_.lng)['ERR_ARGUMENTS'] % 
(__locname__(r.group(1)), r.group(2), r.group(3)), caption, "errorbox")
                 else:
                     origline = __compiled__.split("
")[line-1]
-                    if "com.sun.star" not in message and "__repeat__" not in 
message and "*)" not in message and ("[" in origline or "]" in origline):
+                    if not "com.sun.star" in message and not "__repeat__" in 
message and not "*)" in message and ("[" in origline or "]" in origline):
                         MessageBox(parent, __l12n__(_.lng)['ERR_BLOCK'], 
caption, "errorbox")
                     else:
                         MessageBox(parent, __l12n__(_.lng)['ERROR'] %line, 
__l12n__(_.lng)['LIBRELOGO'], "errorbox")
@@ -842,7 +837,7 @@ def run(arg=None, arg2 = -1):
         else:
           name = os.chdir(os.path.expanduser('~'))
         __thread__.start()
-    except Exception:
+    except Exception as e:
         __thread__ = None
         __trace__()
     return None
@@ -1885,14 +1880,14 @@ def __loadlang__(lang, a):
         for j in a[i[0]].split("|"):
             __colors__[lang][j.lower()] = i[1]
     for i in a:
-        if i[0:3] not in ["LIB", "ERR", "PT", "INC", "MM", "CM", "HOU", "DEG"] 
and i not in __STRCONST__: # uppercase native commands
+        if not i[0:3] in ["LIB", "ERR", "PT", "INC", "MM", "CM", "HOU", "DEG"] 
and not i in __STRCONST__: # uppercase native commands
             a[i] = a[i].upper()
     repcount = a['REPCOUNT'].split('|')[0]
     loopi = itertools.count()
     loop = lambda r: "%(i)s = 1
%(orig)s%(j)s = %(i)s
%(i)s += 1
" % \
         { "i": repcount + str(next(loopi)), "j": repcount, "orig": re.sub( 
r"(?ui)(?<!:)%s" % repcount, repcount + str(next(loopi)-1), r.group(0)) }
     __comp__[lang] = [
-    [r"(?i)(?<!:)(|(?=[-:]))(?:%s)" % "|".join([a[i].lower() for i in a if 
"_" not in i and i != "DECIMAL"]), lambda s: s.group().upper()], # uppercase 
all native commands in the source code
+    [r"(?i)(?<!:)(|(?=[-:]))(?:%s)" % "|".join([a[i].lower() for i in a if 
not "_" in i and i != "DECIMAL"]), lambda s: s.group().upper()], # uppercase 
all native commands in the source code
     [r"(?<!:)(?:%s) \[(?= |
)" % a['GROUP'], "
__groupstart__()
for __groupindex__ in range(2):
[
if __groupindex__ == 1:
[
__groupend__()
break
]
"],
     [r"(?<!:)(?:%s) (%s[^[]*)\[(?= |
)" % (a['GROUP'], __DECODE_STRING_REGEX__), "
__groupstart__(\1)
for __groupindex__ in range(2):
[
if __groupindex__ == 1:
[
__groupend__(\1)
break
]
"],
     [r"(?<!:)(?:%s)" % a['GROUP'], "
__removeshape__(__ACTUAL__)
"],
@@ -2111,7 +2106,7 @@ def __compil__(s):
         if "_" not in locals():
             _ = lambda: None
         _.lng = 'en_US'
-        if _.lng not in __comp__:
+        if not _.lng in __comp__:
             __loadlang__(_.lng, __l12n__(_.lng)) 
 
     _.decimal = __l12n__(_.lng)['DECIMAL']
diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.py 
b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
index bb8d8b81ae01..6e269f6bf242 100644
--- a/wizards/com/sun/star/wizards/agenda/TopicsControl.py
+++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
@@ -643,7 +643,7 @@ class TopicsControl(ControlScroller):
         elif tmp_switch_var1 == 3:
             return cr.timebox
         else:
-            raise Exception("No such column")
+            raise Exception("No such column");
 
     '''getControl
     returns a control out of the given row, which is
diff --git a/wizards/com/sun/star/wizards/common/ConfigGroup.py 
b/wizards/com/sun/star/wizards/common/ConfigGroup.py
index 4155e87f63cc..200d4ef9d1ad 100644
--- a/wizards/com/sun/star/wizards/common/ConfigGroup.py
+++ b/wizards/com/sun/star/wizards/common/ConfigGroup.py
@@ -47,7 +47,7 @@ class ConfigGroup(object):
         propertyName = field[len(prefix):]
         child = getattr(self, field)
         if isinstance(child, ConfigGroup):
-            child.setRoot(self.root)
+            child.setRoot(self.root);
             child.readConfiguration(configView.getByName(propertyName),
                 prefix)
         else:
diff --git a/wizards/com/sun/star/wizards/common/Configuration.py 
b/wizards/com/sun/star/wizards/common/Configuration.py
index 7a469a11bba5..91274e0b288c 100644
--- a/wizards/com/sun/star/wizards/common/Configuration.py
+++ b/wizards/com/sun/star/wizards/common/Configuration.py
@@ -44,7 +44,7 @@ class Configuration(object):
     @classmethod
     def getProductName(self, xMSF):
         try:
-            oProdNameAccess = self.getConfigurationRoot(xMSF, 
"org.openoffice.Setup/Product", False)
+            oProdNameAccess = self.getConfigurationRoot(xMSF, 
"org.openoffice.Setup/Product", False);
             return oProdNameAccess.getByName("ooName")
         except Exception:
             traceback.print_exc()
diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.py 
b/wizards/com/sun/star/wizards/common/SystemDialog.py
index f9c3776b40c1..35bcdadfac3b 100644
--- a/wizards/com/sun/star/wizards/common/SystemDialog.py
+++ b/wizards/com/sun/star/wizards/common/SystemDialog.py
@@ -114,7 +114,7 @@ class SystemDialog(object):
                     return str(i.Value).replace("%productname%", "LibreOffice")
 
             raise Exception(
-                "UIName property not found for Filter " + filterName)
+                "UIName property not found for Filter " + filterName);
         except Exception:
             traceback.print_exc()
             return None
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py 
b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py
index 58d50463c5ab..0153eb639d30 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py
@@ -16,7 +16,7 @@
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
 from .FaxWizardDialogResources import FaxWizardDialogResources
-from .FaxWizardDialogConst import FaxWizardDialogConst, HIDMAIN
+from .FaxWizardDialogConst import FaxWizardDialogConst, HIDMAIN, HID
 from ..ui.WizardDialog import WizardDialog, uno, UIConsts, PropertyNames
 
 
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py 
b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index de85eb50c049..66c0e33457b5 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -234,7 +234,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
                 self.xUnoDialog.endExecute()
                 self.running = False
 
-        return True
+        return True;
 
     def closeDocument(self):
         try:
diff --git a/wizards/com/sun/star/wizards/text/TextDocument.py 
b/wizards/com/sun/star/wizards/text/TextDocument.py
index fe425741f4bb..f975dad5718b 100644
--- a/wizards/com/sun/star/wizards/text/TextDocument.py
+++ b/wizards/com/sun/star/wizards/text/TextDocument.py
@@ -56,10 +56,10 @@ class TextDocument(object):
             elif xArgs is not None:
                 '''creates an instance of TextDocument
                 and creates a frame and loads a document'''
-                self.xDesktop = Desktop.getDesktop(xMSF)
+                self.xDesktop = Desktop.getDesktop(xMSF);
                 self.xFrame = OfficeDocument.createNewFrame(xMSF, listener)
                 self.xTextDocument = OfficeDocument.load(
-                    self.xFrame, URL, "_self", xArgs)
+                    self.xFrame, URL, "_self", xArgs);
                 self.xWindowPeer = self.xFrame.getComponentWindow()
                 self.m_xDocProps = self.xTextDocument.DocumentProperties
                 CharLocale = self.xTextDocument.CharLocale
@@ -68,7 +68,7 @@ class TextDocument(object):
             else:
                 '''creates an instance of TextDocument from
                 the desktop's current frame'''
-                self.xDesktop = Desktop.getDesktop(xMSF)
+                self.xDesktop = Desktop.getDesktop(xMSF);
                 self.xFrame = self.xDesktop.getActiveFrame()
                 self.xTextDocument = self.xFrame.getController().Model
 

Reply via email to