Dataset Viewer
Auto-converted to Parquet Duplicate
commit
stringlengths
40
40
old_file
stringlengths
4
234
new_file
stringlengths
4
234
old_contents
stringlengths
10
3.01k
new_contents
stringlengths
19
3.38k
subject
stringlengths
16
736
message
stringlengths
17
2.63k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
82.6k
config
stringclasses
4 values
content
stringlengths
134
4.41k
fuzzy_diff
stringlengths
29
3.44k
7a3772437d9e2250fface932d65fda664ae4e7f2
app/src/main/java/com/x1unix/avi/rest/KPApiInterface.java
app/src/main/java/com/x1unix/avi/rest/KPApiInterface.java
package com.x1unix.avi.rest; import com.x1unix.avi.model.KPMovie; import com.x1unix.avi.model.KPSearchResponse; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Path; import retrofit2.http.Query; public interface KPApiInterface { @GET("getKPSearchInFilms") ...
package com.x1unix.avi.rest; import com.x1unix.avi.model.KPMovie; import com.x1unix.avi.model.KPSearchResponse; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Path; import retrofit2.http.Query; public interface KPApiInterface { @GET("getKPSearchInFilms") ...
Use internal KP method for movie details
Use internal KP method for movie details
Java
bsd-3-clause
odin3/Avi,odin3/Avi,odin3/Avi
java
## Code Before: package com.x1unix.avi.rest; import com.x1unix.avi.model.KPMovie; import com.x1unix.avi.model.KPSearchResponse; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Path; import retrofit2.http.Query; public interface KPApiInterface { @GET("getKPSea...
// ... existing code ... @GET("getKPSearchInFilms") Call<KPSearchResponse> findMovies(@Query("keyword") String keyword); @GET("getKPFilmDetailView") Call<KPMovie> getMovieById(@Query("filmID") String filmId); } // ... rest of the code ...
4b16ef27769403b56516233622505b822f7572d5
src/codechicken/lib/render/PlaceholderTexture.java
src/codechicken/lib/render/PlaceholderTexture.java
package codechicken.lib.render; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.IResourceManager; import net.minecraft.util.ResourceLocation; public class PlaceholderTexture extends TextureAtlasSprite { protected PlaceholderTexture(String par1) { ...
package codechicken.lib.render; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.IResourceManager; import net.minecraft.util.ResourceLocation; public class PlaceholderTexture extends TextureAtlasSprite { protected PlaceholderTexture(String par1) { supe...
Fix texture not found exceptions in console when using placeholder texture
Fix texture not found exceptions in console when using placeholder texture
Java
lgpl-2.1
KJ4IPS/CodeChickenLib,alexbegt/CodeChickenLib,TheCBProject/CodeChickenLib,Chicken-Bones/CodeChickenLib
java
## Code Before: package codechicken.lib.render; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.IResourceManager; import net.minecraft.util.ResourceLocation; public class PlaceholderTexture extends TextureAtlasSprite { protected PlaceholderTexture(String par1...
... public class PlaceholderTexture extends TextureAtlasSprite { protected PlaceholderTexture(String par1) { super(par1); } @Override public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location) { return true; } @Override public boolean load(IRes...
2c73a41ab78b41da7b6f2ccbd16140fa701d74f2
gunicorn/app/wsgiapp.py
gunicorn/app/wsgiapp.py
import os import sys import traceback from gunicorn import util from gunicorn.app.base import Application class WSGIApplication(Application): def init(self, parser, opts, args): if len(args) != 1: parser.error("No application module specified.") self.cfg.set("default_proc_name",...
import os import sys import traceback from gunicorn import util from gunicorn.app.base import Application class WSGIApplication(Application): def init(self, parser, opts, args): if len(args) != 1: parser.error("No application module specified.") self.cfg.set("default_proc_name",...
Load wsgi apps after reading the configuration.
Load wsgi apps after reading the configuration.
Python
mit
WSDC-NITWarangal/gunicorn,wong2/gunicorn,ccl0326/gunicorn,ephes/gunicorn,tempbottle/gunicorn,zhoucen/gunicorn,prezi/gunicorn,urbaniak/gunicorn,wong2/gunicorn,jamesblunt/gunicorn,gtrdotmcs/gunicorn,alex/gunicorn,keakon/gunicorn,jamesblunt/gunicorn,jamesblunt/gunicorn,gtrdotmcs/gunicorn,1stvamp/gunicorn,elelianghh/gunico...
python
## Code Before: import os import sys import traceback from gunicorn import util from gunicorn.app.base import Application class WSGIApplication(Application): def init(self, parser, opts, args): if len(args) != 1: parser.error("No application module specified.") self.cfg.set("def...
// ... existing code ... self.app_uri = args[0] sys.path.insert(0, os.getcwd()) def load(self): try: return util.import_app(self.app_uri) except: print "Failed to import application: %s" % self.app_uri traceback.print_exc() sys.exi...
8a8b152566b92cfe0ccbc379b9871da795cd4b5b
keystoneclient/hacking/checks.py
keystoneclient/hacking/checks.py
import re def check_oslo_namespace_imports(logical_line, blank_before, filename): oslo_namespace_imports = re.compile( r"(((from)|(import))\s+oslo\." "((config)|(serialization)|(utils)|(i18n)))|" "(from\s+oslo\s+import\s+((config)|(serialization)|(utils)|(i18n)))") if re.match(oslo_...
import re def check_oslo_namespace_imports(logical_line, blank_before, filename): oslo_namespace_imports = re.compile( r"(((from)|(import))\s+oslo\.)|(from\s+oslo\s+import\s+)") if re.match(oslo_namespace_imports, logical_line): msg = ("K333: '%s' must be used instead of '%s'.") % ( ...
Change hacking check to verify all oslo imports
Change hacking check to verify all oslo imports The hacking check was verifying that specific oslo imports weren't using the oslo-namespaced package. Since all the oslo libraries used by keystoneclient are now changed to use the new package name the hacking check can be simplified. bp drop-namespace-packages Change-...
Python
apache-2.0
jamielennox/keystoneauth,citrix-openstack-build/keystoneauth,sileht/keystoneauth
python
## Code Before: import re def check_oslo_namespace_imports(logical_line, blank_before, filename): oslo_namespace_imports = re.compile( r"(((from)|(import))\s+oslo\." "((config)|(serialization)|(utils)|(i18n)))|" "(from\s+oslo\s+import\s+((config)|(serialization)|(utils)|(i18n)))") i...
... def check_oslo_namespace_imports(logical_line, blank_before, filename): oslo_namespace_imports = re.compile( r"(((from)|(import))\s+oslo\.)|(from\s+oslo\s+import\s+)") if re.match(oslo_namespace_imports, logical_line): msg = ("K333: '%s' must be used instead of '%s'.") % ( ...
d7c4f0471271d104c0ff3500033e425547ca6c27
notification/context_processors.py
notification/context_processors.py
from notification.models import Notice def notification(request): if request.user.is_authenticated(): return { "notice_unseen_count": Notice.objects.unseen_count_for(request.user, on_site=True), } else: return {}
from notification.models import Notice def notification(request): if request.user.is_authenticated(): return { "notice_unseen_count": Notice.objects.unseen_count_for(request.user, on_site=True), "notifications": Notice.objects.filter(user=request.user.id) } else: ...
Add user notifications to context processor
Add user notifications to context processor
Python
mit
affan2/django-notification,affan2/django-notification
python
## Code Before: from notification.models import Notice def notification(request): if request.user.is_authenticated(): return { "notice_unseen_count": Notice.objects.unseen_count_for(request.user, on_site=True), } else: return {} ## Instruction: Add user notifications to con...
# ... existing code ... if request.user.is_authenticated(): return { "notice_unseen_count": Notice.objects.unseen_count_for(request.user, on_site=True), "notifications": Notice.objects.filter(user=request.user.id) } else: return {} # ... rest of the code ...
9672bd20203bc4235910080cca6d79c3b8e126b1
nupic/research/frameworks/dendrites/modules/__init__.py
nupic/research/frameworks/dendrites/modules/__init__.py
from .apply_dendrites import * from .boosted_dendrites import * from .dendrite_segments import DendriteSegments from .dendritic_layers import ( AbsoluteMaxGatingDendriticLayer, AbsoluteMaxGatingDendriticLayer2d, BiasingDendriticLayer, GatingDendriticLayer, GatingDendriticLayer2d, )
from .apply_dendrites import * from .boosted_dendrites import * from .dendrite_segments import DendriteSegments from .dendritic_layers import ( AbsoluteMaxGatingDendriticLayer, AbsoluteMaxGatingDendriticLayer2d, BiasingDendriticLayer, GatingDendriticLayer, GatingDendriticLayer2d, DendriticLayer...
Add DendriticLayerBase to init to ease experimentation
Add DendriticLayerBase to init to ease experimentation
Python
agpl-3.0
mrcslws/nupic.research,subutai/nupic.research,numenta/nupic.research,subutai/nupic.research,numenta/nupic.research,mrcslws/nupic.research
python
## Code Before: from .apply_dendrites import * from .boosted_dendrites import * from .dendrite_segments import DendriteSegments from .dendritic_layers import ( AbsoluteMaxGatingDendriticLayer, AbsoluteMaxGatingDendriticLayer2d, BiasingDendriticLayer, GatingDendriticLayer, GatingDendriticLayer2d, ) ...
// ... existing code ... BiasingDendriticLayer, GatingDendriticLayer, GatingDendriticLayer2d, DendriticLayerBase, ) // ... rest of the code ...
1b4e7ebd4aaa7f506789a112a9338667e955954f
django_git/views.py
django_git/views.py
from pygments import highlight from pygments.lexers import guess_lexer_for_filename from pygments.formatters import HtmlFormatter from django.http import HttpResponse from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404 from django.template import RequestContext from django_git.utils im...
from pygments import highlight from pygments.lexers import guess_lexer_for_filename from pygments.formatters import HtmlFormatter from django.http import HttpResponse from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404 from django.template import RequestContext from django_git.utils im...
Add newline to end of file
Add newline to end of file Signed-off-by: Seth Buntin <7fa3258757ee476d85f026594ec3f1563305da2c@gmail.com>
Python
bsd-3-clause
sethtrain/django-git,sethtrain/django-git
python
## Code Before: from pygments import highlight from pygments.lexers import guess_lexer_for_filename from pygments.formatters import HtmlFormatter from django.http import HttpResponse from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404 from django.template import RequestContext from dja...
# ... existing code ... return render_to_response(template_name, {'repo': get_repo(repo)}, context_instance=RequestContext(request)) def commit(request, repo, commit, template_name='django_git/commit.html'): print repo, commit return render_to_response(template_name, {'diffs': get_commit(repo, commit).d...
00922099d6abb03a0dbcca19781eb586d367eab0
skimage/measure/__init__.py
skimage/measure/__init__.py
from .find_contours import find_contours from ._regionprops import regionprops from .find_contours import find_contours from ._structural_similarity import ssim
from .find_contours import find_contours from ._regionprops import regionprops from ._structural_similarity import ssim
Remove double import of find contours.
BUG: Remove double import of find contours.
Python
bsd-3-clause
robintw/scikit-image,WarrenWeckesser/scikits-image,ofgulban/scikit-image,ajaybhat/scikit-image,rjeli/scikit-image,SamHames/scikit-image,chintak/scikit-image,ofgulban/scikit-image,SamHames/scikit-image,dpshelio/scikit-image,chintak/scikit-image,rjeli/scikit-image,oew1v07/scikit-image,almarklein/scikit-image,pratapvardha...
python
## Code Before: from .find_contours import find_contours from ._regionprops import regionprops from .find_contours import find_contours from ._structural_similarity import ssim ## Instruction: BUG: Remove double import of find contours. ## Code After: from .find_contours import find_contours from ._regionprops import...
# ... existing code ... from .find_contours import find_contours from ._regionprops import regionprops from ._structural_similarity import ssim # ... rest of the code ...
cb048cc483754b003d70844ae99a4c512d35d2ee
setup.py
setup.py
from setuptools import setup, find_packages setup( name='regressive-imagery-dictionary', version='0.1.7', url='https://github.com/jefftriplett/rid.py', license='MIT', description='The Regressive Imagery Dictionary (RID) is a coding scheme for text analysis that is designed to measure "primordial" ...
from setuptools import setup, find_packages setup( name='regressive-imagery-dictionary', version='0.1.7', url='https://github.com/jefftriplett/rid.py', license='MIT', description='The Regressive Imagery Dictionary (RID) is a coding scheme for text analysis that is designed to measure "primordial" ...
Fix for missing author info
Fix for missing author info
Python
mit
jefftriplett/rid.py
python
## Code Before: from setuptools import setup, find_packages setup( name='regressive-imagery-dictionary', version='0.1.7', url='https://github.com/jefftriplett/rid.py', license='MIT', description='The Regressive Imagery Dictionary (RID) is a coding scheme for text analysis that is designed to measu...
# ... existing code ... license='MIT', description='The Regressive Imagery Dictionary (RID) is a coding scheme for text analysis that is designed to measure "primordial" and conceptual content.', long_description=__doc__, maintainer='Jeff Triplett', maintainer_email='jeff.triplett@gmail.com', ...
b4e106271f96b083644b27d313ad80c240fcb0a5
gapipy/resources/booking/booking.py
gapipy/resources/booking/booking.py
from __future__ import unicode_literals from gapipy.resources.checkin import Checkin from ..base import Resource from .transaction import Payment, Refund from .document import Invoice, Document from .override import Override from .service import Service class Booking(Resource): _resource_name = 'bookings' _...
from __future__ import unicode_literals from gapipy.resources.checkin import Checkin from ..base import Resource from .agency_chain import AgencyChain from .document import Invoice, Document from .override import Override from .service import Service from .transaction import Payment, Refund class Booking(Resource):...
Add agency chain to Booking
Add agency chain to Booking
Python
mit
gadventures/gapipy
python
## Code Before: from __future__ import unicode_literals from gapipy.resources.checkin import Checkin from ..base import Resource from .transaction import Payment, Refund from .document import Invoice, Document from .override import Override from .service import Service class Booking(Resource): _resource_name = ...
# ... existing code ... from gapipy.resources.checkin import Checkin from ..base import Resource from .agency_chain import AgencyChain from .document import Invoice, Document from .override import Override from .service import Service from .transaction import Payment, Refund class Booking(Resource): # ... modif...
3ad4a7f564acc9e653d57c6a6bbbd10bbc87ea01
src/com/haxademic/core/image/filters/shaders/ChromaColorFilter.java
src/com/haxademic/core/image/filters/shaders/ChromaColorFilter.java
package com.haxademic.core.image.filters.shaders; import processing.core.PApplet; public class ChromaColorFilter extends BaseFilter { public static ChromaColorFilter instance; public ChromaColorFilter(PApplet p) { super(p, "shaders/filters/chroma-color.glsl"); setThresholdSensitivity(0.1f); setSmoothing(0....
package com.haxademic.core.image.filters.shaders; import processing.core.PApplet; public class ChromaColorFilter extends BaseFilter { public static ChromaColorFilter instance; public ChromaColorFilter(PApplet p) { super(p, "shaders/filters/chroma-color.glsl"); setThresholdSensitivity(0.1f); setSmoothing(0....
Add a couple of chrome presets
Add a couple of chrome presets
Java
mit
cacheflowe/haxademic,cacheflowe/haxademic,cacheflowe/haxademic,cacheflowe/haxademic,cacheflowe/haxademic,cacheflowe/haxademic
java
## Code Before: package com.haxademic.core.image.filters.shaders; import processing.core.PApplet; public class ChromaColorFilter extends BaseFilter { public static ChromaColorFilter instance; public ChromaColorFilter(PApplet p) { super(p, "shaders/filters/chroma-color.glsl"); setThresholdSensitivity(0.1f); ...
# ... existing code ... shader.set("colorToReplace", colorToReplaceR, colorToReplaceG, colorToReplaceB); } public void presetGreenScreen() { setThresholdSensitivity(0.73f); setSmoothing(0.08f); setColorToReplace(0.71f, 0.99f, 0.02f); } public void presetBlackKnockout() { setThresholdSensitivity(0.2...
3a0cf1f6114d6c80909f90fe122b026908200b0a
IPython/nbconvert/exporters/markdown.py
IPython/nbconvert/exporters/markdown.py
"""Markdown Exporter class""" #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #---------------...
"""Markdown Exporter class""" #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #---------------...
Revert "Removed Javascript from Markdown by adding display priority to def config."
Revert "Removed Javascript from Markdown by adding display priority to def config." This reverts commit 58e05f9625c60f8deba9ddf1c74dba73e8ea7dd1.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
python
## Code Before: """Markdown Exporter class""" #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. ...
... @property def default_config(self): c = Config({'ExtractOutputPreprocessor':{'enabled':True}}) c.merge(super(MarkdownExporter,self).default_config) return c ...
41021611b9bccbc524ababfab256fe7d7f28cf1c
src/lib/ems_server.c
src/lib/ems_server.c
/*============================================================================* * Local * *============================================================================*/ /*===========================================================================...
/*============================================================================* * Local * *============================================================================*/ Azy_Server *_serv; /*=======================================================...
Use azy_server_run as a replacement for ecore_main_loop_begin
Use azy_server_run as a replacement for ecore_main_loop_begin
C
bsd-2-clause
enna-project/Enna-Media-Server,raoulh/Enna-Media-Server,enna-project/Enna-Media-Server,raoulh/Enna-Media-Server,enna-project/Enna-Media-Server,enna-project/Enna-Media-Server,raoulh/Enna-Media-Server,enna-project/Enna-Media-Server,raoulh/Enna-Media-Server,raoulh/Enna-Media-Server
c
## Code Before: /*============================================================================* * Local * *============================================================================*/ /*===========================================================...
... /*============================================================================* * Local * *============================================================================*/ Azy_Server *_serv; /*===============================================...
14c88194d67dc600fec3645b0b1e8d52cf0eacf6
app/src/main/java/org/wikipedia/page/PageAvailableOfflineHandler.kt
app/src/main/java/org/wikipedia/page/PageAvailableOfflineHandler.kt
package org.wikipedia.page import android.annotation.SuppressLint import kotlinx.coroutines.* import org.wikipedia.WikipediaApp import org.wikipedia.readinglist.database.ReadingListDbHelper import org.wikipedia.readinglist.database.ReadingListPage import org.wikipedia.util.log.L object PageAvailableOfflineHandler { ...
package org.wikipedia.page import android.annotation.SuppressLint import kotlinx.coroutines.* import org.wikipedia.WikipediaApp import org.wikipedia.readinglist.database.ReadingListDbHelper import org.wikipedia.readinglist.database.ReadingListPage import org.wikipedia.util.log.L object PageAvailableOfflineHandler { ...
Fix possible crash if cannot find any reading list
Fix possible crash if cannot find any reading list
Kotlin
apache-2.0
dbrant/apps-android-wikipedia,dbrant/apps-android-wikipedia,dbrant/apps-android-wikipedia,wikimedia/apps-android-wikipedia,wikimedia/apps-android-wikipedia,dbrant/apps-android-wikipedia,wikimedia/apps-android-wikipedia,dbrant/apps-android-wikipedia,wikimedia/apps-android-wikipedia
kotlin
## Code Before: package org.wikipedia.page import android.annotation.SuppressLint import kotlinx.coroutines.* import org.wikipedia.WikipediaApp import org.wikipedia.readinglist.database.ReadingListDbHelper import org.wikipedia.readinglist.database.ReadingListPage import org.wikipedia.util.log.L object PageAvailableOf...
// ... existing code ... } }) { val readingListPage = withContext(Dispatchers.IO) { ReadingListDbHelper.instance().findPageInAnyList(pageTitle) } callback.onFinish(readingListPage != null && readingListPage.offline() && !readingListPage.saving()) } } } // ......
2a42a82d72d8bfbf11b605002bc4781fee320ea3
setup.py
setup.py
import sys try: from setuptools import setup except ImportError: from distutils import setup if sys.version_info[0] == 2: base_dir = 'python2' elif sys.version_info[0] == 3: base_dir = 'python3' readme = open('README.rst', 'r') README_TEXT = readme.read() readme.close() setup( name='aniso8601', ...
import sys try: from setuptools import setup except ImportError: from distutils import setup if sys.version_info[0] == 2: base_dir = 'python2' elif sys.version_info[0] == 3: base_dir = 'python3' readme = open('README.rst', 'r') README_TEXT = readme.read() readme.close() setup( name='aniso8601', ...
Add python2 specifically to classifier list.
Add python2 specifically to classifier list.
Python
bsd-3-clause
3stack-software/python-aniso8601-relativedelta
python
## Code Before: import sys try: from setuptools import setup except ImportError: from distutils import setup if sys.version_info[0] == 2: base_dir = 'python2' elif sys.version_info[0] == 3: base_dir = 'python3' readme = open('README.rst', 'r') README_TEXT = readme.read() readme.close() setup( na...
// ... existing code ... 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', 'Topic :: Software Development :: Libraries :: Pytho...
27d7ab7ecca0d2e6307dbcb1317b486fe77a97d7
cyder/core/system/models.py
cyder/core/system/models.py
from django.db import models from cyder.base.mixins import ObjectUrlMixin from cyder.base.models import BaseModel from cyder.cydhcp.keyvalue.models import KeyValue class System(BaseModel, ObjectUrlMixin): name = models.CharField(max_length=255, unique=False) search_fields = ('name',) display_fields = ('...
from django.db import models from cyder.base.mixins import ObjectUrlMixin from cyder.base.models import BaseModel from cyder.base.helpers import get_display from cyder.cydhcp.keyvalue.models import KeyValue class System(BaseModel, ObjectUrlMixin): name = models.CharField(max_length=255, unique=False) search...
Revert system names to normal
Revert system names to normal
Python
bsd-3-clause
drkitty/cyder,OSU-Net/cyder,drkitty/cyder,murrown/cyder,zeeman/cyder,OSU-Net/cyder,zeeman/cyder,murrown/cyder,akeym/cyder,akeym/cyder,akeym/cyder,zeeman/cyder,drkitty/cyder,OSU-Net/cyder,zeeman/cyder,murrown/cyder,akeym/cyder,murrown/cyder,drkitty/cyder,OSU-Net/cyder
python
## Code Before: from django.db import models from cyder.base.mixins import ObjectUrlMixin from cyder.base.models import BaseModel from cyder.cydhcp.keyvalue.models import KeyValue class System(BaseModel, ObjectUrlMixin): name = models.CharField(max_length=255, unique=False) search_fields = ('name',) dis...
# ... existing code ... from cyder.base.mixins import ObjectUrlMixin from cyder.base.models import BaseModel from cyder.base.helpers import get_display from cyder.cydhcp.keyvalue.models import KeyValue # ... modified code ... name = models.CharField(max_length=255, unique=False) search_fields = ('na...
48b63d01d00c791088b24057751ed1de79811964
src/com/openxc/measurements/ClimateMode.java
src/com/openxc/measurements/ClimateMode.java
package com.openxc.measurements; import java.util.Locale; import com.openxc.units.State; /** * The ClimateMode measurement is used to start the AC/Heater/Fan */ public class ClimateMode extends BaseMeasurement<State<ClimateMode.ClimateControls>> { public final static String ID = "climate_mode"; public enum C...
package com.openxc.measurements; import java.util.Locale; import com.openxc.units.State; /** * The ClimateMode measurement is used to start the AC/Heater/Fan */ public class ClimateMode extends BaseMeasurement<State<ClimateMode.ClimateControls>> { public final static String ID = "climate_mode"; public enum C...
Remove int enum values, as they are unneeded
Remove int enum values, as they are unneeded
Java
bsd-3-clause
openxc/nonstandard-android-measurements,openxc/nonstandard-android-measurements
java
## Code Before: package com.openxc.measurements; import java.util.Locale; import com.openxc.units.State; /** * The ClimateMode measurement is used to start the AC/Heater/Fan */ public class ClimateMode extends BaseMeasurement<State<ClimateMode.ClimateControls>> { public final static String ID = "climate_mode"; ...
# ... existing code ... public final static String ID = "climate_mode"; public enum ClimateControls { OFF, PANEL_VENT, PANEL_FLOOR, FLOOR, FAN_SPEED_INCREMENT, FAN_SPEED_DECREMENT, AUTO, MAX_AC, RECIRCULATION, FRONT_DEFROST, REAR_DEFROST, MAX_DEFROST } public ClimateMode(State<ClimateC...
4a425b414d62d42d28ecd6eefd7bfaa84dd7b710
wow-attendance/src/main/java/ru/faulab/attendence/Runner.java
wow-attendance/src/main/java/ru/faulab/attendence/Runner.java
package ru.faulab.attendence; import com.google.inject.Guice; import com.google.inject.Injector; import ru.faulab.attendence.module.MainModule; import ru.faulab.attendence.ui.MainFrame; public class Runner { /* * 1. Статистика * */ public static void main(String[] args) throws Exception {...
package ru.faulab.attendence; import com.google.inject.Guice; import com.google.inject.Injector; import ru.faulab.attendence.module.MainModule; import ru.faulab.attendence.ui.MainFrame; import javax.swing.*; public class Runner { /* * 1. Статистика * */ public static void main(String[]...
Set UI as best on OS
Set UI as best on OS
Java
apache-2.0
anton-tregubov/wow-attendance
java
## Code Before: package ru.faulab.attendence; import com.google.inject.Guice; import com.google.inject.Injector; import ru.faulab.attendence.module.MainModule; import ru.faulab.attendence.ui.MainFrame; public class Runner { /* * 1. Статистика * */ public static void main(String[] args) throws Excepti...
... import ru.faulab.attendence.module.MainModule; import ru.faulab.attendence.ui.MainFrame; import javax.swing.*; public class Runner { /* ... * 1. Статистика * */ public static void main(String[] args) throws Exception { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClas...
e6d8789a1847ebe1525bb87c80b90d45db7cd29e
source/setup.py
source/setup.py
from distutils.core import setup from Cython.Build import cythonize ext_options = {"compiler_directives": {"profile": True}, "annotate": True} setup( name='Weighted-Levenshtein', version='', packages=[''], url='', license='', author='Team bluebird', author_email='', description='', req...
from setuptools import setup from Cython.Build import cythonize ext_options = {"compiler_directives": {"profile": True}, "annotate": True} setup( name='Weighted-Levenshtein', version='', packages=[''], url='', license='', author='Team bluebird', author_email='', description='', install...
Refactor rename to cost matrx
Refactor rename to cost matrx
Python
mit
elangovana/NLP-BackTransliteration-PersianNames
python
## Code Before: from distutils.core import setup from Cython.Build import cythonize ext_options = {"compiler_directives": {"profile": True}, "annotate": True} setup( name='Weighted-Levenshtein', version='', packages=[''], url='', license='', author='Team bluebird', author_email='', des...
# ... existing code ... from setuptools import setup from Cython.Build import cythonize ext_options = {"compiler_directives": {"profile": True}, "annotate": True} # ... modified code ... license='', author='Team bluebird', author_email='', description='', install_requires=['numpy','weighted_lev...
64f0171d781d03571a7ce725fff64e8162e9b55e
org.spoofax.jsglr2.integrationtest/src/test/java/org/spoofax/jsglr2/integrationtest/languages/StrategoTest.java
org.spoofax.jsglr2.integrationtest/src/test/java/org/spoofax/jsglr2/integrationtest/languages/StrategoTest.java
package org.spoofax.jsglr2.integrationtest.languages; import java.io.IOException; import java.util.stream.Stream; import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.TestFactory; import org.spoofax.interpreter.terms.IStrategoTerm; import org.spoofax.jsglr2.integrationtest.BaseTestWithParseTableFrom...
package org.spoofax.jsglr2.integrationtest.languages; import java.io.IOException; import java.util.stream.Stream; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.TestFactory; import org.spoofax.interpreter.terms.IStrategoTerm; import org.spoofax.jsglr2.int...
Disable indentpadding test, note why
Disable indentpadding test, note why
Java
apache-2.0
metaborg/jsglr,metaborg/jsglr,metaborg/jsglr,metaborg/jsglr
java
## Code Before: package org.spoofax.jsglr2.integrationtest.languages; import java.io.IOException; import java.util.stream.Stream; import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.TestFactory; import org.spoofax.interpreter.terms.IStrategoTerm; import org.spoofax.jsglr2.integrationtest.BaseTestWi...
// ... existing code ... import java.io.IOException; import java.util.stream.Stream; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.TestFactory; import org.spoofax.interpreter.terms.IStrategoTerm; // ... modified code ... return testSuccess...
322997e229457bf43ee2281993ccdc30c8455244
tests/test_util.py
tests/test_util.py
from archivebox import util def test_download_url_downloads_content(): text = util.download_url("https://example.com") assert "Example Domain" in text
from archivebox import util def test_download_url_downloads_content(): text = util.download_url("http://localhost:8080/static/example.com.html") assert "Example Domain" in text
Refactor util tests to use local webserver
test: Refactor util tests to use local webserver
Python
mit
pirate/bookmark-archiver,pirate/bookmark-archiver,pirate/bookmark-archiver
python
## Code Before: from archivebox import util def test_download_url_downloads_content(): text = util.download_url("https://example.com") assert "Example Domain" in text ## Instruction: test: Refactor util tests to use local webserver ## Code After: from archivebox import util def test_download_url_downloads_co...
... from archivebox import util def test_download_url_downloads_content(): text = util.download_url("http://localhost:8080/static/example.com.html") assert "Example Domain" in text ...
aece5e1eb7435d6ce0b5c667cb755aeb3c742084
app/src/main/java/de/bowstreet/testandroidapp/MainActivity.java
app/src/main/java/de/bowstreet/testandroidapp/MainActivity.java
package de.bowstreet.testandroidapp; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import com.microsoft.azure.mobile.MobileCenter; import com.microsoft.azure.mobile.analytics.Analytics; import com.microsoft.azure.mobile.crashes.Crash...
package de.bowstreet.testandroidapp; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import com.microsoft.azure.mobile.MobileCenter; import com.microsoft.azure.mobile.analytics.Analytics; import com.microsoft.azure.mobile.crashes.Crash...
Use app secret for prod app
Use app secret for prod app
Java
mit
ranterle/TestAndroidApp
java
## Code Before: package de.bowstreet.testandroidapp; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import com.microsoft.azure.mobile.MobileCenter; import com.microsoft.azure.mobile.analytics.Analytics; import com.microsoft.azure.mobi...
// ... existing code ... super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); MobileCenter.start(getApplication(), "675da273-5716-4855-9dd0-431fe51ebfef", Analytics.class, Crashes.class); mButton = (Button) findViewById(R.id.button); // ... rest of the code...
aff8cebfd168493a4a9dff77cf9722507429d570
contrib/examples/actions/pythonactions/isprime.py
contrib/examples/actions/pythonactions/isprime.py
import math class PrimeChecker(object): def run(self, **kwargs): return self._is_prime(**kwargs) def _is_prime(self, value=0): if math.floor(value) != value: raise ValueError('%s should be an integer.' % value) if value < 2: return False for test in ra...
import math class PrimeChecker(object): def run(self, value=0): if math.floor(value) != value: raise ValueError('%s should be an integer.' % value) if value < 2: return False for test in range(2, int(math.floor(math.sqrt(value)))+1): if value % test == ...
Update pythonaction sample for simpler run.
Update pythonaction sample for simpler run.
Python
apache-2.0
peak6/st2,lakshmi-kannan/st2,pixelrebel/st2,StackStorm/st2,jtopjian/st2,pinterb/st2,Plexxi/st2,punalpatel/st2,armab/st2,grengojbo/st2,grengojbo/st2,punalpatel/st2,pixelrebel/st2,Itxaka/st2,lakshmi-kannan/st2,emedvedev/st2,lakshmi-kannan/st2,pixelrebel/st2,nzlosh/st2,peak6/st2,dennybaa/st2,pinterb/st2,Plexxi/st2,nzlosh/...
python
## Code Before: import math class PrimeChecker(object): def run(self, **kwargs): return self._is_prime(**kwargs) def _is_prime(self, value=0): if math.floor(value) != value: raise ValueError('%s should be an integer.' % value) if value < 2: return False ...
# ... existing code ... class PrimeChecker(object): def run(self, value=0): if math.floor(value) != value: raise ValueError('%s should be an integer.' % value) if value < 2: # ... rest of the code ...
6e0f2880c80150a71cc719ff652f1bfbde08a1fa
setup.py
setup.py
from setuptools import setup try: import ez_setup ez_setup.use_setuptools() except ImportError: pass setup( name = "django-tsearch2", version = "0.2", packages = ['tsearch2', 'tsearch2.management', 'tsearch2.management.commands'], author = "Henrique Carvalho Alves", author_email = "hca...
from setuptools import setup setup( name = "django-tsearch2", version = "0.2", packages = ['tsearch2', 'tsearch2.management', 'tsearch2.management.commands'], zip_safe = False, author = "Henrique Carvalho Alves", author_email = "hcarvalhoalves@gmail.com", description = "TSearch2 support for...
Mark as zip_safe = False
Mark as zip_safe = False
Python
bsd-3-clause
hcarvalhoalves/django-tsearch2
python
## Code Before: from setuptools import setup try: import ez_setup ez_setup.use_setuptools() except ImportError: pass setup( name = "django-tsearch2", version = "0.2", packages = ['tsearch2', 'tsearch2.management', 'tsearch2.management.commands'], author = "Henrique Carvalho Alves", aut...
# ... existing code ... from setuptools import setup setup( name = "django-tsearch2", version = "0.2", packages = ['tsearch2', 'tsearch2.management', 'tsearch2.management.commands'], zip_safe = False, author = "Henrique Carvalho Alves", author_email = "hcarvalhoalves@gmail.com", descript...
28f9f7e85bb8353435db322138d1bd624934110f
london_commute_alert.py
london_commute_alert.py
import datetime import os import requests import sys def update(lines): url = 'http://api.tfl.gov.uk/Line/Mode/tube/Status' resp = requests.get(url).json() result = [] for el in resp: value = el['lineStatuses'][0] state = value['statusSeverityDescription'] if el['id'] in lines...
import datetime import os import requests import sys def update(lines): url = 'http://api.tfl.gov.uk/Line/Mode/tube/Status' resp = requests.get(url).json() result = [] for el in resp: value = el['lineStatuses'][0] state = value['statusSeverityDescription'] if el['id'] in lines...
Halt emails for time being
Halt emails for time being
Python
mit
noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit
python
## Code Before: import datetime import os import requests import sys def update(lines): url = 'http://api.tfl.gov.uk/Line/Mode/tube/Status' resp = requests.get(url).json() result = [] for el in resp: value = el['lineStatuses'][0] state = value['statusSeverityDescription'] if e...
... def email(delays): # While tube is on shuttle service, don't email return os.chdir(sys.path[0]) with open('curl_raw_command.sh') as f: raw_command = f.read() ...
539fae27f9911b9ad13edc5244ffbd12b1509006
utils.py
utils.py
__all__ = ['mstack', 'wget'] def mstack(vs, fs): import chumpy as ch import numpy as np lengths = [v.shape[0] for v in vs] f = np.vstack([fs[i]+np.sum(lengths[:i]).astype(np.uint32) for i in range(len(fs))]) v = ch.vstack(vs) return v, f def wget(url, dest_fname=None): import urllib.requ...
__all__ = ['mstack', 'wget'] def mstack(vs, fs): import chumpy as ch import numpy as np lengths = [v.shape[0] for v in vs] f = np.vstack([fs[i]+np.sum(lengths[:i]).astype(np.uint32) for i in range(len(fs))]) v = ch.vstack(vs) return v, f def wget(url, dest_fname=None): try: #python3 ...
Fix for python2/3 compatibility issue with urllib
Fix for python2/3 compatibility issue with urllib
Python
mit
mattloper/opendr,mattloper/opendr
python
## Code Before: __all__ = ['mstack', 'wget'] def mstack(vs, fs): import chumpy as ch import numpy as np lengths = [v.shape[0] for v in vs] f = np.vstack([fs[i]+np.sum(lengths[:i]).astype(np.uint32) for i in range(len(fs))]) v = ch.vstack(vs) return v, f def wget(url, dest_fname=None): im...
// ... existing code ... def wget(url, dest_fname=None): try: #python3 from urllib.request import urlopen except: #python2 from urllib2 import urlopen from os.path import split, join curdir = split(__file__)[0] // ... modified code ... dest_fname = join(curdir, split(...
a68494b48bbbdeb8293a0e5c521a501bf3eb3750
OpenMRS-iOS/MRSVisit.h
OpenMRS-iOS/MRSVisit.h
// // MRSVisit.h // OpenMRS-iOS // // Created by Parker Erway on 12/2/14. // Copyright (c) 2014 Erway Software. All rights reserved. // #import <Foundation/Foundation.h> @interface MRSVisit : NSObject @property (nonatomic, strong) NSString *displayName; @property (nonatomic, strong) NSString *UUID; @property (non...
// // MRSVisit.h // OpenMRS-iOS // // Created by Parker Erway on 12/2/14. // Copyright (c) 2014 Erway Software. All rights reserved. // #import <Foundation/Foundation.h> #import "MRSLocation.h" @class MRSVisitType; @interface MRSVisit : NSObject @property (nonatomic, strong) NSString *displayName; @property (nona...
Add new attributes to Visit class
Add new attributes to Visit class
C
mpl-2.0
yousefhamza/openmrs-contrib-ios-client,Undo1/openmrs-contrib-ios-client,yousefhamza/openmrs-contrib-ios-client,Undo1/openmrs-contrib-ios-client
c
## Code Before: // // MRSVisit.h // OpenMRS-iOS // // Created by Parker Erway on 12/2/14. // Copyright (c) 2014 Erway Software. All rights reserved. // #import <Foundation/Foundation.h> @interface MRSVisit : NSObject @property (nonatomic, strong) NSString *displayName; @property (nonatomic, strong) NSString *UUID...
# ... existing code ... // #import <Foundation/Foundation.h> #import "MRSLocation.h" @class MRSVisitType; @interface MRSVisit : NSObject @property (nonatomic, strong) NSString *displayName; @property (nonatomic, strong) NSString *UUID; @property (nonatomic, strong) NSString *startDateTime; @property (nonatomic, st...
c2dbfc7f18dc44747fbb8b14e212cbb4151e8f85
analyze.py
analyze.py
import fore.database analysis = fore.database.get_analysis(2) import pickle, base64 analysis = pickle.loads(base64.b64decode(analysis)) print(analysis)
import sys import fore.database if len(sys.argv) > 1: track_no = sys.argv[1] else: track_no = 2 analysis = fore.database.get_analysis(track_no) import pickle, base64 analysis = pickle.loads(base64.b64decode(analysis)) print(analysis)
Send track number as CLI argument.
Send track number as CLI argument.
Python
artistic-2.0
MikeiLL/appension,Rosuav/appension,MikeiLL/appension,MikeiLL/appension,Rosuav/appension,Rosuav/appension,MikeiLL/appension,Rosuav/appension
python
## Code Before: import fore.database analysis = fore.database.get_analysis(2) import pickle, base64 analysis = pickle.loads(base64.b64decode(analysis)) print(analysis) ## Instruction: Send track number as CLI argument. ## Code After: import sys import fore.database if len(sys.argv) > 1: track_no = sys.argv[1] el...
... import sys import fore.database if len(sys.argv) > 1: track_no = sys.argv[1] else: track_no = 2 analysis = fore.database.get_analysis(track_no) import pickle, base64 analysis = pickle.loads(base64.b64decode(analysis)) print(analysis) ...
7891cf254bb98b65503675a20ed6b013385328cf
setup.py
setup.py
import setuptools def package_data_dirs(source, sub_folders): import os dirs = [] for d in sub_folders: for dirname, _, files in os.walk(os.path.join(source, d)): dirname = os.path.relpath(dirname, source) for f in files: dirs.append(os.path.join(dirname, f)) return dirs def params(): name = "OctoP...
import setuptools def package_data_dirs(source, sub_folders): import os dirs = [] for d in sub_folders: for dirname, _, files in os.walk(os.path.join(source, d)): dirname = os.path.relpath(dirname, source) for f in files: dirs.append(os.path.join(dirname, f)) return dirs def params(): name = "OctoP...
Copy paste error leading to static and template folders not being properly installed along side the package
Copy paste error leading to static and template folders not being properly installed along side the package
Python
agpl-3.0
OctoPrint/OctoPrint-Netconnectd,mrbeam/OctoPrint-Netconnectd,mrbeam/OctoPrint-Netconnectd,OctoPrint/OctoPrint-Netconnectd,mrbeam/OctoPrint-Netconnectd
python
## Code Before: import setuptools def package_data_dirs(source, sub_folders): import os dirs = [] for d in sub_folders: for dirname, _, files in os.walk(os.path.join(source, d)): dirname = os.path.relpath(dirname, source) for f in files: dirs.append(os.path.join(dirname, f)) return dirs def params()...
// ... existing code ... license = "AGPLv3" packages = ["octoprint_netconnectd"] package_data = {"octoprint_netconnectd": package_data_dirs('octoprint_netconnectd', ['static', 'templates'])} include_package_data = True zip_safe = False // ... rest of the code ...
69ec6586cd9ce9c8bda5b9c2f6f76ecd4a43baca
chessfellows/chess/models.py
chessfellows/chess/models.py
from django.db import models from django.contrib.auth.models import User class Match(models.Model): white = models.ForeignKey(User, related_name="White") black = models.ForeignKey(User, related_name="Black") moves = models.TextField() class Player(models.Model): user = models.OneToOneField(User) ...
import os from django.db import models from django.contrib.auth.models import User def get_file_owner_username(instance, filename): parts = [instance.user.username] parts.append(os.path.basename(filename)) path = u"/".join(parts) return path class Match(models.Model): white = models.ForeignKey(U...
Add get_file_owner_username() to return a file path for a player's profile picture; add photo attribute to Player() model
Add get_file_owner_username() to return a file path for a player's profile picture; add photo attribute to Player() model
Python
mit
EyuelAbebe/gamer,EyuelAbebe/gamer
python
## Code Before: from django.db import models from django.contrib.auth.models import User class Match(models.Model): white = models.ForeignKey(User, related_name="White") black = models.ForeignKey(User, related_name="Black") moves = models.TextField() class Player(models.Model): user = models.OneToOn...
// ... existing code ... import os from django.db import models from django.contrib.auth.models import User def get_file_owner_username(instance, filename): parts = [instance.user.username] parts.append(os.path.basename(filename)) path = u"/".join(parts) return path class Match(models.Model): /...
f259830daf79f1e7c02a2fb61af6029ad0ebc8be
app/controllers/PlatformController.java
app/controllers/PlatformController.java
package controllers; import models.Game; import play.mvc.Controller; import play.mvc.Result; import views.html.platform_read; import java.util.List; public class PlatformController extends Controller { public static Result read(final String platformName) { if (platformName == null) { return ...
package controllers; import models.Game; import play.mvc.Controller; import play.mvc.Result; import views.html.platform_read; import java.util.List; public class PlatformController extends Controller { public static Result read(final String platformName) { if (platformName == null) { return ...
Order one cc by game title
Order one cc by game title
Java
apache-2.0
jsmadja/shmuphiscores,jsmadja/shmuphiscores,jsmadja/shmuphiscores
java
## Code Before: package controllers; import models.Game; import play.mvc.Controller; import play.mvc.Result; import views.html.platform_read; import java.util.List; public class PlatformController extends Controller { public static Result read(final String platformName) { if (platformName == null) { ...
// ... existing code ... } public static List<Game> getGamesByPlatform(final String platformName) { return Game.finder.where().ieq("platforms.name", platformName).order("title").findList(); } } // ... rest of the code ...
33ceea40e41d9f568b11e30779b8b7c16ba8f5b8
bench/split-file.py
bench/split-file.py
import sys prefix = sys.argv[1] filename = sys.argv[2] f = open(filename) sf = None for line in f: if line.startswith('Processing database:'): if sf: sf.close() line2 = line.split(':')[1] # Check if entry is compressed and if has to be processed line2 = line2[:line2.rfi...
import sys prefix = sys.argv[1] filename = sys.argv[2] f = open(filename) sf = None for line in f: if line.startswith('Processing database:'): if sf: sf.close() line2 = line.split(':')[1] # Check if entry is compressed and if has to be processed line2 = line2[:line2.rfi...
Support for splitting outputs for PyTables and Postgres indexing benchmarks all in one.
Support for splitting outputs for PyTables and Postgres indexing benchmarks all in one. git-svn-id: 92c705c98a17f0f7623a131b3c42ed50fcde59b4@2885 1b98710c-d8ec-0310-ae81-f5f2bcd8cb94
Python
bsd-3-clause
jennolsen84/PyTables,rabernat/PyTables,avalentino/PyTables,jack-pappas/PyTables,rdhyee/PyTables,gdementen/PyTables,joonro/PyTables,PyTables/PyTables,mohamed-ali/PyTables,andreabedini/PyTables,tp199911/PyTables,jennolsen84/PyTables,tp199911/PyTables,dotsdl/PyTables,cpcloud/PyTables,tp199911/PyTables,FrancescAlted/PyTabl...
python
## Code Before: import sys prefix = sys.argv[1] filename = sys.argv[2] f = open(filename) sf = None for line in f: if line.startswith('Processing database:'): if sf: sf.close() line2 = line.split(':')[1] # Check if entry is compressed and if has to be processed line2 = ...
// ... existing code ... optlevel = int(param[1]) elif param[:-1] in ('zlib', 'lzo'): complib = param if 'PyTables' in prefix: if complib: sfilename = "%s-O%s-%s.out" % (prefix, optlevel, complib) else: sfilen...
7efce87f280e015217514c73097a080a47a56f05
src/wclock_test.c
src/wclock_test.c
static unsigned int sleep(unsigned int x) { Sleep(x * 1000); return 0; } #else # include <unistd.h> #endif int main(void) { double res, t1, t2; wclock clock; if (wclock_init(&clock)) { abort(); } res = wclock_get_res(&clock); printf("%.17g\n", res); assert(res > 0); assert(res...
static unsigned int sleep(unsigned int x) { Sleep(x * 1000); return 0; } #else # include <unistd.h> #endif int main(void) { double res, t1, t2; wclock clock; if (wclock_init(&clock)) { abort(); } res = wclock_get_res(&clock); printf("%.17g\n", res); assert(res > 0); assert(res...
Increase time tolerance to reduce flakiness on slow systems
Increase time tolerance to reduce flakiness on slow systems
C
mit
Rufflewind/calico,Rufflewind/calico,Rufflewind/calico
c
## Code Before: static unsigned int sleep(unsigned int x) { Sleep(x * 1000); return 0; } #else # include <unistd.h> #endif int main(void) { double res, t1, t2; wclock clock; if (wclock_init(&clock)) { abort(); } res = wclock_get_res(&clock); printf("%.17g\n", res); assert(res > 0)...
# ... existing code ... t2 = wclock_get(&clock); printf("%.17g\n", t2); printf("%.17g\n", t2 - t1); assert(t2 - t1 >= 0.9 && t2 - t1 < 1.4); return 0; } # ... rest of the code ...
462656f9653ae43ea69080414735927b18e0debf
stats/random_walk.py
stats/random_walk.py
import neo4j import random from logbook import Logger log = Logger('trinity.topics') DEFAULT_DEPTH = 5 NUM_WALKS = 100 # Passed sorted list (desc order), return top nodes TO_RETURN = lambda x: x[:10] random.seed() def random_walk(graph, node, depth=DEFAULT_DEPTH): # Pick random neighbor neighbors = {} i...
import neo4j import random DEFAULT_DEPTH = 5 NUM_WALKS = 100 # Passed sorted list (desc order), return top nodes TO_RETURN = lambda x: x[:10] random.seed() def random_walk(graph, node, depth=DEFAULT_DEPTH): if depth == 0: return [node] # Pick random neighbor neighbors = {} i = 0 for r in...
Modify random walk so that it works.
Modify random walk so that it works.
Python
mit
peplin/trinity
python
## Code Before: import neo4j import random from logbook import Logger log = Logger('trinity.topics') DEFAULT_DEPTH = 5 NUM_WALKS = 100 # Passed sorted list (desc order), return top nodes TO_RETURN = lambda x: x[:10] random.seed() def random_walk(graph, node, depth=DEFAULT_DEPTH): # Pick random neighbor neig...
// ... existing code ... import neo4j import random DEFAULT_DEPTH = 5 // ... modified code ... random.seed() def random_walk(graph, node, depth=DEFAULT_DEPTH): if depth == 0: return [node] # Pick random neighbor neighbors = {} i = 0 for r in node.relationships().outgoing: ...
042720760a71b5e372489af2335c2fccc5b4905b
ynr/apps/uk_results/views/api.py
ynr/apps/uk_results/views/api.py
from rest_framework import viewsets from django_filters import filters, filterset from api.v09.views import ResultsSetPagination from ..models import CandidateResult, ResultSet from ..serializers import CandidateResultSerializer, ResultSetSerializer class CandidateResultViewSet(viewsets.ModelViewSet): queryset ...
from rest_framework import viewsets from django_filters import filters, filterset from api.v09.views import ResultsSetPagination from ..models import CandidateResult, ResultSet from ..serializers import CandidateResultSerializer, ResultSetSerializer class CandidateResultViewSet(viewsets.ModelViewSet): queryset ...
Update filter args and fix name
Update filter args and fix name The newer version of django-filter uses `field_name` rather than `name`
Python
agpl-3.0
DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative
python
## Code Before: from rest_framework import viewsets from django_filters import filters, filterset from api.v09.views import ResultsSetPagination from ..models import CandidateResult, ResultSet from ..serializers import CandidateResultSerializer, ResultSetSerializer class CandidateResultViewSet(viewsets.ModelViewSet...
# ... existing code ... pagination_class = ResultsSetPagination class ResultSetFilter(filterset.FilterSet): election_id = filters.CharFilter(field_name="post_election__election__slug") election_date = filters.DateFilter( field_name="post_election__election__election_date" ) class Meta:...
34cb26b961b88efd40065c9653d566273fb99fe0
src/test/java/appstore/TestThisWillFailAbunch.java
src/test/java/appstore/TestThisWillFailAbunch.java
package appstore; import static org.junit.Assert.*; import org.junit.Ignore; import org.junit.Test; public class TestThisWillFailAbunch { @Test public void aFailingTest() { assertTrue("I expected this to pass!", true); } @Ignore @Test public void aFailingTest2() { assertTru...
package appstore; import static org.junit.Assert.*; import org.junit.Ignore; import org.junit.Test; public class TestThisWillFailAbunch { @Test public void aFailingTest() { assertTrue("I expected this to pass!", true); } @Ignore @Test public void aFailingTest2() { assertTru...
Fix payment processor test failures
Fix payment processor test failures
Java
mit
i386/app-store-demo,multibranchorg/app-store-demo
java
## Code Before: package appstore; import static org.junit.Assert.*; import org.junit.Ignore; import org.junit.Test; public class TestThisWillFailAbunch { @Test public void aFailingTest() { assertTrue("I expected this to pass!", true); } @Ignore @Test public void aFailingTest2() { ...
// ... existing code ... //@Ignore @Test public void aFailingTest4() { assertTrue("I expected this to pass!", true); } @Ignore // ... modified code ... @Test public void aFailingTest5() { assertTrue("I expected this to pass!", true); } @Test // ... rest o...
37fdbd56a6601848536f2a5ca64d66cf4aa3717a
cu-manager/src/main/java/fr/treeptik/cloudunit/hooks/HookAction.java
cu-manager/src/main/java/fr/treeptik/cloudunit/hooks/HookAction.java
package fr.treeptik.cloudunit.hooks; /** * Created by nicolas on 19/04/2016. */ public enum HookAction { APPLICATION_POST_START("Application post start", "/cloudunit/appconf/hooks/application-post-start.sh"), APPLICATION_POST_STOP("Application post stop", "/cloudunit/appconf/hooks/application-post-stop.sh")...
package fr.treeptik.cloudunit.hooks; /** * Created by nicolas on 19/04/2016. */ public enum HookAction { APPLICATION_POST_START("Application post start", "/cloudunit/appconf/hooks/application-post-start.sh"), APPLICATION_POST_STOP("Application post stop", "/cloudunit/appconf/hooks/application-post-stop.sh")...
Add new Hooks. Not yet called into code
Add new Hooks. Not yet called into code
Java
agpl-3.0
Treeptik/cloudunit,Treeptik/cloudunit,Treeptik/cloudunit,Treeptik/cloudunit,Treeptik/cloudunit,Treeptik/cloudunit
java
## Code Before: package fr.treeptik.cloudunit.hooks; /** * Created by nicolas on 19/04/2016. */ public enum HookAction { APPLICATION_POST_START("Application post start", "/cloudunit/appconf/hooks/application-post-start.sh"), APPLICATION_POST_STOP("Application post stop", "/cloudunit/appconf/hooks/applicatio...
// ... existing code ... APPLICATION_POST_START("Application post start", "/cloudunit/appconf/hooks/application-post-start.sh"), APPLICATION_POST_STOP("Application post stop", "/cloudunit/appconf/hooks/application-post-stop.sh"), APPLICATION_PRE_START("Application pre start", "/cloudunit/appconf/hooks/ap...
198a941c8c71802b72c33f5ef89d1d4d46e52eac
scripts/fetch_all_urls_to_disk.py
scripts/fetch_all_urls_to_disk.py
import urllib import os import hashlib with open('media_urls.txt','r') as f: for url in f: imagename = os.path.basename(url) m = hashlib.md5(url).hexdigest() if '.jpg' in url: shortname = m + '.jpg' elif '.png' in url: shortname = m + '.png' else: print ...
import urllib import os import hashlib with open('media_urls.txt','r') as f: for url in f: imagename = os.path.basename(url) m = hashlib.md5(url).hexdigest() if '.jpg' in url: shortname = m + '.jpg' elif '.png' in url: shortname = m + '.png' else: print ...
Add continue when no extension ".jpg" nor ".png" is found in URL
Add continue when no extension ".jpg" nor ".png" is found in URL
Python
mit
mixbe/kerstkaart2013,mixbe/kerstkaart2013
python
## Code Before: import urllib import os import hashlib with open('media_urls.txt','r') as f: for url in f: imagename = os.path.basename(url) m = hashlib.md5(url).hexdigest() if '.jpg' in url: shortname = m + '.jpg' elif '.png' in url: shortname = m + '.png' else:...
... shortname = m + '.png' else: print 'no jpg nor png' continue print shortname with open(shortname, 'wb') as imgfile: ...
1e8cc5743f32bb5f6e2e9bcbee0f78e3df357449
tests/test_fastpbkdf2.py
tests/test_fastpbkdf2.py
import pytest from fastpbkdf2 import pbkdf2_hmac def test_unsupported_algorithm(): with pytest.raises(ValueError): pbkdf2_hmac("foo", b"password", b"salt", 1)
import binascii import pytest from fastpbkdf2 import pbkdf2_hmac def test_unsupported_algorithm(): with pytest.raises(ValueError): pbkdf2_hmac("foo", b"password", b"salt", 1) @pytest.mark.parametrize("password,salt,iterations,length,derived_key", [ (b"password", b"salt", 1, 20, b"0c60c80f961f...
Add test for RFC 6070 vectors.
Add test for RFC 6070 vectors.
Python
apache-2.0
Ayrx/python-fastpbkdf2,Ayrx/python-fastpbkdf2
python
## Code Before: import pytest from fastpbkdf2 import pbkdf2_hmac def test_unsupported_algorithm(): with pytest.raises(ValueError): pbkdf2_hmac("foo", b"password", b"salt", 1) ## Instruction: Add test for RFC 6070 vectors. ## Code After: import binascii import pytest from fastpbkdf2 import pbkdf2_hmac...
// ... existing code ... import binascii import pytest from fastpbkdf2 import pbkdf2_hmac // ... modified code ... def test_unsupported_algorithm(): with pytest.raises(ValueError): pbkdf2_hmac("foo", b"password", b"salt", 1) @pytest.mark.parametrize("password,salt,iterations,length,derived_key",...
133a085f40f1536d5ebb26e912d15fa3bddcc82c
manager.py
manager.py
from cement.core.foundation import CementApp import command import util.config util.config.Configuration() class Manager(CementApp): class Meta: label = 'QLDS-Manager' handlers = [ command.default.ManagerBaseController, command.setup.SetupController ] with Manage...
from cement.core.foundation import CementApp import command import util.config class Manager(CementApp): class Meta: label = 'QLDS-Manager' handlers = command.commands with Manager() as app: app.run()
Use handlers defined in command package
Use handlers defined in command package
Python
mit
rzeka/QLDS-Manager
python
## Code Before: from cement.core.foundation import CementApp import command import util.config util.config.Configuration() class Manager(CementApp): class Meta: label = 'QLDS-Manager' handlers = [ command.default.ManagerBaseController, command.setup.SetupController ...
# ... existing code ... import command import util.config class Manager(CementApp): class Meta: label = 'QLDS-Manager' handlers = command.commands with Manager() as app: # ... rest of the code ...
8adfceb0e4c482b5cc3119dbeffc2c4335c9d553
jctools-core/src/main/java/org/jctools/util/UnsafeAccess.java
jctools-core/src/main/java/org/jctools/util/UnsafeAccess.java
package org.jctools.util; import java.lang.reflect.Field; import sun.misc.Unsafe; public class UnsafeAccess { public static final Unsafe UNSAFE; static { try { // This is a bit of voodoo to force the unsafe object into // visibility and acquire it. // This is not p...
package org.jctools.util; import java.lang.reflect.Field; import java.util.concurrent.atomic.AtomicReferenceArray; import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; import sun.misc.Unsafe; /** * Why should we resort to using Unsafe?<br> * <ol> * <li>To construct class fields which allow volatile/ord...
Add comment justifying the use of UNSAFE.
Add comment justifying the use of UNSAFE.
Java
apache-2.0
franz1981/JCTools,fengjiachun/JCTools,akarnokd/JCTools,thomasdarimont/JCTools,mackstone/JCTools,JCTools/JCTools
java
## Code Before: package org.jctools.util; import java.lang.reflect.Field; import sun.misc.Unsafe; public class UnsafeAccess { public static final Unsafe UNSAFE; static { try { // This is a bit of voodoo to force the unsafe object into // visibility and acquire it. ...
// ... existing code ... package org.jctools.util; import java.lang.reflect.Field; import java.util.concurrent.atomic.AtomicReferenceArray; import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; import sun.misc.Unsafe; /** * Why should we resort to using Unsafe?<br> * <ol> * <li>To construct class fie...
4510a4a22965d002bd41293fd8fe629c8285800d
tests/test_errors.py
tests/test_errors.py
import pytest from pyxl.codec.register import pyxl_decode from pyxl.codec.parser import ParseError def test_malformed_if(): with pytest.raises(ParseError): pyxl_decode(b""" <frag> <if cond="{true}">foo</if> this is incorrect! <else>bar</else> ...
import pytest from pyxl.codec.register import pyxl_decode from pyxl.codec.parser import ParseError from pyxl.codec.html_tokenizer import BadCharError def test_malformed_if(): with pytest.raises(ParseError): pyxl_decode(b""" <frag> <if cond="{true}">foo</if> this...
Add test for BadCharError exception.
Add test for BadCharError exception.
Python
apache-2.0
pyxl4/pyxl4
python
## Code Before: import pytest from pyxl.codec.register import pyxl_decode from pyxl.codec.parser import ParseError def test_malformed_if(): with pytest.raises(ParseError): pyxl_decode(b""" <frag> <if cond="{true}">foo</if> this is incorrect! <els...
# ... existing code ... from pyxl.codec.register import pyxl_decode from pyxl.codec.parser import ParseError from pyxl.codec.html_tokenizer import BadCharError def test_malformed_if(): with pytest.raises(ParseError): # ... modified code ... <if cond="{true}">foo</if> <else>...
End of preview. Expand in Data Studio

Code Apply

Processed EditPackFT-Multi Python, Java, Kotlin, and C splits with fuzzy diff generated using heuristics.

Dataset Preparation

Steps to replicate. For this version --min_lines_between_chunks=3 was used.

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

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)

Downloads last month
3