Path: Avoid dictionary.keys() if possible
This commit is contained in:
@@ -51,17 +51,17 @@ def setFeedRate(commandlist, ToolController):
|
||||
def _isVertical(currentposition, command):
|
||||
x = (
|
||||
command.Parameters["X"]
|
||||
if "X" in command.Parameters.keys()
|
||||
if "X" in command.Parameters
|
||||
else currentposition.x
|
||||
)
|
||||
y = (
|
||||
command.Parameters["Y"]
|
||||
if "Y" in command.Parameters.keys()
|
||||
if "Y" in command.Parameters
|
||||
else currentposition.y
|
||||
)
|
||||
z = (
|
||||
command.Parameters["Z"]
|
||||
if "Z" in command.Parameters.keys()
|
||||
if "Z" in command.Parameters
|
||||
else currentposition.z
|
||||
)
|
||||
endpoint = FreeCAD.Vector(x, y, z)
|
||||
|
||||
@@ -184,10 +184,10 @@ class BoneState(object):
|
||||
return self.bone.tip()
|
||||
|
||||
def boneIDs(self):
|
||||
return list(sorted(self.bones.keys()))
|
||||
return sorted(self.bones)
|
||||
|
||||
def zLevels(self):
|
||||
return list(sorted([bone.position().z for bone in self.bones.values()]))
|
||||
return sorted([bone.position().z for bone in self.bones.values()])
|
||||
|
||||
def length(self):
|
||||
return self.bone.length
|
||||
|
||||
@@ -242,7 +242,7 @@ class JobCreate:
|
||||
selectTemplate = Path.Preferences.defaultJobTemplate()
|
||||
index = 0
|
||||
self.dialog.jobTemplate.addItem("<none>", "")
|
||||
for name in sorted(template.keys()):
|
||||
for name in sorted(template):
|
||||
if template[name] == selectTemplate:
|
||||
index = self.dialog.jobTemplate.count()
|
||||
self.dialog.jobTemplate.addItem(name, template[name])
|
||||
|
||||
@@ -329,7 +329,7 @@ class JobPreferencesPage:
|
||||
)
|
||||
|
||||
def getPostProcessor(self, name):
|
||||
if not name in self.processor.keys():
|
||||
if not name in self.processor:
|
||||
processor = PostProcessor.load(name)
|
||||
self.processor[name] = processor
|
||||
return processor
|
||||
|
||||
@@ -373,7 +373,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
"extensionEdges.values(): {}".format(extensionEdges.values())
|
||||
)
|
||||
for edgeList in Part.sortEdges(
|
||||
list(extensionEdges.keys())
|
||||
list(extensionEdges)
|
||||
): # Identify connected edges that form wires
|
||||
self.edgeList = edgeList
|
||||
if len(edgeList) == 1:
|
||||
@@ -725,7 +725,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
else:
|
||||
cacheLabel = base.Name + "_" + sub + "_None"
|
||||
|
||||
if cacheLabel in self.extensionsCache.keys():
|
||||
if cacheLabel in self.extensionsCache:
|
||||
# Path.Log.debug("return _cachedExtension({})".format(cacheLabel))
|
||||
return self.extensionsCache[cacheLabel]
|
||||
else:
|
||||
|
||||
@@ -438,7 +438,7 @@ class DlgSelectPostProcessor:
|
||||
self.dialog.lwPostProcessor.itemEntered.connect(self.updateTooltip)
|
||||
|
||||
def updateTooltip(self, item):
|
||||
if item.text() in self.tooltips.keys():
|
||||
if item.text() in self.tooltips:
|
||||
tooltip = self.tooltips[item.text()]
|
||||
else:
|
||||
processor = PostProcessor.load(item.text())
|
||||
|
||||
Reference in New Issue
Block a user