code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
import pandas as pd import matplotlib.pyplot as plt plt.rcParams['font.sans-serif'] = ['SimHei'] def get_ratings(file_path): # 图书的ISBN中可能包含字符,所以在使用pandas读取文件时,需要指定编码 ratings = pd.read_table(file_path, header=0, sep=';', encoding='ISO-8859-1') print('前5条数据:\n{}\n'.format(rating...
normal
{ "blob_id": "be5178f013e639d5179ed1af380dd7a63044bff2", "index": 5636, "step-1": "<mask token>\n\n\ndef get_ratings(file_path):\n ratings = pd.read_table(file_path, header=0, sep=';', encoding='ISO-8859-1'\n )\n print('前5条数据:\\n{}\\n'.format(ratings.head(5)))\n print('总的数据条数:\\n{}\\n'.format(rati...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def sumIntervals(input): interval = set() if len(input) > 0: for data in input: if len(data) == 2 and data[0] < data[1]: for i in range(data[0], data[1]): interval.add(i) else: ...
flexible
{ "blob_id": "25434fccff4401df2cebc9b0c4d0231f056b4e81", "index": 6346, "step-1": "<mask token>\n", "step-2": "def sumIntervals(input):\n interval = set()\n if len(input) > 0:\n for data in input:\n if len(data) == 2 and data[0] < data[1]:\n for i in range(data[0], data[1]...
[ 0, 1, 2 ]
import tensorflow as tf import random from tqdm import tqdm import spacy import ujson as json from collections import Counter import numpy as np import os.path nlp = spacy.blank("en") def word_tokenize(sent): doc = nlp(sent) return [token.text for token in doc] def convert_idx(text, tokens): current = ...
normal
{ "blob_id": "5cd9d4fe9889c4d53b50d86fa78ae84d0c242536", "index": 3693, "step-1": "<mask token>\n\n\ndef convert_idx(text, tokens):\n current = 0\n spans = []\n for token in tokens:\n current = text.find(token, current)\n if current < 0:\n print('Token {} cannot be found'.format(...
[ 5, 6, 7, 8, 10 ]
<|reserved_special_token_0|> def issCheck(): for i in column.keys(): for x in column[i]: if i == 'Date': issNow = x if issNow == timeNow: client.send_message('ISS is over London: ' + x, title='ISS' ) el...
flexible
{ "blob_id": "a573c6870392024ec2e84571ccb0bad3f5c4033a", "index": 4261, "step-1": "<mask token>\n\n\ndef issCheck():\n for i in column.keys():\n for x in column[i]:\n if i == 'Date':\n issNow = x\n if issNow == timeNow:\n client.send_message('I...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def group(arr): low, mid, high = 0, 0, len(arr) - 1 while mid <= high: print(arr) if arr[mid] == 'R': arr[low], arr[mid] = arr[mid], arr[low] low += 1 mid += 1 elif arr[mid] == 'G': ...
flexible
{ "blob_id": "8ad47bf292e0046550cc0ef6f6bb75cf179ebd4b", "index": 7477, "step-1": "<mask token>\n", "step-2": "def group(arr):\n low, mid, high = 0, 0, len(arr) - 1\n while mid <= high:\n print(arr)\n if arr[mid] == 'R':\n arr[low], arr[mid] = arr[mid], arr[low]\n low +...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def reverse_func(apps, schema_editor): """ No need to do anything since the table is...
flexible
{ "blob_id": "a4b61a5a79e314e56ba25c6e2e735bd2ee4ef0d3", "index": 4551, "step-1": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\ndef reverse_func(apps, schema_editor):\n \"\"\" No need to do anything since the t...
[ 1, 3, 4, 5, 6 ]
#+++++++++++++++++++exp.py++++++++++++++++++++ #!/usr/bin/python # -*- coding:utf-8 -*- #Author: Squarer #Time: 2020.11.15 20.20.51 #+++++++++++++++++++exp.py++++++++++++++++++++ from pwn import* #context.log_level = 'debug' context.arch = 'amd64' elf = ELF('./npuctf_2020_easyheap') libc = ...
normal
{ "blob_id": "eeedf4930a7fa58fd406a569db6281476c2e3e35", "index": 4870, "step-1": "<mask token>\n\n\ndef add(size, cont):\n sh.sendlineafter('Your choice :', '1')\n sh.sendlineafter('Size of Heap(0x10 or 0x20 only) : ', str(size))\n sh.sendlineafter('Content:', str(cont))\n\n\ndef edit(index, cont):\n ...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def dadata_clean(method, data): return dadata_proxy.dadata_clean(method, data) def get_detailed_address(address): from fw.utils.address_utils import get_detailed_address as _get_detailed_address return _get_detailed_address(address) def dadata_standardize_address(address):...
flexible
{ "blob_id": "af4d2380f92ea636594695e5ad4ba766d6874dd3", "index": 1355, "step-1": "<mask token>\n\n\ndef dadata_clean(method, data):\n return dadata_proxy.dadata_clean(method, data)\n\n\ndef get_detailed_address(address):\n from fw.utils.address_utils import get_detailed_address as _get_detailed_address\n ...
[ 9, 11, 12, 13, 14 ]
class Solution: def searchRange(self, nums: List[int], target: int) ->List[int]: res = [-1, -1] def binary_serach(left, right, target, res): if left >= right: return mid = (left + right) // 2 if nums[mid] == target: if res[0] == -...
normal
{ "blob_id": "18b82f83d3bf729eadb2bd5a766f731a2c54a93b", "index": 1607, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def searchRange(self, nums: List[int], target: int) ->List[int]:\n res = [-1, -1]\n\n def binary_serach(left, rig...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2016-12-29 03:38 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('django_otp', '0001_initial'), ] operations = [ migrations.AddField( ...
normal
{ "blob_id": "d45ca839a24093266c48e5f97164b160190b154d", "index": 2133, "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 = [('django_otp'...
[ 0, 1, 2, 3, 4 ]
import argparse import subprocess import os def get_files(dir_path, ext='.png'): relative_paths = os.listdir(dir_path) relative_paths = list(filter(lambda fp: ext in fp, relative_paths)) return list(map(lambda rel_p: os.path.join(dir_path, rel_p), relative_paths)) def ipfs_add_local(file_path): 'Ret...
normal
{ "blob_id": "7ca88d451ad702e5a8e532da3e3f5939cfaa7215", "index": 9571, "step-1": "<mask token>\n\n\ndef ipfs_add_local(file_path):\n \"\"\"Returns CID\"\"\"\n proc = subprocess.run(['ipfs', 'add', file_path], capture_output=True,\n text=True)\n stdout = proc.stdout\n try:\n return stdou...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class RMSprop(object): def __init__(self, n_in, n_hid, n_out, regularization_coe): self.nn = Feed_Forward(n_in, n_hid, n_out, regularization_coe) <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> ...
flexible
{ "blob_id": "f971302f39149bcdcbe4237cc71219572db600d4", "index": 8720, "step-1": "<mask token>\n\n\nclass RMSprop(object):\n\n def __init__(self, n_in, n_hid, n_out, regularization_coe):\n self.nn = Feed_Forward(n_in, n_hid, n_out, regularization_coe)\n <mask token>\n <mask token>\n <mask toke...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def bootstrap_p_value(bootstrap_stats, stat_value): """ Calculate the p-value for the statistic's value given the bootstrap values. """ return 1.0 - bisect.bisect_left(bootstrap_stats, stat_value) / float(len (bootstrap_stats)) <|reserved_special_token_1|> <|res...
flexible
{ "blob_id": "752affdfa1481b9a19a9b7dfe76f9d5d11c80073", "index": 4678, "step-1": "<mask token>\n\n\ndef bootstrap_p_value(bootstrap_stats, stat_value):\n \"\"\"\n Calculate the p-value for the statistic's value given the bootstrap values.\n \"\"\"\n return 1.0 - bisect.bisect_left(bootstrap_stats, st...
[ 1, 2, 3, 4, 5 ]
__author__ = 'Chitrang' from google.appengine.api import memcache from google.appengine.ext import db import logging import os import jinja2 class User(db.Model): id = db.StringProperty(required=True) created = db.DateTimeProperty(auto_now_add=True) updated = db.DateTimeProperty(auto_now=True) name =...
normal
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> i = 1 <|reserved_special_token_1|> # i change it for change1 # change 1.py in master i = 1 # fix bug for boss
flexible
{ "blob_id": "92f4f1c8a4e04b07ed7c05d5bb733c0b9c28bd05", "index": 5325, "step-1": "<mask token>\n", "step-2": "i = 1\n", "step-3": "# i change it for change1\n# change 1.py in master\ni = 1\n# fix bug for boss\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|> def print_json(obj): """json格式打印信息 Args: obj 待打印的对象信息 """ print(json.dumps(obj, ensure_ascii=False)) def print_error(err_code, err_msg): """格式化打印错误信息 Args: err_code: 错误码 err_ms...
flexible
{ "blob_id": "0b0eebd31d822ff5c1b951c3ee213f58a3a13aa0", "index": 134, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef print_json(obj):\n \"\"\"json格式打印信息\n\n Args:\n obj 待打印的对象信息\n \"\"\"\n print(json.dumps(obj, ensure_ascii=False))\n\n\ndef print_error(err_code, err_msg):\n ...
[ 0, 3, 4, 5, 6 ]
from pull_links import pull_links from scrape_lyrics import scrape_lyrics from vader_sentiment import getSentimentScores import sys import os import shutil # Get user input for artist -> capitalize it artist = sys.argv[1].title() pull_links(artist) # Dictionary w/ song name as key and lyrics as value lyrics = scrape_...
normal
{ "blob_id": "5055743c9ed8c92bcfab5379162f28315409ff91", "index": 2200, "step-1": "<mask token>\n", "step-2": "<mask token>\npull_links(artist)\n<mask token>\nos.remove('./links.json')\nshutil.rmtree('./songs')\n<mask token>\nfor song in sentimentScores:\n print(song + ': ')\n print(sentimentScores[song])...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import time import random import sys def sequential_search(my_list, search_elt): found = False start_time = time.time() for elt in my_list: if search_elt == elt: found = True break return (time.time() - start_time), found def ordered_sequential_...
normal
{ "blob_id": "f3a34d1c37165490c77ccd21f428718c8c90f866", "index": 4057, "step-1": "<mask token>\n\n\ndef sequential_search(my_list, search_elt):\n found = False\n start_time = time.time()\n for elt in my_list:\n if search_elt == elt:\n found = True\n break\n return time.ti...
[ 6, 7, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @click.command() @click.argument('command', nargs=1, required=True) @click.pass_obj def run(meg: Megalus, command: str) ->None: """Run selected script. :param meg: Megalus instance :param command: command/script to ...
flexible
{ "blob_id": "23a4ca8eec50e6ab72be3f1b1077c61f676b3cce", "index": 5777, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@click.command()\n@click.argument('command', nargs=1, required=True)\n@click.pass_obj\ndef run(meg: Megalus, command: str) ->None:\n \"\"\"Run selected script.\n\n :param meg: M...
[ 0, 1, 2, 3 ]
import os, copy from a import Moon, updateOneMoon, updateAllMoons file_path = os.path.dirname(os.path.realpath(__file__)) input_path = file_path + "/b.in.txt" inpt = open(input_path, 'r') moons = [] for line in inpt: new_moon = Moon(line) moons.append(new_moon) initial_moon_position = copy.deepcopy(moons)...
normal
{ "blob_id": "1f114b4716a44f5370495297511c305ecbb680c3", "index": 7556, "step-1": "import os, copy\nfrom a import Moon, updateOneMoon, updateAllMoons\n\nfile_path = os.path.dirname(os.path.realpath(__file__))\n\ninput_path = file_path + \"/b.in.txt\"\n\ninpt = open(input_path, 'r')\n\nmoons = []\n\nfor line in in...
[ 0 ]
from collections import Counter class Solution: def minDominoRotations(self, A: List[int], B: List[int]) ->int: if not A or not B: return 0 if len(A) != len(B): return -1 cnt_a, cnt_b = Counter(A), Counter(B) check_list = [] for num, freq in cnt_a.i...
normal
{ "blob_id": "069d85370d8358aa884b5195a1b52c0014efd161", "index": 7637, "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 minDominoRotations(self, A: List[int], B: List[int]) ->int:\n if not A or not B:...
[ 0, 1, 2, 3 ]
/usr/local/python-3.6/lib/python3.6/abc.py
normal
{ "blob_id": "32d830f00a9d33b8f7f438c14b522ef186001bf3", "index": 9392, "step-1": "/usr/local/python-3.6/lib/python3.6/abc.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
import kwic mystr = "hello world\nmy test\napples oranges" #asseirt(kwic0.kwic(mystr) == []) #assert(kwic1.kwic(mystr) == [mystr]) #assert(len(kwic3.kwic(mystr))==2) assert len(kwic.kwic(mystr)) == 3
normal
{ "blob_id": "1f21fdc9a198b31bb0d5bd6dd8f46a1b3b28ec94", "index": 6773, "step-1": "<mask token>\n", "step-2": "<mask token>\nassert len(kwic.kwic(mystr)) == 3\n", "step-3": "<mask token>\nmystr = \"\"\"hello world\nmy test\napples oranges\"\"\"\nassert len(kwic.kwic(mystr)) == 3\n", "step-4": "import kwic\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_reference(): json = sorted([os.path.join(args.ref, file) for file in os.listdir(args .ref) if file.endswith('.json')])[0] smap = simple_map.SimpleMap(json) return smap.northing, smap.easting <|reserved_special_token_0|> def main(): jsons = sorted([os.pa...
flexible
{ "blob_id": "a8c59f97501b3f9db30c98e334dbfcffffe7accd", "index": 6557, "step-1": "<mask token>\n\n\ndef get_reference():\n json = sorted([os.path.join(args.ref, file) for file in os.listdir(args\n .ref) if file.endswith('.json')])[0]\n smap = simple_map.SimpleMap(json)\n return smap.northing, sma...
[ 2, 3, 5, 6, 7 ]
# Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param root, a tree node # @return an integer sum = 0 def sumNumbers(self, root): def dfs(root,sofar): ...
normal
{ "blob_id": "e6ac742eb74d5d18e4c304a8ea1331e7e16e403d", "index": 2317, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n <mask token>\n", "step-3": "class Solution:\n <mask token>\n\n def sumNumbers(self, root):\n\n def dfs(root, sofar):\n if root.left is N...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def corec_unlock(lock): locks_fn = 'corec_locks.json' with open(locks_fn) as f: locks = json.load(f) locks[lock] = False with open(locks_fn, 'w') as f: json.dump(locks, f, indent=4) <|reserved_special_token_1|> <|reserved_special_token_0|> def corec_se...
flexible
{ "blob_id": "88b3dd7414a68de65bafb317fbd4da2b1bc933fc", "index": 991, "step-1": "<mask token>\n\n\ndef corec_unlock(lock):\n locks_fn = 'corec_locks.json'\n with open(locks_fn) as f:\n locks = json.load(f)\n locks[lock] = False\n with open(locks_fn, 'w') as f:\n json.dump(locks, f, inde...
[ 1, 3, 4, 5, 6 ]
# 30 - Faça um programa que receba três números e mostre - os em ordem crescentes. n1 = int(input("Digite o primeiro número: ")) n2 = int(input("Digite o segundo número: ")) n3 = int(input("Digite o terceiro número: ")) if n1 <= n2 and n2 <= n3: print(f'A ordem crescente é {n1}, {n2}, {n3}') elif n1 <= n3 and n3 ...
normal
{ "blob_id": "09712a397ad7915d9865b4aebf16606f85988f67", "index": 2737, "step-1": "<mask token>\n", "step-2": "<mask token>\nif n1 <= n2 and n2 <= n3:\n print(f'A ordem crescente é {n1}, {n2}, {n3}')\nelif n1 <= n3 and n3 <= n2:\n print(f'A ordem crescente é {n1}, {n3}, {n2}')\nelif n2 <= n1 and n1 <= n3:...
[ 0, 1, 2, 3 ]
print(1) print(2) print("Jenkins") print("Jenkins2") print("Jenkins3") print("Jenkins44") print("Jenkins55khlk") print("3333333") print("44444444") print("jhjhj")
normal
{ "blob_id": "77a82f99ab10e3d53e3f8466d43b67e8b87c1588", "index": 2418, "step-1": "<mask token>\n", "step-2": "print(1)\nprint(2)\nprint('Jenkins')\nprint('Jenkins2')\nprint('Jenkins3')\nprint('Jenkins44')\nprint('Jenkins55khlk')\nprint('3333333')\nprint('44444444')\nprint('jhjhj')\n", "step-3": "print(1)\npr...
[ 0, 1, 2 ]
from django.apps import AppConfig class ScambioConfig(AppConfig): name = 'scambio'
normal
{ "blob_id": "b091d00f5b5e997de87b36adbe9ce603a36ca49c", "index": 3347, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ScambioConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ScambioConfig(AppConfig):\n name = 'scambio'\n", "step-4": "from django.apps import App...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('sub.json', 'r') as subject_file: subjects = json.load(subject_file) print(json.dumps(subjects, separators=(',', ':'))) <|reserved_special_token_1|> <|reserved_special_token_0|> subjects = [] with open('sub.json',...
flexible
{ "blob_id": "98bd4eb25a76fb9184f9abfcb920a6fbe46b9394", "index": 631, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('sub.json', 'r') as subject_file:\n subjects = json.load(subject_file)\nprint(json.dumps(subjects, separators=(',', ':')))\n", "step-3": "<mask token>\nsubjects = []\nwith o...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Perimeter is ' + str(perimeter) + ', Area is ' + str(area)) <|reserved_special_token_1|> <|reserved_special_token_0|> x, y = 2.4, 6.4 perimeter = x * 2 + y * 2 area = x * y print('Perimeter is ' + str(perimeter) + ', Are...
flexible
{ "blob_id": "a7de079866d7ac80260b438043cf0403f598cebc", "index": 5091, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Perimeter is ' + str(perimeter) + ', Area is ' + str(area))\n", "step-3": "<mask token>\nx, y = 2.4, 6.4\nperimeter = x * 2 + y * 2\narea = x * y\nprint('Perimeter is ' + str(per...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class AngelBankAccount(BankAccount): <|reserved_special_token_0|> <|reserved_special_token_0|> class TroublemakerBankAccount(BankAccount): """ This bank account is designed for Troublemaker children. These children often find themselves in trouble. These are usually ...
flexible
{ "blob_id": "830ae4b6a6b2c4e1bbe6928b3a4b0be86d2ec7a3", "index": 3743, "step-1": "<mask token>\n\n\nclass AngelBankAccount(BankAccount):\n <mask token>\n <mask token>\n\n\nclass TroublemakerBankAccount(BankAccount):\n \"\"\"\n This bank account is designed for Troublemaker children. These\n childr...
[ 12, 17, 20, 25, 28 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def range(state): ran = state['tmp']['analysis']['range'] rang = {key: [state['rank'][i] for i in val & ran] for key, val in state['tmp']['analysis']['keys'].items() if val & ran} for item in state['tmp']['it...
flexible
{ "blob_id": "51868f26599c5878f8eb976d928c30d0bf61547d", "index": 9701, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef range(state):\n ran = state['tmp']['analysis']['range']\n rang = {key: [state['rank'][i] for i in val & ran] for key, val in\n state['tmp']['analysis']['keys'].items(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_by_id(id, lista): """ ia vanzarea cu id-ul dat dintr-o lista :param id: id-ul vanzarii - string :param lista: lista de vanzari :return: vanzarea cu id-ul dat sau None daca nu exista in lista """ for vanzare in lista: if get_id(vanzare) == id: ...
flexible
{ "blob_id": "498d07421d848332ad528ef3d3910d70312b5f55", "index": 2606, "step-1": "<mask token>\n\n\ndef get_by_id(id, lista):\n \"\"\"\n ia vanzarea cu id-ul dat dintr-o lista\n :param id: id-ul vanzarii - string\n :param lista: lista de vanzari\n :return: vanzarea cu id-ul dat sau None daca nu ex...
[ 4, 5, 6, 7, 8 ]
"""Initial migration Revision ID: 1f2296edbc75 Revises: 7417382a3f1 Create Date: 2014-01-19 23:04:58.877817 """ # revision identifiers, used by Alembic. revision = '1f2296edbc75' down_revision = '7417382a3f1' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql from sqlalchemy i...
normal
{ "blob_id": "7df55853d0f4f1bf56512c4427d7f91e9c1f2279", "index": 6524, "step-1": "<mask token>\n\n\ndef downgrade():\n op.drop_index('ix_ballot_measure_tags_ballot_measure_id',\n 'ballot_measure_tags')\n op.drop_index('ix_ballot_measure_tags_tag_id', 'ballot_measure_tags')\n op.drop_table(u'ballo...
[ 1, 2, 3, 4, 5 ]
from Tkinter import * import time def create_window(): window = Toplevel(root) w, h = root.winfo_screenwidth(), root.winfo_screenheight() canvas = Canvas(window,width=w,height=h) canvas.create_text(w/2,h/2,text="this will close after 3 seconds",font="Arial") canvas.pack() window.overrideredirec...
normal
{ "blob_id": "cac49a9a2cb753bb81c45ac1d2d887b1f48dd9bb", "index": 9562, "step-1": "<mask token>\n\n\ndef create_window():\n window = Toplevel(root)\n w, h = root.winfo_screenwidth(), root.winfo_screenheight()\n canvas = Canvas(window, width=w, height=h)\n canvas.create_text(w / 2, h / 2, text='this wi...
[ 1, 2, 3, 4, 5 ]
def func_sum_even(n): e_digit1=n%10 n//=10 e_digit2=n%10 e_digit3=n//10 sum_even=e_digit1*(1-e_digit1%2)+e_digit2*(1-e_digit2%2)+e_digit3*(1-e_digit3%2) return sum_even # n=int(input()) # print(func_sum_even(n))
normal
{ "blob_id": "d567dfe29380a34534308446a9c8940cede84083", "index": 7571, "step-1": "<mask token>\n", "step-2": "def func_sum_even(n):\n e_digit1 = n % 10\n n //= 10\n e_digit2 = n % 10\n e_digit3 = n // 10\n sum_even = e_digit1 * (1 - e_digit1 % 2) + e_digit2 * (1 - e_digit2 % 2\n ) + e_dig...
[ 0, 1, 2 ]
import boto3 import json region = 'us-east-2' ec2 = boto3.resource('ec2',region) ImageId = 'ami-07efac79022b86107' KeyName = 'aws_keypair' InstanceType = 't2.micro' #IamInstanceProfile = instances = ec2.create_instances( ImageId =ImageId, MinCount = 1, MaxCount = 5, KeyName = KeyName, InstanceTyp...
normal
{ "blob_id": "b7606befe123c4fb6840a1bc62e43e6721edfcc3", "index": 5005, "step-1": "<mask token>\n", "step-2": "<mask token>\nregion = 'us-east-2'\nec2 = boto3.resource('ec2', region)\nImageId = 'ami-07efac79022b86107'\nKeyName = 'aws_keypair'\nInstanceType = 't2.micro'\ninstances = ec2.create_instances(ImageId=...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def make_word(user_input): word = '' for letter in user_input: letter = letter.lower() if letter == 'c': word += random.choice(consonants) elif letter == 'v': word += random.choice(vowels) elif letter.isspace(): w...
flexible
{ "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 ]
print(1/2 * 2) # division ret
normal
{ "blob_id": "2c1e51f2c392e77299463d95a2277b3d2ca7c299", "index": 4336, "step-1": "<mask token>\n", "step-2": "print(1 / 2 * 2)\n", "step-3": "print(1/2 * 2) # division ret\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import pandas import evaluation import sys sys.path.append('D:\\libs\\xgboost\\wrapper') import xgboost as xgb # Read training data folder = '../data/' train = pandas.read_csv(folder + 'training.csv', index_col='id') # Define features to drop from train data # variables_to_drop = ['mass', 'production', 'min_ANNmuon'...
normal
{ "blob_id": "a6365104125725f11010c35eb0781c941de803f8", "index": 7172, "step-1": "import pandas\nimport evaluation\nimport sys\n\nsys.path.append('D:\\\\libs\\\\xgboost\\\\wrapper')\nimport xgboost as xgb\n\n# Read training data\nfolder = '../data/'\ntrain = pandas.read_csv(folder + 'training.csv', index_col='id...
[ 0 ]
# -*- coding:utf-8 -*- ''' @author:oldwai ''' # email: frankandrew@163.com def multipliers(): return lab1(x) def lab1(x): list1 = [] for i in range(4): sum = x*i list1.append(sum) return list1 #print ([m(2) for m in multipliers()]) def func1(x): list2 = [] ...
normal
{ "blob_id": "807e19f09f4a46b6c39457b8916714e2c54c3e8d", "index": 5802, "step-1": "<mask token>\n\n\ndef lab1(x):\n list1 = []\n for i in range(4):\n sum = x * i\n list1.append(sum)\n return list1\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef lab1(x):\n list1 = []\n for i i...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @app.route('/') def hello_world(): return 'Hello Waeweorld!' <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if not os.path.exists(dbDir): db.create_all() @app.route('/') def hello_world(): return 'Hello Waeweorld!' if __name__ =...
flexible
{ "blob_id": "71cee06ce697030fd0cea363ddecaa411b39544d", "index": 4330, "step-1": "<mask token>\n\n\n@app.route('/')\ndef hello_world():\n return 'Hello Waeweorld!'\n\n\n<mask token>\n", "step-2": "<mask token>\nif not os.path.exists(dbDir):\n db.create_all()\n\n\n@app.route('/')\ndef hello_world():\n ...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/python import operator import cgi, sys, LINK_HEADERS import simplejson as json from datetime import datetime from dateutil import tz from decimal import * sys.path.insert(0, str(LINK_HEADERS.DAO_LINK)) from transaction_dao import Transaction_dao from user_portfolio_dao import User_portfolio_dao from user_st...
normal
{ "blob_id": "4264cba9a6c39219d21bd21d4b21009bacd1db38", "index": 61, "step-1": "#!/usr/bin/python\n\nimport operator\nimport cgi, sys, LINK_HEADERS\nimport simplejson as json\nfrom datetime import datetime\nfrom dateutil import tz\nfrom decimal import *\nsys.path.insert(0, str(LINK_HEADERS.DAO_LINK))\nfrom trans...
[ 0 ]
<|reserved_special_token_0|> @app.route('/guess/<name>') def guesser(name): person = Person(name=name) return render_template('guess.html', name=person.name, gender=person. gender, age=person.age, country=person.country) <|reserved_special_token_0|> @app.route('/post/<int:id>') def blog_post(id): ...
flexible
{ "blob_id": "895ece0b8d45cd64e43f8ddc54824f7647254185", "index": 2547, "step-1": "<mask token>\n\n\n@app.route('/guess/<name>')\ndef guesser(name):\n person = Person(name=name)\n return render_template('guess.html', name=person.name, gender=person.\n gender, age=person.age, country=person.country)\n...
[ 2, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class xmlSp: def addNode(self, parentNode, childNode): parentNode.append(childNode) def createChildNode(self, key, value, propertyMap={}): element = Element(key, propertyMap) element.text = value return element <|reserved_special_token_0|> ...
flexible
{ "blob_id": "0470f98247f8f835c0c052b01ddd7f1f7a515ab5", "index": 5509, "step-1": "<mask token>\n\n\nclass xmlSp:\n\n def addNode(self, parentNode, childNode):\n parentNode.append(childNode)\n\n def createChildNode(self, key, value, propertyMap={}):\n element = Element(key, propertyMap)\n ...
[ 12, 13, 15, 16, 18 ]
<|reserved_special_token_0|> class FloatVector3InputWidget(InputWidgetRaw, FloatVector3InputWidget_ui. Ui_Form): <|reserved_special_token_0|> def __init__(self, **kwds): super(FloatVector3InputWidget, self).__init__(**kwds) self.setupUi(self) self._configSpinBoxes() self.d...
flexible
{ "blob_id": "023dc23a5e649c2fbbb45ff577dffa3b5d2aac64", "index": 7904, "step-1": "<mask token>\n\n\nclass FloatVector3InputWidget(InputWidgetRaw, FloatVector3InputWidget_ui.\n Ui_Form):\n <mask token>\n\n def __init__(self, **kwds):\n super(FloatVector3InputWidget, self).__init__(**kwds)\n ...
[ 59, 60, 62, 81, 103 ]
from dataframe import * from chaid import SuperCHAID, SuperCHAIDVisualizer supernode_features = [manufacturing_region] features_list = [customer_region, product_family, make_vs_buy] dependant_variable = gm super_tree = SuperCHAID(supernode_features, features_list, dependant_variable) super_tree.fit(df) visualizer = ...
normal
{ "blob_id": "0a42c54ef1412b7f3b8e95da1d65ee05dfa14089", "index": 9709, "step-1": "<mask token>\n", "step-2": "<mask token>\nsuper_tree.fit(df)\n<mask token>\nvisualizer.export('tree')\n<mask token>\nprint(input_row[supernode_features + features_list])\nprint()\n<mask token>\nif result is not None:\n segment...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def xor_encryption(source, destination, key): """ Returns text encrypted or decrypted with xor Keyword arguments: source - path to file with text to be encrypted destination - path to the file where you want to save the result key - encryption key """ text...
flexible
{ "blob_id": "81774d3b4d9fbf22ed19e1cba7ec5e8e3707f51a", "index": 2076, "step-1": "<mask token>\n\n\ndef xor_encryption(source, destination, key):\n \"\"\"\n Returns text encrypted or decrypted with xor\n\n Keyword arguments:\n source - path to file with text to be encrypted\n destination - path to...
[ 1, 2, 3, 4, 5 ]
salario = float(input('Qual o valor do seu Salario atual? R$ ')) novo = salario + (salario * 15 / 100) print('Um funcioario que ganhava R$ {:.2f} com o aumento de 15% passa a ganhar R$ {:.2f}'.format(salario, novo))
normal
{ "blob_id": "ffcd3c0086ff73eb722d867b335df23382615d20", "index": 1657, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\n 'Um funcioario que ganhava R$ {:.2f} com o aumento de 15% passa a ganhar R$ {:.2f}'\n .format(salario, novo))\n", "step-3": "salario = float(input('Qual o valor do seu Sa...
[ 0, 1, 2, 3 ]
def find_happy_number(num): slow, fast = num, num while True: slow = find_square_sum(slow) # move one step fast = find_square_sum(find_square_sum(fast)) # move two steps if slow == fast: # found the cycle break return slow == 1 # see if the cycle is stuck on the number '1' def find_square_...
normal
{ "blob_id": "60b5e515c7275bfa0f79e22f54302a578c2f7b79", "index": 728, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef find_square_sum(num):\n _sum = 0\n while num > 0:\n digit = num % 10\n _sum += digit * digit\n num //= 10\n return _sum\n\n\n<mask token>\n", "step-...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestTimeDehydration(_TestTemporalDehydrationV1): @pytest.fixture def hydration_handler(self): return HydrationHandler() <|reserved_special_token_0|> <|reserved_special_token_0|> def test_pandas_date_time_fixed_offset(self, assert_transforms): dt...
flexible
{ "blob_id": "5b33615e1890631bac68801310e4b606ac41cb13", "index": 1340, "step-1": "<mask token>\n\n\nclass TestTimeDehydration(_TestTemporalDehydrationV1):\n\n @pytest.fixture\n def hydration_handler(self):\n return HydrationHandler()\n <mask token>\n <mask token>\n\n def test_pandas_date_ti...
[ 6, 7, 8, 11, 13 ]
# Generated by Django 2.1.3 on 2019-01-02 12:08 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('leasing', '0037_make_lease_basis_of_rent_archivable'), ] operations = [ migrations.AddField( model_name='invoicepayment', ...
normal
{ "blob_id": "8cd290dc1e682222c97172a0f23e5b93c54838a7", "index": 2201, "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 = [('leasing', '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class V2SLClient: <|reserved_special_token_0|> <|reserved_special_token_0|> def handshake(self): encrypted_key = LOCO_PUBLICKEY.encrypt(self._aeskey, padding.OAEP( padding.MGF1(hashes.SHA1()), hashes.SHA1(), None)) handshake_pkt = struct.pack('<III...
flexible
{ "blob_id": "db9919ab15988828d24b4430a124841f225860cc", "index": 5764, "step-1": "<mask token>\n\n\nclass V2SLClient:\n <mask token>\n <mask token>\n\n def handshake(self):\n encrypted_key = LOCO_PUBLICKEY.encrypt(self._aeskey, padding.OAEP(\n padding.MGF1(hashes.SHA1()), hashes.SHA1()...
[ 4, 5, 6, 8, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from ._sinAction import * from ._sinActionFeedback import * from ._sinActionGoal import * from ._sinActionResult import * from ._sinFeedback import * from ._sinGoal import * from ._sinResult import *
flexible
{ "blob_id": "c6b261a09b2982e17704f847586bbf38d27cb786", "index": 353, "step-1": "<mask token>\n", "step-2": "from ._sinAction import *\nfrom ._sinActionFeedback import *\nfrom ._sinActionGoal import *\nfrom ._sinActionResult import *\nfrom ._sinFeedback import *\nfrom ._sinGoal import *\nfrom ._sinResult impor...
[ 0, 1 ]
G = 1000000000 M = 1000000 K = 1000
normal
{ "blob_id": "f765f54a89a98a5f61c70a37379860f170444c0a", "index": 4069, "step-1": "<mask token>\n", "step-2": "G = 1000000000\nM = 1000000\nK = 1000\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> class TestWktEmpty: def __init__(self, inString, expectedOutString): self.inString = inString self.expectedOutString = expectedOutString def isEmpty(self, geom): try: ogr.Geometry.IsEmpty except: return 'skip' if ge...
flexible
{ "blob_id": "1ef1dcc8fdf4d813dad70c860e33778715d51b0c", "index": 1575, "step-1": "<mask token>\n\n\nclass TestWktEmpty:\n\n def __init__(self, inString, expectedOutString):\n self.inString = inString\n self.expectedOutString = expectedOutString\n\n def isEmpty(self, geom):\n try:\n ...
[ 5, 6, 7, 8, 9 ]
from django.urls import path from .views.home import Home from .views.signup import Signup from .views.login import Login urlpatterns = [ path('', Home.as_view(), name='home'), path('signup', Signup.as_view(), name='signup'), path('login', Login.as_view(), name='login'), ]
normal
{ "blob_id": "979a387e29867818ffad7291511ff0be40dee118", "index": 1938, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', Home.as_view(), name='home'), path('signup', Signup\n .as_view(), name='signup'), path('login', Login.as_view(), name='login')]\n", "step-3": "from django.url...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> __author__ = 'Xomak' add_requests = Blueprint('addrequests', __name__, template_folder='templates') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> from flask import Blueprint __author__ =...
flexible
{ "blob_id": "d39965c3070ec25230b4d6977ff949b3db070ab6", "index": 7399, "step-1": "<mask token>\n", "step-2": "<mask token>\n__author__ = 'Xomak'\nadd_requests = Blueprint('addrequests', __name__, template_folder='templates')\n<mask token>\n", "step-3": "<mask token>\nfrom flask import Blueprint\n__author__ =...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if ano1 == 0 and ano2 != 0: print('\nO ano de {} é Bissexto !!'.format(ano)) else: print('\nO ano de {} não foi Bissexto !!'.format(ano)) <|reserved_special_token_1|> ano = int(input('\nInforme o ano: ')) ano1 = ano % 4...
flexible
{ "blob_id": "daeb11000978d14a05ea62113dcf6e30d6a98b15", "index": 3590, "step-1": "<mask token>\n", "step-2": "<mask token>\nif ano1 == 0 and ano2 != 0:\n print('\\nO ano de {} é Bissexto !!'.format(ano))\nelse:\n print('\\nO ano de {} não foi Bissexto !!'.format(ano))\n", "step-3": "ano = int(input('\\...
[ 0, 1, 2, 3 ]
from celery.task.schedules import crontab from celery.decorators import periodic_task from celery.utils.log import get_task_logger from bbapp.scripts.getScores import doScoresScrape, fixScores logger = get_task_logger(__name__) @periodic_task( run_every=(crontab(minute='*/10')), name="scrape_espn_feed", ...
normal
{ "blob_id": "a9a067ee3b176d2f2ca558b69ce2bc598bb31d22", "index": 4501, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@periodic_task(run_every=crontab(minute='*/10'), name='scrape_espn_feed',\n ignore_result=True)\ndef scrape_espn_feed():\n \"\"\"\n Saves latest image from Flickr\n \"\"\"...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def split_data(data): df = pd.read_csv(data) ranks = df.groupby('userId')['timestamp'].rank(method='first') counts = df['userId'].map(df.groupby('userId')['timestamp'].apply(len)) df['new_col'] = ranks / counts >...
flexible
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> #!/usr/bin/env python #_*_ coding:utf-8 _*_ ''' @author: tanglei @contact: tanglei_0315@163.com @file: index.py @time: 2017/11/1 16:26 ''' #需求: #1.每个客户端需要监控的服务不同 #2.每个服务的监控间隔不同 #3.允许模板的形式批量修改监控指标 #4.不同设备的监控阀值不同 #5.可自定义最近n分钟内hit\max\avg\last\... 指标超过阀值 #6.报警策略...
flexible
{ "blob_id": "886101e5d86daf6c2ac0fe92b361ccca6132b1aa", "index": 3030, "step-1": "<mask token>\n", "step-2": "#!/usr/bin/env python\n#_*_ coding:utf-8 _*_\n'''\n@author: tanglei\n@contact: tanglei_0315@163.com\n@file: index.py\n@time: 2017/11/1 16:26\n'''\n#需求:\n#1.每个客户端需要监控的服务不同\n#2.每个服务的监控间隔不同\n#3.允许模板的形式批量修...
[ 0, 1 ]
import socket from Server.MachineClient.Identification import Identification from Server.SQL import DataBase import threading import time from Server.Connection.AcceptClients import Accept from Server.Connection.ConnectionCheck import ConnectionCheck from Server.Clients_Data import Clients class MachineClient: de...
normal
{ "blob_id": "ff1bb2634ffec6181a42c80a4b2a19c2c27a8f9f", "index": 3136, "step-1": "<mask token>\n\n\nclass MachineClient:\n\n def __init__(self, host, port):\n self.host = host\n self.port = port\n self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n self.db = DataBase(\n ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in sys.stdin: lower = 0 upper = 0 for x in range(0, len(line)): if 'a' <= line[x] <= 'z': lower = lower + 1 elif 'A' <= line[x] <= 'Z': upper = upper + 1 if lower ==...
flexible
{ "blob_id": "4b3664153940b064b424bd77de473a6409437f88", "index": 3279, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in sys.stdin:\n lower = 0\n upper = 0\n for x in range(0, len(line)):\n if 'a' <= line[x] <= 'z':\n lower = lower + 1\n elif 'A' <= line[x] <= '...
[ 0, 1, 2, 3 ]
from flask import Flask, jsonify, make_response, request app = Flask(__name__) VERSION = (0, 1, 0) VERSION_STRING = "{}.{}.{}".format(*VERSION) LANG_ID = "lang.natural.english" @app.errorhandler(404) def not_found(error): return make_response(jsonify({'error': 'Not found'}), 404) @app.route("/") def entry()...
normal
{ "blob_id": "49e1dc98ecc2e5c12c6e520721a6c0a7c2665cca", "index": 3450, "step-1": "<mask token>\n\n\n@app.errorhandler(404)\ndef not_found(error):\n return make_response(jsonify({'error': 'Not found'}), 404)\n\n\n<mask token>\n\n\n@app.route('/api/{}/reason/apply'.format(VERSION_STRING), methods=['GET',\n '...
[ 4, 5, 9, 10, 11 ]
import os from pathlib import Path import shutil from ament_index_python.packages import get_package_share_directory, get_package_prefix import launch import launch_ros.actions def generate_launch_description(): cart_sdf = os.path.join(get_package_share_directory('crs_support'), 'sdf', 'cart.sdf') car...
normal
{ "blob_id": "cc74163d5dbcc2b2ca0fe5222692f6f5e45f73fe", "index": 2377, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef generate_launch_description():\n cart_sdf = os.path.join(get_package_share_directory('crs_support'),\n 'sdf', 'cart.sdf')\n cart_spawner = launch_ros.actions.Node(nod...
[ 0, 1, 2 ]
<|reserved_special_token_0|> @login_required def get_verification_code(request): """Maybe ajaxify this in the future """ if request.user.get_profile().is_verified: messages.info(request, 'Olet jo vahvistanut osoitteesi') else: verification_code = request.user.get_profile().gen_verifica...
flexible
{ "blob_id": "22da05d9bf6139a0306bfb2d1df96e9e2cf6a0c6", "index": 475, "step-1": "<mask token>\n\n\n@login_required\ndef get_verification_code(request):\n \"\"\"Maybe ajaxify this in the future\n \"\"\"\n if request.user.get_profile().is_verified:\n messages.info(request, 'Olet jo vahvistanut osoi...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class TestColGroup(unittest.TestCase): <|reserved_special_token_0|> def test_col(self): return data = [['a', 'b', 'c'], [1, 2, 3], [4, 5, 6]] gen = Table({'data': data, 'colgroup': {'span': 3, 'width': 100}, 'attr_sort': 1}) self.assert...
flexible
{ "blob_id": "24f87bd6aab0ff65cf2153e27df31122818ad0ac", "index": 766, "step-1": "<mask token>\n\n\nclass TestColGroup(unittest.TestCase):\n <mask token>\n\n def test_col(self):\n return\n data = [['a', 'b', 'c'], [1, 2, 3], [4, 5, 6]]\n gen = Table({'data': data, 'colgroup': {'span': 3...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- import threading import time def work(): i = 0 while i < 10: print 'I am working..' time.sleep(0.5) i += 1 t = threading.Thread(target=work) # Daemon 설정 #t.setDaemon(True) t.daemon = True # 혹인 이렇게도 가능 t.start() print 'main thread finished'
normal
{ "blob_id": "f77df47fdb72ba50331b8b5d65984efaec474057", "index": 4049, "step-1": "# -*- coding: utf-8 -*-\n\nimport threading\nimport time\n\ndef work():\n i = 0\n while i < 10:\n print 'I am working..'\n time.sleep(0.5)\n i += 1\n\nt = threading.Thread(target=work)\n# Daemon 설정\n#t.se...
[ 0 ]
<|reserved_special_token_0|> class SimpleSwitch(app_manager.RyuApp): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> print('PACKET_OUT...') <|reserved_special_token_1|> <|reserved_special_token_0|> class SimpleSwitch(app_manager.RyuApp): def __init__(se...
flexible
{ "blob_id": "86d032a3cd67118eb46073c996f1c9a391f8dfe0", "index": 1608, "step-1": "<mask token>\n\n\nclass SimpleSwitch(app_manager.RyuApp):\n <mask token>\n <mask token>\n <mask token>\n print('PACKET_OUT...')\n", "step-2": "<mask token>\n\n\nclass SimpleSwitch(app_manager.RyuApp):\n\n def __ini...
[ 1, 3, 4, 5, 6 ]
from typing import Set, Dict, Tuple from flask import Flask, render_template, request app = Flask(__name__) app.config['SECRET_KEY'] = 'top_secret' # Определение константных величин RULE: Dict[Tuple[str, str], str] = {('H', 'a'): 'S', ('H', 'b'): 'SE', ...
normal
{ "blob_id": "86ea1c46383b5a8790eb187163107f4100395ef3", "index": 8962, "step-1": "<mask token>\n\n\ndef finite_automate(word: str) ->str:\n \"\"\"Реализация конечного автомата для проверки символьных строк\"\"\"\n state: str = INITIAL_STATE\n for ind, char in enumerate(word):\n yield f'{word[ind:...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(df.head()) print() <|reserved_special_token_0|> print(df.head()) print('------------------') <|reserved_special_token_0|> print(df.head()) print('------------------') df.set_index('Date_m', inplace=True) print(df.head()) <...
flexible
{ "blob_id": "d89e1d653c6db322feb6edba93cbfc622bf47aa2", "index": 2781, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(df.head())\nprint()\n<mask token>\nprint(df.head())\nprint('------------------')\n<mask token>\nprint(df.head())\nprint('------------------')\ndf.set_index('Date_m', inplace=True)\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> train_maskRcnn.modelConfig(network_backbone='resnet101', num_classes=3, batch_size=1) train_maskRcnn.load_pretrained_model('c:/models/mask_rcnn_coco.h5') train_maskRcnn.load_dataset('Object-Detection/Pixellib/customModel') tra...
flexible
{ "blob_id": "cb4ca5f91c7cd47197784085258536166055afe9", "index": 4212, "step-1": "<mask token>\n", "step-2": "<mask token>\ntrain_maskRcnn.modelConfig(network_backbone='resnet101', num_classes=3,\n batch_size=1)\ntrain_maskRcnn.load_pretrained_model('c:/models/mask_rcnn_coco.h5')\ntrain_maskRcnn.load_datase...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('Hello!') <|reserved_special_token_1|> #write a program that displays the wor "Hello!" print("Hello!")
flexible
{ "blob_id": "b7a7941b3555b30ac7e743a5457df76f9eb7cb15", "index": 9714, "step-1": "<mask token>\n", "step-2": "print('Hello!')\n", "step-3": "#write a program that displays the wor \"Hello!\"\n\nprint(\"Hello!\")\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
from odoo import api, tools, fields, models, _ import base64 from odoo import modules class InheritUser(models.Model): _inherit = 'pos.config' related_pos_user = fields.One2many('pos.session.users', 'pos_config', string='Related User') class InheritSession(models.Model): _name = 'pos.session.users' ...
normal
{ "blob_id": "2cff5fdfc86793592dd97de90ba9c3a11870b356", "index": 8987, "step-1": "<mask token>\n\n\nclass InheritUser(models.Model):\n _inherit = 'res.users'\n pos_sessions = fields.Many2many('pos.config', string=\n 'Point of Sale Accessible')\n\n @api.multi\n def write(self, vals):\n i...
[ 4, 6, 7, 8, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def orca_run(method, basis, optfreq, custombasis, correlated, values, charge, multip, sym, R_coord): """ Runs orca Parameters: method (char) : Name of functional to be used ...
flexible
{ "blob_id": "019e8d7159fe07adc245e6476ac1fed5e9c457b5", "index": 3035, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef orca_run(method, basis, optfreq, custombasis, correlated, values,\n charge, multip, sym, R_coord):\n \"\"\"\n Runs orca\n\n Parameters:\n me...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': os.environ['CUDA_VISIBLE_DEVICES'] = '0' total_iteration = 300000 m = 512 q = 32 lam = 0.01 beta = 1.0 margin = 0.5 s = 32 batch_size = 256 class_num = 1595 tr...
flexible
{ "blob_id": "459dd9302f7100ad02119cc94b735b19287f21e5", "index": 5956, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n os.environ['CUDA_VISIBLE_DEVICES'] = '0'\n total_iteration = 300000\n m = 512\n q = 32\n lam = 0.01\n beta = 1.0\n margin = 0.5\n s = ...
[ 0, 1, 2, 3 ]
''' LeetCode wants to give one of its best employees the option to travel among n cities to collect algorithm problems. But all work and no play makes Jack a dull boy, you could take vacations in some particular cities and weeks. Your job is to schedule the traveling to maximize the number of vacation days you could ta...
normal
{ "blob_id": "aa7cf08b40b2a13e39003f95e5e0ce7335cbdba2", "index": 1766, "step-1": "'''\nLeetCode wants to give one of its best employees the option to travel among n cities to collect algorithm problems. But all work and no play makes Jack a dull boy, you could take vacations in some particular cities and weeks. ...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for _ in range(numberOfObs): obs = input().split() obstacle.append((int(obs[0]), int(obs[1]))) <|reserved_special_token_0|> while 1 <= q <= board and 1 <= r <= board: if (q, r) in obstacle: break else: ...
flexible
{ "blob_id": "73d02615863826d77d65fbf0314dc71acb97ef28", "index": 4035, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(numberOfObs):\n obs = input().split()\n obstacle.append((int(obs[0]), int(obs[1])))\n<mask token>\nwhile 1 <= q <= board and 1 <= r <= board:\n if (q, r) in obstac...
[ 0, 1, 2, 3, 4 ]
import bpy bl_info = { "name": "Ratchets Center All Objects", "author": "Ratchet3789", "version": (0, 1, 0), "description": "Centers all selected objects. Built for Game Development.", "category": "Object", } class CenterOriginToZero(bpy.types.Operator): """Center all objects script""" # blen...
normal
{ "blob_id": "f7a511beaea869cf32eb905a4f3685077297a5ec", "index": 1654, "step-1": "<mask token>\n\n\nclass CenterOriginToZero(bpy.types.Operator):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def execute(self, context):\n for x in bpy.context.selected_objects:\n ...
[ 10, 14, 15, 16, 18 ]
class Job: def __init__(self, id, duration, tickets): self.id = id self.duration = duration self.tickets = tickets def run(self, time_slice): self.duration -= time_slice def done(self): return self.duration <= 0
normal
{ "blob_id": "cf7bd8aa9c92d1c3acb9ccc1658d66fa0e7a142d", "index": 3777, "step-1": "class Job:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class Job:\n <mask token>\n\n def run(self, time_slice):\n self.duration -= time_slice\n <mask token>\n", "step-3": "class Job:\n ...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> PROJECT_ID = 'aaet-geoscience-dev' DATA_PATH = '/home/airflow/gcs/data/tmp' CREDENTIALS_JSON = 'keys/composer_las_merge.json' BUCKET_LAS_MERGE = 'las_merged' BUCKET_LAS_SPLICE = 'us-central1-lithos-dev-94beb3d4-bucket' COMPOSER_FOLDER = 'data/logqc_landing' T...
flexible
{ "blob_id": "0b2a036b806cca6e7f58008040b3a261a8bc844d", "index": 4092, "step-1": "<mask token>\n", "step-2": "PROJECT_ID = 'aaet-geoscience-dev'\nDATA_PATH = '/home/airflow/gcs/data/tmp'\nCREDENTIALS_JSON = 'keys/composer_las_merge.json'\nBUCKET_LAS_MERGE = 'las_merged'\nBUCKET_LAS_SPLICE = 'us-central1-lithos...
[ 0, 1, 2 ]
<|reserved_special_token_0|> @app.route('/tracks', methods=['POST']) def get_user_tracks(): ids = json.loads(request.data)['ids'] tracks.extend(ids) return 'success' @app.route('/') @login_required def index(): username = session['username'] if session.get('token') and session.get('playlist_dict...
flexible
{ "blob_id": "4f674b30c919c7ec72c11a8edd9692c91da7cb90", "index": 9595, "step-1": "<mask token>\n\n\n@app.route('/tracks', methods=['POST'])\ndef get_user_tracks():\n ids = json.loads(request.data)['ids']\n tracks.extend(ids)\n return 'success'\n\n\n@app.route('/')\n@login_required\ndef index():\n use...
[ 4, 6, 7, 8, 9 ]
# 예시 입력값 board = [[0,0,0,0,0],[0,0,1,0,3],[0,2,5,0,1],[4,2,4,4,2],[3,5,1,3,1]] moves = [1,5,3,5,1,2,1,4] # 로직 resultList = [] count = 0 for nth in moves: for i in range(len(board)): selected = board[i][nth - 1] if selected == 0: continue else: # 인형을 resultList에 넣고 ...
normal
{ "blob_id": "18e032b7ff7ae9d3f5fecc86f63d12f4da7b8067", "index": 6180, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor nth in moves:\n for i in range(len(board)):\n selected = board[i][nth - 1]\n if selected == 0:\n continue\n else:\n resultList.append(sel...
[ 0, 1, 2, 3 ]
class subset: def __init__(self, weight, itemSet, size, setNum): self.weight = weight self.itemSet = itemSet self.size = size self.setNum = setNum def findCover(base, arr): uniq = [] #array that can be union uni = [] #array has been unionized w/ base if len(base.itemSet) == rangeOfVal: # print("COVER:"...
normal
{ "blob_id": "b865c37623f405f67592d1eabc620d11ff87827e", "index": 3378, "step-1": "class subset:\n <mask token>\n\n\n<mask token>\n", "step-2": "class subset:\n\n def __init__(self, weight, itemSet, size, setNum):\n self.weight = weight\n self.itemSet = itemSet\n self.size = size\n ...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class TestDisplay(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestDisplay(unittest.TestCase): def setUp(self): self.display = Display(None) <|reserved_special_to...
flexible
{ "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 ]
import cv2 import numpy as np import random def main(): img = cv2.imread('test_image.png',0) res = np.zeros((img.shape[0],img.shape[1],3),np.uint8) thresh = cv2.threshold(img, 50, 255, 0)[1] _, contours,_ = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE) for cnt in contours: ...
normal
{ "blob_id": "1babf9f27e6792d2a1c2545a1e3bcd08fefa0975", "index": 5639, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n img = cv2.imread('test_image.png', 0)\n res = np.zeros((img.shape[0], img.shape[1], 3), np.uint8)\n thresh = cv2.threshold(img, 50, 255, 0)[1]\n _, contours,...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class UpdatePerformanceView(SuccessMessageMixin, UpdateView): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class DetailPerformanceView...
flexible
{ "blob_id": "7c6ac2837751703ac4582ee81c29ccf67b8277bc", "index": 1632, "step-1": "<mask token>\n\n\nclass UpdatePerformanceView(SuccessMessageMixin, UpdateView):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass DetailPerformanceView(DetailView...
[ 7, 12, 17, 20, 21 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.utils.timezone import utc import datetime class Migration(migrations.Migration): dependencies = [ ('notesapp', '0008_auto_20150819_1222'), ] operations = [ migrations.Ren...
normal
{ "blob_id": "51af54c55834c4bdb8e1cbe4ac55b86bdc61bf4d", "index": 458, "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 = [('notesapp', '...
[ 0, 1, 2, 3, 4 ]
class Graph(): def __init__(self, nvertices): self.N = nvertices self.graph = [[0 for column in range(nvertices)] for row in range(nvertices)] self.V = ['0' for column in range(nvertices)] def nameVertex(self): for i in range(self.N): pr...
normal
{ "blob_id": "51a8b963047215bf864eb4a3e62beb5741dfbafe", "index": 8572, "step-1": "class Graph:\n\n def __init__(self, nvertices):\n self.N = nvertices\n self.graph = [[(0) for column in range(nvertices)] for row in range\n (nvertices)]\n self.V = ['0' for column in range(nverti...
[ 3, 5, 6, 7, 8 ]
##armstrong number## ##n= int(input('enter a number ')) ##a=n ##s=0 ## ##while n>0: ## rem= n%10 ## s= s+rem*rem*rem ## n= n//10 ##if a==s: ## print(a,' is an armstrong number') ##else: ## print(a,' is not an armstrong number') ##palindrome or not## ##n= int(input('enter a number ...
normal
{ "blob_id": "6be285f9c48a20934c1846785232a73373c7d547", "index": 1043, "step-1": "##armstrong number##\r\n##n= int(input('enter a number '))\r\n##a=n\r\n##s=0\r\n##\r\n##while n>0:\r\n## rem= n%10\r\n## s= s+rem*rem*rem\r\n## n= n//10\r\n##if a==s:\r\n## print(a,' is an armstrong number')\r\n##else:\...
[ 1 ]
<|reserved_special_token_0|> class UserCreate(UserBase): password: str class User(UserBase): id: int class Config: orm_mode = True <|reserved_special_token_1|> <|reserved_special_token_0|> class BinCreate(BinBase): owner_id: int password: str class Bin(BinBase): id: int ...
flexible
{ "blob_id": "1c0f194bbdc6f7e3e4feb114e521aa958f11e83e", "index": 3263, "step-1": "<mask token>\n\n\nclass UserCreate(UserBase):\n password: str\n\n\nclass User(UserBase):\n id: int\n\n\n class Config:\n orm_mode = True\n", "step-2": "<mask token>\n\n\nclass BinCreate(BinBase):\n owner_id: in...
[ 2, 5, 6, 7, 8 ]
#! /usr/bin/env python # import ros stuff import rospy from std_srvs.srv import * #to check if the service is active active_ = False def unable_service(req): """ This function contains the variable declared above that is used to enable the service. """ global active_ active_ = req.data res = SetBoolRespo...
normal
{ "blob_id": "0f6737b9e9e9a13d75c20352e9ef9c1db6c0c8a3", "index": 828, "step-1": "#! /usr/bin/env python\n\n# import ros stuff\nimport rospy\nfrom std_srvs.srv import *\n\n#to check if the service is active\nactive_ = False\n\ndef unable_service(req):\n\t\"\"\"\n\tThis function contains the variable declared abov...
[ 0 ]
<|reserved_special_token_0|> def dispersion(list): res = 0 for i in list: res += (i - np.mean(list)) ** 2 return res / len(list) <|reserved_special_token_0|> def chi_square(list): b = sorted(list) k = ceil(log2(len(list)) + 1) step = 10000 / k p = 1 / k frequency_vector = [...
flexible
{ "blob_id": "f2b978b9a4c00469cdd2f5e1e9275df73c7379b8", "index": 3904, "step-1": "<mask token>\n\n\ndef dispersion(list):\n res = 0\n for i in list:\n res += (i - np.mean(list)) ** 2\n return res / len(list)\n\n\n<mask token>\n\n\ndef chi_square(list):\n b = sorted(list)\n k = ceil(log2(len...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python import urllib class LicenseChecker( object ): def __init__( self ): self.url = 'http://logon.guidoaccardo.com.ar/' self.count_offline = 15 def __countTimes( self ): ff = open( 'times.ehead', 'r' ) bb = ff.read() ff.close() return int( bb ) ...
normal
{ "blob_id": "c70aa1a373530ac73553753e62d3989f5bc79287", "index": 687, "step-1": "<mask token>\n\n\nclass LicenseChecker(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass LicenseChecker(object):\n <mask token>\n <mask token>\n\n def ...
[ 1, 3, 5, 6, 7 ]
__author__ = 'Administrator' import unittest class CouchTests2(unittest.TestCase): def test_foo(self): self.assertEqual(1, 1) def test_bar(self): self.assertEqual(1, 1)
normal
{ "blob_id": "cd4f22b8e2188e8019e7324e80d64a7b95f8f956", "index": 1961, "step-1": "<mask token>\n\n\nclass CouchTests2(unittest.TestCase):\n <mask token>\n\n def test_bar(self):\n self.assertEqual(1, 1)\n", "step-2": "<mask token>\n\n\nclass CouchTests2(unittest.TestCase):\n\n def test_foo(self)...
[ 2, 3, 4, 5 ]
import pygame pygame.init() class Tiles: Size = 32 Blocked = [] Blocked_Types = ["5", "6", "7", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "25", "27", "28", "29"] def Blocked_At(pos): if list(pos) in Tiles.Blocked: return True else: ...
normal
{ "blob_id": "3d1f7794763b058cc22c543709a97cb021d0fd23", "index": 8404, "step-1": "<mask token>\n\n\nclass Tiles:\n <mask token>\n <mask token>\n <mask token>\n\n def Blocked_At(pos):\n if list(pos) in Tiles.Blocked:\n return True\n else:\n return False\n\n def L...
[ 3, 4, 5, 6, 7 ]
from collections import namedtuple from math import tau, sin, cos, atan2 grid = 21 c = grid / 2 points = grid**3 Velocity = namedtuple('Velocity', ('x', 'y', 'z')) velocity = [] for k in range(grid): for j in range(grid): for i in range(grid): x = (i / grid + 0.25) * tau y = (j /...
normal
{ "blob_id": "d70986b016e58877c39bfbb76c5bd622c44cbca9", "index": 9273, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor k in range(grid):\n for j in range(grid):\n for i in range(grid):\n x = (i / grid + 0.25) * tau\n y = (j / grid + 0.25) * tau\n z = (k / gri...
[ 0, 1, 2, 3, 4 ]
_method_adaptors = dict() def register_dist_adaptor(method_name): def decorator(func): _method_adaptors[method_name] = func def wrapper(*args, **kwargs): func(*args, **kwargs) return wrapper return decorator def get_nearest_method(method_name, parser): """ all c...
normal
{ "blob_id": "ed2f3bbc7eb0a4d8f5ccdb7a12e00cbddab04dd0", "index": 577, "step-1": "<mask token>\n\n\ndef get_nearest_method(method_name, parser):\n \"\"\"\n all candidates toked\n all protocol untoked\n input:\n queries:\n [\n (protocol, (candidate, sen_id, start, K), (candidate, sen_id, s...
[ 1, 2, 3, 4 ]