Skip to content

feat: raw情况添加dingo_id#394

Merged
shijinpjlab merged 1 commit into
MigoXLab:devfrom
shijinpjlab:dev_0421
Apr 21, 2026
Merged

feat: raw情况添加dingo_id#394
shijinpjlab merged 1 commit into
MigoXLab:devfrom
shijinpjlab:dev_0421

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 updates the to_raw_dict method in dingo/io/output/result_info.py to include the dingo_id field in the output dictionary. The review feedback points out that the current implementation modifies self.raw_data in-place, which could lead to unintended side effects; the reviewer suggests returning a new dictionary containing the updated fields instead.

Comment on lines +43 to 45
self.raw_data['dingo_id'] = self.dingo_id
self.raw_data['dingo_result'] = dingo_result
return self.raw_data
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

to_raw_dict 方法直接修改了 self.raw_data 属性。这种原地修改(in-place mutation)会产生副作用,例如多次调用该方法会重复修改状态,或者导致 to_dict 方法返回的结果不一致(因为 to_dict 引用了同一个 raw_data 对象)。建议返回一个包含新字段的字典副本,以保持函数的纯粹性。

Suggested change
self.raw_data['dingo_id'] = self.dingo_id
self.raw_data['dingo_result'] = dingo_result
return self.raw_data
return {
**self.raw_data,
'dingo_id': self.dingo_id,
'dingo_result': dingo_result,
}

@shijinpjlab shijinpjlab merged commit e19fad1 into MigoXLab:dev Apr 21, 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