Skip to content

Commit f93dc90

Browse files
authoredFeb 23, 2018
Merge pull request #6434 from alexbruy/python-console
[python console] remove 'u' prefixes from strings (fix #18171)
2 parents 9a62305 + 7823025 commit f93dc90

File tree

6 files changed

+11
-17
lines changed

6 files changed

+11
-17
lines changed
 

‎python/console/console.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
***************************************************************************/
1919
Some portions of code were taken from https://code.google.com/p/pydee/
2020
"""
21-
from builtins import str
22-
from builtins import range
2321
import os
2422

2523
from qgis.PyQt.QtCore import Qt, QTimer, QCoreApplication, QSize, QByteArray, QFileInfo, QUrl, QDir

‎python/console/console_compile_apis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def _preparationFinished(self):
6464
rslt = self.tr("Error")
6565
if prepd:
6666
rslt = QCoreApplication.translate("PythonConsole", "Saved")
67-
self.ui.label.setText(u'{0} {1}'.format(self.ui.label.text(), rslt))
67+
self.ui.label.setText('{0} {1}'.format(self.ui.label.text(), rslt))
6868
self._api = None
6969
self.ui.progressBar.setVisible(False)
7070
self.ui.buttonBox.button(QDialogButtonBox.Cancel).setText(
@@ -73,7 +73,7 @@ def _preparationFinished(self):
7373

7474
def prepareAPI(self):
7575
# self.ui.textEdit_Qsci.setLexer(0)
76-
exec(u'self.qlexer = {0}(self.ui.textEdit_Qsci)'.format(self._api_lexer))
76+
exec('self.qlexer = {0}(self.ui.textEdit_Qsci)'.format(self._api_lexer))
7777
# self.ui.textEdit_Qsci.setLexer(self.qlexer)
7878
self._api = QsciAPIs(self.qlexer)
7979
self._api.apiPreparationFinished.connect(self._preparationFinished)

‎python/console/console_editor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def codepad(self):
432432
getCmd = []
433433
for strLine in listText:
434434
getCmd.append(strLine)
435-
pasteText = u"\n".join(getCmd)
435+
pasteText = "\n".join(getCmd)
436436
url = 'http://codepad.org'
437437
values = {'lang': 'Python',
438438
'code': pasteText,
@@ -591,7 +591,7 @@ def runScriptCode(self):
591591
tmpFile = self.createTempFile()
592592
filename = tmpFile
593593

594-
self.parent.pc.shell.runCommand(u"exec(open(u'{0}'.encode('{1}')).read())"
594+
self.parent.pc.shell.runCommand("exec(open('{0}'.encode('{1}')).read())"
595595
.format(filename.replace("\\", "/"), sys.getfilesystemencoding()))
596596

597597
def runSelectedCode(self): # spellok
@@ -626,9 +626,9 @@ def syntaxCheck(self, filename=None, fromContextMenu=True):
626626
if not filename:
627627
filename = self.parent.tw.currentWidget().path
628628
# source = open(filename, 'r').read() + '\n'
629-
if isinstance(source, type(u"")):
629+
if isinstance(source, type("")):
630630
source = source.encode('utf-8')
631-
if isinstance(filename, type(u"")):
631+
if isinstance(filename, type("")):
632632
filename = filename.encode('utf-8')
633633
if filename:
634634
compile(source, filename, 'exec')

‎python/console/console_output.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
***************************************************************************/
1919
Some portions of code were taken from https://code.google.com/p/pydee/
2020
"""
21-
from builtins import range
22-
from builtins import object
2321

2422
from qgis.PyQt.QtCore import Qt, QCoreApplication
2523
from qgis.PyQt.QtGui import QColor, QFont, QKeySequence, QFontDatabase

‎python/console/console_sci.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
***************************************************************************/
1919
Some portions of code were taken from https://code.google.com/p/pydee/
2020
"""
21-
from builtins import bytes
22-
from builtins import range
2321

2422
from qgis.PyQt.QtCore import Qt, QByteArray, QCoreApplication, QFile, QSize
2523
from qgis.PyQt.QtWidgets import QDialog, QMenu, QShortcut, QApplication
@@ -600,7 +598,7 @@ def runCommand(self, cmd):
600598
more = False
601599
else:
602600
self.buffer.append(cmd)
603-
src = u"\n".join(self.buffer)
601+
src = "\n".join(self.buffer)
604602
more = self.runsource(src)
605603
if not more:
606604
self.buffer = []
@@ -627,7 +625,7 @@ def runsource(self, source, filename='<input>', symbol='single'):
627625
hook = sys.excepthook
628626
try:
629627
def excepthook(etype, value, tb):
630-
self.write(u"".join(traceback.format_exception(etype, value, tb)))
628+
self.write("".join(traceback.format_exception(etype, value, tb)))
631629

632630
sys.excepthook = excepthook
633631

‎python/console/console_settings.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
***************************************************************************/
1919
Some portions of code were taken from https://code.google.com/p/pydee/
2020
"""
21-
from builtins import range
2221

2322
from qgis.PyQt.QtCore import QCoreApplication, QSize, Qt
2423
from qgis.PyQt.QtWidgets import QDialog, QFileDialog, QMessageBox, QTableWidgetItem
2524
from qgis.PyQt.QtGui import QIcon, QFont, QColor, QFontDatabase
26-
from .console_compile_apis import PrepareAPIDialog
2725

28-
from .ui_console_settings import Ui_SettingsDialogPythonConsole
2926
from qgis.core import QgsSettings
3027

28+
from .console_compile_apis import PrepareAPIDialog
29+
from .ui_console_settings import Ui_SettingsDialogPythonConsole
30+
3131

3232
class optionsDialog(QDialog, Ui_SettingsDialogPythonConsole):
3333

0 commit comments

Comments
 (0)
Please sign in to comment.