Skip to content

Docstring error in resolve_matching_names and resolve_matching_names_values: preserve_order description is inverted #4493

Closed

Description

@jaredbmit

Noting a mistake in the docstring for isaaclab.utils.string.resolve_matching_names: the text description incorrectly describes how the function works under preserve_order=True and preserve_order=False.

def resolve_matching_names(

"""
...
If the :attr:`preserve_order` is True, the ordering of the matched indices and names is the same as the order
of the provided list of strings. This means that the ordering is dictated by the order of the target strings
and not the order of the query regular expressions.

If the :attr:`preserve_order` is False, the ordering of the matched indices and names is the same as the order
of the provided list of query regular expressions.

For example, consider the list of strings is ['a', 'b', 'c', 'd', 'e'] and the regular expressions are ['a|c', 'b'].
If :attr:`preserve_order` is False, then the function will return the indices of the matched strings and the
strings as: ([0, 1, 2], ['a', 'b', 'c']). When :attr:`preserve_order` is True, it will return them as:
([0, 2, 1], ['a', 'c', 'b']).
...
"""

In terms of the actual function operation, matched strings are enumerated in the order of the list of strings, and then only reordered to the query keys if preserve_order=True. This is the opposite of what the text describes. Swapping True and False in the above text will fix the documentation issue. The provided examples in the docstring are already correct according to the function's operation.

The same issue is seen in isaaclab.utils.string.resolve_matching_names_values directly below the other function.

def resolve_matching_names_values(

"""
...
If the :attr:`preserve_order` is True, the ordering of the matched indices and names is the same as the order
of the provided list of strings. This means that the ordering is dictated by the order of the target strings
and not the order of the query regular expressions.

If the :attr:`preserve_order` is False, the ordering of the matched indices and names is the same as the order
of the provided list of query regular expressions.

For example, consider the dictionary is {"a|d|e": 1, "b|c": 2}, the list of strings is ['a', 'b', 'c', 'd', 'e'].
If :attr:`preserve_order` is False, then the function will return the indices of the matched strings, the
matched strings, and the values as: ([0, 1, 2, 3, 4], ['a', 'b', 'c', 'd', 'e'], [1, 2, 2, 1, 1]). When
:attr:`preserve_order` is True, it will return them as: ([0, 3, 4, 1, 2], ['a', 'd', 'e', 'b', 'c'], [1, 1, 1, 2, 2]).
...
"""

There is a typo/comma error in the example sentence:
... return the indices of the matched strings, the matched strings, and the values as: ...
(remove the redundant "the matched strings,")

This small doc fix will help avoid confusion for the use of other downstream functionalities, like in isaaclab.assets.Articulation:

"""
...
Find joints in the articulation based on the name keys.

Please see the :func:`isaaclab.utils.string.resolve_matching_names` function for more information
on the name matching.
...
"""

Thanks!

Activity

  1. RandomOakForest commented on Feb 2, 2026

    @RandomOakForest
    Collaborator

    Thanks for posting this. The team will review and update accordingly.

  2. added
    bug
    documentation
    on Feb 2, 2026
  3. added a commit that references this issue on Feb 21, 2026
    b4c20a0
  4. AntoineRichard commented on Aug 27, 2026

    @AntoineRichard
    Collaborator

    @jaredbmit thanks for the close read on the inverted preserve_order docs.

    Both resolve_matching_names and resolve_matching_names_values in source/isaaclab/isaaclab/utils/string.py now describe it correctly: False orders by the provided target strings, True by the query keys, and the Args entry matches. Fixed in #5546. Closing as fixed — please reopen if anything still reads inverted.


    🤖 This issue was reviewed as part of an AI-assisted triage of the Isaac Lab backlog, with automated verification against the current codebase. If we got this wrong, please reopen — we'd rather hear about it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdocumentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions