Make Subroutine.argnames return lower-case names#686
Conversation
| the expansion is performed. | ||
| """ | ||
| trafo_data = {'orig_argnames': tuple(arg.lower() for arg in routine.argnames)} | ||
| trafo_data = {'orig_argnames': tuple(routine.argnames)} |
There was a problem hiding this comment.
@claude[agent] The tuple conversion is redundant here.
| trafo_data = {'orig_argnames': tuple(routine.argnames)} | |
| trafo_data = {'orig_argnames': routine.argnames} |
There was a problem hiding this comment.
Removed the redundant tuple conversion in commit 39cdc34 since routine.argnames now returns a tuple directly.
|
Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/686/index.html |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #686 +/- ##
=======================================
Coverage 94.20% 94.20%
=======================================
Files 288 288
Lines 47546 47546
=======================================
Hits 44790 44790
Misses 2756 2756
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ary .lower() calls Agent-Logs-Url: https://github.com/ecmwf-ifs/loki/sessions/6087abd5-a0f2-4dbf-8f83-d7398e3be1bc Co-authored-by: reuterbal <6384870+reuterbal@users.noreply.github.com>
…argnames Agent-Logs-Url: https://github.com/ecmwf-ifs/loki/sessions/895c0996-c03c-45ba-8f48-f4f43668f1e4 Co-authored-by: reuterbal <6384870+reuterbal@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ecmwf-ifs/loki/sessions/38a114b5-1210-49c0-b5ba-cdbf898c5eaf Co-authored-by: reuterbal <6384870+reuterbal@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ecmwf-ifs/loki/sessions/ef38188b-901c-4864-8791-a35a7563c3ad Co-authored-by: reuterbal <6384870+reuterbal@users.noreply.github.com>
While argnames now returns lowercase for case-insensitive comparisons, code generation and transpilation need to preserve original case. This commit fixes those instances by using [arg.name for arg in routine.arguments] instead of routine.argnames. Changes: - fgen.py: Preserve case in function/subroutine headers - fortran_iso_c_wrapper.py: Preserve case in ISO C wrapper generation - subroutine.py: Preserve case in clone method - test_regex_frontend.py: Fix argnames comparisons from [] to () Co-authored-by: reuterbal <6384870+reuterbal@users.noreply.github.com>
7106f56 to
0f46e15
Compare
|
OK, this should be ready for a look @mlange05. It was meant as a small maintenance task after noticing that So, the question is whether we want to have the property lower-case, like most other things, and accept that we have to be more explicit and case-aware in the case-sensitive code regions (using |
mlange05
left a comment
There was a problem hiding this comment.
Ok, as discussed offline, this API change has a few pro and few con uses. As the number of "pros" seem to outweigh the "con" uses, I think we should accept this.
I'd like the docstring of the property to make this change explicit - and we might want to bundle with with the other impending API-breaking change. But otherwise GTG from me.
| @@ -323,7 +323,7 @@ def argnames(self): | |||
| """ | |||
| Return names of arguments in order of the defined signature (dummy list) | |||
There was a problem hiding this comment.
Could we update the docstring here please to make the shift in API explicit?
Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.