Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery refactored master branch #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented May 13, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

print("running %s ..." % example_name, end="")
print(f"running {example_name} ...", end="")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function worker refactored with the following changes:

ais_boxshp = display.DisplayShape(boxshp, update=True)[0]
return ais_boxshp
return display.DisplayShape(boxshp, update=True)[0]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function build_shape refactored with the following changes:

Comment on lines -47 to +46
for i in range(n_rotations):
for _ in range(n_rotations):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function rotating_cube_1_axis refactored with the following changes:

Comment on lines -66 to +65
for i in range(n_rotations):
for _ in range(n_rotations):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function rotating_cube_2_axis refactored with the following changes:

x, y, z = [random.uniform(0, 1) for i in range(3)]
x, y, z = [random.uniform(0, 1) for _ in range(3)]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function random_pnt refactored with the following changes:

Comment on lines -78 to +77
loc = TopLoc_Location(trsf)
return loc
return TopLoc_Location(trsf)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function location_from_vector refactored with the following changes:

"http://m-selig.ae.illinois.edu/ads/coord_seligFmt/%s.dat" % self.profile
f"http://m-selig.ae.illinois.edu/ads/coord_seligFmt/{self.profile}.dat"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function UiucAirfoil.make_shape refactored with the following changes:

face = n_sided.Face()
return face
return n_sided.Face()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function make_n_sided refactored with the following changes:

Comment on lines -95 to +101
if isinstance(pt, list) or isinstance(pt, tuple):
if isinstance(pt, (list, tuple)):
for i in pt:
poly.Add(i)
else:
poly.Add(pt)
poly.Build()
poly.Close()
result = poly.Wire()
return result
return poly.Wire()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function make_closed_polygon refactored with the following changes:

Comment on lines -114 to +112
edges = [i for i in TopologyExplorer(poly).edges()]
edges = list(TopologyExplorer(poly).edges())
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function geom_plate refactored with the following changes:

