code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jan 2 18:52:27 2021 @author: burak """ import veriler import gorsel import numpy as np from sklearn.neighbors import KNeighborsClassifier neighbors = np.arange(1,13) train_accuracy = np.empty(len(neighbors)) test_accuracy = np.empty(len(neighbors)) ...
normal
{ "blob_id": "133bd0b2affc3d29390edeab51299d294dafb709", "index": 4188, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor n, k in enumerate(neighbors):\n knn = KNeighborsClassifier(n_neighbors=k, metric='minkowski')\n knn.fit(veriler.X_train, veriler.y_train.ravel())\n train_accuracy[n] = knn.sc...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('the original DNA sequence is', dnaSequence) print('the first fragment is', firstFragment, 'and is', firstFragmentLen, 'letters long') print('the second fragment is', secondFragment, 'and is', secondFragmentLen, 'let...
flexible
{ "blob_id": "7dc99d33023dbb13938ac413af7d3e9471fdbc3d", "index": 126, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('the original DNA sequence is', dnaSequence)\nprint('the first fragment is', firstFragment, 'and is', firstFragmentLen,\n 'letters long')\nprint('the second fragment is', secondFr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def main(): args = ['./input'] print('./input', end='') for x in range(99): print(' AA', end='') args.append('AA') print(args) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): args = ['./input'] ...
flexible
{ "blob_id": "9184779731d6102498934d77b6d3c0283fc594d9", "index": 7498, "step-1": "<mask token>\n\n\ndef main():\n args = ['./input']\n print('./input', end='')\n for x in range(99):\n print(' AA', end='')\n args.append('AA')\n print(args)\n\n\n<mask token>\n", "step-2": "<mask token>\...
[ 1, 2, 3, 4, 5 ]
L = "chaine de caractere" print("parcours par élément") for e in L : print("caractere : *"+e+"*")
normal
{ "blob_id": "cdc9bc97332a3914415b16f00bc098acc7a02863", "index": 5020, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('parcours par élément')\nfor e in L:\n print('caractere : *' + e + '*')\n", "step-3": "L = 'chaine de caractere'\nprint('parcours par élément')\nfor e in L:\n print('caracte...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class LinkedInGrabber(PageGrabber): def get_info(self, email): client = requests.Session() print('[' + bc.CPRP + '?' + bc.CEND + '] ' + bc.CCYN + 'LinkedIn' + bc.CEND) HOMEPAGE_URL = 'htt...
flexible
{ "blob_id": "570e0d46aa1ea88d1784447e8f693199e3c3b6ad", "index": 9488, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass LinkedInGrabber(PageGrabber):\n\n def get_info(self, email):\n client = requests.Session()\n print('[' + bc.CPRP + '?' + bc.CEND + '] ' + bc.CCYN + 'LinkedIn' +...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def start(): image_file = 'sample.png' top_left_corner = [100, 100] bottom_right_corner = [200, 200] img = Image.open(image_file) top_left_x = top_left_corner[0] top_left_y = top_left_corner[1] bottom...
flexible
{ "blob_id": "84476e1793242bf3bae51263c2db28ff555c25d7", "index": 1104, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef start():\n image_file = 'sample.png'\n top_left_corner = [100, 100]\n bottom_right_corner = [200, 200]\n img = Image.open(image_file)\n top_left_x = top_left_corner...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Table(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Price(models.Model): price = models.FloatField(null=True) class Marketdata(models.M...
flexible
{ "blob_id": "0054921928838d9aee63cf58f50a0a01ee12635d", "index": 6049, "step-1": "<mask token>\n\n\nclass Table(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Price(models.Model):\n price = models.FloatField(null=True)\n\n\nclass Marketdata(...
[ 5, 6, 10, 12, 14 ]
class Pwm: def __init__(self, number, path, features): self.id = number self.path = path + 'pwm' + number self.features = features self.duty = self.get_feature('') self.enable = self.get_feature('_enable') <|reserved_special_token_0|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "c38aff77a7beebc13e7486150d549b876c830db8", "index": 6104, "step-1": "class Pwm:\n\n def __init__(self, number, path, features):\n self.id = number\n self.path = path + 'pwm' + number\n self.features = features\n self.duty = self.get_feature('')\n self.enable = s...
[ 2, 3, 4, 5, 6 ]
import Libcplx as lc # 1.Adición de vectores complejos def adVector(v, w): n = len(v) r = [] for k in range(n): r += [lc.cplxsum(v[k], w[k])] return r # 2.Inverso (aditivo) de un vector complejo def invVector(v): n = len(v) r = [] for k in range(n): r += [lc.cplxproduct((...
normal
{ "blob_id": "5f242ae801a239dde6a22e4fb68b4ef4b2459be6", "index": 2599, "step-1": "<mask token>\n\n\ndef adVector(v, w):\n n = len(v)\n r = []\n for k in range(n):\n r += [lc.cplxsum(v[k], w[k])]\n return r\n\n\n<mask token>\n\n\ndef MultEscalarVector(v, w):\n n = len(w)\n r = []\n for...
[ 10, 13, 14, 15, 18 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if list_1 == list_1_rev: print('You entered a polindrom!') else: print('Your string is not a polindrom') <|reserved_special_token_1|> list_1 = input('Enter something: ') list_1_rev = list_1[::-1] if list_1 == list_1_rev...
flexible
{ "blob_id": "45b56103db0a72ebbc7de340c4293e1f70552414", "index": 5254, "step-1": "<mask token>\n", "step-2": "<mask token>\nif list_1 == list_1_rev:\n print('You entered a polindrom!')\nelse:\n print('Your string is not a polindrom')\n", "step-3": "list_1 = input('Enter something: ')\nlist_1_rev = list...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- import serial import time import argparse def write_command(serial, comm, verbose = False, dt = None): """ Encodes a command and sends it over the serial port """ if verbose and comm != "": if dt is None: print("{} \t\t-> {}".format(comm, serial.port...
normal
{ "blob_id": "3ffcab4b36c6ca05f1e667c628ebb873ebdc0d25", "index": 7866, "step-1": "<mask token>\n\n\ndef write_command(serial, comm, verbose=False, dt=None):\n \"\"\" Encodes a command and sends it over the serial port \"\"\"\n if verbose and comm != '':\n if dt is None:\n print('{} \\t\\t...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def change(): name = 'Brill' print(name) print(locals()) print(globals()) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def change(): name = 'Brill' print(n...
flexible
{ "blob_id": "6c7162a9bd81d618abda204c24031c5a5acc61b4", "index": 7967, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef change():\n name = 'Brill'\n print(name)\n print(locals())\n print(globals())\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef change():\n name = 'Brill'\n ...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 3.0.4 on 2020-03-24 16:58 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('students', '0002_auto_20200324_1635'), ] operations = [ migrations.AddField( model_name='student', name='parent_mobi...
normal
{ "blob_id": "a372289d15b55f43887a37bb78a9fc308ddd0371", "index": 5582, "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 = [('students', ...
[ 0, 1, 2, 3, 4 ]
"""MPI-supported kernels for computing diffusion flux in 2D.""" from sopht.numeric.eulerian_grid_ops.stencil_ops_2d import ( gen_diffusion_flux_pyst_kernel_2d, gen_set_fixed_val_pyst_kernel_2d, ) from sopht_mpi.utils.mpi_utils import check_valid_ghost_size_and_kernel_support from mpi4py import MPI def gen_dif...
normal
{ "blob_id": "ba8cb18544e4ded8b229bfb9cc4b28599119414f", "index": 854, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef gen_diffusion_flux_pyst_mpi_kernel_2d(real_t, mpi_construct,\n ghost_exchange_communicator):\n diffusion_flux_pyst_kernel = gen_diffusion_flux_pyst_kernel_2d(real_t=\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def seed_everything(seed): torch.manual_seed(seed) torch.cuda.manual_seed(seed) torch.cuda.manual_seed_all(seed) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False np.random.seed(seed) random.seed(seed) <|reserved_special_token_0...
flexible
{ "blob_id": "d3b6a105b14d9c3485a71058391a03c2f4aa5c10", "index": 8628, "step-1": "<mask token>\n\n\ndef seed_everything(seed):\n torch.manual_seed(seed)\n torch.cuda.manual_seed(seed)\n torch.cuda.manual_seed_all(seed)\n torch.backends.cudnn.deterministic = True\n torch.backends.cudnn.benchmark = ...
[ 3, 4, 6, 7, 8 ]
#------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: legolas # # Created: 05.03.2015 # Copyright: (c) legolas 2015 # Licence: <your licence> #------------------------------------------------------------------------------- print "T...
normal
{ "blob_id": "08abb94424598cb54a6b16db68759b216682d866", "index": 6254, "step-1": "#-------------------------------------------------------------------------------\n# Name: module1\n# Purpose:\n#\n# Author: legolas\n#\n# Created: 05.03.2015\n# Copyright: (c) legolas 2015\n# Licence: <your li...
[ 0 ]
#!/usr/bin/env python3 import sys import re from collections import namedtuple def isnum(name): return name.startswith('-') or name.isdigit() class WireValues: def __init__(self): self.wires = {} def __getitem__(self, name): return int(name) if isnum(name) else self.wires[name] def _...
normal
{ "blob_id": "a5eb1f559972519dbe0f3702e03af77e61fbfb4e", "index": 7985, "step-1": "<mask token>\n\n\nclass WireValues:\n\n def __init__(self):\n self.wires = {}\n\n def __getitem__(self, name):\n return int(name) if isnum(name) else self.wires[name]\n\n def __setitem__(self, name, value):\n...
[ 7, 14, 16, 18, 20 ]
<|reserved_special_token_0|> def evaluate(sess, data, embds, model, logdir): checkpoint_dir = '{}checkpoints'.format(logdir) saver = tf.train.Saver() sess.run(tf.global_variables_initializer()) sess.run(model.embedding_init, feed_dict={model.embedding_placeholder: embds}) saver.restore(ses...
flexible
{ "blob_id": "3aff6bdfd7c2ffd57af7bb5d0079a8a428e02331", "index": 1284, "step-1": "<mask token>\n\n\ndef evaluate(sess, data, embds, model, logdir):\n checkpoint_dir = '{}checkpoints'.format(logdir)\n saver = tf.train.Saver()\n sess.run(tf.global_variables_initializer())\n sess.run(model.embedding_ini...
[ 5, 6, 8, 9, 10 ]
<|reserved_special_token_0|> def mesh_add_vertex_to_face_edge(mesh, key, fkey, v): """Add an existing vertex of the mesh to an existing face. Parameters ---------- mesh : compas.datastructures.Mesh The mesh data structure. key : hashable The identifier of the vertex. fkey : ha...
flexible
{ "blob_id": "d9b6efce92e30267a9f992c4fea698fe14e0c3e4", "index": 1398, "step-1": "<mask token>\n\n\ndef mesh_add_vertex_to_face_edge(mesh, key, fkey, v):\n \"\"\"Add an existing vertex of the mesh to an existing face.\n\n Parameters\n ----------\n mesh : compas.datastructures.Mesh\n The mesh d...
[ 1, 2, 3, 4, 5 ]
# Generated by Django 2.0 on 2018-03-06 16:21 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('digressions', '0004_auto_20180303_1158'), ] operations = [ migrations.RemoveField( model_name='ex...
normal
{ "blob_id": "38c21fb959d8b98b616006ea48bd720cc6f9995c", "index": 1462, "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 = [('digressions...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def tnrange(*args, **kwargs): ... <|reserved_special_token_1|> <|reserved_special_token_0|> def tqdm_notebook(*args, **kwargs): ... def tnrange(*args, **kwargs): ... <|reserved_special_token_1|> from ._moni...
flexible
{ "blob_id": "25b7af2a8036f35a0bca665867d1729b7c9c113c", "index": 5846, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef tnrange(*args, **kwargs):\n ...\n", "step-3": "<mask token>\n\n\ndef tqdm_notebook(*args, **kwargs):\n ...\n\n\ndef tnrange(*args, **kwargs):\n ...\n", "step-4": "fro...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def f(x): return np.sin(x / 5) * np.exp(x / 10) + 5 * np.exp(-x / 2) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def f(x): return np.sin(x / 5) * np.exp(x / 10) + 5 * np.exp(-x / 2) <|reserved_special_token_0|> plt.plot(xx, y1, '...
flexible
{ "blob_id": "a610ccf4fe154ee12de9212a10958fda2000b425", "index": 7122, "step-1": "<mask token>\n\n\ndef f(x):\n return np.sin(x / 5) * np.exp(x / 10) + 5 * np.exp(-x / 2)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef f(x):\n return np.sin(x / 5) * np.exp(x / 10) + 5 * np.exp(-x / 2)\n\n\n<mask t...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def dropper(): for ex in affected['word']: if ex not in model.vocab: idx_to_drop.append(affected.loc[affected.word == ex].index[0]) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('loading & cleaning the data...') <...
flexible
{ "blob_id": "f5f26819be4b98fab3d46e57e1a5431e54342aed", "index": 414, "step-1": "<mask token>\n\n\ndef dropper():\n for ex in affected['word']:\n if ex not in model.vocab:\n idx_to_drop.append(affected.loc[affected.word == ex].index[0])\n\n\n<mask token>\n", "step-2": "<mask token>\nprint(...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def inception(image, reuse): preprocessed = tf.multiply(tf.subtract(tf.expand_dims(image, 0), 0.5), 2.0) arg_scope = nets.inception.inception_v3_arg_scope(weight_decay=0.0) with slim.arg_scope(arg_scope): logits, end_point = nets.inception.inception_v3(preprocessed, 10...
flexible
{ "blob_id": "31d87b11f6a1f6304a2fef6dd1cd1c0ca292dfe8", "index": 3491, "step-1": "<mask token>\n\n\ndef inception(image, reuse):\n preprocessed = tf.multiply(tf.subtract(tf.expand_dims(image, 0), 0.5), 2.0)\n arg_scope = nets.inception.inception_v3_arg_scope(weight_decay=0.0)\n with slim.arg_scope(arg_s...
[ 5, 6, 7, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': img_path = (pathlib.Path('..') / 'images' / 'tiger.jpg').resolve() with Image.open(str(img_path)) as img: print('IMAGE: {}'.format(str(img_path))) print('Image is in {} format'.fo...
flexible
{ "blob_id": "05edbf3662936465eee8eee0824d1a0cca0df0e5", "index": 4855, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n img_path = (pathlib.Path('..') / 'images' / 'tiger.jpg').resolve()\n with Image.open(str(img_path)) as img:\n print('IMAGE: {}'.format(str(img_pa...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class CustomUsuarioViewSet(AccessViewSetMixin, mixins.CreateModelMixin, mixins.RetrieveModelMixin, mixins.ListModelMixin, GenericViewSet): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved...
flexible
{ "blob_id": "43b5936ca9368dcae8d41b44fd9dc927fe18c9bc", "index": 8794, "step-1": "<mask token>\n\n\nclass CustomUsuarioViewSet(AccessViewSetMixin, mixins.CreateModelMixin,\n mixins.RetrieveModelMixin, mixins.ListModelMixin, GenericViewSet):\n <mask token>\n <mask token>\n <mask token>\n <mask toke...
[ 13, 14, 19, 21, 23 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='Antennass', version=VERSION, description= 'A class project that plots far field antenna array patterns', long_description=README, long_description_content_type='text/markdown', url='https://github.com/MdeVi...
flexible
{ "blob_id": "f563bb5bb32d3653d8a4115c75eda80b676ae3c6", "index": 5759, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='Antennass', version=VERSION, description=\n 'A class project that plots far field antenna array patterns',\n long_description=README, long_description_content_type='text...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(dic.get('country', 'Russia')) <|reserved_special_token_0|> print(dic) <|reserved_special_token_1|> dic = {'city': 'Moscow', 'temperature': 20} print(dic.get('country', 'Russia')) dic['date'] = '27.05.2019' print(dic) <|...
flexible
{ "blob_id": "f145274c8caa1e725d12003874eb54a580a6e35e", "index": 784, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(dic.get('country', 'Russia'))\n<mask token>\nprint(dic)\n", "step-3": "dic = {'city': 'Moscow', 'temperature': 20}\nprint(dic.get('country', 'Russia'))\ndic['date'] = '27.05.2019'\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.axis([0, 6, 0, 20]) plt.plot(x, y, 'ro') plt.plot(np.unique(x), np.poly1d(np.polyfit(x, y, 1))(np.unique(x))) plt.show() <|reserved_special_token_1|> <|reserved_special_token_0|> x = [1, 2, 2.5, 3, 4] y = [1, 4, 7, 9, 15] p...
flexible
{ "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 ]
import sys from PIL import Image from pr_common import * file_name = sys.argv[1] saturation_color = sys.argv[2] saturation_modifier = int(sys.argv[3]) img = getImage(file_name) pixels = pixelValues(img) for i in range(img.height): for j in range(img.width): pixel_val = pixels[i][j] color_idx = No...
normal
{ "blob_id": "96ef95d8997eeab3d85a1bb6e4f8c86c9bfbb0a2", "index": 4732, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(img.height):\n for j in range(img.width):\n pixel_val = pixels[i][j]\n color_idx = None\n if saturation_color == 'R':\n color_idx = 0\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class SophiesAI(Player): <|reserved_special_token_0|> def ship_locations(self) ->Sequence[Tuple[int, int, int, bool]]: return [(2, 0, 0, True)] <|reserved_special_token_0|> def bomb_feedback(self, x: int, y: int, result: ShotResult): pass def bombed_...
flexible
{ "blob_id": "127bf47de554dd397d18c6a70616a2a4d93cae80", "index": 3659, "step-1": "<mask token>\n\n\nclass SophiesAI(Player):\n <mask token>\n\n def ship_locations(self) ->Sequence[Tuple[int, int, int, bool]]:\n return [(2, 0, 0, True)]\n <mask token>\n\n def bomb_feedback(self, x: int, y: int,...
[ 4, 5, 6, 7, 8 ]
import sys sys.path.append("..\\Pole_IA_Systemes_Experts") from tkinter import * from Knowledge_base.Facts import Fact from Knowledge_base.Rules import Rule from Backward.Explanation_tree import * def ask_about_fact(fact: Fact): """ Asks the user about whether a fact is true or false threw an interface provi...
normal
{ "blob_id": "4dae34b7c90f52314aac5e457addb3700ffcbd28", "index": 9156, "step-1": "<mask token>\n\n\ndef ask_about_fact(fact: Fact):\n \"\"\"\n Asks the user about whether a fact is true or false threw an interface provided by tkinter\n Args:\n fact (Fact): the fact we want to know about\n\n Re...
[ 1, 2, 3, 4, 5 ]
a = 1 b = 2 print(a + b) print("hello") list = [1, 2, 3, 4, 5] for i in list: if i % 2 != 0: print(i) print("branch")
normal
{ "blob_id": "03b325094bd3e77f467e17ce54deb95bf2b5c727", "index": 1724, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(a + b)\nprint('hello')\n<mask token>\nfor i in list:\n if i % 2 != 0:\n print(i)\nprint('branch')\n", "step-3": "a = 1\nb = 2\nprint(a + b)\nprint('hello')\nlist = [1, 2...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def clicked(num): current = ent.get() ent.delete(0, END) ent.insert(0, str(current) + str(num)) def click_clear(): ent.delete(0, END) def add(): global ch ch = '+' clicked('+') def subtract(): global ch ch = '-' clicked('-') def multiply(): ...
flexible
{ "blob_id": "bdd9ebfa9a2f14d57efd527ca88032bfb0160a5e", "index": 7504, "step-1": "<mask token>\n\n\ndef clicked(num):\n current = ent.get()\n ent.delete(0, END)\n ent.insert(0, str(current) + str(num))\n\n\ndef click_clear():\n ent.delete(0, END)\n\n\ndef add():\n global ch\n ch = '+'\n clic...
[ 7, 8, 9, 10, 11 ]
<|reserved_special_token_0|> class Divide(APIView): renderer_classes = JSONPRenderer, @staticmethod def get(request): try: first_number = int(request.GET.get('a')) second_number = int(request.GET.get('b')) return Response({'result': first_number / second_number...
flexible
{ "blob_id": "4c483636316dfa660f10b1aba900813bc3e95ebe", "index": 9463, "step-1": "<mask token>\n\n\nclass Divide(APIView):\n renderer_classes = JSONPRenderer,\n\n @staticmethod\n def get(request):\n try:\n first_number = int(request.GET.get('a'))\n second_number = int(reques...
[ 3, 6, 9, 10, 11 ]
<|reserved_special_token_0|> class UserProfileAdmin(admin.ModelAdmin): <|reserved_special_token_0|> <|reserved_special_token_0|> class AuditTrailUserAdmin(admin.ModelAdmin): list_display = 'id', 'date', 'user', 'level', 'message' list_filter = 'level', 'date', 'user__username' readonly_fields = [i...
flexible
{ "blob_id": "477d1629c14609db22ddd9fc57cb644508f4f490", "index": 8905, "step-1": "<mask token>\n\n\nclass UserProfileAdmin(admin.ModelAdmin):\n <mask token>\n\n\n<mask token>\n\n\nclass AuditTrailUserAdmin(admin.ModelAdmin):\n list_display = 'id', 'date', 'user', 'level', 'message'\n list_filter = 'leve...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class RegistrationFormCaseInsensitive(RegistrationForm): <|reserved_special_token_0|> def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields[User.USERNAME_FIELD].validators.append(validators. CaseInsensitiveUnique(User, User...
flexible
{ "blob_id": "3b959481f7c818ec35b8af174b1982954b4c72eb", "index": 1208, "step-1": "<mask token>\n\n\nclass RegistrationFormCaseInsensitive(RegistrationForm):\n <mask token>\n\n def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self.fields[User.USERNAME_FIELD].validator...
[ 8, 12, 14, 15, 16 ]
<|reserved_special_token_0|> def tag(name, *content, cls=None, **attrs): """ 生成一个或多个HTML标签 """ if cls is not None: attrs['class'] = cls if attrs: attrs_str = ''.join(' %s="%s"' % (attr, value) for attr, value in attrs.items()) else: attrs_str = '' if content: ...
flexible
{ "blob_id": "a9b895e4d0830320276359944ca6fdc475fd144e", "index": 7923, "step-1": "<mask token>\n\n\ndef tag(name, *content, cls=None, **attrs):\n \"\"\" 生成一个或多个HTML标签 \"\"\"\n if cls is not None:\n attrs['class'] = cls\n if attrs:\n attrs_str = ''.join(' %s=\"%s\"' % (attr, value) for attr...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/python # -*- coding: utf-8 -*- import phpserialize import urllib2 from cache import cache from config import config def block(request, limit=None): try: links = cache.get_cache("sape", expire=3600).get(key="links", createfunc=load_links) except: links = cache.get_cache("sape", expi...
normal
{ "blob_id": "6d5acaa4a60b646432feb59f4d8eb9c9d0dceb0f", "index": 1151, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef block(request, limit=None):\n try:\n links = cache.get_cache('sape', expire=3600).get(key='links',\n createfunc=load_links)\n except:\n links = cach...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.ion() parser.add_argument('--fish', help="flag for using fisherman's algorithm") parser.add_argument('--heat', help='flag for using heatmap') parser.add_argument('--object', help='flag for dumping the clusters') <|reserved_spe...
flexible
{ "blob_id": "805bc144a4945b46b398853e79ded17370ada380", "index": 3940, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.ion()\nparser.add_argument('--fish', help=\"flag for using fisherman's algorithm\")\nparser.add_argument('--heat', help='flag for using heatmap')\nparser.add_argument('--object', help...
[ 0, 1, 2, 3, 4 ]
from functools import wraps class aws_retry: """retries the call (required for some cases where data is not consistent yet in AWS""" def __init__(self, fields): self.fields = fields # field to inject def __call__(self, function): pass #code ...
normal
{ "blob_id": "493b29433f0c3646e7f80fca2f656fc4a5256003", "index": 8884, "step-1": "<mask token>\n\n\nclass aws_retry:\n <mask token>\n\n def __init__(self, fields):\n self.fields = fields\n <mask token>\n", "step-2": "<mask token>\n\n\nclass aws_retry:\n <mask token>\n\n def __init__(self,...
[ 2, 3, 4, 5, 6 ]
# 約分して、互いに素な(1,3) (3,1)のようなペアを作りカウントする # 正のグループと負のグループを別々に管理 # 正のグループの相手が負のグループに存在した場合、 # どちらかのグループから好きなだけ選ぶか、どちらも選ばないかしかない # 誰ともペアにならなかったグループの個数を全て足してP個だとして、2^P通りを掛ける # (0,0)については、その中から1つ選ぶか、選ばないかしかない import sys readline = sys.stdin.readline N = int(readline()) import math zeropair = 0 zeroa = 0 zerob = 0 from coll...
normal
{ "blob_id": "098488fd10bcf81c4efa198a44d2ff87e4f8c130", "index": 3225, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(N):\n a, b = map(int, readline().split())\n if a == 0 and b == 0:\n zeropair += 1\n continue\n if a == 0:\n zeroa += 1\n continue\n ...
[ 0, 1, 2, 3, 4 ]
from src.MultiValueDictApp import MultiValueDictApp def main(): app = MultiValueDictApp() print("Welcome to Multivalue Dictionary App") print("COMMANDS and format:") print("KEYS") print("MEMBERS key") print("ADD key value") print("REMOVE key value") print("REMOVEALL key") print("CLE...
normal
{ "blob_id": "21e83369c4100c41885e9ee8a8d7310556bfe51d", "index": 7271, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n app = MultiValueDictApp()\n print('Welcome to Multivalue Dictionary App')\n print('COMMANDS and format:')\n print('KEYS')\n print('MEMBERS key')\n prin...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Results_flat(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_t...
flexible
{ "blob_id": "802eb0502c5eddcabd41b2d438bf53a5d6fb2c82", "index": 8368, "step-1": "<mask token>\n\n\nclass Results_flat(models.Model):\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>\n <mask token>...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python # coding: utf-8 # MIT Licensed # http://opensource.org/licenses/MIT led_dir = "/sys/class/gpio/gpio40/" led_pin = led_dir + "value" led_mode = led_dir + "direction" with open(led_mode, "wb") as f: f.write("out") with open(led_pin, "wb") as f: f.write(__import__("sys").argv[1]) """ Contrib...
normal
{ "blob_id": "1a9cad6e49e5ed2bb7781f9fec930d48ec048b3b", "index": 5061, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(led_mode, 'wb') as f:\n f.write('out')\nwith open(led_pin, 'wb') as f:\n f.write(__import__('sys').argv[1])\n<mask token>\n", "step-3": "led_dir = '/sys/class/gpio/gpio4...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Recipe: <|reserved_special_token_0|> def __init__(self, labor_amount: float, required_goods: BagOfGoods, planet_variation: Distribution, person_variation: Distribution, labor_variation: Distribution, output_good: GoodKind): self.labor_amount = labor_...
flexible
{ "blob_id": "286801b69546046853d123c5708f24eaaa2e8cec", "index": 6044, "step-1": "<mask token>\n\n\nclass Recipe:\n <mask token>\n\n def __init__(self, labor_amount: float, required_goods: BagOfGoods,\n planet_variation: Distribution, person_variation: Distribution,\n labor_variation: Distrib...
[ 6, 9, 17, 23, 26 ]
<|reserved_special_token_0|> def make_Folders(names): for n in names: if not os.path.exists(n): os.makedirs(n) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def make_Folders(names): for n in names: if not os.path.exists(n): ...
flexible
{ "blob_id": "426396c981fe56230e39b81e156e7c6877e39055", "index": 2213, "step-1": "<mask token>\n\n\ndef make_Folders(names):\n for n in names:\n if not os.path.exists(n):\n os.makedirs(n)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef make_Folders(names):\n for n in names:\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class User(db.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "0b2bc19aea9393562f79df026bc17513e25c6604", "index": 8535, "step-1": "<mask token>\n\n\nclass User(db.Model):\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>\n <mask token>\n <mask ...
[ 14, 15, 16, 17, 19 ]
from otree.api import Currency as c, currency_range from . import models from ._builtin import Page, WaitPage from .models import Constants class Introduction(Page): timeout_seconds = 60 class Welcome(Page): timeout_seconds = 60 class Priming(Page): form_model = models.Player form_fields = ['text'...
normal
{ "blob_id": "8fecfdf4b3772e5304f0b146317f94cdbd7fbd53", "index": 5791, "step-1": "<mask token>\n\n\nclass Eye11(Page):\n form_model = models.Player\n form_fields = ['option_11']\n timeout_seconds = 10\n\n\nclass Eye12(Page):\n form_model = models.Player\n form_fields = ['option_12']\n timeout_s...
[ 76, 81, 85, 100, 105 ]
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
normal
{ "blob_id": "f0f4573808253ca4bff808104afa9f350d305a9c", "index": 3501, "step-1": "# ----------------------------------------------------------------------\n# Numenta Platform for Intelligent Computing (NuPIC)\n# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement\n# with Numenta, Inc., for a separate...
[ 0 ]
import os templateFile = 'crab_template.py' samples=[\ #"/TTJets_MSDecaysCKM_central_Tune4C_13TeV-madgraph-tauola/Spring14miniaod-PU20bx25_POSTLS170_V5-v1/MINIAODSIM", #"/TTJets_MSDecaysCKM_central_Tune4C_13TeV-madgraph-tauola/Spring14miniaod-PU20bx25_POSTLS170_V5-v2/MINIAODSIM", #Identical? Same event count #miniAO...
normal
{ "blob_id": "184b850e85b523f22a44cfde698efd96b94d819d", "index": 2095, "step-1": "import os\ntemplateFile = 'crab_template.py'\nsamples=[\\\n#\"/TTJets_MSDecaysCKM_central_Tune4C_13TeV-madgraph-tauola/Spring14miniaod-PU20bx25_POSTLS170_V5-v1/MINIAODSIM\", \n#\"/TTJets_MSDecaysCKM_central_Tune4C_13TeV-madgraph-t...
[ 0 ]
class CacheDecorator: <|reserved_special_token_0|> def cachedFunc(self, *args): if args not in self.cache: print('Ergebnis berechnet') self.cache[args] = self.func(*args) else: print('Ergebnis geladen') return self.cache[args] def __call__(self, ...
flexible
{ "blob_id": "b7f6207fe6c013a964258255445004c3f4e0adbb", "index": 7217, "step-1": "class CacheDecorator:\n <mask token>\n\n def cachedFunc(self, *args):\n if args not in self.cache:\n print('Ergebnis berechnet')\n self.cache[args] = self.func(*args)\n else:\n p...
[ 3, 4, 5, 6, 7 ]
# coding: utf-8 import os, sys import numpy as np from math import exp, sqrt, pi def factorial(n): value = 1 for i in range(n,1,-1): value *= i return value def double_factorial(n): k = 1 for i in range(n, 1, -2): k *= i #print("n:", n, "double factorial:", k) return k ...
normal
{ "blob_id": "005650e2747c61b730960a29891b6ba6c8bd381b", "index": 1334, "step-1": "<mask token>\n\n\ndef double_factorial(n):\n k = 1\n for i in range(n, 1, -2):\n k *= i\n return k\n\n\n<mask token>\n\n\ndef gaussian_integral(alpha, m):\n if int(m / 2) * 2 == m:\n n = int(m / 2)\n ...
[ 2, 3, 4, 5, 6 ]
""" You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums2. The Next Greater Number of a number x in nums1 is the first greater number to its right in nums2. If it does not exi...
normal
{ "blob_id": "3abeac4fb80244d2da14e14a6048c09b0c0c1393", "index": 6047, "step-1": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution(object):\n\n def nextGreaterElement(self, findNums, nums):\n \"\"\"\n :type findNums: ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: from local_settings import * except ImportError: pass if SENTRY_URL: import sentry_sdk sentry_sdk.init(SENTRY_URL) <|reserved_special_token_1|> <|reserved_special_token_0|> WOO_HOST = os.environ.get('WOO_HO...
flexible
{ "blob_id": "386fa51b9b285d36c75d6446f9348f6713e0dbaa", "index": 2794, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n from local_settings import *\nexcept ImportError:\n pass\nif SENTRY_URL:\n import sentry_sdk\n sentry_sdk.init(SENTRY_URL)\n", "step-3": "<mask token>\nWOO_HOST = os....
[ 0, 1, 2, 3, 4 ]
from tkinter import * root = Tk() ent = Entry(root) ent.pack() def click(): ent_text = ent.get() lab = Label(root, text=ent_text) lab.pack() btn = Button(root, text="Click Me!", command=click) btn.pack() root.mainloop()
normal
{ "blob_id": "49f1b4c9c6d15b8322b83396c22e1027d241da33", "index": 2311, "step-1": "<mask token>\n\n\ndef click():\n ent_text = ent.get()\n lab = Label(root, text=ent_text)\n lab.pack()\n\n\n<mask token>\n", "step-2": "<mask token>\nent.pack()\n\n\ndef click():\n ent_text = ent.get()\n lab = Label...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def get_all_countries(): response = requests.get('{}/countries'.format(ROOT_URL)) return response.json()['countries'] def get_country_probability(countryIds): body = {'countryIds': countryIds} response = requests.get('{}/countries/probability'.format(ROOT_URL), d...
flexible
{ "blob_id": "6aa7114db66a76cfa9659f5537b1056f40f47bd2", "index": 3975, "step-1": "<mask token>\n\n\ndef get_all_countries():\n response = requests.get('{}/countries'.format(ROOT_URL))\n return response.json()['countries']\n\n\ndef get_country_probability(countryIds):\n body = {'countryIds': countryIds}\...
[ 11, 12, 15, 17, 18 ]
import glob import logging import os import sqlite3 from aiogram import Bot, Dispatcher, executor, types TOKEN = '1772334389:AAE5wv8gssOFOgxQjQwKk7rUSKQHr6NTjus' logging.basicConfig(level=logging.INFO) bot = Bot(token=TOKEN) dp = Dispatcher(bot) path1 = 'C:\\Users\\const\\PycharmProjects\\t' conn = sqlite3.connect('...
normal
{ "blob_id": "4193fa992d06890afb660c072842cf1b85a43774", "index": 3207, "step-1": "<mask token>\n", "step-2": "<mask token>\nlogging.basicConfig(level=logging.INFO)\n<mask token>\n\n\n@dp.message_handler(commands=['start', 'help'])\nasync def send_welcome(message: types.Message):\n await message.reply(\n ...
[ 0, 1, 2, 3, 4 ]
from django.shortcuts import render, redirect, get_object_or_404 from django.http import HttpResponse from django.contrib import messages # Create your views here. from User.models import User, check_if_auth_user from .models import Chat # def recv_chat(request, id = None): # check = check_if_auth_user(request) # if...
normal
{ "blob_id": "9dfb3f58127b30467651ac4209277cd947643c65", "index": 7411, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef begin_chat(request, id=None):\n check = check_if_auth_user(request)\n if not check:\n messages.error(request, 'Perform login first to start chatting')\n return...
[ 0, 1, 2, 3 ]
import matplotlib matplotlib.use('Agg') import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.axes_grid1 import make_axes_locatable def plot_overscan(overscan, img, TITLE, OUT_DIR): """ plot overscan in 9x2 plots with 16 channels """ fig = plt.figure(figs...
normal
{ "blob_id": "736861f18936c7a87ecf3deb134f589b9d7eed92", "index": 3934, "step-1": "\nimport matplotlib\nmatplotlib.use('Agg')\nimport matplotlib.gridspec as gridspec\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom mpl_toolkits.axes_grid1 import make_axes_locatable\n\n\ndef plot_overscan(overscan, img, ...
[ 0 ]
# -*- coding: utf-8 -*- import os import sys import base64 import cdutil import json import os from array import array from uuid import uuid4 import cdms2 import numpy as np import matplotlib as mpl mpl.rcParams['mathtext.default'] = 'regular' mpl.use('qt4agg') import matplotlib.pyplot as plt from mpl_toolkits.ba...
normal
{ "blob_id": "ff9376ab4d6a88849167fb6e180fd9c4f9ab4dad", "index": 8283, "step-1": " # -*- coding: utf-8 -*-\nimport os\nimport sys\n\nimport base64\nimport cdutil\nimport json\nimport os\nfrom array import array\nfrom uuid import uuid4\n\nimport cdms2\nimport numpy as np\nimport matplotlib as mpl\nmpl.rcParams...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': counter1 = Hmm(3) input_counts = open('gene_NoClass.counts', 'r') dev_file = open('gene.dev', 'r+') output_file2 = open('gene_dev.NoClass.out.p2', 'w') print('dev_file read') prin...
flexible
{ "blob_id": "6dda23cc5d0083e72520b0664b6550ccb48e4b4f", "index": 7288, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n counter1 = Hmm(3)\n input_counts = open('gene_NoClass.counts', 'r')\n dev_file = open('gene.dev', 'r+')\n output_file2 = open('gene_dev.NoClass.ou...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TeacherGUI: <|reserved_special_token_0|> @classmethod def setup(cls, ui_mainwindow): cls.__ui_mainwindow = ui_mainwindow @classmethod def display_all_active_school_classes(cls, school_classes): cls.__ui_mainwindow.tableWidget_14.clear() ...
flexible
{ "blob_id": "98f234ca0cbec419466de0504fd8d5c68fd07627", "index": 9609, "step-1": "<mask token>\n\n\nclass TeacherGUI:\n <mask token>\n\n @classmethod\n def setup(cls, ui_mainwindow):\n cls.__ui_mainwindow = ui_mainwindow\n\n @classmethod\n def display_all_active_school_classes(cls, school_c...
[ 100, 103, 113, 122, 132 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('signup/', views.signup, name='signup'), path('home', views.home, name='home'), path('collab/', views.collab, name='collab')] <|reserved_special_token_1|> from django.urls import path from django.conf.ur...
flexible
{ "blob_id": "351963bee76ecaa9fa5c8d659f6d7c6ca9b22531", "index": 2182, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('signup/', views.signup, name='signup'), path('home',\n views.home, name='home'), path('collab/', views.collab, name='collab')]\n", "step-3": "from django.urls im...
[ 0, 1, 2, 3 ]
def main(): s1 = 'mabaabm' s2 = 'moktko!' s3 = ex7(s1, s2) print(s3) def ex7(in1, in2): out1 = in1[0] + in1[int(len(in1) / 2)] + in1[int(len(in1) - 1)] + in2[0 ] + in2[int(len(in2) / 2)] + in2[int(len(in2) - 1)] return out1 if __name__ == '__main__': main()
normal
{ "blob_id": "f45cae397aa3b7bdba6e3f36e20b926487cb160d", "index": 9238, "step-1": "<mask token>\n", "step-2": "def main():\n s1 = 'mabaabm'\n s2 = 'moktko!'\n s3 = ex7(s1, s2)\n print(s3)\n\n\n<mask token>\n", "step-3": "def main():\n s1 = 'mabaabm'\n s2 = 'moktko!'\n s3 = ex7(s1, s2)\n ...
[ 0, 1, 2, 3 ]
import requests import re import time import os import argparse import json url = "https://contactform7.com/captcha/" headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Safari/605.1.15', 'Content-Type': "multipart/form-data; boun...
normal
{ "blob_id": "6990b5f34af654b4e1a39c3d73b6822fa48e4835", "index": 9159, "step-1": "<mask token>\n", "step-2": "<mask token>\nap.add_argument('-o', '--output', required=True, help='Path to save the images'\n )\nap.add_argument('-n', '--number', required=False, default=500, help=\n 'number of images to down...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def resultados(request, total): latest_question_list = Pregunta.objects.order_by('fecha')[:total] output = ', '.join([q.descripcion for q in latest_question_list]) return HttpResponse(output) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_tok...
flexible
{ "blob_id": "07dc058ecef323ffd41299245e4fcafdc9e41506", "index": 2131, "step-1": "<mask token>\n\n\ndef resultados(request, total):\n latest_question_list = Pregunta.objects.order_by('fecha')[:total]\n output = ', '.join([q.descripcion for q in latest_question_list])\n return HttpResponse(output)\n\n\n<...
[ 1, 2, 3, 4, 5 ]
#coding: utf-8 import numpy as np import cv2 leftgray = cv2.imread('../image/1.jpg') rightgray = cv2.imread('../image/2.jpg') hessian=500 surf=cv2.xfeatures2d.SURF_create(hessian) #将Hessian Threshold设置为400,阈值越大能检测的特征就越少 kp1,des1=surf.detectAndCompute(leftgray,None) #查找关键点和描述符 kp2,des2=surf.detectAndCompute(rightgr...
normal
{ "blob_id": "60953878c377382f1c7f25ce284c9fa12b8eb25f", "index": 4667, "step-1": "<mask token>\n", "step-2": "<mask token>\ncv2.namedWindow('mathches', 1)\ncv2.imshow('mathches', a)\ncv2.waitKey()\n<mask token>\nfor m, n in matches:\n if m.distance < 0.45 * n.distance:\n good.append(m)\nprint(len(goo...
[ 0, 1, 2, 3, 4 ]
''' Load a variety of relevant physical parameters. All quantities are in atomic units, such that m_e = 1 e = 1 hbar = 1 1/4\pi\epsilon = 1 ''' import numpy as np hbar = 1.0 m_e = 1.0 h22m = hbar**2 / (2*m_e) pi = np.pi eV = 1/27.21138505 eV_Ha = eV nm = 18.89726124565 kB_eV = 8.6173324e-5 kB = kB_e...
normal
{ "blob_id": "f9f835b24aa8fc77109db9e2d89a3f43bcb4b181", "index": 7079, "step-1": "<mask token>\n", "step-2": "<mask token>\nhbar = 1.0\nm_e = 1.0\nh22m = hbar ** 2 / (2 * m_e)\npi = np.pi\neV = 1 / 27.21138505\neV_Ha = eV\nnm = 18.89726124565\nkB_eV = 8.6173324e-05\nkB = kB_eV * eV_Ha\n", "step-3": "<mask to...
[ 0, 1, 2, 3 ]
# Jeremy Jao # University of Pittsburgh: DBMI # 6/18/2013 # # This is the thing that returns the dictionary of the key. we can edit more code to return different values in the keys (gene) in each dictionary inside the dictionary. # my sys.argv isn't working in my situation due to my IDE (nor do I not know how it w...
normal
{ "blob_id": "7016a7dda80c0cfae0e15cf239f6ae64eb9004b7", "index": 9733, "step-1": "# Jeremy Jao\r\n# University of Pittsburgh: DBMI\r\n# 6/18/2013\r\n#\r\n# This is the thing that returns the dictionary of the key. we can edit more code to return different values in the keys (gene) in each dictionary inside the d...
[ 0 ]
# Copyright 2016 Tesora, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
normal
{ "blob_id": "5e29c6d1034f6612b0081037f8dc679b49f1dbef", "index": 2855, "step-1": "<mask token>\n", "step-2": "charset = {'big5': ['big5_chinese_ci', 'big5_bin'], 'dec8': [\n 'dec8_swedish_ci', 'dec8_bin'], 'cp850': ['cp850_general_ci',\n 'cp850_bin'], 'hp8': ['hp8_english_ci', 'hp8_bin'], 'koi8r': [\n ...
[ 0, 1, 2 ]
#coding=utf-8 ''' Created on 2013-3-28 @author: jemmy ''' import telnetlib import getpass import sys import os import time import xlrd from pyExcelerator import * import #define Host = "192.168.0.1" Port = "70001" #Host = raw_iput("IP",) username = "admin" password = "admin" filename = str(time.strftime('%Y%m%d%H%M%S...
normal
{ "blob_id": "153c02585e5d536616ec4b69757328803ac2fb71", "index": 3394, "step-1": "#coding=utf-8\n'''\nCreated on 2013-3-28\n\n@author: jemmy\n'''\nimport telnetlib\nimport getpass\nimport sys\nimport os\nimport time\nimport xlrd\nfrom pyExcelerator import *\nimport\n#define\nHost = \"192.168.0.1\"\nPort = \"7000...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Map(BaseCommand): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Map(BaseCommand): def run(self): from lib.models import Mapping from lib.models i...
flexible
{ "blob_id": "07783921da2fb4ae9452324f833b08b3f92ba294", "index": 546, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Map(BaseCommand):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Map(BaseCommand):\n\n def run(self):\n from lib.models import Mapping\n from lib.mod...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python # -*- coding: utf-8 -*- import json import urllib2 #this is executed by a cron job on the pi inside the pooltable secret ='secret' baseurl='https://pooltable.mysite.com/' url = baseurl + 'gettrans.php?secret=' + secret req = urllib2.Request(url) f = urllib2.urlopen(req) response = f.read()...
normal
{ "blob_id": "9baf55eb2fb70e9fa0d92df22d307962b8d6c6d4", "index": 5883, "step-1": "#!/usr/bin/python\r\n# -*- coding: utf-8 -*-\r\n\r\nimport json\r\nimport urllib2\r\n#this is executed by a cron job on the pi inside the pooltable\r\nsecret ='secret'\r\nbaseurl='https://pooltable.mysite.com/'\r\nurl = baseurl + '...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> bind = '0.0.0.0:8000' workers = os.environ['GET_KEYS_ACCOUNTS_WORKERS'] <|reserved_special_token_1|> import os bind = '0.0.0.0:8000' workers = os.environ['GET_KEYS_ACCOUNTS_WORKERS']
flexible
{ "blob_id": "d84a7e16471c604283c81412653e037ecdb19102", "index": 3530, "step-1": "<mask token>\n", "step-2": "<mask token>\nbind = '0.0.0.0:8000'\nworkers = os.environ['GET_KEYS_ACCOUNTS_WORKERS']\n", "step-3": "import os\nbind = '0.0.0.0:8000'\nworkers = os.environ['GET_KEYS_ACCOUNTS_WORKERS']\n", "step-4...
[ 0, 1, 2 ]
<|reserved_special_token_0|> @api.route('/get/<key_name>', methods=['GET']) def get(key_name): li = db_handle(key_name) if li[1] is None: abort(404) else: result = matchtyper(li) return make_response(jsonify(result)) @api.errorhandler(404) def not_found(error): return make_re...
flexible
{ "blob_id": "44e9fd355bfab3f007c5428e8a5f0930c4011646", "index": 3853, "step-1": "<mask token>\n\n\n@api.route('/get/<key_name>', methods=['GET'])\ndef get(key_name):\n li = db_handle(key_name)\n if li[1] is None:\n abort(404)\n else:\n result = matchtyper(li)\n return make_response...
[ 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('courses', '0015_auto_20151216_1136'), ] operations = [ migrations.AlterField( model_name='duration', ...
normal
{ "blob_id": "0cba18ca7126dda548a09f34dc26b83d6471bf68", "index": 1652, "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 = [('courses', '...
[ 0, 1, 2, 3, 4 ]
n=int(0) import random def doubleEven(n): if n % 2 == 0: n = n*2 return (n) else: return "-1" print(doubleEven(n = int(input("put in a number")))) g=int(0) def grade(g): if g < 50: return "F" if g < 66: return "C" if g > 92: return "A+" else: ...
normal
{ "blob_id": "5251724656e1d971900fff3d8fa0210c6cfc27bb", "index": 5505, "step-1": "n=int(0)\nimport random\ndef doubleEven(n):\n if n % 2 == 0:\n n = n*2\n return (n)\n else:\n return \"-1\"\n\n\nprint(doubleEven(n = int(input(\"put in a number\"))))\n\ng=int(0)\n\ndef grade(g):\n if...
[ 0 ]
<|reserved_special_token_0|> class Game(object): <|reserved_special_token_0|> <|reserved_special_token_0|> def render_field(self): """Метод отрисовки поля""" print(tabulate.tabulate(self.rendered_field, tablefmt='grid')) def check_free_place(self, i, j): """Метод проверки кле...
flexible
{ "blob_id": "23ba9e498dd153be408e973253d5f2a858d4771b", "index": 6922, "step-1": "<mask token>\n\n\nclass Game(object):\n <mask token>\n <mask token>\n\n def render_field(self):\n \"\"\"Метод отрисовки поля\"\"\"\n print(tabulate.tabulate(self.rendered_field, tablefmt='grid'))\n\n def c...
[ 5, 6, 9, 11, 12 ]
#!/usr/bin/env python import cgitb import cgi import pymysql form = cgi.FieldStorage() c.execute("SELECT * FROM example") recs = c.fetchall() records1 = """ <body> <table> <tbody> <tr> <th>Full Name</th> <th>Average Score</th> </tr>""" records_dyn = [ f"<tr><td>{name}</td><td>{avg...
normal
{ "blob_id": "b5fee01582a28085983c56b9c266ef7fd5c3c927", "index": 5132, "step-1": "<mask token>\n", "step-2": "<mask token>\nc.execute('SELECT * FROM example')\n<mask token>\nprint('Content-Type:text/html; charset=utf-8')\nprint()\nfor i in records1.split('\\n'):\n print(i)\nfor i in records_dyn:\n print(...
[ 0, 1, 2, 3, 4 ]
# Copyright 2018-present Kensho Technologies, LLC. from .utils import create_vertex_statement, get_random_date, get_uuid EVENT_NAMES_LIST = ( "Birthday", "Bar Mitzvah", "Coronation", "Re-awakening", ) def _create_event_statement(event_name): """Return a SQL statement to create a Event vertex."""...
normal
{ "blob_id": "a521befba58aa85c2fcfe6006db4b161123585f1", "index": 5341, "step-1": "<mask token>\n\n\ndef _create_event_statement(event_name):\n \"\"\"Return a SQL statement to create a Event vertex.\"\"\"\n field_name_to_value = {'name': event_name, 'event_date':\n get_random_date(), 'uuid': get_uuid...
[ 1, 2, 3, 4, 5 ]
IMAGE_SIZE=(640, 480)
normal
{ "blob_id": "af80cb4d4ce5c071efc39e85f89bb412cff6bf6e", "index": 4489, "step-1": "<mask token>\n", "step-2": "IMAGE_SIZE = 640, 480\n", "step-3": "IMAGE_SIZE=(640, 480)\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|> if boxChecked == 'true': heading = 'Recurring Donation' customerRequest = {'given_name': firstName, 'family_name': lastName, 'email_address': email} try: customerResponse = customers_api_instance.create...
flexible
{ "blob_id": "bb7910af5334641fd2db7146112afaff7a2e42b9", "index": 565, "step-1": "<mask token>\n", "step-2": "<mask token>\nif boxChecked == 'true':\n heading = 'Recurring Donation'\n customerRequest = {'given_name': firstName, 'family_name': lastName,\n 'email_address': email}\n try:\n c...
[ 0, 1, 2, 3, 4 ]
# from https://github.com/tensorflow/models/tree/master/research/object_detection/dataset_tools # and https://gist.github.com/saghiralfasly/ee642af0616461145a9a82d7317fb1d6 import tensorflow as tf from object_detection.utils import dataset_util import os import io import hashlib import xml.etree.ElementTree as ET imp...
normal
{ "blob_id": "8142585827590f6d951f0fcc375e8511aa75e9c8", "index": 7320, "step-1": "<mask token>\n\n\ndef main(_):\n writer_train = tf.python_io.TFRecordWriter('./data/train.record')\n writer_test = tf.python_io.TFRecordWriter('./data/test.record')\n filename_list = tf.train.match_filenames_once('./data/a...
[ 1, 2, 3, 4, 5 ]
n=int(input("Digite um número")) m=n-1 o=n+1 print("Seu número é {} seu antecessor é {} e seu sucessor é {}".format(n,m,o))
normal
{ "blob_id": "47d72379b894826dad335f098649702ade195f78", "index": 7337, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Seu número é {} seu antecessor é {} e seu sucessor é {}'.format(n, m, o)\n )\n", "step-3": "n = int(input('Digite um número'))\nm = n - 1\no = n + 1\nprint('Seu número é {} se...
[ 0, 1, 2, 3 ]
def unique(lisst): setlisst = set(lisst) return len(setlisst) print(unique({4, 5, 1, 1, 3}))
normal
{ "blob_id": "42d26ef51bb4dafc8a0201a828652e166a3905e4", "index": 7339, "step-1": "<mask token>\n", "step-2": "def unique(lisst):\n setlisst = set(lisst)\n return len(setlisst)\n\n\n<mask token>\n", "step-3": "def unique(lisst):\n setlisst = set(lisst)\n return len(setlisst)\n\n\nprint(unique({4, ...
[ 0, 1, 2 ]
#!/usr/bin/env python """This script draws a boxplot of each atom contribution to the cavity.""" import sys if sys.version < "2.7": print >> sys.stderr, "ERROR: This script requires Python 2.7.x. "\ "Please install it and try again." exit(1) try: import matplotlib.pyplot as pyp...
normal
{ "blob_id": "9fdcaf65f070b7081afd327442dd20e3284c71eb", "index": 7905, "step-1": "<mask token>\n\n\ndef parse_args():\n import argparse\n import os.path\n\n def isfile(path):\n Error = argparse.ArgumentTypeError\n if not os.path.exists(path):\n raise Error(\"No such file: '{0}'\...
[ 6, 7, 8, 11, 12 ]
class Node: def __init__(self, data): self.data = data self.prev = None self.next = None class LinkedList: def __init__(self): self.head = None def insertAtHead(self, newNode, curNode): newNode.next = curNode if curNode is not None: curNode.prev = newNode ...
normal
{ "blob_id": "a3cbdecbbfc49e8ac045f4aabbea6b9f54ed3d5f", "index": 4904, "step-1": "<mask token>\n\n\nclass LinkedList:\n\n def __init__(self):\n self.head = None\n\n def insertAtHead(self, newNode, curNode):\n newNode.next = curNode\n if curNode is not None:\n curNode.prev = ...
[ 5, 7, 8, 9, 11 ]
#!/usr/bin/env python # # ConVirt - Copyright (c) 2008 Convirture Corp. # ====== # # ConVirt is a Virtualization management tool with a graphical user # interface that allows for performing the standard set of VM operations # (start, stop, pause, kill, shutdown, reboot, snapshot, etc...). It # also attempts to s...
normal
{ "blob_id": "3078a0c7e2c711da88846ca3401c7924b1790dbc", "index": 1251, "step-1": "#!/usr/bin/env python\n#\n# ConVirt - Copyright (c) 2008 Convirture Corp.\n# ======\n#\n# ConVirt is a Virtualization management tool with a graphical user\n# interface that allows for performing the standard set of VM opera...
[ 0 ]
def multiplica(): one = int(input('1º: ')) two = int(input('2º: ')) print('a multiplicação é: ', one*two) def soma(): one = int(input('1º: ')) two = int(input('2º: ')) print('a soma é: ', one+two) def subtra(): one = int(input('1º: ')) two = int(input('2º: ')) ...
normal
{ "blob_id": "414fa4021b21cea0dc49380aebfe67f0204f0574", "index": 5994, "step-1": "def multiplica():\n one = int(input('1º: '))\n two = int(input('2º: '))\n print('a multiplicação é: ', one * two)\n\n\ndef soma():\n one = int(input('1º: '))\n two = int(input('2º: '))\n print('a soma é: ', one + ...
[ 2, 3, 4, 5, 6 ]
from pyspark import SparkContext, RDD from pyspark.sql import SparkSession, DataFrame from pyspark.streaming import StreamingContext from pyspark.streaming.kafka import KafkaUtils import string from kafka import KafkaProducer import time import pyspark sc = SparkContext(master='local[4]') ssc = StreamingContext(sc, b...
normal
{ "blob_id": "12fdeae0ae1618139b20176846e7df5b82f7aa01", "index": 8274, "step-1": "<mask token>\n\n\ndef send_rdd(rdd):\n out_list = rdd.collect()\n for word in out_list:\n producer.send('had2020011-out', value=str(word))\n\n\n<mask token>\n\n\ndef aggregator(values, old):\n return (old or 0) + su...
[ 2, 3, 4, 5, 6 ]
# Generated by Django 3.0.4 on 2020-04-04 11:07 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('product', '0003_cost'), ...
normal
{ "blob_id": "a4f2ca3155f2bb4c17be5bb56dd889abb5d20293", "index": 3791, "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 = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
"""David's first approach when I exposed the problem. Reasonable to add in the comparison? """ import numpy as np from sklearn.linear_model import RidgeCV from sklearn.model_selection import ShuffleSplit def correlation(x, y): a = (x - x.mean(0)) / x.std(0) b = (y - y.mean(0)) / y.std(0) return a.T @ b / ...
normal
{ "blob_id": "dfd2b515e08f285345c750bf00f6a55f43d60039", "index": 8379, "step-1": "<mask token>\n\n\ndef partial_correlation_loop(solver, x, y, ensemble=None):\n e_hat = np.zeros(y.shape[1])\n for i in range(y.shape[1]):\n y_i = y[:, i].reshape(-1, 1)\n y_not_i = np.delete(y, i, axis=1)\n ...
[ 4, 5, 6, 7, 9 ]
import Net import mnist_parser import numpy as np #To use this model it is required to download the MNIST database #The donwloaded base is then needet parse to numpy using mnist_parser.parse_to_npy method #The files genetared using mnist_parser.parse_to_npy are then loaded using np.load in_values = np.load("MNIST/mnist...
normal
{ "blob_id": "49005500b299ca276f663fe8431bb955e5585bbd", "index": 335, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n net = Net.FeedForwardNet(input_count=784, layers=[100, 10],\n activation_function=Net.FeedForwardNet.leaky_relu)\n try:\n epoch_num = int(input('Epoch_num...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AutomationserverConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AutomationserverConfig(AppConfig): name = 'automationserver' <|reserved_special...
flexible
{ "blob_id": "3153218fe1d67fdc1c1957ffcfdb380688c159c1", "index": 6483, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AutomationserverConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass AutomationserverConfig(AppConfig):\n name = 'automationserver'\n", "step-4": "...
[ 0, 1, 2, 3 ]
from utils import create_data_lists if __name__ == '__main__': create_data_lists(ICDAR_path= '../ICDAR_Dataset/0325updated.task1train(626p)', output_folder= '../ICDAR_Dataset/0325updated.task1train(626p)')
normal
{ "blob_id": "6334a8a052d72b0f13395b301bd5a766acf4399b", "index": 3437, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n create_data_lists(ICDAR_path=\n '../ICDAR_Dataset/0325updated.task1train(626p)', output_folder=\n '../ICDAR_Dataset/0325updated.task1train(62...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def sieve(n): sieve = [1] * (n + 1) sieve[1] = 0 sieve[0] = 0 for i in range(2, int(math.sqrt(n) + 1)): if sieve[i] == 1: for j in range(i * i, n + 1, i): sieve[j] = 0 return sieve def odd_prime(a): while a != 0: y = a ...
flexible
{ "blob_id": "60617ff6eda880e5467b3b79d3df13a7147f5990", "index": 3329, "step-1": "<mask token>\n\n\ndef sieve(n):\n sieve = [1] * (n + 1)\n sieve[1] = 0\n sieve[0] = 0\n for i in range(2, int(math.sqrt(n) + 1)):\n if sieve[i] == 1:\n for j in range(i * i, n + 1, i):\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class external(terrascript.Provider): pass <|reserved_special_token_1|> import terrascript class external(terrascript.Provider): pass <|reserved_special_token_1|> # terrascript/external/__init__.py import terras...
flexible
{ "blob_id": "04e57739e6fb98cd237fbe09caecd17c728c1797", "index": 5548, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass external(terrascript.Provider):\n pass\n", "step-3": "import terrascript\n\n\nclass external(terrascript.Provider):\n pass\n", "step-4": "# terrascript/external/__init...
[ 0, 1, 2, 3 ]
import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ecommerce.settings.development') application = get_asgi_application()
normal
{ "blob_id": "1cb320cf57823511b0398adce097b770b2131eb6", "index": 9307, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.environ.setdefault('DJANGO_SETTINGS_MODULE',\n 'ecommerce.settings.development')\n<mask token>\n", "step-3": "<mask token>\nos.environ.setdefault('DJANGO_SETTINGS_MODULE',\n 'e...
[ 0, 1, 2, 3 ]
from Receiver import Receiver import time import Image class Sender: ACK = [] size = None windowSize = None tableOfFrames = [] ChosenSumAlgorithm = None def __init__(self, receiver): self.receiver = receiver pass def send_frame(self, frame): self.receiver.receiver_...
normal
{ "blob_id": "ecbcd023b8fec5763c6ff7f4cd0999426fae4a50", "index": 9093, "step-1": "<mask token>\n\n\nclass Sender:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def send_frame(self, frame):\n self.receiver.receiver_frame(frame)\n p...
[ 5, 7, 8, 10, 11 ]