Skip to content
Permalink
Browse files

Silence python warnings from 3rd party libraries on startup

  • Loading branch information
nyalldawson committed May 21, 2018
1 parent 343872b commit c0d9528090274ba6f604d36af0c683b39d1e4de8
Showing with 186 additions and 66 deletions.
  1. +6 −1 python/plugins/MetaSearch/dialogs/maindialog.py
  2. +1 −0 python/plugins/MetaSearch/dialogs/newconnectiondialog.py
  3. +1 −0 python/plugins/MetaSearch/util.py
  4. +7 −4 python/plugins/processing/algs/gdal/GdalUtils.py
  5. +5 −2 python/plugins/processing/algs/qgis/ui/FieldsCalculatorDialog.py
  6. +6 −2 python/plugins/processing/gui/AutofillDialog.py
  7. +6 −2 python/plugins/processing/gui/BatchPanel.py
  8. +5 −2 python/plugins/processing/gui/ConfigDialog.py
  9. +6 −2 python/plugins/processing/gui/DestinationSelectionPanel.py
  10. +5 −2 python/plugins/processing/gui/DirectorySelectorDialog.py
  11. +6 −2 python/plugins/processing/gui/EditRenderingStylesDialog.py
  12. +6 −2 python/plugins/processing/gui/ExtentSelectionPanel.py
  13. +6 −2 python/plugins/processing/gui/FileSelectionPanel.py
  14. +6 −2 python/plugins/processing/gui/FixedTableDialog.py
  15. +6 −2 python/plugins/processing/gui/FixedTablePanel.py
  16. +6 −2 python/plugins/processing/gui/HelpEditionDialog.py
  17. +6 −2 python/plugins/processing/gui/HistoryDialog.py
  18. +5 −2 python/plugins/processing/gui/MessageDialog.py
  19. +6 −2 python/plugins/processing/gui/MultipleFileInputDialog.py
  20. +5 −2 python/plugins/processing/gui/MultipleInputDialog.py
  21. +6 −2 python/plugins/processing/gui/MultipleInputPanel.py
  22. +7 −4 python/plugins/processing/gui/NumberInputPanel.py
  23. +8 −3 python/plugins/processing/gui/ParametersPanel.py
  24. +6 −2 python/plugins/processing/gui/PointSelectionPanel.py
  25. +6 −2 python/plugins/processing/gui/PostgisTableSelector.py
  26. +6 −2 python/plugins/processing/gui/ProcessingToolbox.py
  27. +6 −2 python/plugins/processing/gui/RangePanel.py
  28. +6 −2 python/plugins/processing/gui/RenderingStyleFilePanel.py
  29. +6 −2 python/plugins/processing/gui/ResultsDock.py
  30. +6 −2 python/plugins/processing/gui/enummodelerwidget.py
  31. +6 −2 python/plugins/processing/gui/matrixmodelerwidget.py
  32. +5 −2 python/plugins/processing/modeler/ModelerDialog.py
  33. +6 −2 python/plugins/processing/script/ScriptEditorDialog.py
@@ -29,6 +29,7 @@

import json
import os.path
import warnings
from urllib.request import build_opener, install_opener, ProxyHandler

from qgis.PyQt.QtCore import Qt
@@ -43,7 +44,11 @@
from qgis.gui import QgsRubberBand
from qgis.utils import OverrideCursor

from owslib.csw import CatalogueServiceWeb # spellok
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=ResourceWarning)
warnings.filterwarnings("ignore", category=ImportWarning)
from owslib.csw import CatalogueServiceWeb # spellok

from owslib.fes import BBox, PropertyIsLike
from owslib.ows import ExceptionReport

@@ -27,6 +27,7 @@
#
###############################################################################

import warnings
from qgis.core import QgsSettings
from qgis.PyQt.QtWidgets import QDialog, QMessageBox

