DiamondLightSource / DiamondLightSource/httomo

Don't rely on `output_folder` global variable in YAML generator

Open
#259 0 comments 0 reactions 0 assignees View on GitHub
minor
Dominant language
Python
Stars
10
Forks
5
Avg merge
5d 17h
Merged PRs (30d)
1

Description

The `_save_yaml()` function doesn't have a `output_folder` parameter, yet it somehow is able to
refer to it without defining it itself: https://github.com/DiamondLightSource/httomo/blob/878c74c32dad626b46a52f1b4a8505747f5fd978/templates/yaml_templates_generator.py#L124-L131

This is because it's using the `output_folder` defined in the `if __name__ == "__main__"` block at the bottom of the script: https://github.com/DiamondLightSource/httomo/blob/878c74c32dad626b46a52f1b4a8505747f5fd978/templates/yaml_templates_generator.py#L228-L232

Given that the `_save_yaml()` function is called by the main `yaml_generator()` function: https://github.com/DiamondLightSource/httomo/blob/878c74c32dad626b46a52f1b4a8505747f5fd978/templates/yaml_templates_generator.py#L96

which has been passed the `output_folder` value: https://github.com/DiamondLightSource/httomo/blob/878c74c32dad626b46a52f1b4a8505747f5fd978/templates/yaml_templates_generator.py#L37-L42

it would be nice to pass `_save_yaml()` the `output_folder` value, rather than have it rely on a global variable.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.