Skip to content

Commit

Permalink
remove redundant parentheses around strings
Browse files Browse the repository at this point in the history
  • Loading branch information
marscher committed Dec 13, 2023
1 parent d45e1c7 commit 5362d91
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 27 deletions.
4 changes: 2 additions & 2 deletions weldx_widgets/widget_evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def make_output():
spatial_data_geo_reduced, "workpiece geometry (reduced)", "workpiece"
)

with tabs[("CSM-Subsystems")]:
with tabs["CSM-Subsystems"]:
csm.plot_graph()
plt.show()
self._show_csm_subsystems(csm)
Expand Down Expand Up @@ -228,7 +228,7 @@ def _show_csm_subsystems(csm):
subsystems = csm.subsystems
if not subsystems:
return
print(csm.subsystem_names)
print(csm.subsystem_names) # noqa: T201
fig, ax = plt.subplots(ncols=len(subsystems))
for i, subsystem in enumerate(subsystems):
subsystem.plot_graph(ax=ax[i])
Expand Down
4 changes: 1 addition & 3 deletions weldx_widgets/widget_gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ def _check(self, value):
gas_components = self.to_tree()["gas_component"]
if not sum(g.gas_percentage for g in gas_components) == 100:
with self.out:
print(
"Check percentages, all components should sum up to 100!"
) # , file=sys.stderr)
print("Check percentages, all components should sum up to 100!") # noqa: T201
else:
# remove output, if everything is alright.
self.out.clear_output()
Expand Down
45 changes: 23 additions & 22 deletions weldx_widgets/widget_groove_sel.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ class WidgetCADExport(WidgetMyVBox):
does nothing.
"""

data_formats = [ # ".stl", # FIXME: for some reason there is a div by zero error in meshio
".ply"
data_formats = [
".ply",
# ".stl", # FIXME: for some reason there is a div by zero error in meshio
] # same groove is fine in ply format...
""" example trace for a simple vgroove:
meshio/stl/_stl.py in write(filename, mesh, binary)
Expand All @@ -66,17 +67,17 @@ class WidgetCADExport(WidgetMyVBox):
"""

def __init__(self):
title = make_title(("Export geometry to CAD file [optional]"), heading_level=4)
title = make_title("Export geometry to CAD file [optional]", heading_level=4)

# if the format changes, we have to update the file_pattern mask
# of the chooser of the save widget.
default_format_index = 0
self.format = Dropdown(
options=WidgetCADExport.data_formats,
index=default_format_index,
description=("Data format"),
description="Data format",
)
self.create_btn = Button(description=("Create program"))
self.create_btn = Button(description="Create program")
self.geometry = None
# disable button initially, because we first need to have a geometry
self.create_btn.disabled = True
Expand All @@ -87,13 +88,13 @@ def __init__(self):
self._html_dl_button = HTML()

self.profile_raster_width = FloatWithUnit(
("Profile raster width"),
"Profile raster width",
value=2,
unit="mm",
# tooltip="Target distance between the individual points of a profile",
)
self.trace_raster_width = FloatWithUnit(
("Trace raster width"),
"Trace raster width",
value=30,
unit="mm",
# tooltip="Target distance between the individual profiles on the trace",
Expand All @@ -120,7 +121,7 @@ def geometry(self, value):
if value is not None:
self.create_btn.disabled = False

def _on_export_geometry(self, *args):
def _on_export_geometry(self, *_):
if self.geometry is None:
return
ext = self.format.value
Expand All @@ -140,7 +141,7 @@ def _on_export_geometry(self, *args):
# read and embed in HTML button.
ntf.seek(0)
download_button(
button_description=("Download program"),
button_description="Download program",
filename=f"specimen{ext}",
html_instance=self._html_dl_button,
content=ntf.read(),
Expand All @@ -151,11 +152,11 @@ class WidgetMetal(WidgetMyVBox):
"""Widget to select metal type and parameters."""

def __init__(self):
self.common_name = WidgetLabeledTextInput(("Common name"), "S355J2+N")
self.standard = WidgetLabeledTextInput(("Standard"), "DIN EN 10225-2:2011")
self.thickness = FloatWithUnit(("Thickness"), value=30, unit="mm")
self.common_name = WidgetLabeledTextInput("Common name", "S355J2+N")
self.standard = WidgetLabeledTextInput("Standard", "DIN EN 10225-2:2011")
self.thickness = FloatWithUnit("Thickness", value=30, unit="mm")
children = [
make_title(("Base metal"), heading_level=4),
make_title("Base metal", heading_level=4),
self.common_name,
self.standard,
self.thickness,
Expand Down Expand Up @@ -216,7 +217,7 @@ def __init__(self):
[
WidgetMyHBox(
[
Label(("Groove type"), layout=description_layout),
Label("Groove type", layout=description_layout),
self.groove_type_dropdown,
]
),
Expand All @@ -229,9 +230,9 @@ def __init__(self):
self.output_tabs = Tab()
self.output_tabs.layout = Layout(width="70%")
self.output_tabs.children = [self.out]
self.output_tabs.set_title(0, "2D " + ("profile"))
self.output_tabs.set_title(0, "2D profile")
children = [
make_title(("ISO 9692-1 Groove selection"), 3),
make_title("ISO 9692-1 Groove selection", 3),
WidgetMyHBox(children=[self.groove_selection, self.output_tabs]),
]

Expand Down Expand Up @@ -317,7 +318,7 @@ def _create_groove_dropdown(self):
layout=description_layout,
)
param_widgets[item] = HBox(
[Label(("Code number"), layout=description_layout), dropdown]
[Label("Code number", layout=description_layout), dropdown]
)
else:
# replace underscores with spaces, first letter uppercase, translate.
Expand Down Expand Up @@ -366,7 +367,7 @@ def _update_plot(self, *args):
groove_params = dict(groove_type=groove_type)
for child in self.groove_params.children:
param_key = child.mapping
if param_key == ("code_number"):
if param_key == "code_number":
groove_params[param_key] = child.children[1].value
else:
magnitude = child.children[1].value
Expand Down Expand Up @@ -409,19 +410,19 @@ def __init__(self):
self.last_plot: Optional[CoordinateSystemManagerVisualizerK3D] = None
self.groove_sel = WidgetGrooveSelection()

self.seam_length = FloatWithUnit(("Seam length"), value=300, min=0, unit="mm")
self.seam_length = FloatWithUnit("Seam length", value=300, min=0, unit="mm")
self.seam_length.observe_float_value(self.create_csm_and_plot)
self.seam_length.observe_unit(self.create_csm_and_plot)

self.tcp_y = FloatWithUnit("TCP-y", unit="mm")
self.tcp_z = FloatWithUnit("TCP-z", unit="mm")
# TODO: compute weld speed accordingly to chosen groove area!
# TODO: consider setting it read-only??
self.weld_speed = FloatWithUnit(("weld speed"), value=6, unit="mm/s")
self.weld_speed = FloatWithUnit("weld speed", value=6, unit="mm/s")
self.base_metal = WidgetMetal()
self.geometry_export = WidgetCADExport()
self.additional_params = (
make_title(("Welding parameters"), 4),
make_title("Welding parameters", 4),
self.seam_length,
self.weld_speed,
self.tcp_y,
Expand All @@ -434,7 +435,7 @@ def __init__(self):
# add 3d plot and CAD export to groove_sel output tab
self.out = Output()
self.groove_sel.output_tabs.children += (self.out, self.geometry_export)
self.groove_sel.output_tabs.set_title(1, "3D " + ("profile"))
self.groove_sel.output_tabs.set_title(1, "3D profile")
self.groove_sel.output_tabs.set_title(2, "CAD export")

self.groove_sel.output_tabs.observe(
Expand Down

0 comments on commit 5362d91

Please sign in to comment.