ksych's picture
Update README.md (#3)
b2dd445 verified
metadata
dataset_info:
  features:
    - name: commit
      dtype: string
    - name: old_file
      dtype: string
    - name: new_file
      dtype: string
    - name: old_contents
      dtype: string
    - name: new_contents
      dtype: string
    - name: subject
      dtype: string
    - name: message
      dtype: string
    - name: lang
      dtype: string
    - name: license
      dtype: string
    - name: repos
      dtype: string
    - name: ndiff
      dtype: string
    - name: instruction
      dtype: string
    - name: content
      dtype: string
    - name: fuzzy_diff
      dtype: string
  splits:
    - name: train
      num_bytes: 176459498.90708563
      num_examples: 32083
    - name: test
      num_bytes: 9426642.793987622
      num_examples: 1700
  download_size: 81985479
  dataset_size: 185886141.70107326
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*
      - split: test
        path: data/test-*

Code Apply

Processed EditPackFT with fuzzy diff generated using heuristics for Python language.

Columns

  1. old_contents the old code
  2. new_contents the new code
  3. fuzzy_diff the code segment extracted from diff between old_contents and new_contents

Augmentation

Examples with number of diff chunks > 1 were duplicated. Old contents have one of the diff chunks applied.

Example

Diff

  from kombu import BrokerConnection
  from kombu.common import maybe_declare
  from kombu.pools import producers
  
  from sentry.conf import settings
  from sentry.queue.queues import task_queues, task_exchange
  
  
  class Broker(object):
      def __init__(self, config):
          self.connection = BrokerConnection(**config)
+         with producers[self.connection].acquire(block=False) as producer:
+             for queue in task_queues:
+                 maybe_declare(queue, producer.channel)
  
      def delay(self, func, *args, **kwargs):
          payload = {
              "func": func,
              "args": args,
              "kwargs": kwargs,
          }
  
          with producers[self.connection].acquire(block=False) as producer:
-             for queue in task_queues:
-                 maybe_declare(queue, producer.channel)
              producer.publish(payload,
                  exchange=task_exchange,
                  serializer="pickle",
                  compression="bzip2",
                  queue='default',
                  routing_key='default',
              )
  
  broker = Broker(settings.QUEUE)

Snippet

# ... existing code ... 


        self.connection = BrokerConnection(**config)
        with producers[self.connection].acquire(block=False) as producer:
            for queue in task_queues:
                maybe_declare(queue, producer.channel)

    def delay(self, func, *args, **kwargs):


# ... modified code ... 


        with producers[self.connection].acquire(block=False) as producer:
            producer.publish(payload,
                exchange=task_exchange,


# ... rest of the code ...

Partial apply

from kombu import BrokerConnection
from kombu.common import maybe_declare
from kombu.pools import producers

from sentry.conf import settings
from sentry.queue.queues import task_queues, task_exchange


class Broker(object):
    def __init__(self, config):
        self.connection = BrokerConnection(**config)
        with producers[self.connection].acquire(block=False) as producer:
            for queue in task_queues:
                maybe_declare(queue, producer.channel)

    def delay(self, func, *args, **kwargs):
        payload = {
            "func": func,
            "args": args,
            "kwargs": kwargs,
        }

        with producers[self.connection].acquire(block=False) as producer:
            for queue in task_queues:
                maybe_declare(queue, producer.channel)
            producer.publish(payload,
                exchange=task_exchange,
                serializer="pickle",
                compression="bzip2",
                queue='default',
                routing_key='default',
            )

broker = Broker(settings.QUEUE)