@@ -27,6 +27,7 @@
# avoid PendingDeprecationWarning from PyQt4.uic
import warnings
warnings.filterwarnings("ignore", category=PendingDeprecationWarning)
warnings.filterwarnings("ignore", category=DeprecationWarning)

import configparser
from gettext import gettext, ngettext
@@ -29,15 +29,16 @@
import subprocess
import platform
import re
import warnings

import psycopg2

from osgeo import gdal
from osgeo import ogr
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
from osgeo import ogr

from qgis.core import (Qgis,
QgsApplication,
QgsCoordinateReferenceSystem,
QgsVectorFileWriter,
QgsProcessingFeedback,
QgsProcessingUtils,
@@ -49,7 +50,9 @@
from processing.tools.system import isWindows, isMac

try:
from osgeo import gdal # NOQA
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
from osgeo import gdal # NOQA

gdalAvailable = True
except:
@@ -27,6 +27,7 @@

import os
import re
import warnings

from qgis.PyQt import uic
from qgis.PyQt.QtCore import Qt
@@ -53,8 +54,10 @@
from processing.gui.ParameterGuiUtils import getFileFilter

pluginPath = os.path.dirname(__file__)
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'DlgFieldsCalculator.ui'))
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'DlgFieldsCalculator.ui'))


class FieldCalculatorFeedback(QgsProcessingFeedback):
@@ -26,13 +26,17 @@
__revision__ = '$Format:%H$'

import os
import warnings

from qgis.PyQt import uic
from qgis.PyQt.QtWidgets import QDialog

pluginPath = os.path.split(os.path.dirname(__file__))[0]
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgAutofill.ui'))

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgAutofill.ui'))


class AutofillDialog(BASE, WIDGET):
@@ -27,6 +27,7 @@

import os
import json
import warnings

from qgis.PyQt import uic
from qgis.PyQt.QtWidgets import QTableWidgetItem, QComboBox, QHeaderView, QFileDialog, QMessageBox
@@ -43,8 +44,11 @@
from processing.tools import dataobjects

pluginPath = os.path.split(os.path.dirname(__file__))[0]
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'widgetBatchPanel.ui'))

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'widgetBatchPanel.ui'))


class BatchPanel(BASE, WIDGET):
@@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

import os
import warnings

from qgis.PyQt import uic
from qgis.PyQt.QtCore import Qt, QEvent
@@ -61,8 +62,10 @@


pluginPath = os.path.split(os.path.dirname(__file__))[0]
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgConfig.ui'))
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgConfig.ui'))


class ConfigOptionsPage(QgsOptionsPageWidget):
@@ -27,6 +27,7 @@

import re
import os
import warnings

from qgis.PyQt import uic
from qgis.PyQt.QtCore import QCoreApplication, QDir, pyqtSignal
@@ -49,8 +50,11 @@
from processing.gui.ParameterGuiUtils import getFileFilter

pluginPath = os.path.split(os.path.dirname(__file__))[0]
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'widgetBaseSelector.ui'))

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'widgetBaseSelector.ui'))


class DestinationSelectionPanel(BASE, WIDGET):
@@ -26,15 +26,18 @@
__revision__ = '$Format:%H$'

import os
import warnings

from qgis.PyQt import uic
from qgis.core import QgsSettings
from qgis.PyQt.QtWidgets import QDialog, QAbstractItemView, QPushButton, QDialogButtonBox, QFileDialog
from qgis.PyQt.QtGui import QStandardItemModel, QStandardItem

pluginPath = os.path.split(os.path.dirname(__file__))[0]
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgMultipleSelection.ui'))
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgMultipleSelection.ui'))


class DirectorySelectorDialog(BASE, WIDGET):
@@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

import os
import warnings

from qgis.PyQt import uic
from qgis.PyQt.QtCore import Qt
@@ -38,8 +39,11 @@
from processing.gui.RenderingStyleFilePanel import RenderingStyleFilePanel

