DiamondLightSource / httomo

High-throughput tomography pipeline
https://diamondlightsource.github.io/httomo/
BSD 3-Clause "New" or "Revised" License
4 stars 3 forks source link

Check if param has no default using `Parameter.default` #254

Closed yousefmoazzam closed 3 months ago

yousefmoazzam commented 3 months ago

If a function parameter has no default value, then Parameter.default is equal to Parameter.empty https://docs.python.org/3/library/inspect.html#inspect.Parameter.default.

This can be used in place of the slightly awkward stringifying of a value of type Parameter and then checking for the presence of the "=" character: https://github.com/DiamondLightSource/httomo/blob/d9afc1f04e29a375cee17d33033d75f47a99da34/templates/yaml_templates_generator.py#L107