Skip to content

feat: RuleDictConsistency忽略顺序#391

Merged
shijinpjlab merged 1 commit intoMigoXLab:devfrom
shijinpjlab:dev_0413
Apr 13, 2026
Merged

feat: RuleDictConsistency忽略顺序#391
shijinpjlab merged 1 commit intoMigoXLab:devfrom
shijinpjlab:dev_0413

Conversation

@shijinpjlab
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the RuleDictConsistency class by introducing a normalization method that supports order-insensitive comparisons for nested data structures such as dictionaries, lists, and sets. Additionally, the documentation is updated to simplify LLM configuration by replacing specific parameter lists with a general pass-through policy. A review comment suggests using repr() instead of str() for sorting dictionary keys to improve robustness when handling mixed-type keys and to maintain consistency with other sorting logic in the class.

if isinstance(value, dict):
return {
key: cls._normalize_value(value[key], ignore_order)
for key in sorted(value.keys(), key=lambda x: str(x))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using repr(x) as the sorting key is more robust than str(x) when dealing with mixed-type keys (e.g., it correctly distinguishes between the integer 1 and the string '1'). This also ensures consistency with the sorting logic used for lists and sets on lines 2708 and 2713.

Suggested change
for key in sorted(value.keys(), key=lambda x: str(x))
for key in sorted(value.keys(), key=lambda x: repr(x))

@shijinpjlab shijinpjlab merged commit 16e75af into MigoXLab:dev Apr 13, 2026
2 checks passed
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.

1 participant