Merge pull request #5386 from m-kuhn/pylintFixes

Pylint fixes
This commit is contained in:
Matthias Kuhn 2017-10-17 08:31:48 +02:00 committed by GitHub
commit ba9e0437cc
37 changed files with 25 additions and 724 deletions

View File

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
Qsci.py
---------------------
Date : November 2015
Copyright : (C) 2015 by Matthias Kuhn
Email : matthias at opengis dot ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Matthias Kuhn'
__date__ = 'November 2015'
__copyright__ = '(C) 2015, Matthias Kuhn'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from PyQt4.Qsci import *

View File

@ -1,27 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
Qt.py
---------------------
Date : September 2016
Copyright : (C) 2015 by Marco Bernasocchi
Email : marco at opengis dot ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Marco Bernasocchi'
__date__ = 'September 2016'
__copyright__ = '(C) 2016, Marco Bernasocchi'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from PyQt4.Qt import *

View File

@ -1,67 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
QtCore.py
---------------------
Date : November 2015
Copyright : (C) 2015 by Matthias Kuhn
Email : matthias at opengis dot ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Matthias Kuhn'
__date__ = 'November 2015'
__copyright__ = '(C) 2015, Matthias Kuhn'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
import sip
for api in ["QDate", "QDateTime", "QString", "QTextStream", "QTime", "QUrl", "QVariant"]:
sip.setapi(api, 2)
from PyQt4.QtCore import *
from PyQt4.QtGui import QItemSelectionModel, QSortFilterProxyModel
# Add a __nonzero__ method onto QPyNullVariant so we can check for null values easier.
# >>> value = QPyNullVariant("int")
# >>> if value:
# >>> print "Not a null value"
from types import MethodType
from PyQt4.QtCore import QPyNullVariant
def __nonzero__(self):
return False
def __repr__(self):
return 'NULL'
def __eq__(self, other):
return isinstance(other, QPyNullVariant) or other is None
def __ne__(self, other):
return not isinstance(other, QPyNullVariant) and other is not None
def __hash__(self):
return 2178309
QPyNullVariant.__nonzero__ = MethodType(__nonzero__, None, QPyNullVariant)
QPyNullVariant.__repr__ = MethodType(__repr__, None, QPyNullVariant)
QPyNullVariant.__eq__ = MethodType(__eq__, None, QPyNullVariant)
QPyNullVariant.__ne__ = MethodType(__ne__, None, QPyNullVariant)
QPyNullVariant.__hash__ = MethodType(__hash__, None, QPyNullVariant)
NULL = QPyNullVariant(int)

View File

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
QtGui.py
---------------------
Date : November 2015
Copyright : (C) 2015 by Matthias Kuhn
Email : matthias at opengis dot ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Matthias Kuhn'
__date__ = 'November 2015'
__copyright__ = '(C) 2015, Matthias Kuhn'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from PyQt4.QtGui import *

View File

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
QtNetwork.py
---------------------
Date : February 2016
Copyright : (C) 2016 by Jürgen E. Fischer
Email : jef at norbit dot de
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Jürgen E. Fischer'
__date__ = 'February 2016'
__copyright__ = '(C) 2016, Jürgen E. Fischer'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from PyQt4.QtNetwork import *

View File

@ -1,35 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
QtPrintSupport.py
---------------------
Date : November 2015
Copyright : (C) 2015 by Matthias Kuhn
Email : matthias at opengis dot ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Matthias Kuhn'
__date__ = 'November 2015'
__copyright__ = '(C) 2015, Matthias Kuhn'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from PyQt4.QtGui import (
QAbstractPrintDialog,
QPageSetupDialog,
QPrintDialog,
QPrintEngine,
QPrintPreviewDialog,
QPrintPreviewWidget,
QPrinter,
QPrinterInfo
)

View File

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
QtSql.py
---------------------
Date : February 2016
Copyright : (C) 2016 by Jürgen E. Fischer
Email : jef at norbit dot de
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Jürgen E. Fischer'
__date__ = 'February 2016'
__copyright__ = '(C) 2016, Jürgen E. Fischer'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from PyQt4.QtSql import *

View File

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
QtSvg.py
---------------------
Date : March 2016
Copyright : (C) 2016 by Jürgen E. Fischer
Email : jef at norbit dot de
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Jürgen E. Fischer'
__date__ = 'March 2016'
__copyright__ = '(C) 2016, Jürgen E. Fischer'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from PyQt4.QtSvg import *

