From 5362d91a300334c85e0034dca7b3f78c655af353 Mon Sep 17 00:00:00 2001 From: "Martin K. Scherer" Date: Wed, 13 Dec 2023 14:05:11 +0100 Subject: [PATCH] remove redundant parentheses around strings --- weldx_widgets/widget_evaluate.py | 4 +-- weldx_widgets/widget_gas.py | 4 +-- weldx_widgets/widget_groove_sel.py | 45 +++++++++++++++--------------- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/weldx_widgets/widget_evaluate.py b/weldx_widgets/widget_evaluate.py index 22835c3..e04328c 100644 --- a/weldx_widgets/widget_evaluate.py +++ b/weldx_widgets/widget_evaluate.py @@ -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) @@ -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]) diff --git a/weldx_widgets/widget_gas.py b/weldx_widgets/widget_gas.py index eeeef15..a9533b4 100644 --- a/weldx_widgets/widget_gas.py +++ b/weldx_widgets/widget_gas.py @@ -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() diff --git a/weldx_widgets/widget_groove_sel.py b/weldx_widgets/widget_groove_sel.py index a27f6b5..56904d3 100644 --- a/weldx_widgets/widget_groove_sel.py +++ b/weldx_widgets/widget_groove_sel.py @@ -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) @@ -66,7 +67,7 @@ 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. @@ -74,9 +75,9 @@ def __init__(self): 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 @@ -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", @@ -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 @@ -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(), @@ -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, @@ -216,7 +217,7 @@ def __init__(self): [ WidgetMyHBox( [ - Label(("Groove type"), layout=description_layout), + Label("Groove type", layout=description_layout), self.groove_type_dropdown, ] ), @@ -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]), ] @@ -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. @@ -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 @@ -409,7 +410,7 @@ 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) @@ -417,11 +418,11 @@ def __init__(self): 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, @@ -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(