code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> class Seq: <|reserved_special_token_0|> def __init__(self, sequence: str, id: str=None, codons: dict=codons): self.sequence = sequence self.id = id self.codons = codons def __repr__(self): if not self.id: return f'Seq({self.sequenc...
flexible
{ "blob_id": "3d742505d480493fbc729e7a0febdcab3a7dc041", "index": 9386, "step-1": "<mask token>\n\n\nclass Seq:\n <mask token>\n\n def __init__(self, sequence: str, id: str=None, codons: dict=codons):\n self.sequence = sequence\n self.id = id\n self.codons = codons\n\n def __repr__(s...
[ 20, 24, 31, 33, 35 ]
<|reserved_special_token_0|> def naiveBayes(X_train, y_train): model = GaussianNB() model = model.fit(X_train, y_train) return model def knn(X_train, y_train): model = KNeighborsClassifier() model = model.fit(X_train, y_train) return model def decisionTree(X_train, y_train): model = tr...
flexible
{ "blob_id": "a92384a6abee9e231092ee0e4dbdb60bafcc9979", "index": 8782, "step-1": "<mask token>\n\n\ndef naiveBayes(X_train, y_train):\n model = GaussianNB()\n model = model.fit(X_train, y_train)\n return model\n\n\ndef knn(X_train, y_train):\n model = KNeighborsClassifier()\n model = model.fit(X_t...
[ 13, 14, 16, 17, 21 ]
from lredit import * # customization of MainWindow def configure(window): #---------------------------------------------- # Generic edit config # tab width and indent width Mode.tab_width = 4 # make TAB character visible Mode.show_tab = True # make space character visible Mode.sh...
normal
{ "blob_id": "d8e2613b45b3f4a24db0b07a01061c6057c9feed", "index": 4973, "step-1": "from lredit import *\n\n\n# customization of MainWindow\ndef configure(window):\n\n\n #----------------------------------------------\n # Generic edit config\n\n # tab width and indent width\n Mode.tab_width = 4\n\n ...
[ 0 ]
"""Run golden output tests. The golden tests are a convenient way to make sure that a "small" change does not break anyone else. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from collections import namedtuple import os import subprocess import sys ...
normal
{ "blob_id": "2294951af6ad7a5e752285194d0586c79c49ef87", "index": 4254, "step-1": "<mask token>\n\n\ndef FindTests():\n \"\"\"Finds golden files and returns Test cases for each.\"\"\"\n for root, _, files in os.walk(GOLDEN_CASES_DIR):\n path_parts = root.split('/')\n if path_parts[-3] == 'gold...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def change_directory(path): """ Changes directory to path. """ os.chdir(path) <|reserved_special_token_0|> def get_key_from_values(f, catalog): """ Gets the full associated with the filename in the catalog. """ L_keys = [] L_values = [] for pa...
flexible
{ "blob_id": "3989b4c2a15fa8cd54fef86f9d7150fbd0fb74cf", "index": 8724, "step-1": "<mask token>\n\n\ndef change_directory(path):\n \"\"\" \n Changes directory to path. \n \"\"\"\n os.chdir(path)\n\n\n<mask token>\n\n\ndef get_key_from_values(f, catalog):\n \"\"\"\n Gets the full associated with ...
[ 6, 9, 13, 15, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def checksum_tcp_udp(ip_header, buffer_name, data_length, lenth): return sum_checksum_tcp_udp <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def checksum_tcp_udp(ip_header, buff...
flexible
{ "blob_id": "6d25b0fedf0d5081a3a0a93ddacc49748464d9d0", "index": 405, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef checksum_tcp_udp(ip_header, buffer_name, data_length, lenth):\n return sum_checksum_tcp_udp\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef checksum_tcp_udp(ip_header, ...
[ 0, 1, 2, 3, 4 ]
v = 426 # print 'Yeah!' if dividable by 4 but print 'End of program' after regardless if (v%4) == 0: print ("Yeah!") else: print ("End of the program")
normal
{ "blob_id": "ceca1be15aded0a842c5f2c6183e4f54aba4fd24", "index": 6752, "step-1": "<mask token>\n", "step-2": "<mask token>\nif v % 4 == 0:\n print('Yeah!')\nelse:\n print('End of the program')\n", "step-3": "v = 426\nif v % 4 == 0:\n print('Yeah!')\nelse:\n print('End of the program')\n", "step...
[ 0, 1, 2, 3 ]
import matplotlib.pyplot as plt import cartopy.crs as ccrs from cartopy.feature import ShapelyFeature from shapely.geometry import shape def plot(s): proj = ccrs.PlateCarree() ax = plt.axes(projection=proj) ax.set_extent((s.bounds[0], s.bounds[2], s.bounds[1], s.bounds[3]), crs=ccrs.PlateCarree()) sha...
normal
{ "blob_id": "75754f4032d6e22e53cdbed0f6c640247473faec", "index": 7606, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef plot_merc(s):\n proj = ccrs.Mercator()\n ax = plt.axes(projection=proj)\n ax.set_extent((s.bounds[0], s.bounds[2], s.bounds[1], s.bounds[3]), crs\n =ccrs.PlateCarr...
[ 0, 1, 2, 3, 4 ]
print("gggg") print("gggg") print("gggg")
normal
{ "blob_id": "b53294330a908f8a50d8fbb50b9c88e2bc6135a1", "index": 4124, "step-1": "<mask token>\n", "step-2": "print('gggg')\nprint('gggg')\nprint('gggg')\n", "step-3": "print(\"gggg\")\nprint(\"gggg\")\nprint(\"gggg\")\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import data import numpy as np import matplotlib.pyplot as plt import xgboost as xgb import pandas as pd import csv from matplotlib2tikz import save as tikz_save import trial_sets def print_stats(trial_id, dl): wrist_device, _, true_device = dl.load_oxygen(trial_id, iid=False) print("Length of Dataframe: " ...
normal
{ "blob_id": "836e2fd6eca7453ab7a3da2ecb21705552b5f627", "index": 5157, "step-1": "<mask token>\n\n\ndef print_stats(trial_id, dl):\n wrist_device, _, true_device = dl.load_oxygen(trial_id, iid=False)\n print('Length of Dataframe: ' + str(data.get_df_length(wrist_device)))\n wrist_oxygen = wrist_device.v...
[ 4, 6, 7, 8, 9 ]
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'AND BREAK CHAR COLON COMA CTE_F CTE_I CTE_STRING DETERMINANT DIFFERENT DIVIDE DO DOUBLEEQUAL ELSE EQUAL FLOAT FROM FUNCTION ID IF INPUT INT INVERSA LBRACE LCORCH LOWERE...
normal
{ "blob_id": "160f272edd8283ea561552f22c71967db4a1660a", "index": 7983, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _k, _v in _lr_action_items.items():\n for _x, _y in zip(_v[0], _v[1]):\n if not _x in _lr_action:\n _lr_action[_x] = {}\n _lr_action[_x][_k] = _y\ndel _lr_...
[ 0, 1, 2, 3 ]
import cv2 # open webcam (웹캠 열기) webcam = cv2.VideoCapture(0) if not webcam.isOpened(): print("Could not open webcam") exit() sample_num = 0 captured_num = 0 # loop through frames while webcam.isOpened(): # read frame from webcam status, frame = webcam.read() sample_num = s...
normal
{ "blob_id": "856a27e953a6b4e1f81d02e00717a8f95a7dea5f", "index": 7790, "step-1": "<mask token>\n", "step-2": "<mask token>\nif not webcam.isOpened():\n print('Could not open webcam')\n exit()\n<mask token>\nwhile webcam.isOpened():\n status, frame = webcam.read()\n sample_num = sample_num + 1\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Piece(Objet): <|reserved_special_token_0|> def ramasser(self, joueur): joueur.addPiece() def depenser(self, joueur): joueur.depenserPiece() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Piece(Objet...
flexible
{ "blob_id": "b6898b923e286c66673df1e07105adf789c3151c", "index": 6335, "step-1": "<mask token>\n\n\nclass Piece(Objet):\n <mask token>\n\n def ramasser(self, joueur):\n joueur.addPiece()\n\n def depenser(self, joueur):\n joueur.depenserPiece()\n <mask token>\n", "step-2": "<mask token...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(N): ans.append(abs(i + 1 - lst[i])) <|reserved_special_token_0|> for i in s: rst.append([i, s[i]]) rst.sort(key=lambda x: x[0], reverse=True) for i in rst: if i[1] > 1: print(i[0], i[1]) <|rese...
flexible
{ "blob_id": "decd5d50025fc3b639be2f803d917ff313cf7219", "index": 8838, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(N):\n ans.append(abs(i + 1 - lst[i]))\n<mask token>\nfor i in s:\n rst.append([i, s[i]])\nrst.sort(key=lambda x: x[0], reverse=True)\nfor i in rst:\n if i[1] > 1:\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(0, c): d = ord(a[i]) if b > 0: for j in range(1, b + 1): if a[i] >= 'a' and a[i] <= 'z' or a[i] >= 'A' and a[i] <= 'Z': if d >= 65 and d < 90 or d >= 97 and d < 122: ...
flexible
{ "blob_id": "287d4c2d490c9dcdd7be7e86fe577139a3d30f54", "index": 6676, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, c):\n d = ord(a[i])\n if b > 0:\n for j in range(1, b + 1):\n if a[i] >= 'a' and a[i] <= 'z' or a[i] >= 'A' and a[i] <= 'Z':\n if ...
[ 0, 1, 2, 3 ]
#MenuTitle: Find and Replace Corner Components at Certain Angles # -*- coding: utf-8 -*- from __future__ import division, print_function, unicode_literals __doc__=""" Replace Corner Components at blunt or acute angles. """ import vanilla, math from Foundation import NSPoint class ReplaceCornersAtCertainAngles( object...
normal
{ "blob_id": "540ae4be6a41d52d9c803f829fc8b13b523b31bc", "index": 116, "step-1": "<mask token>\n\n\nclass ReplaceCornersAtCertainAngles(object):\n\n def __init__(self):\n windowWidth = 250\n windowHeight = 140\n windowWidthResize = 100\n windowHeightResize = 0\n self.w = vani...
[ 8, 9, 10, 11, 12 ]
<|reserved_special_token_0|> @app.route('/') def home(): thing = request.args.get('thing') height = request.args.get('height') color = request.args.get('color') return render_template('home1.html', thing=thing, height=height, color= color) <|reserved_special_token_0|> <|reserved_special_to...
flexible
{ "blob_id": "664f9d5aa981c3590043fae1d0c80441bda4fbb1", "index": 2499, "step-1": "<mask token>\n\n\n@app.route('/')\ndef home():\n thing = request.args.get('thing')\n height = request.args.get('height')\n color = request.args.get('color')\n return render_template('home1.html', thing=thing, height=hei...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> create_paths() <|reserved_special_token_0|> if os.path.exists(initial_weights_path): model.load_weights(initial_weights_path) if initial_train: model_checkpoint = tf.keras.callbacks.ModelCheckpoint(initial_weights_path, ...
flexible
{ "blob_id": "d36552cc589b03008dc9edab8d7e4a003e26bd21", "index": 5046, "step-1": "<mask token>\n", "step-2": "<mask token>\ncreate_paths()\n<mask token>\nif os.path.exists(initial_weights_path):\n model.load_weights(initial_weights_path)\nif initial_train:\n model_checkpoint = tf.keras.callbacks.ModelChe...
[ 0, 1, 2, 3, 4 ]
from django.db import models # Create your models here. class Orders(models.Model): customer_name = models.CharField(max_length=80) customer_email = models.CharField(max_length=120) customer_mobile = models.CharField(max_length=40) status = models.CharField(max_length=20) process_url = models.Cha...
normal
{ "blob_id": "bc7a7b9ba4b3277c862aadb57b56661c24efc6e5", "index": 5577, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Orders(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", "step...
[ 0, 1, 2, 3, 4 ]
# (C) Datadog, Inc. 2018 # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) from .agent import agent from .clean import clean from .config import config from .create import create from .dep import dep from .env import env from .meta import meta from .release import release from .run impor...
normal
{ "blob_id": "7a69a9fd6ee5de704a580e4515586a1c1d2b8017", "index": 5874, "step-1": "<mask token>\n", "step-2": "<mask token>\nALL_COMMANDS = (agent, clean, config, create, dep, env, meta, release, run,\n test, validate)\n", "step-3": "from .agent import agent\nfrom .clean import clean\nfrom .config import c...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def translation(query, src_lang, target_lang): if type(query) != str: raise AttributeError('[ERROR] query parameter should be string type') elif len(query) > 5000: raise AttributeError( '[ERROR] Maximum length of query parameter should be same or less t...
flexible
{ "blob_id": "7f58179efecd5a0d691a5c6d83b808f2cd2fcba3", "index": 5332, "step-1": "<mask token>\n\n\ndef translation(query, src_lang, target_lang):\n if type(query) != str:\n raise AttributeError('[ERROR] query parameter should be string type')\n elif len(query) > 5000:\n raise AttributeError(...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- """Template parser for Faker""" from datetime import datetime from jinja2 import Template from faker import Faker from faker.providers.internet import Provider as InternetProvider from ..providers.file_data_source_provider import FileDataSourceProvider from ..providers.numbers_provider import Nu...
normal
{ "blob_id": "38f9cddfde4787ead2314fc70c1f4d91a3da9687", "index": 1307, "step-1": "<mask token>\n\n\nclass TemplateParser:\n <mask token>\n <mask token>\n\n def __init__(self, template=None, providers=None, date_generator=None):\n self.fake = Faker()\n self.fake.add_provider(FileDataSourceP...
[ 3, 4, 6, 7, 8 ]
import random consonants = [ 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z' ] vowels = [ 'a', 'e',' i', 'o', 'u' ] def make_word(user_input): word = "" for letter in user_input: letter = letter.lower() if letter...
normal
{ "blob_id": "a4f4137b9310ebc68515b9cae841051eda1f0360", "index": 3522, "step-1": "<mask token>\n\n\ndef make_word(user_input):\n word = ''\n for letter in user_input:\n letter = letter.lower()\n if letter == 'c':\n word += random.choice(consonants)\n elif letter == 'v':\n ...
[ 1, 2, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(np.random.binomial(10, 0.5, 1)) <|reserved_special_token_1|> import numpy as np print(np.random.binomial(10, 0.5, 1))
flexible
{ "blob_id": "0a3e0eeda14e42bfff7797b3c42a0aebd9a72ade", "index": 3212, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(np.random.binomial(10, 0.5, 1))\n", "step-3": "import numpy as np\nprint(np.random.binomial(10, 0.5, 1))\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class RobotCar_Stub(RobotCar): <|reserved_special_token_0|> def backward(self): print('Backward') def left(self): print('Left') def right(self): print('Right') def stop(self): print('Stop') <|reserved_special_token_0|> <|reserved...
flexible
{ "blob_id": "09b2c1e69203f440754e82506b42e7856c94639a", "index": 8623, "step-1": "<mask token>\n\n\nclass RobotCar_Stub(RobotCar):\n <mask token>\n\n def backward(self):\n print('Backward')\n\n def left(self):\n print('Left')\n\n def right(self):\n print('Right')\n\n def stop(...
[ 5, 6, 7, 8, 9 ]
# content of conftest.py # adapted from http://pytest.org/latest/example/special.html import pytest import requests def tear_down(): ''' conftest.py tear_down - the last to go.... ''' print("\nTEARDOWN after all tests") @pytest.fixture(scope="session", autouse=True) def set_up(request): ''' conftest...
normal
{ "blob_id": "816b1a932208a4525230dd886adf8c67dec3af3e", "index": 349, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.fixture(scope='session', autouse=True)\ndef set_up(request):\n \"\"\" conftest.py set_up - the first to start.... \"\"\"\n print('\\nSETUP before all tests')\n request...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_classifier(config, dataset, checkpoint_path, device='cuda:0'): model = ToxicClassifier(config) checkpoint = torch.load(checkpoint_path, map_location=device) model.load_state_dict(checkpoint['state_dict']) ...
flexible
{ "blob_id": "58c7e81d1b3cf1cff7d91bf40641e5a03b9f19ac", "index": 5730, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_classifier(config, dataset, checkpoint_path, device='cuda:0'):\n model = ToxicClassifier(config)\n checkpoint = torch.load(checkpoint_path, map_location=device)\n mo...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @app.route('/info/<pelicula>', methods=['GET', 'POST']) def informacionPelicula(pelicula): peliculas = catalogo_data['peliculas'] if request.method == 'POST': return redirect(url_for('index'), code=307) for aux in peliculas: if aux['titulo'] == pelicula.replace...
flexible
{ "blob_id": "ebb4cf1ec2baa7bd0d29e3ae88b16e65cf76a88a", "index": 3679, "step-1": "<mask token>\n\n\n@app.route('/info/<pelicula>', methods=['GET', 'POST'])\ndef informacionPelicula(pelicula):\n peliculas = catalogo_data['peliculas']\n if request.method == 'POST':\n return redirect(url_for('index'), ...
[ 9, 12, 13, 15, 16 ]
# Generated by Django 3.0.4 on 2020-03-27 11:42 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('web', '0005_remove_product_image'), ] operations = [ migrations.CreateMode...
normal
{ "blob_id": "c10e1cf2f1ce5b11d19ddddbfc3dc9652d830a3c", "index": 1132, "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 = [('web', '0005...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Remedio(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_1|> <|reserved_special_token_0|> class Remedio(models.Model): ...
flexible
{ "blob_id": "07cce6802ab3259dbc78ab86a8dd6d6a4a617c7e", "index": 5242, "step-1": "<mask token>\n\n\nclass Remedio(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Remedio(models.Model):\n <mask token>\n <mask t...
[ 1, 2, 3, 4, 5 ]
from django import forms from acl.models import Alert class CreateAlertForm(forms.ModelForm): class Meta: model = Alert exclude = ['role', 'age_analysis', 'Date_Uploaded', 'alias_name', 'CAMT_Reveiewer', 'Date_Regularised', 'alert_message', 'Count2']
normal
{ "blob_id": "bfcf6e241881c4f668f926e087ab0f7dcad61dee", "index": 5260, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass CreateAlertForm(forms.ModelForm):\n\n\n class Meta:\n model = Alert\n exclude = ['role', 'age_analysis', 'Date_Uploaded', 'alias_name',\n 'CAMT_Revei...
[ 0, 1, 2 ]
from functools import partial import utils.functions as fn import random as rd import numpy as np import time class NeuralNetwork: def __init__(self, input_size, hidden_size, output_size): self.input_size = input_size self.hidden_size = hidden_size self.output_size = output_size ...
normal
{ "blob_id": "f24516d8977b10b1ccece2f8eaec6e08ce0c2e16", "index": 9689, "step-1": "<mask token>\n\n\nclass NeuralNetwork:\n\n def __init__(self, input_size, hidden_size, output_size):\n self.input_size = input_size\n self.hidden_size = hidden_size\n self.output_size = output_size\n ...
[ 5, 6, 7, 8, 9 ]
aes_key = 'eR5ceExL4IpUUY2lqALN7gLXzo11jlXPOwTwFGwOO3h='
normal
{ "blob_id": "7112348631bc60767bfb79c7f6966fc9189c522b", "index": 7901, "step-1": "<mask token>\n", "step-2": "aes_key = 'eR5ceExL4IpUUY2lqALN7gLXzo11jlXPOwTwFGwOO3h='\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# ------------------------------------------------------------------------- # File: mb_trap.py # Created: Tue Feb 7 20:51:32 2006 # ------------------------------------------------------------------------- import random import mb_io import mb_subs from mb_go import GameObject class Trap(GameObject): """ ...
normal
{ "blob_id": "f2a94f6bfe86af439a8248b40732340c45d89b93", "index": 9925, "step-1": "<mask token>\n\n\nclass Trap(GameObject):\n <mask token>\n\n def __init__(self, gamedir, filename=None):\n self.attacks = list()\n self.x = 0\n self.y = 0\n self.radius = 0\n self.is_first_r...
[ 3, 4, 5, 6, 7 ]
from typing import Any, Sequence, Callable, Union, Optional import pandas as pd import numpy as np from .taglov import TagLoV def which_lov(series: pd.Series, patterns: Sequence[Sequence[Any]], method: Optional[Union[Callable, str]] = None, **kwargs) -> np.ndarray: """Whi...
normal
{ "blob_id": "7b9bf791d52fdc801e24d0c8541d77d91a488e12", "index": 3361, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef which_lov(series: pd.Series, patterns: Sequence[Sequence[Any]], method:\n Optional[Union[Callable, str]]=None, **kwargs) ->np.ndarray:\n \"\"\"Which list-of-values does ever...
[ 0, 1, 2, 3, 4 ]
import os from sql_interpreter.tables.csv_table import CsvTable from sql_interpreter.interpreter import SqlInterpreter from sql_interpreter.cli import Cli class InterpreterTest(): def setUp(self): self.interpreter = SqlInterpreter() self.cli = Cli(self.interpreter) filename = os....
normal
{ "blob_id": "b3ee76bc0d93135d0908044a2424dd927a390007", "index": 6357, "step-1": "<mask token>\n\n\nclass InterpreterTest:\n <mask token>\n\n def tearDown(self):\n self.interpreter.unload_all()\n <mask token>\n\n def test_select_2(self):\n sql = \"\"\"select\n e.id, last_name...
[ 4, 5, 8, 9, 10 ]
#!/usr/bin/python import socket import sys from ctypes import * import re if len(sys.argv) == 3: TCP_IP = sys.argv[1] TCP_PORT = int(sys.argv[2]) else: TCP_IP = "127.0.0.1" TCP_PORT = 5005 BUFFER_SIZE = 1024 MESSAGE = "Hello, World!\n" s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) print "Connecting to " ...
normal
{ "blob_id": "f570d7e723fd0bec8c51022912a7dab4795fad43", "index": 2049, "step-1": "#!/usr/bin/python\n\nimport socket\nimport sys\nfrom ctypes import *\nimport re\n\nif len(sys.argv) == 3:\n\tTCP_IP = sys.argv[1]\n\tTCP_PORT = int(sys.argv[2])\nelse:\n\tTCP_IP = \"127.0.0.1\"\n\tTCP_PORT = 5005\n\nBUFFER_SIZE = 1...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while person_win_count < 4 or person_lose_count < 4: player = input('가위, 바위, 보 중 어떤 것을 낼래요? ') if player != '가위' and player != '바위' and player != '보': player = input('다시 입력해 주세요.(예: 가위, 바위, 보)') computer = rand...
flexible
{ "blob_id": "93d4c6b6aef827d6746afc684c32a9cf1d0229e4", "index": 717, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile person_win_count < 4 or person_lose_count < 4:\n player = input('가위, 바위, 보 중 어떤 것을 낼래요? ')\n if player != '가위' and player != '바위' and player != '보':\n player = input('다시...
[ 0, 1, 2, 3, 4 ]
import unittest from utils import getParams from utils.httpUtil import HttpUtil from utils.logger import Log logger = Log(logger='cms_getMarket').get_log() class NavTest(unittest.TestCase): @classmethod def setUpClass(cls) ->None: cls.url = getParams.get_url('cms_getMarket', 'getMarket') Http...
normal
{ "blob_id": "b328ee0b6c5afaf496297cefe477f933af458a03", "index": 5654, "step-1": "<mask token>\n\n\nclass NavTest(unittest.TestCase):\n <mask token>\n\n @classmethod\n def tearDownClass(cls) ->None:\n pass\n\n def test01_getMarket(self):\n resp_c = getParams.get_resp_params('cms_getMark...
[ 3, 4, 5, 6 ]
<|reserved_special_token_0|> def defeating_cost(i, defeating): return (i + 1) * defeating[i] def defeating_cost_precompute(health): n = len(health) + 1 defeating = [(0) for x in range(n)] defeating[len(health)] = 0 for i in range(len(health) - 1, -1, -1): defeating[i] = defeating[i + 1] ...
flexible
{ "blob_id": "24ad62342fb9e7759be8561eaf0292736c7dcb6d", "index": 6756, "step-1": "<mask token>\n\n\ndef defeating_cost(i, defeating):\n return (i + 1) * defeating[i]\n\n\ndef defeating_cost_precompute(health):\n n = len(health) + 1\n defeating = [(0) for x in range(n)]\n defeating[len(health)] = 0\n ...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class TestRB(unittest.TestCase): <|reserved_special_token_0|> @staticmethod def choose_pattern(pattern_type, nq): """ Choose a valid field for rb_opts['rb_pattern'] :param pattern_type: a number between 0 and 2. 0 - a list ...
flexible
{ "blob_id": "995e42312e286d82fa101128795d8aa60c1a6548", "index": 4203, "step-1": "<mask token>\n\n\nclass TestRB(unittest.TestCase):\n <mask token>\n\n @staticmethod\n def choose_pattern(pattern_type, nq):\n \"\"\"\n Choose a valid field for rb_opts['rb_pattern']\n :param pattern_ty...
[ 6, 7, 8, 9, 10 ]
# Copyright 2021 TerminalWarlord under the terms of the MIT # license found at https://github.com/TerminalWarlord/Subtitle-Downloader-Bot/blob/master/LICENSE # Encoding = 'utf-8' # Fork and Deploy, do not modify this repo and claim it yours # For collaboration mail me at dev.jaybee@gmail.com from pyrogram impo...
normal
{ "blob_id": "ecbb64223b0d5aa478cf91e1fcafe45572eac1af", "index": 6197, "step-1": "<mask token>\n\n\n@app.on_message(filters.command('start'))\ndef start(client, message):\n kb = [[InlineKeyboardButton('🍿 Channel', url=\n 'https://telegram.me/MyTestBotZ'), InlineKeyboardButton(\n '🍿 BotsList', ...
[ 12, 13, 14, 15, 16 ]
<|reserved_special_token_0|> def task_correo(): """ envia correo """ correo() logger.info('se envio el correo') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @app.task def correo(): try: port = 587 smtp_server = 'smtp-mail.outlook...
flexible
{ "blob_id": "d0a6bfb729a150863303621a136ae80e96ae32d0", "index": 3250, "step-1": "<mask token>\n\n\ndef task_correo():\n \"\"\"\n envia correo\n \"\"\"\n correo()\n logger.info('se envio el correo')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\n@app.task\ndef correo():\n try:\n po...
[ 1, 2, 3, 4, 5 ]
""" pytest.mark.parametrize(“变量参数名称”,变量数据列表[‘123’,‘34’,‘567’,‘78’]) 上面的变量个数有4个,测试用例传入变量名称后,会依序4次使用变量的数据,执行4次测试用例 def test001(self,"变量参数名称") assert 变量名称 """
normal
{ "blob_id": "24f3284a7a994951a1f0a4ef64c951499bbba1b4", "index": 6958, "step-1": "<mask token>\n", "step-2": "\"\"\"\n pytest.mark.parametrize(“变量参数名称”,变量数据列表[‘123’,‘34’,‘567’,‘78’])\n 上面的变量个数有4个,测试用例传入变量名称后,会依序4次使用变量的数据,执行4次测试用例\n def test001(self,\"变量参数名称\")\n assert 变量名称\n\n\"\"\"", "step...
[ 0, 1 ]
''' @author: Victor Barrera Burgos Created on 09 Feb 2014 Description: This script permits the obtention of the methylation profile of a CpGRegion indicating the methylation status of each CpG dinucleotide. Addition on 02 March 2014 Description: permits the obtention of the methylation profile of the whole genome usi...
normal
{ "blob_id": "67509ce426fd572b22d5059d98e5439e87cdc591", "index": 4541, "step-1": "'''\n@author: Victor Barrera Burgos\nCreated on 09 Feb 2014\nDescription: This script permits the obtention of the\nmethylation profile of a CpGRegion indicating the \nmethylation status of each CpG dinucleotide.\n\nAddition on 02 ...
[ 0 ]
<|reserved_special_token_0|> class DevelopmentConfig(Config): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class ProductionConfig(Config): """Production Config that extends the Base Config Object""" DEBUG = False <|reserved_special_token_1|> <|reserve...
flexible
{ "blob_id": "833923c1928862e13c24904f5614927a683b168f", "index": 611, "step-1": "<mask token>\n\n\nclass DevelopmentConfig(Config):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass ProductionConfig(Config):\n \"\"\"Production Config that extends the Base Config Object\"\"\"\n DEBUG = False\...
[ 4, 6, 9, 11 ]
speak = 'speak' def hacker(): try: raise speak # go to hacker's except print 'not reached' except speak: print 'Hello world!' raise speak # go to primate's except def primate(): try: hacker() print 'not reached' except speak: ...
normal
{ "blob_id": "644d0a0d88f1a051e004d271359dcc3df855bd77", "index": 9020, "step-1": "speak = 'speak'\n\ndef hacker():\n try:\n raise speak # go to hacker's except \n print 'not reached'\n except speak:\n print 'Hello world!'\n raise speak # go to primate's...
[ 0 ]
def func(i): if(i % 2 != 0): return False visited = [0,0,0,0,0,0,0,0,0,0] temp = i while(i): x = i%10 if (visited[x] == 1) or (x == 0): break visited[x] = 1; i = (int)(i / 10); if(i == 0): for y in str(temp): if(temp % int(y) != 0): return False else: return False...
normal
{ "blob_id": "1a8c9be389aad37a36630a962c20a0a36c449bdd", "index": 3809, "step-1": "<mask token>\n", "step-2": "def func(i):\n if i % 2 != 0:\n return False\n visited = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n temp = i\n while i:\n x = i % 10\n if visited[x] == 1 or x == 0:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in json_list: with open(i) as f: obj = json.load(f) f.close() outfile = open(i, 'w') outfile.write(json.dumps(obj, indent=4, sort_keys=True)) outfile.close() <|reserved_special_token_1|> <|...
flexible
{ "blob_id": "f37d016dc49820239eb42198ca922e8681a2e0a6", "index": 6929, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in json_list:\n with open(i) as f:\n obj = json.load(f)\n f.close()\n outfile = open(i, 'w')\n outfile.write(json.dumps(obj, indent=4, sort_keys=True))\n o...
[ 0, 1, 2, 3, 4 ]
from django.db.models import Q from rest_framework.generics import get_object_or_404 from rest_framework.permissions import BasePermission from relations.models import Relation from .. import models class ConversationAccessPermission(BasePermission): message = 'You cant see others conversations!' def has_o...
normal
{ "blob_id": "56b5faf925d9a1bfaef348caeb35a7d3c323d57f", "index": 8450, "step-1": "<mask token>\n\n\nclass SendMessagePermission(BasePermission):\n <mask token>\n <mask token>\n\n\nclass MessageOwnerPermission(BasePermission):\n message = 'You cant modify your messages only!'\n\n def has_object_permis...
[ 4, 6, 8, 10, 11 ]
import os basedir = os.path.abspath(os.path.dirname(__file__)) from datetime import datetime class Config(object): # ... SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \ 'postgres' or 'sqlite:///' + os.path.join(basedir, 'app.db') SQLALCHEMY_TRACK_MODIFICATIONS = False MONGODB_DB...
normal
{ "blob_id": "118380f58cd173d2de5572a1591766e38ca4a7f8", "index": 8846, "step-1": "<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", "step-2": "<mask token>\n\n\nclass Config(object):\n SQLALCHEMY_DATABASE_U...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class TestaOrdenador: @pytest.fixture def ordenad(self): return ordenador.Ordenador() <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def test_selecao_bolha_melhorada_aleatoria(self, ordenad, list_aleatoria): ...
flexible
{ "blob_id": "32bb6d5ad0a1398c9ab89190c087fe3916631878", "index": 7750, "step-1": "<mask token>\n\n\nclass TestaOrdenador:\n\n @pytest.fixture\n def ordenad(self):\n return ordenador.Ordenador()\n <mask token>\n <mask token>\n <mask token>\n\n def test_selecao_bolha_melhorada_aleatoria(se...
[ 5, 6, 8, 9, 11 ]
<|reserved_special_token_0|> def preProcesar(request): id_archivo = request.GET.get('id_archivo') archivo = DataArchivoCargueProcesar.objects.filter(id=id_archivo).last() valores, columnas = iniPreviw(id_archivo, archivo. archivocargueprocesararchivo, archivo. archivocargueprocesararchivot...
flexible
{ "blob_id": "55cf99e3493c9c94955fc7e75ac428cbd88ac5cf", "index": 2453, "step-1": "<mask token>\n\n\ndef preProcesar(request):\n id_archivo = request.GET.get('id_archivo')\n archivo = DataArchivoCargueProcesar.objects.filter(id=id_archivo).last()\n valores, columnas = iniPreviw(id_archivo, archivo.\n ...
[ 8, 11, 12, 14, 15 ]
<|reserved_special_token_0|> class Role: <|reserved_special_token_0|> <|reserved_special_token_0|> class User(Role): """ 用户类 玩家 """ def __init__(self, id, role_id): self.id = id self.role_id = role_id <|reserved_special_token_1|> <|reserved_special_token_0|> class R...
flexible
{ "blob_id": "3b5141a86948df6632612f6c9d7fc0089acc60aa", "index": 5981, "step-1": "<mask token>\n\n\nclass Role:\n <mask token>\n <mask token>\n\n\nclass User(Role):\n \"\"\"\n 用户类\n 玩家\n \"\"\"\n\n def __init__(self, id, role_id):\n self.id = id\n self.role_id = role_id\n", "...
[ 4, 5, 6, 7, 8 ]
#!/usr/bin/env python #-*-coding:utf-8-*- #author:wuya import os import xlrd import json class Helper(object): '''公共方法''' def base_dir(self,filePath,folder='data'): ''' 返回公共路径 :parameter folder:文件夹 :parameter filePath:文件名称 ''' return os.path.join( os.path.dirn...
normal
{ "blob_id": "7c2349810fc757848eeb5bddef4640d87d5f9ab9", "index": 2439, "step-1": "<mask token>\n\n\nclass Helper(object):\n <mask token>\n\n def base_dir(self, filePath, folder='data'):\n \"\"\"\n 返回公共路径\n :parameter folder:文件夹\n :parameter filePath:文件名称\n \"\"\"\n return ...
[ 3, 4, 6, 7, 8 ]
#!/usr/bin/python import pymysql dbServerName = "127.0.0.1" dbUser = "root" dbPassword = "1448" dbName = "TestDataBase2" charSet = "utf8mb4" cusrorType = pymysql.cursors.DictCursor connectionObject = pymysql.connect(host=dbServerName, user=dbUser, password=dbPassword, ...
normal
{ "blob_id": "1c85ccaacfb47808e9e74f2a18bfe3b309891cf4", "index": 877, "step-1": "#!/usr/bin/python\nimport pymysql\n\n\ndbServerName = \"127.0.0.1\"\n\ndbUser = \"root\"\n\ndbPassword = \"1448\"\n\ndbName = \"TestDataBase2\"\n\ncharSet = \"utf8mb4\"\n\ncusrorType = pymysql....
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> m.drawcoastlines() m.fillcontinents(color='coral', lake_color='aqua') m.drawparallels(np.arange(-90.0, 91.0, 30.0)) m.drawmeridians(np.arange(-180.0, 181.0, 60.0)) m.drawmapboundary(fill_color='aqua') plt.title('Cylindrical Equal-...
flexible
{ "blob_id": "f5f9a1c7dcb7345e24f50db54649a1970fc37185", "index": 1262, "step-1": "<mask token>\n", "step-2": "<mask token>\nm.drawcoastlines()\nm.fillcontinents(color='coral', lake_color='aqua')\nm.drawparallels(np.arange(-90.0, 91.0, 30.0))\nm.drawmeridians(np.arange(-180.0, 181.0, 60.0))\nm.drawmapboundary(f...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def mysum(*c): print(sum([x for x in c])) <|reserved_special_token_0|> <|reserved_special_token_1|> def mysum(*c): print(sum([x for x in c])) mysum(1, 2, 3, 4, 11) <|reserved_special_token_1|> def mysum(*c): print(sum([x for x in c])) m...
flexible
{ "blob_id": "2c4fa92b28fa46a26f21ada8826474baac204e00", "index": 1234, "step-1": "<mask token>\n", "step-2": "def mysum(*c):\n print(sum([x for x in c]))\n\n\n<mask token>\n", "step-3": "def mysum(*c):\n print(sum([x for x in c]))\n\n\nmysum(1, 2, 3, 4, 11)\n", "step-4": "def mysum(*c):\n print(su...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def main(): global targets username, password = get_credentials('laozi') remote_host = Machine(username, password) for target in targets: remote_host.connect(target) stdin, stdout = remote_host.create_channel(target, input_file) slb.send_cmd(stdin, ...
flexible
{ "blob_id": "18bc8a8b1cbb544cfbe581e32ee5e509d67beafd", "index": 1410, "step-1": "<mask token>\n\n\ndef main():\n global targets\n username, password = get_credentials('laozi')\n remote_host = Machine(username, password)\n for target in targets:\n remote_host.connect(target)\n stdin, st...
[ 1, 2, 3, 4, 5 ]
import re APACHE_ACCESS_LOG_PATTERN = '^(\S+) (\S+) (\S+) \[([\w:/]+\s[+\-]\d{4})\] "(\S+) (\S+)\s*(\S*)" (\d{3}) (\S+)' pattern = re.compile(APACHE_ACCESS_LOG_PATTERN) print re.match('ix-sac6-20.ix.netcom.com - - [08/Aug/1995:14:43:39 -0400] "GET / HTTP/1.0 " 200 7131', 0)
normal
{ "blob_id": "0abba9fdd98d6bb5c706b82a01a267dbcefbba28", "index": 4562, "step-1": "import re\nAPACHE_ACCESS_LOG_PATTERN = '^(\\S+) (\\S+) (\\S+) \\[([\\w:/]+\\s[+\\-]\\d{4})\\] \"(\\S+) (\\S+)\\s*(\\S*)\" (\\d{3}) (\\S+)'\npattern = re.compile(APACHE_ACCESS_LOG_PATTERN)\nprint re.match('ix-sac6-20.ix.netcom.com -...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class BoldifyEncryptForm(FlaskForm): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class BoldifyEncryptForm(FlaskForm): boldMessage = StringF...
flexible
{ "blob_id": "77b43d7d9cd6b912bcee471c564b47d7a7cdd552", "index": 6227, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass BoldifyEncryptForm(FlaskForm):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass BoldifyEncryptForm(FlaskForm):\n boldMessage = StringField('Bolded...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def multiply(self, A: List[List[int]], B: List[List[int]]) ->List[List[int] ]: ...
flexible
{ "blob_id": "8425ee79fcb41799e5edbbab822f93dd40e39d8e", "index": 6481, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def multiply(self, A: List[List[int]], B: List[List[int]]) ->List[List[int]\n ]:\n ...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 from collections import OrderedDict import torch.nn as nn from fairseq.models import FairseqMultiModel, register_model from pytorch_translate import common_layers, utils @register_model("multilingual") class MultilingualModel(FairseqMultiModel): """ To use, you must extend this class ...
normal
{ "blob_id": "0ac471d2cb30a21c1246106ded14cdc4c06d2d40", "index": 8329, "step-1": "<mask token>\n\n\n@register_model('multilingual')\nclass MultilingualModel(FairseqMultiModel):\n <mask token>\n\n def __init__(self, task, encoders, decoders):\n super().__init__(encoders, decoders)\n self.task ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> aes_key = 'eR5ceExL4IpUUY2lqALN7gLXzo11jlXPOwTwFGwOO3h='
flexible
{ "blob_id": "7112348631bc60767bfb79c7f6966fc9189c522b", "index": 7901, "step-1": "<mask token>\n", "step-2": "aes_key = 'eR5ceExL4IpUUY2lqALN7gLXzo11jlXPOwTwFGwOO3h='\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
/home/salmane/anaconda3/lib/python3.7/_weakrefset.py
normal
{ "blob_id": "05d21a27097cf3295e9328aeafa466973a4d2611", "index": 5696, "step-1": "/home/salmane/anaconda3/lib/python3.7/_weakrefset.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
import praw import pickle import copy class histogram: def __init__(self, dictionary=None): self.frequencies = {} if dictionary is not None: self.frequencies = copy.deepcopy(dictionary) def get_sum(self): the_sum = 0 for e in self.frequencies: the_sum +=...
normal
{ "blob_id": "f135d52e4d5e49f96869c4209b84f30ff72f6780", "index": 876, "step-1": "import praw\nimport pickle\nimport copy\n\nclass histogram:\n def __init__(self, dictionary=None):\n self.frequencies = {}\n if dictionary is not None:\n self.frequencies = copy.deepcopy(dictionary)\n\n ...
[ 0 ]
import glob import os import xml.etree.ElementTree as ET file_dirs = ["train/","test/"] for file_dir in file_dirs: fdir = "custom_dataset/" + file_dir for directory in os.listdir(fdir): new_location = "/content/gdrive/My Drive/project/custom_dataset/" + file_dir + directory xml_file...
normal
{ "blob_id": "3a053c2c8a2b9123974183e65914dc0f73d2e078", "index": 6368, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor file_dir in file_dirs:\n fdir = 'custom_dataset/' + file_dir\n for directory in os.listdir(fdir):\n new_location = ('/content/gdrive/My Drive/project/custom_dataset/' +\n...
[ 0, 1, 2, 3, 4 ]
import requests from datetime import datetime, timedelta from . import base class YoutubeVerifier(base.SimpleVerifier): def __init__(self, channel_id, access_token): self.channel_id = channel_id self.access_token = access_token self.headers = { 'Authorization': 'Bearer {}'.fo...
normal
{ "blob_id": "7ba2377b7d4f8d127cfee63c856d20753da9b7c6", "index": 4526, "step-1": "<mask token>\n\n\nclass YoutubeVerifier(base.SimpleVerifier):\n <mask token>\n <mask token>\n\n def get_follower_info(self):\n \"\"\"\n Get follower information from youtube api subscriptions\n\n :rtyp...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class DisplayString(OctetString): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class DisplayString(OctetString): subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 255) <|reserved_special_t...
flexible
{ "blob_id": "b16e64edd0ff55a424ce3d4589321ee4576e930c", "index": 3965, "step-1": "<mask token>\n\n\nclass DisplayString(OctetString):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass DisplayString(OctetString):\n subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 255)\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> SECRET_KEY = ( 'django-insecure-usp0sg081f=9+_j95j@-k^sfp+9c*!qrwh-m17%=_9^xot#9fn') DATABASES = {'default': {'ENGINE': 'django.db.backends.postgresql', 'NAME': 'puka-test', 'USER': 'jeff', 'PASSWORD': '', 'HOST': '127.0.0...
flexible
{ "blob_id": "2432e2b4da8af284055e7edf6e0bd94b7b293f0b", "index": 8601, "step-1": "<mask token>\n", "step-2": "<mask token>\nSECRET_KEY = (\n 'django-insecure-usp0sg081f=9+_j95j@-k^sfp+9c*!qrwh-m17%=_9^xot#9fn')\nDATABASES = {'default': {'ENGINE': 'django.db.backends.postgresql', 'NAME':\n 'puka-test', 'U...
[ 0, 1, 2, 3 ]
from pyspark import SparkContext from pyspark.sql import SQLContext from pyspark.sql.types import * sc = SparkContext("local", "weblog app") effective_care = sc.textFile('file:///data/exercise1/effective_care').map(lambda l:l.encode().split(',')).map(lambda x: (x[0], x[1:])) procedure_care = effective_care.map(lambda ...
normal
{ "blob_id": "4c60fd123f591bf2a88ca0affe14a3c3ec0d3cf6", "index": 60, "step-1": "<mask token>\n\n\ndef range_func(measures):\n scores = []\n for entry in measures:\n try:\n curr = int(entry[1])\n except:\n curr = None\n if curr is not None:\n scores.appe...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class gSmart: <|reserved_special_token_0|> def getNextMove(self, b, n): gt = gameTree(b, n) return gt.miniMax() def getAllNextMoves(self, b): pcs = b.getPieces(b.turn) nextMoves = [] for p in pcs: for x in range(8): ...
flexible
{ "blob_id": "7998c4e0ed2bb683f029342554730464f8ac2a09", "index": 2366, "step-1": "<mask token>\n\n\nclass gSmart:\n <mask token>\n\n def getNextMove(self, b, n):\n gt = gameTree(b, n)\n return gt.miniMax()\n\n def getAllNextMoves(self, b):\n pcs = b.getPieces(b.turn)\n nextMo...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def game(screen, clock): running = True time = 0 WHITE = 255, 255, 255 BLUE = 0, 0, 205 upper_border = pygame.Rect(12, 44, 1000, 20) right_border = pygame.Rect(992, 60, 20, 648) left_border = pygame.R...
flexible
{ "blob_id": "83815acb0520c1f8186b0b5c69f8597b1b6a552a", "index": 8051, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef game(screen, clock):\n running = True\n time = 0\n WHITE = 255, 255, 255\n BLUE = 0, 0, 205\n upper_border = pygame.Rect(12, 44, 1000, 20)\n right_border = pygam...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- # @Time : 2021/5/12 2:48 下午 # @Author : shaoguowen # @Email : shaoguowen@tencent.com # @FileName: train.py # @Software: PyCharm import argparse from mmcv import Config import trainers # 解析传入的参数 parser = argparse.ArgumentParser(description='Train IVQA model') parser.add_argument('config',...
normal
{ "blob_id": "46e2955756cf1aea902f31685b258ffd14b2e62b", "index": 5291, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('config', help='train config file path')\n<mask token>\nif __name__ == '__main__':\n trainer = getattr(trainers, config.trainer.trainer_name)(config, args.\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def fibonacci(num): f_1 = 0 f_2 = 1 answer = 0 for i in range(num - 1): answer = f_1 + f_2 f_1 = f_2 f_2 = answer return answer <|reserved_special_token_0|> <|reserved_special_token_1|> def fibonacci(num): ...
flexible
{ "blob_id": "c3d0a9bdbfd5b6f2b960ee2c1f11ec4acf508310", "index": 8458, "step-1": "<mask token>\n", "step-2": "def fibonacci(num):\n f_1 = 0\n f_2 = 1\n answer = 0\n for i in range(num - 1):\n answer = f_1 + f_2\n f_1 = f_2\n f_2 = answer\n return answer\n\n\n<mask token>\n",...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def predict(input_text): URL = 'http://127.0.0.1:8000/api/v1/predict/' values = {'format': 'json', 'input_text': input_text} data = urllib.parse.urlencode({'input_text': input_text}).encode('utf-8') request = url...
flexible
{ "blob_id": "b7632cc7d8fc2f9096f7a6bb61c471dc61689f70", "index": 8342, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef predict(input_text):\n URL = 'http://127.0.0.1:8000/api/v1/predict/'\n values = {'format': 'json', 'input_text': input_text}\n data = urllib.parse.urlencode({'input_text'...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class SearchForm(Form): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class SearchForm(Form): criteria = StringField('Texto a buscar') <|reserved_special_token_1|> from wt...
flexible
{ "blob_id": "1896f4d5b304915d5cbbb30b0a83854c4a8cc60c", "index": 7566, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass SearchForm(Form):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass SearchForm(Form):\n criteria = StringField('Texto a buscar')\n", "step-4": "from wtforms import...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def MoveUp(): """It computes to the matrix upper side the adjacent elements with the same value and moves the other elements to the same side if there are empty cells when the up key is pressed.""" global movement for j in range(4): for i in range(3): ...
flexible
{ "blob_id": "ab69f4d6afb96d86381bcf507d7810980446c6ea", "index": 6407, "step-1": "<mask token>\n\n\ndef MoveUp():\n \"\"\"It computes to the matrix upper side the adjacent elements with the same\n value and moves the other elements to the same side if there are empty cells\n when the up key is pressed.\...
[ 3, 8, 10, 12, 13 ]
cadena = input("Introduzca su cadena: ") separador = input("Introduzca el separador: ") print(cadena.replace(" ", separador))
normal
{ "blob_id": "290b8b4c3aeafc84b1e9cce7e6d2a5e770bd8716", "index": 3444, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(cadena.replace(' ', separador))\n", "step-3": "cadena = input('Introduzca su cadena: ')\nseparador = input('Introduzca el separador: ')\nprint(cadena.replace(' ', separador))\n", ...
[ 0, 1, 2, 3 ]
# Generated by Django 3.1.7 on 2021-03-28 01:03 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('details', '0002_auto_20210310_1421'), ] operations = [ migrations.AlterModelOptions( name='detail', options={'get_latest_by'...
normal
{ "blob_id": "cdaceb2d8804e08f0b35b9b65f2d06695efad002", "index": 6470, "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 = [('details', '...
[ 0, 1, 2, 3, 4 ]
from tqdm import tqdm import fasttext import codecs import os import hashlib import time def make_save_folder(prefix="", add_suffix=True) -> str: """ 1. 現在時刻のハッシュをsuffixにした文字列の生成 2. 生成した文字列のフォルダが無かったら作る :param prefix:save folderの系統ラベル :param add_suffix: suffixを付与するかを選ぶフラグ, True: 付与, False: 付与しない ...
normal
{ "blob_id": "14e304f30364932910986f2dda48223b6d4b01c0", "index": 8372, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef make_save_folder(prefix='', add_suffix=True) ->str:\n \"\"\"\n 1. 現在時刻のハッシュをsuffixにした文字列の生成\n 2. 生成した文字列のフォルダが無かったら作る\n :param prefix:save folderの系統ラベル\n :param add...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class SNSQueueRoute(Route): def __init__(self, provider_queue, provider_options=None, *args, **kwargs): provider_options = provider_options or {} provider = SQSProvider(provider_queue, **provider_options) kwargs['provider'] = provider if 'message_trans...
flexible
{ "blob_id": "041f1d7c482fe4f65e8cc5a508da62ee6ccf59ff", "index": 6686, "step-1": "<mask token>\n\n\nclass SNSQueueRoute(Route):\n\n def __init__(self, provider_queue, provider_options=None, *args, **kwargs):\n provider_options = provider_options or {}\n provider = SQSProvider(provider_queue, **p...
[ 2, 3, 4, 5 ]
# 5. Write a program to implement polymorphism. class Honda: def __init__(self, name, color): self.name = name self.color = color def display(self): print("Honda car name is : ", self.name, " and color is : ", self.color) class Audi: def __init__(self, name, color): sel...
normal
{ "blob_id": "92f59612b2697db155da1bdc625fdabc115867b0", "index": 9600, "step-1": "class Honda:\n <mask token>\n <mask token>\n\n\nclass Audi:\n\n def __init__(self, name, color):\n self.name = name\n self.color = color\n\n def display(self):\n print('Audi car name is : ', self.na...
[ 4, 6, 7, 8, 9 ]
import unittest from display import Display class TestDisplay(unittest.TestCase): def setUp(self): self.display = Display(None) def test_set_pixels(self): self.display.clear_buffer() self.display.set_pixel(0, 1, 1) self.assertEqual(self.display.get_pixel(0, 1), 1, "pixel was n...
normal
{ "blob_id": "75d2dcbb0c131930602e3c1f2cf30c0e4c5e3c42", "index": 8262, "step-1": "<mask token>\n\n\nclass TestDisplay(unittest.TestCase):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TestDisplay(unittest.TestCase):\n\n def setUp(self):\n self.display = Display(None)\n ...
[ 1, 2, 3, 4, 5 ]
#Problem available at: https://www.hackerrank.com/challenges/weather-observation-station-6/problem SELECT DISTINCT CITY from STATION where substr(CITY,1,1) in ('a','e','i','o','u');
normal
{ "blob_id": "1cba7889370cc7de47bb5cd1eaeadfece056e68a", "index": 5912, "step-1": "#Problem available at: https://www.hackerrank.com/challenges/weather-observation-station-6/problem\nSELECT DISTINCT CITY from STATION where substr(CITY,1,1) in ('a','e','i','o','u');", "step-2": null, "step-3": null, "step-4"...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @win.event def on_draw(): glClear(GL_COLOR_BUFFER_BIT) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) glBegin(GL_TRIANGLES) glVertex3i(0, 0, 0) glVertex3i(300, 0, 0) glVertex3i(0, 300, 0) glEnd() pyglet....
flexible
{ "blob_id": "86c4193ec0fee8a0c06858913ec8153fcf0df6d9", "index": 4114, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@win.event\ndef on_draw():\n glClear(GL_COLOR_BUFFER_BIT)\n glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)\n glBegin(GL_TRIANGLES)\n glVertex3i(0, 0, 0)\n glVertex3i(300, 0,...
[ 0, 2, 3, 4, 5 ]
""" Crie um programa onde o usuario possa digitar sete valores numericos e cadastre-os em uma lisa unicaque mantenha separados os valores pares e impares. No final, mostre os valores ares e impares em ordem crescente """ n = [[],[]] for c in range(0,7): num = int(input(f'Digite o {c+1} valor: ')) res = num % ...
normal
{ "blob_id": "72bbbe78db746febc9a36a676e0fa2d97bf5e81e", "index": 8849, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor c in range(0, 7):\n num = int(input(f'Digite o {c + 1} valor: '))\n res = num % 2\n if res == 0:\n n[0].append(num)\n else:\n n[1].append(num)\nn[0].sort()\n...
[ 0, 1, 2, 3 ]
from flask import render_template, request, current_app from . import main from .. import db, cache from ..models import Content from ..utils import make_cache_key import requests @main.route('/') def index(): return render_template("templates/index.html") @main.route('/link') @cache.cached(key_prefix=make_cach...
normal
{ "blob_id": "c4096cfae7182875a79ba7837187cd94b4379922", "index": 1100, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@main.route('/link')\n@cache.cached(key_prefix=make_cache_key, timeout=60)\ndef get_link():\n url = request.args.get('url')\n params = {'video': True, 'audio': True, 'screenshot...
[ 0, 1, 2, 3, 4 ]
def is_prime(x): divisor = 2 while divisor <= x**(1/2.0): if x % divisor == 0: return False divisor += 1 return True for j in range(int(raw_input())): a, b = map(int, raw_input().split()) count = 0 if a == 2: a += 1 count += 1 elif...
normal
{ "blob_id": "e3a59a1ae65dd86ff2f5dcc15d4df9e8dc451990", "index": 8587, "step-1": "def is_prime(x):\r\n divisor = 2\r\n while divisor <= x**(1/2.0):\r\n if x % divisor == 0:\r\n return False\r\n divisor += 1\r\n return True\r\n\r\nfor j in range(int(raw_input())):\r\n a, b = m...
[ 0 ]
<|reserved_special_token_0|> class OrderForm(forms.Form): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class OrderForm(forms.Form): <|reserved_special_token_0|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "b32784bf398a58ba4b6e86fedcdc3ac9de0e8d51", "index": 3137, "step-1": "<mask token>\n\n\nclass OrderForm(forms.Form):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass OrderForm(forms.Form):\n <mask token>\n <mask token>\n\n def clean(self):\n ...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # Given an input with the following format # x y yerr # on standard input, print a fit of y = ax+b # to the data. import sys, string from math import sqrt def cP(X, Yerr): sum = 0 for i in range(len(X)): sum = sum + (X[i]*X[i])/(Yerr[i]*Yerr[i]) return sum def cQ(Y...
normal
{ "blob_id": "e78504971c51a98eed60ea8032502b6ce1a11f29", "index": 4206, "step-1": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Given an input with the following format\n# x y yerr\n# on standard input, print a fit of y = ax+b\n# to the data.\n\nimport sys, string\nfrom math import sqrt\n\ndef cP(X, Yerr):...
[ 0 ]
#!/usr/bin/env python3.4 # -*- coding: utf-8 -*- """ Das Pong-Spielfeld wird simuliert. Court moduliert ein anpassbares Spielfeld für Pong mit einem standardmäßigen Seitenverhältnis von 16:9. Jenes Spielfeld verfügt über einen Ball und zwei Schläger, jeweils links und rechts am Spielfeldrand, sowie einen Punktestand ...
normal
{ "blob_id": "5485a1210a0c0361dbb000546ee74df725fad913", "index": 5647, "step-1": "<mask token>\n\n\nclass court:\n <mask token>\n\n def __init__(self):\n \"\"\"\n Initialisiert ein court-Objekt.\n Hierzu zählen Spielfeld, Spieler sowie die Startposition des Balles.\n\n :return v...
[ 20, 21, 23, 26, 29 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def getGC(st): n = 0 for char in st: if char == 'C' or char == 'G': n += 1 return n <|reserved_special_token_0|> <|reserved_special_token_1|> def getGC(st): n = 0 for char in st: if char == 'C' or char == '...
flexible
{ "blob_id": "afe63f94c7107cf79e57f695df8543e0786a155f", "index": 6556, "step-1": "<mask token>\n", "step-2": "def getGC(st):\n n = 0\n for char in st:\n if char == 'C' or char == 'G':\n n += 1\n return n\n\n\n<mask token>\n", "step-3": "def getGC(st):\n n = 0\n for char in st...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def talk(text): engine.say('heyo' + text) engine.runAndWait() def take_command(): try: with sr.Microphone() as source: print('listening....') voice = listener.listen(source) command = listener.recognize_google(voice) co...
flexible
{ "blob_id": "f5d353694a719472320f4d6fa28bc9d2cc5a69b0", "index": 951, "step-1": "<mask token>\n\n\ndef talk(text):\n engine.say('heyo' + text)\n engine.runAndWait()\n\n\ndef take_command():\n try:\n with sr.Microphone() as source:\n print('listening....')\n voice = listener....
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def match_regexp(pattern, substring): if not pattern: return True if substring: if regexp_engine(pattern[0], substring[0]): return match_regexp(pattern[1:], substring[1:]) return False <|reserved_special_token_0|> <|reserved_special_token_1|> d...
flexible
{ "blob_id": "fbfc1749252cf8cbd9f8f72df268284d3e05d6dc", "index": 8024, "step-1": "<mask token>\n\n\ndef match_regexp(pattern, substring):\n if not pattern:\n return True\n if substring:\n if regexp_engine(pattern[0], substring[0]):\n return match_regexp(pattern[1:], substring[1:])\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def fraz(data): data_slownie = data[6:8] + '.' + data[4:6] + '.' + data[0:4] lista_stron = getListFromXML(data) site = pywikibot.Site('pl', 'wiktionary') outputPage = pywikibot.Page(site, 'Wikipedysta:Alk...
flexible
{ "blob_id": "2b928dad60bfb0ba863e9039a5462faa885644f3", "index": 4643, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fraz(data):\n data_slownie = data[6:8] + '.' + data[4:6] + '.' + data[0:4]\n lista_stron = getListFromXML(data)\n site = pywikibot.Site('pl', 'wiktionary')\n outputPag...
[ 0, 1, 2, 3 ]
import matplotlib.pyplot as plt import pandas as pd from collections import Counter import numpy as np import imdb import csv import networkx as nx from networkx import * def split_data(data): df = pd.read_csv(data) ranks = df.groupby('userId')['timestamp'].rank(method='first') counts = df['userId'].map(df....
normal
{ "blob_id": "e3b39c6655fc14efec3b3f95b08bc7b2c036cbdc", "index": 4117, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef split_data(data):\n df = pd.read_csv(data)\n ranks = df.groupby('userId')['timestamp'].rank(method='first')\n counts = df['userId'].map(df.groupby('userId')['timestamp']....
[ 0, 1, 2, 3, 4 ]
array=list(map(int,input().split(" "))) nums=list(set(array)) occ=[] for num in nums: count=array.count(num) occ.append((int(num),int(count))) ans=[] print(occ) occ.sort(key=lambda x: x[1],reverse=True) print(occ) for number,count in (occ): for i in range(count): ans.append(number) print (ans)
normal
{ "blob_id": "acbe4afee81cb6b9c0b8404d470c3f7f5685477c", "index": 1700, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor num in nums:\n count = array.count(num)\n occ.append((int(num), int(count)))\n<mask token>\nprint(occ)\nocc.sort(key=lambda x: x[1], reverse=True)\nprint(occ)\nfor number, count...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @given('I am logged in') def step_impl(context): assert context.oauth is not None, ERROR_AUTHORIZATION_FAILED assert context.oauth.access_token is not None, ERROR_AUTHORIZATION_FAILED @given('I am not logged in') def step_impl(context): context.oauth.access_token = None <|...
flexible
{ "blob_id": "ef0c9f740f1ca0906aeb7a5c5e5d35baca189310", "index": 6128, "step-1": "<mask token>\n\n\n@given('I am logged in')\ndef step_impl(context):\n assert context.oauth is not None, ERROR_AUTHORIZATION_FAILED\n assert context.oauth.access_token is not None, ERROR_AUTHORIZATION_FAILED\n\n\n@given('I am ...
[ 9, 10, 12, 15, 17 ]
<|reserved_special_token_0|> class StringAppend(StringNode): <|reserved_special_token_0|> Input('First', str) Input('Second', str) Input('Delimiter', str, optional=True, default='') Output('Joined', str) <|reserved_special_token_0|> class ListToString(StringNode): """ Creates a new n...
flexible
{ "blob_id": "1bb151171bbbb899456324056be3634e87b5c8fb", "index": 3494, "step-1": "<mask token>\n\n\nclass StringAppend(StringNode):\n <mask token>\n Input('First', str)\n Input('Second', str)\n Input('Delimiter', str, optional=True, default='')\n Output('Joined', str)\n <mask token>\n\n\nclass ...
[ 4, 5, 6, 8 ]