File size: 12,526 Bytes
8c822ea
266e63e
026be51
6eb0f9a
 
1f5e7fe
 
6eb0f9a
 
 
 
 
 
 
 
 
 
 
 
 
 
762c7c2
 
d61001b
 
6eb0f9a
 
 
 
 
 
 
 
 
 
 
 
d61001b
 
6eb0f9a
 
 
 
 
 
d61001b
 
6eb0f9a
 
d61001b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43a50d6
 
d61001b
 
 
 
 
 
 
 
6eb0f9a
 
 
 
 
 
 
 
 
 
 
 
43a50d6
6afbc1f
f1fd61e
 
 
4d8a2fb
 
 
 
f1fd61e
a3ec68f
 
29b182c
 
a3ec68f
 
 
 
 
 
 
 
 
 
 
 
 
 
14b6dbd
 
74ce61b
 
a3ec68f
 
 
 
 
 
 
 
 
 
 
 
74ce61b
 
a3ec68f
 
 
 
 
 
74ce61b
 
a3ec68f
 
74ce61b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eeae512
 
74ce61b
 
 
 
 
 
 
 
a3ec68f
 
 
 
 
 
 
 
 
 
 
 
eeae512
3a5e7cd
8135c5a
 
 
 
 
8bf46c9
 
3e23eef
 
8bf46c9
 
 
 
 
 
 
 
 
 
 
 
 
 
ea0bab0
 
b3de7ce
 
8bf46c9
 
 
 
 
 
 
 
 
 
 
 
b3de7ce
 
8bf46c9
 
 
 
 
 
b3de7ce
 
8bf46c9
 
b3de7ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a1e880f
 
b3de7ce
 
 
 
 
 
 
 
8bf46c9
 
 
 
 
 
 
 
 
 
 
 
a1e880f
a365e83
a1e880f
 
6eb0f9a
026be51
0244d08
 
026be51
 
 
 
 
 
 
 
 
 
 
 
 
 
dc0dc24
 
68f3fdf
 
026be51
 
 
 
 
 
 
 
 
 
 
 
68f3fdf
 
026be51
 
 
 
 
 
68f3fdf
 
026be51
 
68f3fdf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6311013
 
68f3fdf
 
 
 
 
 
 
 
026be51
 
 
 
 
 
 
 
 
 
 
 
6311013
b51927d
93a2dd2
 
 
f630648
 
 
 
93a2dd2
026be51
6eb0f9a
 
 
 
f1fd61e
 
4d8a2fb
 
a3ec68f
 
 
 
8135c5a
 
8bf46c9
 
 
 
026be51
 
 
 
93a2dd2
 
f630648
 
8c822ea
7a0f2f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
---
license: other
dataset_info:
- config_name: java
  features:
  - name: id
    dtype: int64
  - name: text_id
    dtype: string
  - name: repo_owner
    dtype: string
  - name: repo_name
    dtype: string
  - name: issue_url
    dtype: string
  - name: pull_url
    dtype: string
  - name: comment_url
    dtype: string
  - name: links_count
    dtype: int64
  - name: link_keyword
    dtype: string
  - name: issue_title
    dtype: string
  - name: issue_body
    dtype: string
  - name: base_sha
    dtype: string
  - name: head_sha
    dtype: string
  - name: diff_url
    dtype: string
  - name: diff
    dtype: string
  - name: changed_files
    dtype: string
  - name: changed_files_exts
    dtype: string
  - name: changed_files_count
    dtype: int64
  - name: java_changed_files_count
    dtype: int64
  - name: kt_changed_files_count
    dtype: int64
  - name: py_changed_files_count
    dtype: int64
  - name: code_changed_files_count
    dtype: int64
  - name: repo_symbols_count
    dtype: int64
  - name: repo_tokens_count
    dtype: int64
  - name: repo_lines_count
    dtype: int64
  - name: repo_files_without_tests_count
    dtype: int64
  - name: changed_symbols_count
    dtype: int64
  - name: changed_tokens_count
    dtype: int64
  - name: changed_lines_count
    dtype: int64
  - name: changed_files_without_tests_count
    dtype: int64
  - name: issue_symbols_count
    dtype: int64
  - name: issue_words_count
    dtype: int64
  - name: issue_tokens_count
    dtype: int64
  - name: issue_lines_count
    dtype: int64
  - name: issue_links_count
    dtype: int64
  - name: issue_code_blocks_count
    dtype: int64
  - name: pull_create_at
    dtype: timestamp[s]
  - name: stars
    dtype: int64
  - name: language
    dtype: string
  - name: languages
    dtype: string
  - name: license
    dtype: string
  splits:
  - name: dev
    num_bytes: 22190207
    num_examples: 2522
  - name: test
    num_bytes: 351946.1855670103
    num_examples: 40
  - name: train
    num_bytes: 0.0
    num_examples: 0
  download_size: 7325861
  dataset_size: 22542153.18556701
