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 #63

Closed
wants to merge 1 commit into from
Closed

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Apr 16, 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!

@sourcery-ai sourcery-ai bot requested a review from tpaviot April 16, 2023 06:28
Copy link
Author

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Due to GitHub API limits, only the first 60 comments can be shown.

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:

examples/core_animation.py Show resolved Hide resolved
examples/core_animation.py Show resolved Hide resolved
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:

for i in range(0, 40):
for i in range(40):
Copy link
Author

Choose a reason for hiding this comment

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

Function faircurve 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 -66 to +65
shape = feature_maker.Shape()
return shape
return feature_maker.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 add_feature refactored with the following changes:

Comment on lines -102 to +100
fuse = BRepAlgoAPI_Fuse(base, torus).Shape()
return fuse
return BRepAlgoAPI_Fuse(base, torus).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_fuse refactored with the following changes:

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 -299 to +297
for i in range(0, 8):
for i in range(8):
Copy link
Author

Choose a reason for hiding this comment

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

Function clone_tooth refactored with the following changes:

Comment on lines -332 to +330
for i in range(0, mounting_hole_count):
for i in range(mounting_hole_count):
Copy link
Author

Choose a reason for hiding this comment

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

Function mounting_holes 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:

Comment on lines -28 to +34
arr = np.random.uniform(-spread / 2.0, spread / 2.0, (n, 3))
for i in arr:
yield i
yield from np.random.uniform(-spread / 2.0, spread / 2.0, (n, 3))
except ImportError:
n_ = n / 100
warnings.warn(
"Numpy could not be imported... this example will run very SLOW"
"drawing {} rather than {} lines".format(n_, n)
f"Numpy could not be imported... this example will run very SLOWdrawing {n_} rather than {n} lines"
)
for i in range(n_):
for _ in range(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 generate_points refactored with the following changes:

Comment on lines -325 to +343
if buttons == QtCore.Qt.LeftButton and not modifiers == QtCore.Qt.ShiftModifier:
if (
buttons == QtCore.Qt.LeftButton
and modifiers != QtCore.Qt.ShiftModifier
):
self.current_action = ON_DYN_ROT

# dynamic zoom
elif (
buttons == QtCore.Qt.RightButton
and not modifiers == QtCore.Qt.ShiftModifier
and modifiers != QtCore.Qt.ShiftModifier
):
self.current_action = ON_DYN_ZOOM

# dynamic panning
elif buttons == QtCore.Qt.MidButton:
self.current_action = ON_DYN_PAN

# zoom window, overpaints rectangle
elif buttons == QtCore.Qt.RightButton and modifiers == QtCore.Qt.ShiftModifier:
elif buttons == QtCore.Qt.RightButton:
self.current_action = ON_ZOOM_AREA

# select area
elif buttons == QtCore.Qt.LeftButton and modifiers == QtCore.Qt.ShiftModifier:
elif buttons == QtCore.Qt.LeftButton:
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.mouseMoveEvent refactored with the following changes:

This removes the following comments ( why? ):

# dynamic zoom
# select area
# zoom window, overpaints rectangle
# dynamic panning

if self._have_pyqt5:
delta = event.angleDelta().y()
else:
delta = event.delta()

if delta > 0:
self.zoom_factor = 1.3
else:
self.zoom_factor = 0.7
delta = event.angleDelta().y() if self._have_pyqt5 else event.delta()
self.zoom_factor = 1.3 if delta > 0 else 0.7
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.wheelEvent refactored with the following changes:

Comment on lines -377 to +378
if abs(dx) <= tolerance and abs(dy) <= tolerance:
# zooming at a near nil value can segfault the opengl viewer
pass
else:
if not self.is_right_mouse_button_surpressed:
coords = [
self.point_on_mouse_press[0],
self.point_on_mouse_press[1],
self.point_on_mouse_move[0],
self.point_on_mouse_move[1],
]
self._display.ZoomArea(*coords)
if (
abs(dx) > tolerance or abs(dy) > tolerance
) and not self.is_right_mouse_button_surpressed:
coords = [
self.point_on_mouse_press[0],
self.point_on_mouse_press[1],
self.point_on_mouse_move[0],
self.point_on_mouse_move[1],
]
self._display.ZoomArea(*coords)
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 -471 to -472
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:

@tpaviot tpaviot closed this May 12, 2023
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.

1 participant