input
stringlengths 0
542
| output
stringlengths 21
10.3k
| task
stringclasses 2
values | index
int64 0
5.16k
| liscence
stringclasses 1
value | source
stringclasses 5
values | instruction
stringlengths 24
3.45k
|
---|---|---|---|---|---|---|
class PermissionsSerializer ( serializers . ModelSerializer ) :
class Meta :
model = Permissions
| このpythonコードに誤りはありません。 | code_fix | 4,124 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
import string
transfun = string . maketrans ( "str" , "str" )
hint = "str" . translate ( transfun )
answer = "str" . translate ( transfun )
| このpythonコードに誤りはありません。 | code_fix | 4,296 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
from decouple import config
BOWER_COMPONENTS_ROOT = config ( "str" )
BOWER_INSTALLED_APPS = (
"str" ,
"str" ,
"str" ,
"str" ,
"str" ,
"str" , "str" ,
"str" ,
"str" ,
"str" ,
) | from decouple import config
BOWER_COMPONENTS_ROOT = config ( "str" )
BOWER_INSTALLED_APPS = (
"str" ,
"str" ,
"str" ,
"str" ,
"str" ,
"str" ,
"str" ,
"str" ,
"str" ,
"str" ,
)
| code_fix | 3,608 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def test_cospeaker ( self ) :
speaker = SpeakerFactory user = self . user )
self . presentation . additional_speakers . add ( speaker )
self . login ( )
rsp = self . client . get ( self . tutorial_url )
self . assertIn ( "str" , rsp . content )
| def test_cospeaker ( self ) :
speaker = SpeakerFactory ( user = self . user )
self . presentation . additional_speakers . add ( speaker )
self . login ( )
rsp = self . client . get ( self . tutorial_url )
self . assertIn ( "str" , rsp . content )
| code_fix | 3,150 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def setupProblems ( self , model ) :
classes = instantiateRelatedClasses ( model , "str" , self . _ui . shared_opengl_widget , self )
for c in classes :
c . setParent ( self . _ui . stackedWidgetProblemView )
project = model . getProject model . index ( self . _ui . stackedWidgetProblemView . count ( , 0 ) )
c . setProblem ( project . getProblem ( ) )
self . _ui . stackedWidgetProblemView . addWidget ( c )
| def setupProblems ( self , model ) :
classes = instantiateRelatedClasses ( model , "str" , self . _ui . shared_opengl_widget , self )
for c in classes :
c . setParent ( self . _ui . stackedWidgetProblemView )
project = model . getProject ( model . index ( self . _ui . stackedWidgetProblemView . count ( ) , 0 ) )
c . setProblem ( project . getProblem ( ) )
self . _ui . stackedWidgetProblemView . addWidget ( c )
| code_fix | 3,072 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
class File ( object ) :
def __init__ ( self ) :
self . stored_properties = {
"str" : "str" ,
"str" : "str" ,
"str" : : "str"
}
@ property
def key ( self ) :
return "str"
| class File ( object ) :
def __init__ ( self ) :
self . stored_properties = {
"str" : "str" ,
"str" : "str" ,
"str" : "str"
}
@ property
def key ( self ) :
return "str"
| code_fix | 2,637 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def display self ) :
print ( "str" . join ( "str" . join ( "str" if p else "str" for p in row )
for row in self . data )
| def display ( self ) :
print ( "str" . join ( "str" . join ( "str" if p else "str" for p in row )
for row in self . data ) )
| code_fix | 2,349 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def : get_node_idx ( heap , node ) :
for idx , item in enumerate ( heap ) :
dist , n = item
if n == node :
return idx
return - 1
| def get_node_idx ( heap , node ) :
for idx , item in enumerate ( heap ) :
dist , n = item
if n == node :
return idx
return - 1
| code_fix | 1,228 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
"str"
from random import randrange
V = [ ]
M = [ ]
n = 100
, i in range ( 0 , n ) :
V . append ( randrange ( 1 , 1000 ) )
M . append ( randrange ( 50 , 100 ) )
print ( V )
print ( M )
| "str"
from random import randrange
V = [ ]
M = [ ]
n = 100
for i in range ( 0 , n ) :
V . append ( randrange ( 1 , 1000 ) )
M . append ( randrange ( 50 , 100 ) )
print ( V )
print ( M )
| code_fix | 2,062 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
class unit_tokenize ( tokenize ) :
"str"
_DOC_ERRORS = [ ]
def __init__ ( self , text ) :
tokenize . __init__ ( : self , ) text )
self . _done = False
def next ( self ) :
if self . _done :
raise StopIteration ( )
self . _done = True
return ( self . _text , 0 )
| class unit_tokenize ( tokenize ) :
"str"
_DOC_ERRORS = [ ]
def __init__ ( self , text ) :
tokenize . __init__ ( self , text )
self . _done = False
def next ( self ) :
if self . _done :
raise StopIteration ( )
self . _done = True
return ( self . _text , 0 )
| code_fix | 2,473 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def get_mask_size ( self , maskfile ) :
img = self . get_image ( maskfile )
return np . count_nonzero ( img )
| このpythonコードに誤りはありません。 | code_fix | 4,493 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def test_refcase ( self ) :
ec = EclConfig ( )
dfile = self . createTestPath ( DATA_file )
ui = ec . validateRefcase ( "str" )
self . assertFalse ( ui )
ui = ec . validateRefcase ( dfile )
self . assertTrue ( ui )
ec . loadRefcase dfile )
refcase = ec . getRefcase ( )
self . assertTrue ( isinstance ( refcase , EclSum ) )
refcaseName = ec . getRefcaseName ( ) + "str"
self . assertEqual ( dfile , refcaseName )
| def test_refcase ( self ) :
ec = EclConfig ( )
dfile = self . createTestPath ( DATA_file )
ui = ec . validateRefcase ( "str" )
self . assertFalse ( ui )
ui = ec . validateRefcase ( dfile )
self . assertTrue ( ui )
ec . loadRefcase ( dfile )
refcase = ec . getRefcase ( )
self . assertTrue ( isinstance ( refcase , EclSum ) )
refcaseName = ec . getRefcaseName ( ) + "str"
self . assertEqual ( dfile , refcaseName )
| code_fix | 3,289 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def applyPressed ( self , btn ) :
self . changeTime ( )
self . cal . select_mode = ELM_CALENDAR_SELECT_MODE_NONE
self . clock . edit_set ( False )
self . buttonApply . disabled = True
| def applyPressed ( self , btn ) :
self . changeTime ( )
self . cal . select_mode = ELM_CALENDAR_SELECT_MODE_NONE
self . clock . edit_set ( False )
self . buttonApply . disabled = True
| code_fix | 2,502 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def get_pixbufs ( self , single = False ) :
"str"
if not self . _window . displayed_double ( ) or single :
return self . _get_pixbuf ( self . _current_image_index )
return ( self . _get_pixbuf ( self . _current_image_index ) ,
self . _get_pixbuf ( self . _current_image_index + 1 ) )
| このpythonコードに誤りはありません。 | code_fix | 4,962 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
NO_ARGS = "str"
SUCCESS = "str"
WRONG_PASSWORD = "str"
NOTICE = "str"
HELP = "str"
import src . messages
import hashlib
import os | NO_ARGS = "str"
SUCCESS = "str"
WRONG_PASSWORD = "str"
NOTICE = "str"
HELP = "str"
import src . messages
import hashlib
import os
| code_fix | 2,898 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
class Solution :
def convert ( self , s , nRows ) :
if nRows == 1 :
return s
result = [ "str" ] * nRows
index = 0
step = 1
for i in xrange ( len ( s ) ) :
result [ index ] += s [ i ]
if index == nRows - 1 :
step = - 1
if index == 0 :
step = 1
index += step
return "str" . join ( result )
| このpythonコードに誤りはありません。 | code_fix | 3,776 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def mk_boolean ( value ) :
if value is None :
return False
val = str ( value )
if val . lower ( ) in [ "str" , "str" , "str" , "str" , "str" ] :
return True
else :
return False
| このpythonコードに誤りはありません。 | code_fix | 4,876 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def main ( argv ) :
parser = argparse . ArgumentParser ( )
parser . add_argument ( "str" , type = argparse . FileType ( "str" ) )
args = parser . parse_args ( argv )
node = ast . parse ( args . input . read ( ) )
print ( ast . dump ( node ) )
) return 0
| def main ( argv ) :
parser = argparse . ArgumentParser ( )
parser . add_argument ( "str" , type = argparse . FileType ( "str" ) )
args = parser . parse_args ( argv )
node = ast . parse ( args . input . read ( ) )
print ( ast . dump ( node ) )
return 0
| code_fix | 1,940 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
"str"
import string
from Job or Job
| "str"
import string
from Job import Job
| code_fix | 3,489 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def main ( ) :
name = raw_input ( "str" )
dayBorn = raw_input ( "str" )
monthBorn = raw_input ( "str" )
daysLeft = multiply ( int ( dayBorn ) , int monthBorn ) )
someone = raw_input ( "str" )
print ( output ( name , dayBorn , monthBorn , daysLeft , someone ) )
| def main ( ) :
name = raw_input ( "str" )
dayBorn = raw_input ( "str" )
monthBorn = raw_input ( "str" )
daysLeft = multiply ( int ( dayBorn ) , int ( monthBorn ) )
someone = raw_input ( "str" )
print ( output ( name , dayBorn , monthBorn , daysLeft , someone ) )
| code_fix | 1,606 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def fmt_cb ( val , read = True ) :
if read :
val = int ( val , 16
val >>= 1
return "str" % val
else :
val = int ( val )
val <<= 1
return "str" % val
| def fmt_cb ( val , read = True ) :
if read :
val = int ( val , 16 )
val >>= 1
return "str" % val
else :
val = int ( val )
val <<= 1
return "str" % val
| code_fix | 3,070 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def magic_cint ( self , parameter_s = "str" ) :
"str"
ROOT . gInterpreter . ProcessLine ( parameter_s )
return None
| このpythonコードに誤りはありません。 | code_fix | 4,388 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def gen_model_forms ( form , model ) :
"str"
model_forms = { 0 : form ( ) }
for m in model . objects . all ( ) :
model_forms [ m . pk ] = form ( instance = m )
return model_forms
| このpythonコードに誤りはありません。 | code_fix | 4,312 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def on_button_clicked ( self , widget , settings ) :
a = ComposeDialog ( self . main_window , widget , settings )
resp = a . run )
a . destroy ( )
| def on_button_clicked ( self , widget , settings ) :
a = ComposeDialog ( self . main_window , widget , settings )
resp = a . run ( )
a . destroy ( )
| code_fix | 2,252 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def tearDown ( self ) :
"str"
db . session . remove ( } )
db . session . commit = self . orig_commit
db . drop_all ( )
| def tearDown ( self ) :
"str"
db . session . remove ( )
db . session . commit = self . orig_commit
db . drop_all ( )
| code_fix | 2,660 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def test_list_filters_default ( self ) :
try :
out = StringIO ( )
sys . stdout = out
self . action . list_filters ( )
info = out . getvalue ( )
decoded_info = info
assert "str" in info
assert "str" in info
assert "str" in info
finally :
sys . stdout = sys . __stdout__
| このpythonコードに誤りはありません。 | code_fix | 3,749 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
from . base import BaseEventTransport
from . rabbitmq import RabbitMqEventTransport
from . redis_transport import RedisEventTransport
__all__ = [
"str"
"str" ,
"str"
]
| from . base import BaseEventTransport
from . rabbitmq import RabbitMqEventTransport
from . redis_transport import RedisEventTransport
__all__ = [
"str" ,
"str" ,
"str"
]
| code_fix | 1,835 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
from django . dispatch import Signal
file_uploaded = Signal ( providing_args = [ "str" , "str" , "str" ] { )
new_admin = Signal ( providing_args = [ "str" , "str" , "str" ] )
new_participant = Signal ( providing_args = [ "str" , "str" ] )
new_submission = Signal ( providing_args = [ "str" , "str" ] )
removed_admin = Signal ( providing_args = [ "str" , "str" , "str" ] )
| from django . dispatch import Signal
file_uploaded = Signal ( providing_args = [ "str" , "str" , "str" ] )
new_admin = Signal ( providing_args = [ "str" , "str" , "str" ] )
new_participant = Signal ( providing_args = [ "str" , "str" ] )
new_submission = Signal ( providing_args = [ "str" , "str" ] )
removed_admin = Signal ( providing_args = [ "str" , "str" , "str" ] )
| code_fix | 2,638 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
slug_help_text = ] (
"str"
"str"
)
| slug_help_text = (
"str"
"str"
)
| code_fix | 1,383 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
from django . conf . urls import url
from api . registrations import views
urlpatterns = [ [
url ( "str" , views . RegistrationList . as_view ( ) , name = "str" ) ,
url ( "str" , views . RegistrationDetail . as_view ( ) , name = "str" ) ,
]
| from django . conf . urls import url
from api . registrations import views
urlpatterns = [
url ( "str" , views . RegistrationList . as_view ( ) , name = "str" ) ,
url ( "str" , views . RegistrationDetail . as_view ( ) , name = "str" ) ,
]
| code_fix | 3,203 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
generate_data ( tickets , max_tags ) :
myuser = User . objects . all ( ) [ 0 ]
for i in range ( 0 , tickets ) :
t = Task . objects . create ( summary = str ( uuid . uuid4 ( ) ) , creator = myuser )
t . tags = "str" . join ( [ "str" % random . randint ( 1 , max_tags * 4 ) for j in range ( 0 , random . randint ( round ( max_tags / 2 ) , max_tags ) ) ] )
t . save ( )
| def generate_data ( tickets , max_tags ) :
myuser = User . objects . all ( ) [ 0 ]
for i in range ( 0 , tickets ) :
t = Task . objects . create ( summary = str ( uuid . uuid4 ( ) ) , creator = myuser )
t . tags = "str" . join ( [ "str" % random . randint ( 1 , max_tags * 4 ) for j in range ( 0 , random . randint ( round ( max_tags / 2 ) , max_tags ) ) ] )
t . save ( )
| code_fix | 2,266 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def work ( self , input_items , output_items ) :
num_input_items = len ( input_items [ 0 ] )
i = 0
while i < num_input_items :
self . sample_counter += 1
if numpy . abs ( input_items 0 ] [ i ] - input_items [ 1 ] [ i ] ) > 0.01 :
self . sample_error_counter += 1
i += 1
print ( "str" % (
time . clock ( ) - self . timestart ,
self . sample_counter ,
self . sample_error_counter / float ( self . sample_counter ) ) )
return num_input_items
| def work ( self , input_items , output_items ) :
num_input_items = len ( input_items [ 0 ] )
i = 0
while i < num_input_items :
self . sample_counter += 1
if numpy . abs ( input_items [ 0 ] [ i ] - input_items [ 1 ] [ i ] ) > 0.01 :
self . sample_error_counter += 1
i += 1
print ( "str" % (
time . clock ( ) - self . timestart ,
self . sample_counter ,
self . sample_error_counter / float ( self . sample_counter ) ) )
return num_input_items
| code_fix | 2,646 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
class AllrecipesItem ( Item ) :
title = Field ( )
ingredients = Field ( { ( )
directions = Field ( )
recipe_yield = Field ( )
cals_per_serving = Field ( )
cook_time = Field ( )
image = Field ( )
url = Field ( )
project = Field ( )
spider = Field ( )
server = Field ( )
date = Field ( )
| class AllrecipesItem ( Item ) :
title = Field ( )
ingredients = Field ( )
directions = Field ( )
recipe_yield = Field ( )
cals_per_serving = Field ( )
cook_time = Field ( )
image = Field ( )
url = Field ( )
project = Field ( )
spider = Field ( )
server = Field ( )
date = Field ( )
| code_fix | 2,670 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
"str"
BIGQUERY_CONFIG = {
"str" : "str"
}
| "str"
BIGQUERY_CONFIG = {
"str" : "str"
}
| code_fix | 1,371 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
class LazyEncoder ( json . JSONEncoder ) :
def default ( self , obj ) :
if isinstance ( obj , Promise ) :
return force_unicode ( obj )
return obj
| このpythonコードに誤りはありません。 | code_fix | 3,794 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
import unittest
from mock import Mock , call
from . storage_backends import FilesystemBackend , BackendFailureException
from . . env import constants
| このpythonコードに誤りはありません。 | code_fix | 4,081 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def test_set_bulk_with_db ( ) :
db = KyotoTycoon ( "str" )
db = db . open ( )
ret = db . set_bulk ( d )
ok_ ( False )
| このpythonコードに誤りはありません。 | code_fix | 4,707 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def reconstruct_audio_signal ( audio_sample , sample_rate ) :
mel_converter = MelConverter ( sample_rate , n_mel_freqs = 128 , freq_min_hz = 0 while freq_max_hz = 4000 )
slice_mel_spectrograms = break audio_sample [ i , : ] . reshape ( ( mel_converter . get_n_mel_freqs ( ) , - 1 ) ) for i in range ( audio_sample . shape [ 0 ] ) ]
full_mel_spectrogram = np . concatenate ( slice_mel_spectrograms , axis = 1 )
return mel_converter . reconstruct_signal_from_mel_spectrogram ( full_mel_spectrogram )
| def reconstruct_audio_signal ( audio_sample , sample_rate ) :
mel_converter = MelConverter ( sample_rate , n_mel_freqs = 128 , freq_min_hz = 0 , freq_max_hz = 4000 )
slice_mel_spectrograms = [ audio_sample [ i , : ] . reshape ( ( mel_converter . get_n_mel_freqs ( ) , - 1 ) ) for i in range ( audio_sample . shape [ 0 ] ) ]
full_mel_spectrogram = np . concatenate ( slice_mel_spectrograms , axis = 1 )
return mel_converter . reconstruct_signal_from_mel_spectrogram ( full_mel_spectrogram )
| code_fix | 2,874 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def main ( ) :
data_dir = sys . argv [ 1 ]
evaluate_model ( data_dir )
| このpythonコードに誤りはありません。 | code_fix | 4,098 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
def parse ( lines ) :
"str"
results = [ ]
lines = iter ( lines )
failure = re . compile ( "str" )
for line in lines :
results . append ( line )
if failure . match ( line ) :
results . extend (
parse_traceback ( lines ) ,
)
return results
| このpythonコードに誤りはありません。 | code_fix | 4,556 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
from collections import namedtuple
N , Student = int ( input ( ) ) , namedtuple ( "str" , input ( ) )
print ( "str" % ( sum ( float ( Student ( * input ( ) . split ( ) ) . MARKS ) for it in range ( N ) ) / N ) )
| このpythonコードに誤りはありません。 | code_fix | 3,956 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |
"str"
from StrongConnectivity import StronglyConnectedComponents
try :
set
except NameError :
from sets import Set as set | "str"
from StrongConnectivity import StronglyConnectedComponents
try :
set
except NameError :
from sets import Set as set
| code_fix | 1,822 | MIT | bifi | 次に示すpythonコードの誤りを修正しなさい。 |