Create README.md
#1
by
bzz2
- opened
README.md
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
dataset_info:
|
3 |
+
features:
|
4 |
+
- name: commit
|
5 |
+
dtype: string
|
6 |
+
- name: old_file
|
7 |
+
dtype: string
|
8 |
+
- name: new_file
|
9 |
+
dtype: string
|
10 |
+
- name: old_contents
|
11 |
+
dtype: string
|
12 |
+
- name: new_contents
|
13 |
+
dtype: string
|
14 |
+
- name: subject
|
15 |
+
dtype: string
|
16 |
+
- name: message
|
17 |
+
dtype: string
|
18 |
+
- name: lang
|
19 |
+
dtype: string
|
20 |
+
- name: license
|
21 |
+
dtype: string
|
22 |
+
- name: repos
|
23 |
+
dtype: string
|
24 |
+
- name: ndiff
|
25 |
+
dtype: string
|
26 |
+
- name: instruction
|
27 |
+
dtype: string
|
28 |
+
- name: content
|
29 |
+
dtype: string
|
30 |
+
- name: fuzzy_diff
|
31 |
+
dtype: string
|
32 |
+
splits:
|
33 |
+
- name: train
|
34 |
+
num_bytes: 176459498.90708563
|
35 |
+
num_examples: 32083
|
36 |
+
- name: test
|
37 |
+
num_bytes: 9426642.793987622
|
38 |
+
num_examples: 1700
|
39 |
+
download_size: 81985479
|
40 |
+
dataset_size: 185886141.70107326
|
41 |
+
configs:
|
42 |
+
- config_name: default
|
43 |
+
data_files:
|
44 |
+
- split: train
|
45 |
+
path: data/train-*
|
46 |
+
- split: test
|
47 |
+
path: data/test-*
|
48 |
+
---
|
49 |
+
|
50 |
+
# Code Apply
|
51 |
+
Processed [EditPackFT](https://huggingface.co/datasets/nuprl/EditPackFT/blob/main/README.md) with `fuzzy diff` generated using heuristics for multiple languages (Python, C, Java and Kotlin). <br>
|
52 |
+
|
53 |
+
## Columns
|
54 |
+
1. `old_contents` the old code
|
55 |
+
2. `new_contents` the new code
|
56 |
+
3. `fuzzy_diff` the code segment extracted from diff between `old_contents` and `new_contents`
|
57 |
+
|
58 |
+
## Augmentation
|
59 |
+
Examples with number of diff chunks > 1 were duplicated. Old contents have one of the diff chunks applied.
|
60 |
+
|
61 |
+
## Example
|
62 |
+
### Diff
|
63 |
+
|
64 |
+
```python
|
65 |
+
from kombu import BrokerConnection
|
66 |
+
from kombu.common import maybe_declare
|
67 |
+
from kombu.pools import producers
|
68 |
+
|
69 |
+
from sentry.conf import settings
|
70 |
+
from sentry.queue.queues import task_queues, task_exchange
|
71 |
+
|
72 |
+
|
73 |
+
class Broker(object):
|
74 |
+
def __init__(self, config):
|
75 |
+
self.connection = BrokerConnection(**config)
|
76 |
+
+ with producers[self.connection].acquire(block=False) as producer:
|
77 |
+
+ for queue in task_queues:
|
78 |
+
+ maybe_declare(queue, producer.channel)
|
79 |
+
|
80 |
+
def delay(self, func, *args, **kwargs):
|
81 |
+
payload = {
|
82 |
+
"func": func,
|
83 |
+
"args": args,
|
84 |
+
"kwargs": kwargs,
|
85 |
+
}
|
86 |
+
|
87 |
+
with producers[self.connection].acquire(block=False) as producer:
|
88 |
+
- for queue in task_queues:
|
89 |
+
- maybe_declare(queue, producer.channel)
|
90 |
+
producer.publish(payload,
|
91 |
+
exchange=task_exchange,
|
92 |
+
serializer="pickle",
|
93 |
+
compression="bzip2",
|
94 |
+
queue='default',
|
95 |
+
routing_key='default',
|
96 |
+
)
|
97 |
+
|
98 |
+
broker = Broker(settings.QUEUE)
|
99 |
+
```
|
100 |
+
|
101 |
+
### Snippet
|
102 |
+
```python
|
103 |
+
# ... existing code ...
|
104 |
+
|
105 |
+
|
106 |
+
self.connection = BrokerConnection(**config)
|
107 |
+
with producers[self.connection].acquire(block=False) as producer:
|
108 |
+
for queue in task_queues:
|
109 |
+
maybe_declare(queue, producer.channel)
|
110 |
+
|
111 |
+
def delay(self, func, *args, **kwargs):
|
112 |
+
|
113 |
+
|
114 |
+
# ... modified code ...
|
115 |
+
|
116 |
+
|
117 |
+
with producers[self.connection].acquire(block=False) as producer:
|
118 |
+
producer.publish(payload,
|
119 |
+
exchange=task_exchange,
|
120 |
+
|
121 |
+
|
122 |
+
# ... rest of the code ...
|
123 |
+
```
|
124 |
+
|
125 |
+
### Partial apply
|
126 |
+
```python
|
127 |
+
from kombu import BrokerConnection
|
128 |
+
from kombu.common import maybe_declare
|
129 |
+
from kombu.pools import producers
|
130 |
+
|
131 |
+
from sentry.conf import settings
|
132 |
+
from sentry.queue.queues import task_queues, task_exchange
|
133 |
+
|
134 |
+
|
135 |
+
class Broker(object):
|
136 |
+
def __init__(self, config):
|
137 |
+
self.connection = BrokerConnection(**config)
|
138 |
+
with producers[self.connection].acquire(block=False) as producer:
|
139 |
+
for queue in task_queues:
|
140 |
+
maybe_declare(queue, producer.channel)
|
141 |
+
|
142 |
+
def delay(self, func, *args, **kwargs):
|
143 |
+
payload = {
|
144 |
+
"func": func,
|
145 |
+
"args": args,
|
146 |
+
"kwargs": kwargs,
|
147 |
+
}
|
148 |
+
|
149 |
+
with producers[self.connection].acquire(block=False) as producer:
|
150 |
+
for queue in task_queues:
|
151 |
+
maybe_declare(queue, producer.channel)
|
152 |
+
producer.publish(payload,
|
153 |
+
exchange=task_exchange,
|
154 |
+
serializer="pickle",
|
155 |
+
compression="bzip2",
|
156 |
+
queue='default',
|
157 |
+
routing_key='default',
|
158 |
+
)
|
159 |
+
|
160 |
+
broker = Broker(settings.QUEUE)
|
161 |
+
```
|