summaryrefslogtreecommitdiff
path: root/librelogo
diff options
context:
space:
mode:
authorLeSasse <l.sasse@fz-juelich.de>2024-03-27 18:25:46 +0100
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-03-28 08:47:44 +0100
commit9d4844374395ecce6b2ff4f9a71b3c8dae23050a (patch)
treec958b4beae7086c5c202980812191b9b060c2363 /librelogo
parent845dbe38844d90d4313652a7b390f3715fce6d7e (diff)
tdf#158803 remove some unused imports, unnecessary semicolons and related styling
Change-Id: Ie413ffd72b3d2f583d697ba89035d2a5d35bafe6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165406 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'librelogo')
-rw-r--r--librelogo/source/LibreLogo/LibreLogo.py33
1 files changed, 19 insertions, 14 deletions
diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py
index dca6356026bb..c60bbffa4cbf 100644
--- a/librelogo/source/LibreLogo/LibreLogo.py
+++ b/librelogo/source/LibreLogo/LibreLogo.py
@@ -6,9 +6,16 @@
# 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, os, uno, unohelper
-import re, random, traceback, itertools
-import threading, time as __time__
+import sys
+import os
+import uno
+import unohelper
+import re
+import random
+import traceback
+import itertools
+import threading
+import time as __time__
__lng__ = {}
@@ -194,7 +201,7 @@ class __Doc__:
self.fontstyle = 0
self.points = []
-from math import pi, sin, cos, asin, log10, hypot, sqrt
+from math import pi, sin, cos, asin, hypot
from com.sun.star.awt import Point as __Point__
from com.sun.star.awt import Gradient as __Gradient__
@@ -217,8 +224,6 @@ 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__
@@ -360,7 +365,7 @@ def Print(s):
def MessageBox(parent, message, title, msgtype = "messbox", buttons = __OK__):
msgtypes = ("messbox", "infobox", "errorbox", "warningbox", "querybox")
- if not (msgtype in msgtypes):
+ if msgtype not in msgtypes:
msgtype = "messbox"
d = __WinDesc__()
d.Type = __MODALTOP__
@@ -550,13 +555,13 @@ class LogoProgram(threading.Thread):
_.doc.CurrentController.getViewCursor().gotoRange(_.origcursor[0], False)
except:
_.doc.CurrentController.getViewCursor().gotoRange(_.origcursor[0].getStart(), False)
- except Exception as e:
+ except Exception:
try:
__unlock__(all_levels = True)
TRACEPATTERN = '"<string>", line '
message = traceback.format_exc()
l = re.findall(TRACEPATTERN + '[0-9]+', message)
- if len(l) > 0 and not "SystemExit" in message:
+ if len(l) > 0 and "SystemExit" not in message:
line = len(re.findall(__LINEBREAK__, ''.join(self.code.split("\n")[:int(l[-1][len(TRACEPATTERN):])]))) + 1
caption = __l12n__(_.lng)['LIBRELOGO']
if __prevcode__ and "\n" in __prevcode__:
@@ -584,7 +589,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("\n")[line-1]
- if not "com.sun.star" in message and not "__repeat__" in message and not "*)" in message and ("[" in origline or "]" in origline):
+ if "com.sun.star" not in message and "__repeat__" not 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")
@@ -837,7 +842,7 @@ def run(arg=None, arg2 = -1):
else:
name = os.chdir(os.path.expanduser('~'))
__thread__.start()
- except Exception as e:
+ except Exception:
__thread__ = None
__trace__()
return None
@@ -1880,14 +1885,14 @@ def __loadlang__(lang, a):
for j in a[i[0]].split("|"):
__colors__[lang][j.lower()] = i[1]
for i in a:
- if not i[0:3] in ["LIB", "ERR", "PT", "INC", "MM", "CM", "HOU", "DEG"] and not i in __STRCONST__: # uppercase native commands
+ if i[0:3] not in ["LIB", "ERR", "PT", "INC", "MM", "CM", "HOU", "DEG"] and i not in __STRCONST__: # uppercase native commands
a[i] = a[i].upper()
repcount = a['REPCOUNT'].split('|')[0]
loopi = itertools.count()
loop = lambda r: "%(i)s = 1\n%(orig)s%(j)s = %(i)s\n%(i)s += 1\n" % \
{ "i": repcount + str(next(loopi)), "j": repcount, "orig": re.sub( r"(?ui)(?<!:)\b%s\b" % repcount, repcount + str(next(loopi)-1), r.group(0)) }
__comp__[lang] = [
- [r"(?i)(?<!:)(\b|(?=[-:]))(?:%s)\b" % "|".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)(?<!:)(\b|(?=[-:]))(?:%s)\b" % "|".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"(?<!:)\b(?:%s) \[(?= |\n)" % a['GROUP'], "\n__groupstart__()\nfor __groupindex__ in range(2):\n[\nif __groupindex__ == 1:\n[\n__groupend__()\nbreak\n]\n"],
[r"(?<!:)\b(?:%s) (%s[^[]*)\[(?= |\n)" % (a['GROUP'], __DECODE_STRING_REGEX__), "\n__groupstart__(\\1)\nfor __groupindex__ in range(2):\n[\nif __groupindex__ == 1:\n[\n__groupend__(\\1)\nbreak\n]\n"],
[r"(?<!:)\b(?:%s)\b" % a['GROUP'], "\n__removeshape__(__ACTUAL__)\n"],
@@ -2106,7 +2111,7 @@ def __compil__(s):
if "_" not in locals():
_ = lambda: None
_.lng = 'en_US'
- if not _.lng in __comp__:
+ if _.lng not in __comp__:
__loadlang__(_.lng, __l12n__(_.lng))
_.decimal = __l12n__(_.lng)['DECIMAL']