- config_name: kt
  features:
  - name: id
    dtype: int64
  - name: text_id
    dtype: string
  - name: repo_owner
    dtype: string
  - name: repo_name
    dtype: string
  - name: issue_url
    dtype: string
  - name: pull_url
    dtype: string
  - name: comment_url
    dtype: string
  - name: links_count
    dtype: int64
  - name: link_keyword
    dtype: string
  - name: issue_title
    dtype: string
  - name: issue_body
    dtype: string
  - name: base_sha
    dtype: string
  - name: head_sha
    dtype: string
  - name: diff_url
    dtype: string
  - name: diff
    dtype: string
  - name: changed_files
    dtype: string
  - name: changed_files_exts
    dtype: string
  - name: changed_files_count
    dtype: int64
  - name: java_changed_files_count
    dtype: int64
  - name: kt_changed_files_count
    dtype: int64
  - name: py_changed_files_count
    dtype: int64
  - name: code_changed_files_count
    dtype: int64
  - name: repo_symbols_count
    dtype: int64
  - name: repo_tokens_count
    dtype: int64
  - name: repo_lines_count
    dtype: int64
  - name: repo_files_without_tests_count
    dtype: int64
  - name: changed_symbols_count
    dtype: int64
  - name: changed_tokens_count
    dtype: int64
  - name: changed_lines_count
    dtype: int64
  - name: changed_files_without_tests_count
    dtype: int64
  - name: issue_symbols_count
    dtype: int64
  - name: issue_words_count
    dtype: int64
  - name: issue_tokens_count
    dtype: int64
  - name: issue_lines_count
    dtype: int64
  - name: issue_links_count
    dtype: int64
  - name: issue_code_blocks_count
    dtype: int64
  - name: pull_create_at
    dtype: timestamp[s]
  - name: stars
    dtype: int64
  - name: language
    dtype: string
  - name: languages
    dtype: string
  - name: license
    dtype: string
  splits:
  - name: dev
    num_bytes: 4867349
    num_examples: 618
  - name: test
    num_bytes: 110263.56957928803
    num_examples: 14
  download_size: 1722867
  dataset_size: 4977612.569579288
- config_name: mixed
  features:
  - name: id
    dtype: int64
  - name: text_id
    dtype: string
  - name: repo_owner
    dtype: string
  - name: repo_name
    dtype: string
  - name: issue_url
    dtype: string
  - name: pull_url
    dtype: string
  - name: comment_url
    dtype: string
  - name: links_count
    dtype: int64
  - name: link_keyword
    dtype: string
  - name: issue_title
    dtype: string
  - name: issue_body
    dtype: string
  - name: base_sha
    dtype: string
  - name: head_sha
    dtype: string
  - name: diff_url
    dtype: string
  - name: diff
    dtype: string
  - name: changed_files
    dtype: string
  - name: changed_files_exts
    dtype: string
  - name: changed_files_count
    dtype: int64
  - name: java_changed_files_count
    dtype: int64
  - name: kt_changed_files_count
    dtype: int64
  - name: py_changed_files_count
    dtype: int64
  - name: code_changed_files_count
    dtype: int64
  - name: repo_symbols_count
    dtype: int64
  - name: repo_tokens_count
    dtype: int64
  - name: repo_lines_count
    dtype: int64
  - name: repo_files_without_tests_count
    dtype: int64
  - name: changed_symbols_count
    dtype: int64
  - name: changed_tokens_count
    dtype: int64
  - name: changed_lines_count
    dtype: int64
  - name: changed_files_without_tests_count
    dtype: int64
  - name: issue_symbols_count
    dtype: int64
  - name: issue_words_count
    dtype: int64
  - name: issue_tokens_count
    dtype: int64
  - name: issue_lines_count
    dtype: int64
  - name: issue_links_count
    dtype: int64
  - name: issue_code_blocks_count
    dtype: int64
  - name: pull_create_at
    dtype: timestamp[s]
  - name: stars
    dtype: int64
  - name: language
    dtype: string
  - name: languages
    dtype: string
  - name: license
    dtype: string
  splits:
  - name: dev
    num_bytes: 48686593
    num_examples: 2322
  download_size: 17216309
  dataset_size: 48686593
- config_name: py
  features:
  - name: id
    dtype: int64
  - name: text_id
    dtype: string
  - name: repo_owner
    dtype: string
  - name: repo_name
    dtype: string
  - name: issue_url
    dtype: string
  - name: pull_url
    dtype: string
  - name: comment_url
    dtype: string
  - name: links_count
    dtype: int64
  - name: link_keyword
    dtype: string
  - name: issue_title
    dtype: string
  - name: issue_body
    dtype: string
  - name: base_sha
    dtype: string
  - name: head_sha
    dtype: string
  - name: diff_url
    dtype: string
  - name: diff
    dtype: string
  - name: changed_files
    dtype: string
  - name: changed_files_exts
    dtype: string
  - name: changed_files_count
    dtype: int64
  - name: java_changed_files_count
    dtype: int64
  - name: kt_changed_files_count
    dtype: int64
  - name: py_changed_files_count
    dtype: int64
  - name: code_changed_files_count
    dtype: int64
  - name: repo_symbols_count
    dtype: int64
  - name: repo_tokens_count
    dtype: int64
  - name: repo_lines_count
    dtype: int64
  - name: repo_files_without_tests_count
    dtype: int64
  - name: changed_symbols_count
    dtype: int64
  - name: changed_tokens_count
    dtype: int64
  - name: changed_lines_count
    dtype: int64
  - name: changed_files_without_tests_count
    dtype: int64
  - name: issue_symbols_count
    dtype: int64
  - name: issue_words_count
    dtype: int64
  - name: issue_tokens_count
    dtype: int64
  - name: issue_lines_count
    dtype: int64
  - name: issue_links_count
    dtype: int64
  - name: issue_code_blocks_count
    dtype: int64
  - name: pull_create_at
    dtype: timestamp[s]
  - name: stars
    dtype: int64
  - name: language
    dtype: string
  - name: languages
    dtype: string
  - name: license
    dtype: string
  splits:
  - name: dev
    num_bytes: 26666884
    num_examples: 4339
  - name: test
    num_bytes: 24583.437658446648
    num_examples: 4
  - name: train
    num_bytes: 0.0
    num_examples: 0
  download_size: 9941113
  dataset_size: 26691467.437658448
configs:
- config_name: java
  data_files:
  - split: dev
    path: java/dev-*
  - split: test
    path: java/test-*
  - split: train
    path: java/train-*
- config_name: kt
  data_files:
  - split: dev
    path: kt/dev-*
  - split: test
    path: kt/test-*
- config_name: mixed
  data_files:
  - split: dev
    path: mixed/dev-*
- config_name: py
  data_files:
  - split: dev
    path: py/dev-*
  - split: test
    path: py/test-*
  - split: train
    path: py/train-*