View File

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
QtTest.py
---------------------
Date : February 2016
Copyright : (C) 2016 by Jürgen E. Fischer
Email : jef at norbit dot de
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Jürgen E. Fischer'
__date__ = 'February 2016'
__copyright__ = '(C) 2016, Jürgen E. Fischer'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from PyQt4.QtTest import *

View File

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
QtWebKit.py
---------------------
Date : November 2015
Copyright : (C) 2015 by Matthias Kuhn
Email : matthias at opengis dot ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Matthias Kuhn'
__date__ = 'November 2015'
__copyright__ = '(C) 2015, Matthias Kuhn'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from PyQt4.QtWebKit import *

View File

@ -1,33 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
QtWebKitWidgets.py
---------------------
Date : November 2015
Copyright : (C) 2015 by Matthias Kuhn
Email : matthias at opengis dot ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Matthias Kuhn'
__date__ = 'November 2015'
__copyright__ = '(C) 2015, Matthias Kuhn'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from PyQt4.QtWebKit import (
QGraphicsWebView,
QWebFrame,
QWebHitTestResult,
QWebInspector,
QWebPage,
QWebView
)

View File

@ -1,225 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
QtWidgets.py
---------------------
Date : November 2015
Copyright : (C) 2015 by Matthias Kuhn
Email : matthias at opengis dot ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Matthias Kuhn'
__date__ = 'November 2015'
__copyright__ = '(C) 2015, Matthias Kuhn'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from PyQt4.QtGui import (
QAbstractButton,
QAbstractGraphicsShapeItem,
QAbstractItemDelegate,
QAbstractItemView,
QAbstractScrollArea,
QAbstractSlider,
QAbstractSpinBox,
QAction,
QActionGroup,
QApplication,
QBoxLayout,
QButtonGroup,
QCalendarWidget,
QCheckBox,
QColorDialog,
QColumnView,
QComboBox,
QCommandLinkButton,
QCommonStyle,
QCompleter,
QDataWidgetMapper,
QDateEdit,
QDateTimeEdit,
QDesktopWidget,
QDial,
QDialog,
QDialogButtonBox,
QDirModel,
QDockWidget,
QDoubleSpinBox,
QErrorMessage,
QFileDialog,
QFileIconProvider,
QFileSystemModel,
QFocusFrame,
QFontComboBox,
QFontDialog,
QFormLayout,
QFrame,
QGesture,
QGestureEvent,
QGestureRecognizer,
QGraphicsAnchor,
QGraphicsAnchorLayout,
QGraphicsBlurEffect,
QGraphicsColorizeEffect,
QGraphicsDropShadowEffect,
QGraphicsEffect,
QGraphicsEllipseItem,
QGraphicsGridLayout,
QGraphicsItem,
QGraphicsItemGroup,
QGraphicsLayout,
QGraphicsLayoutItem,
QGraphicsLineItem,
QGraphicsLinearLayout,
QGraphicsObject,
QGraphicsOpacityEffect,
QGraphicsPathItem,
QGraphicsPixmapItem,
QGraphicsPolygonItem,
QGraphicsProxyWidget,
QGraphicsRectItem,
QGraphicsRotation,
QGraphicsScale,
QGraphicsScene,
QGraphicsSceneContextMenuEvent,
QGraphicsSceneDragDropEvent,
QGraphicsSceneEvent,
QGraphicsSceneHelpEvent,
QGraphicsSceneHoverEvent,
QGraphicsSceneMouseEvent,
QGraphicsSceneMoveEvent,
QGraphicsSceneResizeEvent,
QGraphicsSceneWheelEvent,
QGraphicsSimpleTextItem,
QGraphicsTextItem,
QGraphicsTransform,
QGraphicsView,
QGraphicsWidget,
QGridLayout,
QGroupBox,
QHBoxLayout,
QHeaderView,
QInputDialog,
QItemDelegate,
QItemEditorCreatorBase,
QItemEditorFactory,
QKeyEventTransition,
QLCDNumber,
QLabel,
QLayout,
QLayoutItem,
QLineEdit,
QListView,
QListWidget,
QListWidgetItem,
QMainWindow,
QMdiArea,
QMdiSubWindow,
QMenu,
QMenuBar,
QMessageBox,
QMouseEventTransition,
QPanGesture,
QPinchGesture,
QPlainTextDocumentLayout,
QPlainTextEdit,
QProgressBar,
QProgressDialog,
QPushButton,
QRadioButton,
QRubberBand,
QScrollArea,
QScrollBar,
QShortcut,
QSizeGrip,
QSizePolicy,
QSlider,
QSpacerItem,
QSpinBox,
QSplashScreen,
QSplitter,
QSplitterHandle,
QStackedLayout,
QStackedWidget,
QStatusBar,
QStyle,
QStyleFactory,
QStyleHintReturn,
QStyleHintReturnMask,
QStyleHintReturnVariant,
QStyleOption,
QStyleOptionButton,
QStyleOptionComboBox,
QStyleOptionComplex,
QStyleOptionDockWidget,
QStyleOptionFocusRect,
QStyleOptionFrame,
QStyleOptionGraphicsItem,
QStyleOptionGroupBox,
QStyleOptionHeader,
QStyleOptionMenuItem,
QStyleOptionProgressBar,
QStyleOptionRubberBand,
QStyleOptionSizeGrip,
QStyleOptionSlider,
QStyleOptionSpinBox,
QStyleOptionTab,
QStyleOptionTabBarBase,
QStyleOptionTabWidgetFrame,
QStyleOptionTitleBar,
QStyleOptionToolBar,
QStyleOptionToolBox,
QStyleOptionToolButton,
QStyleOptionViewItem,
QStylePainter,
QStyledItemDelegate,
QSwipeGesture,
QSystemTrayIcon,
QTabBar,
QTabWidget,
QTableView,
QTableWidget,
QTableWidgetItem,
QTableWidgetSelectionRange,
QTapAndHoldGesture,
QTapGesture,
QTextBrowser,
QTextEdit,
QTimeEdit,
QToolBar,
QToolBox,
QToolButton,
QToolTip,
QTreeView,
QTreeWidget,
QTreeWidgetItem,
QTreeWidgetItemIterator,
QUndoCommand,
QUndoGroup,
QUndoStack,
QUndoView,
QVBoxLayout,
QWhatsThis,
QWidget,
QWidgetAction,
QWidgetItem,
QWizard,
QWizardPage,
qApp,
qDrawBorderPixmap,
qDrawPlainRect,
qDrawShadeLine,
qDrawShadePanel,
qDrawShadeRect,
qDrawWinButton,
qDrawWinPanel
)

View File

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
QtXml.py
---------------------
Date : February 2016
Copyright : (C) 2016 by Jürgen E. Fischer
Email : jef at norbit dot de
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Jürgen E. Fischer'
__date__ = 'February 2016'
__copyright__ = '(C) 2016, Jürgen E. Fischer'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from PyQt4.QtXml import *

View File

@ -1,24 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
__init__.py
---------------------
Date : November 2015
Copyright : (C) 2015 by Matthias Kuhn
Email : matthias at opengis dot ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Matthias Kuhn'
__date__ = 'November 2015'
__copyright__ = '(C) 2015, Matthias Kuhn'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

View File

@ -1,29 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
__init__.py
---------------------
Date : February 2016
Copyright : (C) 2016 by Jürgen E. Fischer
Email : jef at norbit dot de
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Jürgen E. Fischer'
__date__ = 'February 2016'
__copyright__ = '(C) 2016, Jürgen E. Fischer'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from PyQt4.uic.Compiler import indenter, compiler
from PyQt4.uic.objcreator import widgetPluginPath
from PyQt4.uic import properties, uiparser, Compiler
from PyQt4.uic import *

View File

@ -1 +0,0 @@
from PyQt4.uic import properties

View File

@ -1,31 +0,0 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
pyuic.py
---------------------
Date : February 2016
Copyright : (C) 2016 by Jürgen E. Fischer
Email : jef at norbit dot de
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Jürgen E. Fischer'
__date__ = 'February 2016'
__copyright__ = '(C) 2016, Jürgen E. Fischer'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
import sip
for api in ["QDate", "QDateTime", "QString", "QTextStream", "QTime", "QUrl", "QVariant"]:
sip.setapi(api, 2)
from PyQt4.uic import pyuic

View File