pluginPath = os.path.split(os.path.dirname(__file__))[0]
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgRenderingStyles.ui'))

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgRenderingStyles.ui'))


class EditRenderingStylesDialog(BASE, WIDGET):
@@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

import os
import warnings

from qgis.PyQt import uic
from qgis.PyQt.QtWidgets import QMenu, QAction, QInputDialog
@@ -45,8 +46,11 @@
from processing.tools.dataobjects import createContext

pluginPath = os.path.split(os.path.dirname(__file__))[0]
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'widgetBaseSelector.ui'))

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'widgetBaseSelector.ui'))


class ExtentSelectionPanel(BASE, WIDGET):
@@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

import os
import warnings

from qgis.PyQt import uic
from qgis.PyQt.QtWidgets import QFileDialog
@@ -34,8 +35,11 @@
from processing.tools.system import isWindows

pluginPath = os.path.split(os.path.dirname(__file__))[0]
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'widgetBaseSelector.ui'))

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'widgetBaseSelector.ui'))


class FileSelectionPanel(BASE, WIDGET):
@@ -26,14 +26,18 @@
__revision__ = '$Format:%H$'

import os
import warnings

from qgis.PyQt import uic
from qgis.PyQt.QtWidgets import QDialog, QPushButton, QAbstractItemView, QDialogButtonBox
from qgis.PyQt.QtGui import QStandardItemModel, QStandardItem

pluginPath = os.path.split(os.path.dirname(__file__))[0]
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgFixedTable.ui'))

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgFixedTable.ui'))


class FixedTableDialog(BASE, WIDGET):
@@ -26,14 +26,18 @@
__revision__ = '$Format:%H$'

import os
import warnings

from qgis.PyQt import uic

from processing.gui.FixedTableDialog import FixedTableDialog

pluginPath = os.path.split(os.path.dirname(__file__))[0]
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'widgetBaseSelector.ui'))

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'widgetBaseSelector.ui'))


class FixedTablePanel(BASE, WIDGET):
@@ -27,6 +27,7 @@

import os
import json
import warnings

from qgis.PyQt import uic
from qgis.PyQt.QtWidgets import QDialog, QTreeWidgetItem
@@ -38,8 +39,11 @@
QgsProcessingModelAlgorithm)

pluginPath = os.path.split(os.path.dirname(__file__))[0]
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgHelpEdition.ui'))

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgHelpEdition.ui'))


class HelpEditionDialog(BASE, WIDGET):
@@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

import os
import warnings

from qgis.PyQt import uic
from qgis.PyQt.QtCore import Qt, QCoreApplication
@@ -35,8 +36,11 @@
from processing.core.ProcessingLog import ProcessingLog

pluginPath = os.path.split(os.path.dirname(__file__))[0]
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgHistory.ui'))

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgHistory.ui'))


class HistoryDialog(BASE, WIDGET):
@@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

import os
import warnings

from qgis.PyQt import uic
from qgis.PyQt.QtGui import QDesktopServices
@@ -34,8 +35,10 @@
from qgis.utils import iface

pluginPath = os.path.split(os.path.dirname(__file__))[0]
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgMessage.ui'))
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgMessage.ui'))


class MessageDialog(BASE, WIDGET):
@@ -28,6 +28,7 @@
__revision__ = '$Format:%H$'

import os
import warnings

from qgis.core import QgsSettings
from qgis.PyQt import uic
@@ -36,8 +37,11 @@
from qgis.PyQt.QtGui import QStandardItemModel, QStandardItem

pluginPath = os.path.split(os.path.dirname(__file__))[0]
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgMultipleSelection.ui'))

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
WIDGET, BASE = uic.loadUiType(
os.path.join(pluginPath, 'ui', 'DlgMultipleSelection.ui'))


class MultipleFileInputDialog(BASE, WIDGET):

0 comments on commit c0d9528

Please sign in to comment.
You can’t perform that action at this time.