Skip to content

Commit

Permalink
Fix flake failures
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson authored and troopa81 committed Oct 24, 2024
1 parent 9220e3f commit dd7e065
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions python/core/additions/qgssettingsentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self, key, pluginName, defaultValue, description=str(), options=Qgi
defaultValueStr = self.__metaEnum.valueToKey(defaultValue)
self.__enumFlagClass = defaultValue.__class__

if type(pluginName) == str:
if isinstance(pluginName, str):
parent = QgsSettingsTree.createPluginTreeNode(pluginName)
else:
parent = pluginName
Expand Down Expand Up @@ -127,7 +127,7 @@ def setValue(self, value, dynamicKeyPart: (list, str) = None):
QgsLogger.debug("Invalid enum/flag value '{0}'.".format(value))
return False

if type(dynamicKeyPart) == str:
if isinstance(dynamicKeyPart, str):
dynamicKeyPart = [dynamicKeyPart]
elif dynamicKeyPart is None:
dynamicKeyPart = []
Expand Down
2 changes: 1 addition & 1 deletion python/pyplugin_installer/version_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def compareVersions(a, b):

def splitVersion(s):
""" split string into 2 or 3 numerical segments """
if not s or type(s) != str:
if not s or not isinstance(s, str):
return None
l = str(s).split('.')
for c in l:
Expand Down
6 changes: 3 additions & 3 deletions tests/src/python/test_qgsgeometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2638,14 +2638,14 @@ def circle_curvepolygon():
message += ' failed'
message_with_wkt = message + f'\nOriginal geom: {geoms[t].asWkt()}'
if type(parts[t]) is list:
if type(parts[t][0]) == QgsPointXY:
if isinstance(parts[t][0], QgsPointXY):
self.assertEqual(geoms[t].addPointsXY(parts[t], geom_type), expected_result, message_with_wkt)
elif type(parts[t][0]) == QgsPoint:
elif isinstance(parts[t][0], QgsPoint):
self.assertEqual(geoms[t].addPoints(parts[t]), expected_result, message_with_wkt)
else:
self.fail(message_with_wkt + '\n could not detect what Python method to use for add part')
else:
if type(parts[t]) == QgsGeometry:
if isinstance(parts[t], QgsGeometry):
self.assertEqual(geoms[t].addPartGeometry(parts[t]), expected_result, message)
else:
self.assertEqual(geoms[t].addPart(parts[t], geom_type), expected_result, message_with_wkt)
Expand Down

0 comments on commit dd7e065

Please sign in to comment.