mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Fix warning regarding ABC import from collections
This commit is contained in:
parent
776768eb9f
commit
4adb937ced
@ -29,7 +29,11 @@ import tempfile
|
||||
import inspect
|
||||
import time
|
||||
import test_qgsdelimitedtextprovider_wanted as want # NOQA
|
||||
import collections
|
||||
|
||||
try:
|
||||
from collections.abc import Callable
|
||||
except ImportError:
|
||||
from collections import Callable
|
||||
|
||||
rebuildTests = 'REBUILD_DELIMITED_TEXT_TESTS' in os.environ
|
||||
|
||||
@ -305,11 +309,11 @@ class TestQgsDelimitedTextProviderOther(unittest.TestCase):
|
||||
for nr, r in enumerate(requests):
|
||||
if verbose:
|
||||
print(("Processing request", nr + 1, repr(r)))
|
||||
if isinstance(r, collections.Callable):
|
||||
if isinstance(r, Callable):
|
||||
r(layer)
|
||||
if verbose:
|
||||
print("Request function executed")
|
||||
if isinstance(r, collections.Callable):
|
||||
if isinstance(r, Callable):
|
||||
continue
|
||||
rfields, rtypes, rdata = self.layerData(layer, r, nr * 1000)
|
||||
if len(rfields) > len(fields):
|
||||
|
@ -11,7 +11,6 @@ the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
"""
|
||||
|
||||
import collections
|
||||
|
||||
__author__ = 'Larry Shaffer'
|
||||
__date__ = '07/09/2013'
|
||||
@ -25,6 +24,11 @@ import datetime
|
||||
import glob
|
||||
import shutil
|
||||
|
||||
try:
|
||||
from collections.abc import Callable
|
||||
except ImportError:
|
||||
from collections import Callable
|
||||
|
||||
from qgis.PyQt.QtCore import QSize, qDebug, Qt
|
||||
from qgis.PyQt.QtGui import QFont, QColor
|
||||
|
||||
@ -267,7 +271,7 @@ class TestQgsPalLabeling(unittest.TestCase):
|
||||
value = getattr(lyr, attr)
|
||||
if isinstance(value, (QgsGeometry, QgsStringReplacementCollection, QgsCoordinateTransform)):
|
||||
continue # ignore these objects
|
||||
if not isinstance(value, collections.Callable):
|
||||
if not isinstance(value, Callable):
|
||||
res[attr] = value
|
||||
return res
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user