---

# Bug Localization
This is the data for **Bug Localization** benchmark.

## How-to

1. Since the dataset is private, if you haven't used HF Hub before, add your token via `huggingface-cli` first:

    ```
    huggingface-cli login
    ```

2. List all the available configs via [`datasets.get_dataset_config_names`](https://huggingface.co/docs/datasets/v2.14.3/en/package_reference/loading_methods#datasets.get_dataset_config_names) and choose an appropriate one
   

3. Load the data via [`load_dataset`](https://huggingface.co/docs/datasets/v2.14.3/en/package_reference/loading_methods#datasets.load_dataset):

    ```py
    from datasets import load_dataset
    
    # Select a configuration from ["py", "java", "kt", "mixed"]
    configuration = "py"
    # Select a split from ["dev", "train", "test"]
    split = "dev"
    # Load data
    dataset = load_dataset("JetBrains-Research/lca-bug-localization", configuration, split=split)  
    ```

4. Load repos via [`hf_hub_download`](https://huggingface.co/docs/huggingface_hub/v0.20.3/en/package_reference/file_download#huggingface_hub.hf_hub_download)
    ```py
    from huggingface_hub import hf_hub_download
    from datasets import load_dataset

    # Load json with list of repos' .tar.gz file paths
    paths_json = load_dataset("JetBrains-Research/lca-bug-localization", data_files="paths.json")

    # Load each repo in .tar.gz format, unzip, delete archive
    repos = paths_json["repos"][0]

    for i, repo_tar_path in enumerate(repos):
  
        local_repo_tars = hf_hub_download(
            "JetBrains-Research/lca-bug-localization",
            filename=repo_tar_path,
            repo_type="dataset",
            local_dir="local/dir"
        )

        result = subprocess.run(["tar", "-xzf", local_repo_tars, "-C", os.path.join("local/dir", "repos")])
        os.remove(local_repo_tars)
   ```

## Dataset Structure

TODO: some overall structure or repo

### Bug localization data

This section concerns configuration with *full data* about each commit (no `-labels` suffix).

Each example has the following fields:

|     **Field**      |             **Description**              |
|:------------------:|:----------------------------------------:|
|    `repo_owner`    |            Bug issue repository owner.            |
|    `repo_name`    |            Bug issue repository name.            |
|    `issue_url`      |       GitHub link to issue <br> `https://github.com/{repo_owner}/{repo_name}/issues/{issue_id}`.       |
|    `pull_url`      |       GitHub link to pull request <br> `https://github.com/{repo_owner}/{repo_name}/pull/{pull_id}`.       |
|    `comment_url`      |       GitHub link to comment with pull request to issue reference <br> `https://github.com/{repo_owner}/{repo_name}/pull/{pull_id}#issuecomment-{comment_id}`.       |
|    `issue_title`       | Issue title.  |
|    `issue_body`       | Issue body.  |
|    `base_sha`       | Pull request base sha.  |
|    `head_sha`        | Pull request head sha.  |
|    `diff_url`        | Pull request diff url between base and head sha <br> `https://github.com/{repo_owner}/{repo_name}/compare/{base_sha}...{head_sha}`.  |
|    `diff`       | Pull request diff content.  |
|    `changed_files`       | List of changed files parsed from diff.  |
|    `changed_files_exts`       | Dict from changed files extension to count.  |
|    `changed_files_count`       | Number of changed files.  |
|    `java_changed_files_count`       | Number of changed `.java` files.  |
|    `kt_changed_files_count`       | Number of changed `.kt` files.  |
|    `py_changed_files_count`       | Number of changed `.py` files.  |
|    `code_changed_files_count`       | Number of changed `.java`, `.kt` or `.py` files. |
|    `pull_create_at`       | Data of pull request creation in format yyyy-mm-ddThh:mm:ssZ.  |
|    `stars`       | Number of repo stars.  |

### Repos data

TODO: describe repos data as `.tar.gz` archives with list of repos metadata