Skip to content

Commit 70a37bf

Browse files
cjmayonyalldawson
authored andcommittedSep 5, 2018
Tidy installer_data.py and utils.py
- Fix unused and missing imports - Only import configparser is needed for Python 3 - Unnecessary string u prefix for Python 3 - Comment typo
1 parent b2275df commit 70a37bf

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed
 

‎python/pyplugin_installer/installer_data.py‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,14 @@
2828
QLocale, QByteArray)
2929
from qgis.PyQt.QtXml import QDomDocument
3030
from qgis.PyQt.QtNetwork import QNetworkRequest, QNetworkReply
31-
from qgis.core import QgsSettings
31+
from qgis.core import Qgis, QgsSettings
3232
import sys
3333
import os
3434
import codecs
3535
import re
36-
try:
37-
import configparser
38-
except ImportError:
39-
import configparser as configparser
40-
try:
41-
from importlib import reload
42-
except ImportError:
43-
from imp import reload
36+
import configparser
4437
import qgis.utils
4538
from qgis.core import QgsNetworkAccessManager, QgsApplication
46-
from qgis.gui import QgsMessageBar
4739
from qgis.utils import iface, plugin_paths
4840
from .version_compare import pyQgisVersion, compareVersions, normalizeVersion, isCompatible
4941

@@ -565,7 +557,7 @@ def getInstalledPlugin(self, key, path, readOnly):
565557
""" get the metadata of an installed plugin """
566558
def metadataParser(fct):
567559
""" plugin metadata parser reimplemented from qgis.utils
568-
for better control on wchich module is examined
560+
for better control of which module is examined
569561
in case there is an installed plugin masking a core one """
570562
global errorDetails
571563
cp = configparser.ConfigParser()
@@ -625,7 +617,7 @@ def pluginMetadata(fct):
625617
else:
626618
error = "broken"
627619
e = errorDetails
628-
errorDetails = QCoreApplication.translate("QgsPluginInstaller", u"Error reading metadata")
620+
errorDetails = QCoreApplication.translate("QgsPluginInstaller", "Error reading metadata")
629621
if e:
630622
errorDetails += ": " + e
631623

‎python/utils.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,15 @@
3030

3131
from qgis.PyQt.QtCore import QCoreApplication, QLocale, QThread
3232
from qgis.PyQt.QtWidgets import QPushButton, QApplication
33-
from qgis.core import Qgis, QgsExpression, QgsMessageLog, qgsfunction, QgsMessageOutput, QgsWkbTypes
33+
from qgis.core import Qgis, QgsMessageLog, qgsfunction, QgsMessageOutput
3434
from qgis.gui import QgsMessageBar
3535

3636
import os
3737
import sys
3838
import traceback
3939
import glob
4040
import os.path
41-
try:
42-
import configparser
43-
except ImportError:
44-
import ConfigParser as configparser
41+
import configparser
4542
import warnings
4643
import codecs
4744
import time

0 commit comments

Comments
 (0)
Please sign in to comment.