Skip to content

Commit

Permalink
Tidy installer_data.py and utils.py
Browse files Browse the repository at this point in the history
- Fix unused and missing imports
- Only import configparser is needed for Python 3
- Unnecessary string u prefix for Python 3
- Comment typo
  • Loading branch information
cjmayo authored and nyalldawson committed Sep 5, 2018
1 parent b2275df commit 70a37bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
16 changes: 4 additions & 12 deletions python/pyplugin_installer/installer_data.py
Expand Up @@ -28,22 +28,14 @@
QLocale, QByteArray)
from qgis.PyQt.QtXml import QDomDocument
from qgis.PyQt.QtNetwork import QNetworkRequest, QNetworkReply
from qgis.core import QgsSettings
from qgis.core import Qgis, QgsSettings
import sys
import os
import codecs
import re
try:
import configparser
except ImportError:
import configparser as configparser
try:
from importlib import reload
except ImportError:
from imp import reload
import configparser
import qgis.utils
from qgis.core import QgsNetworkAccessManager, QgsApplication
from qgis.gui import QgsMessageBar
from qgis.utils import iface, plugin_paths
from .version_compare import pyQgisVersion, compareVersions, normalizeVersion, isCompatible

Expand Down Expand Up @@ -565,7 +557,7 @@ def getInstalledPlugin(self, key, path, readOnly):
""" get the metadata of an installed plugin """
def metadataParser(fct):
""" plugin metadata parser reimplemented from qgis.utils
for better control on wchich module is examined
for better control of which module is examined
in case there is an installed plugin masking a core one """
global errorDetails
cp = configparser.ConfigParser()
Expand Down Expand Up @@ -625,7 +617,7 @@ def pluginMetadata(fct):
else:
error = "broken"
e = errorDetails
errorDetails = QCoreApplication.translate("QgsPluginInstaller", u"Error reading metadata")
errorDetails = QCoreApplication.translate("QgsPluginInstaller", "Error reading metadata")
if e:
errorDetails += ": " + e

Expand Down
7 changes: 2 additions & 5 deletions python/utils.py
Expand Up @@ -30,18 +30,15 @@

from qgis.PyQt.QtCore import QCoreApplication, QLocale, QThread
from qgis.PyQt.QtWidgets import QPushButton, QApplication
from qgis.core import Qgis, QgsExpression, QgsMessageLog, qgsfunction, QgsMessageOutput, QgsWkbTypes
from qgis.core import Qgis, QgsMessageLog, qgsfunction, QgsMessageOutput
from qgis.gui import QgsMessageBar

import os
import sys
import traceback
import glob
import os.path
try:
import configparser
except ImportError:
import ConfigParser as configparser
import configparser
import warnings
import codecs
import time
Expand Down

0 comments on commit 70a37bf

Please sign in to comment.