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

Open Beginner friendly
#259 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
tooling

Research direction

Start in templates/yaml_templates_generator.py, reading yaml_generator() and _save_yaml() around the referenced lines. Pass the output_folder value through the call instead of relying on the variable from the main block. Done means _save_yaml() no longer depends on that global while YAML generation continues to use the requested output folder.

Written by the indexing model from the issue text.

Description

minor

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.

Dominant language
Python
Stars
10
Forks
5
Avg merge
5d 17h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DiamondLightSource/httomo

All issues in DiamondLightSource/httomo

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.