code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ax.set_xlim([-0.007, 1.0]) ax.set_ylim([0.0, 1.01]) ax.set_xlabel('False Positive Rate') ax.set_ylabel('True Positive Rate') ax.set_title('Receiver operating characteristic (AUC: %.3f)' % auc(fpr, tpr)) ax.plot([0, 1], [0, 1], col...
flexible
{ "blob_id": "5b3514af839c132fda9a2e6e178ae62f780f291e", "index": 3388, "step-1": "<mask token>\n", "step-2": "<mask token>\nax.set_xlim([-0.007, 1.0])\nax.set_ylim([0.0, 1.01])\nax.set_xlabel('False Positive Rate')\nax.set_ylabel('True Positive Rate')\nax.set_title('Receiver operating characteristic (AUC: %.3f...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 import argparse import logging import tango def delete_devices(): """.""" db = tango.Database() class_list = db.get_class_list('*') print('class list = ', class_list) server_list = db.get_server_list('*') print('server list = ', server_list) # for index in range(nu...
normal
{ "blob_id": "f3dad6a474d5882beaac7d98f8f60c347730ee55", "index": 8428, "step-1": "<mask token>\n\n\ndef delete_devices():\n \"\"\".\"\"\"\n db = tango.Database()\n class_list = db.get_class_list('*')\n print('class list = ', class_list)\n server_list = db.get_server_list('*')\n print('server li...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/python # This IDAPython code can be used to de-obfuscate strings generated by # CryptoWall version 3, as well as any other malware samples that make use of # this technique. ''' Example disassembly: .text:00403EC8 mov ecx, 'V' .text:00403ECD mov [ebp+var_1C], cx ...
normal
{ "blob_id": "e38149f0d421a43f6aa34a977eee89fe29021b85", "index": 7451, "step-1": "#!/usr/bin/python\n# This IDAPython code can be used to de-obfuscate strings generated by\n# CryptoWall version 3, as well as any other malware samples that make use of\n# this technique. \n\n'''\nExample disassembly:\n\n\t.text:00...
[ 0 ]
import unittest from unittest.mock import patch from fsqlfly.db_helper import * from fsqlfly.tests.base_test import FSQLFlyTestCase class MyTestCase(FSQLFlyTestCase): def test_positive_delete(self): namespace = Namespace(name='iii') self.session.add(namespace) self.session.commit() ...
normal
{ "blob_id": "abbefb1e426408b32fa9e125c78b572de22dbb8c", "index": 7493, "step-1": "<mask token>\n\n\nclass MyTestCase(FSQLFlyTestCase):\n\n def test_positive_delete(self):\n namespace = Namespace(name='iii')\n self.session.add(namespace)\n self.session.commit()\n t = Transform(name=...
[ 4, 5, 7, 9, 10 ]
# Generated by Django 3.1.7 on 2021-03-24 14:51 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Products_Table', fields=[ ('product_id', mo...
normal
{ "blob_id": "90b9dcd2dfc28446d1979d58ed49a12a85ce5b98", "index": 7429, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def inner_dsym_download(project_id: int, config_id: str) ->None: """Downloads the dSYMs from App Store Connect and stores them in the Project's debug files.""" with sdk.configure_scope() as scope: scope.set_tag('project', project_id) scope.set_tag('config_id', conf...
flexible
{ "blob_id": "51bc2668a9f9f4425166f9e6da72b7a1c37baa01", "index": 9628, "step-1": "<mask token>\n\n\ndef inner_dsym_download(project_id: int, config_id: str) ->None:\n \"\"\"Downloads the dSYMs from App Store Connect and stores them in the Project's debug files.\"\"\"\n with sdk.configure_scope() as scope:\...
[ 3, 5, 7, 9, 10 ]
import numpy as np import sys import os import cv2 if __name__ == "__main__": # print(sys.argv[1]) # img = cv2.imread(sys.argv[1], 0) # cv2.imshow('img', img) # cv2.waitKey(0) img = np.array([[1, 2], [1, 3], [1, 4]]) print(img.tolist()) sys.stdout.flush()
normal
{ "blob_id": "54833c19d68bb7a1817639ef761367ce75a3a46f", "index": 9200, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n img = np.array([[1, 2], [1, 3], [1, 4]])\n print(img.tolist())\n sys.stdout.flush()\n", "step-3": "import numpy as np\nimport sys\nimport os\nimpor...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "fcfec60a2302ee0c1385add053d4371040a2aff4", "index": 3667, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('core', '000...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_input_text(expected_result, actual_result): assert expected_result == actual_result, f'expected {expected_result}, got {actual_result}' <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_speci...
flexible
{ "blob_id": "63391b31d1746f9b3583df5353ae160a430943a9", "index": 9027, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_input_text(expected_result, actual_result):\n assert expected_result == actual_result, f'expected {expected_result}, got {actual_result}'\n\n\n<mask token>\n", "step-3":...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def create_graph(): with tf.gfile.FastGFile(out_pb_path, 'rb') as f: graph_def = tf.GraphDef() graph_def.ParseFromString(f.read()) tf.import_graph_def(graph_def, name='') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|...
flexible
{ "blob_id": "50fab726b90f65a82c1206a8c7df955a8b76da99", "index": 1572, "step-1": "<mask token>\n\n\ndef create_graph():\n with tf.gfile.FastGFile(out_pb_path, 'rb') as f:\n graph_def = tf.GraphDef()\n graph_def.ParseFromString(f.read())\n tf.import_graph_def(graph_def, name='')\n\n\n<mask...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class LetterPage(Page): def __init__(self, page_num, n): super(LetterPage, self).__init__(page_num) self.title = 'Letters' self.in_index = False self.n = n self.tagline = ( 'Email klbscroggsbot@gmail.com and your letter will appear ...
flexible
{ "blob_id": "e714fe0e27ec9ea5acb3120a4d2114d3d7674fcf", "index": 5601, "step-1": "<mask token>\n\n\nclass LetterPage(Page):\n\n def __init__(self, page_num, n):\n super(LetterPage, self).__init__(page_num)\n self.title = 'Letters'\n self.in_index = False\n self.n = n\n self....
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- import luigi from luigi import * #from luigi import Task import pandas as pd from pset.tasks.embeddings.load_embeding import EmbedStudentData from pset.tasks.data.load_dataset import HashedStudentData import numpy as npy import pickle import os class NearestStudents(Task): github_id = Par...
normal
{ "blob_id": "15eed401728e07bfe9299edd12add43ad8b9cb71", "index": 3802, "step-1": "<mask token>\n\n\nclass NearestStudents(Task):\n <mask token>\n <mask token>\n <mask token>\n\n def output(self):\n return luigi.LocalTarget('/Users/adcxdpf/Downloads/pset_03/sd.csv')\n\n def requires(self):\n...
[ 5, 6, 7, 8, 9 ]
import django from rest_framework import serializers from django.shortcuts import render from .models import Student from .serializiers import StudentSerializer from rest_framework.renderers import JSONRenderer from django.http import HttpResponse,JsonResponse import io from rest_framework.parsers import JSONParser f...
normal
{ "blob_id": "99785ffb4b594db1fac05ca3d3f5764151b2b7b6", "index": 103, "step-1": "<mask token>\n\n\n@csrf_exempt\ndef create(request):\n if request.method == 'POST':\n json_data = request.body\n stream = io.BytesIO(json_data)\n pythondata = JSONParser().parse(stream)\n serializer = ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AbstractGraphGenerator(object): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AbstractGraphGenerator(object): def generate(self, graph): Util.abstract() ...
flexible
{ "blob_id": "e37e468d8a41b8711fb0eb4ddec7db67691f9156", "index": 488, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AbstractGraphGenerator(object):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass AbstractGraphGenerator(object):\n\n def generate(self, graph):\n Util.abstrac...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_new_pay_records(process_at, limit=200): with zeus_session() as session: result = session.query(SubsidyPayRecord.id, SubsidyPayRecord. restaurant_id, SubsidyProcessRecord.card_id, SubsidyProcessRecord.processed_at, SubsidyPayRecord.status ...
flexible
{ "blob_id": "68d537cb8488ae4f2c8300e885be78540952dec0", "index": 450, "step-1": "<mask token>\n\n\ndef get_new_pay_records(process_at, limit=200):\n with zeus_session() as session:\n result = session.query(SubsidyPayRecord.id, SubsidyPayRecord.\n restaurant_id, SubsidyProcessRecord.card_id,\...
[ 11, 13, 14, 16, 19 ]
<|reserved_special_token_0|> class Student(andy.Lesson_7.exercise_1.Human): def __init__(self, firstname, lastname, grade): super().__init__(firstname, lastname) self.grade = grade def do_hobby(self): return self.full_name + ' ebet Petra Kovarskogo' <|reserved_special_token_0|> <...
flexible
{ "blob_id": "497f56891670f635feff983058e86055e54be493", "index": 2618, "step-1": "<mask token>\n\n\nclass Student(andy.Lesson_7.exercise_1.Human):\n\n def __init__(self, firstname, lastname, grade):\n super().__init__(firstname, lastname)\n self.grade = grade\n\n def do_hobby(self):\n ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): <|reserved_special_token_0|> def solve_equation(self, m, n): k_l, k_h = 2, n - 1 while k...
flexible
{ "blob_id": "de287d1bc644fdfd0f47bd8667580786b74444d0", "index": 8863, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n <mask token>\n", "step-3": "class Solution(object):\n <mask token>\n\n def solve_equation(self, m, n):\n k_l, k_h = 2, n - 1\n while...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TimestechConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TimestechConfig(AppConfig): name = 'TimesTech' <|reserved_special_token_1|> from djan...
flexible
{ "blob_id": "94f50e371ef65e86d0d2d40a3ed16946f8811be3", "index": 2601, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TimestechConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TimestechConfig(AppConfig):\n name = 'TimesTech'\n", "step-4": "from django.apps impo...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def isPrime(num): if num <= 1: return False elif num == 2: return True elif num % 2 == 0: return False else: sqrt_num = math.sqrt(num) bound = int(sqrt_num) + 1 for i in range(3, bound, 2): if num % i == 0: ...
flexible
{ "blob_id": "7ca7693b842700a7b15242b656648e8a7e58cd23", "index": 1691, "step-1": "<mask token>\n\n\ndef isPrime(num):\n if num <= 1:\n return False\n elif num == 2:\n return True\n elif num % 2 == 0:\n return False\n else:\n sqrt_num = math.sqrt(num)\n bound = int(s...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def ref_mod2(x0, x1, fmod): if x0.dtype == np.float32 or fmod == True: return np.fmod(x0, x1) else: return np.mod(x0, x1) @pytest.mark.parametrize('ctx, func_name', ctxs) @pytest.mark.parametrize('x0_sh...
flexible
{ "blob_id": "32f10c3e73a3d792416f6b2841a80f8b3c390e8c", "index": 9194, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef ref_mod2(x0, x1, fmod):\n if x0.dtype == np.float32 or fmod == True:\n return np.fmod(x0, x1)\n else:\n return np.mod(x0, x1)\n\n\n@pytest.mark.parametrize('ct...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @require_GET def Follow(request, shorturl): link = get_object_or_404(Link, shorturl=shorturl) link.vi += 1 print(link.vi) link.save() return HttpResponseRedirect(link.link) def FormView(request): toplink = Link.objects.annotate(Count('vi')).order_by('-vi__count')...
flexible
{ "blob_id": "11952e60ab95bc1896fd899a5ced126dcafec63a", "index": 9882, "step-1": "<mask token>\n\n\n@require_GET\ndef Follow(request, shorturl):\n link = get_object_or_404(Link, shorturl=shorturl)\n link.vi += 1\n print(link.vi)\n link.save()\n return HttpResponseRedirect(link.link)\n\n\ndef FormV...
[ 2, 4, 5, 6, 7 ]
import subprocess import re class Command: InputSize = 1 OutputSize = 2 MultiThreadable = True ShareResources = False def __init__(self, bin, config, showerr=False): self.travatar = subprocess.Popen([bin, "-config_file", config, "-trace_out", "STDOUT", "-in_format", "egret", "-buffer", "...
normal
{ "blob_id": "91cef72962332e7efcc86f1b19da4382bd72a466", "index": 9278, "step-1": "<mask token>\n\n\nclass Command:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Command:\n <mask token>\n <mask token>\n ...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def commonFactors(self, a: int, b: int) ->int: gcd = math.gcd(a, b) return sum(a % i == 0 and b % i == 0 for i in range(1, gcd + 1))
flexible
{ "blob_id": "ea696329a0cfd558fb592ffaf6339a35e8950a3c", "index": 6721, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def commonFactors(self, a: int, b: int) ->int:\n gcd = math.gcd(a, b)\n return sum(a % i == 0 and b % i == 0 for ...
[ 0, 1, 2 ]
#Define a function max_of_three() that takes three numbers as #arguments and returns the largest of them. def max_of_three(a,b,c): max=0 if a > b: max = a else: max = b if max > c : return max else: return c print max(234,124,43) def max_of_three2(a, b, ...
normal
{ "blob_id": "00b4a57537358797bfe37eee76bbf73ef42de081", "index": 9775, "step-1": "\n\n\n#Define a function max_of_three() that takes three numbers as\n#arguments and returns the largest of them.\n\n\n\n\ndef max_of_three(a,b,c):\n\n max=0\n if a > b:\n max = a\n else:\n max = b\n\n if m...
[ 0 ]
<|reserved_special_token_0|> class TestFileDisplayPane(TestCase): def setUp(self): self.file_display = FileDisplayPane(supported_readers={'Probe': ProbeMultiImageReader()}, supported_parsers={'Probe': ProbeParser()}) self.file_path = test_image_path <|reserved_special_...
flexible
{ "blob_id": "7c65d0bdd4fd808b3d87706357a651601368e43b", "index": 8596, "step-1": "<mask token>\n\n\nclass TestFileDisplayPane(TestCase):\n\n def setUp(self):\n self.file_display = FileDisplayPane(supported_readers={'Probe':\n ProbeMultiImageReader()}, supported_parsers={'Probe':\n ...
[ 5, 6, 7, 8, 9 ]
import numpy as np import matplotlib.pyplot as plt def sample_1(N): numeros=np.array([-10, -5, 3, 9]) return np.random.choice(numeros, N, p=[0.1, 0.4, 0.2, 0.3])#devuelve distro aleatoria con las probabilidades indicadas def sample_2(N): return np.random.exponential(0.5,N)#devuelve numeros aleatorios con distro ex...
normal
{ "blob_id": "d2d04686b3d7f8d01ca195750ca625baa06ed098", "index": 2835, "step-1": "<mask token>\n\n\ndef sample_1(N):\n numeros = np.array([-10, -5, 3, 9])\n return np.random.choice(numeros, N, p=[0.1, 0.4, 0.2, 0.3])\n\n\ndef sample_2(N):\n return np.random.exponential(0.5, N)\n\n\ndef get_mean(sampling...
[ 3, 4, 5, 6, 7 ]
import server.wsgi as flask import server.grunner as gunicorn from utils.cfgreader import EnvReader, BoolVar def use_flask() -> bool: env_var = BoolVar('USE_FLASK', False) return EnvReader().safe_read(env_var) if __name__ == '__main__': if use_flask(): # dev mode, run the WSGI app in Flask dev server ...
normal
{ "blob_id": "ffe10ee8b2ebaad565e9aef5047440a067d4e239", "index": 7528, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef use_flask() ->bool:\n env_var = BoolVar('USE_FLASK', False)\n return EnvReader().safe_read(env_var)\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef use_flask() ->bo...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Script for converting the new csv files to the desirable json format ''' import codecs import json import re def creeper(): ''' Settings for creeper file ''' ccPrefix = False inFilename = u'creeper.csv' outFilename = u'Creeper.json' mappingFil...
normal
{ "blob_id": "5a5b2d0ade5b66981218b4ecf15a2253b7d665f9", "index": 3273, "step-1": "<mask token>\n\n\ndef mediaCreeper():\n \"\"\"\n Settings for mediaCreeper file\n \"\"\"\n ccPrefix = True\n inFilename = u'mediacreeper.csv'\n outFilename = u'MediaCreeper.json'\n run(inFilename, outFilename, ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class BaseModel(object): <|reserved_special_token_0|> <|reserved_special_token_0|> @classmethod def resolve_all(cls): return cls.query.all() <|reserved_special_token_1|> <|reserved_special_token_0|> class BaseModel(object): def get_id(self): retu...
flexible
{ "blob_id": "c9079f27e3c0aca09f99fa381af5f35576b4be75", "index": 4717, "step-1": "<mask token>\n\n\nclass BaseModel(object):\n <mask token>\n <mask token>\n\n @classmethod\n def resolve_all(cls):\n return cls.query.all()\n", "step-2": "<mask token>\n\n\nclass BaseModel(object):\n\n def ge...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def line(body): url = 'https://notify-api.line.me/api/notify' access_token = 'I89UnoDRgRSInUXJOTg5fAniBE08CUuxVqj8ythMLt8' headers = {'Authorization': 'Bearer ' + access_token} message = body payload = {'mess...
flexible
{ "blob_id": "8b598703df67fb8287fe6cdccda5b73bf2892da8", "index": 4878, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef line(body):\n url = 'https://notify-api.line.me/api/notify'\n access_token = 'I89UnoDRgRSInUXJOTg5fAniBE08CUuxVqj8ythMLt8'\n headers = {'Authorization': 'Bearer ' + acces...
[ 0, 1, 2, 3, 4 ]
def getmin(a, b, c): if a <= b and a <= c: print(a) elif b <= a and b <= c: print(b) else: print(c) def filtername(name): if len(name) > 3: return name[:3] elif len(name) < 3: return name + " " * (3 - len(name)) return name def filternames(names): ...
normal
{ "blob_id": "917241482dc1f234d5fae9c107a5f21b018fe6d4", "index": 9843, "step-1": "<mask token>\n\n\ndef filtername(name):\n if len(name) > 3:\n return name[:3]\n elif len(name) < 3:\n return name + ' ' * (3 - len(name))\n return name\n\n\ndef filternames(names):\n re = []\n for n in ...
[ 2, 3, 4, 5, 6 ]
from .candles import CandleCallback from .firestore import FirestoreTradeCallback from .gcppubsub import GCPPubSubTradeCallback from .thresh import ThreshCallback from .trades import ( NonSequentialIntegerTradeCallback, SequentialIntegerTradeCallback, TradeCallback, ) __all__ = [ "FirestoreTradeCallbac...
normal
{ "blob_id": "b6dc29ae5661f84273ff91a124420bc10c7b6f6e", "index": 3704, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['FirestoreTradeCallback', 'GCPPubSubTradeCallback',\n 'CandleCallback', 'TradeCallback', 'ThreshCallback',\n 'SequentialIntegerTradeCallback', 'NonSequentialIntegerTradeC...
[ 0, 1, 2, 3 ]
# Generated by Django 2.2 on 2019-05-13 06:57 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('base_data_app', '0008_key_keyslider'), ] operations = [ migrations.AddField( model_name='key', name='image', ...
normal
{ "blob_id": "ad53b100a1774f5429278379302b85f3a675adea", "index": 8986, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('base_data_a...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Model(pl.LightningModule): <|reserved_special_token_0|> def init_training_parameters(self, criterion, optimizer): self.criterion = criterion self.optimizer = optimizer def set_criterion(self, criterion): self.criterion = criterion <|reserved...
flexible
{ "blob_id": "324081eb4e133f6d16e716f3119e4cbc5e045ede", "index": 8526, "step-1": "<mask token>\n\n\nclass Model(pl.LightningModule):\n <mask token>\n\n def init_training_parameters(self, criterion, optimizer):\n self.criterion = criterion\n self.optimizer = optimizer\n\n def set_criterion(...
[ 8, 10, 12, 15 ]
import pandas as pd from pandas import DataFrame myencoding = 'utf-8' chikenList = ['pelicana', 'nene', 'cheogajip', 'goobne'] # chikenList = ['pelicana'] newframe = DataFrame() for onestore in chikenList: filename = onestore + '.csv' myframe = pd.read_csv(filename, index_col=0, encoding=myencoding) # pr...
normal
{ "blob_id": "11a31d3276201105ca7485fa4e4eb711012accd5", "index": 2190, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor onestore in chikenList:\n filename = onestore + '.csv'\n myframe = pd.read_csv(filename, index_col=0, encoding=myencoding)\n newframe = pd.concat([newframe, myframe], axis=0,...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def gameOver(board, symbol): if board[0] == board[3] == board[6] == symbol or board[1] == board[7 ] == board[4] == symbol or board[2] == board[5] == board[8 ] == symbol or board[0] == board[1] == board[2] == symbol or board[5 ] == board[3] == board[4] == symbol...
flexible
{ "blob_id": "d2f6d7c779d3d6e61d9da7af01a2931fdabec828", "index": 371, "step-1": "<mask token>\n\n\ndef gameOver(board, symbol):\n if board[0] == board[3] == board[6] == symbol or board[1] == board[7\n ] == board[4] == symbol or board[2] == board[5] == board[8\n ] == symbol or board[0] == board[1...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> api.main() <|reserved_special_token_1|> from xrouter import api api.main() <|reserved_special_token_1|> #!/usr/bin/env python from xrouter import api api.main()
flexible
{ "blob_id": "64368679aa2e387e25a36b2f3d0312a99b819e95", "index": 2147, "step-1": "<mask token>\n", "step-2": "<mask token>\napi.main()\n", "step-3": "from xrouter import api\napi.main()\n", "step-4": "#!/usr/bin/env python\nfrom xrouter import api\napi.main()\n", "step-5": null, "step-ids": [ 0, ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> while True: a, b = input().split() a = float(a) b = float(b) if b == 0: print('error') else: c = a / b + 0.5 c = int(c) print(c) <|reserved_special_token_1|> # coding=utf-8 while True: a,b=input().spl...
flexible
{ "blob_id": "dab5e7ee1d14cba485cbaece1354ec8d686ca4ab", "index": 9080, "step-1": "<mask token>\n", "step-2": "while True:\n a, b = input().split()\n a = float(a)\n b = float(b)\n if b == 0:\n print('error')\n else:\n c = a / b + 0.5\n c = int(c)\n print(c)\n", "step...
[ 0, 1, 2 ]
<|reserved_special_token_0|> @jd.get('/routerjson') def apply_jd_waybill(db): query = bottle.request.query if query['method'] == 'jingdong.etms.waybillcode.get': jd_code, resp = jd_get_response_normal() logging.debug('JD response: {} {}'.format(jd_code, resp)) db.add(JdWaybillApplyResp...
flexible
{ "blob_id": "a93884757069393b4d96de5ec9c7d815d58a2ea5", "index": 935, "step-1": "<mask token>\n\n\n@jd.get('/routerjson')\ndef apply_jd_waybill(db):\n query = bottle.request.query\n if query['method'] == 'jingdong.etms.waybillcode.get':\n jd_code, resp = jd_get_response_normal()\n logging.deb...
[ 4, 5, 6, 7, 8 ]
import random #import random module guesses_taken = 0 #assign 0 to guesses_taken variable print('Hello! What is your name?')# print Hello! What is your name? to console myName = input()#take an input from user(name) number = random.randint(1, 20)# make random number between 1 and 19 and save in number variable print...
normal
{ "blob_id": "3302dc058032d9fe412bde6fd89699203526a72d", "index": 4695, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Hello! What is your name?')\n<mask token>\nprint('Well, ' + myName + ', I am thinking of a number between 1 and 20.')\nwhile guesses_taken < 6:\n print('Take a guess.')\n gue...
[ 0, 1, 2, 3, 4 ]
from datetime import datetime from sqlalchemy import Column, Integer, String, ForeignKey, DateTime from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship Base = declarative_base() class BusLine(Base): __tablename__ = "bus_lines" id = Column(Integer, primary_key=True)...
normal
{ "blob_id": "9e896d935cc57e580ed46cd501b41053bbaab38f", "index": 6490, "step-1": "<mask token>\n\n\nclass BusRoute(Base):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass BusRoutePos(Base):\n __tablename__ = 'bus_route_pos'\n id = Column...
[ 12, 15, 16, 17, 19 ]
include('f469-disco/manifest_f469.py') freeze('src')
normal
{ "blob_id": "3b29912788fa4cc76f34f52da7728e934ee96637", "index": 7117, "step-1": "<mask token>\n", "step-2": "include('f469-disco/manifest_f469.py')\nfreeze('src')\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from django.urls import path from .views import * urlpatterns = [path('country', Country_Data, name='country_data'), path( 'tours', Scrape_Data, name='scrape_data'), path('draws', Draw_Data, name='Draw_data')]
normal
{ "blob_id": "b39c783cbaff2915c8864ce0b081b5bf052baee5", "index": 6731, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('country', Country_Data, name='country_data'), path(\n 'tours', Scrape_Data, name='scrape_data'), path('draws', Draw_Data,\n name='Draw_data')]\n", "step-3": "...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class DBException(Exception): """ Represents a generic exception thrown by the Database Manager """ pass class DBManager: def __init__(self, cfg): self.cfg = cfg self.__companies = {} self.__loggedIn = False self.connection = None ...
flexible
{ "blob_id": "31b87a3ceca1f48665ecc9754d5f87bb9b7bbf13", "index": 7579, "step-1": "<mask token>\n\n\nclass DBException(Exception):\n \"\"\"\n Represents a generic exception thrown by the Database Manager\n \"\"\"\n pass\n\n\nclass DBManager:\n\n def __init__(self, cfg):\n self.cfg = cfg\n ...
[ 15, 17, 18, 19, 22 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Login(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Login(models.Model): trinity_...
flexible
{ "blob_id": "1c5cb9363c2903905f1026ede77615e8373c250b", "index": 7321, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Login(models.Model):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Login(models.Model):\n trinity_id = models.CharField('', m...
[ 0, 1, 2, 3, 4 ]
import tensorflow as tf import numpy as np import OpenAi.Pendulum.ActorCritic.Models as Models """ The `Buffer` class implements Experience Replay. --- ![Algorithm](https://i.imgur.com/mS6iGyJ.jpg) --- **Critic loss** - Mean Squared Error of `y - Q(s, a)` where `y` is the expected return as seen by the Target netw...
normal
{ "blob_id": "8a9ed10bf25f3aa13fde43079303194fc6db26c0", "index": 4248, "step-1": "<mask token>\n\n\nclass Agent:\n <mask token>\n\n def record(self, obs_tuple):\n index = self.buffer_counter % self.buffer_capacity\n self.state_buffer[index] = obs_tuple[0]\n self.action_buffer[index] = ...
[ 8, 9, 10, 12, 13 ]
<|reserved_special_token_0|> class _BaseNevergradOptimizer: <|reserved_special_token_0|> def __init__(self, method): self.method = method self.valid_methods = [x[0] for x in ng.optimizers.registry.items()] self.sequential_methods = ['SQPCMA', 'chainCMAPowell', 'Powell'] self.i...
flexible
{ "blob_id": "4a136a6284add3bcbd7f9546e18e79151cea685f", "index": 623, "step-1": "<mask token>\n\n\nclass _BaseNevergradOptimizer:\n <mask token>\n\n def __init__(self, method):\n self.method = method\n self.valid_methods = [x[0] for x in ng.optimizers.registry.items()]\n self.sequentia...
[ 3, 4, 5, 6, 8 ]
from pathlib import Path import eyed3 import csv import sys import filetype import os pathFile = Path( 'C:\\Users\\JORGE\\Music\\Vicente Garcia - Te Soñé (Lyric Video)(MP3_160K).mp3' ) audiofile = eyed3.load(pathFile) with open('loveMusic.csv', 'w', newline='') as csvFile: fieldsName = ['nameFile', 'tittle...
normal
{ "blob_id": "629649abe9d855122a5db6d61a20735ceb89c5cf", "index": 6426, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('loveMusic.csv', 'w', newline='') as csvFile:\n fieldsName = ['nameFile', 'tittle', 'artist', 'gender', 'path']\n writer = csv.DictWriter(csvFile, fieldnames=fieldsName)\n...
[ 0, 1, 2, 3 ]
from tkinter import * import re class Molecule: def __init__(self, nom, poids, adn): self.nom = nom self.poids = poids self.adn = adn def __repr__(self): return "{} : {} g".format(self.nom, self.poids) class Menu: def __init__(self): self.data = dict() se...
normal
{ "blob_id": "4d05e65dce9f689ae533a57466bc75fa24db7b4d", "index": 4558, "step-1": "<mask token>\n\n\nclass Menu:\n\n def __init__(self):\n self.data = dict()\n self.main = Tk()\n self.main.title('Molécules')\n self.main.config(bg='black')\n self.main.minsize(210, 220)\n ...
[ 17, 18, 23, 24, 26 ]
<|reserved_special_token_0|> class REvolution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def get_pop(self): ids = ['x: {} => y: {}'.format('%.3f' % i.value[0], '%.3f' % self. fitness(i.value)) for i in self.population.individuals] ...
flexible
{ "blob_id": "fe13b57484e0f0796164fda99c0d759238a67153", "index": 7215, "step-1": "<mask token>\n\n\nclass REvolution:\n <mask token>\n <mask token>\n <mask token>\n\n def get_pop(self):\n ids = ['x: {} => y: {}'.format('%.3f' % i.value[0], '%.3f' % self.\n fitness(i.value)) for i in...
[ 2, 4, 5, 6, 7 ]
# Comic Downloader #! python3 import urllib, bs4, requests url = 'http://explosm.net/comics/39/' base_url = 'http://explosm.net' for i in range(1,4000): req = requests.get(url) req.raise_for_status() soup = bs4.BeautifulSoup(req.text, "lxml") comic = soup.select('#main-comic') comicUrl = 'http:'...
normal
{ "blob_id": "66e77b8237850a29127402310bfab3061f7ebca4", "index": 2346, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, 4000):\n req = requests.get(url)\n req.raise_for_status()\n soup = bs4.BeautifulSoup(req.text, 'lxml')\n comic = soup.select('#main-comic')\n comicUrl = '...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python # This script deletes and recreates the NIC BoD intents. # Use nic-bod-setup.py to set up the physical network and NEMO nodes first import requests,json import argparse, sys from requests.auth import HTTPBasicAuth USERNAME='admin' PASSWORD='admin' NIC_INTENTS="http://%s:8181/restconf/config/intent...
normal
{ "blob_id": "955017ad7cc9dde744b8d8a9439f63f4725d50bc", "index": 1673, "step-1": "#!/usr/bin/python\n\n# This script deletes and recreates the NIC BoD intents.\n# Use nic-bod-setup.py to set up the physical network and NEMO nodes first\n\nimport requests,json\nimport argparse, sys\nfrom requests.auth import HTTP...
[ 0 ]
#!/usr/bin/python # -*- coding: utf-8 -*- import pandas as pd import numpy as np import datetime import time from sys import exit from matplotlib import colors, pyplot as plt from functools import reduce import matplotlib.cm as cm import seaborn as sns from astropy.io import ascii, fits from astropy.wcs import wcs fr...
normal
{ "blob_id": "736fee6f9a46b8568b2dd217b81d54d689306630", "index": 970, "step-1": "<mask token>\n\n\nclass bcolors:\n HEADER = '\\x1b[95m'\n OKBLUE = '\\x1b[94m'\n OKGREEN = '\\x1b[92m'\n WARNING = '\\x1b[93m'\n FAIL = '\\x1b[91m'\n ENDC = '\\x1b[0m'\n BOLD = '\\x1b[1m'\n UNDERLINE = '\\x1b...
[ 3, 4, 5, 6, 7 ]
L5 = [0]*10 print(L5) L5[2] = 20 print(L5) print(L5[1:4]) L5.append(30) print(L5) L5.remove(30) #Elimina la primera ocurrencia del objeto print(L5) L6 = [1,2,3,4,5,6] print(L6[1::2]) print(L6[::2])
normal
{ "blob_id": "052824082854c5f7721efb7faaf5a794e9be2789", "index": 6517, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(L5)\n<mask token>\nprint(L5)\nprint(L5[1:4])\nL5.append(30)\nprint(L5)\nL5.remove(30)\nprint(L5)\n<mask token>\nprint(L6[1::2])\nprint(L6[::2])\n", "step-3": "L5 = [0] * 10\nprint...
[ 0, 1, 2, 3 ]
import tcod as libtcod import color from input_handlers import consts from input_handlers.ask_user_event_handler import AskUserEventHandler class SelectIndexHandler(AskUserEventHandler): """ Handles asking the user for an index on the map. """ def __init__(self, engine): super().__init__(eng...
normal
{ "blob_id": "8c7dcff80eeb8d7d425cfb25da8a30fc15daf5f9", "index": 4872, "step-1": "<mask token>\n\n\nclass SelectIndexHandler(AskUserEventHandler):\n <mask token>\n <mask token>\n\n def on_render(self, console):\n \"\"\"\n Highlight the tile under the cursor.\n \"\"\"\n super(...
[ 3, 6, 7, 8, 9 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2017/6/20 下午4:00 # @Author : Huang HUi # @Site : # @File : query_parse.py # @Software: PyCharm from mysqlConnection import mysqlConnection import yaml import copy import time import csv import json from collections import OrderedDict import ast # # GIV...
normal
{ "blob_id": "b52807a15cef8f07f685f8761a470d4a24d9c3dc", "index": 6603, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef query_parse(GIVEN_QUERY):\n try:\n countryIds_query = list(map(lambda x: x['country_id'], GIVEN_QUERY[\n 'countries']))\n except:\n countryIds_query...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class max31865(object): <|reserved_special_token_0|> def __init__(self, csPin=8, misoPin=9, mosiPin=10, clkPin=11): self.csPin = csPin self.misoPin = misoPin self.mosiPin = mosiPin self.clkPin = clkPin self.setupGPIO() <|reserved_specia...
flexible
{ "blob_id": "5d92c68e0fe7f37d4719fb9ca4274b29ff1cbb43", "index": 4699, "step-1": "<mask token>\n\n\nclass max31865(object):\n <mask token>\n\n def __init__(self, csPin=8, misoPin=9, mosiPin=10, clkPin=11):\n self.csPin = csPin\n self.misoPin = misoPin\n self.mosiPin = mosiPin\n ...
[ 8, 9, 11, 12, 14 ]
#!/usr/bin/env python3 import pandas as pd import csv def get_apriori_input(input_file,output_file,sample_col="Sample",gene_id_col="Gene_ID"): df=pd.read_csv(input_file,sep="\t") sample_names=df[sample_col].unique() with open(output_file,"w") as out: csv_writer=csv.writer(out,delimiter="\t") ...
normal
{ "blob_id": "e14bea6376c8649bf9c9c5759d530af773664cd4", "index": 891, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_apriori_input(input_file, output_file, sample_col='Sample',\n gene_id_col='Gene_ID'):\n df = pd.read_csv(input_file, sep='\\t')\n sample_names = df[sample_col].unique(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class BaseSearchFilterSet(django_filters.FilterSet): <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, *args, **kwargs): self.facet_config = kwargs.pop('facet_config', {}) self.view = kwargs.pop('view', None) super().__init__...
flexible
{ "blob_id": "f225fbf363f1b170704418ed339f2e57ca790975", "index": 5317, "step-1": "<mask token>\n\n\nclass BaseSearchFilterSet(django_filters.FilterSet):\n <mask token>\n <mask token>\n\n def __init__(self, *args, **kwargs):\n self.facet_config = kwargs.pop('facet_config', {})\n self.view =...
[ 4, 5, 6, 7, 8 ]
import h5py import numpy as np from matplotlib import pyplot from IPython.Shell import IPShellEmbed ipshell = IPShellEmbed("Dropping to IPython shell") filename = "SPY-VXX-20090507-20100427.hdf5" start_day = 1 end_day = 245 #start_day = 108 #end_day = 111 start_day = 120 end_day = 245 start_day = 1 end_day = 120 s...
normal
{ "blob_id": "175e8ecdd0c9faa5fc981447f821763e0eb58b4d", "index": 5609, "step-1": "<mask token>\n", "step-2": "<mask token>\nipshell = IPShellEmbed('Dropping to IPython shell')\nfilename = 'SPY-VXX-20090507-20100427.hdf5'\nstart_day = 1\nend_day = 245\nstart_day = 120\nend_day = 245\nstart_day = 1\nend_day = 12...
[ 0, 1, 2, 3 ]
#! /usr/bin/env python # coding: utf-8 ''' Author: xiezhw3@163.com @contact: xiezhw3@163.com @version: $Id$ Last modified: 2016-01-17 FileName: consumer.py Description: 从 rabbitmq 拿到消息并存储到数据库 ''' import pika import json import logging import pymongo import traceback from conf import config from code.modules.db_proce...
normal
{ "blob_id": "ff26a2c2d8427f1ad4617669e701ea88b34616cd", "index": 9152, "step-1": "<mask token>\n\n\nclass Consumer(object):\n <mask token>\n\n def __init__(self):\n self.db_processor = DbProcessor()\n credentials = pika.PlainCredentials(config.RABBITMQ_USER, config.\n RABBITMQ_PASS...
[ 3, 5, 6, 7, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(""" Your current directory is: """ + curr_path + """ It contains the following files and directories: """ + str(os. listdir('.'))) <|reserved_special_token_0|> os.mkdir(project) os.chdir(project) <|reserved_special...
flexible
{ "blob_id": "0131657a7675904ee2743448f514a9f11e0dc0ad", "index": 7561, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\"\"\"\nYour current directory is: \"\"\" + curr_path +\n \"\"\"\n\nIt contains the following files and directories:\n\n\"\"\" + str(os.\n listdir('.')))\n<mask token>\nos.mkd...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ClassromConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ClassromConfig(AppConfig): name = 'classrom' <|reserved_special_token_1|> from django....
flexible
{ "blob_id": "a995305cb5589fa0cbb246ae3ca6337f4f2c3ca1", "index": 8798, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ClassromConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ClassromConfig(AppConfig):\n name = 'classrom'\n", "step-4": "from django.apps import ...
[ 0, 1, 2, 3 ]
# SPDX-FileCopyrightText: 2023 spdx contributors # # SPDX-License-Identifier: Apache-2.0 from dataclasses import field from beartype.typing import List, Optional from spdx_tools.common.typing.dataclass_with_properties import dataclass_with_properties from spdx_tools.common.typing.type_checks import check_types_and_se...
normal
{ "blob_id": "1c085ea8f9b21ea7bef94ad4ecbb1771a57f697a", "index": 2208, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@dataclass_with_properties\nclass ExternalMap:\n external_id: str\n verified_using: List[IntegrityMethod] = field(default_factory=list)\n location_hint: Optional[str] = None\...
[ 0, 1, 2, 3, 4 ]
#Answer to The Ship Teams - https://py.checkio.org/en/mission/the-ship-teams/ def two_teams(sailors): result = [] #To store the result temp = [[],[]] #To store the intermediatary values for i in sailors.items(): #To get the values of dictionary as Tuple if i[1] > 40 or i[1] < 20: #To get the people...
normal
{ "blob_id": "de634c95fddf4591cb15cd0eb20e798043075798", "index": 2464, "step-1": "<mask token>\n", "step-2": "def two_teams(sailors):\n result = []\n temp = [[], []]\n for i in sailors.items():\n if i[1] > 40 or i[1] < 20:\n temp[0].append(i[0])\n else:\n temp[1].ap...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cv2.imshow('Original', image) cv2.waitKey(0) <|reserved_special_token_0|> cv2.imshow('Rotated by 45 degrees', rotated) cv2.waitKey(0) <|reserved_special_token_0|> cv2.imshow('Rotated by -90 degrees', rotated) cv2.waitKey(0) <|rese...
flexible
{ "blob_id": "4462fec6e0edc25530c93ffeeae2372c86fef2cc", "index": 528, "step-1": "<mask token>\n", "step-2": "<mask token>\ncv2.imshow('Original', image)\ncv2.waitKey(0)\n<mask token>\ncv2.imshow('Rotated by 45 degrees', rotated)\ncv2.waitKey(0)\n<mask token>\ncv2.imshow('Rotated by -90 degrees', rotated)\ncv2....
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class PluginSetupTests(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class PluginSetupTests(unittest.TestCase): def test_plugin_setup(self): self...
flexible
{ "blob_id": "4296dc5b79fd1d2c872eb1115beab52a0f067423", "index": 4816, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass PluginSetupTests(unittest.TestCase):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass PluginSetupTests(unittest.TestCase):\n\n def test_plugin_setup(self):\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('users/', views.UserCreateAPIView.as_view(), name= 'user-list'), path('users/login/', CustomObtainAuthToken.as_view()), path('users/<int:pk>/', views.ReadUserAPIView.as_view()), path( 'users/<int:pk...
flexible
{ "blob_id": "49d76458b8adcf6eea9db2ef127609ff96e03ad1", "index": 6270, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('users/', views.UserCreateAPIView.as_view(), name=\n 'user-list'), path('users/login/', CustomObtainAuthToken.as_view()),\n path('users/<int:pk>/', views.ReadUse...
[ 0, 1, 2 ]
def parse(filename): t1, t2 = open(filename).read().strip().split('\n\n') return tuple(map(lambda x: list(map(int, x.split('\n')[1:])), [t1, t2])) def score(deck): res = 0 for i in range(len(deck)): res += deck[i] * (len(deck) - i) return res <|reserved_special_token_0|> def combat(dec...
flexible
{ "blob_id": "508d016161131481ace41f3d3bda005423125fe5", "index": 5635, "step-1": "def parse(filename):\n t1, t2 = open(filename).read().strip().split('\\n\\n')\n return tuple(map(lambda x: list(map(int, x.split('\\n')[1:])), [t1, t2]))\n\n\ndef score(deck):\n res = 0\n for i in range(len(deck)):\n ...
[ 4, 5, 6, 8, 9 ]
#List methods allow you to modify lists. The following are some list methods for you to practice with. Feel free to google resources to help you with this assignment. #append(element) adds a single element to the list #1. 'Anonymous' is also deserving to be in the hacker legends list. Add him in to the hacker legends ...
normal
{ "blob_id": "53fd020946a2baddb1bb0463d2a56744de6e3822", "index": 5506, "step-1": "<mask token>\n", "step-2": "<mask token>\nhacker_legends.append('Anonymous')\nprint(hacker_legends)\n<mask token>\nnetworking.insert(3, 'SSH')\nprint(networking)\n<mask token>\nip_addy.remove(5102018)\nprint(ip_addy)\n<mask token...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for ti in range(tn): rn, cn = [int(x) for x in input().split()] evenRow = '-'.join(['+'] * (cn + 1)) oddRow = '.'.join(['|'] * (cn + 1)) artrn = rn * 2 + 1 print(f'Case #{ti + 1}:') for ri in range(artrn): ...
flexible
{ "blob_id": "1972e3733918da654cd156a500432a35a239aed4", "index": 1841, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor ti in range(tn):\n rn, cn = [int(x) for x in input().split()]\n evenRow = '-'.join(['+'] * (cn + 1))\n oddRow = '.'.join(['|'] * (cn + 1))\n artrn = rn * 2 + 1\n print(...
[ 0, 1, 2, 3 ]
from graphviz import Digraph dot = Digraph() dot.edge("BaseException", "SystemExit") dot.edge("BaseException", "KeyboardInterrupt") dot.edge("BaseException", "GeneratorExit") dot.edge("BaseException", "Exception") dot.edge("Exception", "StopIteration") dot.edge("Exception", "StopAsyncIteration") dot.edge("Exception",...
normal
{ "blob_id": "a7db627c49b53cd3a073d866a0373336a46b4053", "index": 1088, "step-1": "<mask token>\n", "step-2": "<mask token>\ndot.edge('BaseException', 'SystemExit')\ndot.edge('BaseException', 'KeyboardInterrupt')\ndot.edge('BaseException', 'GeneratorExit')\ndot.edge('BaseException', 'Exception')\ndot.edge('Exce...
[ 0, 1, 2, 3, 4 ]
from functools import partial import numpy as np import scipy.stats as sps # SPMs HRF def spm_hrf_compat(t, peak_delay=6, under_delay=16, peak_disp=1, under_disp=1, p_u_ratio = 6, normalize=True, ...
normal
{ "blob_id": "596ee5568a32c3044e797375fbc705e2091f35c2", "index": 4340, "step-1": "<mask token>\n\n\ndef spm_hrf_compat(t, peak_delay=6, under_delay=16, peak_disp=1, under_disp\n =1, p_u_ratio=6, normalize=True):\n \"\"\" SPM HRF function from sum of two gamma PDFs\n\n This function is designed to be par...
[ 4, 5, 6, 7, 8 ]
import unittest import gym import torch from all.environments import DuplicateEnvironment, GymEnvironment def make_vec_env(num_envs=3): env = [GymEnvironment('CartPole-v0') for i in range(num_envs)] return env class DuplicateEnvironmentTest(unittest.TestCase): def test_env_name(self): env = Dupl...
normal
{ "blob_id": "e01eced7c43aae354047fbf29028c601d1daae50", "index": 9636, "step-1": "<mask token>\n\n\nclass DuplicateEnvironmentTest(unittest.TestCase):\n <mask token>\n\n def test_num_envs(self):\n num_envs = 5\n env = DuplicateEnvironment(make_vec_env(num_envs))\n self.assertEqual(env....
[ 4, 5, 6, 7, 9 ]
#Sorting for a number list #ascending and descending ls=[1,34,23,56,34,67,87,54,62,31,66] ls.sort(reverse=True) print(ls) ls.sort() print(ls) #Sorting a letter's list with different scenarios ls_l=["aaa","ertdf","ieurtff","fnjr","resdjx","jfh","r","fd"] #1-sort according to string length from small length to bigger ls...
normal
{ "blob_id": "0e0e51904f05b41b4769b730c836568b8bb63869", "index": 9564, "step-1": "<mask token>\n\n\ndef secondItem(ls):\n return ls[2]\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef FirstLetter(string):\n return string[0]\n\n\n<mask token>\n\n\ndef secondItem(ls):\n return ls[2]\n\n\n<mask tok...
[ 1, 2, 3, 4, 5 ]
import logging import azure.functions as func def main(event: func.EventHubEvent): logging.info('Python EventHub trigger processed an event: %s', event. get_body().decode('utf-8'))
normal
{ "blob_id": "58f8924a9cd2af4106e54b163e96bcd8517282b5", "index": 2803, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(event: func.EventHubEvent):\n logging.info('Python EventHub trigger processed an event: %s', event.\n get_body().decode('utf-8'))\n", "step-3": "import logging\ni...
[ 0, 1, 2 ]
# pylint: disable=C0103, C0413, E1101, W0611 """Covid Catcher Backend""" import os from os.path import join, dirname import json import requests import flask from flask import request import flask_sqlalchemy import flask_socketio from dotenv import load_dotenv from covid import get_covid_stats_by_state from covid impor...
normal
{ "blob_id": "8d48b5b831edb62b2d9624bc23cae45d390fd224", "index": 8035, "step-1": "<mask token>\n\n\ndef emit_all_users(channel):\n \"\"\"emits all users\"\"\"\n all_users = [user.name for user in db.session.query(models.User1).all()]\n socketio.emit(channel, {'allUsers': all_users})\n return channel\...
[ 12, 13, 14, 18, 19 ]
<|reserved_special_token_0|> class UndoDelegator: <|reserved_special_token_0|> def undo_block_start(*args): pass def undo_block_stop(*args): pass <|reserved_special_token_1|> <|reserved_special_token_0|> class Editor: <|reserved_special_token_0|> def __init__(self, flist=No...
flexible
{ "blob_id": "3b7c30718838a164eaf3aa12cd7b6a68930346f8", "index": 8604, "step-1": "<mask token>\n\n\nclass UndoDelegator:\n <mask token>\n\n def undo_block_start(*args):\n pass\n\n def undo_block_stop(*args):\n pass\n", "step-2": "<mask token>\n\n\nclass Editor:\n <mask token>\n\n d...
[ 3, 7, 8, 9, 10 ]
"""Unit tests for misc. ticket functions.""" from pdm_utils.classes import bundle from pdm_utils.classes import genome from pdm_utils.classes import ticket from pdm_utils.classes import eval from pdm_utils.functions import tickets from pdm_utils.constants import constants import unittest class TestTicketFunctions...
normal
{ "blob_id": "d8ba2557e20920eaadd2fd35f0ebdf1b4a5b33da", "index": 9010, "step-1": "<mask token>\n\n\nclass TestTicketFunctions1(unittest.TestCase):\n\n def setUp(self):\n self.required_keys = constants.IMPORT_TABLE_STRUCTURE['required']\n self.optional_keys = constants.IMPORT_TABLE_STRUCTURE['opt...
[ 22, 24, 27, 39, 40 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def dir_slash(): slash = '/' if 'win' in sys.platform: slash = '\\' return slash <|reserved_special_token_1|> import sys def dir_slash(): slash = '/' if 'win' in sys.platform: slash = '\\...
flexible
{ "blob_id": "b12c8d0cb1cd1e48df6246fe3f16467b2db296e0", "index": 745, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef dir_slash():\n slash = '/'\n if 'win' in sys.platform:\n slash = '\\\\'\n return slash\n", "step-3": "import sys\n\n\ndef dir_slash():\n slash = '/'\n if 'w...
[ 0, 1, 2 ]
#!/usr/bin/python ## # @file # This file is part of SeisSol. # # @author Sebastian Rettenberger (rettenbs AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Sebastian_Rettenberger,_M.Sc.) # # @section LICENSE # Copyright (c) 2013, SeisSol Group # All rights reserved. # # Redistribution and use in source and binary for...
normal
{ "blob_id": "91e1ac12ba99a8efd8f7f26310244d83bdd4aa52", "index": 2510, "step-1": "<mask token>\n\n\nclass Partitioner:\n <mask token>\n\n def __init__(self, mesh, partitions, tmpdir):\n metisMesh = tmpdir.path(METIS_MESH)\n metis.MeshWriter(metisMesh, mesh.elements())\n metisGraph = tm...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- """ Created on Fri Apr 10 01:03:35 2020 @author: Jordan """ import pandas as pd import numpy as np import matplotlib.pyplot as plt from datetime import date ## from COVID19_Simple import * from COVID19_Diff import calc_diff_country ### Dash Stuff ### import dash import dash_core...
normal
{ "blob_id": "1e02d584cde0cdf251aa36abd27b683219ef87ed", "index": 7539, "step-1": "<mask token>\n\n\n@app.callback(Output(component_id='global-box-1', component_property=\n 'figure'), [Input(component_id='global-dropdown', component_property=\n 'value')])\ndef global_update(select_global):\n if select_gl...
[ 3, 4, 5, 6, 7 ]
import torch from torchelie.data_learning import * def test_pixel_image(): pi = PixelImage((1, 3, 128, 128), 0.01) pi() start = torch.randn(3, 128, 128) pi = PixelImage((1, 3, 128, 128), init_img=start) assert start.allclose(pi() + 0.5, atol=1e-7) def test_spectral_image(): pi = SpectralIm...
normal
{ "blob_id": "73cacc1317c8624b45c017144bc7449bc99bd045", "index": 9542, "step-1": "<mask token>\n\n\ndef test_pixel_image():\n pi = PixelImage((1, 3, 128, 128), 0.01)\n pi()\n start = torch.randn(3, 128, 128)\n pi = PixelImage((1, 3, 128, 128), init_img=start)\n assert start.allclose(pi() + 0.5, at...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def corner(data, bins=20, *, range=None, axes_scale='linear', weights=None, color=None, hist_bin_factor=1, smooth=None, smooth1d=None, labels=None, label_kwargs=None, titles=None, show_titles=False, title_quantiles=None, title_fmt='.2f', title_kwargs=None, truths=None, truth_c...
flexible
{ "blob_id": "ae998fb17b8d6f4f5c8871a0ebe86a039501ec99", "index": 5959, "step-1": "<mask token>\n\n\ndef corner(data, bins=20, *, range=None, axes_scale='linear', weights=None,\n color=None, hist_bin_factor=1, smooth=None, smooth1d=None, labels=None,\n label_kwargs=None, titles=None, show_titles=False, titl...
[ 1, 2, 3, 4, 5 ]
from flask import Blueprint, render_template, request, session, url_for, redirect from flask_socketio import join_room, leave_room, send, emit from models.game.game import Game from models.games.games import Games from decorators.req_login import requires_login game_blueprint = Blueprint('game', __name__) @game_bluep...
normal
{ "blob_id": "1ccb23435d8501ed82debf91bd6bf856830d01cb", "index": 6063, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@game_blueprint.route('/<string:game_id>')\n@requires_login\ndef game_index(game_id):\n return render_template('game/game.html')\n", "step-3": "<mask token>\ngame_blueprint = Blu...
[ 0, 1, 2, 3 ]
import numpy as np from sklearn.model_selection import train_test_split from sklearn.datasets import load_digits from sklearn.metrics import confusion_matrix, classification_report from sklearn.preprocessing import LabelBinarizer def tanh(x): return np.tanh(x) def tanh_deriv(x): return 1.0 - np.tanh(x) * np...
normal
{ "blob_id": "a6a5fddb8e1eda4cc8e9c79ad83019f55d149a80", "index": 2988, "step-1": "<mask token>\n\n\ndef tanh(x):\n return np.tanh(x)\n\n\ndef tanh_deriv(x):\n return 1.0 - np.tanh(x) * np.tanh(x)\n\n\n<mask token>\n\n\nclass NeuralNetwork:\n\n def __init__(self, layers, activation='tanh'):\n \"\"...
[ 6, 8, 9, 11, 12 ]
<|reserved_special_token_0|> class DevelopmentConfig(Config): <|reserved_special_token_0|> <|reserved_special_token_0|> class ProductionConfig(Config): DATABASE_URI = '' class TestingConfig(Config): TESTING = True <|reserved_special_token_1|> <|reserved_special_token_0|> class DevelopmentConf...
flexible
{ "blob_id": "d89f0ef24d8e8d23a77cbbb0ae8723c7dec8c00a", "index": 4954, "step-1": "<mask token>\n\n\nclass DevelopmentConfig(Config):\n <mask token>\n <mask token>\n\n\nclass ProductionConfig(Config):\n DATABASE_URI = ''\n\n\nclass TestingConfig(Config):\n TESTING = True\n", "step-2": "<mask token>\...
[ 5, 6, 7, 8, 9 ]
from django.contrib.auth.models import BaseUserManager class MyUserManager(BaseUserManager): def create_user(self, email, password, full_name, national_code, mobile, address): if not email : raise ValueError('ایمیل الزامی است') if not full_name : raise ValueError('نام و نام...
normal
{ "blob_id": "f5f14e4d114855b7eef555db182ee991bdf26c39", "index": 8832, "step-1": "<mask token>\n\n\nclass MyUserManager(BaseUserManager):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass MyUserManager(BaseUserManager):\n <mask token>\n\n def create_superuser(self, email, passwor...
[ 1, 2, 3, 4, 5 ]
from selenium import webdriver from selenium.common.exceptions import TimeoutException from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.keys import Keys from selenium.webdri...
normal
{ "blob_id": "5f490d6a3444b3b782eed5691c82ab7e4b2e55db", "index": 8883, "step-1": "from selenium import webdriver\nfrom selenium.common.exceptions import TimeoutException\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.support.ui import WebDriverWait\nfrom selenium.webdriver.support import e...
[ 0 ]
import numpy as np import cv2 import colorsys from matplotlib import pyplot as plt img = cv2.imread('coins.jpg') b,g,r = cv2.split(img) rgb_img = cv2.merge([r,g,b]) gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) # Blurring image grayBlur = cv2.medianBlur(gray, 3) # Binary threshold ret, thresh = cv2.threshold(grayBl...
normal
{ "blob_id": "39dda191ab2137b5f5538660f17e39b0a1358bf4", "index": 206, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(nodes):\n r, g, b = colorsys.hsv_to_rgb(float(i) / nodes, 1.0, 1.0)\n R, G, B = int(255 * r), int(255 * g), int(255 * b)\n color = [R, G, B]\n print(color)\n ...
[ 0, 1, 2, 3, 4 ]
from _math import Vector2, Vector3, Quaternion, Transform, Vector3Immutable, QuaternionImmutable, minimum_distance from _math import mod_2pi from math import pi as PI, sqrt, fmod, floor, atan2, acos, asin, ceil, pi, e import operator from sims4.repr_utils import standard_repr import enum import native.animation import ...
normal
{ "blob_id": "a0310b1bab339064c36ff0fe92d275db7a6c5ba9", "index": 8734, "step-1": "<mask token>\n\n\ndef rad_to_deg(rad):\n return rad * 180 / PI\n\n\ndef angle_abs_difference(a1, a2):\n delta = sims4.math.mod_2pi(a1 - a2)\n if delta > sims4.math.PI:\n delta = sims4.math.TWO_PI - delta\n return...
[ 52, 53, 55, 64, 75 ]
from Eutils.pathmagic import context with context(): import argparse import numpy as np from model.hourglass_yolo_net_multi_gpu import HOURGLASSYOLONet from evaluator.Eutils.pascal_val import PASCAL_VAL # from evaluator.Eutils.coco_val import COCO_VAL from evaluator.Eutils.detector import Detect...
normal
{ "blob_id": "3bb6305ceb1491db57c7f8b03e438398644c8f90", "index": 8124, "step-1": "<mask token>\n\n\nclass EVALUATOR(object):\n\n def __init__(self, detector, data):\n self.detector = detector\n self.data = data\n self.gt = self.data.gt\n self.image_ids, self.bboxes, self.prob, self...
[ 5, 6, 7, 8, 9 ]
#THIS BUILD WORKS, BUT IS VERY SLOW. CURRENTLY YIELDS A DECENT SCORE, NOT GREAT alphabet = "abcdefghijklmnopqrstuvwxyz" def author(): return "" def student_id(): return "" def fill_words(pattern,words,scoring_f,minlen,maxlen): foundWords = find_words(pattern,words,scoring_f,minlen,maxlen) f...
normal
{ "blob_id": "9bd659bb3bf812e48710f625bb65a848d3a8d074", "index": 594, "step-1": "<mask token>\n\n\ndef author():\n return ''\n\n\ndef student_id():\n return ''\n\n\n<mask token>\n\n\ndef find_words(pattern, words, scoring_f, minlen, maxlen):\n patternCopy = pattern\n bestWord = '', 0\n bestState =...
[ 5, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(contador_letras(lista_animais)) <|reserved_special_token_1|> contador_letras = lambda lista: [len(x) for x in lista] lista_animais = ['cachorro', 'pato', 'marreco'] print(contador_letras(lista_animais)) <|reserved_speci...
flexible
{ "blob_id": "d13957c3d3f4d34279dc660d80ca91ca84ba4a77", "index": 4504, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(contador_letras(lista_animais))\n", "step-3": "contador_letras = lambda lista: [len(x) for x in lista]\nlista_animais = ['cachorro', 'pato', 'marreco']\nprint(contador_letras(list...
[ 0, 1, 2, 3 ]
#SEE /etc/rc.local FOR BOOTUP COMMANDS from Measure_and_File import * from WebServer import * from multiprocessing import * web = WebServer() board_boy = Measurer_and_Filer() #try: proc1 = Process( target=board_boy.measure_and_file, args=() ) proc1.start() proc2 = Process( target=web.serve, args=() ) proc2.start() #...
normal
{ "blob_id": "26744d51dbce835d31d572a053294c9d280e1a8b", "index": 3956, "step-1": "<mask token>\n", "step-2": "<mask token>\nproc1.start()\n<mask token>\nproc2.start()\n", "step-3": "<mask token>\nweb = WebServer()\nboard_boy = Measurer_and_Filer()\nproc1 = Process(target=board_boy.measure_and_file, args=())\...
[ 0, 1, 2, 3, 4 ]
class Point: def __init__(self,x,y): self.x=x self.y=y def __str__(self): return "({0},{1})".format(self.x,self.y) def __add__(self, other): self.x=self.x+other.x self.y=self.y+other.y return Point(self.x,self.y) p1=Point(1,2) p2=Point(3,4) p...
normal
{ "blob_id": "1bebd3c18742f5362d2e5f22c539f6b13ad58d2a", "index": 2873, "step-1": "class Point:\n <mask token>\n\n def __str__(self):\n return '({0},{1})'.format(self.x, self.y)\n\n def __add__(self, other):\n self.x = self.x + other.x\n self.y = self.y + other.y\n return Poin...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class DrawApp(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class SavedDrawings(models.Model): username = models.ForeignK...
flexible
{ "blob_id": "fa566eb77b17830acad8c7bfc2b958760d982925", "index": 7623, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass DrawApp(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass SavedDrawings(models.Model):\n username = models.ForeignKey(settings...
[ 0, 3, 4, 5, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(message, type(message)) <|reserved_special_token_0|> for msg in message: print(msg, message.count(msg)) msg_dict[msg] = message.count(msg) print(msg_dict) <|reserved_special_token_1|> message = ( 'It was a bri...
flexible
{ "blob_id": "20671470c087719fa9ea8ffa25be55e9ade67681", "index": 5373, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(message, type(message))\n<mask token>\nfor msg in message:\n print(msg, message.count(msg))\n msg_dict[msg] = message.count(msg)\nprint(msg_dict)\n", "step-3": "message = (\...
[ 0, 1, 2, 3 ]
from __future__ import division, print_function, unicode_literals import sys import os sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) from pyglet.gl import * from pyglet.window import key from cocos.actions import * from cocos.director import director from cocos.layer import Layer from cocos.scene...
normal
{ "blob_id": "2678aac08104a580e866984bc4cf4adf8cb8ac5c", "index": 5930, "step-1": "<mask token>\n\n\nclass SpriteMoveTo(SpriteLayer):\n <mask token>\n\n\nclass FontLayer(Layer):\n\n def __init__(self, title='Sprite Exmaple #', subtitle='Goto()'):\n super(FontLayer, self).__init__()\n self.titl...
[ 4, 9, 10, 11, 13 ]
<|reserved_special_token_0|> def get_content(t): content = t['full_text'] if 'entities' in t: raw_urls = re.findall( 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+' , content) for m in t['entities']['user_mentions']: screen...
flexible
{ "blob_id": "001d2ae89a2d008fdf6621a1be73de94c766c65f", "index": 4570, "step-1": "<mask token>\n\n\ndef get_content(t):\n content = t['full_text']\n if 'entities' in t:\n raw_urls = re.findall(\n 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\\\(\\\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'\n ...
[ 3, 8, 11, 14, 15 ]