Skip to content

Conversation

@Wheeeeeeeeels
Copy link

Summary

Fix the misleading docstring for resolve_matching_names_values function in isaaclab/utils/string.py.

The docstring incorrectly described the behavior of the preserve_order parameter - the descriptions for True and False were swapped.

Fixes #3849

Changes

Before (incorrect):

  • preserve_order=True: ordering follows the list of strings
  • preserve_order=False: ordering follows the query regular expressions

After (correct):

  • preserve_order=False (default): ordering follows list_of_strings
  • preserve_order=True: ordering follows the regex keys in data dictionary

Verification

The code logic confirms the corrected behavior:

  • Default path (lines 314-339): iterates over list_of_strings in order
  • When preserve_order=True (lines 341-360): reorders results to follow data keys order

The example in the docstring was already correct; only the parameter descriptions were swapped.

The docstring incorrectly described the behavior of the preserve_order
parameter. The descriptions for True and False were swapped.

Corrected behavior:
- preserve_order=False (default): ordering follows list_of_strings
- preserve_order=True: ordering follows the regex keys in data dict

Fixes isaac-sim#3849
@github-actions github-actions bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Jan 20, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 20, 2026

Greptile Overview

Greptile Summary

This PR fixes a documentation bug in the resolve_matching_names_values function where the docstring incorrectly described the preserve_order parameter behavior - the descriptions for True and False were swapped.

Key Changes:

  • Corrected preserve_order=False description: now correctly states it follows list_of_strings order (default behavior)
  • Corrected preserve_order=True description: now correctly states it follows the regex keys order in the data dictionary
  • Updated example explanation to clarify which ordering corresponds to which parameter value
  • Code logic verification confirms the corrected docstring accurately describes the actual implementation behavior (lines 323-360)

The fix improves code documentation accuracy and resolves issue #3849.

Confidence Score: 5/5

  • This PR is completely safe to merge - it only corrects documentation without any code changes
  • Score of 5 reflects that this is a documentation-only fix with zero risk. The change corrects a misleading docstring by swapping the True/False descriptions to accurately match the actual code implementation (verified by analyzing lines 323-360). No functional code is modified, no logic is changed, and the correction improves code documentation accuracy.
  • No files require special attention - this is a straightforward documentation fix

Sequence Diagram

sequenceDiagram
    participant User
    participant Function as resolve_matching_names_values
    participant CodeLogic as Code Logic
    participant Docstring
    
    User->>Function: Calls with preserve_order parameter
    Note over Function: Before PR: Docstring had swapped descriptions
    
    alt preserve_order=False (default)
        Function->>CodeLogic: Iterate over list_of_strings (lines 323-339)
        CodeLogic->>Function: Returns matches in list_of_strings order
        Note over Docstring: BEFORE: Incorrectly said "follows regex keys"<br/>AFTER: Correctly says "follows list_of_strings"
    else preserve_order=True
        Function->>CodeLogic: Reorder by data keys (lines 341-360)
        CodeLogic->>Function: Returns matches in regex keys order
        Note over Docstring: BEFORE: Incorrectly said "follows list_of_strings"<br/>AFTER: Correctly says "follows regex keys"
    end
    
    Function->>User: Returns (indices, names, values)
    Note over Function,Docstring: PR fixes docstring to match actual code behavior
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report] Confusing or incorrect docstring for resolve_matching_names_values

1 participant