darshanajudiya7 commited on
Commit
c6da15a
·
verified ·
1 Parent(s): 666dff1

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. models.py +8 -0
models.py CHANGED
@@ -187,6 +187,8 @@ class PythonReviewAction(Action):
187
  # Primary UI Fields (matches CodingEnv style)
188
  operation: str = Field(default="submit_findings", description="The operation to perform.")
189
  code: Optional[str] = Field(default=None, description="The fixed source code.")
 
 
190
  findings: List[ReviewFinding] = Field(default_factory=list, description="The structured findings list.")
191
 
192
  # Optional Review Fields (for benchmark compatibility)
@@ -201,6 +203,12 @@ class PythonReviewAction(Action):
201
  @model_validator(mode="after")
202
  def validate_action_shape(self) -> "PythonReviewAction":
203
  """Require the right fields for each action type."""
 
 
 
 
 
 
204
 
205
  # Bypass benchmark validation if using the template 'operation' style (e.g. submit_findings)
206
  if self.operation != ActionType.ADD_COMMENT:
 
187
  # Primary UI Fields (matches CodingEnv style)
188
  operation: str = Field(default="submit_findings", description="The operation to perform.")
189
  code: Optional[str] = Field(default=None, description="The fixed source code.")
190
+ patched_code: Optional[str] = Field(default=None, description="Compatibility alias for code.")
191
+ note: Optional[str] = Field(default=None, description="Optional note about the review.")
192
  findings: List[ReviewFinding] = Field(default_factory=list, description="The structured findings list.")
193
 
194
  # Optional Review Fields (for benchmark compatibility)
 
203
  @model_validator(mode="after")
204
  def validate_action_shape(self) -> "PythonReviewAction":
205
  """Require the right fields for each action type."""
206
+
207
+ # Synchronize code and patched_code
208
+ if self.code is None and self.patched_code is not None:
209
+ self.code = self.patched_code
210
+ elif self.patched_code is None and self.code is not None:
211
+ self.patched_code = self.code
212
 
213
  # Bypass benchmark validation if using the template 'operation' style (e.g. submit_findings)
214
  if self.operation != ActionType.ADD_COMMENT: