Make erfa_generator._indent() more convenient - #315
Merged
Conversation
Previously `erfa_generator._indent()` worked on multiline strings just like the `jinja` `indent()` filter the function was meant to replace, but it is more convenient if it works on a `list` of strings, where each element represents a single line.
eerovaher
commented
Aug 11, 2026
Comment on lines
+837
to
841
| list(chain(*[func.define_types_and_functions for func in funcs])) | ||
| ), | ||
| ufunc_definitions=_indent( | ||
| list(chain(*[func.define_ufunc.splitlines() for func in funcs])) | ||
| ), |
Collaborator
Author
There was a problem hiding this comment.
When pyerfa drops support for Python 3.14 then PEP 798 – Unpacking in Comprehensions will allow this to be rewritten as
Suggested change
| list(chain(*[func.define_types_and_functions for func in funcs])) | |
| ), | |
| ufunc_definitions=_indent( | |
| list(chain(*[func.define_ufunc.splitlines() for func in funcs])) | |
| ), | |
| [*func.define_types_and_functions for func in funcs] | |
| ), | |
| ufunc_definitions=_indent([*func.define_ufunc.splitlines() for func in funcs]), |
avalentino
approved these changes
Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On current
mainerfa_generator._indent()works on multiline strings just like thejinjaindent()filter the function was meant to replace, but it is more convenient if it works on alistof strings, where each element represents a single line, because that avoids having to call"\n".join()over and over again.There are no changes to the files
erfa_generatorcreates.