ybelkada HF Staff commited on
Commit
4aba101
·
verified ·
1 Parent(s): 16312a9

Harbor format: 871 coding_baseline tasks (part 53)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. tasks/swegym-1116/adapter.json +248 -0
  3. tasks/swegym-1116/dependency-assets/Makefile +96 -0
  4. tasks/swegym-1116/dependency-assets/pyproject.toml +154 -0
  5. tasks/swegym-1116/dependency-assets/requirements/all.txt +227 -0
  6. tasks/swegym-1116/dependency-assets/requirements/pyproject-all.txt +20 -0
  7. tasks/swegym-1116/dependency-setup.sh +17 -0
  8. tasks/swegym-1116/environment/Dockerfile +48 -0
  9. tasks/swegym-1116/instruction.md +209 -0
  10. tasks/swegym-1116/metadata.json +117 -0
  11. tasks/swegym-1116/provided-gold.diff +90 -0
  12. tasks/swegym-1116/solution/solve.sh +167 -0
  13. tasks/swegym-1116/task.toml +18 -0
  14. tasks/swegym-1116/tests/check_pytest.py +91 -0
  15. tasks/swegym-1116/tests/config.json +116 -0
  16. tasks/swegym-1116/tests/expected-panels.json +110 -0
  17. tasks/swegym-1116/tests/install_trusted_test_patch.sh +8 -0
  18. tasks/swegym-1116/tests/install_trusted_test_paths.sh +89 -0
  19. tasks/swegym-1116/tests/native-test-instrumented.sh +233 -0
  20. tasks/swegym-1116/tests/native-test.sh +233 -0
  21. tasks/swegym-1116/tests/test.sh +11 -0
  22. tasks/swegym-1116/tests/test_patch.diff +52 -0
  23. tasks/swegym-1116/tests/test_state.py +8 -0
  24. tasks/swegym-1116/tests/trusted_patch_paths.txt +1 -0
  25. tasks/swegym-1116/tests/trusted_test_paths.txt +1 -0
  26. tasks/swegym-1116/validation/canaries/partial-repair.sh +17 -0
  27. tasks/swegym-1116/validation/canaries/stale-reward.sh +3 -0
  28. tasks/swegym-1116/validation/canaries/unmodified.sh +2 -0
  29. tasks/swegym-1116/validation/openenv.json +27 -0
  30. tasks/swegym-1117/adapter.json +212 -0
  31. tasks/swegym-1117/dependency-assets/Makefile +107 -0
  32. tasks/swegym-1117/dependency-assets/pyproject.toml +184 -0
  33. tasks/swegym-1117/dependency-assets/requirements/all.txt +5 -0
  34. tasks/swegym-1117/dependency-assets/requirements/docs.txt +86 -0
  35. tasks/swegym-1117/dependency-assets/requirements/linting.txt +87 -0
  36. tasks/swegym-1117/dependency-assets/requirements/pyproject-all.txt +20 -0
  37. tasks/swegym-1117/dependency-assets/requirements/testing-extra.txt +30 -0
  38. tasks/swegym-1117/dependency-assets/requirements/testing.txt +45 -0
  39. tasks/swegym-1117/dependency-setup.sh +20 -0
  40. tasks/swegym-1117/environment/Dockerfile +48 -0
  41. tasks/swegym-1117/instruction.md +135 -0
  42. tasks/swegym-1117/metadata.json +85 -0
  43. tasks/swegym-1117/provided-gold.diff +27 -0
  44. tasks/swegym-1117/solution/solve.sh +122 -0
  45. tasks/swegym-1117/task.toml +18 -0
  46. tasks/swegym-1117/tests/check_pytest.py +91 -0
  47. tasks/swegym-1117/tests/config.json +84 -0
  48. tasks/swegym-1117/tests/expected-panels.json +78 -0
  49. tasks/swegym-1117/tests/install_trusted_test_patch.sh +8 -0
  50. tasks/swegym-1117/tests/install_trusted_test_paths.sh +89 -0
.gitattributes CHANGED
@@ -59,3 +59,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
  data/tasks.jsonl filter=lfs diff=lfs merge=lfs -text
 
 
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
  data/tasks.jsonl filter=lfs diff=lfs merge=lfs -text