@ -200,9 +200,9 @@ class GPKGDBConnector(DBConnector):
raise DbError(e)
@classmethod
def isValidDatabase(self, path):
def isValidDatabase(cls, path):
if hasattr(gdal, 'OpenEx'):
ds = gdal.OpenEx(self.dbname)
ds = gdal.OpenEx(path)
if ds is None or ds.GetDriver().ShortName != 'GPKG':
return False
else:
@ -631,9 +631,9 @@ class GPKGDBConnector(DBConnector):
return True
if tablename.find('"') >= 0:
tablename = self.quotedId(tablename)
tablename = self.quoteId(tablename)
if new_table.find('"') >= 0:
new_table = self.quotedId(new_table)
new_table = self.quoteId(new_table)
gdal.ErrorReset()
self.gdal_ds.ExecuteSQL('ALTER TABLE %s RENAME TO %s' % (tablename, new_table))

View File

@ -60,13 +60,13 @@ def TimestampFromTicks(ticks):
class ConnectionError(Exception):
def __init__(self, *args, **kwargs):
super(Exception, self).__init__(*args, **kwargs)
super(ConnectionError, self).__init__(*args, **kwargs)
class ExecError(Exception):
def __init__(self, *args, **kwargs):
super(Exception, self).__init__(*args, **kwargs)
super(ExecError, self).__init__(*args, **kwargs)
class QtSqlDBCursor(object):

View File

