Draft: Fix 'testing inequality to None' syntax (#7275)

* Draft: Fix 'testing inequality to None' syntax 

- Substitute `is not None` for `!= None`
- Trim trailing whitespace on touched files
This commit is contained in:
luzpaz
2022-07-29 18:26:56 -04:00
committed by GitHub
parent 922f6b83d6
commit 95070bded4
10 changed files with 69 additions and 69 deletions

View File

@@ -42,9 +42,9 @@ def make_bezcurve(pointslist,
closed=False, placement=None, face=None, support=None,
degree=None):
"""make_bezcurve(pointslist, [closed], [placement])
Creates a Bezier Curve object from the given list of vectors.
Parameters
----------
pointlist : [Base.Vector]
@@ -53,19 +53,19 @@ def make_bezcurve(pointslist,
TODO: Change the name so!
closed : bool
If closed is True or first and last points are identical,
If closed is True or first and last points are identical,
the created BSpline will be closed.
placement : Base.Placement
If a placement is given, it is used.
face : Bool
If face is False, the rectangle is shown as a wireframe,
otherwise as a face.
support :
face : Bool
If face is False, the rectangle is shown as a wireframe,
otherwise as a face.
support :
TODO: Describe
degree : int
Degree of the BezCurve
"""
@@ -92,7 +92,7 @@ def make_bezcurve(pointslist,
Part.BezierCurve().MaxDegree)
obj.Closed = closed
obj.Support = support
if face != None:
if face is not None:
obj.MakeFace = face
obj.Proxy.resetcontinuity(obj)
if placement: obj.Placement = placement

View File

@@ -40,9 +40,9 @@ if App.GuiUp:
def make_bspline(pointslist, closed=False, placement=None, face=None, support=None):
"""make_bspline(pointslist, [closed], [placement])
Creates a B-Spline object from the given list of vectors.
Parameters
----------
pointlist : [Base.Vector]
@@ -51,17 +51,17 @@ def make_bspline(pointslist, closed=False, placement=None, face=None, support=No
TODO: Change the name so!
closed : bool
If closed is True or first and last points are identical,
If closed is True or first and last points are identical,
the created BSpline will be closed.
placement : Base.Placement
If a placement is given, it is used.
face : Bool
If face is False, the rectangle is shown as a wireframe,
otherwise as a face.
support :
face : Bool
If face is False, the rectangle is shown as a wireframe,
otherwise as a face.
support :
TODO: Describe
"""
if not App.ActiveDocument:
@@ -97,7 +97,7 @@ def make_bspline(pointslist, closed=False, placement=None, face=None, support=No
obj.Closed = closed
obj.Points = pointslist
obj.Support = support
if face != None:
if face is not None:
obj.MakeFace = face
if placement: obj.Placement = placement
if App.GuiUp:

View File

@@ -45,29 +45,29 @@ def make_circle(radius, placement=None, face=None, startangle=None, endangle=Non
"""make_circle(radius, [placement, face, startangle, endangle])
or make_circle(edge,[face]):
Creates a circle object with given parameters.
Creates a circle object with given parameters.
Parameters
----------
radius : the radius of the circle.
placement :
If placement is given, it is used.
placement :
If placement is given, it is used.
face : Bool
If face is False, the circle is shown as a wireframe,
otherwise as a face.
If face is False, the circle is shown as a wireframe,
otherwise as a face.
startangle : start angle of the arc (in degrees)
endangle : end angle of the arc (in degrees)
if startangle and endangle are equal, a circle is created,
if startangle and endangle are equal, a circle is created,
if they are different an arc is created
edge : edge.Curve must be a 'Part.Circle'
the circle is created from the given edge
support :
support :
TODO: Describe
"""
@@ -87,7 +87,7 @@ def make_circle(radius, placement=None, face=None, startangle=None, endangle=Non
Circle(obj)
if face != None:
if face is not None:
obj.MakeFace = face
if isinstance(radius,Part.Edge):
@@ -112,14 +112,14 @@ def make_circle(radius, placement=None, face=None, startangle=None, endangle=Non
obj.LastAngle = a1
else:
obj.Radius = radius
if (startangle != None) and (endangle != None):
if (startangle is not None) and (endangle is not None):
if startangle == -0: startangle = 0
obj.FirstAngle = startangle
obj.LastAngle = endangle
obj.Support = support
if placement:
if placement:
obj.Placement = placement
if App.GuiUp:

View File

@@ -38,26 +38,26 @@ if App.GuiUp:
def make_ellipse(majradius, minradius, placement=None, face=None, support=None):
"""make_ellipse(majradius, minradius, [placement], [face], [support])
Makes an ellipse with the given major and minor radius, and optionally
a placement.
Parameters
----------
majradius :
majradius :
Major radius of the ellipse.
minradius :
minradius :
Minor radius of the ellipse.
placement : Base.Placement
If a placement is given, it is used.
face : Bool
If face is False, the rectangle is shown as a wireframe,
otherwise as a face.
support :
face : Bool
If face is False, the rectangle is shown as a wireframe,
otherwise as a face.
support :
TODO: Describe.
"""
@@ -74,7 +74,7 @@ def make_ellipse(majradius, minradius, placement=None, face=None, support=None):
obj.MinorRadius = minradius
obj.Support = support
if face != None:
if face is not None:
obj.MakeFace = face
if placement:

View File

@@ -44,20 +44,20 @@ def make_polygon(nfaces, radius=1, inscribed=True, placement=None, face=None, su
edges : int
Number of edges of the polygon.
radius :
radius :
Radius of the control circle.
inscribed : bool
Defines is the polygon is inscribed or not into the control circle.
placement : Base.Placement
If placement is given, it is used.
If placement is given, it is used.
face : bool
If face is True, the resulting shape is displayed as a face,
If face is True, the resulting shape is displayed as a face,
otherwise as a wireframe.
support :
support :
TODO: Describe
"""
if not App.ActiveDocument:
@@ -68,7 +68,7 @@ def make_polygon(nfaces, radius=1, inscribed=True, placement=None, face=None, su
Polygon(obj)
obj.FacesNumber = nfaces
obj.Radius = radius
if face != None:
if face is not None:
obj.MakeFace = face
if inscribed:
obj.DrawMode = "inscribed"

View File

@@ -84,7 +84,7 @@ def make_rectangle(length, height=0, placement=None, face=None, support=None):
obj.Height = height
obj.Support = support
if face != None:
if face is not None:
obj.MakeFace = face
if placement: obj.Placement = placement

View File

@@ -39,7 +39,7 @@ if App.GuiUp:
def make_wire(pointslist, closed=False, placement=None, face=None, support=None, bs2wire=False):
"""make_wire(pointslist, [closed], [placement])
Creates a Wire object from the given list of vectors. If face is
true (and wire is closed), the wire will appear filled. Instead of
a pointslist, you can also pass a Part Wire.
@@ -50,19 +50,19 @@ def make_wire(pointslist, closed=False, placement=None, face=None, support=None,
List of points to create the polyline
closed : bool
If closed is True or first and last points are identical,
If closed is True or first and last points are identical,
the created polyline will be closed.
placement : Base.Placement
If a placement is given, it is used.
face : Bool
If face is False, the rectangle is shown as a wireframe,
otherwise as a face.
support :
face : Bool
If face is False, the rectangle is shown as a wireframe,
otherwise as a face.
support :
TODO: Describe
bs2wire : bool
TODO: Describe
"""
@@ -96,16 +96,16 @@ def make_wire(pointslist, closed=False, placement=None, face=None, support=None,
if len(pointslist) == 0:
App.Console.PrintWarning("Draft Wire created with empty point list\n")
if placement:
utils.type_check([(placement, App.Placement)], "make_wire")
ipl = placement.inverse()
if not bs2wire:
pointslist = [ipl.multVec(p) for p in pointslist]
if len(pointslist) == 2:
if len(pointslist) == 2:
fname = "Line"
else:
else:
fname = "Wire"
obj = App.ActiveDocument.addObject("Part::Part2DObjectPython", fname)
@@ -113,11 +113,11 @@ def make_wire(pointslist, closed=False, placement=None, face=None, support=None,
obj.Points = pointslist
obj.Closed = closed
obj.Support = support
if face != None:
if face is not None:
obj.MakeFace = face
if placement:
if placement:
obj.Placement = placement
if App.GuiUp: