diff --git a/src/Mod/PartDesign/FeatureHole/Standards.py b/src/Mod/PartDesign/FeatureHole/Standards.py index e06144b682..7ead8748df 100644 --- a/src/Mod/PartDesign/FeatureHole/Standards.py +++ b/src/Mod/PartDesign/FeatureHole/Standards.py @@ -349,7 +349,7 @@ def getStandards(holetype): def getBaseDiameters(standard): "Return the base diameters of all holes defined in the given norm" - if not standard in standards.keys(): + if not standard in standards: return [] #FreeCAD.Console.PrintMessage("Getting diameters for " + standard + "\n") if standards[standard][StandardType] == "through": @@ -363,7 +363,7 @@ def getBaseDiameters(standard): return [] def getThroughHoleDia(standard, threadDia, tolerance = "medium"): - if not standard in standards_through.keys(): + if not standard in standards_through: raise Exception("No such standard exists") values = standards_through[standard] if not threadDia in values: @@ -372,12 +372,12 @@ def getThroughHoleDia(standard, threadDia, tolerance = "medium"): return values[threadDia][standards_tolerance.index(tolerance)] def getThroughHoleStandard(standard): - if not standard in standards_counterbore_through.keys(): + if not standard in standards_counterbore_through: raise Exception("No such standard exists") return standards_counterbore_through[standard] def getCounterboreDia(standard, threadDia, extraStandard = ""): - if not standard in standards_counterbore.keys(): + if not standard in standards_counterbore: raise Exception("No such standard exists") values = standards_counterbore[standard] if not threadDia in values: @@ -401,7 +401,7 @@ def calcCounterboreDepth(standard, threadDia, standardBolt, standardsWashers return headHeight + washerHeight + extraDepth def getRowStandards(standard): - if not standard in standards_counterbore_rows.keys(): + if not standard in standards_counterbore_rows: raise Exception("No such standard exists") result = [] rowdict = standards_counterbore_rows[standard] @@ -412,7 +412,7 @@ def getRowStandards(standard): return result def getCountersinkDia(standard, threadDia): - if not standard in standards_countersink.keys(): + if not standard in standards_countersink: raise Exception("No such standard exists") values = standards_countersink[standard] if not threadDia in values: @@ -421,7 +421,7 @@ def getCountersinkDia(standard, threadDia): return values[threadDia][standards_countersink_dia] def getCountersinkAngle(standard, threadDia): - if not standard in standards_countersink.keys(): + if not standard in standards_countersink: raise Exception("No such standard exists") values = standards_countersink[standard] if not threadDia in values: @@ -430,7 +430,7 @@ def getCountersinkAngle(standard, threadDia): return values[threadDia][standards_countersink_angle] def getThreadCoreDiameter(standard, threadDia): - if not standard in standards_thread.keys(): + if not standard in standards_thread: raise Exception("No such standard exists") values = standards_thread[standard] if not threadDia in values: @@ -439,7 +439,7 @@ def getThreadCoreDiameter(standard, threadDia): return values[threadDia][standards_thread_innercoredia] def getThreadFinishLength(standard, threadDia, length = "normal"): - if not standard in standards_threaded.keys(): + if not standard in standards_threaded: raise Exception("No such standard exists") stdThread = standards_threaded_thread[standard] values = standards_thread[stdThread] diff --git a/src/Mod/PartDesign/SprocketFeature.py b/src/Mod/PartDesign/SprocketFeature.py index e929e9f4ec..ebbeb5abf0 100644 --- a/src/Mod/PartDesign/SprocketFeature.py +++ b/src/Mod/PartDesign/SprocketFeature.py @@ -125,7 +125,7 @@ class Sprocket: obj.addProperty("App::PropertyEnumeration","SprocketReference","Sprocket","Sprocket Reference") obj.addProperty("App::PropertyLength","Thickness","Sprocket","Thickness as stated in the reference specification") - obj.SprocketReference = list(self.SprocketReferenceRollerTable.keys()) + obj.SprocketReference = list(self.SprocketReferenceRollerTable) obj.NumberOfTeeth = 50 obj.Pitch = "0.375 in" diff --git a/src/Mod/PartDesign/WizardShaft/SegmentFunction.py b/src/Mod/PartDesign/WizardShaft/SegmentFunction.py index f1c4d12c51..675f87e415 100644 --- a/src/Mod/PartDesign/WizardShaft/SegmentFunction.py +++ b/src/Mod/PartDesign/WizardShaft/SegmentFunction.py @@ -121,7 +121,7 @@ class SegmentFunction: def buildFromDict(self, var, dict): self.variable = var - for key in sorted(dict.keys()): + for key in sorted(dict): #if abs(dict[key]) > 1E-9: self.segments.append(SegmentFunctionSegment(key, var, dict[key], 0)) @@ -130,7 +130,7 @@ class SegmentFunction: self.segments.insert(self.index(st), SegmentFunctionSegment(st, self.variable, coeff, exp)) def addSegments(self, dict): - for key in sorted(dict.keys()): + for key in sorted(dict): self.addSegment(key, dict[key]) def setMaxX(self, mx): diff --git a/src/Mod/PartDesign/WizardShaft/WizardShaftTable.py b/src/Mod/PartDesign/WizardShaft/WizardShaftTable.py index db4aa6db0c..8ac62a1c0c 100644 --- a/src/Mod/PartDesign/WizardShaft/WizardShaftTable.py +++ b/src/Mod/PartDesign/WizardShaft/WizardShaftTable.py @@ -53,8 +53,8 @@ class WizardShaftTable: ] def __init__(self, w, s): - for key in iter(self.rowDict.keys()): - self.rowDictReverse[self.rowDict[key]] = key + for key, val in self.rowDict.items(): + self.rowDictReverse[val] = key # Set parent wizard (for connecting slots) self.wizard = w self.shaft = s