62
+ tasks/tasksmith-35d8641e8647/tests/source/docs/_static/social[[:space:]]card.afdesign filter=lfs diff=lfs merge=lfs -text
tasks/swegym-1116/adapter.json ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "canary_selection": "Fixed first gold hunk, never selected from observed rewards; reward1 requires semantic review",
3
+ "collector_sha256": "2a75d35790f6496f754850af247239363d8226867be0988241601d82a0eefc59",
4
+ "dependency_installation_pinned": false,
5
+ "dependency_setup_sha256": "bdba8140caed604295c11cec8557c41f1049a872c022660f96ae4efbb85bcf38",
6
+ "extra_canaries": "test-reset and stale-reward boundary probes, not distinct semantic bugs",
7
+ "gold_patch_sha256": "9104bc84fbdf0373051eee8552e922fb070cab6525eee39cb0de9f272d27a7c4",
8
+ "known_wrong_semantic_implementations": 0,
9
+ "native_inventory_sha256": "d8c22a22babfb75a94b9f99fdac342058d7ba5be82076c62bfff73c876544a7a",
10
+ "new_files_deletions_and_executable_modes_supported": true,
11
+ "partial_repair_canary": true,
12
+ "partial_repair_sha256": "d9063b9f1857492ed09a9e2b659c24ad31e8cd6db681bd21581d7163ffb32215",
13
+ "partial_repair_wrongness_established": false,
14
+ "repo_url": "https://github.com/pydantic/pydantic.git",
15
+ "runtime_image": null,
16
+ "runtime_ready": false,
17
+ "schema": "python-git-patch-jobs-v1",
18
+ "source_base_commit": "2a7cb4f584e08680b65260d19b48a2c7ec574731",
19
+ "source_index_sha256": "55a8cdf68e0bab301ae92a7f48615d145e87a03563c02781f5dc0ffbf0b23597",
20
+ "source_pr_url": "https://github.com/pydantic/pydantic/pull/5589",
21
+ "source_record": {
22
+ "anti_training_canary": false,
23
+ "anti_training_reviewed": true,
24
+ "candidate_id": "TaskTrove:946884702046be1a7dcea2638186ad6b0d2ea103:swegym-1116",
25
+ "cloud_launch_ready": false,
26
+ "evaluation_only": false,
27
+ "fail_to_pass": [
28
+ "tests/test_types.py::test_path_validation_success[/test/path-result0]",
29
+ "tests/test_types.py::test_path_like",
30
+ "tests/test_types.py::test_path_validation_success[value1-result1]",
31
+ "tests/test_types.py::test_path_like_strict"
32
+ ],
33
+ "instruction_sha256": "2b9aae71dff317282dfa7419d424fae88bc16ddfd7e4de848835714e5aa9c868",
34
+ "intake_assessment": {
35
+ "reasons": [],
36
+ "semantic_nonoverlap_established": false,
37
+ "status": "eligible_for_controls",
38
+ "training_admissible": false,
39
+ "warnings": []
40
+ },
41
+ "inventory_path": "inventories/swegym-1116.json",
42
+ "license_evidence": {
43
+ "source_code": {
44
+ "probes": [
45
+ {
46
+ "filename": "LICENSE",
47
+ "http_status": 200
48
+ }
49
+ ],
50
+ "reused_frozen_pilot25": false,
51
+ "reviewed": true,
52
+ "scope": "captured exact-commit upstream software grant; all notices retained",
53
+ "sha256": "f72b9425e837e0cf59b335f6a37e6eb916bcf02544d756168d136139627e3483",
54
+ "spdx": "MIT",
55
+ "training_allowed": true,
56
+ "url": "https://raw.githubusercontent.com/pydantic/pydantic/2a7cb4f584e08680b65260d19b48a2c7ec574731/LICENSE"
57
+ },
58
+ "task_bundle": {
59
+ "reviewed": true,
60
+ "scope": "publisher-declared wrapper/train corpus; upstream notices remain applicable",
61
+ "sha256": "a906abccd50817f3dd2ea2485b43f5411aec676441025422c15c8a031ac55828",
62
+ "spdx": "Apache-2.0",
63
+ "training_allowed": true,
64
+ "url": "https://huggingface.co/datasets/open-thoughts/TaskTrove/blob/946884702046be1a7dcea2638186ad6b0d2ea103/README.md"
65
+ }
66
+ },
67
+ "native_inventory_sha256": "d8c22a22babfb75a94b9f99fdac342058d7ba5be82076c62bfff73c876544a7a",
68
+ "native_runtime_qualified": false,
69
+ "native_task_config": {
70
+ "agent": {
71
+ "timeout_sec": 1800.0
72
+ },
73
+ "metadata": {
74
+ "author_email": "bf996@nyu.edu",
75
+ "author_name": "OT-Agent + OpenHands",
76
+ "category": "bugfix",
77
+ "difficulty": "medium",
78
+ "tags": [
79
+ "swe",
80
+ "bugfix"
81
+ ]
82
+ },
83
+ "verifier": {
84
+ "restart_environment": false,
85
+ "timeout_sec": 600.0
86
+ },
87
+ "version": "1.0"
88
+ },
89
+ "negative_controls": [],
90
+ "original_source_dataset": "SWE-Gym/SWE-Gym",
91
+ "pass_to_pass": [
92
+ "tests/test_types.py::test_finite_float_validation_error[inf]",
93
+ "tests/test_types.py::test_default_validators[date_check-value113-result113]",
94
+ "tests/test_types.py::test_default_validators[date_check-value106-result106]",
95
+ "tests/test_types.py::test_default_validators[datetime_check-value120-result120]",
96
+ "tests/test_types.py::test_none_literal",
97
+ "tests/test_types.py::test_default_validators[float_check-value84-1.0]",
98
+ "tests/test_types.py::test_default_validators[float_check-t-ValidationError0]",
99
+ "tests/test_types.py::test_is_hashable[ImportString]",
100
+ "tests/test_types.py::test_list_success[value3-result3]",
101
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args40-value40-result40]",
102
+ "tests/test_types.py::test_default_validators[date_check-2017-05-05-result108]",
103
+ "tests/test_types.py::test_default_validators[bool_check-F-False]",
104
+ "tests/test_types.py::test_invalid_schema_constraints[kwargs11-type_11]",
105
+ "tests/test_types.py::test_decimal_validation[Field-type_args15-value15-result15]",
106
+ "tests/test_types.py::test_default_validators[frozenset_check-value176-result176]",
107
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args38-value38-result38]",
108
+ "tests/test_types.py::test_default_validators[bytes_check-value68-ValidationError]",
109
+ "tests/test_types.py::test_directory_path_validation_success[tests-result0]",
110
+ "tests/test_types.py::test_enum_from_json[Enum-False]",
111
+ "tests/test_types.py::test_str_to_upper[True-ABCDefG-ABCDEFG]",
112
+ "tests/test_types.py::test_enum_successful",
113
+ "tests/test_types.py::test_default_validators[float_check-1-1.01]",
114
+ "tests/test_types.py::test_deque_fails[int-value2-expected_error2]",
115
+ "tests/test_types.py::test_default_validators[uuid_check-123-ValidationError]",
116
+ "tests/test_types.py::test_default_validators[date_check-1493942400-result111]",
117
+ "tests/test_types.py::test_infinite_iterable_int",
118
+ "tests/test_types.py::test_default_validators[datetime_check-value121-result121]",
119
+ "tests/test_types.py::test_default_validators[str_check-xxxxxxxxxxx-ValidationError0]",
120
+ "tests/test_types.py::test_default_validators[str_check-xxxxxxxxxxx-ValidationError1]",
121
+ "tests/test_types.py::test_default_validators[datetime_check-1493979010000.0-result128]",
122
+ "tests/test_types.py::test_default_validators[decimal_check-42.24-result99]",
123
+ "tests/test_types.py::test_invalid_schema_constraints[kwargs8-type_8]",
124
+ "tests/test_types.py::test_deque_generic_success[cls5-value5-result5]",
125
+ "tests/test_types.py::test_is_hashable[pydantic_type13]",
126
+ "tests/test_types.py::test_default_validators[bool_check-value48-ValidationError]",
127
+ "tests/test_types.py::test_constrained_set_optional",
128
+ "tests/test_types.py::test_list_fails[1231]",
129
+ "tests/test_types.py::test_is_hashable[ByteSize]",
130
+ "tests/test_types.py::test_decimal_validation[Field-type_args38-value38-result38]",
131
+ "tests/test_types.py::test_is_hashable[pydantic_type31]",
132
+ "tests/test_types.py::test_sequence_success[int-value0-result0]",
133
+ "tests/test_types.py::test_pattern[Pattern]",
134
+ "tests/test_types.py::test_int_enum_successful_for_str_int",
135
+ "tests/test_types.py::test_default_validators[bool_check-off-False]",
136
+ "tests/test_types.py::test_default_validators[bool_check-NO-False]",
137
+ "tests/test_types.py::test_default_validators[float_check-1-1.00]",
138
+ "tests/test_types.py::test_default_validators[bool_check-on-True]",
139
+ "tests/test_types.py::test_enum_fails",
140
+ "tests/test_types.py::test_decimal_strict",
141
+ "tests/test_types.py::test_bytesize_to",
142
+ "tests/test_types.py::test_number_multiple_of_float_invalid[1.27]",
143
+ "tests/test_types.py::test_default_validators[bool_check-T-True]",
144
+ "tests/test_types.py::test_default_validators[int_check-value74-1]",
145
+ "tests/test_types.py::test_bytesize_conversions[1.0-1-1B-1B]",
146
+ "tests/test_types.py::test_bytesize_conversions[1-1-1B-1B]",
147
+ "tests/test_types.py::test_strict_timedelta",
148
+ "tests/test_types.py::test_tuple_variable_len_success[<genexpr>-int-result2]",
149
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args43-value43-result43]",
150
+ "tests/test_types.py::test_number_le",
151
+ "tests/test_types.py::test_default_union_class",
152
+ "tests/test_types.py::test_default_validators[set_check-value172-result172]",
153
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args21-NaN-result21]",
154
+ "tests/test_types.py::test_decimal_validation[Field-type_args14-value14-result14]",
155
+ "tests/test_types.py::test_is_hashable[pydantic_type12]",
156
+ "tests/test_types.py::test_list_success[<genexpr>-result2]",
157
+ "tests/test_types.py::test_is_hashable[pydantic_type14]",
158
+ "tests/test_types.py::test_directory_path_validation_fails[tests/test_t.py]",
159
+ "tests/test_types.py::test_constrained_set_good",
160
+ "tests/test_types.py::test_is_hashable[pydantic_type10]",
161
+ "tests/test_types.py::test_default_validators[date_check-2017-5-5-ValidationError0]",
162
+ "tests/test_types.py::test_is_hashable[conbytes]",
163
+ "tests/test_types.py::test_is_hashable[confloat]",
164
+ "tests/test_types.py::test_default_validators[bool_check-OFF-False]",
165
+ "tests/test_types.py::test_default_validators[date_check-value119-ValidationError]",
166
+ "tests/test_types.py::test_is_hashable[condecimal]",
167
+ "tests/test_types.py::test_decimal_validation[Field-type_args41-value41-result41]",
168
+ "tests/test_types.py::test_decimal_not_finite[-NaN-is_nan]",
169
+ "tests/test_types.py::test_default_validators[int_check-12-121]",
170
+ "tests/test_types.py::test_is_hashable[pydantic_type4]",
171
+ "tests/test_types.py::test_conlist_wrong_type_default",
172
+ "tests/test_types.py::test_default_validators[frozenset_check-value174-result174]",
173
+ "tests/test_types.py::test_default_validators[bool_check-No-False]",
174
+ "tests/test_types.py::test_decimal_validation[Field-type_args11-value11-result11]",
175
+ "tests/test_types.py::test_frozenset_field_conversion[value0-result0]",
176
+ "tests/test_types.py::test_decimal_validation[Field-type_args8-value8-result8]",
177
+ "tests/test_types.py::test_list_success[value0-result0]",
178
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args20-value20-result20]",
179
+ "tests/test_types.py::test_default_validators[bool_check-false-False]",
180
+ "tests/test_types.py::test_default_validators[str_check-s-s1]",
181
+ "tests/test_types.py::test_default_validators[time_check-value143-ValidationError]",
182
+ "tests/test_types.py::test_finite_float_config",
183
+ "tests/test_types.py::test_secretstr_idempotent",
184
+ "tests/test_types.py::test_none[NoneType1]",
185
+ "tests/test_types.py::test_tuple_success[value3-result3]",
186
+ "tests/test_types.py::test_number_multiple_of_int_invalid[14]",
187
+ "tests/test_types.py::test_decimal_validation[Field-type_args2-value2-result2]",
188
+ "tests/test_types.py::test_new_type_fails",
189
+ "tests/test_types.py::test_default_validators[bool_check-Y-True]",
190
+ "tests/test_types.py::test_enum_from_json[IntEnum-True]",
191
+ "tests/test_types.py::test_decimal_validation[Field-type_args0-value0-result0]"
192
+ ],
193
+ "patch_sha256": "9104bc84fbdf0373051eee8552e922fb070cab6525eee39cb0de9f272d27a7c4",
194
+ "prior_pilot25_member": false,
195
+ "provenance_path": "provenance/swegym-1116.json",
196
+ "published_image_pins_qualified": false,
197
+ "repair_patch_paths": [
198
+ {
199
+ "new": "pydantic/_internal/_std_types_schema.py",
200
+ "old": "pydantic/_internal/_std_types_schema.py"
201
+ },
202
+ {
203
+ "new": "pydantic/_internal/_validators.py",
204
+ "old": "pydantic/_internal/_validators.py"
205
+ }
206
+ ],
207
+ "repository_lineage": [
208
+ "pydantic/pydantic"
209
+ ],
210
+ "rfc008_complete": false,
211
+ "runtime_blockers": [
212
+ "unqualified repository worktree preparation and patch/file handoff",
213
+ "missing task-specific negatives and canaries",
214
+ "unqualified immutable runtime image",
215
+ "reference/NOP/replay and model audit not run"
216
+ ],
217
+ "runtime_resource_review_required": false,
218
+ "semantic_nonoverlap_established": false,
219
+ "source_commit": "2a7cb4f584e08680b65260d19b48a2c7ec574731",
220
+ "source_dataset": "open-thoughts/TaskTrove",
221
+ "source_kind": "pr",
222
+ "source_pr_url": "https://github.com/pydantic/pydantic/pull/5589",
223
+ "source_repo": "pydantic/pydantic",
224
+ "source_revision": "946884702046be1a7dcea2638186ad6b0d2ea103",
225
+ "source_split": "train",
226
+ "source_task_id": "pydantic__pydantic-5589",
227
+ "target_model_calibrated": false,
228
+ "task_id": "swegym-1116",
229
+ "task_path": "tasks/swegym-1116",
230
+ "task_sha256": "74a895d4ba251d359d359def5290c2b62ca04ca7538f4ec81e4941c4764ccfab",
231
+ "task_sha256_kind": "original-native-tar-gzip",
232
+ "trainability_established": false,
233
+ "training_admissible": false,
234
+ "transfer_contract": {
235
+ "allowlist": [],
236
+ "status": "blocked_missing_repository_patch_adapter"
237
+ },
238
+ "upstream_identity_reviewed": true,
239
+ "upstream_repo": "pydantic/pydantic",
240
+ "usage": "quarantine_only",
241
+ "verified": false
242
+ },
243
+ "source_repo": "pydantic/pydantic",
244
+ "symlink_submodule_changes_supported": false,
245
+ "task_id": "swegym-1116",
246
+ "transfer": "index-independent-worktree-to-Git-binary-patch",
247
+ "transfer_path": "/testbed/submission.patch"
248
+ }
tasks/swegym-1116/dependency-assets/Makefile ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .DEFAULT_GOAL := all
2
+ sources = pydantic tests docs/plugins
3
+
4
+ .PHONY: install
5
+ install:
6
+ python -m pip install -U pip
7
+ pip install -r requirements/all.txt
8
+ pip install -r requirements/pyproject-all.txt
9
+ pip install -e .
10
+
11
+ .PHONY: refresh-lockfiles
12
+ refresh-lockfiles: ## Sync lockfiles with requirements files.
13
+ bash requirements/refresh.sh
14
+
15
+
16
+ .PHONY: rebuild-lockfiles
17
+ rebuild-lockfiles: ## Rebuild lockfiles from scratch, updating all dependencies
18
+ bash requirements/rebuild.sh
19
+
20
+ .PHONY: format
21
+ format:
22
+ black $(sources)
23
+ ruff --fix $(sources)
24
+
25
+ .PHONY: lint
26
+ lint:
27
+ ruff $(sources)
28
+ black $(sources) --check --diff
29
+
30
+ .PHONY: codespell
31
+ codespell:
32
+ pre-commit run codespell --all-files
33
+
34
+ .PHONY: typecheck
35
+ typecheck:
36
+ pre-commit run typecheck --all-files
37
+
38
+ .PHONY: test-mypy
39
+ test-mypy:
40
+ coverage run -m pytest tests/mypy --test-mypy
41
+
42
+ .PHONY: test-pyright
43
+ test-pyright:
44
+ cd tests/pyright && pyright
45
+
46
+ .PHONY: test
47
+ test:
48
+ coverage run -m pytest --durations=10
49
+
50
+ .PHONY: testcov
51
+ testcov: test
52
+ @echo "building coverage html"
53
+ @coverage html
54
+
55
+ .PHONY: testcov-compile
56
+ testcov-compile: build-trace test
57
+ @echo "building coverage html"
58
+ @coverage html
59
+
60
+ .PHONY: test-examples
61
+ test-examples:
62
+ @echo "running examples"
63
+ @find docs/examples -type f -name '*.py' | xargs -I'{}' sh -c 'python {} >/dev/null 2>&1 || (echo "{} failed")'
64
+
65
+ .PHONY: test-fastapi
66
+ test-fastapi:
67
+ git clone https://github.com/tiangolo/fastapi.git --single-branch
68
+ ./tests/test_fastapi.sh
69
+
70
+ .PHONY: all
71
+ all: lint typecheck codespell testcov
72
+
73
+ .PHONY: clean
74
+ clean:
75
+ rm -rf `find . -name __pycache__`
76
+ rm -f `find . -type f -name '*.py[co]'`
77
+ rm -f `find . -type f -name '*~'`
78
+ rm -f `find . -type f -name '.*~'`
79
+ rm -rf .cache
80
+ rm -rf .pytest_cache
81
+ rm -rf .ruff_cache
82
+ rm -rf htmlcov
83
+ rm -rf *.egg-info
84
+ rm -f .coverage
85
+ rm -f .coverage.*
86
+ rm -rf build
87
+ rm -rf dist
88
+ rm -rf site
89
+ rm -rf docs/_build
90
+ rm -rf docs/.changelog.md docs/.version.md docs/.tmp_schema_mappings.html
91
+ rm -rf fastapi/test.db
92
+ rm -rf coverage.xml
93
+
94
+ .PHONY: docs
95
+ docs:
96
+ mkdocs build
tasks/swegym-1116/dependency-assets/pyproject.toml ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ requires = ['hatchling', 'hatch-fancy-pypi-readme>=22.5.0']
3
+ build-backend = 'hatchling.build'
4
+
5
+ [tool.hatch.version]
6
+ path = 'pydantic/version.py'
7
+
8
+ [tool.hatch.build.targets.sdist]
9
+ # limit which files are included in the sdist (.tar.gz) asset,
10
+ # see https://github.com/pydantic/pydantic/pull/4542
11
+ include = [
12
+ '/README.md',
13
+ '/HISTORY.md',
14
+ '/Makefile',
15
+ '/pydantic',
16
+ '/tests',
17
+ '/requirements',
18
+ ]
19
+
20
+ [project]
21
+ name = 'pydantic'
22
+ description = 'Data validation using Python type hints'
23
+ authors = [
24
+ {name = 'Samuel Colvin', email = 's@muelcolvin.com'},
25
+ {name = 'Eric Jolibois', email = 'em.jolibois@gmail.com'},
26
+ {name = 'Hasan Ramezani', email = 'hasan.r67@gmail.com'},
27
+ {name = 'Adrian Garcia Badaracco', email = '1755071+adriangb@users.noreply.github.com'},
28
+ {name = 'Terrence Dorsey', email = 'terry@pydantic.dev'},
29
+ {name = 'David Montague', email = 'david@pydantic.dev'},
30
+ ]
31
+ license = 'MIT'
32
+ classifiers = [
33
+ 'Development Status :: 5 - Production/Stable',
34
+ 'Programming Language :: Python',
35
+ 'Programming Language :: Python :: Implementation :: CPython',
36
+ 'Programming Language :: Python :: Implementation :: PyPy',
37
+ 'Programming Language :: Python :: 3',
38
+ 'Programming Language :: Python :: 3 :: Only',
39
+ 'Programming Language :: Python :: 3.7',
40
+ 'Programming Language :: Python :: 3.8',
41
+ 'Programming Language :: Python :: 3.9',
42
+ 'Programming Language :: Python :: 3.10',
43
+ 'Programming Language :: Python :: 3.11',
44
+ 'Intended Audience :: Developers',
45
+ 'Intended Audience :: Information Technology',
46
+ 'Intended Audience :: System Administrators',
47
+ 'License :: OSI Approved :: MIT License',
48
+ 'Operating System :: Unix',
49
+ 'Operating System :: POSIX :: Linux',
50
+ 'Environment :: Console',
51
+ 'Environment :: MacOS X',
52
+ 'Framework :: Hypothesis',
53
+ 'Framework :: Pydantic',
54
+ 'Topic :: Software Development :: Libraries :: Python Modules',
55
+ 'Topic :: Internet',
56
+ ]
57
+ requires-python = '>=3.7'
58
+ dependencies = [
59
+ 'typing-extensions>=4.5.0',
60
+ 'pydantic-core==0.27.0',
61
+ 'annotated-types>=0.4.0',
62
+ ]
63
+ optional-dependencies = { email = ['email-validator>=1.3.0'] }
64
+ dynamic = ['version', 'readme']
65
+
66
+ entry-points.hypothesis = {_ = 'pydantic._hypothesis_plugin'}
67
+
68
+ [project.urls]
69
+ Homepage = 'https://github.com/pydantic/pydantic'
70
+ Documentation = 'https://docs.pydantic.dev'
71
+ Funding = 'https://github.com/sponsors/samuelcolvin'
72
+ Source = 'https://github.com/pydantic/pydantic'
73
+ Changelog = 'https://docs.pydantic.dev/changelog'
74
+
75
+ [tool.hatch.metadata.hooks.fancy-pypi-readme]
76
+ content-type = 'text/markdown'
77
+ # construct the PyPI readme from README.md and HISTORY.md
78
+ fragments = [
79
+ {path = "README.md"},
80
+ {text = "\n## Changelog\n\n"},
81
+ {path = "HISTORY.md", pattern = "(.+?)<!-- package description limit -->"},
82
+ {text = "\n... see [here](https://docs.pydantic.dev/changelog/#v0322-2019-08-17) for earlier changes.\n"},
83
+ ]
84
+ # convert GitHuB issue/PR numbers and handles to links
85
+ substitutions = [
86
+ {pattern = '(\s+)#(\d+)', replacement = '\1[#\2](https://github.com/pydantic/pydantic/issues/\2)'},
87
+ {pattern = '(\s+)@([\w\-]+)', replacement = '\1[@\2](https://github.com/\2)'},
88
+ {pattern = '@@', replacement = '@'},
89
+ ]
90
+
91
+ [tool.pytest.ini_options]
92
+ testpaths = 'tests'
93
+ xfail_strict = true
94
+ filterwarnings = [
95
+ 'error',
96
+ 'ignore:path is deprecated.*:DeprecationWarning:',
97
+ ]
98
+
99
+ # configuring https://github.com/pydantic/hooky
100
+ [tool.hooky]
101
+ reviewers = ['samuelcolvin', 'adriangb', 'dmontagu', 'hramezani', 'Kludex']
102
+ require_change_file = false
103
+
104
+ [tool.ruff]
105
+ line-length = 120
106
+ extend-select = ['Q', 'RUF100', 'C90', 'UP', 'I']
107
+ flake8-quotes = {inline-quotes = 'single', multiline-quotes = 'double'}
108
+ mccabe = { max-complexity = 14 }
109
+ isort = { known-first-party = ['pydantic', 'tests'] }
110
+ target-version = "py37"
111
+
112
+ [tool.ruff.per-file-ignores]
113
+ 'pydantic/__init__.py' = ['F405', 'F403']
114
+ 'tests/test_forward_ref.py' = ['F821']
115
+
116
+ [tool.coverage.run]
117
+ source = ['pydantic']
118
+ omit = ['pydantic/deprecated/*']
119
+ branch = true
120
+ context = '${CONTEXT}'
121
+
122
+ [tool.coverage.report]
123
+ precision = 2
124
+ exclude_lines = [
125
+ 'pragma: no cover',
126
+ 'raise NotImplementedError',
127
+ 'if TYPE_CHECKING:',
128
+ 'if typing.TYPE_CHECKING:',
129
+ '@overload',
130
+ '@typing.overload',
131
+ '\(Protocol\):$',
132
+ ]
133
+
134
+ [tool.coverage.paths]
135
+ source = [
136
+ 'pydantic/',
137
+ '/Users/runner/work/pydantic/pydantic/pydantic/',
138
+ 'D:\a\pydantic\pydantic\pydantic',
139
+ ]
140
+
141
+ [tool.black]
142
+ color = true
143
+ line-length = 120
144
+ target-version = ['py310']
145
+ skip-string-normalization = true
146
+
147
+ [tool.pyright]
148
+ include = ['pydantic']
149
+ exclude = ['pydantic/_hypothesis_plugin.py', 'pydantic/mypy.py']
150
+
151
+ [tool.codespell]
152
+ skip = '.git,env*'
153
+ # `ser` - abbreviation for "ser"ialisation
154
+ ignore-words-list = 'gir,ser'
tasks/swegym-1116/dependency-assets/requirements/all.txt ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is autogenerated by pip-compile with Python 3.10
3
+ # by the following command:
4
+ #
5
+ # pip-compile --output-file=requirements/all.txt --resolver=backtracking --strip-extras requirements/all.in
6
+ #
7
+ # via -r requirements/all.in
8
+ annotated-types==0.4.0
9
+ # via
10
+ # -r requirements/linting.in
11
+ # pydantic
12
+ ansi2html==1.8.0
13
+ # via -r requirements/testing-extra.in
14
+ asttokens==2.2.1
15
+ # via devtools
16
+ attrs==22.2.0
17
+ # via
18
+ # hypothesis
19
+ # pytest
20
+ autoflake==2.0.2
21
+ # via -r requirements/docs.in
22
+ black==23.1.0
23
+ # via
24
+ # -r requirements/linting.in
25
+ # pytest-examples
26
+ certifi==2022.12.7
27
+ # via requests
28
+ cfgv==3.3.1
29
+ # via pre-commit
30
+ charset-normalizer==3.1.0
31
+ # via requests
32
+ click==8.1.3
33
+ # via
34
+ # black
35
+ # mkdocs
36
+ colorama==0.4.6
37
+ # via
38
+ # griffe
39
+ # mkdocs-material
40
+ coverage==7.2.2
41
+ # via -r requirements/testing.in
42
+ devtools==0.10.0
43
+ # via -r requirements/testing-extra.in
44
+ dirty-equals==0.5.0
45
+ # via -r requirements/testing.in
46
+ distlib==0.3.6
47
+ # via virtualenv
48
+ dnspython==2.3.0
49
+ # via email-validator
50
+ email-validator==2.0.0.post2
51
+ # via pydantic
52
+ exceptiongroup==1.1.1
53
+ # via
54
+ # hypothesis
55
+ # pytest
56
+ executing==1.2.0
57
+ # via devtools
58
+ filelock==3.10.1
59
+ # via virtualenv
60
+ ghp-import==2.1.0
61
+ # via mkdocs
62
+ greenlet==2.0.2
63
+ # via sqlalchemy
64
+ griffe==0.27.1
65
+ # via mkdocstrings-python
66
+ hypothesis==6.70.0
67
+ # via
68
+ # -r requirements/linting.in
69
+ # -r requirements/testing-extra.in
70
+ identify==2.5.21
71
+ # via pre-commit
72
+ idna==3.4
73
+ # via
74
+ # email-validator
75
+ # requests
76
+ iniconfig==2.0.0
77
+ # via pytest
78
+ jinja2==3.1.2
79
+ # via
80
+ # mkdocs
81
+ # mkdocs-material
82
+ # mkdocstrings
83
+ markdown==3.3.7
84
+ # via
85
+ # mkdocs
86
+ # mkdocs-autorefs
87
+ # mkdocs-material
88
+ # mkdocstrings
89
+ # pymdown-extensions
90
+ markdown-it-py==2.2.0
91
+ # via rich
92
+ markupsafe==2.1.2
93
+ # via
94
+ # jinja2
95
+ # mkdocstrings
96
+ mdurl==0.1.2
97
+ # via markdown-it-py
98
+ mergedeep==1.3.4
99
+ # via mkdocs
100
+ mkdocs==1.4.2
101
+ # via
102
+ # -r requirements/docs.in
103
+ # mkdocs-autorefs
104
+ # mkdocs-exclude
105
+ # mkdocs-material
106
+ # mkdocs-redirects
107
+ # mkdocs-simple-hooks
108
+ # mkdocstrings
109
+ mkdocs-autorefs==0.4.1
110
+ # via mkdocstrings
111
+ mkdocs-exclude==1.0.2
112
+ # via -r requirements/docs.in
113
+ mkdocs-material==9.1.4
114
+ # via -r requirements/docs.in
115
+ mkdocs-material-extensions==1.1.1
116
+ # via mkdocs-material
117
+ mkdocs-redirects==1.2.0
118
+ # via -r requirements/docs.in
119
+ mkdocs-simple-hooks==0.1.5
120
+ # via -r requirements/docs.in
121
+ mkdocstrings==0.21.2
122
+ # via mkdocstrings-python
123
+ mkdocstrings-python==0.9.0
124
+ # via -r requirements/docs.in
125
+ mypy-extensions==1.0.0
126
+ # via black
127
+ nodeenv==1.7.0
128
+ # via pre-commit
129
+ packaging==23.0
130
+ # via
131
+ # black
132
+ # mkdocs
133
+ # pytest
134
+ pathspec==0.11.0
135
+ # via black
136
+ platformdirs==3.1.1
137
+ # via
138
+ # black
139
+ # virtualenv
140
+ pluggy==1.0.0
141
+ # via pytest
142
+ pre-commit==2.21.0
143
+ # via -r requirements/linting.in
144
+ pydantic-core==0.27.0
145
+ # via
146
+ # -r requirements/docs.in
147
+ # -r requirements/linting.in
148
+ # pydantic
149
+ pyflakes==3.0.1
150
+ # via autoflake
151
+ pygments==2.14.0
152
+ # via
153
+ # mkdocs-material
154
+ # rich
155
+ pymdown-extensions==9.10
156
+ # via
157
+ # mkdocs-material
158
+ # mkdocstrings
159
+ pytest==7.2.2
160
+ # via
161
+ # -r requirements/testing.in
162
+ # pytest-examples
163
+ # pytest-mock
164
+ # pytest-pretty
165
+ pytest-examples==0.0.8
166
+ # via -r requirements/testing.in
167
+ pytest-mock==3.10.0
168
+ # via -r requirements/testing.in
169
+ pytest-pretty==1.1.1
170
+ # via -r requirements/testing.in
171
+ python-dateutil==2.8.2
172
+ # via ghp-import
173
+ pytz==2022.7.1
174
+ # via dirty-equals
175
+ pyupgrade==3.3.1
176
+ # via
177
+ # -r requirements/docs.in
178
+ # -r requirements/linting.in
179
+ pyyaml==6.0
180
+ # via
181
+ # mkdocs
182
+ # pre-commit
183
+ # pymdown-extensions
184
+ # pyyaml-env-tag
185
+ pyyaml-env-tag==0.1
186
+ # via mkdocs
187
+ regex==2022.10.31
188
+ # via mkdocs-material
189
+ requests==2.28.2
190
+ # via mkdocs-material
191
+ rich==13.3.2
192
+ # via pytest-pretty
193
+ ruff==0.0.259
194
+ # via
195
+ # -r requirements/linting.in
196
+ # pytest-examples
197
+ six==1.16.0
198
+ # via
199
+ # asttokens
200
+ # python-dateutil
201
+ sortedcontainers==2.4.0
202
+ # via hypothesis
203
+ sqlalchemy==1.4.0
204
+ # via -r requirements/testing-extra.in
205
+ tokenize-rt==5.0.0
206
+ # via pyupgrade
207
+ tomli==2.0.1
208
+ # via
209
+ # -r requirements/docs.in
210
+ # autoflake
211
+ # black
212
+ # coverage
213
+ # pytest
214
+ typing-extensions==4.5.0
215
+ # via
216
+ # dirty-equals
217
+ # pydantic
218
+ # pydantic-core
219
+ urllib3==1.26.15
220
+ # via requests
221
+ virtualenv==20.21.0
222
+ # via pre-commit
223
+ watchdog==3.0.0
224
+ # via mkdocs
225
+
226
+ # The following packages are considered to be unsafe in a requirements file:
227
+ # setuptools
tasks/swegym-1116/dependency-assets/requirements/pyproject-all.txt ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is autogenerated by pip-compile with Python 3.10
3
+ # by the following command:
4
+ #
5
+ # pip-compile --all-extras --output-file=requirements/pyproject-all.txt --pip-args='-c requirements/all.txt' --resolver=backtracking pyproject.toml
6
+ #
7
+ annotated-types==0.4.0
8
+ # via pydantic (pyproject.toml)
9
+ dnspython==2.3.0
10
+ # via email-validator
11
+ email-validator==1.3.1
12
+ # via pydantic (pyproject.toml)
13
+ idna==3.4
14
+ # via email-validator
15
+ pydantic-core==0.27.0
16
+ # via pydantic (pyproject.toml)
17
+ typing-extensions==4.5.0
18
+ # via
19
+ # pydantic (pyproject.toml)
20
+ # pydantic-core
tasks/swegym-1116/dependency-setup.sh ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -Eeuo pipefail
3
+ source /opt/miniconda3/bin/activate
4
+ conda activate testbed
5
+ cd /testbed/repo
6
+ /usr/bin/sha256sum --check <<'OPENENV_BASE_REQUIREMENTS'
7
+ 28b65309b75b306c4ac87a6e3bd74ea0e10ecea6d9384f8cba8a524aa0e035c2 Makefile
8
+ 4021e29262be56552f340349249ca61cc544b60703046521f50e6030a6623bb3 pyproject.toml
9
+ 257040fa435cdf2b340bb5f07943a69e741525181aebcc51c0cc3acf03e854f8 requirements/all.txt
10
+ 86a4df7c31e130b1de5cd3ccf37d9c78d17e1c7b0e51fd2c61f1bc72a26d26a5 requirements/pyproject-all.txt
11
+ OPENENV_BASE_REQUIREMENTS
12
+ python -m pip install -U pip
13
+ python -m pip install -r requirements/all.txt
14
+ python -m pip install -r requirements/pyproject-all.txt
15
+ python -m pip install -e .
16
+ python -c 'import pydantic_core; assert pydantic_core.__version__ == "0.27.0"'
17
+ touch /tmp/tasktrove-agent-setup-complete
tasks/swegym-1116/environment/Dockerfile ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:22.04
2
+
3
+ ARG DEBIAN_FRONTEND=noninteractive
4
+ ENV TZ=Etc/UTC
5
+
6
+ WORKDIR /testbed
7
+
8
+ RUN apt-get update && \
9
+ apt-get install -y --no-install-recommends \
10
+ wget \
11
+ git \
12
+ build-essential \
13
+ pkg-config \
14
+ ca-certificates \
15
+ curl \
16
+ jq \
17
+ locales \
18
+ locales-all \
19
+ tzdata \
20
+ libxml2-dev \
21
+ libxmlsec1-dev \
22
+ libffi-dev \
23
+ libssl-dev \
24
+ zlib1g-dev \
25
+ libbz2-dev \
26
+ libreadline-dev \
27
+ libsqlite3-dev \
28
+ python3 \
29
+ python3-pip \
30
+ python-is-python3 \
31
+ libsqlite3-dev openjdk-17-jdk openjdk-17-jre npm libpq-dev \
32
+ && rm -rf /var/lib/apt/lists/*
33
+
34
+ # Install Miniconda - Consistent with original SWE-Bench approach
35
+ RUN wget 'https://repo.anaconda.com/miniconda/Miniconda3-py311_24.7.1-0-Linux-x86_64.sh' -O miniconda.sh && \
36
+ bash miniconda.sh -b -p /opt/miniconda3 && \
37
+ rm miniconda.sh
38
+
39
+ ENV PATH="/opt/miniconda3/bin:$PATH"
40
+
41
+ # Following authors' approach: use /bin/bash explicitly for initialization
42
+ RUN /bin/bash -c "source /opt/miniconda3/bin/activate && \
43
+ conda init bash && \
44
+ conda config --append channels conda-forge && \
45
+ conda create -n testbed python=3.8 -y"
46
+
47
+ # Automatically activate environment in shell sessions
48
+ RUN echo "source /opt/miniconda3/bin/activate && conda activate testbed" >> /root/.bashrc
tasks/swegym-1116/instruction.md ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Bug Fix Task
2
+
3
+ - Repository: `pydantic/pydantic`
4
+ - Source commit: `2a7cb4f584e08680b65260d19b48a2c7ec574731`
5
+ - Dataset instance: `pydantic__pydantic-5589`
6
+ - Upstream issue version: `2.03`
7
+ - Reference repo URL: https://github.com/pydantic/pydantic
8
+
9
+ ## Environment Setup (complete these steps first)
10
+
11
+ touch /tmp/tasktrove-agent-setup-complete
12
+ ```bash
13
+ cd /testbed
14
+ git clone https://github.com/pydantic/pydantic.git repo
15
+ cd repo
16
+ git checkout 2a7cb4f584e08680b65260d19b48a2c7ec574731
17
+
18
+ # Activate environment
19
+ source /opt/miniconda3/bin/activate
20
+ conda activate testbed
21
+
22
+ # Install dependencies
23
+ pip install pdm && pdm install
24
+ ```
25
+
26
+ ---
27
+
28
+ ## Problem Statement
29
+ Support validating `os.PathLike` typed variables
30
+ ### Checks
31
+
32
+ * [x] I added a descriptive title to this issue
33
+ * [x] I have searched (google, github) for similar issues and couldn't find anything
34
+ * [x] I have read and followed [the docs](https://pydantic-docs.helpmanual.io/) and still think this feature/change is needed
35
+ * [x] After submitting this, I commit to one of:
36
+ * Look through open issues and helped at least one other person
37
+ * Hit the "watch" button on this repo to receive notifications and I commit to help at least 2 people that ask questions in the future
38
+ * Implement a Pull Request for a confirmed bug
39
+
40
+ <!-- Sorry to sound so draconian, but every second saved replying to issues is time spend improving pydantic :-) -->
41
+
42
+ # Feature Request
43
+
44
+ Output of `python -c "import pydantic.utils; print(pydantic.utils.version_info())"`:
45
+ ```
46
+ pydantic version: 1.7.2
47
+ pydantic compiled: True
48
+ install path: /home/hong/src/pydantic/pydantic
49
+ python version: 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0]
50
+ platform: Linux-5.8.0-0.bpo.2-amd64-x86_64-with-debian-10.6
51
+ optional deps. installed: ['typing-extensions', 'email-validator', 'devtools']
52
+
53
+ ```
54
+ <!-- or if you're using pydantic prior to v1.3, manually include: OS, python version and pydantic version -->
55
+
56
+ <!-- Please read the [docs](https://pydantic-docs.helpmanual.io/) and search through issues to
57
+ confirm your feature hasn't been asked for before, or already implemented. -->
58
+
59
+ <!-- Where possible please include a self-contained code snippet describing your feature request: -->
60
+
61
+ ```py
62
+ import os
63
+ from pydantic.dataclasses import dataclass
64
+
65
+ @dataclass
66
+ class Data:
67
+ a: os.PathLike
68
+ ```
69
+
70
+ Running this script leads to:
71
+
72
+ ```
73
+ Traceback (most recent call last):
74
+ File "m.py", line 4, in <module>
75
+ @dataclass
76
+ File "pydantic/dataclasses.py", line 229, in pydantic.dataclasses.dataclass
77
+ return wrap(_cls)
78
+ File "pydantic/dataclasses.py", line 224, in pydantic.dataclasses.dataclass.wrap
79
+ return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen, config)
80
+ File "pydantic/dataclasses.py", line 160, in pydantic.dataclasses._process_class
81
+ cls.__pydantic_model__ = create_model(
82
+ File "pydantic/main.py", line 931, in pydantic.main.create_model
83
+ return type(__model_name, (__base__,), namespace)
84
+ File "pydantic/main.py", line 262, in pydantic.main.ModelMetaclass.__new__
85
+ fields[ann_name] = inferred = ModelField.infer(
86
+ File "pydantic/fields.py", line 315, in pydantic.fields.ModelField.infer
87
+ return cls(
88
+ File "pydantic/fields.py", line 284, in pydantic.fields.ModelField.__init__
89
+ self.prepare()
90
+ File "pydantic/fields.py", line 361, in pydantic.fields.ModelField.prepare
91
+ self.populate_validators()
92
+ File "pydantic/fields.py", line 542, in pydantic.fields.ModelField.populate_validators
93
+ *(get_validators() if get_validators else list(find_validators(self.type_, self.model_config))),
94
+ File "pydantic/validators.py", line 638, in find_validators
95
+ raise RuntimeError(f'no validator found for {type_}, see `arbitrary_types_allowed` in Config')
96
+ RuntimeError: no validator found for <class 'os.PathLike'>, see `arbitrary_types_allowed` in Config
97
+ ```
98
+
99
+ It would be good to support this builtin annotation type ([os.PathLike](https://docs.python.org/3/library/os.html#os.PathLike)).
100
+
101
+ ## Tests that must keep passing
102
+ - `tests/test_types.py::test_finite_float_validation_error[inf]`
103
+ - `tests/test_types.py::test_default_validators[date_check-value113-result113]`
104
+ - `tests/test_types.py::test_default_validators[date_check-value106-result106]`
105
+ - `tests/test_types.py::test_default_validators[datetime_check-value120-result120]`
106
+ - `tests/test_types.py::test_none_literal`
107
+ - `tests/test_types.py::test_default_validators[float_check-value84-1.0]`
108
+ - `tests/test_types.py::test_default_validators[float_check-t-ValidationError0]`
109
+ - `tests/test_types.py::test_is_hashable[ImportString]`
110
+ - `tests/test_types.py::test_list_success[value3-result3]`
111
+ - `tests/test_types.py::test_decimal_validation[condecimal-type_args40-value40-result40]`
112
+ - `tests/test_types.py::test_default_validators[date_check-2017-05-05-result108]`
113
+ - `tests/test_types.py::test_default_validators[bool_check-F-False]`
114
+ - `tests/test_types.py::test_invalid_schema_constraints[kwargs11-type_11]`
115
+ - `tests/test_types.py::test_decimal_validation[Field-type_args15-value15-result15]`
116
+ - `tests/test_types.py::test_default_validators[frozenset_check-value176-result176]`
117
+ - `tests/test_types.py::test_decimal_validation[condecimal-type_args38-value38-result38]`
118
+ - `tests/test_types.py::test_default_validators[bytes_check-value68-ValidationError]`
119
+ - `tests/test_types.py::test_directory_path_validation_success[tests-result0]`
120
+ - `tests/test_types.py::test_enum_from_json[Enum-False]`
121
+ - `tests/test_types.py::test_str_to_upper[True-ABCDefG-ABCDEFG]`
122
+ - `tests/test_types.py::test_enum_successful`
123
+ - `tests/test_types.py::test_default_validators[float_check-1-1.01]`
124
+ - `tests/test_types.py::test_deque_fails[int-value2-expected_error2]`
125
+ - `tests/test_types.py::test_default_validators[uuid_check-123-ValidationError]`
126
+ - `tests/test_types.py::test_default_validators[date_check-1493942400-result111]`
127
+ - `tests/test_types.py::test_infinite_iterable_int`
128
+ - `tests/test_types.py::test_default_validators[datetime_check-value121-result121]`
129
+ - `tests/test_types.py::test_default_validators[str_check-xxxxxxxxxxx-ValidationError0]`
130
+ - `tests/test_types.py::test_default_validators[str_check-xxxxxxxxxxx-ValidationError1]`
131
+ - `tests/test_types.py::test_default_validators[datetime_check-1493979010000.0-result128]`
132
+ - `tests/test_types.py::test_default_validators[decimal_check-42.24-result99]`
133
+ - `tests/test_types.py::test_invalid_schema_constraints[kwargs8-type_8]`
134
+ - `tests/test_types.py::test_deque_generic_success[cls5-value5-result5]`
135
+ - `tests/test_types.py::test_is_hashable[pydantic_type13]`
136
+ - `tests/test_types.py::test_default_validators[bool_check-value48-ValidationError]`
137
+ - `tests/test_types.py::test_constrained_set_optional`
138
+ - `tests/test_types.py::test_list_fails[1231]`
139
+ - `tests/test_types.py::test_is_hashable[ByteSize]`
140
+ - `tests/test_types.py::test_decimal_validation[Field-type_args38-value38-result38]`
141
+ - `tests/test_types.py::test_is_hashable[pydantic_type31]`
142
+ - `tests/test_types.py::test_sequence_success[int-value0-result0]`
143
+ - `tests/test_types.py::test_pattern[Pattern]`
144
+ - `tests/test_types.py::test_int_enum_successful_for_str_int`
145
+ - `tests/test_types.py::test_default_validators[bool_check-off-False]`
146
+ - `tests/test_types.py::test_default_validators[bool_check-NO-False]`
147
+ - `tests/test_types.py::test_default_validators[float_check-1-1.00]`
148
+ - `tests/test_types.py::test_default_validators[bool_check-on-True]`
149
+ - `tests/test_types.py::test_enum_fails`
150
+ - `tests/test_types.py::test_decimal_strict`
151
+ - `tests/test_types.py::test_bytesize_to`
152
+ - `tests/test_types.py::test_number_multiple_of_float_invalid[1.27]`
153
+ - `tests/test_types.py::test_default_validators[bool_check-T-True]`
154
+ - `tests/test_types.py::test_default_validators[int_check-value74-1]`
155
+ - `tests/test_types.py::test_bytesize_conversions[1.0-1-1B-1B]`
156
+ - `tests/test_types.py::test_bytesize_conversions[1-1-1B-1B]`
157
+ - `tests/test_types.py::test_strict_timedelta`
158
+ - `tests/test_types.py::test_tuple_variable_len_success[<genexpr>-int-result2]`
159
+ - `tests/test_types.py::test_decimal_validation[condecimal-type_args43-value43-result43]`
160
+ - `tests/test_types.py::test_number_le`
161
+ - `tests/test_types.py::test_default_union_class`
162
+ - `tests/test_types.py::test_default_validators[set_check-value172-result172]`
163
+ - `tests/test_types.py::test_decimal_validation[condecimal-type_args21-NaN-result21]`
164
+ - `tests/test_types.py::test_decimal_validation[Field-type_args14-value14-result14]`
165
+ - `tests/test_types.py::test_is_hashable[pydantic_type12]`
166
+ - `tests/test_types.py::test_list_success[<genexpr>-result2]`
167
+ - `tests/test_types.py::test_is_hashable[pydantic_type14]`
168
+ - `tests/test_types.py::test_directory_path_validation_fails[tests/test_t.py]`
169
+ - `tests/test_types.py::test_constrained_set_good`
170
+ - `tests/test_types.py::test_is_hashable[pydantic_type10]`
171
+ - `tests/test_types.py::test_default_validators[date_check-2017-5-5-ValidationError0]`
172
+ - `tests/test_types.py::test_is_hashable[conbytes]`
173
+ - `tests/test_types.py::test_is_hashable[confloat]`
174
+ - `tests/test_types.py::test_default_validators[bool_check-OFF-False]`
175
+ - `tests/test_types.py::test_default_validators[date_check-value119-ValidationError]`
176
+ - `tests/test_types.py::test_is_hashable[condecimal]`
177
+ - `tests/test_types.py::test_decimal_validation[Field-type_args41-value41-result41]`
178
+ - `tests/test_types.py::test_decimal_not_finite[-NaN-is_nan]`
179
+ - `tests/test_types.py::test_default_validators[int_check-12-121]`
180
+ - `tests/test_types.py::test_is_hashable[pydantic_type4]`
181
+ - `tests/test_types.py::test_conlist_wrong_type_default`
182
+ - `tests/test_types.py::test_default_validators[frozenset_check-value174-result174]`
183
+ - `tests/test_types.py::test_default_validators[bool_check-No-False]`
184
+ - `tests/test_types.py::test_decimal_validation[Field-type_args11-value11-result11]`
185
+ - `tests/test_types.py::test_frozenset_field_conversion[value0-result0]`
186
+ - `tests/test_types.py::test_decimal_validation[Field-type_args8-value8-result8]`
187
+ - `tests/test_types.py::test_list_success[value0-result0]`
188
+ - `tests/test_types.py::test_decimal_validation[condecimal-type_args20-value20-result20]`
189
+ - `tests/test_types.py::test_default_validators[bool_check-false-False]`
190
+ - `tests/test_types.py::test_default_validators[str_check-s-s1]`
191
+ - `tests/test_types.py::test_default_validators[time_check-value143-ValidationError]`
192
+ - `tests/test_types.py::test_finite_float_config`
193
+ - `tests/test_types.py::test_secretstr_idempotent`
194
+ - `tests/test_types.py::test_none[NoneType1]`
195
+ - `tests/test_types.py::test_tuple_success[value3-result3]`
196
+ - `tests/test_types.py::test_number_multiple_of_int_invalid[14]`
197
+ - `tests/test_types.py::test_decimal_validation[Field-type_args2-value2-result2]`
198
+ - `tests/test_types.py::test_new_type_fails`
199
+ - `tests/test_types.py::test_default_validators[bool_check-Y-True]`
200
+ - `tests/test_types.py::test_enum_from_json[IntEnum-True]`
201
+ - `tests/test_types.py::test_decimal_validation[Field-type_args0-value0-result0]`
202
+
203
+ ## Tests currently failing (should pass after your fix)
204
+ - `tests/test_types.py::test_path_validation_success[/test/path-result0]`
205
+ - `tests/test_types.py::test_path_like`
206
+ - `tests/test_types.py::test_path_validation_success[value1-result1]`
207
+ - `tests/test_types.py::test_path_like_strict`
208
+
209
+ Apply code changes directly inside `/testbed/repo` and use `pytest` to run any of the above test targets. Focus on making the failing tests succeed without regressing the existing passing suite.
tasks/swegym-1116/metadata.json ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": "SWE-Gym/SWE-Gym",
3
+ "split": "train",
4
+ "instance_id": "pydantic__pydantic-5589",
5
+ "repo": "pydantic/pydantic",
6
+ "base_commit": "2a7cb4f584e08680b65260d19b48a2c7ec574731",
7
+ "version": "2.03",
8
+ "pass_to_pass": [
9
+ "tests/test_types.py::test_finite_float_validation_error[inf]",
10
+ "tests/test_types.py::test_default_validators[date_check-value113-result113]",
11
+ "tests/test_types.py::test_default_validators[date_check-value106-result106]",
12
+ "tests/test_types.py::test_default_validators[datetime_check-value120-result120]",
13
+ "tests/test_types.py::test_none_literal",
14
+ "tests/test_types.py::test_default_validators[float_check-value84-1.0]",
15
+ "tests/test_types.py::test_default_validators[float_check-t-ValidationError0]",
16
+ "tests/test_types.py::test_is_hashable[ImportString]",
17
+ "tests/test_types.py::test_list_success[value3-result3]",
18
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args40-value40-result40]",
19
+ "tests/test_types.py::test_default_validators[date_check-2017-05-05-result108]",
20
+ "tests/test_types.py::test_default_validators[bool_check-F-False]",
21
+ "tests/test_types.py::test_invalid_schema_constraints[kwargs11-type_11]",
22
+ "tests/test_types.py::test_decimal_validation[Field-type_args15-value15-result15]",
23
+ "tests/test_types.py::test_default_validators[frozenset_check-value176-result176]",
24
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args38-value38-result38]",
25
+ "tests/test_types.py::test_default_validators[bytes_check-value68-ValidationError]",
26
+ "tests/test_types.py::test_directory_path_validation_success[tests-result0]",
27
+ "tests/test_types.py::test_enum_from_json[Enum-False]",
28
+ "tests/test_types.py::test_str_to_upper[True-ABCDefG-ABCDEFG]",
29
+ "tests/test_types.py::test_enum_successful",
30
+ "tests/test_types.py::test_default_validators[float_check-1-1.01]",
31
+ "tests/test_types.py::test_deque_fails[int-value2-expected_error2]",
32
+ "tests/test_types.py::test_default_validators[uuid_check-123-ValidationError]",
33
+ "tests/test_types.py::test_default_validators[date_check-1493942400-result111]",
34
+ "tests/test_types.py::test_infinite_iterable_int",
35
+ "tests/test_types.py::test_default_validators[datetime_check-value121-result121]",
36
+ "tests/test_types.py::test_default_validators[str_check-xxxxxxxxxxx-ValidationError0]",
37
+ "tests/test_types.py::test_default_validators[str_check-xxxxxxxxxxx-ValidationError1]",
38
+ "tests/test_types.py::test_default_validators[datetime_check-1493979010000.0-result128]",
39
+ "tests/test_types.py::test_default_validators[decimal_check-42.24-result99]",
40
+ "tests/test_types.py::test_invalid_schema_constraints[kwargs8-type_8]",
41
+ "tests/test_types.py::test_deque_generic_success[cls5-value5-result5]",
42
+ "tests/test_types.py::test_is_hashable[pydantic_type13]",
43
+ "tests/test_types.py::test_default_validators[bool_check-value48-ValidationError]",
44
+ "tests/test_types.py::test_constrained_set_optional",
45
+ "tests/test_types.py::test_list_fails[1231]",
46
+ "tests/test_types.py::test_is_hashable[ByteSize]",
47
+ "tests/test_types.py::test_decimal_validation[Field-type_args38-value38-result38]",
48
+ "tests/test_types.py::test_is_hashable[pydantic_type31]",
49
+ "tests/test_types.py::test_sequence_success[int-value0-result0]",
50
+ "tests/test_types.py::test_pattern[Pattern]",
51
+ "tests/test_types.py::test_int_enum_successful_for_str_int",
52
+ "tests/test_types.py::test_default_validators[bool_check-off-False]",
53
+ "tests/test_types.py::test_default_validators[bool_check-NO-False]",
54
+ "tests/test_types.py::test_default_validators[float_check-1-1.00]",
55
+ "tests/test_types.py::test_default_validators[bool_check-on-True]",
56
+ "tests/test_types.py::test_enum_fails",
57
+ "tests/test_types.py::test_decimal_strict",
58
+ "tests/test_types.py::test_bytesize_to",
59
+ "tests/test_types.py::test_number_multiple_of_float_invalid[1.27]",
60
+ "tests/test_types.py::test_default_validators[bool_check-T-True]",
61
+ "tests/test_types.py::test_default_validators[int_check-value74-1]",
62
+ "tests/test_types.py::test_bytesize_conversions[1.0-1-1B-1B]",
63
+ "tests/test_types.py::test_bytesize_conversions[1-1-1B-1B]",
64
+ "tests/test_types.py::test_strict_timedelta",
65
+ "tests/test_types.py::test_tuple_variable_len_success[<genexpr>-int-result2]",
66
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args43-value43-result43]",
67
+ "tests/test_types.py::test_number_le",
68
+ "tests/test_types.py::test_default_union_class",
69
+ "tests/test_types.py::test_default_validators[set_check-value172-result172]",
70
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args21-NaN-result21]",
71
+ "tests/test_types.py::test_decimal_validation[Field-type_args14-value14-result14]",
72
+ "tests/test_types.py::test_is_hashable[pydantic_type12]",
73
+ "tests/test_types.py::test_list_success[<genexpr>-result2]",
74
+ "tests/test_types.py::test_is_hashable[pydantic_type14]",
75
+ "tests/test_types.py::test_directory_path_validation_fails[tests/test_t.py]",
76
+ "tests/test_types.py::test_constrained_set_good",
77
+ "tests/test_types.py::test_is_hashable[pydantic_type10]",
78
+ "tests/test_types.py::test_default_validators[date_check-2017-5-5-ValidationError0]",
79
+ "tests/test_types.py::test_is_hashable[conbytes]",
80
+ "tests/test_types.py::test_is_hashable[confloat]",
81
+ "tests/test_types.py::test_default_validators[bool_check-OFF-False]",
82
+ "tests/test_types.py::test_default_validators[date_check-value119-ValidationError]",
83
+ "tests/test_types.py::test_is_hashable[condecimal]",
84
+ "tests/test_types.py::test_decimal_validation[Field-type_args41-value41-result41]",
85
+ "tests/test_types.py::test_decimal_not_finite[-NaN-is_nan]",
86
+ "tests/test_types.py::test_default_validators[int_check-12-121]",
87
+ "tests/test_types.py::test_is_hashable[pydantic_type4]",
88
+ "tests/test_types.py::test_conlist_wrong_type_default",
89
+ "tests/test_types.py::test_default_validators[frozenset_check-value174-result174]",
90
+ "tests/test_types.py::test_default_validators[bool_check-No-False]",
91
+ "tests/test_types.py::test_decimal_validation[Field-type_args11-value11-result11]",
92
+ "tests/test_types.py::test_frozenset_field_conversion[value0-result0]",
93
+ "tests/test_types.py::test_decimal_validation[Field-type_args8-value8-result8]",
94
+ "tests/test_types.py::test_list_success[value0-result0]",
95
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args20-value20-result20]",
96
+ "tests/test_types.py::test_default_validators[bool_check-false-False]",
97
+ "tests/test_types.py::test_default_validators[str_check-s-s1]",
98
+ "tests/test_types.py::test_default_validators[time_check-value143-ValidationError]",
99
+ "tests/test_types.py::test_finite_float_config",
100
+ "tests/test_types.py::test_secretstr_idempotent",
101
+ "tests/test_types.py::test_none[NoneType1]",
102
+ "tests/test_types.py::test_tuple_success[value3-result3]",
103
+ "tests/test_types.py::test_number_multiple_of_int_invalid[14]",
104
+ "tests/test_types.py::test_decimal_validation[Field-type_args2-value2-result2]",
105
+ "tests/test_types.py::test_new_type_fails",
106
+ "tests/test_types.py::test_default_validators[bool_check-Y-True]",
107
+ "tests/test_types.py::test_enum_from_json[IntEnum-True]",
108
+ "tests/test_types.py::test_decimal_validation[Field-type_args0-value0-result0]"
109
+ ],
110
+ "fail_to_pass": [
111
+ "tests/test_types.py::test_path_validation_success[/test/path-result0]",
112
+ "tests/test_types.py::test_path_like",
113
+ "tests/test_types.py::test_path_validation_success[value1-result1]",
114
+ "tests/test_types.py::test_path_like_strict"
115
+ ],
116
+ "created_at": "2023-04-25T22:06:20Z"
117
+ }
tasks/swegym-1116/provided-gold.diff ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/pydantic/_internal/_std_types_schema.py b/pydantic/_internal/_std_types_schema.py
2
+ --- a/pydantic/_internal/_std_types_schema.py
3
+ +++ b/pydantic/_internal/_std_types_schema.py
4
+ @@ -12,6 +12,7 @@
5
+ from decimal import Decimal
6
+ from enum import Enum
7
+ from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network
8
+ +from os import PathLike
9
+ from pathlib import PurePath
10
+ from typing import Any, Callable
11
+ from uuid import UUID
12
+ @@ -203,31 +204,32 @@ def uuid_schema(_schema_generator: GenerateSchema, uuid_type: type[UUID]) -> cor
13
+
14
+
15
+ @schema_function(PurePath)
16
+ -def path_schema(_schema_generator: GenerateSchema, path_type: type[PurePath]) -> core_schema.LaxOrStrictSchema:
17
+ +@schema_function(PathLike)
18
+ +def path_schema(_schema_generator: GenerateSchema, path_type: type[PathLike]) -> core_schema.LaxOrStrictSchema:
19
+ + construct_path = PurePath if path_type is PathLike else path_type
20
+ metadata = build_metadata_dict(js_functions=[lambda _c, _h: {'type': 'string', 'format': 'path'}])
21
+ - # TODO, is this actually faster than `function_after(...)` as above?
22
+ - lax = core_schema.union_schema(
23
+ - [
24
+ - core_schema.is_instance_schema(path_type, json_types={'str'}, metadata=metadata),
25
+ - core_schema.general_after_validator_function(
26
+ - _validators.path_validator,
27
+ - core_schema.str_schema(),
28
+ - metadata=metadata,
29
+ - ),
30
+ - ],
31
+ - custom_error_type='path_type',
32
+ - custom_error_message='Input is not a valid path',
33
+ - strict=True,
34
+ - )
35
+ +
36
+ + def path_validator(__input_value: str) -> PathLike:
37
+ + try:
38
+ + return construct_path(__input_value) # type: ignore
39
+ + except TypeError as e:
40
+ + raise PydanticCustomError('path_type', 'Input is not a valid path') from e
41
+ +
42
+ + instance_schema = core_schema.is_instance_schema(path_type, json_types={'str'}, json_function=path_validator)
43
+
44
+ return core_schema.lax_or_strict_schema(
45
+ - lax_schema=lax,
46
+ - strict_schema=core_schema.general_after_validator_function(
47
+ - lambda x, _: path_type(x),
48
+ - core_schema.is_instance_schema(path_type, json_types={'str'}),
49
+ - serialization=core_schema.to_string_ser_schema(),
50
+ - metadata=metadata,
51
+ + lax_schema=core_schema.union_schema(
52
+ + [
53
+ + instance_schema,
54
+ + core_schema.no_info_after_validator_function(path_validator, core_schema.str_schema()),
55
+ + ],
56
+ + custom_error_type='path_type',
57
+ + custom_error_message='Input is not a valid path',
58
+ + strict=True,
59
+ ),
60
+ + strict_schema=instance_schema,
61
+ + serialization=core_schema.to_string_ser_schema(),
62
+ + metadata=metadata,
63
+ )
64
+
65
+
66
+ diff --git a/pydantic/_internal/_validators.py b/pydantic/_internal/_validators.py
67
+ --- a/pydantic/_internal/_validators.py
68
+ +++ b/pydantic/_internal/_validators.py
69
+ @@ -11,7 +11,6 @@
70
+ from collections import OrderedDict, defaultdict, deque
71
+ from decimal import Decimal, DecimalException
72
+ from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network
73
+ -from pathlib import Path
74
+ from typing import Any
75
+ from uuid import UUID
76
+
77
+ @@ -272,13 +271,6 @@ def uuid_validator(__input_value: str | bytes, _: core_schema.ValidationInfo) ->
78
+ raise PydanticCustomError('uuid_parsing', 'Input should be a valid UUID, unable to parse string as an UUID')
79
+
80
+
81
+ -def path_validator(__input_value: str, _: core_schema.ValidationInfo) -> Path:
82
+ - try:
83
+ - return Path(__input_value)
84
+ - except TypeError:
85
+ - raise PydanticCustomError('path_type', 'Input is not a valid path')
86
+ -
87
+ -
88
+ def pattern_either_validator(__input_value: Any, _: core_schema.ValidationInfo) -> typing.Pattern[Any]:
89
+ if isinstance(__input_value, typing.Pattern):
90
+ return __input_value # type: ignore
tasks/swegym-1116/solution/solve.sh ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -Eeuo pipefail
3
+
4
+ # --- Environment setup ---
5
+ source /opt/miniconda3/bin/activate
6
+ conda activate testbed
7
+ cd /testbed
8
+ if [ ! -d "repo" ]; then
9
+ git clone https://github.com/pydantic/pydantic.git repo
10
+ fi
11
+ cd repo
12
+ git checkout 2a7cb4f584e08680b65260d19b48a2c7ec574731
13
+ # --- End environment setup ---
14
+
15
+ patch_file="$(mktemp /tmp/swegym-test-patch-XXXX.diff)"
16
+ cat <<'PATCH_EOF' > "$patch_file"
17
+ diff --git a/tests/test_types.py b/tests/test_types.py
18
+ --- a/tests/test_types.py
19
+ +++ b/tests/test_types.py
20
+ @@ -1,4 +1,5 @@
21
+ import itertools
22
+ +import json
23
+ import math
24
+ import os
25
+ import re
26
+ @@ -2914,6 +2915,42 @@ class Model(BaseModel):
27
+ foo: Path
28
+
29
+ assert Model(foo=value).foo == result
30
+ + assert Model.model_validate_json(json.dumps({'foo': str(value)})).foo == result
31
+ +
32
+ +
33
+ +def test_path_like():
34
+ + class Model(BaseModel):
35
+ + foo: os.PathLike
36
+ +
37
+ + assert Model(foo='/foo/bar').foo == Path('/foo/bar')
38
+ + assert Model(foo=Path('/foo/bar')).foo == Path('/foo/bar')
39
+ + assert Model.model_validate_json('{"foo": "abc"}').foo == Path('abc')
40
+ + # insert_assert(Model.model_json_schema())
41
+ + assert Model.model_json_schema() == {
42
+ + 'type': 'object',
43
+ + 'properties': {'foo': {'type': 'string', 'format': 'path', 'title': 'Foo'}},
44
+ + 'required': ['foo'],
45
+ + 'title': 'Model',
46
+ + }
47
+ +
48
+ +
49
+ +def test_path_like_strict():
50
+ + class Model(BaseModel):
51
+ + model_config = dict(strict=True)
52
+ +
53
+ + foo: os.PathLike
54
+ +
55
+ + with pytest.raises(ValidationError, match='Input should be an instance of PathLike'):
56
+ + Model(foo='/foo/bar')
57
+ + assert Model(foo=Path('/foo/bar')).foo == Path('/foo/bar')
58
+ + assert Model.model_validate_json('{"foo": "abc"}').foo == Path('abc')
59
+ + # insert_assert(Model.model_json_schema())
60
+ + assert Model.model_json_schema() == {
61
+ + 'type': 'object',
62
+ + 'properties': {'foo': {'type': 'string', 'format': 'path', 'title': 'Foo'}},
63
+ + 'required': ['foo'],
64
+ + 'title': 'Model',
65
+ + }
66
+
67
+
68
+ def test_path_validation_fails():
69
+ PATCH_EOF
70
+
71
+ git apply --whitespace=nowarn --apply "$patch_file"
72
+
73
+ patch_file2="$(mktemp /tmp/swegym-solution-patch-XXXX.diff)"
74
+ cat <<'SOLUTION_PATCH_EOF' > "$patch_file2"
75
+ diff --git a/pydantic/_internal/_std_types_schema.py b/pydantic/_internal/_std_types_schema.py
76
+ --- a/pydantic/_internal/_std_types_schema.py
77
+ +++ b/pydantic/_internal/_std_types_schema.py
78
+ @@ -12,6 +12,7 @@
79
+ from decimal import Decimal
80
+ from enum import Enum
81
+ from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network
82
+ +from os import PathLike
83
+ from pathlib import PurePath
84
+ from typing import Any, Callable
85
+ from uuid import UUID
86
+ @@ -203,31 +204,32 @@ def uuid_schema(_schema_generator: GenerateSchema, uuid_type: type[UUID]) -> cor
87
+
88
+
89
+ @schema_function(PurePath)
90
+ -def path_schema(_schema_generator: GenerateSchema, path_type: type[PurePath]) -> core_schema.LaxOrStrictSchema:
91
+ +@schema_function(PathLike)
92
+ +def path_schema(_schema_generator: GenerateSchema, path_type: type[PathLike]) -> core_schema.LaxOrStrictSchema:
93
+ + construct_path = PurePath if path_type is PathLike else path_type
94
+ metadata = build_metadata_dict(js_functions=[lambda _c, _h: {'type': 'string', 'format': 'path'}])
95
+ - # TODO, is this actually faster than `function_after(...)` as above?
96
+ - lax = core_schema.union_schema(
97
+ - [
98
+ - core_schema.is_instance_schema(path_type, json_types={'str'}, metadata=metadata),
99
+ - core_schema.general_after_validator_function(
100
+ - _validators.path_validator,
101
+ - core_schema.str_schema(),
102
+ - metadata=metadata,
103
+ - ),
104
+ - ],
105
+ - custom_error_type='path_type',
106
+ - custom_error_message='Input is not a valid path',
107
+ - strict=True,
108
+ - )
109
+ +
110
+ + def path_validator(__input_value: str) -> PathLike:
111
+ + try:
112
+ + return construct_path(__input_value) # type: ignore
113
+ + except TypeError as e:
114
+ + raise PydanticCustomError('path_type', 'Input is not a valid path') from e
115
+ +
116
+ + instance_schema = core_schema.is_instance_schema(path_type, json_types={'str'}, json_function=path_validator)
117
+
118
+ return core_schema.lax_or_strict_schema(
119
+ - lax_schema=lax,
120
+ - strict_schema=core_schema.general_after_validator_function(
121
+ - lambda x, _: path_type(x),
122
+ - core_schema.is_instance_schema(path_type, json_types={'str'}),
123
+ - serialization=core_schema.to_string_ser_schema(),
124
+ - metadata=metadata,
125
+ + lax_schema=core_schema.union_schema(
126
+ + [
127
+ + instance_schema,
128
+ + core_schema.no_info_after_validator_function(path_validator, core_schema.str_schema()),
129
+ + ],
130
+ + custom_error_type='path_type',
131
+ + custom_error_message='Input is not a valid path',
132
+ + strict=True,
133
+ ),
134
+ + strict_schema=instance_schema,
135
+ + serialization=core_schema.to_string_ser_schema(),
136
+ + metadata=metadata,
137
+ )
138
+
139
+
140
+ diff --git a/pydantic/_internal/_validators.py b/pydantic/_internal/_validators.py
141
+ --- a/pydantic/_internal/_validators.py
142
+ +++ b/pydantic/_internal/_validators.py
143
+ @@ -11,7 +11,6 @@
144
+ from collections import OrderedDict, defaultdict, deque
145
+ from decimal import Decimal, DecimalException
146
+ from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network
147
+ -from pathlib import Path
148
+ from typing import Any
149
+ from uuid import UUID
150
+
151
+ @@ -272,13 +271,6 @@ def uuid_validator(__input_value: str | bytes, _: core_schema.ValidationInfo) ->
152
+ raise PydanticCustomError('uuid_parsing', 'Input should be a valid UUID, unable to parse string as an UUID')
153
+
154
+
155
+ -def path_validator(__input_value: str, _: core_schema.ValidationInfo) -> Path:
156
+ - try:
157
+ - return Path(__input_value)
158
+ - except TypeError:
159
+ - raise PydanticCustomError('path_type', 'Input is not a valid path')
160
+ -
161
+ -
162
+ def pattern_either_validator(__input_value: Any, _: core_schema.ValidationInfo) -> typing.Pattern[Any]:
163
+ if isinstance(__input_value, typing.Pattern):
164
+ return __input_value # type: ignore
165
+ SOLUTION_PATCH_EOF
166
+
167
+ git apply --whitespace=nowarn --apply "$patch_file2"
tasks/swegym-1116/task.toml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version = "1.0"
2
+
3
+ [agent]
4
+ timeout_sec = 1800.0
5
+
6
+ [metadata]
7
+ author_name = "OT-Agent + OpenHands"
8
+ author_email = "bf996@nyu.edu"
9
+ difficulty = "medium"
10
+ category = "bugfix"
11
+ tags = [
12
+ "swe",
13
+ "bugfix",
14
+ ]
15
+
16
+ [verifier]
17
+ restart_environment = false
18
+ timeout_sec = 600.0
tasks/swegym-1116/tests/check_pytest.py ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Distinguish real pytest failures from missing/setup/verifier evidence."""
2
+
3
+ import argparse
4
+ import json
5
+ import re
6
+ import xml.etree.ElementTree as ET
7
+ from pathlib import Path
8
+
9
+
10
+ def matches(case, target):
11
+ parts = target.split("::")
12
+ module = parts[0].removesuffix(".py").replace("/", ".")
13
+ classname = case.get("classname", "")
14
+ name = case.get("name", "")
15
+ if not (classname == module or classname.startswith(module + ".")):
16
+ return False
17
+ selector = parts[-1] if len(parts) > 1 else ""
18
+ classes = parts[1:-1]
19
+ if classes and classname != module + "." + ".".join(classes):
20
+ return False
21
+ return (
22
+ not selector
23
+ or name == selector
24
+ or ("[" not in selector and name.startswith(selector + "["))
25
+ )
26
+
27
+
28
+ def assess(root, expected, native_exit):
29
+ all_cases = []
30
+ actual_failure = False
31
+ for group in ("pass-to-pass", "fail-to-pass"):
32
+ path = Path(root) / (group + ".xml")
33
+ if not path.exists():
34
+ if actual_failure:
35
+ continue
36
+ raise ValueError("Missing preceding pytest panel")
37
+ if actual_failure:
38
+ raise ValueError(
39
+ "Pytest evidence continued after the native stop-on-failure"
40
+ )
41
+ raw = path.read_bytes()
42
+ if not 0 < len(raw) <= 4 * 1024**2 or re.search(
43
+ rb"<!\s*(?:DOCTYPE|ENTITY)", raw, re.I
44
+ ):
45
+ raise ValueError("Unbounded or unsafe pytest XML")
46
+ tree = ET.fromstring(raw)
47
+ cases = list(tree.iter("testcase"))
48
+ if len(cases) > 20000:
49
+ raise ValueError("Too many pytest cases")
50
+ identities = [(c.get("classname"), c.get("name")) for c in cases]
51
+ if len(identities) != len(set(identities)):
52
+ raise ValueError("Duplicate pytest case evidence")
53
+ targets = expected[group]
54
+ if any(not any(matches(case, t) for t in targets) for case in cases):
55
+ raise ValueError("Unexpected pytest case")
56
+ all_cases.extend(cases)
57
+ failures = [c for c in cases if c.find("failure") is not None]
58
+ if any(
59
+ c.find("error") is not None or c.find("skipped") is not None for c in cases
60
+ ):
61
+ raise ValueError("Pytest collection/error/skip is not a completed panel")
62
+ actual_failure = actual_failure or bool(failures)
63
+ if not failures and any(
64
+ not any(matches(case, t) for case in cases) for t in targets
65
+ ):
66
+ raise ValueError("Declared pytest target never ran")
67
+ if actual_failure:
68
+ if native_exit == 0:
69
+ raise ValueError("Native verifier exit disagrees with pytest failure")
70
+ return {"reward": 0, "valid_test_failure": True, "cases": len(all_cases)}
71
+ if native_exit != 0:
72
+ raise ValueError("Setup or native verifier failed without a real test failure")
73
+ for group in ("pass-to-pass", "fail-to-pass"):
74
+ if not (Path(root) / (group + ".xml")).is_file():
75
+ raise ValueError("Missing completed pytest panel")
76
+ return {"reward": 1, "valid_test_failure": False, "cases": len(all_cases)}
77
+
78
+
79
+ if __name__ == "__main__":
80
+ p = argparse.ArgumentParser()
81
+ p.add_argument("--root", required=True)
82
+ p.add_argument("--expected", required=True)
83
+ p.add_argument("--native-exit", type=int, required=True)
84
+ a = p.parse_args()
85
+ result = assess(a.root, json.loads(Path(a.expected).read_text()), a.native_exit)
86
+ reward = Path(a.root) / "reward.txt"
87
+ if reward.read_text().strip() != str(result["reward"]):
88
+ raise ValueError("Native raw reward disagrees with pytest evidence")
89
+ (Path(a.root) / "pytest-evidence.json").write_text(
90
+ json.dumps(result, sort_keys=True) + "\n"
91
+ )
tasks/swegym-1116/tests/config.json ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "instance_id": "pydantic__pydantic-5589",
3
+ "repo": "pydantic/pydantic",
4
+ "base_commit": "2a7cb4f584e08680b65260d19b48a2c7ec574731",
5
+ "version": "2.03",
6
+ "pass_to_pass": [
7
+ "tests/test_types.py::test_finite_float_validation_error[inf]",
8
+ "tests/test_types.py::test_default_validators[date_check-value113-result113]",
9
+ "tests/test_types.py::test_default_validators[date_check-value106-result106]",
10
+ "tests/test_types.py::test_default_validators[datetime_check-value120-result120]",
11
+ "tests/test_types.py::test_none_literal",
12
+ "tests/test_types.py::test_default_validators[float_check-value84-1.0]",
13
+ "tests/test_types.py::test_default_validators[float_check-t-ValidationError0]",
14
+ "tests/test_types.py::test_is_hashable[ImportString]",
15
+ "tests/test_types.py::test_list_success[value3-result3]",
16
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args40-value40-result40]",
17
+ "tests/test_types.py::test_default_validators[date_check-2017-05-05-result108]",
18
+ "tests/test_types.py::test_default_validators[bool_check-F-False]",
19
+ "tests/test_types.py::test_invalid_schema_constraints[kwargs11-type_11]",
20
+ "tests/test_types.py::test_decimal_validation[Field-type_args15-value15-result15]",
21
+ "tests/test_types.py::test_default_validators[frozenset_check-value176-result176]",
22
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args38-value38-result38]",
23
+ "tests/test_types.py::test_default_validators[bytes_check-value68-ValidationError]",
24
+ "tests/test_types.py::test_directory_path_validation_success[tests-result0]",
25
+ "tests/test_types.py::test_enum_from_json[Enum-False]",
26
+ "tests/test_types.py::test_str_to_upper[True-ABCDefG-ABCDEFG]",
27
+ "tests/test_types.py::test_enum_successful",
28
+ "tests/test_types.py::test_default_validators[float_check-1-1.01]",
29
+ "tests/test_types.py::test_deque_fails[int-value2-expected_error2]",
30
+ "tests/test_types.py::test_default_validators[uuid_check-123-ValidationError]",
31
+ "tests/test_types.py::test_default_validators[date_check-1493942400-result111]",
32
+ "tests/test_types.py::test_infinite_iterable_int",
33
+ "tests/test_types.py::test_default_validators[datetime_check-value121-result121]",
34
+ "tests/test_types.py::test_default_validators[str_check-xxxxxxxxxxx-ValidationError0]",
35
+ "tests/test_types.py::test_default_validators[str_check-xxxxxxxxxxx-ValidationError1]",
36
+ "tests/test_types.py::test_default_validators[datetime_check-1493979010000.0-result128]",
37
+ "tests/test_types.py::test_default_validators[decimal_check-42.24-result99]",
38
+ "tests/test_types.py::test_invalid_schema_constraints[kwargs8-type_8]",
39
+ "tests/test_types.py::test_deque_generic_success[cls5-value5-result5]",
40
+ "tests/test_types.py::test_is_hashable[pydantic_type13]",
41
+ "tests/test_types.py::test_default_validators[bool_check-value48-ValidationError]",
42
+ "tests/test_types.py::test_constrained_set_optional",
43
+ "tests/test_types.py::test_list_fails[1231]",
44
+ "tests/test_types.py::test_is_hashable[ByteSize]",
45
+ "tests/test_types.py::test_decimal_validation[Field-type_args38-value38-result38]",
46
+ "tests/test_types.py::test_is_hashable[pydantic_type31]",
47
+ "tests/test_types.py::test_sequence_success[int-value0-result0]",
48
+ "tests/test_types.py::test_pattern[Pattern]",
49
+ "tests/test_types.py::test_int_enum_successful_for_str_int",
50
+ "tests/test_types.py::test_default_validators[bool_check-off-False]",
51
+ "tests/test_types.py::test_default_validators[bool_check-NO-False]",
52
+ "tests/test_types.py::test_default_validators[float_check-1-1.00]",
53
+ "tests/test_types.py::test_default_validators[bool_check-on-True]",
54
+ "tests/test_types.py::test_enum_fails",
55
+ "tests/test_types.py::test_decimal_strict",
56
+ "tests/test_types.py::test_bytesize_to",
57
+ "tests/test_types.py::test_number_multiple_of_float_invalid[1.27]",
58
+ "tests/test_types.py::test_default_validators[bool_check-T-True]",
59
+ "tests/test_types.py::test_default_validators[int_check-value74-1]",
60
+ "tests/test_types.py::test_bytesize_conversions[1.0-1-1B-1B]",
61
+ "tests/test_types.py::test_bytesize_conversions[1-1-1B-1B]",
62
+ "tests/test_types.py::test_strict_timedelta",
63
+ "tests/test_types.py::test_tuple_variable_len_success[<genexpr>-int-result2]",
64
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args43-value43-result43]",
65
+ "tests/test_types.py::test_number_le",
66
+ "tests/test_types.py::test_default_union_class",
67
+ "tests/test_types.py::test_default_validators[set_check-value172-result172]",
68
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args21-NaN-result21]",
69
+ "tests/test_types.py::test_decimal_validation[Field-type_args14-value14-result14]",
70
+ "tests/test_types.py::test_is_hashable[pydantic_type12]",
71
+ "tests/test_types.py::test_list_success[<genexpr>-result2]",
72
+ "tests/test_types.py::test_is_hashable[pydantic_type14]",
73
+ "tests/test_types.py::test_directory_path_validation_fails[tests/test_t.py]",
74
+ "tests/test_types.py::test_constrained_set_good",
75
+ "tests/test_types.py::test_is_hashable[pydantic_type10]",
76
+ "tests/test_types.py::test_default_validators[date_check-2017-5-5-ValidationError0]",
77
+ "tests/test_types.py::test_is_hashable[conbytes]",
78
+ "tests/test_types.py::test_is_hashable[confloat]",
79
+ "tests/test_types.py::test_default_validators[bool_check-OFF-False]",
80
+ "tests/test_types.py::test_default_validators[date_check-value119-ValidationError]",
81
+ "tests/test_types.py::test_is_hashable[condecimal]",
82
+ "tests/test_types.py::test_decimal_validation[Field-type_args41-value41-result41]",
83
+ "tests/test_types.py::test_decimal_not_finite[-NaN-is_nan]",
84
+ "tests/test_types.py::test_default_validators[int_check-12-121]",
85
+ "tests/test_types.py::test_is_hashable[pydantic_type4]",
86
+ "tests/test_types.py::test_conlist_wrong_type_default",
87
+ "tests/test_types.py::test_default_validators[frozenset_check-value174-result174]",
88
+ "tests/test_types.py::test_default_validators[bool_check-No-False]",
89
+ "tests/test_types.py::test_decimal_validation[Field-type_args11-value11-result11]",
90
+ "tests/test_types.py::test_frozenset_field_conversion[value0-result0]",
91
+ "tests/test_types.py::test_decimal_validation[Field-type_args8-value8-result8]",
92
+ "tests/test_types.py::test_list_success[value0-result0]",
93
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args20-value20-result20]",
94
+ "tests/test_types.py::test_default_validators[bool_check-false-False]",
95
+ "tests/test_types.py::test_default_validators[str_check-s-s1]",
96
+ "tests/test_types.py::test_default_validators[time_check-value143-ValidationError]",
97
+ "tests/test_types.py::test_finite_float_config",
98
+ "tests/test_types.py::test_secretstr_idempotent",
99
+ "tests/test_types.py::test_none[NoneType1]",
100
+ "tests/test_types.py::test_tuple_success[value3-result3]",
101
+ "tests/test_types.py::test_number_multiple_of_int_invalid[14]",
102
+ "tests/test_types.py::test_decimal_validation[Field-type_args2-value2-result2]",
103
+ "tests/test_types.py::test_new_type_fails",
104
+ "tests/test_types.py::test_default_validators[bool_check-Y-True]",
105
+ "tests/test_types.py::test_enum_from_json[IntEnum-True]",
106
+ "tests/test_types.py::test_decimal_validation[Field-type_args0-value0-result0]"
107
+ ],
108
+ "fail_to_pass": [
109
+ "tests/test_types.py::test_path_validation_success[/test/path-result0]",
110
+ "tests/test_types.py::test_path_like",
111
+ "tests/test_types.py::test_path_validation_success[value1-result1]",
112
+ "tests/test_types.py::test_path_like_strict"
113
+ ],
114
+ "patch": "diff --git a/pydantic/_internal/_std_types_schema.py b/pydantic/_internal/_std_types_schema.py\n--- a/pydantic/_internal/_std_types_schema.py\n+++ b/pydantic/_internal/_std_types_schema.py\n@@ -12,6 +12,7 @@\n from decimal import Decimal\n from enum import Enum\n from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network\n+from os import PathLike\n from pathlib import PurePath\n from typing import Any, Callable\n from uuid import UUID\n@@ -203,31 +204,32 @@ def uuid_schema(_schema_generator: GenerateSchema, uuid_type: type[UUID]) -> cor\n \n \n @schema_function(PurePath)\n-def path_schema(_schema_generator: GenerateSchema, path_type: type[PurePath]) -> core_schema.LaxOrStrictSchema:\n+@schema_function(PathLike)\n+def path_schema(_schema_generator: GenerateSchema, path_type: type[PathLike]) -> core_schema.LaxOrStrictSchema:\n+ construct_path = PurePath if path_type is PathLike else path_type\n metadata = build_metadata_dict(js_functions=[lambda _c, _h: {'type': 'string', 'format': 'path'}])\n- # TODO, is this actually faster than `function_after(...)` as above?\n- lax = core_schema.union_schema(\n- [\n- core_schema.is_instance_schema(path_type, json_types={'str'}, metadata=metadata),\n- core_schema.general_after_validator_function(\n- _validators.path_validator,\n- core_schema.str_schema(),\n- metadata=metadata,\n- ),\n- ],\n- custom_error_type='path_type',\n- custom_error_message='Input is not a valid path',\n- strict=True,\n- )\n+\n+ def path_validator(__input_value: str) -> PathLike:\n+ try:\n+ return construct_path(__input_value) # type: ignore\n+ except TypeError as e:\n+ raise PydanticCustomError('path_type', 'Input is not a valid path') from e\n+\n+ instance_schema = core_schema.is_instance_schema(path_type, json_types={'str'}, json_function=path_validator)\n \n return core_schema.lax_or_strict_schema(\n- lax_schema=lax,\n- strict_schema=core_schema.general_after_validator_function(\n- lambda x, _: path_type(x),\n- core_schema.is_instance_schema(path_type, json_types={'str'}),\n- serialization=core_schema.to_string_ser_schema(),\n- metadata=metadata,\n+ lax_schema=core_schema.union_schema(\n+ [\n+ instance_schema,\n+ core_schema.no_info_after_validator_function(path_validator, core_schema.str_schema()),\n+ ],\n+ custom_error_type='path_type',\n+ custom_error_message='Input is not a valid path',\n+ strict=True,\n ),\n+ strict_schema=instance_schema,\n+ serialization=core_schema.to_string_ser_schema(),\n+ metadata=metadata,\n )\n \n \ndiff --git a/pydantic/_internal/_validators.py b/pydantic/_internal/_validators.py\n--- a/pydantic/_internal/_validators.py\n+++ b/pydantic/_internal/_validators.py\n@@ -11,7 +11,6 @@\n from collections import OrderedDict, defaultdict, deque\n from decimal import Decimal, DecimalException\n from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network\n-from pathlib import Path\n from typing import Any\n from uuid import UUID\n \n@@ -272,13 +271,6 @@ def uuid_validator(__input_value: str | bytes, _: core_schema.ValidationInfo) ->\n raise PydanticCustomError('uuid_parsing', 'Input should be a valid UUID, unable to parse string as an UUID')\n \n \n-def path_validator(__input_value: str, _: core_schema.ValidationInfo) -> Path:\n- try:\n- return Path(__input_value)\n- except TypeError:\n- raise PydanticCustomError('path_type', 'Input is not a valid path')\n-\n-\n def pattern_either_validator(__input_value: Any, _: core_schema.ValidationInfo) -> typing.Pattern[Any]:\n if isinstance(__input_value, typing.Pattern):\n return __input_value # type: ignore\n",
115
+ "test_patch_length": 1637
116
+ }
tasks/swegym-1116/tests/expected-panels.json ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fail-to-pass": [
3
+ "tests/test_types.py::test_path_validation_success[/test/path-result0]",
4
+ "tests/test_types.py::test_path_like",
5
+ "tests/test_types.py::test_path_validation_success[value1-result1]",
6
+ "tests/test_types.py::test_path_like_strict"
7
+ ],
8
+ "pass-to-pass": [
9
+ "tests/test_types.py::test_finite_float_validation_error[inf]",
10
+ "tests/test_types.py::test_default_validators[date_check-value113-result113]",
11
+ "tests/test_types.py::test_default_validators[date_check-value106-result106]",
12
+ "tests/test_types.py::test_default_validators[datetime_check-value120-result120]",
13
+ "tests/test_types.py::test_none_literal",
14
+ "tests/test_types.py::test_default_validators[float_check-value84-1.0]",
15
+ "tests/test_types.py::test_default_validators[float_check-t-ValidationError0]",
16
+ "tests/test_types.py::test_is_hashable[ImportString]",
17
+ "tests/test_types.py::test_list_success[value3-result3]",
18
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args40-value40-result40]",
19
+ "tests/test_types.py::test_default_validators[date_check-2017-05-05-result108]",
20
+ "tests/test_types.py::test_default_validators[bool_check-F-False]",
21
+ "tests/test_types.py::test_invalid_schema_constraints[kwargs11-type_11]",
22
+ "tests/test_types.py::test_decimal_validation[Field-type_args15-value15-result15]",
23
+ "tests/test_types.py::test_default_validators[frozenset_check-value176-result176]",
24
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args38-value38-result38]",
25
+ "tests/test_types.py::test_default_validators[bytes_check-value68-ValidationError]",
26
+ "tests/test_types.py::test_directory_path_validation_success[tests-result0]",
27
+ "tests/test_types.py::test_enum_from_json[Enum-False]",
28
+ "tests/test_types.py::test_str_to_upper[True-ABCDefG-ABCDEFG]",
29
+ "tests/test_types.py::test_enum_successful",
30
+ "tests/test_types.py::test_default_validators[float_check-1-1.01]",
31
+ "tests/test_types.py::test_deque_fails[int-value2-expected_error2]",
32
+ "tests/test_types.py::test_default_validators[uuid_check-123-ValidationError]",
33
+ "tests/test_types.py::test_default_validators[date_check-1493942400-result111]",
34
+ "tests/test_types.py::test_infinite_iterable_int",
35
+ "tests/test_types.py::test_default_validators[datetime_check-value121-result121]",
36
+ "tests/test_types.py::test_default_validators[str_check-xxxxxxxxxxx-ValidationError0]",
37
+ "tests/test_types.py::test_default_validators[str_check-xxxxxxxxxxx-ValidationError1]",
38
+ "tests/test_types.py::test_default_validators[datetime_check-1493979010000.0-result128]",
39
+ "tests/test_types.py::test_default_validators[decimal_check-42.24-result99]",
40
+ "tests/test_types.py::test_invalid_schema_constraints[kwargs8-type_8]",
41
+ "tests/test_types.py::test_deque_generic_success[cls5-value5-result5]",
42
+ "tests/test_types.py::test_is_hashable[pydantic_type13]",
43
+ "tests/test_types.py::test_default_validators[bool_check-value48-ValidationError]",
44
+ "tests/test_types.py::test_constrained_set_optional",
45
+ "tests/test_types.py::test_list_fails[1231]",
46
+ "tests/test_types.py::test_is_hashable[ByteSize]",
47
+ "tests/test_types.py::test_decimal_validation[Field-type_args38-value38-result38]",
48
+ "tests/test_types.py::test_is_hashable[pydantic_type31]",
49
+ "tests/test_types.py::test_sequence_success[int-value0-result0]",
50
+ "tests/test_types.py::test_pattern[Pattern]",
51
+ "tests/test_types.py::test_int_enum_successful_for_str_int",
52
+ "tests/test_types.py::test_default_validators[bool_check-off-False]",
53
+ "tests/test_types.py::test_default_validators[bool_check-NO-False]",
54
+ "tests/test_types.py::test_default_validators[float_check-1-1.00]",
55
+ "tests/test_types.py::test_default_validators[bool_check-on-True]",
56
+ "tests/test_types.py::test_enum_fails",
57
+ "tests/test_types.py::test_decimal_strict",
58
+ "tests/test_types.py::test_bytesize_to",
59
+ "tests/test_types.py::test_number_multiple_of_float_invalid[1.27]",
60
+ "tests/test_types.py::test_default_validators[bool_check-T-True]",
61
+ "tests/test_types.py::test_default_validators[int_check-value74-1]",
62
+ "tests/test_types.py::test_bytesize_conversions[1.0-1-1B-1B]",
63
+ "tests/test_types.py::test_bytesize_conversions[1-1-1B-1B]",
64
+ "tests/test_types.py::test_strict_timedelta",
65
+ "tests/test_types.py::test_tuple_variable_len_success[<genexpr>-int-result2]",
66
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args43-value43-result43]",
67
+ "tests/test_types.py::test_number_le",
68
+ "tests/test_types.py::test_default_union_class",
69
+ "tests/test_types.py::test_default_validators[set_check-value172-result172]",
70
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args21-NaN-result21]",
71
+ "tests/test_types.py::test_decimal_validation[Field-type_args14-value14-result14]",
72
+ "tests/test_types.py::test_is_hashable[pydantic_type12]",
73
+ "tests/test_types.py::test_list_success[<genexpr>-result2]",
74
+ "tests/test_types.py::test_is_hashable[pydantic_type14]",
75
+ "tests/test_types.py::test_directory_path_validation_fails[tests/test_t.py]",
76
+ "tests/test_types.py::test_constrained_set_good",
77
+ "tests/test_types.py::test_is_hashable[pydantic_type10]",
78
+ "tests/test_types.py::test_default_validators[date_check-2017-5-5-ValidationError0]",
79
+ "tests/test_types.py::test_is_hashable[conbytes]",
80
+ "tests/test_types.py::test_is_hashable[confloat]",
81
+ "tests/test_types.py::test_default_validators[bool_check-OFF-False]",
82
+ "tests/test_types.py::test_default_validators[date_check-value119-ValidationError]",
83
+ "tests/test_types.py::test_is_hashable[condecimal]",
84
+ "tests/test_types.py::test_decimal_validation[Field-type_args41-value41-result41]",
85
+ "tests/test_types.py::test_decimal_not_finite[-NaN-is_nan]",
86
+ "tests/test_types.py::test_default_validators[int_check-12-121]",
87
+ "tests/test_types.py::test_is_hashable[pydantic_type4]",
88
+ "tests/test_types.py::test_conlist_wrong_type_default",
89
+ "tests/test_types.py::test_default_validators[frozenset_check-value174-result174]",
90
+ "tests/test_types.py::test_default_validators[bool_check-No-False]",
91
+ "tests/test_types.py::test_decimal_validation[Field-type_args11-value11-result11]",
92
+ "tests/test_types.py::test_frozenset_field_conversion[value0-result0]",
93
+ "tests/test_types.py::test_decimal_validation[Field-type_args8-value8-result8]",
94
+ "tests/test_types.py::test_list_success[value0-result0]",
95
+ "tests/test_types.py::test_decimal_validation[condecimal-type_args20-value20-result20]",
96
+ "tests/test_types.py::test_default_validators[bool_check-false-False]",
97
+ "tests/test_types.py::test_default_validators[str_check-s-s1]",
98
+ "tests/test_types.py::test_default_validators[time_check-value143-ValidationError]",
99
+ "tests/test_types.py::test_finite_float_config",
100
+ "tests/test_types.py::test_secretstr_idempotent",
101
+ "tests/test_types.py::test_none[NoneType1]",
102
+ "tests/test_types.py::test_tuple_success[value3-result3]",
103
+ "tests/test_types.py::test_number_multiple_of_int_invalid[14]",
104
+ "tests/test_types.py::test_decimal_validation[Field-type_args2-value2-result2]",
105
+ "tests/test_types.py::test_new_type_fails",
106
+ "tests/test_types.py::test_default_validators[bool_check-Y-True]",
107
+ "tests/test_types.py::test_enum_from_json[IntEnum-True]",
108
+ "tests/test_types.py::test_decimal_validation[Field-type_args0-value0-result0]"
109
+ ]
110
+ }
tasks/swegym-1116/tests/install_trusted_test_patch.sh ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -Eeuo pipefail
3
+
4
+ repository=${1:?repository path is required}
5
+ patch_path=${2:?patch path is required}
6
+ trusted_commit=${3:?trusted commit is required}
7
+
8
+ exec bash /tests/install_trusted_test_paths.sh "$repository" "$trusted_commit" /tests/trusted_patch_paths.txt "$patch_path"
tasks/swegym-1116/tests/install_trusted_test_paths.sh ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -Eeuo pipefail
3
+
4
+ export GIT_CONFIG_GLOBAL=/dev/null
5
+ export GIT_CONFIG_NOSYSTEM=1
6
+ export GIT_NO_REPLACE_OBJECTS=1
7
+
8
+ repository=${1:?repository path is required}
9
+ trusted_commit=${2:?trusted commit is required}
10
+ manifest=${3:?path manifest is required}
11
+ patch_path=${4:-}
12
+ fallback_commit=${5:-}
13
+
14
+ cd "$repository"
15
+
16
+ trusted_git() {
17
+ command git -c safe.directory="$repository" -c core.hooksPath=/dev/null -c core.fsmonitor=false "$@"
18
+ }
19
+
20
+ trusted_git cat-file -e "${trusted_commit}^{commit}"
21
+
22
+ restore_path() {
23
+ path=$1
24
+ case "$path" in
25
+ ""|/*|.|..|../*|*/..|*/../*)
26
+ echo "Unsafe trusted-test path: $path" >&2
27
+ exit 1
28
+ ;;
29
+ esac
30
+ trusted_git clean -ffdx -- "$path"
31
+ rm -rf -- "$path"
32
+ if trusted_git cat-file -e "${trusted_commit}:${path}" 2>/dev/null; then
33
+ trusted_git archive --format=tar "$trusted_commit" -- "$path" | tar -xf - -C "$repository"
34
+ elif [ -n "$fallback_commit" ] && trusted_git cat-file -e "${fallback_commit}:${path}" 2>/dev/null; then
35
+ trusted_git archive --format=tar "$fallback_commit" -- "$path" | tar -xf - -C "$repository"
36
+ fi
37
+ }
38
+
39
+ is_test_control_path() {
40
+ path=$1
41
+ basename=${path##*/}
42
+ case "/$path/" in
43
+ */test/*|*/tests/*|*/testing/*|*/test-data/*|*/testdata/*|*/spec/*|*/specs/*|*/__tests__/*)
44
+ return 0
45
+ ;;
46
+ esac
47
+ case "$basename" in
48
+ conftest.py|pytest.ini|tox.ini|.coveragerc|jest.config.*|vitest.config.*|test_*|*_test.*|*.test.*|*.spec.*)
49
+ return 0
50
+ ;;
51
+ esac
52
+ return 1
53
+ }
54
+
55
+ # Reset changed and untracked test-control files before restoring the explicit
56
+ # task targets. Product-code changes remain untouched.
57
+ while IFS= read -r -d '' path; do
58
+ if is_test_control_path "$path"; then
59
+ restore_path "$path"
60
+ fi
61
+ done < <(
62
+ {
63
+ trusted_git diff --name-only -z "$trusted_commit"
64
+ trusted_git ls-files --others --exclude-standard -z
65
+ trusted_git ls-files --others --ignored --exclude-standard -z
66
+ } | sort -zu
67
+ )
68
+
69
+ # Index flags can hide working-tree edits from ordinary diff discovery.
70
+ while IFS= read -r -d '' record; do
71
+ flag=${record%% *}
72
+ path=${record#? }
73
+ case "$flag" in
74
+ [a-z]|S)
75
+ if is_test_control_path "$path"; then
76
+ restore_path "$path"
77
+ fi
78
+ ;;
79
+ esac
80
+ done < <(trusted_git ls-files -v -z)
81
+
82
+ while IFS= read -r path || [ -n "$path" ]; do
83
+ restore_path "$path"
84
+ done < "$manifest"
85
+
86
+ if [ -n "$patch_path" ] && [ -s "$patch_path" ]; then
87
+ trusted_git apply --check "$patch_path"
88
+ trusted_git apply --verbose "$patch_path"
89
+ fi
tasks/swegym-1116/tests/native-test-instrumented.sh ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -Eeuo pipefail
3
+
4
+ # --- Environment setup ---
5
+ source /opt/miniconda3/bin/activate
6
+ conda activate testbed
7
+ # --- End environment setup ---
8
+
9
+ REPO_DIR="/testbed/repo"
10
+ LOG_DIR="/logs"
11
+ VERIFIER_DIR="/logs/verifier"
12
+ LOG_FILE="$LOG_DIR/test_output.log"
13
+ REWARD_FILE="$VERIFIER_DIR/reward.txt"
14
+
15
+ mkdir -p "$LOG_DIR" "$VERIFIER_DIR"
16
+ : > "$LOG_FILE"
17
+ echo 0 > "$REWARD_FILE"
18
+
19
+ exec > >(tee -a "$LOG_FILE") 2>&1
20
+
21
+ on_error() {
22
+ echo "One or more tests failed." >&2
23
+ echo 0 > "$REWARD_FILE"
24
+ exit 1
25
+ }
26
+ trap on_error ERR
27
+
28
+ PASS_TESTS=(
29
+ 'tests/test_types.py::test_finite_float_validation_error[inf]'
30
+ 'tests/test_types.py::test_default_validators[date_check-value113-result113]'
31
+ 'tests/test_types.py::test_default_validators[date_check-value106-result106]'
32
+ 'tests/test_types.py::test_default_validators[datetime_check-value120-result120]'
33
+ 'tests/test_types.py::test_none_literal'
34
+ 'tests/test_types.py::test_default_validators[float_check-value84-1.0]'
35
+ 'tests/test_types.py::test_default_validators[float_check-t-ValidationError0]'
36
+ 'tests/test_types.py::test_is_hashable[ImportString]'
37
+ 'tests/test_types.py::test_list_success[value3-result3]'
38
+ 'tests/test_types.py::test_decimal_validation[condecimal-type_args40-value40-result40]'
39
+ 'tests/test_types.py::test_default_validators[date_check-2017-05-05-result108]'
40
+ 'tests/test_types.py::test_default_validators[bool_check-F-False]'
41
+ 'tests/test_types.py::test_invalid_schema_constraints[kwargs11-type_11]'
42
+ 'tests/test_types.py::test_decimal_validation[Field-type_args15-value15-result15]'
43
+ 'tests/test_types.py::test_default_validators[frozenset_check-value176-result176]'
44
+ 'tests/test_types.py::test_decimal_validation[condecimal-type_args38-value38-result38]'
45
+ 'tests/test_types.py::test_default_validators[bytes_check-value68-ValidationError]'
46
+ 'tests/test_types.py::test_directory_path_validation_success[tests-result0]'
47
+ 'tests/test_types.py::test_enum_from_json[Enum-False]'
48
+ 'tests/test_types.py::test_str_to_upper[True-ABCDefG-ABCDEFG]'
49
+ 'tests/test_types.py::test_enum_successful'
50
+ 'tests/test_types.py::test_default_validators[float_check-1-1.01]'
51
+ 'tests/test_types.py::test_deque_fails[int-value2-expected_error2]'
52
+ 'tests/test_types.py::test_default_validators[uuid_check-123-ValidationError]'
53
+ 'tests/test_types.py::test_default_validators[date_check-1493942400-result111]'
54
+ 'tests/test_types.py::test_infinite_iterable_int'
55
+ 'tests/test_types.py::test_default_validators[datetime_check-value121-result121]'
56
+ 'tests/test_types.py::test_default_validators[str_check-xxxxxxxxxxx-ValidationError0]'
57
+ 'tests/test_types.py::test_default_validators[str_check-xxxxxxxxxxx-ValidationError1]'
58
+ 'tests/test_types.py::test_default_validators[datetime_check-1493979010000.0-result128]'
59
+ 'tests/test_types.py::test_default_validators[decimal_check-42.24-result99]'
60
+ 'tests/test_types.py::test_invalid_schema_constraints[kwargs8-type_8]'
61
+ 'tests/test_types.py::test_deque_generic_success[cls5-value5-result5]'
62
+ 'tests/test_types.py::test_is_hashable[pydantic_type13]'
63
+ 'tests/test_types.py::test_default_validators[bool_check-value48-ValidationError]'
64
+ 'tests/test_types.py::test_constrained_set_optional'
65
+ 'tests/test_types.py::test_list_fails[1231]'
66
+ 'tests/test_types.py::test_is_hashable[ByteSize]'
67
+ 'tests/test_types.py::test_decimal_validation[Field-type_args38-value38-result38]'
68
+ 'tests/test_types.py::test_is_hashable[pydantic_type31]'
69
+ 'tests/test_types.py::test_sequence_success[int-value0-result0]'
70
+ 'tests/test_types.py::test_pattern[Pattern]'
71
+ 'tests/test_types.py::test_int_enum_successful_for_str_int'
72
+ 'tests/test_types.py::test_default_validators[bool_check-off-False]'
73
+ 'tests/test_types.py::test_default_validators[bool_check-NO-False]'
74
+ 'tests/test_types.py::test_default_validators[float_check-1-1.00]'
75
+ 'tests/test_types.py::test_default_validators[bool_check-on-True]'
76
+ 'tests/test_types.py::test_enum_fails'
77
+ 'tests/test_types.py::test_decimal_strict'
78
+ 'tests/test_types.py::test_bytesize_to'
79
+ 'tests/test_types.py::test_number_multiple_of_float_invalid[1.27]'
80
+ 'tests/test_types.py::test_default_validators[bool_check-T-True]'
81
+ 'tests/test_types.py::test_default_validators[int_check-value74-1]'
82
+ 'tests/test_types.py::test_bytesize_conversions[1.0-1-1B-1B]'
83
+ 'tests/test_types.py::test_bytesize_conversions[1-1-1B-1B]'
84
+ 'tests/test_types.py::test_strict_timedelta'
85
+ 'tests/test_types.py::test_tuple_variable_len_success[<genexpr>-int-result2]'
86
+ 'tests/test_types.py::test_decimal_validation[condecimal-type_args43-value43-result43]'
87
+ 'tests/test_types.py::test_number_le'
88
+ 'tests/test_types.py::test_default_union_class'
89
+ 'tests/test_types.py::test_default_validators[set_check-value172-result172]'
90
+ 'tests/test_types.py::test_decimal_validation[condecimal-type_args21-NaN-result21]'
91
+ 'tests/test_types.py::test_decimal_validation[Field-type_args14-value14-result14]'
92
+ 'tests/test_types.py::test_is_hashable[pydantic_type12]'
93
+ 'tests/test_types.py::test_list_success[<genexpr>-result2]'
94
+ 'tests/test_types.py::test_is_hashable[pydantic_type14]'
95
+ 'tests/test_types.py::test_directory_path_validation_fails[tests/test_t.py]'
96
+ 'tests/test_types.py::test_constrained_set_good'
97
+ 'tests/test_types.py::test_is_hashable[pydantic_type10]'
98
+ 'tests/test_types.py::test_default_validators[date_check-2017-5-5-ValidationError0]'
99
+ 'tests/test_types.py::test_is_hashable[conbytes]'
100
+ 'tests/test_types.py::test_is_hashable[confloat]'
101
+ 'tests/test_types.py::test_default_validators[bool_check-OFF-False]'
102
+ 'tests/test_types.py::test_default_validators[date_check-value119-ValidationError]'
103
+ 'tests/test_types.py::test_is_hashable[condecimal]'
104
+ 'tests/test_types.py::test_decimal_validation[Field-type_args41-value41-result41]'
105
+ 'tests/test_types.py::test_decimal_not_finite[-NaN-is_nan]'
106
+ 'tests/test_types.py::test_default_validators[int_check-12-121]'
107
+ 'tests/test_types.py::test_is_hashable[pydantic_type4]'
108
+ 'tests/test_types.py::test_conlist_wrong_type_default'
109
+ 'tests/test_types.py::test_default_validators[frozenset_check-value174-result174]'
110
+ 'tests/test_types.py::test_default_validators[bool_check-No-False]'
111
+ 'tests/test_types.py::test_decimal_validation[Field-type_args11-value11-result11]'
112
+ 'tests/test_types.py::test_frozenset_field_conversion[value0-result0]'
113
+ 'tests/test_types.py::test_decimal_validation[Field-type_args8-value8-result8]'
114
+ 'tests/test_types.py::test_list_success[value0-result0]'
115
+ 'tests/test_types.py::test_decimal_validation[condecimal-type_args20-value20-result20]'
116
+ 'tests/test_types.py::test_default_validators[bool_check-false-False]'
117
+ 'tests/test_types.py::test_default_validators[str_check-s-s1]'
118
+ 'tests/test_types.py::test_default_validators[time_check-value143-ValidationError]'
119
+ 'tests/test_types.py::test_finite_float_config'
120
+ 'tests/test_types.py::test_secretstr_idempotent'
121
+ 'tests/test_types.py::test_none[NoneType1]'
122
+ 'tests/test_types.py::test_tuple_success[value3-result3]'
123
+ 'tests/test_types.py::test_number_multiple_of_int_invalid[14]'
124
+ 'tests/test_types.py::test_decimal_validation[Field-type_args2-value2-result2]'
125
+ 'tests/test_types.py::test_new_type_fails'
126
+ 'tests/test_types.py::test_default_validators[bool_check-Y-True]'
127
+ 'tests/test_types.py::test_enum_from_json[IntEnum-True]'
128
+ 'tests/test_types.py::test_decimal_validation[Field-type_args0-value0-result0]'
129
+ )
130
+
131
+ FAIL_TESTS=(
132
+ 'tests/test_types.py::test_path_validation_success[/test/path-result0]'
133
+ 'tests/test_types.py::test_path_like'
134
+ 'tests/test_types.py::test_path_validation_success[value1-result1]'
135
+ 'tests/test_types.py::test_path_like_strict'
136
+ )
137
+
138
+ log() {
139
+ echo "[swegym] $*"
140
+ }
141
+
142
+ ensure_dependencies() {
143
+ log "Installing base Python tooling"
144
+
145
+ # PIP_CONSTRAINT cython<3 is scoped PER-REPO (legacy repos need it;
146
+ # it is fatal to the modern meson build used by pandas>=2.0/modin>=2.x).
147
+ echo "cython<3" > /tmp/constraint.txt
148
+ export PIP_CONSTRAINT=/tmp/constraint.txt
149
+
150
+ # Use prefer-binary to avoid building from source where possible (fixes PyYAML/Cython issues)
151
+ pip install --prefer-binary --upgrade pip setuptools wheel
152
+
153
+ # Generic dev/runtime deps install is gated per-repo (skipped for
154
+ # repos whose recipe installs explicitly, to avoid torch/CUDA disk
155
+ # overflow on the 10 GB cap).
156
+ if [ -f requirements-dev.txt ]; then
157
+ log "Installing requirements-dev.txt"
158
+ pip install --prefer-binary -r requirements-dev.txt || true
159
+ fi
160
+
161
+ if [ -f requirements.txt ]; then
162
+ log "Installing requirements.txt"
163
+ pip install --prefer-binary -r requirements.txt || true
164
+ fi
165
+
166
+ log "Running repo-specific install..."
167
+ pip install pdm && pdm install
168
+
169
+ # Fix 'sure' library bit-rot for Python 3.7+
170
+ # This replaces re._pattern_type with a compatible type check
171
+ SURE_OLD_PY=$(python3 -c "import sure, os; print(os.path.join(sure.__path__[0], 'old.py'))" 2>/dev/null || true)
172
+ if [ -f "$SURE_OLD_PY" ]; then
173
+ log "Patching 'sure' library for compatibility..."
174
+ sed -i 's/re._pattern_type/type(re.compile(""))/g' "$SURE_OLD_PY" || true
175
+ fi
176
+
177
+ pip install "pytest>=8.0.0" "pytest-xdist>=3.5.0" || true
178
+ }
179
+
180
+ run_test_group() {
181
+ local label="$1"
182
+ shift || true
183
+ local tests=()
184
+
185
+ for target in "$@"; do
186
+ if [ -z "$target" ] || [[ "$target" == "#"* ]]; then
187
+ continue
188
+ fi
189
+ tests+=("$target")
190
+ done
191
+
192
+ if [ "${#tests[@]}" -eq 0 ]; then
193
+ log "No ${label} tests to run"
194
+ return 0
195
+ fi
196
+
197
+ log "Running ${#tests[@]} ${label} tests in one pytest session"
198
+ if python3 -m pytest -q -x --override-ini=addopts= --junitxml="$VERIFIER_DIR/${label}.xml" "${tests[@]}"; then
199
+ log "All ${label} tests passed"
200
+ else
201
+ local ec=$?
202
+ log "${label} tests failed with exit code $ec"
203
+ return 1
204
+ fi
205
+ }
206
+
207
+ cd "$REPO_DIR"
208
+ if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1 || \
209
+ ! git -c safe.directory="$REPO_DIR" cat-file -e 2a7cb4f584e08680b65260d19b48a2c7ec574731^{commit}; then
210
+ echo 0 > "$REWARD_FILE"
211
+ exit 0
212
+ fi
213
+ if ! bash /tests/install_trusted_test_paths.sh \
214
+ "$REPO_DIR" 2a7cb4f584e08680b65260d19b48a2c7ec574731 /tests/trusted_test_paths.txt; then
215
+ echo 0 > "$REWARD_FILE"
216
+ exit 0
217
+ fi
218
+ if ! bash /tests/install_trusted_test_patch.sh \
219
+ "$REPO_DIR" /tests/test_patch.diff 2a7cb4f584e08680b65260d19b48a2c7ec574731; then
220
+ echo 0 > "$REWARD_FILE"
221
+ exit 0
222
+ fi
223
+ if [ ! -f /tmp/tasktrove-agent-setup-complete ]; then
224
+ ensure_dependencies
225
+ else
226
+ log "Reusing dependency setup completed during the agent phase"
227
+ fi
228
+
229
+ run_test_group "pass-to-pass" "${PASS_TESTS[@]}"
230
+ run_test_group "fail-to-pass" "${FAIL_TESTS[@]}"
231
+
232
+ echo 1 > "$REWARD_FILE"
233
+ log "All configured tests succeeded"
tasks/swegym-1116/tests/native-test.sh ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -Eeuo pipefail
3
+
4
+ # --- Environment setup ---
5
+ source /opt/miniconda3/bin/activate
6
+ conda activate testbed
7
+ # --- End environment setup ---
8
+
9
+ REPO_DIR="/testbed/repo"
10
+ LOG_DIR="/logs"
11
+ VERIFIER_DIR="/logs/verifier"
12
+ LOG_FILE="$LOG_DIR/test_output.log"
13
+ REWARD_FILE="$VERIFIER_DIR/reward.txt"
14
+
15
+ mkdir -p "$LOG_DIR" "$VERIFIER_DIR"
16
+ : > "$LOG_FILE"
17
+ echo 0 > "$REWARD_FILE"
18
+
19
+ exec > >(tee -a "$LOG_FILE") 2>&1
20
+
21
+ on_error() {
22
+ echo "One or more tests failed." >&2
23
+ echo 0 > "$REWARD_FILE"
24
+ exit 1
25
+ }
26
+ trap on_error ERR
27
+
28
+ PASS_TESTS=(
29
+ 'tests/test_types.py::test_finite_float_validation_error[inf]'
30
+ 'tests/test_types.py::test_default_validators[date_check-value113-result113]'
31
+ 'tests/test_types.py::test_default_validators[date_check-value106-result106]'
32
+ 'tests/test_types.py::test_default_validators[datetime_check-value120-result120]'
33
+ 'tests/test_types.py::test_none_literal'
34
+ 'tests/test_types.py::test_default_validators[float_check-value84-1.0]'
35
+ 'tests/test_types.py::test_default_validators[float_check-t-ValidationError0]'
36
+ 'tests/test_types.py::test_is_hashable[ImportString]'
37
+ 'tests/test_types.py::test_list_success[value3-result3]'
38
+ 'tests/test_types.py::test_decimal_validation[condecimal-type_args40-value40-result40]'
39
+ 'tests/test_types.py::test_default_validators[date_check-2017-05-05-result108]'
40
+ 'tests/test_types.py::test_default_validators[bool_check-F-False]'
41
+ 'tests/test_types.py::test_invalid_schema_constraints[kwargs11-type_11]'
42
+ 'tests/test_types.py::test_decimal_validation[Field-type_args15-value15-result15]'
43
+ 'tests/test_types.py::test_default_validators[frozenset_check-value176-result176]'
44
+ 'tests/test_types.py::test_decimal_validation[condecimal-type_args38-value38-result38]'
45
+ 'tests/test_types.py::test_default_validators[bytes_check-value68-ValidationError]'
46
+ 'tests/test_types.py::test_directory_path_validation_success[tests-result0]'
47
+ 'tests/test_types.py::test_enum_from_json[Enum-False]'
48
+ 'tests/test_types.py::test_str_to_upper[True-ABCDefG-ABCDEFG]'
49
+ 'tests/test_types.py::test_enum_successful'
50
+ 'tests/test_types.py::test_default_validators[float_check-1-1.01]'
51
+ 'tests/test_types.py::test_deque_fails[int-value2-expected_error2]'
52
+ 'tests/test_types.py::test_default_validators[uuid_check-123-ValidationError]'
53
+ 'tests/test_types.py::test_default_validators[date_check-1493942400-result111]'
54
+ 'tests/test_types.py::test_infinite_iterable_int'
55
+ 'tests/test_types.py::test_default_validators[datetime_check-value121-result121]'
56
+ 'tests/test_types.py::test_default_validators[str_check-xxxxxxxxxxx-ValidationError0]'
57
+ 'tests/test_types.py::test_default_validators[str_check-xxxxxxxxxxx-ValidationError1]'
58
+ 'tests/test_types.py::test_default_validators[datetime_check-1493979010000.0-result128]'
59
+ 'tests/test_types.py::test_default_validators[decimal_check-42.24-result99]'
60
+ 'tests/test_types.py::test_invalid_schema_constraints[kwargs8-type_8]'
61
+ 'tests/test_types.py::test_deque_generic_success[cls5-value5-result5]'
62
+ 'tests/test_types.py::test_is_hashable[pydantic_type13]'
63
+ 'tests/test_types.py::test_default_validators[bool_check-value48-ValidationError]'
64
+ 'tests/test_types.py::test_constrained_set_optional'
65
+ 'tests/test_types.py::test_list_fails[1231]'
66
+ 'tests/test_types.py::test_is_hashable[ByteSize]'
67
+ 'tests/test_types.py::test_decimal_validation[Field-type_args38-value38-result38]'
68
+ 'tests/test_types.py::test_is_hashable[pydantic_type31]'
69
+ 'tests/test_types.py::test_sequence_success[int-value0-result0]'
70
+ 'tests/test_types.py::test_pattern[Pattern]'
71
+ 'tests/test_types.py::test_int_enum_successful_for_str_int'
72
+ 'tests/test_types.py::test_default_validators[bool_check-off-False]'
73
+ 'tests/test_types.py::test_default_validators[bool_check-NO-False]'
74
+ 'tests/test_types.py::test_default_validators[float_check-1-1.00]'
75
+ 'tests/test_types.py::test_default_validators[bool_check-on-True]'
76
+ 'tests/test_types.py::test_enum_fails'
77
+ 'tests/test_types.py::test_decimal_strict'
78
+ 'tests/test_types.py::test_bytesize_to'
79
+ 'tests/test_types.py::test_number_multiple_of_float_invalid[1.27]'
80
+ 'tests/test_types.py::test_default_validators[bool_check-T-True]'
81
+ 'tests/test_types.py::test_default_validators[int_check-value74-1]'
82
+ 'tests/test_types.py::test_bytesize_conversions[1.0-1-1B-1B]'
83
+ 'tests/test_types.py::test_bytesize_conversions[1-1-1B-1B]'
84
+ 'tests/test_types.py::test_strict_timedelta'
85
+ 'tests/test_types.py::test_tuple_variable_len_success[<genexpr>-int-result2]'
86
+ 'tests/test_types.py::test_decimal_validation[condecimal-type_args43-value43-result43]'
87
+ 'tests/test_types.py::test_number_le'
88
+ 'tests/test_types.py::test_default_union_class'
89
+ 'tests/test_types.py::test_default_validators[set_check-value172-result172]'
90
+ 'tests/test_types.py::test_decimal_validation[condecimal-type_args21-NaN-result21]'
91
+ 'tests/test_types.py::test_decimal_validation[Field-type_args14-value14-result14]'
92
+ 'tests/test_types.py::test_is_hashable[pydantic_type12]'
93
+ 'tests/test_types.py::test_list_success[<genexpr>-result2]'
94
+ 'tests/test_types.py::test_is_hashable[pydantic_type14]'
95
+ 'tests/test_types.py::test_directory_path_validation_fails[tests/test_t.py]'
96
+ 'tests/test_types.py::test_constrained_set_good'
97
+ 'tests/test_types.py::test_is_hashable[pydantic_type10]'
98
+ 'tests/test_types.py::test_default_validators[date_check-2017-5-5-ValidationError0]'
99
+ 'tests/test_types.py::test_is_hashable[conbytes]'
100
+ 'tests/test_types.py::test_is_hashable[confloat]'
101
+ 'tests/test_types.py::test_default_validators[bool_check-OFF-False]'
102
+ 'tests/test_types.py::test_default_validators[date_check-value119-ValidationError]'
103
+ 'tests/test_types.py::test_is_hashable[condecimal]'
104
+ 'tests/test_types.py::test_decimal_validation[Field-type_args41-value41-result41]'
105
+ 'tests/test_types.py::test_decimal_not_finite[-NaN-is_nan]'
106
+ 'tests/test_types.py::test_default_validators[int_check-12-121]'
107
+ 'tests/test_types.py::test_is_hashable[pydantic_type4]'
108
+ 'tests/test_types.py::test_conlist_wrong_type_default'
109
+ 'tests/test_types.py::test_default_validators[frozenset_check-value174-result174]'
110
+ 'tests/test_types.py::test_default_validators[bool_check-No-False]'
111
+ 'tests/test_types.py::test_decimal_validation[Field-type_args11-value11-result11]'
112
+ 'tests/test_types.py::test_frozenset_field_conversion[value0-result0]'
113
+ 'tests/test_types.py::test_decimal_validation[Field-type_args8-value8-result8]'
114
+ 'tests/test_types.py::test_list_success[value0-result0]'
115
+ 'tests/test_types.py::test_decimal_validation[condecimal-type_args20-value20-result20]'
116
+ 'tests/test_types.py::test_default_validators[bool_check-false-False]'
117
+ 'tests/test_types.py::test_default_validators[str_check-s-s1]'
118
+ 'tests/test_types.py::test_default_validators[time_check-value143-ValidationError]'
119
+ 'tests/test_types.py::test_finite_float_config'
120
+ 'tests/test_types.py::test_secretstr_idempotent'
121
+ 'tests/test_types.py::test_none[NoneType1]'
122
+ 'tests/test_types.py::test_tuple_success[value3-result3]'
123
+ 'tests/test_types.py::test_number_multiple_of_int_invalid[14]'
124
+ 'tests/test_types.py::test_decimal_validation[Field-type_args2-value2-result2]'
125
+ 'tests/test_types.py::test_new_type_fails'
126
+ 'tests/test_types.py::test_default_validators[bool_check-Y-True]'
127
+ 'tests/test_types.py::test_enum_from_json[IntEnum-True]'
128
+ 'tests/test_types.py::test_decimal_validation[Field-type_args0-value0-result0]'
129
+ )
130
+
131
+ FAIL_TESTS=(
132
+ 'tests/test_types.py::test_path_validation_success[/test/path-result0]'
133
+ 'tests/test_types.py::test_path_like'
134
+ 'tests/test_types.py::test_path_validation_success[value1-result1]'
135
+ 'tests/test_types.py::test_path_like_strict'
136
+ )
137
+
138
+ log() {
139
+ echo "[swegym] $*"
140
+ }
141
+
142
+ ensure_dependencies() {
143
+ log "Installing base Python tooling"
144
+
145
+ # PIP_CONSTRAINT cython<3 is scoped PER-REPO (legacy repos need it;
146
+ # it is fatal to the modern meson build used by pandas>=2.0/modin>=2.x).
147
+ echo "cython<3" > /tmp/constraint.txt
148
+ export PIP_CONSTRAINT=/tmp/constraint.txt
149
+
150
+ # Use prefer-binary to avoid building from source where possible (fixes PyYAML/Cython issues)
151
+ pip install --prefer-binary --upgrade pip setuptools wheel
152
+
153
+ # Generic dev/runtime deps install is gated per-repo (skipped for
154
+ # repos whose recipe installs explicitly, to avoid torch/CUDA disk
155
+ # overflow on the 10 GB cap).
156
+ if [ -f requirements-dev.txt ]; then
157
+ log "Installing requirements-dev.txt"
158
+ pip install --prefer-binary -r requirements-dev.txt || true
159
+ fi
160
+
161
+ if [ -f requirements.txt ]; then
162
+ log "Installing requirements.txt"
163
+ pip install --prefer-binary -r requirements.txt || true
164
+ fi
165
+
166
+ log "Running repo-specific install..."
167
+ pip install pdm && pdm install
168
+
169
+ # Fix 'sure' library bit-rot for Python 3.7+
170
+ # This replaces re._pattern_type with a compatible type check
171
+ SURE_OLD_PY=$(python3 -c "import sure, os; print(os.path.join(sure.__path__[0], 'old.py'))" 2>/dev/null || true)
172
+ if [ -f "$SURE_OLD_PY" ]; then
173
+ log "Patching 'sure' library for compatibility..."
174
+ sed -i 's/re._pattern_type/type(re.compile(""))/g' "$SURE_OLD_PY" || true
175
+ fi
176
+
177
+ pip install "pytest>=8.0.0" "pytest-xdist>=3.5.0" || true
178
+ }
179
+
180
+ run_test_group() {
181
+ local label="$1"
182
+ shift || true
183
+ local tests=()
184
+
185
+ for target in "$@"; do
186
+ if [ -z "$target" ] || [[ "$target" == "#"* ]]; then
187
+ continue
188
+ fi
189
+ tests+=("$target")
190
+ done
191
+
192
+ if [ "${#tests[@]}" -eq 0 ]; then
193
+ log "No ${label} tests to run"
194
+ return 0
195
+ fi
196
+
197
+ log "Running ${#tests[@]} ${label} tests in one pytest session"
198
+ if python3 -m pytest -q -x --override-ini=addopts= "${tests[@]}"; then
199
+ log "All ${label} tests passed"
200
+ else
201
+ local ec=$?
202
+ log "${label} tests failed with exit code $ec"
203
+ return 1
204
+ fi
205
+ }
206
+
207
+ cd "$REPO_DIR"
208
+ if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1 || \
209
+ ! git -c safe.directory="$REPO_DIR" cat-file -e 2a7cb4f584e08680b65260d19b48a2c7ec574731^{commit}; then
210
+ echo 0 > "$REWARD_FILE"
211
+ exit 0
212
+ fi
213
+ if ! bash /tests/install_trusted_test_paths.sh \
214
+ "$REPO_DIR" 2a7cb4f584e08680b65260d19b48a2c7ec574731 /tests/trusted_test_paths.txt; then
215
+ echo 0 > "$REWARD_FILE"
216
+ exit 0
217
+ fi
218
+ if ! bash /tests/install_trusted_test_patch.sh \
219
+ "$REPO_DIR" /tests/test_patch.diff 2a7cb4f584e08680b65260d19b48a2c7ec574731; then
220
+ echo 0 > "$REWARD_FILE"
221
+ exit 0
222
+ fi
223
+ if [ ! -f /tmp/tasktrove-agent-setup-complete ]; then
224
+ ensure_dependencies
225
+ else
226
+ log "Reusing dependency setup completed during the agent phase"
227
+ fi
228
+
229
+ run_test_group "pass-to-pass" "${PASS_TESTS[@]}"
230
+ run_test_group "fail-to-pass" "${FAIL_TESTS[@]}"
231
+
232
+ echo 1 > "$REWARD_FILE"
233
+ log "All configured tests succeeded"
tasks/swegym-1116/tests/test.sh ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -Eeuo pipefail
3
+ mkdir -p /logs/verifier
4
+ rm -f /logs/verifier/pass-to-pass.xml /logs/verifier/fail-to-pass.xml
5
+ /opt/miniconda3/envs/testbed/bin/python -I -c 'import json,platform,sys; print("OPENENV_NATIVE_RUNTIME="+json.dumps({"python":platform.python_version(),"machine":platform.machine()})); assert sys.version_info[:2]==(3,8); assert platform.machine()=="x86_64"'
6
+ set +e
7
+ bash /tests/native-test-instrumented.sh
8
+ code=$?
9
+ set -e
10
+ python3 -I -c 'import json,platform,sys; print("OPENENV_CHECKER_RUNTIME="+json.dumps({"python":platform.python_version(),"machine":platform.machine()})); assert sys.version_info>=(3,9)'
11
+ exec python3 /tests/check_pytest.py --root /logs/verifier --expected /tests/expected-panels.json --native-exit "$code"
tasks/swegym-1116/tests/test_patch.diff ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/tests/test_types.py b/tests/test_types.py
2
+ --- a/tests/test_types.py
3
+ +++ b/tests/test_types.py
4
+ @@ -1,4 +1,5 @@
5
+ import itertools
6
+ +import json
7
+ import math
8
+ import os
9
+ import re
10
+ @@ -2914,6 +2915,42 @@ class Model(BaseModel):
11
+ foo: Path
12
+
13
+ assert Model(foo=value).foo == result
14
+ + assert Model.model_validate_json(json.dumps({'foo': str(value)})).foo == result
15
+ +
16
+ +
17
+ +def test_path_like():
18
+ + class Model(BaseModel):
19
+ + foo: os.PathLike
20
+ +
21
+ + assert Model(foo='/foo/bar').foo == Path('/foo/bar')
22
+ + assert Model(foo=Path('/foo/bar')).foo == Path('/foo/bar')
23
+ + assert Model.model_validate_json('{"foo": "abc"}').foo == Path('abc')
24
+ + # insert_assert(Model.model_json_schema())
25
+ + assert Model.model_json_schema() == {
26
+ + 'type': 'object',
27
+ + 'properties': {'foo': {'type': 'string', 'format': 'path', 'title': 'Foo'}},
28
+ + 'required': ['foo'],
29
+ + 'title': 'Model',
30
+ + }
31
+ +
32
+ +
33
+ +def test_path_like_strict():
34
+ + class Model(BaseModel):
35
+ + model_config = dict(strict=True)
36
+ +
37
+ + foo: os.PathLike
38
+ +
39
+ + with pytest.raises(ValidationError, match='Input should be an instance of PathLike'):
40
+ + Model(foo='/foo/bar')
41
+ + assert Model(foo=Path('/foo/bar')).foo == Path('/foo/bar')
42
+ + assert Model.model_validate_json('{"foo": "abc"}').foo == Path('abc')
43
+ + # insert_assert(Model.model_json_schema())
44
+ + assert Model.model_json_schema() == {
45
+ + 'type': 'object',
46
+ + 'properties': {'foo': {'type': 'string', 'format': 'path', 'title': 'Foo'}},
47
+ + 'required': ['foo'],
48
+ + 'title': 'Model',
49
+ + }
50
+
51
+
52
+ def test_path_validation_fails():
tasks/swegym-1116/tests/test_state.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+
3
+
4
+ def test_reward_file_indicates_success():
5
+ reward_path = Path("/logs/verifier/reward.txt")
6
+ assert reward_path.exists(), "Reward file missing"
7
+ content = reward_path.read_text(encoding="utf-8").strip()
8
+ assert content == "1", f"Tests did not succeed (reward={content!r})"
tasks/swegym-1116/tests/trusted_patch_paths.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ tests/test_types.py
tasks/swegym-1116/tests/trusted_test_paths.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ tests/test_types.py
tasks/swegym-1116/validation/canaries/partial-repair.sh ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -eu
3
+ cd /testbed/repo
4
+ cat > /tmp/openenv-partial.diff <<'OPENENV_PARTIAL'
5
+ diff --git a/pydantic/_internal/_std_types_schema.py b/pydantic/_internal/_std_types_schema.py
6
+ --- a/pydantic/_internal/_std_types_schema.py
7
+ +++ b/pydantic/_internal/_std_types_schema.py
8
+ @@ -12,6 +12,7 @@
9
+ from decimal import Decimal
10
+ from enum import Enum
11
+ from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network
12
+ +from os import PathLike
13
+ from pathlib import PurePath
14
+ from typing import Any, Callable
15
+ from uuid import UUID
16
+ OPENENV_PARTIAL
17
+ git -c core.hooksPath=/dev/null apply --whitespace=nowarn /tmp/openenv-partial.diff
tasks/swegym-1116/validation/canaries/stale-reward.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/bin/bash
2
+ mkdir -p /logs/verifier
3
+ printf "1\n" > /logs/verifier/reward.txt
tasks/swegym-1116/validation/canaries/unmodified.sh ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ #!/bin/bash
2
+ :
tasks/swegym-1116/validation/openenv.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "canaries": "validation/canaries",
3
+ "profile": "harbor-semantic-v1",
4
+ "requires_credentials": false,
5
+ "resources": {
6
+ "cpu": 2,
7
+ "disk_mb": 16384,
8
+ "episode_timeout_s": 1800,
9
+ "memory_mb": 8192
10
+ },
11
+ "reward": {
12
+ "floor_margin": 0.1,
13
+ "oracle_tolerance": 0,
14
+ "range": [
15
+ 0,
16
+ 1
17
+ ]
18
+ },
19
+ "reward_key": "reward",
20
+ "types": {
21
+ "tags": [
22
+ "swe",
23
+ "python",
24
+ "repository-repair"
25
+ ]
26
+ }
27
+ }
tasks/swegym-1117/adapter.json ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "canary_selection": "Fixed first gold hunk, never selected from observed rewards; reward1 requires semantic review",
3
+ "collector_sha256": "2a75d35790f6496f754850af247239363d8226867be0988241601d82a0eefc59",
4
+ "dependency_installation_pinned": false,
5
+ "dependency_setup_sha256": "664410452ea01ff43406fb8c84b5230dffe3e331d1aab1015b83c6c9f9dc9e26",
6
+ "extra_canaries": "test-reset and stale-reward boundary probes, not distinct semantic bugs",
7
+ "gold_patch_sha256": "0efb0b4d9e371cb5424ae729488deb7b6b89fb2a5a8e8b6ee30b534fd8eec93d",
8
+ "known_wrong_semantic_implementations": 0,
9
+ "native_inventory_sha256": "e1e6efd844cc1671b45b4b268469726fe3ccc7b66b3b98388f02ec6c3553548e",
10
+ "new_files_deletions_and_executable_modes_supported": true,
11
+ "partial_repair_canary": true,
12
+ "partial_repair_sha256": "e477bcbfbb6b937497d8baf606e74727db66dcade50a73c1a4f011ba6c34c6a2",
13
+ "partial_repair_wrongness_established": false,
14
+ "repo_url": "https://github.com/pydantic/pydantic.git",
15
+ "runtime_image": null,
16
+ "runtime_ready": false,
17
+ "schema": "python-git-patch-jobs-v1",
18
+ "source_base_commit": "f55515820a407c5d31c45a7b0307925eecf21f34",
19
+ "source_index_sha256": "55a8cdf68e0bab301ae92a7f48615d145e87a03563c02781f5dc0ffbf0b23597",
20
+ "source_pr_url": "https://github.com/pydantic/pydantic/pull/4911",
21
+ "source_record": {
22
+ "anti_training_canary": false,
23
+ "anti_training_reviewed": true,
24
+ "candidate_id": "TaskTrove:946884702046be1a7dcea2638186ad6b0d2ea103:swegym-1117",
25
+ "cloud_launch_ready": false,
26
+ "evaluation_only": false,
27
+ "fail_to_pass": [
28
+ "tests/test_edge_cases.py::test_str_method_inheritance",
29
+ "tests/test_edge_cases.py::test_repr_method_inheritance",
30
+ "tests/test_edge_cases.py::test_partial_inheritance_config",
31
+ "tests/test_edge_cases.py::test_parent_field_with_default",
32
+ "tests/test_json.py::test_json_encoder_inheritance_override"
33
+ ],
34
+ "instruction_sha256": "f288518df1fdb4762444839ffa4d92fdc8f4fbc0770e849b908494060690ddd0",
35
+ "intake_assessment": {
36
+ "reasons": [],
37
+ "semantic_nonoverlap_established": false,
38
+ "status": "eligible_for_controls",
39
+ "training_admissible": false,
40
+ "warnings": []
41
+ },
42
+ "inventory_path": "inventories/swegym-1117.json",
43
+ "license_evidence": {
44
+ "source_code": {
45
+ "probes": [
46
+ {
47
+ "filename": "LICENSE",
48
+ "http_status": 200
49
+ }
50
+ ],
51
+ "reused_frozen_pilot25": false,
52
+ "reviewed": true,
53
+ "scope": "captured exact-commit upstream software grant; all notices retained",
54
+ "sha256": "f72b9425e837e0cf59b335f6a37e6eb916bcf02544d756168d136139627e3483",
55
+ "spdx": "MIT",
56
+ "training_allowed": true,
57
+ "url": "https://raw.githubusercontent.com/pydantic/pydantic/f55515820a407c5d31c45a7b0307925eecf21f34/LICENSE"
58
+ },
59
+ "task_bundle": {
60
+ "reviewed": true,
61
+ "scope": "publisher-declared wrapper/train corpus; upstream notices remain applicable",
62
+ "sha256": "a906abccd50817f3dd2ea2485b43f5411aec676441025422c15c8a031ac55828",
63
+ "spdx": "Apache-2.0",
64
+ "training_allowed": true,
65
+ "url": "https://huggingface.co/datasets/open-thoughts/TaskTrove/blob/946884702046be1a7dcea2638186ad6b0d2ea103/README.md"
66
+ }
67
+ },
68
+ "native_inventory_sha256": "e1e6efd844cc1671b45b4b268469726fe3ccc7b66b3b98388f02ec6c3553548e",
69
+ "native_runtime_qualified": false,
70
+ "native_task_config": {
71
+ "agent": {
72
+ "timeout_sec": 1800.0
73
+ },
74
+ "metadata": {
75
+ "author_email": "bf996@nyu.edu",
76
+ "author_name": "OT-Agent + OpenHands",
77
+ "category": "bugfix",
78
+ "difficulty": "medium",
79
+ "tags": [
80
+ "swe",
81
+ "bugfix"
82
+ ]
83
+ },
84
+ "verifier": {
85
+ "restart_environment": false,
86
+ "timeout_sec": 600.0
87
+ },
88
+ "version": "1.0"
89
+ },
90
+ "negative_controls": [],
91
+ "original_source_dataset": "SWE-Gym/SWE-Gym",
92
+ "pass_to_pass": [
93
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include13-expected13]",
94
+ "tests/test_json.py::test_custom_encoder",
95
+ "tests/test_edge_cases.py::test_skip_defaults_deprecated",
96
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude6-expected6]",
97
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include3-expected3]",
98
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude12-expected12]",
99
+ "tests/test_edge_cases.py::test_illegal_extra_value",
100
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude3-expected3]",
101
+ "tests/test_json.py::test_custom_encode_error",
102
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude11-expected11]",
103
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude2-expected2]",
104
+ "tests/test_edge_cases.py::test_model_issubclass",
105
+ "tests/test_edge_cases.py::test_values_order",
106
+ "tests/test_json.py::test_custom_encoder_arg",
107
+ "tests/test_json.py::test_iso_timedelta[input1-P1001DT1H2M3.654321S]",
108
+ "tests/test_json.py::test_encode_dataclass",
109
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude4-expected4]",
110
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude13-expected13]",
111
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude14-expected14]",
112
+ "tests/test_edge_cases.py::test_arbitrary_types_allowed_custom_eq",
113
+ "tests/test_edge_cases.py::test_dict_any",
114
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude0-expected0]",
115
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include8-expected8]",
116
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include1-expected1]",
117
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include5-expected5]",
118
+ "tests/test_edge_cases.py::test_field_set_allow_extra",
119
+ "tests/test_edge_cases.py::test_list_bare",
120
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include11-expected11]",
121
+ "tests/test_json.py::test_custom_encode_fallback_basemodel",
122
+ "tests/test_edge_cases.py::test_field_set_field_name",
123
+ "tests/test_json.py::test_invalid_model",
124
+ "tests/test_edge_cases.py::test_any_none",
125
+ "tests/test_edge_cases.py::test_any_dict",
126
+ "tests/test_edge_cases.py::test_str_enum",
127
+ "tests/test_json.py::test_path_encoding",
128
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include0-expected0]",
129
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include7-expected7]",
130
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude5-expected5]",
131
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include9-expected9]",
132
+ "tests/test_edge_cases.py::test_exclude_none",
133
+ "tests/test_edge_cases.py::test_field_set_ignore_extra",
134
+ "tests/test_json.py::test_iso_timedelta[input3-P0DT0H0M0.000000S]",
135
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include2-expected2]",
136
+ "tests/test_json.py::test_iso_timedelta[input2--P1DT23H59M59.000000S]",
137
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude9-expected9]",
138
+ "tests/test_json.py::test_custom_iso_timedelta",
139
+ "tests/test_edge_cases.py::test_bytes_subclass",
140
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include6-expected6]",
141
+ "tests/test_edge_cases.py::test_self_recursive",
142
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude1-expected1]",
143
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude7-expected7]",
144
+ "tests/test_edge_cases.py::test_submodel_different_type",
145
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include14-expected14]",
146
+ "tests/test_edge_cases.py::test_exclude_none_with_extra",
147
+ "tests/test_edge_cases.py::test_iter_coverage",
148
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude10-expected10]",
149
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include10-expected10]",
150
+ "tests/test_edge_cases.py::test_exclude_none_recursive",
151
+ "tests/test_edge_cases.py::test_inheritance",
152
+ "tests/test_edge_cases.py::test_force_extra",
153
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include4-expected4]",
154
+ "tests/test_json.py::test_iso_timedelta[input0-P12DT0H0M34.000056S]",
155
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include12-expected12]",
156
+ "tests/test_edge_cases.py::test_dict_dict",
157
+ "tests/test_edge_cases.py::test_dict_bare",
158
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude8-expected8]",
159
+ "tests/test_edge_cases.py::test_init_inspection"
160
+ ],
161
+ "patch_sha256": "0efb0b4d9e371cb5424ae729488deb7b6b89fb2a5a8e8b6ee30b534fd8eec93d",
162
+ "prior_pilot25_member": false,
163
+ "provenance_path": "provenance/swegym-1117.json",
164
+ "published_image_pins_qualified": false,
165
+ "repair_patch_paths": [
166
+ {
167
+ "new": "pydantic/_internal/_model_construction.py",
168
+ "old": "pydantic/_internal/_model_construction.py"
169
+ }
170
+ ],
171
+ "repository_lineage": [
172
+ "pydantic/pydantic"
173
+ ],
174
+ "rfc008_complete": false,
175
+ "runtime_blockers": [
176
+ "unqualified repository worktree preparation and patch/file handoff",
177
+ "missing task-specific negatives and canaries",
178
+ "unqualified immutable runtime image",
179
+ "reference/NOP/replay and model audit not run"
180
+ ],
181
+ "runtime_resource_review_required": false,
182
+ "semantic_nonoverlap_established": false,
183
+ "source_commit": "f55515820a407c5d31c45a7b0307925eecf21f34",
184
+ "source_dataset": "open-thoughts/TaskTrove",
185
+ "source_kind": "pr",
186
+ "source_pr_url": "https://github.com/pydantic/pydantic/pull/4911",
187
+ "source_repo": "pydantic/pydantic",
188
+ "source_revision": "946884702046be1a7dcea2638186ad6b0d2ea103",
189
+ "source_split": "train",
190
+ "source_task_id": "pydantic__pydantic-4911",
191
+ "target_model_calibrated": false,
192
+ "task_id": "swegym-1117",
193
+ "task_path": "tasks/swegym-1117",
194
+ "task_sha256": "78c85636aff1f7a1fd89a84997ff488f0051b87443e8a5ae768ea9ba0515163f",
195
+ "task_sha256_kind": "original-native-tar-gzip",
196
+ "trainability_established": false,
197
+ "training_admissible": false,
198
+ "transfer_contract": {
199
+ "allowlist": [],
200
+ "status": "blocked_missing_repository_patch_adapter"
201
+ },
202
+ "upstream_identity_reviewed": true,
203
+ "upstream_repo": "pydantic/pydantic",
204
+ "usage": "quarantine_only",
205
+ "verified": false
206
+ },
207
+ "source_repo": "pydantic/pydantic",
208
+ "symlink_submodule_changes_supported": false,
209
+ "task_id": "swegym-1117",
210
+ "transfer": "index-independent-worktree-to-Git-binary-patch",
211
+ "transfer_path": "/testbed/submission.patch"
212
+ }
tasks/swegym-1117/dependency-assets/Makefile ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .DEFAULT_GOAL := all
2
+ sources = pydantic tests docs/build
3
+
4
+ .PHONY: install
5
+ install:
6
+ python -m pip install -U pip
7
+ pip install -r requirements/all.txt
8
+ pip install -e .
9
+
10
+ .PHONY: refresh-lockfiles
11
+ refresh-lockfiles:
12
+ @echo "Updating requirements/*.txt files using pip-compile"
13
+ find requirements/ -name '*.txt' ! -name 'all.txt' -type f -delete
14
+ pip-compile -q --resolver backtracking -o requirements/docs.txt requirements/docs.in
15
+ pip-compile -q --resolver backtracking -o requirements/linting.txt requirements/linting.in
16
+ pip-compile -q --resolver backtracking -o requirements/testing.txt requirements/testing.in
17
+ pip-compile -q --resolver backtracking -o requirements/testing-extra.txt requirements/testing-extra.in
18
+ pip-compile -q --resolver backtracking -o requirements/pyproject-min.txt pyproject.toml
19
+ pip-compile -q --resolver backtracking -o requirements/pyproject-all.txt pyproject.toml --extra=email
20
+ pip install --dry-run -r requirements/all.txt
21
+
22
+ .PHONY: format
23
+ format:
24
+ isort $(sources)
25
+ black $(sources)
26
+
27
+ .PHONY: lint
28
+ lint:
29
+ ruff $(sources)
30
+ isort $(sources) --check-only --df
31
+ black $(sources) --check --diff
32
+
33
+ .PHONY: lint-flake8
34
+ lint-flake8:
35
+ flake8 $(sources)
36
+
37
+ .PHONY: mypy
38
+ mypy:
39
+ mypy pydantic docs/build --disable-recursive-aliases
40
+
41
+ .PHONY: pyupgrade
42
+ pyupgrade:
43
+ pyupgrade --py37-plus `find pydantic tests -name "*.py" -type f`
44
+
45
+ .PHONY: pyright
46
+ pyright:
47
+ cd tests/pyright && pyright
48
+
49
+ .PHONY: test
50
+ test:
51
+ coverage run -m pytest --durations=10
52
+
53
+ .PHONY: testcov
54
+ testcov: test
55
+ @echo "building coverage html"
56
+ @coverage html
57
+
58
+ .PHONY: testcov-compile
59
+ testcov-compile: build-trace test
60
+ @echo "building coverage html"
61
+ @coverage html
62
+
63
+ .PHONY: test-examples
64
+ test-examples:
65
+ @echo "running examples"
66
+ @find docs/examples -type f -name '*.py' | xargs -I'{}' sh -c 'python {} >/dev/null 2>&1 || (echo "{} failed")'
67
+
68
+ .PHONY: test-fastapi
69
+ test-fastapi:
70
+ git clone https://github.com/tiangolo/fastapi.git --single-branch
71
+ ./tests/test_fastapi.sh
72
+
73
+ .PHONY: all
74
+ all: lint mypy testcov
75
+
76
+ .PHONY: clean
77
+ clean:
78
+ rm -rf `find . -name __pycache__`
79
+ rm -f `find . -type f -name '*.py[co]'`
80
+ rm -f `find . -type f -name '*~'`
81
+ rm -f `find . -type f -name '.*~'`
82
+ rm -rf .cache
83
+ rm -rf .pytest_cache
84
+ rm -rf .mypy_cache
85
+ rm -rf htmlcov
86
+ rm -rf *.egg-info
87
+ rm -f .coverage
88
+ rm -f .coverage.*
89
+ rm -rf build
90
+ rm -rf dist
91
+ rm -f pydantic/*.c pydantic/*.so
92
+ rm -rf site
93
+ rm -rf docs/_build
94
+ rm -rf docs/.changelog.md docs/.version.md docs/.tmp_schema_mappings.html
95
+ rm -rf fastapi/test.db
96
+ rm -rf coverage.xml
97
+
98
+ .PHONY: docs
99
+ docs:
100
+ flake8 --max-line-length=80 docs/examples/
101
+ python docs/build/main.py
102
+ mkdocs build
103
+
104
+ .PHONY: docs-serve
105
+ docs-serve:
106
+ python docs/build/main.py
107
+ mkdocs serve
tasks/swegym-1117/dependency-assets/pyproject.toml ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ requires = ['hatchling', 'hatch-fancy-pypi-readme>=22.5.0']
3
+ build-backend = 'hatchling.build'
4
+
5
+ [tool.hatch.version]
6
+ path = 'pydantic/version.py'
7
+
8
+ [tool.hatch.build.targets.sdist]
9
+ # limit which files are included in the sdist (.tar.gz) asset,
10
+ # see https://github.com/pydantic/pydantic/pull/4542
11
+ include = [
12
+ '/README.md',
13
+ '/HISTORY.md',
14
+ '/Makefile',
15
+ '/pydantic',
16
+ '/tests',
17
+ '/requirements',
18
+ ]
19
+
20
+ [project]
21
+ name = 'pydantic'
22
+ description = 'Data validation using Python type hints'
23
+ authors = [
24
+ {name = 'Samuel Colvin', email = 's@muelcolvin.com'},
25
+ {name = 'Eric Jolibois', email = 'em.jolibois@gmail.com'},
26
+ {name = 'Hasan Ramezani', email = 'hasan.r67@gmail.com'},
27
+ ]
28
+ license = 'MIT'
29
+ classifiers = [
30
+ 'Development Status :: 5 - Production/Stable',
31
+ 'Programming Language :: Python',
32
+ 'Programming Language :: Python :: 3',
33
+ 'Programming Language :: Python :: 3 :: Only',
34
+ 'Programming Language :: Python :: 3.7',
35
+ 'Programming Language :: Python :: 3.8',
36
+ 'Programming Language :: Python :: 3.9',
37
+ 'Programming Language :: Python :: 3.10',
38
+ 'Programming Language :: Python :: 3.11',
39
+ 'Intended Audience :: Developers',
40
+ 'Intended Audience :: Information Technology',
41
+ 'Intended Audience :: System Administrators',
42
+ 'License :: OSI Approved :: MIT License',
43
+ 'Operating System :: Unix',
44
+ 'Operating System :: POSIX :: Linux',
45
+ 'Environment :: Console',
46
+ 'Environment :: MacOS X',
47
+ 'Framework :: Hypothesis',
48
+ 'Topic :: Software Development :: Libraries :: Python Modules',
49
+ 'Topic :: Internet',
50
+ ]
51
+ requires-python = '>=3.7'
52
+ dependencies = [
53
+ 'typing-extensions>=4.2.0',
54
+ 'pydantic-core>=0.7.1',
55
+ 'annotated-types>=0.4.0',
56
+ ]
57
+ optional-dependencies = { email = ['email-validator>=1.0.3'] }
58
+ dynamic = ['version', 'readme']
59
+
60
+ entry-points.hypothesis = {_ = 'pydantic._hypothesis_plugin'}
61
+
62
+ [project.urls]
63
+ Homepage = 'https://github.com/pydantic/pydantic'
64
+ Documentation = 'https://docs.pydantic.dev'
65
+ Funding = 'https://github.com/sponsors/samuelcolvin'
66
+ Source = 'https://github.com/pydantic/pydantic'
67
+ Changelog = 'https://docs.pydantic.dev/changelog'
68
+
69
+ [tool.hatch.metadata.hooks.fancy-pypi-readme]
70
+ content-type = 'text/markdown'
71
+ # construct the PyPI readme from README.md and HISTORY.md
72
+ fragments = [
73
+ {path = "README.md"},
74
+ {text = "\n## Changelog\n\n"},
75
+ {path = "HISTORY.md", pattern = "(.+?)<!-- package description limit -->"},
76
+ {text = "\n... see [here](https://docs.pydantic.dev/changelog/#v0322-2019-08-17) for earlier changes.\n"},
77
+ ]
78
+ # convert GitHUB issue/PR numbers and handles to links
79
+ substitutions = [
80
+ {pattern = '(\s+)#(\d+)', replacement = '\1[#\2](https://github.com/pydantic/pydantic/issues/\2)'},
81
+ {pattern = '(\s+)@([\w\-]+)', replacement = '\1[@\2](https://github.com/\2)'},
82
+ {pattern = '@@', replacement = '@'},
83
+ ]
84
+
85
+ [tool.pytest.ini_options]
86
+ testpaths = 'tests'
87
+ xfail_strict = true
88
+ filterwarnings = [
89
+ 'error',
90
+ 'ignore:path is deprecated.*:DeprecationWarning:',
91
+ ]
92
+
93
+ # configuring https://github.com/pydantic/hooky
94
+ [tool.hooky]
95
+ reviewers = ['samuelcolvin', 'PrettyWood', 'hramezani']
96
+ require_change_file = false
97
+
98
+ [tool.flake8]
99
+ max_line_length = 120
100
+ max_complexity = 14
101
+ inline_quotes = 'single'
102
+ multiline_quotes = 'double'
103
+ ignore = ['E203', 'W503']
104
+ per_file_ignores = [
105
+ 'docs/examples/schema_unenforced_constraints.py:F811',
106
+ 'docs/examples/validation_decorator_async.py:E402',
107
+ 'docs/examples/types_constrained.py:F722',
108
+ ]
109
+
110
+ [tool.ruff]
111
+ line-length = 120
112
+ extend-select = ['Q']
113
+ flake8-quotes = {inline-quotes = 'single', multiline-quotes = 'double'}
114
+
115
+ [tool.ruff.per-file-ignores]
116
+ 'pydantic/__init__.py' = ['F405', 'F403']
117
+ 'tests/test_forward_ref.py' = ['F821']
118
+
119
+ [tool.coverage.run]
120
+ source = ['pydantic']
121
+ branch = true
122
+ context = '${CONTEXT}'
123
+
124
+ [tool.coverage.report]
125
+ precision = 2
126
+ exclude_lines = [
127
+ 'pragma: no cover',
128
+ 'raise NotImplementedError',
129
+ 'if TYPE_CHECKING:',
130
+ '@overload',
131
+ ]
132
+
133
+
134
+ [tool.coverage.paths]
135
+ source = [
136
+ 'pydantic/',
137
+ '/Users/runner/work/pydantic/pydantic/pydantic/',
138
+ 'D:\a\pydantic\pydantic\pydantic',
139
+ ]
140
+
141
+ [tool.black]
142
+ color = true
143
+ line-length = 120
144
+ target-version = ['py310']
145
+ skip-string-normalization = true
146
+
147
+ [tool.isort]
148
+ line_length = 120
149
+ known_first_party = 'pydantic'
150
+ multi_line_output = 3
151
+ include_trailing_comma = true
152
+ force_grid_wrap = 0
153
+ combine_as_imports = true
154
+
155
+ [tool.mypy]
156
+ # temporarily ignore some files
157
+ exclude = 'pydantic/(schema|_hypothesis_plugin)\.py'
158
+ python_version = '3.10'
159
+ show_error_codes = true
160
+ follow_imports = 'silent'
161
+ strict_optional = true
162
+ warn_redundant_casts = true
163
+ warn_unused_ignores = true
164
+ disallow_any_generics = true
165
+ check_untyped_defs = true
166
+ no_implicit_reexport = true
167
+ warn_unused_configs = true
168
+ disallow_subclassing_any = true
169
+ disallow_incomplete_defs = true
170
+ disallow_untyped_decorators = true
171
+ disallow_untyped_calls = true
172
+ disallow_untyped_defs = true
173
+ implicit_optional = true
174
+
175
+ # ansi2html and devtools are required to avoid the need to install these packages when running linting,
176
+ # they're used in the docs build script
177
+ [[tool.mypy.overrides]]
178
+ module = [
179
+ 'email_validator.*',
180
+ 'toml.*',
181
+ 'ansi2html.*',
182
+ 'devtools.*',
183
+ ]
184
+ ignore_missing_imports = true
tasks/swegym-1117/dependency-assets/requirements/all.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ -r ./pyproject-all.txt
2
+ -r ./docs.txt
3
+ -r ./linting.txt
4
+ -r ./testing.txt
5
+ -r ./testing-extra.txt
tasks/swegym-1117/dependency-assets/requirements/docs.txt ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is autogenerated by pip-compile with python 3.10
3
+ # To update, run:
4
+ #
5
+ # pip-compile --output-file=requirements/docs.txt --resolver=backtracking requirements/docs.in
6
+ #
7
+ ansi2html==1.8.0
8
+ # via -r requirements/docs.in
9
+ autoflake==1.7.7
10
+ # via -r requirements/docs.in
11
+ certifi==2022.12.7
12
+ # via requests
13
+ charset-normalizer==2.1.1
14
+ # via requests
15
+ click==8.1.3
16
+ # via mkdocs
17
+ ghp-import==2.1.0
18
+ # via mkdocs
19
+ greenlet==2.0.1
20
+ # via sqlalchemy
21
+ idna==3.4
22
+ # via requests
23
+ jinja2==3.1.2
24
+ # via
25
+ # mkdocs
26
+ # mkdocs-material
27
+ markdown==3.3.7
28
+ # via
29
+ # markdown-include
30
+ # mdx-truly-sane-lists
31
+ # mkdocs
32
+ # mkdocs-material
33
+ # pymdown-extensions
34
+ markdown-include==0.7.0
35
+ # via -r requirements/docs.in
36
+ markupsafe==2.1.1
37
+ # via jinja2
38
+ mdx-truly-sane-lists==1.3
39
+ # via -r requirements/docs.in
40
+ mergedeep==1.3.4
41
+ # via mkdocs
42
+ mkdocs==1.4.2
43
+ # via
44
+ # -r requirements/docs.in
45
+ # mkdocs-exclude
46
+ # mkdocs-material
47
+ mkdocs-exclude==1.0.2
48
+ # via -r requirements/docs.in
49
+ mkdocs-material==8.5.9
50
+ # via -r requirements/docs.in
51
+ mkdocs-material-extensions==1.1
52
+ # via mkdocs-material
53
+ orjson==3.8.1
54
+ # via -r requirements/docs.in
55
+ packaging==21.3
56
+ # via mkdocs
57
+ pyflakes==2.5.0
58
+ # via autoflake
59
+ pygments==2.13.0
60
+ # via mkdocs-material
61
+ pymdown-extensions==9.8
62
+ # via mkdocs-material
63
+ pyparsing==3.0.9
64
+ # via packaging
65
+ python-dateutil==2.8.2
66
+ # via ghp-import
67
+ pyyaml==6.0
68
+ # via
69
+ # mkdocs
70
+ # pyyaml-env-tag
71
+ pyyaml-env-tag==0.1
72
+ # via mkdocs
73
+ requests==2.28.1
74
+ # via mkdocs-material
75
+ six==1.16.0
76
+ # via python-dateutil
77
+ sqlalchemy==1.4.43
78
+ # via -r requirements/docs.in
79
+ tomli==2.0.1
80
+ # via autoflake
81
+ ujson==5.5.0
82
+ # via -r requirements/docs.in
83
+ urllib3==1.26.12
84
+ # via requests
85
+ watchdog==2.1.9
86
+ # via mkdocs
tasks/swegym-1117/dependency-assets/requirements/linting.txt ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is autogenerated by pip-compile with python 3.10
3
+ # To update, run:
4
+ #
5
+ # pip-compile --output-file=requirements/linting.txt --resolver=backtracking requirements/linting.in
6
+ #
7
+ annotated-types==0.4.0
8
+ # via -r requirements/linting.in
9
+ attrs==22.1.0
10
+ # via hypothesis
11
+ black==22.10.0
12
+ # via -r requirements/linting.in
13
+ cfgv==3.3.1
14
+ # via pre-commit
15
+ click==8.1.3
16
+ # via black
17
+ distlib==0.3.6
18
+ # via virtualenv
19
+ exceptiongroup==1.0.1
20
+ # via hypothesis
21
+ filelock==3.8.0
22
+ # via virtualenv
23
+ flake8==5.0.4
24
+ # via
25
+ # -r requirements/linting.in
26
+ # flake8-pyproject
27
+ # flake8-quotes
28
+ flake8-pyproject==1.1.0.post0
29
+ # via -r requirements/linting.in
30
+ flake8-quotes==3.3.1
31
+ # via -r requirements/linting.in
32
+ hypothesis==6.56.4
33
+ # via -r requirements/linting.in
34
+ identify==2.5.8
35
+ # via pre-commit
36
+ isort==5.10.1
37
+ # via -r requirements/linting.in
38
+ mccabe==0.7.0
39
+ # via flake8
40
+ mypy==0.991
41
+ # via -r requirements/linting.in
42
+ mypy-extensions==0.4.3
43
+ # via
44
+ # black
45
+ # mypy
46
+ nodeenv==1.7.0
47
+ # via pre-commit
48
+ pathspec==0.10.1
49
+ # via black
50
+ platformdirs==2.5.3
51
+ # via
52
+ # black
53
+ # virtualenv
54
+ pre-commit==2.20.0
55
+ # via -r requirements/linting.in
56
+ pycodestyle==2.9.1
57
+ # via flake8
58
+ pydantic-core==0.7.1
59
+ # via -r requirements/linting.in
60
+ pyflakes==2.5.0
61
+ # via flake8
62
+ pyupgrade==3.2.2
63
+ # via -r requirements/linting.in
64
+ pyyaml==6.0
65
+ # via pre-commit
66
+ ruff==0.0.109
67
+ # via -r requirements/linting.in
68
+ sortedcontainers==2.4.0
69
+ # via hypothesis
70
+ tokenize-rt==5.0.0
71
+ # via pyupgrade
72
+ toml==0.10.2
73
+ # via pre-commit
74
+ tomli==2.0.1
75
+ # via
76
+ # black
77
+ # flake8-pyproject
78
+ # mypy
79
+ typing-extensions==4.4.0
80
+ # via
81
+ # mypy
82
+ # pydantic-core
83
+ virtualenv==20.16.6
84
+ # via pre-commit
85
+
86
+ # The following packages are considered to be unsafe in a requirements file:
87
+ # setuptools
tasks/swegym-1117/dependency-assets/requirements/pyproject-all.txt ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is autogenerated by pip-compile with python 3.10
3
+ # To update, run:
4
+ #
5
+ # pip-compile --extra=email --output-file=requirements/pyproject-all.txt --resolver=backtracking pyproject.toml
6
+ #
7
+ annotated-types==0.4.0
8
+ # via pydantic (pyproject.toml)
9
+ dnspython==2.2.1
10
+ # via email-validator
11
+ email-validator==1.3.0
12
+ # via pydantic (pyproject.toml)
13
+ idna==3.4
14
+ # via email-validator
15
+ pydantic-core==0.7.1
16
+ # via pydantic (pyproject.toml)
17
+ typing-extensions==4.4.0
18
+ # via
19
+ # pydantic (pyproject.toml)
20
+ # pydantic-core
tasks/swegym-1117/dependency-assets/requirements/testing-extra.txt ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is autogenerated by pip-compile with python 3.10
3
+ # To update, run:
4
+ #
5
+ # pip-compile --output-file=requirements/testing-extra.txt --resolver=backtracking requirements/testing-extra.in
6
+ #
7
+ asttokens==2.1.0
8
+ # via devtools
9
+ attrs==22.1.0
10
+ # via hypothesis
11
+ devtools==0.9.0
12
+ # via -r requirements/testing-extra.in
13
+ exceptiongroup==1.0.1
14
+ # via hypothesis
15
+ executing==0.10.0
16
+ # via devtools
17
+ hypothesis==6.56.4
18
+ # via -r requirements/testing-extra.in
19
+ mypy==0.991
20
+ # via -r requirements/testing-extra.in
21
+ mypy-extensions==0.4.3
22
+ # via mypy
23
+ six==1.16.0
24
+ # via asttokens
25
+ sortedcontainers==2.4.0
26
+ # via hypothesis
27
+ tomli==2.0.1
28
+ # via mypy
29
+ typing-extensions==4.4.0
30
+ # via mypy
tasks/swegym-1117/dependency-assets/requirements/testing.txt ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is autogenerated by pip-compile with python 3.10
3
+ # To update, run:
4
+ #
5
+ # pip-compile --output-file=requirements/testing.txt --resolver=backtracking requirements/testing.in
6
+ #
7
+ attrs==22.1.0
8
+ # via pytest
9
+ commonmark==0.9.1
10
+ # via rich
11
+ coverage[toml]==6.5.0
12
+ # via -r requirements/testing.in
13
+ dirty-equals==0.5.0
14
+ # via -r requirements/testing.in
15
+ exceptiongroup==1.0.1
16
+ # via pytest
17
+ iniconfig==1.1.1
18
+ # via pytest
19
+ packaging==21.3
20
+ # via pytest
21
+ pluggy==1.0.0
22
+ # via pytest
23
+ pygments==2.13.0
24
+ # via rich
25
+ pyparsing==3.0.9
26
+ # via packaging
27
+ pytest==7.2.0
28
+ # via
29
+ # -r requirements/testing.in
30
+ # pytest-mock
31
+ # pytest-pretty
32
+ pytest-mock==3.10.0
33
+ # via -r requirements/testing.in
34
+ pytest-pretty==0.0.1
35
+ # via -r requirements/testing.in
36
+ pytz==2022.6
37
+ # via dirty-equals
38
+ rich==12.6.0
39
+ # via pytest-pretty
40
+ tomli==2.0.1
41
+ # via
42
+ # coverage
43
+ # pytest
44
+ typing-extensions==4.4.0
45
+ # via dirty-equals
tasks/swegym-1117/dependency-setup.sh ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -Eeuo pipefail
3
+ source /opt/miniconda3/bin/activate
4
+ conda activate testbed
5
+ cd /testbed/repo
6
+ /usr/bin/sha256sum --check <<'OPENENV_BASE_REQUIREMENTS'
7
+ a811c26d2a571dee803061d4bc51fd3fcb08caa8e5f968e5113791f44f6de4c6 Makefile
8
+ a048506c871700ab722e24cede9fe12c961dcadd636a6cce5b49011cfcc35fd9 pyproject.toml
9
+ 5afa7ad84be9a4dae3dee76be98aee87d1def1492e473922fdc75a9c44d3f5ef requirements/all.txt
10
+ 3ad4df370bf239ff6c0a9616d230737ca646f1d2dde3b0bbf8195dbf30914768 requirements/docs.txt
11
+ 580b461f59dee3a902c5de605068e362af8589f7d59730e20c9c4f26dc963b7f requirements/linting.txt
12
+ a5a4c89ec367d895e538fe32c4837194a8f46d90e200bdc76f2b45ea5c897bac requirements/pyproject-all.txt
13
+ 30c581721c0d7162a019bf6e5f27811c649e057a25b7c2f3a58f6aca879f14cd requirements/testing-extra.txt
14
+ 8902fb4398287a2d32dd041f39a2bc7f0dbaf81087cbb43c051f37e657436708 requirements/testing.txt
15
+ OPENENV_BASE_REQUIREMENTS
16
+ python -m pip install -U pip
17
+ python -m pip install -r requirements/all.txt
18
+ python -m pip install -e .
19
+ python -c 'import pydantic_core; assert pydantic_core.__version__ == "0.7.1"'
20
+ touch /tmp/tasktrove-agent-setup-complete
tasks/swegym-1117/environment/Dockerfile ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:22.04
2
+
3
+ ARG DEBIAN_FRONTEND=noninteractive
4
+ ENV TZ=Etc/UTC
5
+
6
+ WORKDIR /testbed
7
+
8
+ RUN apt-get update && \
9
+ apt-get install -y --no-install-recommends \
10
+ wget \
11
+ git \
12
+ build-essential \
13
+ pkg-config \
14
+ ca-certificates \
15
+ curl \
16
+ jq \
17
+ locales \
18
+ locales-all \
19
+ tzdata \
20
+ libxml2-dev \
21
+ libxmlsec1-dev \
22
+ libffi-dev \
23
+ libssl-dev \
24
+ zlib1g-dev \
25
+ libbz2-dev \
26
+ libreadline-dev \
27
+ libsqlite3-dev \
28
+ python3 \
29
+ python3-pip \
30
+ python-is-python3 \
31
+ libsqlite3-dev openjdk-17-jdk openjdk-17-jre npm libpq-dev \
32
+ && rm -rf /var/lib/apt/lists/*
33
+
34
+ # Install Miniconda - Consistent with original SWE-Bench approach
35
+ RUN wget 'https://repo.anaconda.com/miniconda/Miniconda3-py311_24.7.1-0-Linux-x86_64.sh' -O miniconda.sh && \
36
+ bash miniconda.sh -b -p /opt/miniconda3 && \
37
+ rm miniconda.sh
38
+
39
+ ENV PATH="/opt/miniconda3/bin:$PATH"
40
+
41
+ # Following authors' approach: use /bin/bash explicitly for initialization
42
+ RUN /bin/bash -c "source /opt/miniconda3/bin/activate && \
43
+ conda init bash && \
44
+ conda config --append channels conda-forge && \
45
+ conda create -n testbed python=3.8 -y"
46
+
47
+ # Automatically activate environment in shell sessions
48
+ RUN echo "source /opt/miniconda3/bin/activate && conda activate testbed" >> /root/.bashrc
tasks/swegym-1117/instruction.md ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Bug Fix Task
2
+
3
+ - Repository: `pydantic/pydantic`
4
+ - Source commit: `f55515820a407c5d31c45a7b0307925eecf21f34`
5
+ - Dataset instance: `pydantic__pydantic-4911`
6
+ - Upstream issue version: `2.0`
7
+ - Reference repo URL: https://github.com/pydantic/pydantic
8
+
9
+ ## Environment Setup (complete these steps first)
10
+
11
+ touch /tmp/tasktrove-agent-setup-complete
12
+ ```bash
13
+ cd /testbed
14
+ git clone https://github.com/pydantic/pydantic.git repo
15
+ cd repo
16
+ git checkout f55515820a407c5d31c45a7b0307925eecf21f34
17
+
18
+ # Activate environment
19
+ source /opt/miniconda3/bin/activate
20
+ conda activate testbed
21
+
22
+ # Install dependencies
23
+ pip install pdm && pdm install
24
+ ```
25
+
26
+ ---
27
+
28
+ ## Problem Statement
29
+ Intended behavior of Field in Parent-Child-Inheritance
30
+ ### Discussed in https://github.com/pydantic/pydantic/discussions/4896
31
+
32
+ <div type='discussions-op-text'>
33
+
34
+ <sup>Originally posted by **florianfischer91** January 2, 2023</sup>
35
+ Given the following code
36
+ ```python
37
+ class Parent(BaseModel):
38
+ a: int = 3
39
+ # a: Annotated[int, Field(3)]
40
+
41
+ class Child(Parent):
42
+ b: str = Field(alias='bbb')
43
+ ```
44
+ the resulting field infos of `Parent` and `Child` are
45
+ ```bash
46
+ {'a': FieldInfo(annotation=int, required=False, default=3)} # Parent
47
+ {'a': FieldInfo(annotation=int, required=True), 'b': FieldInfo(annotation=str, required=True, alias='bbb', alias_priority=2)} # Child
48
+ ```
49
+
50
+ You can see that for `Child` the inherited field `a` has no default value and is required. Using `Annotated` and `Field` (see comment) leads to the (in my opinion) correct field infos
51
+ ```bash
52
+ {'a': FieldInfo(annotation=int, required=False, default=3)}
53
+ {'a': FieldInfo(annotation=int, required=False, default=3), 'b': FieldInfo(annotation=str, required=True, alias='bbb', alias_priority=2)}
54
+ ```
55
+
56
+ This behavior applies to every case where a 'value' is assigned to a field. I know that V2 is still in development but i just stumpled over this and want to now whether this is intended and one should just use `Annotated` or still has to be implemented?
57
+ </div>
58
+
59
+ ## Tests that must keep passing
60
+ - `tests/test_edge_cases.py::test_advanced_include_nested_lists[include13-expected13]`
61
+ - `tests/test_json.py::test_custom_encoder`
62
+ - `tests/test_edge_cases.py::test_skip_defaults_deprecated`
63
+ - `tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude6-expected6]`
64
+ - `tests/test_edge_cases.py::test_advanced_include_nested_lists[include3-expected3]`
65
+ - `tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude12-expected12]`
66
+ - `tests/test_edge_cases.py::test_illegal_extra_value`
67
+ - `tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude3-expected3]`
68
+ - `tests/test_json.py::test_custom_encode_error`
69
+ - `tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude11-expected11]`
70
+ - `tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude2-expected2]`
71
+ - `tests/test_edge_cases.py::test_model_issubclass`
72
+ - `tests/test_edge_cases.py::test_values_order`
73
+ - `tests/test_json.py::test_custom_encoder_arg`
74
+ - `tests/test_json.py::test_iso_timedelta[input1-P1001DT1H2M3.654321S]`
75
+ - `tests/test_json.py::test_encode_dataclass`
76
+ - `tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude4-expected4]`
77
+ - `tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude13-expected13]`
78
+ - `tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude14-expected14]`
79
+ - `tests/test_edge_cases.py::test_arbitrary_types_allowed_custom_eq`
80
+ - `tests/test_edge_cases.py::test_dict_any`
81
+ - `tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude0-expected0]`
82
+ - `tests/test_edge_cases.py::test_advanced_include_nested_lists[include8-expected8]`
83
+ - `tests/test_edge_cases.py::test_advanced_include_nested_lists[include1-expected1]`
84
+ - `tests/test_edge_cases.py::test_advanced_include_nested_lists[include5-expected5]`
85
+ - `tests/test_edge_cases.py::test_field_set_allow_extra`
86
+ - `tests/test_edge_cases.py::test_list_bare`
87
+ - `tests/test_edge_cases.py::test_advanced_include_nested_lists[include11-expected11]`
88
+ - `tests/test_json.py::test_custom_encode_fallback_basemodel`
89
+ - `tests/test_edge_cases.py::test_field_set_field_name`
90
+ - `tests/test_json.py::test_invalid_model`
91
+ - `tests/test_edge_cases.py::test_any_none`
92
+ - `tests/test_edge_cases.py::test_any_dict`
93
+ - `tests/test_edge_cases.py::test_str_enum`
94
+ - `tests/test_json.py::test_path_encoding`
95
+ - `tests/test_edge_cases.py::test_advanced_include_nested_lists[include0-expected0]`
96
+ - `tests/test_edge_cases.py::test_advanced_include_nested_lists[include7-expected7]`
97
+ - `tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude5-expected5]`
98
+ - `tests/test_edge_cases.py::test_advanced_include_nested_lists[include9-expected9]`
99
+ - `tests/test_edge_cases.py::test_exclude_none`
100
+ - `tests/test_edge_cases.py::test_field_set_ignore_extra`
101
+ - `tests/test_json.py::test_iso_timedelta[input3-P0DT0H0M0.000000S]`
102
+ - `tests/test_edge_cases.py::test_advanced_include_nested_lists[include2-expected2]`
103
+ - `tests/test_json.py::test_iso_timedelta[input2--P1DT23H59M59.000000S]`
104
+ - `tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude9-expected9]`
105
+ - `tests/test_json.py::test_custom_iso_timedelta`
106
+ - `tests/test_edge_cases.py::test_bytes_subclass`
107
+ - `tests/test_edge_cases.py::test_advanced_include_nested_lists[include6-expected6]`
108
+ - `tests/test_edge_cases.py::test_self_recursive`
109
+ - `tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude1-expected1]`
110
+ - `tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude7-expected7]`
111
+ - `tests/test_edge_cases.py::test_submodel_different_type`
112
+ - `tests/test_edge_cases.py::test_advanced_include_nested_lists[include14-expected14]`
113
+ - `tests/test_edge_cases.py::test_exclude_none_with_extra`
114
+ - `tests/test_edge_cases.py::test_iter_coverage`
115
+ - `tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude10-expected10]`
116
+ - `tests/test_edge_cases.py::test_advanced_include_nested_lists[include10-expected10]`
117
+ - `tests/test_edge_cases.py::test_exclude_none_recursive`
118
+ - `tests/test_edge_cases.py::test_inheritance`
119
+ - `tests/test_edge_cases.py::test_force_extra`
120
+ - `tests/test_edge_cases.py::test_advanced_include_nested_lists[include4-expected4]`
121
+ - `tests/test_json.py::test_iso_timedelta[input0-P12DT0H0M34.000056S]`
122
+ - `tests/test_edge_cases.py::test_advanced_include_nested_lists[include12-expected12]`
123
+ - `tests/test_edge_cases.py::test_dict_dict`
124
+ - `tests/test_edge_cases.py::test_dict_bare`
125
+ - `tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude8-expected8]`
126
+ - `tests/test_edge_cases.py::test_init_inspection`
127
+
128
+ ## Tests currently failing (should pass after your fix)
129
+ - `tests/test_edge_cases.py::test_str_method_inheritance`
130
+ - `tests/test_edge_cases.py::test_repr_method_inheritance`
131
+ - `tests/test_edge_cases.py::test_partial_inheritance_config`
132
+ - `tests/test_edge_cases.py::test_parent_field_with_default`
133
+ - `tests/test_json.py::test_json_encoder_inheritance_override`
134
+
135
+ Apply code changes directly inside `/testbed/repo` and use `pytest` to run any of the above test targets. Focus on making the failing tests succeed without regressing the existing passing suite.
tasks/swegym-1117/metadata.json ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": "SWE-Gym/SWE-Gym",
3
+ "split": "train",
4
+ "instance_id": "pydantic__pydantic-4911",
5
+ "repo": "pydantic/pydantic",
6
+ "base_commit": "f55515820a407c5d31c45a7b0307925eecf21f34",
7
+ "version": "2.0",
8
+ "pass_to_pass": [
9
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include13-expected13]",
10
+ "tests/test_json.py::test_custom_encoder",
11
+ "tests/test_edge_cases.py::test_skip_defaults_deprecated",
12
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude6-expected6]",
13
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include3-expected3]",
14
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude12-expected12]",
15
+ "tests/test_edge_cases.py::test_illegal_extra_value",
16
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude3-expected3]",
17
+ "tests/test_json.py::test_custom_encode_error",
18
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude11-expected11]",
19
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude2-expected2]",
20
+ "tests/test_edge_cases.py::test_model_issubclass",
21
+ "tests/test_edge_cases.py::test_values_order",
22
+ "tests/test_json.py::test_custom_encoder_arg",
23
+ "tests/test_json.py::test_iso_timedelta[input1-P1001DT1H2M3.654321S]",
24
+ "tests/test_json.py::test_encode_dataclass",
25
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude4-expected4]",
26
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude13-expected13]",
27
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude14-expected14]",
28
+ "tests/test_edge_cases.py::test_arbitrary_types_allowed_custom_eq",
29
+ "tests/test_edge_cases.py::test_dict_any",
30
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude0-expected0]",
31
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include8-expected8]",
32
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include1-expected1]",
33
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include5-expected5]",
34
+ "tests/test_edge_cases.py::test_field_set_allow_extra",
35
+ "tests/test_edge_cases.py::test_list_bare",
36
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include11-expected11]",
37
+ "tests/test_json.py::test_custom_encode_fallback_basemodel",
38
+ "tests/test_edge_cases.py::test_field_set_field_name",
39
+ "tests/test_json.py::test_invalid_model",
40
+ "tests/test_edge_cases.py::test_any_none",
41
+ "tests/test_edge_cases.py::test_any_dict",
42
+ "tests/test_edge_cases.py::test_str_enum",
43
+ "tests/test_json.py::test_path_encoding",
44
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include0-expected0]",
45
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include7-expected7]",
46
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude5-expected5]",
47
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include9-expected9]",
48
+ "tests/test_edge_cases.py::test_exclude_none",
49
+ "tests/test_edge_cases.py::test_field_set_ignore_extra",
50
+ "tests/test_json.py::test_iso_timedelta[input3-P0DT0H0M0.000000S]",
51
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include2-expected2]",
52
+ "tests/test_json.py::test_iso_timedelta[input2--P1DT23H59M59.000000S]",
53
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude9-expected9]",
54
+ "tests/test_json.py::test_custom_iso_timedelta",
55
+ "tests/test_edge_cases.py::test_bytes_subclass",
56
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include6-expected6]",
57
+ "tests/test_edge_cases.py::test_self_recursive",
58
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude1-expected1]",
59
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude7-expected7]",
60
+ "tests/test_edge_cases.py::test_submodel_different_type",
61
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include14-expected14]",
62
+ "tests/test_edge_cases.py::test_exclude_none_with_extra",
63
+ "tests/test_edge_cases.py::test_iter_coverage",
64
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude10-expected10]",
65
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include10-expected10]",
66
+ "tests/test_edge_cases.py::test_exclude_none_recursive",
67
+ "tests/test_edge_cases.py::test_inheritance",
68
+ "tests/test_edge_cases.py::test_force_extra",
69
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include4-expected4]",
70
+ "tests/test_json.py::test_iso_timedelta[input0-P12DT0H0M34.000056S]",
71
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include12-expected12]",
72
+ "tests/test_edge_cases.py::test_dict_dict",
73
+ "tests/test_edge_cases.py::test_dict_bare",
74
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude8-expected8]",
75
+ "tests/test_edge_cases.py::test_init_inspection"
76
+ ],
77
+ "fail_to_pass": [
78
+ "tests/test_edge_cases.py::test_str_method_inheritance",
79
+ "tests/test_edge_cases.py::test_repr_method_inheritance",
80
+ "tests/test_edge_cases.py::test_partial_inheritance_config",
81
+ "tests/test_edge_cases.py::test_parent_field_with_default",
82
+ "tests/test_json.py::test_json_encoder_inheritance_override"
83
+ ],
84
+ "created_at": "2023-01-04T22:37:48Z"
85
+ }
tasks/swegym-1117/provided-gold.diff ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/pydantic/_internal/_model_construction.py b/pydantic/_internal/_model_construction.py
2
+ --- a/pydantic/_internal/_model_construction.py
3
+ +++ b/pydantic/_internal/_model_construction.py
4
+ @@ -205,6 +205,9 @@ def build_inner_schema( # noqa: C901
5
+ raise
6
+ raise PydanticUndefinedAnnotation(name) from e
7
+
8
+ + # https://docs.python.org/3/howto/annotations.html#accessing-the-annotations-dict-of-an-object-in-python-3-9-and-older
9
+ + # annotations is only used for finding fields in parent classes
10
+ + annotations = cls.__dict__.get('__annotations__', {})
11
+ fields: dict[str, FieldInfo] = {}
12
+ for ann_name, ann_type in type_hints.items():
13
+ if ann_name.startswith('_') or _typing_extra.is_classvar(ann_type):
14
+ @@ -224,7 +227,12 @@ def build_inner_schema( # noqa: C901
15
+ try:
16
+ default = getattr(cls, ann_name)
17
+ except AttributeError:
18
+ - fields[ann_name] = FieldInfo.from_annotation(ann_type)
19
+ + # if field has no default value and is not in __annotations__ this means that it is
20
+ + # defined in a base class and we can take it from there
21
+ + if ann_name in annotations:
22
+ + fields[ann_name] = FieldInfo.from_annotation(ann_type)
23
+ + else:
24
+ + fields[ann_name] = cls.model_fields[ann_name]
25
+ else:
26
+ fields[ann_name] = FieldInfo.from_annotated_attribute(ann_type, default)
27
+ # attributes which are fields are removed from the class namespace:
tasks/swegym-1117/solution/solve.sh ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -Eeuo pipefail
3
+
4
+ # --- Environment setup ---
5
+ source /opt/miniconda3/bin/activate
6
+ conda activate testbed
7
+ cd /testbed
8
+ if [ ! -d "repo" ]; then
9
+ git clone https://github.com/pydantic/pydantic.git repo
10
+ fi
11
+ cd repo
12
+ git checkout f55515820a407c5d31c45a7b0307925eecf21f34
13
+ # --- End environment setup ---
14
+
15
+ patch_file="$(mktemp /tmp/swegym-test-patch-XXXX.diff)"
16
+ cat <<'PATCH_EOF' > "$patch_file"
17
+ diff --git a/tests/test_edge_cases.py b/tests/test_edge_cases.py
18
+ --- a/tests/test_edge_cases.py
19
+ +++ b/tests/test_edge_cases.py
20
+ @@ -979,19 +979,12 @@ class Config:
21
+ assert repr(m) == "Child(a=1, b='s')"
22
+
23
+
24
+ -@pytest.mark.xfail(reason='working on V2')
25
+ def test_partial_inheritance_config():
26
+ class Parent(BaseModel):
27
+ - a: int
28
+ -
29
+ - class Config:
30
+ - fields = {'a': 'aaa'}
31
+ + a: int = Field(alias='aaa')
32
+
33
+ class Child(Parent):
34
+ - b: str
35
+ -
36
+ - class Config:
37
+ - fields = {'b': 'bbb'}
38
+ + b: str = Field(alias='bbb')
39
+
40
+ m = Child(aaa=1, bbb='s')
41
+ assert repr(m) == "Child(a=1, b='s')"
42
+ @@ -1608,7 +1601,6 @@ class Config:
43
+ assert m.model_dump() == {'a': 'a', 'b': 'b', 'c': None}
44
+
45
+
46
+ -@pytest.mark.xfail(reason='working on V2')
47
+ def test_str_method_inheritance():
48
+ import pydantic
49
+
50
+ @@ -1626,7 +1618,6 @@ class Bar(Foo):
51
+ assert str(Bar()) == '7'
52
+
53
+
54
+ -@pytest.mark.xfail(reason='working on V2')
55
+ def test_repr_method_inheritance():
56
+ import pydantic
57
+
58
+ @@ -2109,3 +2100,17 @@ class Model(BaseModel):
59
+ # this used to hang indefinitely
60
+ with pytest.raises(ValidationError):
61
+ Model(x='1' * (10**7))
62
+ +
63
+ +
64
+ +def test_parent_field_with_default():
65
+ + class Parent(BaseModel):
66
+ + a: int = 1
67
+ + b: int = Field(2)
68
+ +
69
+ + class Child(Parent):
70
+ + c: int = 3
71
+ +
72
+ + c = Child()
73
+ + assert c.a == 1
74
+ + assert c.b == 2
75
+ + assert c.c == 3
76
+ diff --git a/tests/test_json.py b/tests/test_json.py
77
+ --- a/tests/test_json.py
78
+ +++ b/tests/test_json.py
79
+ @@ -215,7 +215,6 @@ class Config:
80
+ assert Child().model_dump_json() == '{"dt": "parent_encoder", "timedt": "child_encoder"}'
81
+
82
+
83
+ -@pytest.mark.xfail(reason='working on V2')
84
+ def test_json_encoder_inheritance_override():
85
+ class Parent(BaseModel):
86
+ dt: datetime.datetime = datetime.datetime.now()
87
+ PATCH_EOF
88
+
89
+ git apply --whitespace=nowarn --apply "$patch_file"
90
+
91
+ patch_file2="$(mktemp /tmp/swegym-solution-patch-XXXX.diff)"
92
+ cat <<'SOLUTION_PATCH_EOF' > "$patch_file2"
93
+ diff --git a/pydantic/_internal/_model_construction.py b/pydantic/_internal/_model_construction.py
94
+ --- a/pydantic/_internal/_model_construction.py
95
+ +++ b/pydantic/_internal/_model_construction.py
96
+ @@ -205,6 +205,9 @@ def build_inner_schema( # noqa: C901
97
+ raise
98
+ raise PydanticUndefinedAnnotation(name) from e
99
+
100
+ + # https://docs.python.org/3/howto/annotations.html#accessing-the-annotations-dict-of-an-object-in-python-3-9-and-older
101
+ + # annotations is only used for finding fields in parent classes
102
+ + annotations = cls.__dict__.get('__annotations__', {})
103
+ fields: dict[str, FieldInfo] = {}
104
+ for ann_name, ann_type in type_hints.items():
105
+ if ann_name.startswith('_') or _typing_extra.is_classvar(ann_type):
106
+ @@ -224,7 +227,12 @@ def build_inner_schema( # noqa: C901
107
+ try:
108
+ default = getattr(cls, ann_name)
109
+ except AttributeError:
110
+ - fields[ann_name] = FieldInfo.from_annotation(ann_type)
111
+ + # if field has no default value and is not in __annotations__ this means that it is
112
+ + # defined in a base class and we can take it from there
113
+ + if ann_name in annotations:
114
+ + fields[ann_name] = FieldInfo.from_annotation(ann_type)
115
+ + else:
116
+ + fields[ann_name] = cls.model_fields[ann_name]
117
+ else:
118
+ fields[ann_name] = FieldInfo.from_annotated_attribute(ann_type, default)
119
+ # attributes which are fields are removed from the class namespace:
120
+ SOLUTION_PATCH_EOF
121
+
122
+ git apply --whitespace=nowarn --apply "$patch_file2"
tasks/swegym-1117/task.toml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version = "1.0"
2
+
3
+ [agent]
4
+ timeout_sec = 1800.0
5
+
6
+ [metadata]
7
+ author_name = "OT-Agent + OpenHands"
8
+ author_email = "bf996@nyu.edu"
9
+ difficulty = "medium"
10
+ category = "bugfix"
11
+ tags = [
12
+ "swe",
13
+ "bugfix",
14
+ ]
15
+
16
+ [verifier]
17
+ restart_environment = false
18
+ timeout_sec = 600.0
tasks/swegym-1117/tests/check_pytest.py ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Distinguish real pytest failures from missing/setup/verifier evidence."""
2
+
3
+ import argparse
4
+ import json
5
+ import re
6
+ import xml.etree.ElementTree as ET
7
+ from pathlib import Path
8
+
9
+
10
+ def matches(case, target):
11
+ parts = target.split("::")
12
+ module = parts[0].removesuffix(".py").replace("/", ".")
13
+ classname = case.get("classname", "")
14
+ name = case.get("name", "")
15
+ if not (classname == module or classname.startswith(module + ".")):
16
+ return False
17
+ selector = parts[-1] if len(parts) > 1 else ""
18
+ classes = parts[1:-1]
19
+ if classes and classname != module + "." + ".".join(classes):
20
+ return False
21
+ return (
22
+ not selector
23
+ or name == selector
24
+ or ("[" not in selector and name.startswith(selector + "["))
25
+ )
26
+
27
+
28
+ def assess(root, expected, native_exit):
29
+ all_cases = []
30
+ actual_failure = False
31
+ for group in ("pass-to-pass", "fail-to-pass"):
32
+ path = Path(root) / (group + ".xml")
33
+ if not path.exists():
34
+ if actual_failure:
35
+ continue
36
+ raise ValueError("Missing preceding pytest panel")
37
+ if actual_failure:
38
+ raise ValueError(
39
+ "Pytest evidence continued after the native stop-on-failure"
40
+ )
41
+ raw = path.read_bytes()
42
+ if not 0 < len(raw) <= 4 * 1024**2 or re.search(
43
+ rb"<!\s*(?:DOCTYPE|ENTITY)", raw, re.I
44
+ ):
45
+ raise ValueError("Unbounded or unsafe pytest XML")
46
+ tree = ET.fromstring(raw)
47
+ cases = list(tree.iter("testcase"))
48
+ if len(cases) > 20000:
49
+ raise ValueError("Too many pytest cases")
50
+ identities = [(c.get("classname"), c.get("name")) for c in cases]
51
+ if len(identities) != len(set(identities)):
52
+ raise ValueError("Duplicate pytest case evidence")
53
+ targets = expected[group]
54
+ if any(not any(matches(case, t) for t in targets) for case in cases):
55
+ raise ValueError("Unexpected pytest case")
56
+ all_cases.extend(cases)
57
+ failures = [c for c in cases if c.find("failure") is not None]
58
+ if any(
59
+ c.find("error") is not None or c.find("skipped") is not None for c in cases
60
+ ):
61
+ raise ValueError("Pytest collection/error/skip is not a completed panel")
62
+ actual_failure = actual_failure or bool(failures)
63
+ if not failures and any(
64
+ not any(matches(case, t) for case in cases) for t in targets
65
+ ):
66
+ raise ValueError("Declared pytest target never ran")
67
+ if actual_failure:
68
+ if native_exit == 0:
69
+ raise ValueError("Native verifier exit disagrees with pytest failure")
70
+ return {"reward": 0, "valid_test_failure": True, "cases": len(all_cases)}
71
+ if native_exit != 0:
72
+ raise ValueError("Setup or native verifier failed without a real test failure")
73
+ for group in ("pass-to-pass", "fail-to-pass"):
74
+ if not (Path(root) / (group + ".xml")).is_file():
75
+ raise ValueError("Missing completed pytest panel")
76
+ return {"reward": 1, "valid_test_failure": False, "cases": len(all_cases)}
77
+
78
+
79
+ if __name__ == "__main__":
80
+ p = argparse.ArgumentParser()
81
+ p.add_argument("--root", required=True)
82
+ p.add_argument("--expected", required=True)
83
+ p.add_argument("--native-exit", type=int, required=True)
84
+ a = p.parse_args()
85
+ result = assess(a.root, json.loads(Path(a.expected).read_text()), a.native_exit)
86
+ reward = Path(a.root) / "reward.txt"
87
+ if reward.read_text().strip() != str(result["reward"]):
88
+ raise ValueError("Native raw reward disagrees with pytest evidence")
89
+ (Path(a.root) / "pytest-evidence.json").write_text(
90
+ json.dumps(result, sort_keys=True) + "\n"
91
+ )
tasks/swegym-1117/tests/config.json ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "instance_id": "pydantic__pydantic-4911",
3
+ "repo": "pydantic/pydantic",
4
+ "base_commit": "f55515820a407c5d31c45a7b0307925eecf21f34",
5
+ "version": "2.0",
6
+ "pass_to_pass": [
7
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include13-expected13]",
8
+ "tests/test_json.py::test_custom_encoder",
9
+ "tests/test_edge_cases.py::test_skip_defaults_deprecated",
10
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude6-expected6]",
11
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include3-expected3]",
12
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude12-expected12]",
13
+ "tests/test_edge_cases.py::test_illegal_extra_value",
14
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude3-expected3]",
15
+ "tests/test_json.py::test_custom_encode_error",
16
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude11-expected11]",
17
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude2-expected2]",
18
+ "tests/test_edge_cases.py::test_model_issubclass",
19
+ "tests/test_edge_cases.py::test_values_order",
20
+ "tests/test_json.py::test_custom_encoder_arg",
21
+ "tests/test_json.py::test_iso_timedelta[input1-P1001DT1H2M3.654321S]",
22
+ "tests/test_json.py::test_encode_dataclass",
23
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude4-expected4]",
24
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude13-expected13]",
25
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude14-expected14]",
26
+ "tests/test_edge_cases.py::test_arbitrary_types_allowed_custom_eq",
27
+ "tests/test_edge_cases.py::test_dict_any",
28
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude0-expected0]",
29
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include8-expected8]",
30
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include1-expected1]",
31
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include5-expected5]",
32
+ "tests/test_edge_cases.py::test_field_set_allow_extra",
33
+ "tests/test_edge_cases.py::test_list_bare",
34
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include11-expected11]",
35
+ "tests/test_json.py::test_custom_encode_fallback_basemodel",
36
+ "tests/test_edge_cases.py::test_field_set_field_name",
37
+ "tests/test_json.py::test_invalid_model",
38
+ "tests/test_edge_cases.py::test_any_none",
39
+ "tests/test_edge_cases.py::test_any_dict",
40
+ "tests/test_edge_cases.py::test_str_enum",
41
+ "tests/test_json.py::test_path_encoding",
42
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include0-expected0]",
43
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include7-expected7]",
44
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude5-expected5]",
45
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include9-expected9]",
46
+ "tests/test_edge_cases.py::test_exclude_none",
47
+ "tests/test_edge_cases.py::test_field_set_ignore_extra",
48
+ "tests/test_json.py::test_iso_timedelta[input3-P0DT0H0M0.000000S]",
49
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include2-expected2]",
50
+ "tests/test_json.py::test_iso_timedelta[input2--P1DT23H59M59.000000S]",
51
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude9-expected9]",
52
+ "tests/test_json.py::test_custom_iso_timedelta",
53
+ "tests/test_edge_cases.py::test_bytes_subclass",
54
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include6-expected6]",
55
+ "tests/test_edge_cases.py::test_self_recursive",
56
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude1-expected1]",
57
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude7-expected7]",
58
+ "tests/test_edge_cases.py::test_submodel_different_type",
59
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include14-expected14]",
60
+ "tests/test_edge_cases.py::test_exclude_none_with_extra",
61
+ "tests/test_edge_cases.py::test_iter_coverage",
62
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude10-expected10]",
63
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include10-expected10]",
64
+ "tests/test_edge_cases.py::test_exclude_none_recursive",
65
+ "tests/test_edge_cases.py::test_inheritance",
66
+ "tests/test_edge_cases.py::test_force_extra",
67
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include4-expected4]",
68
+ "tests/test_json.py::test_iso_timedelta[input0-P12DT0H0M34.000056S]",
69
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include12-expected12]",
70
+ "tests/test_edge_cases.py::test_dict_dict",
71
+ "tests/test_edge_cases.py::test_dict_bare",
72
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude8-expected8]",
73
+ "tests/test_edge_cases.py::test_init_inspection"
74
+ ],
75
+ "fail_to_pass": [
76
+ "tests/test_edge_cases.py::test_str_method_inheritance",
77
+ "tests/test_edge_cases.py::test_repr_method_inheritance",
78
+ "tests/test_edge_cases.py::test_partial_inheritance_config",
79
+ "tests/test_edge_cases.py::test_parent_field_with_default",
80
+ "tests/test_json.py::test_json_encoder_inheritance_override"
81
+ ],
82
+ "patch": "diff --git a/pydantic/_internal/_model_construction.py b/pydantic/_internal/_model_construction.py\n--- a/pydantic/_internal/_model_construction.py\n+++ b/pydantic/_internal/_model_construction.py\n@@ -205,6 +205,9 @@ def build_inner_schema( # noqa: C901\n raise\n raise PydanticUndefinedAnnotation(name) from e\n \n+ # https://docs.python.org/3/howto/annotations.html#accessing-the-annotations-dict-of-an-object-in-python-3-9-and-older\n+ # annotations is only used for finding fields in parent classes\n+ annotations = cls.__dict__.get('__annotations__', {})\n fields: dict[str, FieldInfo] = {}\n for ann_name, ann_type in type_hints.items():\n if ann_name.startswith('_') or _typing_extra.is_classvar(ann_type):\n@@ -224,7 +227,12 @@ def build_inner_schema( # noqa: C901\n try:\n default = getattr(cls, ann_name)\n except AttributeError:\n- fields[ann_name] = FieldInfo.from_annotation(ann_type)\n+ # if field has no default value and is not in __annotations__ this means that it is\n+ # defined in a base class and we can take it from there\n+ if ann_name in annotations:\n+ fields[ann_name] = FieldInfo.from_annotation(ann_type)\n+ else:\n+ fields[ann_name] = cls.model_fields[ann_name]\n else:\n fields[ann_name] = FieldInfo.from_annotated_attribute(ann_type, default)\n # attributes which are fields are removed from the class namespace:\n",
83
+ "test_patch_length": 1858
84
+ }
tasks/swegym-1117/tests/expected-panels.json ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fail-to-pass": [
3
+ "tests/test_edge_cases.py::test_str_method_inheritance",
4
+ "tests/test_edge_cases.py::test_repr_method_inheritance",
5
+ "tests/test_edge_cases.py::test_partial_inheritance_config",
6
+ "tests/test_edge_cases.py::test_parent_field_with_default",
7
+ "tests/test_json.py::test_json_encoder_inheritance_override"
8
+ ],
9
+ "pass-to-pass": [
10
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include13-expected13]",
11
+ "tests/test_json.py::test_custom_encoder",
12
+ "tests/test_edge_cases.py::test_skip_defaults_deprecated",
13
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude6-expected6]",
14
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include3-expected3]",
15
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude12-expected12]",
16
+ "tests/test_edge_cases.py::test_illegal_extra_value",
17
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude3-expected3]",
18
+ "tests/test_json.py::test_custom_encode_error",
19
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude11-expected11]",
20
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude2-expected2]",
21
+ "tests/test_edge_cases.py::test_model_issubclass",
22
+ "tests/test_edge_cases.py::test_values_order",
23
+ "tests/test_json.py::test_custom_encoder_arg",
24
+ "tests/test_json.py::test_iso_timedelta[input1-P1001DT1H2M3.654321S]",
25
+ "tests/test_json.py::test_encode_dataclass",
26
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude4-expected4]",
27
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude13-expected13]",
28
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude14-expected14]",
29
+ "tests/test_edge_cases.py::test_arbitrary_types_allowed_custom_eq",
30
+ "tests/test_edge_cases.py::test_dict_any",
31
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude0-expected0]",
32
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include8-expected8]",
33
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include1-expected1]",
34
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include5-expected5]",
35
+ "tests/test_edge_cases.py::test_field_set_allow_extra",
36
+ "tests/test_edge_cases.py::test_list_bare",
37
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include11-expected11]",
38
+ "tests/test_json.py::test_custom_encode_fallback_basemodel",
39
+ "tests/test_edge_cases.py::test_field_set_field_name",
40
+ "tests/test_json.py::test_invalid_model",
41
+ "tests/test_edge_cases.py::test_any_none",
42
+ "tests/test_edge_cases.py::test_any_dict",
43
+ "tests/test_edge_cases.py::test_str_enum",
44
+ "tests/test_json.py::test_path_encoding",
45
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include0-expected0]",
46
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include7-expected7]",
47
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude5-expected5]",
48
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include9-expected9]",
49
+ "tests/test_edge_cases.py::test_exclude_none",
50
+ "tests/test_edge_cases.py::test_field_set_ignore_extra",
51
+ "tests/test_json.py::test_iso_timedelta[input3-P0DT0H0M0.000000S]",
52
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include2-expected2]",
53
+ "tests/test_json.py::test_iso_timedelta[input2--P1DT23H59M59.000000S]",
54
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude9-expected9]",
55
+ "tests/test_json.py::test_custom_iso_timedelta",
56
+ "tests/test_edge_cases.py::test_bytes_subclass",
57
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include6-expected6]",
58
+ "tests/test_edge_cases.py::test_self_recursive",
59
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude1-expected1]",
60
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude7-expected7]",
61
+ "tests/test_edge_cases.py::test_submodel_different_type",
62
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include14-expected14]",
63
+ "tests/test_edge_cases.py::test_exclude_none_with_extra",
64
+ "tests/test_edge_cases.py::test_iter_coverage",
65
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude10-expected10]",
66
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include10-expected10]",
67
+ "tests/test_edge_cases.py::test_exclude_none_recursive",
68
+ "tests/test_edge_cases.py::test_inheritance",
69
+ "tests/test_edge_cases.py::test_force_extra",
70
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include4-expected4]",
71
+ "tests/test_json.py::test_iso_timedelta[input0-P12DT0H0M34.000056S]",
72
+ "tests/test_edge_cases.py::test_advanced_include_nested_lists[include12-expected12]",
73
+ "tests/test_edge_cases.py::test_dict_dict",
74
+ "tests/test_edge_cases.py::test_dict_bare",
75
+ "tests/test_edge_cases.py::test_advanced_exclude_nested_lists[exclude8-expected8]",
76
+ "tests/test_edge_cases.py::test_init_inspection"
77
+ ]
78
+ }
tasks/swegym-1117/tests/install_trusted_test_patch.sh ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -Eeuo pipefail
3
+
4
+ repository=${1:?repository path is required}
5
+ patch_path=${2:?patch path is required}
6
+ trusted_commit=${3:?trusted commit is required}
7
+
8
+ exec bash /tests/install_trusted_test_paths.sh "$repository" "$trusted_commit" /tests/trusted_patch_paths.txt "$patch_path"
tasks/swegym-1117/tests/install_trusted_test_paths.sh ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -Eeuo pipefail
3
+
4
+ export GIT_CONFIG_GLOBAL=/dev/null
5
+ export GIT_CONFIG_NOSYSTEM=1
6
+ export GIT_NO_REPLACE_OBJECTS=1
7
+
8
+ repository=${1:?repository path is required}
9
+ trusted_commit=${2:?trusted commit is required}
10
+ manifest=${3:?path manifest is required}
11
+ patch_path=${4:-}
12
+ fallback_commit=${5:-}
13
+
14
+ cd "$repository"
15
+
16
+ trusted_git() {
17
+ command git -c safe.directory="$repository" -c core.hooksPath=/dev/null -c core.fsmonitor=false "$@"
18
+ }
19
+
20
+ trusted_git cat-file -e "${trusted_commit}^{commit}"
21
+
22
+ restore_path() {
23
+ path=$1
24
+ case "$path" in
25
+ ""|/*|.|..|../*|*/..|*/../*)
26
+ echo "Unsafe trusted-test path: $path" >&2
27
+ exit 1
28
+ ;;
29
+ esac
30
+ trusted_git clean -ffdx -- "$path"
31
+ rm -rf -- "$path"
32
+ if trusted_git cat-file -e "${trusted_commit}:${path}" 2>/dev/null; then
33
+ trusted_git archive --format=tar "$trusted_commit" -- "$path" | tar -xf - -C "$repository"
34
+ elif [ -n "$fallback_commit" ] && trusted_git cat-file -e "${fallback_commit}:${path}" 2>/dev/null; then
35
+ trusted_git archive --format=tar "$fallback_commit" -- "$path" | tar -xf - -C "$repository"
36
+ fi
37
+ }
38
+
39
+ is_test_control_path() {
40
+ path=$1
41
+ basename=${path##*/}
42
+ case "/$path/" in
43
+ */test/*|*/tests/*|*/testing/*|*/test-data/*|*/testdata/*|*/spec/*|*/specs/*|*/__tests__/*)
44
+ return 0
45
+ ;;
46
+ esac
47
+ case "$basename" in
48
+ conftest.py|pytest.ini|tox.ini|.coveragerc|jest.config.*|vitest.config.*|test_*|*_test.*|*.test.*|*.spec.*)
49
+ return 0
50
+ ;;
51
+ esac
52
+ return 1
53
+ }
54
+
55
+ # Reset changed and untracked test-control files before restoring the explicit
56
+ # task targets. Product-code changes remain untouched.
57
+ while IFS= read -r -d '' path; do
58
+ if is_test_control_path "$path"; then
59
+ restore_path "$path"
60
+ fi
61
+ done < <(
62
+ {
63
+ trusted_git diff --name-only -z "$trusted_commit"
64
+ trusted_git ls-files --others --exclude-standard -z
65
+ trusted_git ls-files --others --ignored --exclude-standard -z
66
+ } | sort -zu
67
+ )
68
+
69
+ # Index flags can hide working-tree edits from ordinary diff discovery.
70
+ while IFS= read -r -d '' record; do
71
+ flag=${record%% *}
72
+ path=${record#? }
73
+ case "$flag" in
74
+ [a-z]|S)
75
+ if is_test_control_path "$path"; then
76
+ restore_path "$path"
77
+ fi
78
+ ;;
79
+ esac
80
+ done < <(trusted_git ls-files -v -z)
81
+
82
+ while IFS= read -r path || [ -n "$path" ]; do
83
+ restore_path "$path"
84
+ done < "$manifest"
85
+
86
+ if [ -n "$patch_path" ] && [ -s "$patch_path" ]; then
87
+ trusted_git apply --check "$patch_path"
88
+ trusted_git apply --verbose "$patch_path"
89
+ fi