code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
# -*- coding: utf-8 -*- ''' LE JEU DE LA VIE Mini projet numéro 2 de NSI Modélisation Objet : Q1) On peut dégager, au premier abord : une classe cellule (avec un attribut état et un autre voisins) et une classe grille (avec un attribut ordonnée et un autre abscisse). En effet, ce sont les deux éléments du jeu....
normal
{ "blob_id": "cef904b70eb9a997c3c48884ee34665a77e18897", "index": 8465, "step-1": "<mask token>\n\n\nclass Cellule:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def basculer(self):\n \"\"\"mutateur qui change l'état actuel de la cellule ...
[ 20, 23, 24, 28, 32 ]
<|reserved_special_token_0|> class FeatureSelector(metaclass=abc.ABCMeta): <|reserved_special_token_0|> def _setup(self): self.n_features = self.trajectories[0].shape[1] - 1 self.id_reward = self.n_features self.set_reward = frozenset({self.id_reward}) self.id_J_k = -1 ...
flexible
{ "blob_id": "983473129bfd56138a615e0f5bdb1353e9c6d8af", "index": 6441, "step-1": "<mask token>\n\n\nclass FeatureSelector(metaclass=abc.ABCMeta):\n <mask token>\n\n def _setup(self):\n self.n_features = self.trajectories[0].shape[1] - 1\n self.id_reward = self.n_features\n self.set_rew...
[ 16, 18, 20, 22, 23 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Origem = 0') <|reserved_special_token_0|> print('Distância da origem {:.2f}'.format(dist)) <|reserved_special_token_1|> <|reserved_special_token_0|> print('Origem = 0') x = int(input('X: ')) y = int(input('Y: ')) aux = x...
flexible
{ "blob_id": "69d48bc9ecd0f003d7b22c6fbaa532d28137b38e", "index": 7713, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Origem = 0')\n<mask token>\nprint('Distância da origem {:.2f}'.format(dist))\n", "step-3": "<mask token>\nprint('Origem = 0')\nx = int(input('X: '))\ny = int(input('Y: '))\naux =...
[ 0, 1, 2, 3, 4 ]
class Queue: def __init__(self): self.head = None self.tail = None class Node: def __init__(self, data): self.data = data self.next = None <|reserved_special_token_0|> def peek(self): return self.head.data if self.head is not None else None ...
flexible
{ "blob_id": "1aca1cf11d64374d0e0786e74c16567a4c5a1dec", "index": 6452, "step-1": "class Queue:\n\n def __init__(self):\n self.head = None\n self.tail = None\n\n\n class Node:\n\n def __init__(self, data):\n self.data = data\n self.next = None\n <mask token>\n\n...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('{} = {}{}{}{}'.format(num, bit4, bit3, bit2, bit1)) <|reserved_special_token_1|> num = 15850 base = 16 residuo = num % base cociente = num // base bit1 = str(residuo) bit1 = bit1.replace('10', 'a') bit1 = bit1.replace('1...
flexible
{ "blob_id": "2d72f063362aaefdc236e1240020c71bacaf51cf", "index": 8057, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('{} = {}{}{}{}'.format(num, bit4, bit3, bit2, bit1))\n", "step-3": "num = 15850\nbase = 16\nresiduo = num % base\ncociente = num // base\nbit1 = str(residuo)\nbit1 = bit1.replace(...
[ 0, 1, 2, 3 ]
tp = 1, 2, 3 print(tp + (4,))
normal
{ "blob_id": "8e9db58488f6ee8aa0d521a19d9d89504d119076", "index": 6689, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(tp + (4,))\n", "step-3": "tp = 1, 2, 3\nprint(tp + (4,))\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: from .prod_local import * except: pass <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: from .prod_local import * except: pass ELEMENTARY_ALLOW_REPO_CREATION = Tru...
flexible
{ "blob_id": "709271b98fc2b40c763522c54488be36968f02d8", "index": 346, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n from .prod_local import *\nexcept:\n pass\n<mask token>\n", "step-3": "<mask token>\ntry:\n from .prod_local import *\nexcept:\n pass\nELEMENTARY_ALLOW_REPO_CREATION =...
[ 0, 1, 2, 3, 4 ]
<|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": "ca7b3b5df860d3c3fb0953857ad950affdcc671d", "index": 9311, "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 = [('location', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(2, Max): if a[i] == 0: p.append(i) j = i * i while j < Max: a[j] = 1 j = j + i <|reserved_special_token_0|> while p[j] <= n: if p[j] - p[j - 1] == 2: c...
flexible
{ "blob_id": "e828c2792d508ba41c5dca3f4a255eee2611c333", "index": 3565, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(2, Max):\n if a[i] == 0:\n p.append(i)\n j = i * i\n while j < Max:\n a[j] = 1\n j = j + i\n<mask token>\nwhile p[j] <= n:\n ...
[ 0, 1, 2, 3 ]
""" Rectangles: Compute overlapping region of two rectangles. Point(x: number, y: number): Cartesian coordinate pair Rect(ll: Point, ur: Point): A rectangle defined by lower left and upper right coordinates Rect.overlaps(other: Rect) -> boolean: True if non-empty overlap Rect.intersect(other: Rect...
normal
{ "blob_id": "7b9660bba6fcb8c725251971f3733a1cc915c0e7", "index": 760, "step-1": "<mask token>\n\n\nclass Point(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Rect(object):\n \"\"\"A rectangle identified by its lower left\n and upper right corne...
[ 9, 12, 16, 17, 18 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> __all__ = ['BuzzerController', 'CardScanner', 'RFIDController', 'ServoController'] <|reserved_special_token_1|> from .Buzzer import BuzzerController from .Card import CardScanner from .RFID import RFIDController from .Servo...
flexible
{ "blob_id": "8fa78824a38a3b0c1f51aceacab671f987ea2705", "index": 9635, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['BuzzerController', 'CardScanner', 'RFIDController',\n 'ServoController']\n", "step-3": "from .Buzzer import BuzzerController\nfrom .Card import CardScanner\nfrom .RFID im...
[ 0, 1, 2, 3 ]
from django import forms class SignupAliasForm(forms.Form): alias = forms.CharField(max_length=20, required=True) email_secret = forms.CharField(max_length=100, required=True)
normal
{ "blob_id": "953186a330ae9dff15c037b556746590d748c7ad", "index": 4974, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass SignupAliasForm(forms.Form):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass SignupAliasForm(forms.Form):\n alias = forms.CharField(max_length=20...
[ 0, 1, 2, 3 ]
################################################################################ # Controller of the Darwin Squat-Stand task using numpy # # Note: all joint data used in this file uses the dof indexing with # # from the simulation environment, not the hardware. ...
normal
{ "blob_id": "97c5b75323bb143c87972b389e2f27e443c1e00c", "index": 9945, "step-1": "<mask token>\n\n\nclass NP_Net_MirrorSym:\n <mask token>\n\n def load_from_file(self, fname):\n params = joblib.load(fname)\n pol_scope = list(params.keys())[0][0:list(params.keys())[0].find('/')]\n obrms...
[ 8, 12, 14, 16, 17 ]
<|reserved_special_token_0|> def options(opt): generic._options(opt, name) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def options(opt): generic._options(opt, name) def configure(cfg): generic._configure(cfg, name, incs=('czmq.h',), libs=('czmq',), pcnam...
flexible
{ "blob_id": "9e511c769f6ccedc06845a382171fb3729913d05", "index": 9767, "step-1": "<mask token>\n\n\ndef options(opt):\n generic._options(opt, name)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef options(opt):\n generic._options(opt, name)\n\n\ndef configure(cfg):\n generic._configure(cfg, name...
[ 1, 2, 3, 4 ]
import numpy as np import cv2 import time cap = cv2.VideoCapture(0) ret, frame = cap.read() average_stack = np.float32(np.copy(frame))/255 frames = 1.0 while(True): # Capture frame-by-frame ret, frame = cap.read() frame = np.float32(frame)/255 average_stack = average_stack * frames + frame frames...
normal
{ "blob_id": "7fd89272d3d3584f35fd8f552cb7b14e57b7ed1b", "index": 1591, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n ret, frame = cap.read()\n frame = np.float32(frame) / 255\n average_stack = average_stack * frames + frame\n frames += 1.0\n average_stack = average_stack / f...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def estacionamiento_reserva(request, _id): _id = int(_id) try: estacionamiento = Estacionamiento.objects.get(id=_id) except ObjectDoesNotExist: raise Http404 if estacionamiento.apertura is None: return HttpResponse(status=403) if request.method ...
flexible
{ "blob_id": "1a46752a2d1c72ec6084e7af3694a3969e2d1b4c", "index": 1772, "step-1": "<mask token>\n\n\ndef estacionamiento_reserva(request, _id):\n _id = int(_id)\n try:\n estacionamiento = Estacionamiento.objects.get(id=_id)\n except ObjectDoesNotExist:\n raise Http404\n if estacionamient...
[ 5, 7, 9, 10, 11 ]
def count_singlekey(inputDict, keyword): # sample input # inputDict = { # abName1: { dna: 'atgc', protein: 'x' } # abName2: { dna: 'ctga', protein: 'y' } # } countDict = {} for abName, abInfo in inputDict.iteritems(): if countDict.has_key(abInfo[keyword]): countDict[abInfo[keyword]...
normal
{ "blob_id": "b164dc8183c0dc460aa20883553fc73acd1e45ec", "index": 7828, "step-1": "<mask token>\n", "step-2": "def count_singlekey(inputDict, keyword):\n countDict = {}\n for abName, abInfo in inputDict.iteritems():\n if countDict.has_key(abInfo[keyword]):\n countDict[abInfo[keyword]][1]...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def create_users(): for i in range(10): user = User(name=fake.name(), email=fake.email()) session.add(user) def create_courses(): for user in session.query(User).all(): for i in range(2): course = Course(name=''.join(fake.words(4)), user_id=us...
flexible
{ "blob_id": "6c94b487eaa179a70ea6528b0214d04d5148574f", "index": 4070, "step-1": "<mask token>\n\n\ndef create_users():\n for i in range(10):\n user = User(name=fake.name(), email=fake.email())\n session.add(user)\n\n\ndef create_courses():\n for user in session.query(User).all():\n fo...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class NeuralNetwork: def __init__(self, layer1, layer2): self.layer1 = layer1 self.layer2 = layer2 <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def think(self, inputs): output_from_layer1 = self.__sigm...
flexible
{ "blob_id": "8109fcc136b967e0ed4ca06077b32612605d5e5f", "index": 1136, "step-1": "<mask token>\n\n\nclass NeuralNetwork:\n\n def __init__(self, layer1, layer2):\n self.layer1 = layer1\n self.layer2 = layer2\n <mask token>\n <mask token>\n <mask token>\n\n def think(self, inputs):\n ...
[ 3, 6, 8, 9, 10 ]
<|reserved_special_token_0|> class ElementarySortTest(unittest.TestCase): <|reserved_special_token_0|> def test_insertion_sort(self): insertion = Insertion() actual = Utilities.generate_random_array(self.n) expected = list(actual) actual.sort() insertion.sort(expected)...
flexible
{ "blob_id": "779ef8942bfb55bf017a8da9dfe34c03ac574a9a", "index": 2591, "step-1": "<mask token>\n\n\nclass ElementarySortTest(unittest.TestCase):\n <mask token>\n\n def test_insertion_sort(self):\n insertion = Insertion()\n actual = Utilities.generate_random_array(self.n)\n expected = l...
[ 5, 6, 7, 8 ]
<|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": "5acbd6002c5e3cfac942d52b788f18c6afa92da2", "index": 7028, "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 = [('examen', '0...
[ 0, 1, 2, 3, 4 ]
import torch from torch import nn import pytorch_ssim class Custom_Loss_for_Autoencoder(nn.Module): def __init__(self, window_size=6): super(Custom_Loss_for_Autoencoder, self).__init__() self.ssim = pytorch_ssim.SSIM(window_size=window_size) self.mse = nn.MSELoss() def forward(self, ...
normal
{ "blob_id": "ce3e2aa2534bb404b45202bcb76e9d07080560cb", "index": 2739, "step-1": "<mask token>\n\n\nclass Custom_Loss_for_Autoencoder(nn.Module):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Custom_Loss_for_Autoencoder(nn.Module):\n <mask token>\n\n def forward(self, reconst...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> regressor.fit(X, y) <|reserved_special_token_0|> X_test.shape <|reserved_special_token_0|> y_pred <|reserved_special_token_0|> y_pred for i in range(len(y_pred)): print(y_pred[i]) <|reserved_special_token_0|> VIX.iloc[40:2476]...
flexible
{ "blob_id": "4a8d203872a1e86c54142dea6cd04c1cac6bcfb2", "index": 5067, "step-1": "<mask token>\n", "step-2": "<mask token>\nregressor.fit(X, y)\n<mask token>\nX_test.shape\n<mask token>\ny_pred\n<mask token>\ny_pred\nfor i in range(len(y_pred)):\n print(y_pred[i])\n<mask token>\nVIX.iloc[40:2476]\n<mask tok...
[ 0, 1, 2, 3, 4 ]
import tensorflow as tf class Config(object): # Source and Target files from_train_file='data/dev.en' to_train_file='data/dev.vi' # Special characters and ID's _PAD = b"_PAD" _GO = b"_GO" _EOS = b"_EOS" _UNK = b"_UNK" _START_VOCAB = [_PAD, _GO, _EOS, _UNK] PAD_ID = 0 GO_I...
normal
{ "blob_id": "c27c2df1830f066ca4f973c46967722869090d05", "index": 1373, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Config(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>...
[ 0, 1, 2, 3, 4 ]
try: a=100 b=a/0 print(b) except ZeroDivisionError as z: print("Error= ",z)
normal
{ "blob_id": "9dead39e41fd0f3cff43501c659050885a50fec3", "index": 4521, "step-1": "<mask token>\n", "step-2": "try:\n a = 100\n b = a / 0\n print(b)\nexcept ZeroDivisionError as z:\n print('Error= ', z)\n", "step-3": "try:\r\n a=100\r\n b=a/0\r\n print(b)\r\nexcept ZeroDivisionError as z:...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class TestPycmbsData4D(unittest.TestCase): def setUp(self): pass <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestPycmbsData4D(unittest.TestCase): def setUp(self): pass d...
flexible
{ "blob_id": "87562ce2a957de3fa2eb84cbb0de18c6ce264c6b", "index": 7676, "step-1": "<mask token>\n\n\nclass TestPycmbsData4D(unittest.TestCase):\n\n def setUp(self):\n pass\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass TestPycmbsData4D(unittest.TestCase):\n\n def setUp(s...
[ 2, 3, 4, 5, 6 ]
#! /usr/bin/env python #printing the sum of the even Fibonacci numbers n= int(raw_input("enter your number")) sumeven=0 # Defining the Fibonacci function def fib(n): a,b = 0,1 #first numbers of the sequence while 1: yield a a,b = b,a+b #generator for the next number in the sequence a = fib(n) for i in range(n...
normal
{ "blob_id": "24290f3a6cf9a0a272186a505d31c62a6f278c86", "index": 480, "step-1": "#! /usr/bin/env python\n#printing the sum of the even Fibonacci numbers\n\nn= int(raw_input(\"enter your number\"))\nsumeven=0\n# Defining the Fibonacci function\ndef fib(n): \n\ta,b = 0,1 #first numbers of the sequence \n\twhile 1:...
[ 0 ]
from kafka import KafkaProducer import json msg_count = 50 producer = KafkaProducer(bootstrap_servers=['localhost:9092']) for i in range(0, msg_count): msg = {'id': i + 20, 'payload': 'Here is test message {}'.format(i + 20)} sent = producer.send('test-topic2', bytes(json.dumps(msg), 'utf-8'))
normal
{ "blob_id": "d763485e417900044d7ce3a63ef7ec2def115f05", "index": 7263, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, msg_count):\n msg = {'id': i + 20, 'payload': 'Here is test message {}'.format(i + 20)}\n sent = producer.send('test-topic2', bytes(json.dumps(msg), 'utf-8'))\n", ...
[ 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": "43dc69c66d94d85337c11eb4cfed48d7fdef2074", "index": 5770, "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 = [('recipe', '0...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- ########################### # CSCI 573 Data Mining - Eclat and Linear Kernel SVM # Author: Chu-An Tsai # 12/14/2019 ########################### import fim import numpy as np from sklearn.model_selection import train_test_split, GridSearchCV from sklearn.svm import SVC from sklearn.m...
normal
{ "blob_id": "07b05093b630fc0167532884ec69a00420ed70b4", "index": 4021, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in lines:\n strpline = line.rstrip()\n arr = strpline.split(',')\n newline = []\n for i in range(len(arr)):\n if arr[i] == 'y':\n newline.append(i)\...
[ 0, 1, 2, 3, 4 ]
class HashTable: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class HashTable: <|reserved_special_token_0|> def hash(self, chave): return int(chave) <|reserved_special_token_0|> <|...
flexible
{ "blob_id": "f14d46bedd5f6e0081a982251ad45e95860ef310", "index": 209, "step-1": "class HashTable:\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "class HashTable:\n <mask token>\n\n def hash(self, chave):\n return int(chave)\n <mask token>\n\n\n<mask token...
[ 1, 2, 3, 4, 5 ]
from django.db import models class Course(models.Model): cid = models.CharField(max_length=100) title = models.CharField(max_length=500) link = models.CharField(max_length=300)
normal
{ "blob_id": "226fc85dc8b6d549fddef0ca43ad629875ac0717", "index": 3080, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Course(models.Model):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Course(models.Model):\n cid = models.CharField(max_length...
[ 0, 1, 2, 3 ]
import sys n=int(input().strip()) a=list(input().strip().split(' ')) H=list(input().strip().split(' ')) a = [int(i) for i in a] m=int(H[0]) hmin=int(H[1]) hmax=int(H[2]) pos=0 found = 0 d=a[-1]-a[0] if(d==m): print(a[0]) elif(0<d<m): for i in range(hmin, hmax+1): fin1 = a[0]-i+m if(hmin<=fin1-...
normal
{ "blob_id": "3da82bcff0a4f91c1245892bc01e9f743ea354a8", "index": 4484, "step-1": "<mask token>\n", "step-2": "<mask token>\nif d == m:\n print(a[0])\nelif 0 < d < m:\n for i in range(hmin, hmax + 1):\n fin1 = a[0] - i + m\n if hmin <= fin1 - a[-1] <= hmax or fin1 == a[-1]:\n prin...
[ 0, 1, 2, 3, 4 ]
from brie.config import ldap_config from brie.model.ldap import * from brie.lib.log_helper import BrieLogging import datetime import smtplib class Residences: @staticmethod def get_dn_by_name(user_session, name): result = user_session.ldap_bind.search_first(ldap_config.liste_residence_dn, "(cn=" +...
normal
{ "blob_id": "d726e468a9df26f1bcb8a016812b87fad7b41aa8", "index": 8089, "step-1": "<mask token>\n\n\nclass CotisationComputes:\n\n @staticmethod\n def current_year():\n now = datetime.datetime.now()\n if now.month > 8:\n return now.year + 1\n return now.year\n\n @staticmet...
[ 11, 12, 16, 17, 23 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: for i in range(0, 8): temp = str(23 + i) + '-05-21' for pincode in pincodes: req = Request( 'https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/calendarByPin?pi...
flexible
{ "blob_id": "7c60ae58b26ae63ba7c78a28b72192373cc05a86", "index": 1211, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n for i in range(0, 8):\n temp = str(23 + i) + '-05-21'\n for pincode in pincodes:\n req = Request(\n 'https://cdn-api.co-vin.in/api...
[ 0, 1, 2, 3, 4 ]
from django.shortcuts import render from post.models import * from .models import * from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator from account.models import Profile from django.contrib.auth.models import User from django.db.models import Q # Create your views here. def index(request): posts...
normal
{ "blob_id": "ee3718dee869a58089e897489af2eec3ff72be56", "index": 3478, "step-1": "<mask token>\n\n\ndef index(request):\n posts = Post.objects.order_by('-created_at').filter(status='Published')\n paginator = Paginator(posts, 9)\n page = request.GET.get('page')\n post_listings = paginator.get_page(pag...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python ################################################################################ # # HDREEnable.py # # Version: 1.000 # # Author: Gwynne Reddick # # Description: # # # Usage: # # Last Update 16:49 08/12/10 # ################################################################################ # pa...
normal
{ "blob_id": "78a96020abfd393438c2fce1dfd5fd159a23ca5a", "index": 9666, "step-1": "<mask token>\n\n\ndef itemexists(name):\n lx.eval('select.item {%s} set' % name)\n selected = lx.evalN('item.name ?')\n return name in selected\n\n\ndef lockcamera():\n if not itemexists('HDRECam_Grp'):\n lx.eval...
[ 6, 7, 9, 10, 11 ]
<|reserved_special_token_0|> def get_partition(subject_id: int) ->str: if subject_id <= 10: return TEST elif subject_id <= 15: return VALID else: return TRAIN def data_generator(input_folder: str) ->Iterable[Tuple[Dict[str, Any], str]]: sample_id = 0 for subject_id in sor...
flexible
{ "blob_id": "e82dd2792ecbb8ed5a33012239102d2c6a02202b", "index": 1749, "step-1": "<mask token>\n\n\ndef get_partition(subject_id: int) ->str:\n if subject_id <= 10:\n return TEST\n elif subject_id <= 15:\n return VALID\n else:\n return TRAIN\n\n\ndef data_generator(input_folder: str...
[ 3, 4, 5, 6, 7 ]
# coding: utf-8 """ Meme Meister API to create memes # noqa: E501 OpenAPI spec version: 0.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import swagger_client from swagger_client.api.default_api import DefaultA...
normal
{ "blob_id": "fca46c095972e8190ee9c93f3bddbb2a49363a7f", "index": 6903, "step-1": "<mask token>\n\n\nclass TestDefaultApi(unittest.TestCase):\n <mask token>\n <mask token>\n\n def tearDown(self):\n pass\n <mask token>\n\n def test_meme_meme_id_delete(self):\n \"\"\"Test case for meme_...
[ 5, 8, 9, 10, 11 ]
<|reserved_special_token_0|> class Guest: <|reserved_special_token_0|> def parked_and_linkedplatform_value(self): boolean, linkedplatform = (self.CarRotationManager. check_if_guest_parked(self)) if boolean == True: self.parked = True self.linkedplatform = l...
flexible
{ "blob_id": "3553fa72cb831f82a1030b9eadc9594eee1d1422", "index": 2152, "step-1": "<mask token>\n\n\nclass Guest:\n <mask token>\n\n def parked_and_linkedplatform_value(self):\n boolean, linkedplatform = (self.CarRotationManager.\n check_if_guest_parked(self))\n if boolean == True:\...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): def wiggleMaxLength(self, nums): """ :type nums: List[int] :rtype: int """ length = len(nums) ...
flexible
{ "blob_id": "6c1f7b8e71760cac443a06f68f5f6ee3c2151e50", "index": 8170, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n", "step-3": "class Solution(object):\n\n def wiggleMaxLength(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \...
[ 0, 1, 2, 3 ]
def hello_func(): pass <|reserved_special_token_0|> <|reserved_special_token_1|> def hello_func(): pass <|reserved_special_token_0|> def hello_func(): print('hello function!') hello_func() <|reserved_special_token_1|> def hello_func(): pass <|reserved_special_token_0|> def hello_func...
flexible
{ "blob_id": "94a0b341aac3683712578b31e98a0a5a6a643b57", "index": 7646, "step-1": "def hello_func():\n pass\n\n\n<mask token>\n", "step-2": "def hello_func():\n pass\n\n\n<mask token>\n\n\ndef hello_func():\n print('hello function!')\n hello_func()\n", "step-3": "def hello_func():\n pass\n\n\n<...
[ 1, 2, 3, 4, 5 ]
import hashlib import hmac import time def hmac_sha1_token(): timestamp = str(time.time()) hmac_pass = hmac.new(b'some very secret string', timestamp.encode( 'utf-8'), hashlib.sha1).hexdigest() token = '%s:%s' % (timestamp, hmac_pass) return token
normal
{ "blob_id": "65ef3b2ed5eef3d9d9e682ca18cf84457e929df2", "index": 2222, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef hmac_sha1_token():\n timestamp = str(time.time())\n hmac_pass = hmac.new(b'some very secret string', timestamp.encode(\n 'utf-8'), hashlib.sha1).hexdigest()\n toke...
[ 0, 1, 2 ]
import pygame import utils from random import randint class TileSurface(): tileGroup = pygame.sprite.Group() tileGrid = [] def __init__(self, x, y, width, height): self.x = x self.y = y self.width = width self.height = height self.surface = pygame.Surface((width, height)) def updatePos(self, x, y): ...
normal
{ "blob_id": "0c8eb90c1d8a58f54186a30ce98a67310955a367", "index": 3024, "step-1": "<mask token>\n\n\nclass Tile(pygame.sprite.Sprite):\n <mask token>\n <mask token>\n\n def __init__(self, sprite, x, y, surface):\n super().__init__()\n self.image = pygame.image.load(sprite).convert_alpha()\n...
[ 7, 13, 14, 15, 16 ]
import numpy as np import pandas as pd from sklearn.metrics import confusion_matrix from sklearn.metrics import classification_report from sklearn.metrics import precision_score, recall_score, f1_score from scipy.optimize import fsolve import numba from numba import njit,jit # @jit(parallel = True) def conventional_tes...
normal
{ "blob_id": "e564e0d05c3c0e60f356422722803df510d9dd0b", "index": 281, "step-1": "<mask token>\n\n\n@njit(parallel=True)\ndef parallel_test(subject_array, typeII_error, typeI_error, num):\n test_result = np.zeros(subject_array.shape, dtype=int)\n random_table = np.random.uniform(0, 1, (subject_array.shape[0...
[ 10, 14, 15, 17, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def find_all_links(text): result = [] iterator = re.finditer('https?\\:\\/\\/(www)?\\.?\\w+\\.\\w+', text) for match in iterator: result.append(match.group()) return result <|reserved_special_token_1|> ...
flexible
{ "blob_id": "b8c7aa5ff7387eacb45d996fa47186d193b44782", "index": 4823, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef find_all_links(text):\n result = []\n iterator = re.finditer('https?\\\\:\\\\/\\\\/(www)?\\\\.?\\\\w+\\\\.\\\\w+', text)\n for match in iterator:\n result.append(m...
[ 0, 1, 2, 3 ]
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
normal
{ "blob_id": "6a954197b13c9adf9f56b82bcea830aaf44e725f", "index": 8999, "step-1": "<mask token>\n\n\nclass TriggerPipelineReference(Model):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TriggerPipelineReference(Model):\n <mask token>\n _attribute_map = {'pipe...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(top * bottom) <|reserved_special_token_1|> <|reserved_special_token_0|> n, m, a = map(int, input().split()) top = math.ceil(n / a) bottom = math.ceil(m / a) print(top * bottom) <|reserved_special_token_1|> import math ...
flexible
{ "blob_id": "6c426d2b165e01a7cec9f7ddbd96113ae05668f6", "index": 4898, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(top * bottom)\n", "step-3": "<mask token>\nn, m, a = map(int, input().split())\ntop = math.ceil(n / a)\nbottom = math.ceil(m / a)\nprint(top * bottom)\n", "step-4": "import math...
[ 0, 1, 2, 3 ]
# Pass Function def hello_func(): pass hello_func() print(hello_func()) def hello_func(): hello_func() print(hello_func) # Function allows to reuse ,without repeat def hello_func(): print('hello function!') hello_func()
normal
{ "blob_id": "94a0b341aac3683712578b31e98a0a5a6a643b57", "index": 7646, "step-1": "def hello_func():\n pass\n\n\n<mask token>\n", "step-2": "def hello_func():\n pass\n\n\n<mask token>\n\n\ndef hello_func():\n print('hello function!')\n hello_func()\n", "step-3": "def hello_func():\n pass\n\n\n<...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in open('Automotive_5.json', 'r'): list_data.append(json.loads(line)) for item in list_data: list_data_only_reviews.append(item['reviewText']) list_data_reviewerid.append(item['reviewerID']) <|reserved_special...
flexible
{ "blob_id": "43b519d7db2e46a0bf9317eddac1f5cf6b7b79e3", "index": 6417, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in open('Automotive_5.json', 'r'):\n list_data.append(json.loads(line))\nfor item in list_data:\n list_data_only_reviews.append(item['reviewText'])\n list_data_revieweri...
[ 0, 1, 2, 3, 4 ]
import copy import time import random from twisted.python import log, failure from twisted.internet import defer, error, protocol, reactor from twisted.protocols import basic, policies from pn.util import url from pn.core import stream as stream_mod try: from collections import deque except ImportError: class dequ...
normal
{ "blob_id": "57ab0421d5234caf7a97ce93908cd07e23f53a0b", "index": 9037, "step-1": "import copy\nimport time\nimport random\n\nfrom twisted.python import log, failure\nfrom twisted.internet import defer, error, protocol, reactor\nfrom twisted.protocols import basic, policies\n\nfrom pn.util import url\nfrom pn.cor...
[ 0 ]
<|reserved_special_token_0|> class EfficientDoubleExcitation2(AnsatzElement): def __init__(self, qubit_pair_1, qubit_pair_2): self.qubit_pair_1 = qubit_pair_1 self.qubit_pair_2 = qubit_pair_2 super(EfficientDoubleExcitation2, self).__init__(element= 'optimized_d_exc {}, {}'.fo...
flexible
{ "blob_id": "24cdbbadc8ff1c7ad5d42eeb518cb6c2b34724a2", "index": 263, "step-1": "<mask token>\n\n\nclass EfficientDoubleExcitation2(AnsatzElement):\n\n def __init__(self, qubit_pair_1, qubit_pair_2):\n self.qubit_pair_1 = qubit_pair_1\n self.qubit_pair_2 = qubit_pair_2\n super(EfficientDo...
[ 3, 5, 6, 7, 11 ]
#%% [markdown] # # Look at intron-less gene enrichment in Cyte biased expressed genes. # This is a quick look at if parimary spermatocyte biased genes are enriched in intronless genes. # Yes this is what we see. #%% import os import pickle import numpy as np import pandas as pd from scipy.stats import fisher_exact, c...
normal
{ "blob_id": "5f4d83aa2b530417ecb1598510fb4778b111700b", "index": 6489, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n os.chdir(os.path.join(os.getcwd(), 'docs'))\n print(os.getcwd())\nexcept:\n pass\n<mask token>\ng.map(sns.boxplot, 'intronless', 'pct_cyte', order=[False, True])\ng.set_yl...
[ 0, 1, 2, 3, 4 ]
# the main program of this project import log import logging import os from ast_modifier import AstModifier from analyzer import Analyzer class Demo(): def __init__(self): self.log = logging.getLogger(self.__class__.__name__) def start(self, filename: str): self.log.debug('analyse file: ' + fil...
normal
{ "blob_id": "e989f73011559080f96802dba4db30361d5626f9", "index": 4002, "step-1": "<mask token>\n\n\nclass Demo:\n\n def __init__(self):\n self.log = logging.getLogger(self.__class__.__name__)\n\n def start(self, filename: str):\n self.log.debug('analyse file: ' + filename)\n astmodif =...
[ 3, 4, 5, 6, 7 ]
# 4. Пользователь вводит целое положительное число. # Найдите самую большую цифру в числе. Для решения используйте цикл while и арифметические операции. income_number = int(input('Введите, пожалуйста, целое положительное число ')) max_number = 0 # в другую сторону решение, не так как Вы на вебинаре советовали, но тож...
normal
{ "blob_id": "18e0ece7c38169d2de91a07dddd4f40b7427848f", "index": 3759, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile income_number != 0:\n num_exp = 10 ** (len(str(income_number)) - 1)\n deleted_number = int(income_number / num_exp)\n if max_number < deleted_number:\n max_number = ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class ServicesTests(TestCase): def setUp(self): self.tag = TagFactory() self.blog_post = BlogPostFactory() self.client = Client() self.user = User.objects.create_user(username=faker.name(), password='Ivoepanda') def test_create_new_pos...
flexible
{ "blob_id": "c9d25460022bb86c821600dfaed17baa70531c9f", "index": 7125, "step-1": "<mask token>\n\n\nclass ServicesTests(TestCase):\n\n def setUp(self):\n self.tag = TagFactory()\n self.blog_post = BlogPostFactory()\n self.client = Client()\n self.user = User.objects.create_user(use...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def validRows(grid): found_zero = False for row in range(9): bit_dict = {} for col in range(9): current_item = grid[row][col] if current_item != 0 and current_item in bit_dict: return False else: b...
flexible
{ "blob_id": "67452f31a49f50cdb2555406287b31e53a994224", "index": 7906, "step-1": "<mask token>\n\n\ndef validRows(grid):\n found_zero = False\n for row in range(9):\n bit_dict = {}\n for col in range(9):\n current_item = grid[row][col]\n if current_item != 0 and current_...
[ 5, 7, 9, 12, 13 ]
from aspose.email.storage.pst import * from aspose.email.mapi import MapiCalendar from aspose.email.mapi import MapiRecipientType from aspose.email.mapi import MapiRecipientCollection from aspose.email.mapi import MapiRecipient import datetime as dt from datetime import timedelta import os def run(): dataDir = "Dat...
normal
{ "blob_id": "8a6028aa477f697946ab75411b667f559e87141c", "index": 7072, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run():\n dataDir = 'Data/'\n personalStorage = PersonalStorage.from_file(dataDir + 'Outlook.pst')\n for folder in personalStorage.root_folder.get_sub_folders():\n ...
[ 0, 1, 2, 3, 4 ]
def largestVar(s: str): freq = {i:0 for i in range(26)} for i in range(len(s)): freq[(int) (chr(i) - 'a')] += 1 max_var = 0 for a in range(26): for b in range(26): left_a = freq[a] left_b = freq[b]
normal
{ "blob_id": "4bd2923381cd3ead9a5605363a86f41b3743bf27", "index": 7223, "step-1": "<mask token>\n", "step-2": "def largestVar(s: str):\n freq = {i: (0) for i in range(26)}\n for i in range(len(s)):\n freq[int(chr(i) - 'a')] += 1\n max_var = 0\n for a in range(26):\n for b in range(26):...
[ 0, 1, 2 ]
from django.views import generic from .models import Project class IndexView(generic.ListView): template_name = "projects/index.html" context_object_name = "projectz" def get_queryset(self): """Return all projects.""" return Project.objects.all() class DetailView(generic.DetailView): ...
normal
{ "blob_id": "23d15c719cd26ea67a032a91a3e73f0d8d3bcfd1", "index": 6662, "step-1": "<mask token>\n\n\nclass DetailView(generic.DetailView):\n model = Project\n template_name = 'projects/detail.html'\n", "step-2": "<mask token>\n\n\nclass IndexView(generic.ListView):\n <mask token>\n <mask token>\n\n ...
[ 2, 4, 5, 6, 7 ]
import os import glob import pandas as pd import xml.etree.ElementTree as ET import argparse import numpy as np def run(path, output): #xml_df = xml_to_csv(path) #xml_df.to_csv(output, index=None) # for filename in os.listdir(path): # base_file, ext = os.path.splitext(filename) # print(bas...
normal
{ "blob_id": "26d14bc74d893f6f14ee7405280f4af41854c544", "index": 141, "step-1": "<mask token>\n\n\ndef run(path, output):\n for xml_file in glob.glob(path + '/*.xml'):\n tree = ET.parse(xml_file)\n root = tree.getroot()\n base_file, ext = os.path.splitext(root.find('filename').text)\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while N >= 2: N = N / 2 K = K + 1 print('K=', K) <|reserved_special_token_1|> N = int(input('N=')) K = int() K = 0 while N >= 2: N = N / 2 K = K + 1 print('K=', K) <|reserved_special_token_1|> N=int(input("N=...
flexible
{ "blob_id": "7f4c6e4a5627b44b9a700d2de4f9caca0ae8b17c", "index": 2808, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile N >= 2:\n N = N / 2\n K = K + 1\nprint('K=', K)\n", "step-3": "N = int(input('N='))\nK = int()\nK = 0\nwhile N >= 2:\n N = N / 2\n K = K + 1\nprint('K=', K)\n", "ste...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Following are the words with five Letters:') for strWord in fiveWord: print(strWord) <|reserved_special_token_1|> <|reserved_special_token_0|> text = ( 'Python is an interpreted high-level general-purpose program...
flexible
{ "blob_id": "aa15d51760c16181907994d329fb7ceede6a539b", "index": 5858, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Following are the words with five Letters:')\nfor strWord in fiveWord:\n print(strWord)\n", "step-3": "<mask token>\ntext = (\n 'Python is an interpreted high-level general...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def calculate_recovery_clifford(cl_in, desired_cl=0): """ Extracts the clifford that has to be applied to cl_in to make the net operation correspond to desired_cl from the clifford lookuptable. This operation should perform the inverse of calculate_net_clifford """ ...
flexible
{ "blob_id": "038b8206f77b325bf43fc753f6cee8b4278f4bc9", "index": 785, "step-1": "<mask token>\n\n\ndef calculate_recovery_clifford(cl_in, desired_cl=0):\n \"\"\"\n Extracts the clifford that has to be applied to cl_in to make the net\n operation correspond to desired_cl from the clifford lookuptable.\n\...
[ 3, 5, 6, 7, 8 ]
from socketserver import StreamRequestHandler, TCPServer from functools import partial class EchoHandler(StreamRequestHandler): def __init__(self, *args, ack, **kwargs): self.ack = ack super.__init__(*args, **kwargs) def handle(self): for line in self.rfile: self.wfile.wri...
normal
{ "blob_id": "7819e41d567daabe64bd6eba62461d9e553566b3", "index": 5393, "step-1": "<mask token>\n\n\nclass EchoHandler(StreamRequestHandler):\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass EchoHandler(StreamRequestHandler):\n\n def __init__(self, *args, ack, **kw...
[ 1, 3, 5, 6, 7 ]
<|reserved_special_token_0|> class Mail(object): <|reserved_special_token_0|> <|reserved_special_token_0|> @property def message(self): m = MIMEMultipart('alternative') m['Subject'] = self.subject m['From'] = self.sender m['To'] = self.recipient m.attach(MIMETe...
flexible
{ "blob_id": "3a678f9b5274f008a510a23b2358fe2a506c3221", "index": 4061, "step-1": "<mask token>\n\n\nclass Mail(object):\n <mask token>\n <mask token>\n\n @property\n def message(self):\n m = MIMEMultipart('alternative')\n m['Subject'] = self.subject\n m['From'] = self.sender\n ...
[ 5, 6, 7, 8, 11 ]
<|reserved_special_token_0|> class BlogSpider(scrapy.Spider): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def parse(self, response): for url in response.css('ul li a::attr("href")').re('.*/category/.*'): yield scrapy.Request(response.urlj...
flexible
{ "blob_id": "4c79dcf394acbcc9a636bcc9b0aac13a2bafc7e3", "index": 9249, "step-1": "<mask token>\n\n\nclass BlogSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n\n def parse(self, response):\n for url in response.css('ul li a::attr(\"href\")').re('.*/category/.*'):\n ...
[ 4, 5, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def take_shot(filename): os.system('screencapture ' + filename + '.png') <|reserved_special_token_1|> import os def take_shot(filename): os.system('screencapture ' + filename + '.png') <|reserved_special_token_1|>...
flexible
{ "blob_id": "f4c90a6d6afdcf78ec6742b1924a5c854a5a4ed6", "index": 1825, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef take_shot(filename):\n os.system('screencapture ' + filename + '.png')\n", "step-3": "import os\n\n\ndef take_shot(filename):\n os.system('screencapture ' + filename + '.p...
[ 0, 1, 2, 3 ]
''' Created on Feb 21, 2013 @author: dharadarji ''' def get_row(row_index): entry = [1] if row_index == 0: return entry tmp = [] for i in range(1, row_index + 2): tmp = entry print "i: ", i, "tmp: ", tmp entry = [] entry.append(1) ...
normal
{ "blob_id": "2579b0c31c5f7cad361ed317f87cb8b0ffcb0098", "index": 875, "step-1": "'''\nCreated on Feb 21, 2013\n\n@author: dharadarji\n'''\n\ndef get_row(row_index):\n entry = [1]\n \n if row_index == 0:\n return entry\n \n tmp = []\n \n for i in range(1, row_index + 2):\n tmp =...
[ 0 ]
<|reserved_special_token_0|> def log(model, i): mmm = [] for loader in (train_loader, val_loader, test_loader): y, y_bar = infer(loader, model) a = th.sum(y == y_bar).item() / len(y) fnfn = utils.fn_mc(y, y_bar, n_classes) fpfp = utils.fp_mc(y, y_bar, n_classes) m = met...
flexible
{ "blob_id": "92bcfff733e5f305ad1276ceb39a72a8f0fcb214", "index": 8038, "step-1": "<mask token>\n\n\ndef log(model, i):\n mmm = []\n for loader in (train_loader, val_loader, test_loader):\n y, y_bar = infer(loader, model)\n a = th.sum(y == y_bar).item() / len(y)\n fnfn = utils.fn_mc(y, ...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': n = int(input('请输入最大的数字范围:')) paixu(n) <|reserved_special_token_1|> from practice.demo4 import paixu if __name__ == '__main__': n = int(input('请输入最大的数字范围:')) paixu(n) <|reserved_spec...
flexible
{ "blob_id": "a777c6d76ef2ae15544a91bcfba0dbeabce0470a", "index": 5377, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n n = int(input('请输入最大的数字范围:'))\n paixu(n)\n", "step-3": "from practice.demo4 import paixu\nif __name__ == '__main__':\n n = int(input('请输入最大的数字范围:')...
[ 0, 1, 2, 3 ]
# Duy B. Lam # 61502602 # Project 3 # A module that reads the input and constructs the objects # that will generate the program's output. This is the only # module that should have an if __name__ == '__main__' block # to make it executable; you would execute this module to run your program. import Module1 ...
normal
{ "blob_id": "da19bc4fc999bd48a3d55b8cb5f47ba6208bc02b", "index": 4502, "step-1": "<mask token>\n\n\ndef outputQ() ->int:\n try:\n outputQ = int(input())\n return outputQ\n finally:\n print('output quantity:' + str(outputQ))\n\n\n<mask token>\n\n\ndef quantityToOutput(outputQ: int) ->li...
[ 2, 4, 5, 6, 7 ]
from selenium.webdriver.common.keys import Keys from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC # driver = webdriver.Chrome('C:/automation/chromedriver') # wait = W...
normal
{ "blob_id": "0a23b16329d8b599a4ee533604d316bdfe4b579a", "index": 4832, "step-1": "<mask token>\n\n\nclass Methodos(object):\n\n def __init__(self, driver):\n self.driver = driver\n self.wait = WebDriverWait(self.driver, 15)\n <mask token>\n\n def Click(self, id):\n e = self.wait.unt...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> @application.route('/chutesnladders') @application.route('/cnl') @application.route('/snakesnladders') @application.route('/snl') def chutesnladders(): response = application.make_response(render_template( 'chutesnladders.min.html')) return response <|reserved_special_to...
flexible
{ "blob_id": "a2c62091b14929942b49853c4a30b851ede0004b", "index": 4563, "step-1": "<mask token>\n\n\n@application.route('/chutesnladders')\n@application.route('/cnl')\n@application.route('/snakesnladders')\n@application.route('/snl')\ndef chutesnladders():\n response = application.make_response(render_template...
[ 1, 3, 4, 5, 6 ]
import heapq class Solution: #priority queue # def sortElemsByFrequency(self, arr): # if arr: # mydict = {} # for k,v in enumerate(arr): # mydict[v] = mydict.get(v, 0) + 1 # sorted_dict = sorted(mydict.items(), key = lambda x:x[1]) # return sorted_dict def sortElemsByFrequen...
normal
{ "blob_id": "dcb12e282962c63f8e7de5d29c4c81ad177a387e", "index": 7775, "step-1": "<mask token>\n\n\nclass Solution:\n\n def sortElemsByFrequency(self, arr):\n if arr:\n x = []\n res = []\n mydict = {}\n for k, v in enumerate(arr):\n mydict[v] =...
[ 2, 3, 4, 5, 6 ]
'For learning OWL and owlready2' 'From "https://qiita.com/sci-koke/items/a650c09bf77331f5537f"' 'From "https://owlready2.readthedocs.io/en/latest/class.html"' '* Owlready2 * Warning: optimized Cython parser module "owlready2_optimized" is not available, defaulting to slower Python implementation' '↑ This wartning mean...
normal
{ "blob_id": "cc7f1f38efcd4d757c1d11e2bd53695fca44e15a", "index": 212, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith onto:\n\n\n class Pizza(Thing):\n pass\n\n\n class MeatPizza(Pizza):\n pass\n\n\n class Topping(Thing):\n pass\n\n\n class has_Topping((Pizza >> Toppi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Partitioner: <|reserved_special_token_0|> def __init__(self, mesh, partitions, tmpdir): metisMesh = tmpdir.path(METIS_MESH) metis.MeshWriter(metisMesh, mesh.elements()) metisGraph = tmpdir.path(METIS_GRAPH) p = subprocess.Popen(['m2gmetis', '...
flexible
{ "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 ]
#!/usr/bin/env python # Creates a new task from a given task definition json and starts on # all instances in the given cluster name # USAGE: # python ecs-tasker.py <task_definition_json_filename> <cluster_name> # EXAMPLE: # python ecs-tasker.py ecs-task-stage.json cops-cluster import boto3 import json import sys im...
normal
{ "blob_id": "3b613ec75088d6d9a645443df2bbc2f33b80000b", "index": 6984, "step-1": "#!/usr/bin/env python\n# Creates a new task from a given task definition json and starts on\n# all instances in the given cluster name\n# USAGE:\n# python ecs-tasker.py <task_definition_json_filename> <cluster_name>\n# EXAMPLE:\n#...
[ 0 ]
from model.area import AreaModel from flask_restful import Resource, reqparse from flask_jwt import jwt_required class Area(Resource): pareser = reqparse.RequestParser() pareser.add_argument('name', type = str, required = True, help = 'Area name is required') @jwt_required() def get(self,...
normal
{ "blob_id": "4dcc0261abdb783c60471736567faf7db8b56190", "index": 9548, "step-1": "<mask token>\n\n\nclass Area(Resource):\n <mask token>\n pareser.add_argument('name', type=str, required=True, help=\n 'Area name is required')\n\n @jwt_required()\n def get(self, name):\n area = AreaModel...
[ 5, 6, 7, 8, 9 ]
import pygame from pygame.locals import * import threading from load import * import time import socket as sck import sys port=8767 grid=[[None,None,None],[None,None,None],[None,None,None]] XO='X' OX='X' winner=None coordinate1=600 coordinate2=20 begin=0 address=('localhost',port) class TTTError(Exception): def __i...
normal
{ "blob_id": "b6d9b6ec10271627b7177acead9a617520dec8f8", "index": 5146, "step-1": "import pygame\nfrom pygame.locals import *\n\nimport threading\nfrom load import *\nimport time\nimport socket as sck\nimport sys\n\nport=8767\ngrid=[[None,None,None],[None,None,None],[None,None,None]]\nXO='X'\nOX='X'\nwinner=None\...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def minOperations(n): """ a method that calculates the fewest number of operations needed to result in exactly n H characters in the file """ if n <= 1: return 0 """loop for n number of times""" ...
flexible
{ "blob_id": "f14b9373e9bf1ad7fe2216dfefc1571f5380fb27", "index": 6528, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef minOperations(n):\n \"\"\"\n a method that calculates the fewest number of operations needed\n to result in exactly n H characters in the file\n \"\"\"\n if n <= 1:...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> pygame.display.set_caption('Piirtäminen') <|reserved_special_token_0|> def main(): while True: tapahtuma = pygame.event.poll() if tapahtuma.type == pygame.QUIT: break naytto.fill((0, 0, 0)...
flexible
{ "blob_id": "3fdb29797894737edae37ad7890e14cb9ce705e8", "index": 5901, "step-1": "<mask token>\n", "step-2": "<mask token>\npygame.display.set_caption('Piirtäminen')\n<mask token>\n\n\ndef main():\n while True:\n tapahtuma = pygame.event.poll()\n if tapahtuma.type == pygame.QUIT:\n ...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class EXR: """Reads EXR files. EXR files can be generic or physically meaningful, such as depth, normal, etc. When data loaded are physically meaningful, these methods assume the EXR files are produced by :mod:`xiuminglib.blender.render` and hence follow certain formats. ...
flexible
{ "blob_id": "b9cce77d4d2b9ff5563d17927e21166f9c870e3d", "index": 5220, "step-1": "<mask token>\n\n\nclass EXR:\n \"\"\"Reads EXR files.\n\n EXR files can be generic or physically meaningful, such as depth, normal, etc.\n When data loaded are physically meaningful, these methods assume the EXR files\n ...
[ 7, 9, 10, 11, 12 ]
import torch import torch.nn as nn import torch.nn.functional as F class Net(torch.nn.Module): def __init__(self, layer_sizes=[256, 128, 2], dropout_prob=None, device=None): super(Net, self).__init__() self.device = device if dropout_prob is not None and dropout_prob > 0.5: pr...
normal
{ "blob_id": "4711adcc7c95993ec13b9d06fa674aa064f79bfd", "index": 314, "step-1": "<mask token>\n\n\nclass Net(torch.nn.Module):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Net(torch.nn.Module):\n\n def __init__(self, layer_sizes=[256, 128, 2], dropout_prob=None, device\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def func_sum_even(n): e_digit1 = n % 10 n //= 10 e_digit2 = n % 10 e_digit3 = n // 10 sum_even = e_digit1 * (1 - e_digit1 % 2) + e_digit2 * (1 - e_digit2 % 2 ) + e_digit3 * (1 - e_digit3 % 2) return sum_even <|reserved_specia...
flexible
{ "blob_id": "d567dfe29380a34534308446a9c8940cede84083", "index": 7571, "step-1": "<mask token>\n", "step-2": "def func_sum_even(n):\n e_digit1 = n % 10\n n //= 10\n e_digit2 = n % 10\n e_digit3 = n // 10\n sum_even = e_digit1 * (1 - e_digit1 % 2) + e_digit2 * (1 - e_digit2 % 2\n ) + e_dig...
[ 0, 1, 2 ]
import numpy as np import pandas as pd from scipy.optimize import minimize from datetime import datetime import time from functions import weather_scraper def getData(): # # run weather_scraper.py to fetch new weather data # weather_scraper.getData() ## Read in csv file "weather_data.csv" weather_data...
normal
{ "blob_id": "7a1bd2b4734527a414c6173ea8edb150221f8042", "index": 363, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getData():\n weather_data = pd.read_csv('data/weather_data.csv')\n currentMonth = datetime.now().month\n currentHour = datetime.now().hour\n currentMonthGroup = current...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> len(dfhtml) dfhtml type(dfhtml) <|reserved_special_token_0|> print(txtnew) <|reserved_special_token_0|> f.writelines(str(txtnew)) f.close() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "c7768e44464703552f579a1ec68b58fd9746a381", "index": 8743, "step-1": "<mask token>\n", "step-2": "<mask token>\nlen(dfhtml)\ndfhtml\ntype(dfhtml)\n<mask token>\nprint(txtnew)\n<mask token>\nf.writelines(str(txtnew))\nf.close()\n<mask token>\n", "step-3": "<mask token>\npath = (\n 'E:/Data Scie...
[ 0, 1, 2, 3, 4 ]
import re import datetime as dt from datetime import datetime import time import random import json import sys import requests import os import pickle import cv2 import numpy as np import cPickle import multiprocessing as mp import math root = "/datasets/sagarj/instaSample6000/" # post_dir = root + "/" videos_dir = r...
normal
{ "blob_id": "ac978accc821600ad8def04b9c7423fbe6759e43", "index": 6203, "step-1": "import re\nimport datetime as dt\nfrom datetime import datetime\nimport time\nimport random\nimport json\nimport sys\nimport requests\nimport os\nimport pickle\nimport cv2\nimport numpy as np\nimport cPickle\nimport multiprocessing...
[ 0 ]
import matplotlib.pyplot as plt import numpy as np x = [1, 2, 2.5, 3, 4] # x-coordinates for graph y = [1, 4, 7, 9, 15] # y-coordinates plt.axis([0, 6, 0, 20]) # creating my x and y axis range. 0-6 is x, 0-20 is y plt.plot(x, y, 'ro') # can see graph has a linear correspondence, therefore, can use linear regression ...
normal
{ "blob_id": "c69c8ba218935e5bb065b3b925cc7c5f1aa2957b", "index": 5806, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.axis([0, 6, 0, 20])\nplt.plot(x, y, 'ro')\nplt.plot(np.unique(x), np.poly1d(np.polyfit(x, y, 1))(np.unique(x)))\nplt.show()\n", "step-3": "<mask token>\nx = [1, 2, 2.5, 3, 4]\ny = [...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(triples) <|reserved_special_token_1|> <|reserved_special_token_0|> triples = pd.read_csv('SollTripel.csv', sep=',', skip_blank_lines=True, skipinitialspace=True) triples.columns = ['triple', 'found'] triples = triples...
flexible
{ "blob_id": "97afa67cbe20900e2388994481abebe772e22818", "index": 5301, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(triples)\n", "step-3": "<mask token>\ntriples = pd.read_csv('SollTripel.csv', sep=',', skip_blank_lines=True,\n skipinitialspace=True)\ntriples.columns = ['triple', 'found']\nt...
[ 0, 1, 2, 3, 4 ]
from __future__ import division import numpy as np import scipy.stats from tms import read_and_transform __author__ = 'Diego' def estimate_vrpn_clock_drift(points): # clocks = [map(np.datetime64,(p.date,p.ref_date,p.point_date)) for p in points] clocks = [(p.date, p.ref_date, p.point_date) for p in points...
normal
{ "blob_id": "7d0b0cb19e22ff338104e0c2061da94ba04d4f16", "index": 2249, "step-1": "from __future__ import division\n\nimport numpy as np\nimport scipy.stats\n\nfrom tms import read_and_transform\n\n\n__author__ = 'Diego'\n\n\ndef estimate_vrpn_clock_drift(points):\n # clocks = [map(np.datetime64,(p.date,p.ref_...
[ 0 ]
from db_connector import insert_item_details, insert_user_details from Item_details import ItemDetails def mechant_service(user_id): print('================================') print('Merchant Page') print('================================') heading='=============================================\nenter ...
normal
{ "blob_id": "d5dae7ab6eb34c82ae795730ecae666c4f81f10a", "index": 4160, "step-1": "<mask token>\n\n\ndef create_item(user_id):\n flag = False\n while flag == False:\n product_name = input('Enter the name of the product : ')\n flag = validate_product_name(product_name)\n flag = False\n wh...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def line(f): return map(int, f.readline().split()) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def solve(tribes): attacks = [] for t in tribes: D, N, W, E, S, DD, DP, DS = t for i in range(N): d = D ...
flexible
{ "blob_id": "362bfc5a35b09817ce071e71a72e574a28ea287d", "index": 3365, "step-1": "<mask token>\n\n\ndef line(f):\n return map(int, f.readline().split())\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef solve(tribes):\n attacks = []\n for t in tribes:\n D, N, W, E, S, DD, DP, DS = t\n ...
[ 1, 3, 4, 5, 6 ]
from scrapy import Spider, Request from urllib.parse import quote from Product.items import ProductItem class TaobaoSpider(Spider): name = 'taobao' allowed_domains = ['www.taobao.com'] start_urls = ['http://www.taobao.com/'] def parse(self, response, **kwargs): pass
normal
{ "blob_id": "8f709af924820c77290f97731d9f96258c3db095", "index": 2533, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TaobaoSpider(Spider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TaobaoSpider(Spider):\n <mask token>\n ...
[ 0, 1, 2, 3, 4 ]
N = int(input()) StopPoint = N cycle = 0 ten = 0 one = 0 new_N = 0 while True: ten = N // 10 one = N % 10 total = ten + one new_N = one * 10 + total % 10 cycle += 1 N = new_N if new_N == StopPoint: break print(cycle)
normal
{ "blob_id": "047b3b25cb064115a46cde1f1480ce55a1256bc1", "index": 5827, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n ten = N // 10\n one = N % 10\n total = ten + one\n new_N = one * 10 + total % 10\n cycle += 1\n N = new_N\n if new_N == StopPoint:\n break\nprint...
[ 0, 1, 2 ]
class Region: """ A region (represented by a list of long/lat coordinates). """ def __init__(self, coords, r_votes, d_votes, o_votes): self.coords = coords def lats(self): "Return a list of the latitudes of all the coordinates in the region" return [y for x,y in self.coords...
normal
{ "blob_id": "517436d61ac9993bee5ecfd932f272dbb8bec60b", "index": 7608, "step-1": "class Region:\n <mask token>\n\n def __init__(self, coords, r_votes, d_votes, o_votes):\n self.coords = coords\n\n def lats(self):\n \"\"\"Return a list of the latitudes of all the coordinates in the region\"...
[ 6, 7, 8, 9, 10 ]
''' Find the greatest product of five consecutive digits in the 1000-digit number. 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 66896648950445244523161731856403...
normal
{ "blob_id": "db20a77778392c84bab50f6d4002dd11b73967b9", "index": 9214, "step-1": "'''\nFind the greatest product of five consecutive digits in the 1000-digit number.\n\n73167176531330624919225119674426574742355349194934\n96983520312774506326239578318016984801869478851843\n8586156078911294949545950173795833195285...
[ 0 ]
import FWCore.ParameterSet.Config as cms source = cms.Source("PoolSource", fileNames = cms.untracked.vstring( '/store/user/skaplan/noreplica/ADDdiPhoton/sherpa/mgg750-2000_Ms3000/sherpaevents_10_1_Kji.root', '/store/user/skaplan/noreplica/ADDdiPhoton/sherpa/mgg750-2000_Ms3000/sherpaevents_1_1_oTR.r...
normal
{ "blob_id": "aaeca18f3771a6032c0fe51b75502f730c888888", "index": 9383, "step-1": "<mask token>\n", "step-2": "<mask token>\nsource = cms.Source('PoolSource', fileNames=cms.untracked.vstring(\n '/store/user/skaplan/noreplica/ADDdiPhoton/sherpa/mgg750-2000_Ms3000/sherpaevents_10_1_Kji.root'\n ,\n '/stor...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Solution(object): <|reserved_special_token_0|> def dfs(self, bottom, energy): if (bottom, energy) in self.memory: return self.memory[bottom, energy] if energy == 1: return [[bottom]] results = [] for v in range(bottom,...
flexible
{ "blob_id": "d52b6dda7111aefb7f9a7b10ad606cda615389d9", "index": 7123, "step-1": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n\n def dfs(self, bottom, energy):\n if (bottom, energy) in self.memory:\n return self.memory[bottom, energy]\n if energy == 1:\n re...
[ 3, 5, 7, 8, 10 ]
<|reserved_special_token_0|> class _Settings: <|reserved_special_token_0|> def _valueAt(self, *paths): u = _get(self.userConfig, *paths) d = _get(self.defaultConfig, *paths) return u, d def _loadConfigs(self): yaml = YAML() defaultFile = Path(__file__).parent / 'r...
flexible
{ "blob_id": "784159dfb2e85ca4634adf790e68129834155e4d", "index": 2702, "step-1": "<mask token>\n\n\nclass _Settings:\n <mask token>\n\n def _valueAt(self, *paths):\n u = _get(self.userConfig, *paths)\n d = _get(self.defaultConfig, *paths)\n return u, d\n\n def _loadConfigs(self):\n ...
[ 5, 6, 8, 9, 10 ]