Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Upgrade DBManager and Grass plugins to Python 3.X
  • Loading branch information
Gustry authored and nyalldawson committed Apr 25, 2023
1 parent 66c88af commit 8f33d5e
Show file tree
Hide file tree
Showing 179 changed files with 117 additions and 530 deletions.
2 changes: 0 additions & 2 deletions python/plugins/db_manager/__init__.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
/***************************************************************************
Name : DB Manager
Expand Down
2 changes: 0 additions & 2 deletions python/plugins/db_manager/db_manager.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
/***************************************************************************
Name : DB Manager
Expand Down
5 changes: 1 addition & 4 deletions python/plugins/db_manager/db_manager_plugin.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
/***************************************************************************
Name : DB Manager
Expand All @@ -19,7 +17,6 @@
* *
***************************************************************************/
"""
from builtins import object

from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtWidgets import QAction, QApplication
Expand All @@ -35,7 +32,7 @@
from . import resources_rc # NOQA


class DBManagerPlugin(object):
class DBManagerPlugin:

def __init__(self, iface):
self.iface = iface
Expand Down
4 changes: 0 additions & 4 deletions python/plugins/db_manager/db_model.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
/***************************************************************************
Name : DB Manager
Expand All @@ -19,8 +17,6 @@
* *
***************************************************************************/
"""
from builtins import str
from builtins import range

from functools import partial
from qgis.PyQt.QtCore import Qt, QObject, qDebug, QByteArray, QMimeData, QDataStream, QIODevice, QFileInfo, QAbstractItemModel, QModelIndex, pyqtSignal
Expand Down
3 changes: 0 additions & 3 deletions python/plugins/db_manager/db_plugins/__init__.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
/***************************************************************************
Name : DB Manager
Expand All @@ -19,7 +17,6 @@
* *
***************************************************************************/
"""
from builtins import str


class NotSupportedDbType(Exception):
Expand Down
10 changes: 3 additions & 7 deletions python/plugins/db_manager/db_plugins/connector.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
/***************************************************************************
Name : DB Manager
Expand All @@ -19,15 +17,13 @@
* *
***************************************************************************/
"""
from builtins import str
from builtins import object

from qgis.core import QgsDataSourceUri

from .plugin import DbError, ConnectionError


class DBConnector(object):
class DBConnector:

def __init__(self, uri):
"""Creates a new DB connector
Expand Down Expand Up @@ -195,7 +191,7 @@ def quoteId(self, identifier):
)

identifier = str(
identifier) if identifier is not None else str() # make sure it's python unicode string
identifier) if identifier is not None else '' # make sure it's python unicode string
return '"%s"' % identifier.replace('"', '""')

@classmethod
Expand All @@ -208,7 +204,7 @@ def quoteString(self, txt):
if i is not None
)

txt = str(txt) if txt is not None else str() # make sure it's python unicode string
txt = str(txt) if txt is not None else '' # make sure it's python unicode string
return "'%s'" % txt.replace("'", "''")

@classmethod
Expand Down
4 changes: 0 additions & 4 deletions python/plugins/db_manager/db_plugins/data_model.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
/***************************************************************************
Name : DB Manager
Expand All @@ -19,8 +17,6 @@
* *
***************************************************************************/
"""
from builtins import str
from builtins import range

from qgis.PyQt.QtCore import (Qt,
QTime,
Expand Down
3 changes: 0 additions & 3 deletions python/plugins/db_manager/db_plugins/gpkg/connector.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
/***************************************************************************
Name : DB Manager
Expand All @@ -20,7 +18,6 @@
* *
***************************************************************************/
"""
from builtins import str

from functools import cmp_to_key

Expand Down
2 changes: 0 additions & 2 deletions python/plugins/db_manager/db_plugins/gpkg/data_model.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
/***************************************************************************
Name : DB Manager
Expand Down
2 changes: 0 additions & 2 deletions python/plugins/db_manager/db_plugins/gpkg/info_model.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
/***************************************************************************
Name : DB Manager
Expand Down
3 changes: 0 additions & 3 deletions python/plugins/db_manager/db_plugins/gpkg/plugin.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
/***************************************************************************
Name : DB Manager
Expand All @@ -19,7 +17,6 @@
* *
***************************************************************************/
"""
from builtins import str

# this will disable the dbplugin if the connector raise an ImportError
from .connector import GPKGDBConnector
Expand Down
2 changes: 0 additions & 2 deletions python/plugins/db_manager/db_plugins/gpkg/sql_dictionary.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
sql_dictionary.py
Expand Down
8 changes: 2 additions & 6 deletions python/plugins/db_manager/db_plugins/html_elems.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
/***************************************************************************
Name : DB Manager
Expand All @@ -19,11 +17,9 @@
* *
***************************************************************************/
"""
from builtins import str
from builtins import object


class HtmlContent(object):
class HtmlContent:

def __init__(self, data):
self.data = data if not isinstance(data, HtmlContent) else data.data
Expand Down Expand Up @@ -56,7 +52,7 @@ def hasContents(self):
return len(self.data) > 0


class HtmlElem(object):
class HtmlElem:

def __init__(self, tag, data, attrs=None):
self.tag = tag
Expand Down
9 changes: 3 additions & 6 deletions python/plugins/db_manager/db_plugins/info_model.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
/***************************************************************************
Name : DB Manager
Expand All @@ -19,14 +17,13 @@
* *
***************************************************************************/
"""
from builtins import object

from qgis.PyQt.QtWidgets import QApplication

from .html_elems import HtmlContent, HtmlSection, HtmlParagraph, HtmlList, HtmlTable, HtmlTableHeader, HtmlTableCol


class DatabaseInfo(object):
class DatabaseInfo:

def __init__(self, db):
self.db = db
Expand Down Expand Up @@ -124,7 +121,7 @@ def toHtml(self):
return HtmlContent(ret).toHtml()


class SchemaInfo(object):
class SchemaInfo:

def __init__(self, schema):
self.schema = schema
Expand Down Expand Up @@ -175,7 +172,7 @@ def toHtml(self):
return HtmlContent(ret).toHtml()


class TableInfo(object):
class TableInfo:

def __init__(self, table):
self.table = table
Expand Down
12 changes: 4 additions & 8 deletions python/plugins/db_manager/db_plugins/oracle/QtSqlDB.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
/***************************************************************************
Name : QtSqlDB
Expand All @@ -19,8 +17,6 @@
* *
***************************************************************************/
"""
from builtins import range
from builtins import object

from qgis.PyQt.QtCore import QVariant, QDate, QTime, QDateTime, QByteArray
from qgis.PyQt.QtSql import QSqlDatabase, QSqlQuery, QSqlField
Expand Down Expand Up @@ -60,16 +56,16 @@ def TimestampFromTicks(ticks):
class ConnectionError(Exception):

def __init__(self, *args, **kwargs):
super(ConnectionError, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)


class ExecError(Exception):

def __init__(self, *args, **kwargs):
super(ExecError, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)


class QtSqlDBCursor(object):
class QtSqlDBCursor:

def __init__(self, conn):
self.qry = QSqlQuery(conn)
Expand Down Expand Up @@ -189,7 +185,7 @@ def setoutputsize(self, size, column=None):
raise ExecError("nyi")


class QtSqlDBConnection(object):
class QtSqlDBConnection:
connections = 0

def __init__(self, driver, dbname, user, passwd):
Expand Down

0 comments on commit 8f33d5e

Please sign in to comment.