diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-04-04 20:01:17 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-04-09 16:43:34 +0200 |
commit | c4fa6efa67775a6b333a4a5aa873b5cc24a4f7bc (patch) | |
tree | d8977f4c2c97287865a2407b25c0327c49bbe17c /librelogo | |
parent | 2d64651e889e55f63c90ded24e63e17eaf52102f (diff) |
pyuno,*: kill Python 2 support with fire
Python 2 support was retained for use with --enable-python=system
on RHEL7 and SLES. The time has arrived to remove it.
Some .py files that were imported from third parties are not changed to
enable easier replacement with updated versions if necessary.
solenv/gdb should continue to support Python 2.
bin/get-bugzilla-attachments-by-mimetype requires Python 2 to access
Launchpad.
Change-Id: I26414ae8e9f8402c90336af82020135685694217
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91697
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'librelogo')
-rw-r--r-- | librelogo/source/LibreLogo/LibreLogo.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py index 2fa16ed81822..859b62e19532 100644 --- a/librelogo/source/LibreLogo/LibreLogo.py +++ b/librelogo/source/LibreLogo/LibreLogo.py @@ -6,17 +6,10 @@ # 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/. # -from __future__ import unicode_literals import sys, os, uno, unohelper import re, random, traceback, itertools import threading, time as __time__ -try: - unicode - next = lambda l: l.next() # python 2 -except: - unicode, long = str, int # support python 3 - __lng__ = {} def __trace__(): @@ -327,7 +320,7 @@ def __string__(s, decimal = None): # convert decimal sign, localized BOOL and SE s = s.replace(".", ",") return re.sub(__DECODE_STRING_REGEX__, __decodestring__, \ s.replace('set', __locname__('SET')).replace('True', __locname__('TRUE')).replace('False', __locname__('FALSE'))) - if type(s) in [str, unicode]: + if type(s) in [str]: return s elif type(s) == bool: return __locname__(str(s).upper()) @@ -1323,9 +1316,9 @@ def __fontstyle__(w): return __Slant_NONE__ def __color__(c): - if type(c) in [int, float, long]: + if type(c) in [int, float]: return c - if type(c) == unicode: + if type(c) == str: if c == u'any': rc, rv, rgray = __NORMCOLORS__[int(random.random()*7)], random.random(), random.random() ** 0.5 ratio = 1.0*abs(rc[2])/(abs(rc[2]) + abs(rc[4])) @@ -1610,12 +1603,12 @@ def __groupend__(name = ""): __removeshape__(__ACTUAL__) def __int__(x): # handle eg. int("10cm") - if type(x) == str or type(x) == unicode: + if type(x) == str: x = __float__(x) return int(x) def __float__(x): # handle eg. float("10,5cm") - if type(x) == str or type(x) == unicode: + if type(x) == str: for i in __comp__[_.lng]: x = re.sub(u"(?iu)" + i[0], i[1], x) x = eval(x) |