Skip to content
Permalink
Browse files

Fix warning regarding ABC import from collections

  • Loading branch information
tirkarthi authored and nyalldawson committed Sep 25, 2020
1 parent 776768e commit 4adb937ced11913fa217b5cf19537228c8c106c9
Showing with 13 additions and 5 deletions.
  1. +7 −3 tests/src/python/test_qgsdelimitedtextprovider.py
  2. +6 −2 tests/src/python/test_qgspallabeling_base.py
@@ -29,7 +29,11 @@
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 @@ def delimitedTextData(self, testname, filename, requests, verbose, **params):
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 @@
(at your option) any later version.
"""

import collections

__author__ = 'Larry Shaffer'
__date__ = '07/09/2013'
@@ -25,6 +24,11 @@
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 @@ def settingsDict(lyr):
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

0 comments on commit 4adb937

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