From 751d57ee499d539382e66e3d0cd9fb0a64a1f3ab Mon Sep 17 00:00:00 2001 From: cow-bot Date: Tue, 13 Jun 2023 15:13:09 +0000 Subject: [PATCH 1/2] GO FORMAT YOURSELF (black) --- nexus_constructor/field_utils.py | 8 +++++++- nexus_constructor/field_widget.py | 21 ++++++++++++++++----- nexus_constructor/json/load_from_json.py | 9 +++++---- nexus_constructor/model/module.py | 8 ++++---- nexus_constructor/module_view.py | 8 ++++++-- 5 files changed, 38 insertions(+), 16 deletions(-) diff --git a/nexus_constructor/field_utils.py b/nexus_constructor/field_utils.py index 2117ce07f..da79e0c27 100644 --- a/nexus_constructor/field_utils.py +++ b/nexus_constructor/field_utils.py @@ -7,7 +7,13 @@ from nexus_constructor.field_widget import FieldWidget from nexus_constructor.invalid_field_names import INVALID_FIELD_NAMES from nexus_constructor.model.group import Group -from nexus_constructor.model.module import Dataset, FileWriterModule, Link, StreamModule, FileWriter +from nexus_constructor.model.module import ( + Dataset, + FileWriterModule, + Link, + StreamModule, + FileWriter, +) from nexus_constructor.model.value_type import ValueTypes from nexus_constructor.utils.required_component_fields import required_component_fields from nexus_constructor.validators import FieldType diff --git a/nexus_constructor/field_widget.py b/nexus_constructor/field_widget.py index 0c8161a69..0eda46af7 100644 --- a/nexus_constructor/field_widget.py +++ b/nexus_constructor/field_widget.py @@ -25,7 +25,13 @@ from nexus_constructor.field_attrs import FieldAttrsDialog from nexus_constructor.invalid_field_names import INVALID_FIELD_NAMES from nexus_constructor.model.group import Group -from nexus_constructor.model.module import Dataset, FileWriter, FileWriterModule, Link, StreamModule +from nexus_constructor.model.module import ( + Dataset, + FileWriter, + FileWriterModule, + Link, + StreamModule, +) from nexus_constructor.model.value_type import VALUE_TYPE_TO_NP, ValueTypes from nexus_constructor.stream_fields_widget import StreamFieldsWidget from nexus_constructor.ui_utils import validate_line_edit @@ -456,7 +462,14 @@ def field_type_changed(self): self.streams_widget.ok_validator.validate_ok() self.streams_widget.cancel_button.clicked.connect(self.reset_field_type) elif self.field_type == FieldType.link: - self.set_visibility(True, False, False, False, show_unit_line_edit=False, show_attrs_edit=False) + self.set_visibility( + True, + False, + False, + False, + show_unit_line_edit=False, + show_attrs_edit=False, + ) self._set_up_value_validator(False) elif self.field_type == FieldType.filewriter: self.set_visibility(False, False, False, False, True, False, False) @@ -488,9 +501,7 @@ def _set_up_value_validator(self, is_link: bool): else: self.value_line_edit.setValidator( FieldValueValidator( - self.field_type_combo, - self.value_type_combo, - self.field_type.value + self.field_type_combo, self.value_type_combo, self.field_type.value ) ) tooltip_on_accept = "Value is cast-able to numpy type." diff --git a/nexus_constructor/json/load_from_json.py b/nexus_constructor/json/load_from_json.py index 24ad1a2ac..56051ef0c 100644 --- a/nexus_constructor/json/load_from_json.py +++ b/nexus_constructor/json/load_from_json.py @@ -277,10 +277,11 @@ def _read_json_object(self, json_object: Dict, parent_node: Group = None): elif CommonKeys.MODULE in json_object and NodeType.CONFIG in json_object: module_type = json_object[CommonKeys.MODULE] if ( - (module_type == WriterModules.DATASET.value or module_type == WriterModules.FILEWRITER.value) - and json_object[NodeType.CONFIG][CommonKeys.NAME] - == CommonAttrs.DEPENDS_ON - ): + module_type == WriterModules.DATASET.value + or module_type == WriterModules.FILEWRITER.value + ) and json_object[NodeType.CONFIG][ + CommonKeys.NAME + ] == CommonAttrs.DEPENDS_ON: nexus_object = None elif module_type in [x.value for x in WriterModules]: nexus_object = create_fw_module_object( diff --git a/nexus_constructor/model/module.py b/nexus_constructor/model/module.py index ac87761f9..1219310b2 100644 --- a/nexus_constructor/model/module.py +++ b/nexus_constructor/model/module.py @@ -173,7 +173,9 @@ class FileWriter(FileWriterModule): name = attr.ib(type=str) type = attr.ib(type=str, default="string") values = attr.ib(type=str, default=None) - writer_module = attr.ib(type=str, default=WriterModules.FILEWRITER.value, init=False) + writer_module = attr.ib( + type=str, default=WriterModules.FILEWRITER.value, init=False + ) def as_dict(self, error_collector: List[str]): return { @@ -395,9 +397,7 @@ def create_fw_module_object(mod_type, configuration, parent_node): ) elif mod_type == WriterModules.FILEWRITER.value: fw_mod_obj = fw_mod_class( - name=configuration[CommonKeys.NAME], - parent_node=parent_node, - type="string" + name=configuration[CommonKeys.NAME], parent_node=parent_node, type="string" ) elif mod_type == WriterModules.DATASET.value: if CommonKeys.DATA_TYPE in configuration: diff --git a/nexus_constructor/module_view.py b/nexus_constructor/module_view.py index 642b27f70..bb792a583 100644 --- a/nexus_constructor/module_view.py +++ b/nexus_constructor/module_view.py @@ -31,7 +31,10 @@ def _setup_frame(self, module): source = module.source if module.source else "not specified" self.layout.addWidget(self._get_label(f"link name: {name} | ")) self.layout.addWidget(self._get_label(f"source: {source}")) - elif module.writer_module == WriterModules.DATASET.value or module.writer_module == WriterModules.FILEWRITER.value: + elif ( + module.writer_module == WriterModules.DATASET.value + or module.writer_module == WriterModules.FILEWRITER.value + ): name = module.name if module.name else "not specified" dtype = module.type if module.type else "not specified" self.layout.addWidget(self._get_label(f"dataset name: {name} | ")) @@ -74,7 +77,8 @@ def _set_existing_items(self): if ( self.module.writer_module == WriterModules.DATASET.value or self.module.writer_module == WriterModules.LINK.value - or self.module.writer_module in [StreamMode.value for StreamMode in StreamModules] + or self.module.writer_module + in [StreamMode.value for StreamMode in StreamModules] or self.module.writer_module == WriterModules.FILEWRITER.value ): update_function = find_field_type(module, []) From b63623f02dd4dbcc60864fab5cb18b5980ad2c9c Mon Sep 17 00:00:00 2001 From: cow-bot Date: Tue, 13 Jun 2023 15:14:22 +0000 Subject: [PATCH 2/2] Update NeXus HTML documentation --- .../html/applying-nexus.html | 5 +- nx-class-documentation/html/authorgroup.html | 5 +- .../html/classes/applications/NXarchive.html | 5 +- .../html/classes/applications/NXarpes.html | 5 +- .../html/classes/applications/NXcanSAS.html | 9 ++- .../classes/applications/NXdirecttof.html | 5 +- .../html/classes/applications/NXfluo.html | 5 +- .../classes/applications/NXindirecttof.html | 5 +- .../html/classes/applications/NXiqproc.html | 5 +- .../html/classes/applications/NXlauetof.html | 5 +- .../html/classes/applications/NXmonopd.html | 5 +- .../html/classes/applications/NXmx.html | 5 +- .../html/classes/applications/NXrefscan.html | 5 +- .../html/classes/applications/NXreftof.html | 5 +- .../html/classes/applications/NXsas.html | 5 +- .../html/classes/applications/NXsastof.html | 5 +- .../html/classes/applications/NXscan.html | 5 +- .../html/classes/applications/NXspe.html | 5 +- .../html/classes/applications/NXsqom.html | 5 +- .../html/classes/applications/NXstxm.html | 5 +- .../html/classes/applications/NXtas.html | 5 +- .../html/classes/applications/NXtofnpd.html | 5 +- .../html/classes/applications/NXtofraw.html | 5 +- .../classes/applications/NXtofsingle.html | 5 +- .../html/classes/applications/NXtomo.html | 5 +- .../classes/applications/NXtomophase.html | 5 +- .../html/classes/applications/NXtomoproc.html | 5 +- .../html/classes/applications/NXxas.html | 5 +- .../html/classes/applications/NXxasproc.html | 5 +- .../html/classes/applications/NXxbase.html | 5 +- .../html/classes/applications/NXxeuler.html | 5 +- .../html/classes/applications/NXxkappa.html | 5 +- .../html/classes/applications/NXxlaue.html | 5 +- .../classes/applications/NXxlaueplate.html | 5 +- .../html/classes/applications/NXxnb.html | 5 +- .../html/classes/applications/NXxrot.html | 5 +- .../html/classes/applications/index.html | 5 +- .../html/classes/base_classes/NXaperture.html | 5 +- .../classes/base_classes/NXattenuator.html | 5 +- .../html/classes/base_classes/NXbeam.html | 5 +- .../classes/base_classes/NXbeam_stop.html | 5 +- .../base_classes/NXbending_magnet.html | 5 +- .../classes/base_classes/NXcapillary.html | 5 +- .../html/classes/base_classes/NXcite.html | 5 +- .../classes/base_classes/NXcollection.html | 5 +- .../classes/base_classes/NXcollimator.html | 5 +- .../html/classes/base_classes/NXcrystal.html | 5 +- .../base_classes/NXcylindrical_geometry.html | 5 +- .../html/classes/base_classes/NXdata.html | 5 +- .../html/classes/base_classes/NXdetector.html | 5 +- .../base_classes/NXdetector_group.html | 5 +- .../base_classes/NXdetector_module.html | 5 +- .../classes/base_classes/NXdisk_chopper.html | 5 +- .../html/classes/base_classes/NXentry.html | 7 +-- .../classes/base_classes/NXenvironment.html | 5 +- .../classes/base_classes/NXevent_data.html | 5 +- .../classes/base_classes/NXfermi_chopper.html | 5 +- .../html/classes/base_classes/NXfilter.html | 5 +- .../html/classes/base_classes/NXflipper.html | 5 +- .../base_classes/NXfresnel_zone_plate.html | 5 +- .../html/classes/base_classes/NXgeometry.html | 5 +- .../html/classes/base_classes/NXgrating.html | 5 +- .../html/classes/base_classes/NXguide.html | 5 +- .../base_classes/NXinsertion_device.html | 5 +- .../classes/base_classes/NXinstrument.html | 5 +- .../html/classes/base_classes/NXlog.html | 5 +- .../html/classes/base_classes/NXmirror.html | 5 +- .../classes/base_classes/NXmoderator.html | 5 +- .../html/classes/base_classes/NXmonitor.html | 5 +- .../classes/base_classes/NXmonochromator.html | 5 +- .../html/classes/base_classes/NXnote.html | 5 +- .../html/classes/base_classes/NXobject.html | 5 +- .../classes/base_classes/NXoff_geometry.html | 5 +- .../classes/base_classes/NXorientation.html | 5 +- .../classes/base_classes/NXparameters.html | 5 +- .../html/classes/base_classes/NXpdb.html | 5 +- .../html/classes/base_classes/NXpinhole.html | 5 +- .../classes/base_classes/NXpolarizer.html | 5 +- .../classes/base_classes/NXpositioner.html | 5 +- .../html/classes/base_classes/NXprocess.html | 5 +- .../classes/base_classes/NXreflections.html | 5 +- .../html/classes/base_classes/NXroot.html | 5 +- .../html/classes/base_classes/NXsample.html | 5 +- .../base_classes/NXsample_component.html | 5 +- .../html/classes/base_classes/NXsensor.html | 5 +- .../html/classes/base_classes/NXshape.html | 5 +- .../html/classes/base_classes/NXslit.html | 5 +- .../html/classes/base_classes/NXsource.html | 5 +- .../html/classes/base_classes/NXsubentry.html | 5 +- .../base_classes/NXtransformations.html | 5 +- .../classes/base_classes/NXtranslation.html | 5 +- .../html/classes/base_classes/NXuser.html | 5 +- .../base_classes/NXvelocity_selector.html | 5 +- .../html/classes/base_classes/NXxraylens.html | 5 +- .../html/classes/base_classes/index.html | 5 +- .../contributed_definitions/NXcontainer.html | 5 +- .../contributed_definitions/NXcsg.html | 5 +- .../contributed_definitions/NXcxi_ptycho.html | 5 +- .../NXelectrostatic_kicker.html | 5 +- .../NXmagnetic_kicker.html | 5 +- .../contributed_definitions/NXquadric.html | 5 +- .../NXquadrupole_magnet.html | 5 +- .../contributed_definitions/NXseparator.html | 5 +- .../contributed_definitions/NXsnsevent.html | 5 +- .../contributed_definitions/NXsnshisto.html | 5 +- .../NXsolenoid_magnet.html | 5 +- .../NXsolid_geometry.html | 5 +- .../contributed_definitions/NXspecdata.html | 7 +-- .../NXspin_rotator.html | 5 +- .../contributed_definitions/index.html | 5 +- .../html/classes/index.html | 7 +-- nx-class-documentation/html/colophon.html | 5 +- nx-class-documentation/html/community.html | 5 +- nx-class-documentation/html/copyright.html | 5 +- nx-class-documentation/html/datarules.html | 23 ++++---- nx-class-documentation/html/defs_intro.html | 7 +-- nx-class-documentation/html/design.html | 20 +++---- nx-class-documentation/html/docs_about.html | 5 +- .../html/examples/code_napi.html | 9 ++- .../html/examples/code_native.html | 5 +- .../html/examples/epics/index.html | 27 +++++---- .../html/examples/h5py/index.html | 13 ++--- .../html/examples/h5py/writer_1_3.html | 7 +-- .../html/examples/h5py/writer_2_1.html | 5 +- .../html/examples/index.html | 5 +- .../html/examples/lrmecs/index.html | 7 +-- .../html/examples/matlab/index.html | 5 +- nx-class-documentation/html/faq.html | 8 +-- nx-class-documentation/html/fileformat.html | 5 +- nx-class-documentation/html/genindex.html | 3 +- nx-class-documentation/html/github.html | 5 +- nx-class-documentation/html/history.html | 11 ++-- nx-class-documentation/html/index.html | 7 +-- nx-class-documentation/html/installation.html | 9 ++- .../html/introduction-napi.html | 21 ++++--- nx-class-documentation/html/introduction.html | 7 +-- nx-class-documentation/html/issues.html | 5 +- nx-class-documentation/html/mailinglist.html | 5 +- nx-class-documentation/html/motivations.html | 5 +- nx-class-documentation/html/napi-c.html | 5 +- nx-class-documentation/html/napi-f77.html | 5 +- nx-class-documentation/html/napi-f90.html | 5 +- nx-class-documentation/html/napi-idl.html | 5 +- nx-class-documentation/html/napi-java.html | 5 +- nx-class-documentation/html/napi.html | 5 +- nx-class-documentation/html/niac.html | 7 +-- nx-class-documentation/html/nxdl-types.html | 5 +- nx-class-documentation/html/nxdl.html | 9 ++- nx-class-documentation/html/nxdl_desc.html | 5 +- nx-class-documentation/html/preface.html | 5 +- nx-class-documentation/html/ref_doc.html | 5 +- nx-class-documentation/html/revhistory.html | 5 +- nx-class-documentation/html/rules.html | 5 +- nx-class-documentation/html/search.html | 3 +- nx-class-documentation/html/searchindex.js | 2 +- nx-class-documentation/html/strategies.html | 5 +- nx-class-documentation/html/user_manual.html | 5 +- nx-class-documentation/html/utilities.html | 57 +++++++++---------- nx-class-documentation/html/validation.html | 5 +- 159 files changed, 403 insertions(+), 559 deletions(-) diff --git a/nx-class-documentation/html/applying-nexus.html b/nx-class-documentation/html/applying-nexus.html index 99ab54dc6..47ed1fa7c 100644 --- a/nx-class-documentation/html/applying-nexus.html +++ b/nx-class-documentation/html/applying-nexus.html @@ -1,13 +1,12 @@ - - + 1.3. Constructing NeXus Files and Application Definitions — nexus v2020.10 documentation @@ -790,7 +789,7 @@

Navigation

\ No newline at end of file diff --git a/nx-class-documentation/html/authorgroup.html b/nx-class-documentation/html/authorgroup.html index 736586ba3..285aabff1 100644 --- a/nx-class-documentation/html/authorgroup.html +++ b/nx-class-documentation/html/authorgroup.html @@ -1,13 +1,12 @@ - - + 9.1. Authors — nexus v2020.10 documentation @@ -152,7 +151,7 @@

Navigation

\ No newline at end of file diff --git a/nx-class-documentation/html/classes/applications/NXarchive.html b/nx-class-documentation/html/classes/applications/NXarchive.html index da46f168f..77f79b58b 100644 --- a/nx-class-documentation/html/classes/applications/NXarchive.html +++ b/nx-class-documentation/html/classes/applications/NXarchive.html @@ -1,13 +1,12 @@ - - + 3.3.2.1. NXarchive — nexus v2020.10 documentation @@ -451,7 +450,7 @@

Navigation

\ No newline at end of file diff --git a/nx-class-documentation/html/classes/applications/NXarpes.html b/nx-class-documentation/html/classes/applications/NXarpes.html index 8f214dd91..8b6d450eb 100644 --- a/nx-class-documentation/html/classes/applications/NXarpes.html +++ b/nx-class-documentation/html/classes/applications/NXarpes.html @@ -1,13 +1,12 @@ - - + 3.3.2.2. NXarpes — nexus v2020.10 documentation @@ -370,7 +369,7 @@

Navigation

\ No newline at end of file diff --git a/nx-class-documentation/html/classes/applications/NXcanSAS.html b/nx-class-documentation/html/classes/applications/NXcanSAS.html index b93292b91..fb1b7bfdb 100644 --- a/nx-class-documentation/html/classes/applications/NXcanSAS.html +++ b/nx-class-documentation/html/classes/applications/NXcanSAS.html @@ -1,13 +1,12 @@ - - + 3.3.2.3. NXcanSAS — nexus v2020.10 documentation @@ -192,7 +191,7 @@

Navigation

Use the Unidata UDunits [1] specification as this is compatible with various community standards.