@ -1698,12 +1698,11 @@ class OracleDBConnector(DBConnector):
if self.userTablesOnly:
sql = u"""
SELECT DISTINCT tablename
FROM "oracle_{0}" WHERE ownername = '{1}'
FROM "oracle_{conn}" WHERE ownername = '{user}'
UNION
SELECT DISTINCT ownername
FROM "oracle_{0}" WHERE ownername = '{1}'
""".format(self.connName, self.user, self.connName,
self.user)
FROM "oracle_{conn}" WHERE ownername = '{user}'
""".format(conn=self.connName, user=self.user)
c = self.cache_connection.cursor()
c.execute(sql)

View File

@ -103,7 +103,7 @@ class DBPlugin(QObject):
return DatabaseInfo(None)
def connect(self, parent=None):
raise NotImplemented
raise NotImplementedError('Needs to be implemented by subclasses')
def connectToUri(self, uri):
self.db = self.databasesFactory(self, uri)
@ -128,7 +128,7 @@ class DBPlugin(QObject):
@classmethod
def addConnection(self, conn_name, uri):
raise NotImplemented
raise NotImplementedError('Needs to be implemented by subclasses')
@classmethod
def icon(self):
@ -170,7 +170,7 @@ class DBPlugin(QObject):
@classmethod
def addConnectionActionSlot(self, item, action, parent):
raise NotImplemented
raise NotImplementedError('Needs to be implemented by subclasses')
def removeActionSlot(self, item, action, parent):
QApplication.restoreOverrideCursor()
@ -726,8 +726,8 @@ class Table(DbItemObject):
def tableDataModel(self, parent):
pass
def tableFieldsFactory(self):
return None
def tableFieldsFactory(self, row, table):
raise NotImplementedError('Needs to be implemented by subclasses')
def fields(self):
if self._fields is None:

View File

@ -849,7 +849,7 @@ class PostGisDBConnector(DBConnector):
if self.isGeometryColumn(table, column):
# use PostGIS function to delete geometry column correctly
schema, tablename = self.getSchemaTableName(table)
schema_part = u"%s, " % self._quote_unicode(schema) if schema else ""
schema_part = u"%s, " % self.quoteString(schema) if schema else ""
sql = u"SELECT DropGeometryColumn(%s%s, %s)" % (
schema_part, self.quoteString(tablename), self.quoteString(column))
else:
@ -971,7 +971,7 @@ class PostGisDBConnector(DBConnector):
def deleteSpatialIndex(self, table, geom_column='geom'):
schema, tablename = self.getSchemaTableName(table)
idx_name = self.quoteId(u"sidx_%s_%s" % (tablename, geom_column))
return self.dropTableIndex(table, idx_name)
return self.deleteTableIndex(table, idx_name)
def execution_error_types(self):
return psycopg2.Error, psycopg2.ProgrammingError, psycopg2.Warning

View File

@ -199,12 +199,3 @@ class DlgExportVector(QDialog, Ui_Dialog):
QMessageBox.information(self, self.tr("Export to file"), self.tr("Export finished."))
return QDialog.accept(self)
if __name__ == '__main__':
import sys
a = QApplication(sys.argv)
dlg = DlgExportVector()
dlg.show()
sys.exit(a.exec_())

View File

@ -391,12 +391,3 @@ class DlgImportVector(QDialog, Ui_Dialog):
# from this dialog!
self.deleteInputLayer()
QDialog.closeEvent(self, event)
if __name__ == '__main__':
import sys
a = QApplication(sys.argv)
dlg = DlgImportVector()
dlg.show()
sys.exit(a.exec_())

View File

@ -113,7 +113,7 @@ class GdalUtils(object):
retry_count += 1
else:
raise IOError(
e.message + u'\nTried 5 times without success. Last iteration stopped after reading {} line(s).\nLast line(s):\n{}'.format(
str(e) + u'\nTried 5 times without success. Last iteration stopped after reading {} line(s).\nLast line(s):\n{}'.format(
len(loglines), u'\n'.join(loglines[-10:])))
QgsMessageLog.logMessage('\n'.join(loglines), 'Processing', QgsMessageLog.INFO)

View File

@ -83,9 +83,6 @@ class Ogr2OgrToPostGisList(GdalAlgorithm):
GdalAlgorithm.__init__(self)
self.processing = False
def __init__(self):
super().__init__()
def initAlgorithm(self, config=None):
self.addParameter(ParameterString(
self.DATABASE,

View File

@ -45,7 +45,7 @@ def multipleOutputDir(alg, field, basename=None):
commands = ["for r in $(g.list type=rast pattern='{}*'); do".format(basename)]
# Otherwise, export everything
else:
commands = ["for r in $(g.list type=rast); do".format(basename)]
commands = ["for r in $(g.list type=rast); do"]
commands.append(" r.out.gdal -c -t -f input=${{r}} output={}/${{r}}.tif createopt=\"TFW=YES,COMPRESS=LZW\"".format(outputDir))
commands.append("done")
alg.commands.extend(commands)

View File

0
python/plugins/processing/algs/qgis/SpatialJoin.py Executable file → Normal file
View File

View File

View File

0
python/plugins/processing/algs/qgis/Union.py Executable file → Normal file
View File

View File

@ -138,6 +138,7 @@ class SagaAlgorithm(GeoAlgorithm):
self.exportedLayers = {}
self.preProcessInputs()
extent = None
# 1: Export rasters to sgrd and vectors to shp
# Tables must be in dbf format. We check that.

View File

@ -81,7 +81,7 @@ class SplitRGBBands(GeoAlgorithm):
g = self.getOutputValue(SplitRGBBands.G)
b = self.getOutputValue(SplitRGBBands.B)
commands = []
version = SagaUtils.getSagaInstalledVersion(True) # NOQA
version = SagaUtils.getInstalledVersion(True)
trailing = ""
lib = ""
commands.append('%sio_gdal 0 -GRIDS "%s" -FILES "%s"' % (lib, temp, input)

View File

@ -28,7 +28,6 @@ import codecs
from qgis.core import (QgsApplication,
QgsProcessingParameterDefinition)
from processing.core.Processing import Processing
from processing.core.parameters import ParameterMultipleInput, ParameterTableField, ParameterVector, ParameterSelection
from processing.tools.system import mkdir
@ -106,7 +105,7 @@ def baseHelpForAlgorithm(alg, folder):
def createBaseHelpFiles(folder):
for provider in Processing.providers:
for provider in QgsApplication.processingRegistry().providers():
if 'grass' in provider.id():
continue

View File

@ -735,7 +735,7 @@ class GeoDB(object):
sql = "SELECT has_database_privilege('%(d)s', 'CREATE'), \
has_database_privilege('%(d)s', 'TEMP')" \
% {'d': self._quote_unicode(self.dbname)}
% {'d': self._quote_unicode(self.uri.database())}
c = self.con.cursor()
self._exec_sql(c, sql)
return c.fetchone()

View File

@ -62,6 +62,7 @@ class TestQgsSpatialiteProvider(unittest.TestCase, ProviderTestCase):
@classmethod
def setUpClass(cls):
"""Run before all tests"""
print(' ### Setup Spatialite Provider Test Class')
# setup provider for base tests
cls.vl = QgsVectorLayer('dbname=\'{}/provider/spatialite.db\' table="somedata" (geom) sql='.format(TEST_DATA_DIR), 'test', 'spatialite')
assert(cls.vl.isValid())
@ -160,6 +161,8 @@ class TestQgsSpatialiteProvider(unittest.TestCase, ProviderTestCase):
@classmethod
def tearDownClass(cls):
"""Run after all tests"""
print(' ### Tear Down Spatialite Provider Test Class')
# for the time being, keep the file to check with qgis
# if os.path.exists(cls.dbname) :
# os.remove(cls.dbname)