Comment on lines -247 to +245
print("Goal: %s radius: %s" % (i, rcs.curr_radius))
print(f"Goal: {i} radius: {rcs.curr_radius}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function solve_radius refactored with the following changes:

Comment on lines -270 to +268
face = make_face(plate.Surface(), uMin, uMax, vMin, vMax, 1e-6)
return face
return make_face(plate.Surface(), uMin, uMax, vMin, vMax, 1e-6)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function build_geom_plate refactored with the following changes:

shp = cut.Shape()
return shp
return cut.Shape()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function boolean_cut refactored with the following changes:

Comment on lines -66 to +65
f3 = boolean_cut(f, f2)
return f3
return boolean_cut(f, f2)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function make_face_to_contour_from refactored with the following changes:

Comment on lines -37 to +43
# loop over faces
fc_idx = 1

for face in expl.faces():
for fc_idx, face in enumerate(expl.faces(), start=1):
print("=== Face %i ===" % fc_idx)
surf = BRepAdaptor_Surface(face, True)
surf_type = surf.GetType()
# check each of the is a BSpline surface
# it should be, since we used the nurbs converter before
if not surf_type == GeomAbs_BSplineSurface:
if surf_type != GeomAbs_BSplineSurface:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 37-81 refactored with the following changes:

This removes the following comments ( why? ):

# loop over faces

Comment on lines -145 to +142
# Remove the revolved shape
cut = BRepAlgoAPI_Cut(base, moved_shape).Shape()
return cut
return BRepAlgoAPI_Cut(base, moved_shape).Shape()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function revolved_cut refactored with the following changes:

This removes the following comments ( why? ):

# Remove the revolved shape

Comment on lines -155 to +150
revolved_shape = revolved_cut(fused_shape)
return revolved_shape
return revolved_cut(fused_shape)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function generate_demo refactored with the following changes:

cut_2 = BRepAlgoAPI_Cut(cut_1, rounding_cut_2).Shape()

return cut_2
return BRepAlgoAPI_Cut(cut_1, rounding_cut_2).Shape()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function round_tooth refactored with the following changes:

Comment on lines -376 to +377
if inter_1.Point(1).X() > 0:
p1 = inter_1.Point(1)
else:
p1 = inter_1.Point(2)

if inter_2.Point(1).X() > 0:
p2 = inter_2.Point(1)
else:
p2 = inter_2.Point(2)

if inter_3.Point(1).X() > 0:
p3 = inter_3.Point(1)
else:
p3 = inter_3.Point(2)

if inter_4.Point(1).X() > 0:
p4 = inter_4.Point(1)
else:
p4 = inter_4.Point(2)

p1 = inter_1.Point(1) if inter_1.Point(1).X() > 0 else inter_1.Point(2)
p2 = inter_2.Point(1) if inter_2.Point(1).X() > 0 else inter_2.Point(2)
p3 = inter_3.Point(1) if inter_3.Point(1).X() > 0 else inter_3.Point(2)
p4 = inter_4.Point(1) if inter_4.Point(1).X() > 0 else inter_4.Point(2)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function cut_out refactored with the following changes:

Comment on lines -450 to +432
sprocket = cut_out(mountable_disc)
return sprocket
return cut_out(mountable_disc)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function build_sprocket refactored with the following changes:

Comment on lines -88 to +97
_str_slices.append(":" + str(i * n) + " ")
_str_slices.append(f":{str(i * n)} ")
elif i == n_procs:
# does a little extra work if the number of slices
# isn't divisible by n_procs
slices.append(z_slices[(i - 1) * n :])
_str_slices.append(str((i - 1) * n) + ": ")
_str_slices.append(f"{str((i - 1) * n)}: ")
print("last slice", len(z_slices[(i - 1) * n :]))
else:
slices.append(z_slices[(i - 1) * n : i * n])
_str_slices.append(" %s:%s " % ((i - 1) * n, i * n))
_str_slices.append(f" {(i - 1) * n}:{i * n} ")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function run refactored with the following changes:

print("Cube mass = %s" % mass)
print(f"Cube mass = {mass}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function cube_inertia_properties refactored with the following changes:

Comment on lines -53 to -58
shp_idx = 1
for face in t.faces():
for shp_idx, face in enumerate(t.faces(), start=1):
brepgprop_SurfaceProperties(face, props)
face_surf = props.Mass()
print("Surface for face nbr %i : %f" % (shp_idx, face_surf))
shp_idx += 1
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function shape_faces_surface refactored with the following changes:

Comment on lines -50 to +58
if not number_of_normals == number_of_vertices:
if number_of_normals != number_of_vertices:
raise AssertionError("wrong number of normals returned by the tessellator")

# if HAVE_NUMPY, we try to reshape the tuple so that it is of
# a ndarray such as [[x1, y1, z1], [x2, y2, z2], ...]
#
if HAVE_NUMPY:
vertices = np.array(vertices_position).reshape(int(number_of_vertices / 3), 3)
normals = np.array(normals).reshape(int(number_of_vertices / 3), 3)
vertices = np.array(vertices_position).reshape(number_of_vertices // 3, 3)
normals = np.array(normals).reshape(number_of_vertices // 3, 3)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 50-58 refactored with the following changes:

line3 = Geom2d_Line(P32d, gp_Dir2d((0.9 - 0.02), (0.1 - 0.1)))
line3 = Geom2d_Line(P32d, gp_Dir2d(0.9 - 0.02, 0.0))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function face refactored with the following changes:

Comment on lines -376 to +368
if abs(dx) <= tolerance and abs(dy) <= tolerance:
# zooming at a near nil value can segfault the opengl viewer
pass
else:
if abs(dx) > tolerance or abs(dy) > tolerance:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function GLWidget.on_zoom_area refactored with the following changes:

This removes the following comments ( why? ):

# zooming at a near nil value can segfault the opengl viewer

Comment on lines -470 to -471
perform_action = False

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function GLWidget._dispatch_camera_command_actions refactored with the following changes:

Comment on lines -598 to +585
if abs(dx) <= tolerance and abs(dy) <= tolerance:
pass

else:
if abs(dx) > tolerance or abs(dy) > tolerance:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function GLWidget.drawBox refactored with the following changes:

idx = 0
for i in range(n_toruses):
for idx, _ in enumerate(range(n_toruses)):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 33-52 refactored with the following changes:

for i in range(100):
for _ in range(100):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 30-30 refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants