Skip to content

Commit a2f5a7c

Browse files
committed
Special Commit for local example to test the tools.
1 parent 2149349 commit a2f5a7c

File tree

115 files changed

+75578
-120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+75578
-120
lines changed

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"python": true,
1010
"json": true
1111
},
12-
"github.copilot.chat.temporalContext.enabled": true,
1312
"editor.defaultFormatter": "charliermarsh.ruff",
1413
"notebook.formatOnSave.enabled": false,
15-
"CRS.OnSaveAlFileAction": "Reorganize"
14+
"CRS.OnSaveAlFileAction": "Reorganize",
15+
"github.copilot.chat.editor.temporalContext.enabled": true
1616
}

src/pynxtools_spm/nomad_uploader/reader_config_setup.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class SPMConvertInputParameters:
1414
output: str = None
1515
nxdl: Optional[str] = None
1616
create_zip: Optional[bool] = True
17-
zip_file_path: Optional[str] = None
17+
zip_file_path: Optional[str | Path] = None
1818
skip_verify: Optional[bool] = False
1919
config: Optional[str | Path] = None
2020
raw_extension: Optional[str] = None
@@ -80,18 +80,25 @@ def convert_spm_experiments(
8080
# TODO Try with input_file as tuple of Path objects
8181
input_params.input_file = [str(file) for file in input_params.input_file]
8282
input_params.output = str(input_params.output)
83-
convert(**asdict(input_params))
84-
input_params.input_file = tuple(
85-
Path(file) if isinstance(file, str) else file
86-
for file in input_params.input_file
87-
)
83+
try:
84+
convert(**asdict(input_params))
8885

89-
if input_params.create_zip:
90-
with zipfile.ZipFile(zip_file, "w") as zipf:
91-
zipf.write(input_params.output, arcname=input_params.output.split("/")[-1])
92-
for file in input_params.input_file:
93-
zipf.write(file, arcname=file.split("/")[-1])
94-
input_params.zip_file_path = zip_file
86+
if input_params.create_zip:
87+
with zipfile.ZipFile(zip_file, "w") as zipf:
88+
zipf.write(
89+
input_params.output, arcname=input_params.output.split("/")[-1]
90+
)
91+
for file in input_params.input_file:
92+
zipf.write(file, arcname=file.split("/")[-1])
93+
input_params.zip_file_path = Path(zip_file)
94+
input_params.output = Path(input_params.output)
95+
except Exception as e:
96+
print("NeXusConverterError:", e)
97+
finally:
98+
input_params.input_file = tuple(
99+
Path(file) if isinstance(file, str) else file
100+
for file in input_params.input_file
101+
)
95102

96103
return input_params
97104

0 commit comments

Comments
 (0)