Skip to content

Make erfa_generator._indent() more convenient - #315

Merged
avalentino merged 1 commit into
liberfa:mainfrom
eerovaher:indent-lines
Aug 11, 2026
Merged

Make erfa_generator._indent() more convenient#315
avalentino merged 1 commit into
liberfa:mainfrom
eerovaher:indent-lines

Conversation

@eerovaher

Copy link
Copy Markdown
Collaborator

On current main erfa_generator._indent() works 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, because that avoids having to call "\n".join() over and over again.

There are no changes to the files erfa_generator creates.

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.
Comment thread erfa_generator.py
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]))
),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
avalentino merged commit 902d9ad into liberfa:main Aug 11, 2026
25 of 26 checks passed
@eerovaher
eerovaher deleted the indent-lines branch August 12, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants