code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def activate_emu(): """ This function scans all the open windows and returns a handle to the first known and supported emulator-game pair. Args: None Returns: """ windows = CGWindowLi...
flexible
{ "blob_id": "043ea0efd490522de4f6ee4913c8d66029b34ff5", "index": 5136, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef activate_emu():\n \"\"\"\n This function scans all the open windows and returns a handle to the first known\n and supported emulator-game pair.\n Args:\n None\n...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for reservoir in reservoirs: storageURL = ('https://cdec.water.ca.gov/dynamicapp/QueryMonthly?s=' + reservoir[0]) storagePage = requests.get(storageURL) storageSoup = BeautifulSoup(storagePage.content, 'html.pa...
flexible
{ "blob_id": "ebe7c245e3e14116a37020971e67ada054e0b434", "index": 1171, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor reservoir in reservoirs:\n storageURL = ('https://cdec.water.ca.gov/dynamicapp/QueryMonthly?s=' +\n reservoir[0])\n storagePage = requests.get(storageURL)\n storageSou...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def month_bounds(year, month): """ Returns a tuple of datetime objects (month_start,month_end) given a year and month. Both params are strings because we want month to be a two digit month representation and pyth...
flexible
{ "blob_id": "4c5416582afb3cfeb56259954cda2701ea26f8cd", "index": 7780, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef month_bounds(year, month):\n \"\"\"\n Returns a tuple of datetime objects (month_start,month_end) given a year and month.\n Both params are strings because we want month ...
[ 0, 1, 2, 3 ]
def findFirst(arr, l, h, x): if l > h: return -1 mid = (l + h) // 2 if arr[mid] == x: return mid elif arr[mid] > x: return findFirst(arr, l, mid - 1, x) return findFirst(arr, mid + 1, h, x) def indexes(arr, x): n = len(arr) ind = findFirst(arr, 0, n - 1, x) if i...
normal
{ "blob_id": "b4783540224902b10088edbd038d6d664934a237", "index": 4893, "step-1": "<mask token>\n", "step-2": "def findFirst(arr, l, h, x):\n if l > h:\n return -1\n mid = (l + h) // 2\n if arr[mid] == x:\n return mid\n elif arr[mid] > x:\n return findFirst(arr, l, mid - 1, x)\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def where_is_the_iss_now(): iss_now_website = 'http://api.open-notify.org/iss-now.json' webby = requests.get(iss_now_website) data = webby.json() if data['iss_position']: longitude = data['iss_position'].get('longitude') latitude = data['iss_position'].get(...
flexible
{ "blob_id": "726f133bcf592315c42f8701be8308422ffbf0d9", "index": 426, "step-1": "<mask token>\n\n\ndef where_is_the_iss_now():\n iss_now_website = 'http://api.open-notify.org/iss-now.json'\n webby = requests.get(iss_now_website)\n data = webby.json()\n if data['iss_position']:\n longitude = da...
[ 8, 9, 11, 12, 17 ]
""" Create a list of words and with it, create a new dictionary in which the key is the word and the value is the same word reversed. """ word_list = ['Tree','Apple','Snake','flowers'] word_dict = {word:word[::-1] for word in word_list} print(word_dict) #Output: {'Tree': 'eerT', 'Apple': 'elppA', 'Snake': 'ekanS', 'fl...
normal
{ "blob_id": "5ac489a2d30155bb92767184ad546247817e28ea", "index": 1478, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(word_dict)\n<mask token>\nprint(multiple_list)\n<mask token>\nprint(final_list)\n", "step-3": "<mask token>\nword_list = ['Tree', 'Apple', 'Snake', 'flowers']\nword_dict = {word: ...
[ 0, 1, 2, 3 ]
import traceback from functools import partial import json import logging from collections import defaultdict from itertools import cycle as CycleIter from datetime import datetime, date, timedelta from decimal import Decimal import random from copy import deepcopy from math import ceil import boto3 import bottle from...
normal
{ "blob_id": "1fbe9078748b00efad0211b29ad572df97cda921", "index": 1958, "step-1": "<mask token>\n\n\ndef dpd1_process(lst):\n \"\"\"已废弃的方法\"\"\"\n if not lst:\n return\n for key, l in lst.items():\n rule = getattr(BeforeInBomber, key).value\n query = AutoIVRActions.select(fn.DISTINCT...
[ 60, 69, 74, 80, 146 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import requests ACHAEA_ENDPOINT = 'https://api.achaea.com' def _requires_auth(func): def wrapper(self, *args, **kwargs): if self.auth is not True: raise APIError() return func(self, *args, **kwargs) return wrapper class API: au...
normal
{ "blob_id": "da66b254afb3a8fcd3783a38d8624caa917e58c3", "index": 652, "step-1": "<mask token>\n\n\nclass API:\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 token>\n\n ...
[ 12, 15, 20, 23, 26 ]
import scraperwiki, lxml.html, urllib2, re from datetime import datetime #html = scraperwiki.scrape("http://www.public.health.wa.gov.au/2/1035/2/publication_of_names_of_offenders_list.pm") doc = lxml.html.parse(urllib2.urlopen("http://www.public.health.wa.gov.au/2/1035/2/publication_of_names_of_offenders_list.pm")) ro...
normal
{ "blob_id": "e870900249b121f2416d7be543752ebf6392b6be", "index": 6868, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor tr in root.xpath(\"//div[@id='verdiSection10']/div/div/table/tbody/tr\")[1:]:\n data = {'conviction_date': datetime.strptime(re.match(\n '(\\\\d+/\\\\d+/\\\\d+)', tr[0].text...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def sleep(min_seconds=1, max_seconds=10): """Allow a browser instance to wait for a few seconds before do something""" time.sleep(randint(min_seconds, max_seconds)) def click(elem): try: elem.click() except ElementNotInteractableException: pass def open...
flexible
{ "blob_id": "01de85b0d480c105c8cc1a8154c3de936ab3226d", "index": 9143, "step-1": "<mask token>\n\n\ndef sleep(min_seconds=1, max_seconds=10):\n \"\"\"Allow a browser instance to wait for a few seconds before do something\"\"\"\n time.sleep(randint(min_seconds, max_seconds))\n\n\ndef click(elem):\n try:\...
[ 5, 6, 7, 8, 9 ]
ANCHO = 600 ALTO = 800
normal
{ "blob_id": "71ca67948100fb7ad388934740cead1ebe4a2b52", "index": 8549, "step-1": "<mask token>\n", "step-2": "ANCHO = 600\nALTO = 800\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from schemasheets.schemasheet_datamodel import SchemaSheet RECORD = "Record" FIELD = "Field" METATYPE = "MetaType" INFO = "Info" CV = "CV" PV = "PV" SDO_MAPPINGS = "schema.org" WD_MAPPINGS = "wikidata" DATATYPE = "Datatype" CASES = [ (1, [ { RECORD: "> class", INFO: " descript...
normal
{ "blob_id": "25dc0395da1f1ac2ccd990151c3e5b250802b402", "index": 2749, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_parse_header():\n print()\n for case_id, case in CASES:\n ss = SchemaSheet.from_dictreader(case)\n tc = ss.table_config\n info_cc = tc.columns[INFO...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def find_boyer_moore2(T, P): """ return lowest index of T at which the substring P begins or -1""" n, m = len(T), len(P) if m == 0: return 0 last = {} for k in range(m): last[P[k]] = k i = m - 1 k = m - 1 while i < n: if T[i] == P[k]...
flexible
{ "blob_id": "c418b9b6903ebdad204a3a55f2384a94a3be0d09", "index": 5561, "step-1": "<mask token>\n\n\ndef find_boyer_moore2(T, P):\n \"\"\" return lowest index of T at which the substring P begins or -1\"\"\"\n n, m = len(T), len(P)\n if m == 0:\n return 0\n last = {}\n for k in range(m):\n ...
[ 1, 2, 3, 4, 5 ]
""" 函数对象有一个__defaults__属性,是保存定位参数和关键字参数默认值的元组, 仅限关键字参数默认值在__kwdefaults__属性中,参数的名称在__code__属性中(__code__本身是对象引用,有很多属性) 使用inspect模块提取函数签名更加方便,很多框架和IDE都是以此来验证代码的 """ def tag(name, *content, cls=None, **attrs): """ 生成一个或多个HTML标签 """ if cls is not None: attrs['class'] = cls if attrs: attrs_str = ''.join(' %s="%s"' ...
normal
{ "blob_id": "a9b895e4d0830320276359944ca6fdc475fd144e", "index": 7923, "step-1": "<mask token>\n\n\ndef tag(name, *content, cls=None, **attrs):\n \"\"\" 生成一个或多个HTML标签 \"\"\"\n if cls is not None:\n attrs['class'] = cls\n if attrs:\n attrs_str = ''.join(' %s=\"%s\"' % (attr, value) for attr...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def findSubsequences(self, nums: List[int]) ->List[List[int]]: res: List[List[int]] = [] s = set() def deep(pos: int, tmp: List[int]): if pos == len(nums): ...
flexible
{ "blob_id": "3edfc1098c775fa31456aa3cc938051b2dbb8697", "index": 1664, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n\n def findSubsequences(self, nums: List[int]) ->List[List[int]]:\n res: List[List[int]] = []\n s = set()\n\n def deep(pos: int, tmp: List[int...
[ 0, 2, 3, 4 ]
# test CurlypivSetup """ Notes about program """ # 1.0 import modules import numpy as np from skimage import io import glob from os.path import join import matplotlib.pyplot as plt from curlypiv.utils.calibrateCamera import measureIlluminationDistributionXY, calculate_depth_of_correlation, calculate_darkfield, plot_fi...
normal
{ "blob_id": "6ca7b896cc20220f790c06d4ba08fef7bda8400f", "index": 3301, "step-1": "<mask token>\n\n\nclass illumination(object):\n <mask token>\n\n\nclass darkfield(object):\n\n def __init__(self, basePath, darkframePath=None, flip_image_across_axis\n =None, show_image=False, save_image=False, save_i...
[ 37, 41, 45, 48, 50 ]
from django.conf.urls import patterns, url from riskDashboard2 import views urlpatterns = patterns('', #url(r'getdata', views.vulnData, name='getdata'), url(r'appmanagement', views.appmanagement, name='appmanagement'), url(r'^.*', views.index, name='index'), )
normal
{ "blob_id": "3372d98ff91d90558a87293d4032820b1662d60b", "index": 298, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('', url('appmanagement', views.appmanagement, name=\n 'appmanagement'), url('^.*', views.index, name='index'))\n", "step-3": "from django.conf.urls import patte...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def savitzky_golay(y, window_size, order, deriv=0, rate=1): order_range = range(order + 1) half_window = (window_size - 1) // 2 b = np.mat([[(k ** i) for i in order_range] for k in range(-half_window, half_window + 1)]) m = np.linalg.pinv(b).A[deriv] * rate ** deri...
flexible
{ "blob_id": "8beafcd4f9c02657a828d8c37f2aecda325ba180", "index": 9439, "step-1": "<mask token>\n\n\ndef savitzky_golay(y, window_size, order, deriv=0, rate=1):\n order_range = range(order + 1)\n half_window = (window_size - 1) // 2\n b = np.mat([[(k ** i) for i in order_range] for k in range(-half_windo...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> st.merge() st.detrend(type='demean') st.remove_response() st.filter('bandpass', freqmin=F1, freqmax=F2, corners=4) st.trim(t1, t2) <|reserved_special_token_0|> plt.suptitle(LABEL) <|reserved_special_token_0|> ax.plot(st[0].times(r...
flexible
{ "blob_id": "8d8ea6ad7a3ed1a1e6e96ab75260ecf6e8211d32", "index": 1305, "step-1": "<mask token>\n", "step-2": "<mask token>\nst.merge()\nst.detrend(type='demean')\nst.remove_response()\nst.filter('bandpass', freqmin=F1, freqmax=F2, corners=4)\nst.trim(t1, t2)\n<mask token>\nplt.suptitle(LABEL)\n<mask token>\nax...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def add_sub_path(yaml_path): file = open(yaml_path, 'r', encoding='utf-8') file_data = file.read() file.close() data = yaml.safe_load(file_data) for p, p_info in data.get('paths', {}).items(): for met...
flexible
{ "blob_id": "bbd50c40bc0897fe7a93f277bcfdcba3ba6d6f2a", "index": 1531, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef add_sub_path(yaml_path):\n file = open(yaml_path, 'r', encoding='utf-8')\n file_data = file.read()\n file.close()\n data = yaml.safe_load(file_data)\n for p, p_info...
[ 0, 1, 2, 3, 4 ]
import turtle def draw_square(): conrad = turtle.Turtle() conrad.shape("turtle") conrad.color("red") conrad.speed(3) i = 0 while(i < 4): conrad.forward(200) conrad.right(90) i += 1 def draw_circle(): niki = turtle.Turtle() niki.circle(50) def draw_triangle(): tri = turtle.Turtle() tri.shape("t...
normal
{ "blob_id": "9a982e0ab7fff882767a98ed01f5ed68bd710888", "index": 7433, "step-1": "<mask token>\n\n\ndef draw_circle():\n niki = turtle.Turtle()\n niki.circle(50)\n\n\ndef draw_triangle():\n tri = turtle.Turtle()\n tri.shape('turtle')\n i = 0\n while i < 3:\n tri.forward(135)\n tri...
[ 2, 4, 5, 6, 7 ]
# def add(a,b): # x = a + b # # # the return value gets assigned to the "result" variable # result = add(3,5) # print result # this should print 8 # # def multiply(arr,num): # for x in range(len(arr)): # arr[x] *= num # return arr # # a = [2,4,10,16] # b = multiply(a,5) # print b # # # dog = ("Canis F...
normal
{ "blob_id": "e24c3f6ce2e65305f955dcede9edc0b497f6e74c", "index": 2880, "step-1": "# def add(a,b):\n# x = a + b\n#\n# # the return value gets assigned to the \"result\" variable\n# result = add(3,5)\n# print result # this should print 8\n#\n# def multiply(arr,num):\n# for x in range(len(arr)):\n# ar...
[ 0 ]
<|reserved_special_token_0|> def _update_mpy_clip(clip, subclip, speed, frame, norm, loop, duration, pos, scale, vol, **kwargs): assert duration is not None if subclip is not None: if isinstance(subclip, (int, float)): clip = clip.subclip(subclip).set_duration(duration) else: ...
flexible
{ "blob_id": "9e21a39358d97633b49ad83805990c29c19a80ed", "index": 8599, "step-1": "<mask token>\n\n\ndef _update_mpy_clip(clip, subclip, speed, frame, norm, loop, duration, pos,\n scale, vol, **kwargs):\n assert duration is not None\n if subclip is not None:\n if isinstance(subclip, (int, float)):...
[ 8, 9, 10, 12, 15 ]
<|reserved_special_token_0|> def init_database(conn): c = conn.cursor() c.execute( """CREATE TABLE IF NOT EXISTS catalogs (id INTEGER PRIMARY KEY AUTOINCREMENT, catalog_name TEXT)""" ) c.execute( """CREATE TABLE IF NOT EXISTS products (id INTEGER PRIMA...
flexible
{ "blob_id": "46b1e5adbd956c35820d7d2b17628364388cdcd7", "index": 3638, "step-1": "<mask token>\n\n\ndef init_database(conn):\n c = conn.cursor()\n c.execute(\n \"\"\"CREATE TABLE IF NOT EXISTS catalogs\n (id INTEGER PRIMARY KEY AUTOINCREMENT, catalog_name TEXT)\"\"\"\n )\n ...
[ 9, 17, 19, 20, 21 ]
from __future__ import print_function import os import shutil import pymake import flopy # set up paths dstpth = os.path.join('temp') if not os.path.exists(dstpth): os.makedirs(dstpth) mp6pth = os.path.join(dstpth, 'Modpath_7_1_000') expth = os.path.join(mp6pth, 'examples') exe_name = 'mp7' srcpth = os.path.join(...
normal
{ "blob_id": "ddaba7a8b53072da36224dd4618696ebf0e9a4e4", "index": 1015, "step-1": "<mask token>\n\n\ndef compile_code():\n if os.path.isdir(mp6pth):\n shutil.rmtree(mp6pth)\n url = 'https://water.usgs.gov/ogw/modpath/Modpath_7_1_000.zip'\n pymake.download_and_unzip(url, pth=dstpth)\n pth = os.p...
[ 7, 8, 9, 11, 12 ]
""" Class for manage tables in Storage and Big Query """ # pylint: disable=invalid-name, too-many-locals, too-many-branches, too-many-arguments,line-too-long,R0801,consider-using-f-string from pathlib import Path import json from copy import deepcopy import textwrap import inspect from io import StringIO from loguru i...
normal
{ "blob_id": "da218e6d9ee311eefb8e9ae4dac5053793eb5514", "index": 9369, "step-1": "<mask token>\n\n\nclass Table(Base):\n <mask token>\n\n def __init__(self, dataset_id, table_id, **kwargs):\n super().__init__(**kwargs)\n self.table_id = table_id.replace('-', '_')\n self.dataset_id = da...
[ 8, 12, 15, 16, 20 ]
def flat_list(array): result = [] for element in array: if type(element) == list: result += flat_list(element) else: result.append(element) return result print flat_list([1, [2, 2, 2], 4]) print flat_list([-1, [1, [-2], 1], -1])
normal
{ "blob_id": "0d321193d68b463e3dd04b21ee611afdc212a22b", "index": 4682, "step-1": "def flat_list(array):\n result = []\n for element in array:\n if type(element) == list:\n result += flat_list(element)\n else:\n result.append(element)\n return result\n\n\nprint flat_li...
[ 0 ]
import sys, serial, time, signal, threading from MFRC522 import MFRC522 from event import Event class Sensor(threading.Thread): # main program for reading and processing tags def __init__(self, name): threading.Thread.__init__(self) self.name = name self.continue_reading = False self.tag_reader = MFRC522() ...
normal
{ "blob_id": "c179d27f1620414061d376d4f30d2ddd4fd2750e", "index": 3842, "step-1": "import sys, serial, time, signal, threading\nfrom MFRC522 import MFRC522\nfrom event import Event\n\nclass Sensor(threading.Thread):\n\n\t# main program for reading and processing tags\n\tdef __init__(self, name):\n\t\tthreading.Th...
[ 0 ]
from utils.gradient_strategy.dct_generator import DCTGenerator from utils.gradient_strategy.random_generator import RandomGenerator from utils.gradient_strategy.upsample_generator import UpSampleGenerator from utils.gradient_strategy.centerconv_generator import CenterConvGenerator from utils.attack_setting import * fro...
normal
{ "blob_id": "399097ef7cfdc061b307c3cc29615c9f50b1e6bf", "index": 5511, "step-1": "<mask token>\n", "step-2": "from utils.gradient_strategy.dct_generator import DCTGenerator\nfrom utils.gradient_strategy.random_generator import RandomGenerator\nfrom utils.gradient_strategy.upsample_generator import UpSampleGene...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if horast >= 41: print('Valor a Pagar: ', resp3) elif horast <= 40: print('Valor a Pagar: ', resp4) <|reserved_special_token_1|> <|reserved_special_token_0|> horast = int(input('Horas Trabajadas: ' + '\n\t\t')) tarifa =...
flexible
{ "blob_id": "4d9575c178b672815bb561116689b9b0721cb5ba", "index": 919, "step-1": "<mask token>\n", "step-2": "<mask token>\nif horast >= 41:\n print('Valor a Pagar: ', resp3)\nelif horast <= 40:\n print('Valor a Pagar: ', resp4)\n", "step-3": "<mask token>\nhorast = int(input('Horas Trabajadas: ' + '\\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(sys.modules) <|reserved_special_token_1|> <|reserved_special_token_0|> import sys print(sys.modules) <|reserved_special_token_1|> """to get the all the module and its location""" import sys print(sys.modules)
flexible
{ "blob_id": "20637e41df8a33e3837905a4729ae0b4a9f94dbb", "index": 3128, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(sys.modules)\n", "step-3": "<mask token>\nimport sys\nprint(sys.modules)\n", "step-4": "\"\"\"to get the all the module and its location\"\"\"\r\nimport sys\r\nprint(sys.modules...
[ 0, 1, 2, 3 ]
import json from flask import Flask, request, jsonify from lib.chess_utils import run_game def create_app(): app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello, World!' @app.route('/process_game', methods=['POST']) def process_game(): move_sequence = json.load...
normal
{ "blob_id": "60ca8b1d7307a9d8183e3617f238efcfb9d707dd", "index": 1950, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef create_app():\n app = Flask(__name__)\n\n @app.route('/')\n def hello_world():\n return 'Hello, World!'\n\n @app.route('/process_game', methods=['POST'])\n d...
[ 0, 1, 2, 3 ]
''' XFA/XDP DOM in Javascript This file is part of the phoneyPDF Framework This module provides methods for transforming both PDF objects and XML (xfa/xdp) into a single structure of linked objects in javascript. The idea is that any *DOM interation will play out in javascript land, where the DOMs are created and main...
normal
{ "blob_id": "59b2d0ff3296c9d9a76b8b69a784d5a0c46128be", "index": 8080, "step-1": "'''\nXFA/XDP DOM in Javascript\nThis file is part of the phoneyPDF Framework\n\nThis module provides methods for transforming both PDF objects and XML (xfa/xdp) into a single structure of linked objects\nin javascript. The idea is ...
[ 0 ]
# -*- coding=utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the ...
normal
{ "blob_id": "f3da38f2c4fda0a1d54e79c2c21070f98002b88d", "index": 3351, "step-1": "<mask token>\n\n\nclass CityscapesTestConfig(CityscapesCommonConfig):\n <mask token>\n batch_size = 1\n list_path = 'val.txt'\n\n @classmethod\n def rules(cls):\n \"\"\"Return rules for checking.\"\"\"\n ...
[ 8, 18, 19, 21, 23 ]
#!/usr/bin/env python #python import os import math import sys import time import re import cPickle import random #eman try: import EMAN except: print "EMAN module did not get imported" #scipy import numpy #appion from appionlib import appionScript from appionlib import appiondata from appionlib import apDisplay fro...
normal
{ "blob_id": "49887a3914fa0021a03d89721aa47cded95d54f6", "index": 9605, "step-1": "#!/usr/bin/env python\n\n#python\nimport os\nimport math\nimport sys\nimport time\nimport re\nimport cPickle\nimport random\n#eman\ntry:\n\timport EMAN\nexcept:\n\tprint \"EMAN module did not get imported\"\n#scipy\nimport numpy\n#...
[ 0 ]
import numpy as np class settings: def __init__(self, xmax, xmin, ymax, ymin, yrange, xrange): self.xmax = xmax self.xmin = xmin self.ymax = ymax self.ymin = ymin self.yrange = yrange self.xrange = xrange pass def mapminmax(x, ymin=-1.0, ymax...
normal
{ "blob_id": "e4a66617adbe863459e33f77c32c89e901f66995", "index": 2309, "step-1": "<mask token>\n\n\nclass settings:\n\n def __init__(self, xmax, xmin, ymax, ymin, yrange, xrange):\n self.xmax = xmax\n self.xmin = xmin\n self.ymax = ymax\n self.ymin = ymin\n self.yrange = yra...
[ 7, 8, 9, 11, 12 ]
# https://leetcode.com/problems/wiggle-subsequence/ # # algorithms # Medium (36.9%) # Total Accepted: 43,722 # Total Submissions: 118,490 # beats 100.0% of python submissions class Solution(object): def wiggleMaxLength(self, nums): """ :type nums: List[int] :rtype: int """ ...
normal
{ "blob_id": "6c1f7b8e71760cac443a06f68f5f6ee3c2151e50", "index": 8170, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n", "step-3": "class Solution(object):\n\n def wiggleMaxLength(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> BASE_DIR = os.path.dirname(__file__) SECRET_KEY = '6@j!6%foulnrume$wc7i5cwc2ppf6hcxoa&xh_vtanfy_rc@yc' DEBUG = True EXCEPTION_INGORE_AJAX = True TEMPLATE_DEBUG = True TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')] RESOURCE_...
flexible
{ "blob_id": "045ad27f46c2090ed39a49144c3aa17093b0d9c7", "index": 7094, "step-1": "<mask token>\n", "step-2": "<mask token>\nBASE_DIR = os.path.dirname(__file__)\nSECRET_KEY = '6@j!6%foulnrume$wc7i5cwc2ppf6hcxoa&xh_vtanfy_rc@yc'\nDEBUG = True\nEXCEPTION_INGORE_AJAX = True\nTEMPLATE_DEBUG = True\nTEMPLATE_DIRS =...
[ 0, 1, 2, 3 ]
import pygame from settings import * import random class Cell: def __init__(self, game, x, y, bombs): self.game = game self.x = x self.y = y self.i = x // TILESIZE self.j = y // TILESIZE self.revelada = False self.bomba = False self.bombas_total = bo...
normal
{ "blob_id": "e31f1e24c319f338d728661dfd50e758526112d6", "index": 7796, "step-1": "<mask token>\n\n\nclass Cell:\n <mask token>\n\n def reveal(self):\n if not self.game.is_game_over:\n self.revelada = True\n if self.bombs_around == 0:\n self.flood()\n i...
[ 6, 9, 10, 11, 12 ]
from flask import Flask, request, render_template, redirect import os import smtplib from email.message import EmailMessage app = Flask(__name__) EMAIL_ADDRESS = os.environ.get('EMAIL_USER') EMAIL_PASSWORD = os.environ.get('EMAIL_PASS') @app.route('/') def index(): return render_template('index.html') @app.rout...
normal
{ "blob_id": "27d9e6a868cfc18780ec9615e8dbc3b5ea2fd0c3", "index": 1399, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n return render_template('index.html')\n\n\n@app.route('/submit', methods=['POST'])\ndef submit():\n if request.method == 'POST':\n name = request.form['name']\n e...
[ 2, 3, 4, 5 ]
y = 10 x = 'Тишь да гладь' print(f'Текст:{x}') print(f'Число:{y}') a1 = input('Введите первое число: ') a2 = input('Введите второе число: ') b1 = input('Введите первую строку: ') b2 = input('Введите вторую строку: ') print(f'Вы ввели числа: {a1}/{a2}') print(f'Вы ввели строки: {b1} / {b2}')
normal
{ "blob_id": "2fabb03f0f6b0b297245354782e650380509424b", "index": 8054, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(f'Текст:{x}')\nprint(f'Число:{y}')\n<mask token>\nprint(f'Вы ввели числа: {a1}/{a2}')\nprint(f'Вы ввели строки: {b1} / {b2}')\n", "step-3": "y = 10\nx = 'Тишь да гладь'\nprint(f'Т...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def containsNearbyDuplicate(self, nums, k): """ Time com...
flexible
{ "blob_id": "33c241747062ab0d374082d2a8179335503fa212", "index": 3320, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def containsNearbyDuplicate(self, nums, k):\n \"\"\" Time complexi...
[ 0, 1, 2, 3, 4 ]
import pygame def play_file(name,loop=0,time=0.0): try: #if image exists file='data/audio/'+name pygame.mixer.music.load(file) pygame.mixer.music.play(loop, time) except ZeroDivisionError: #if image doesn't exist print('AudioLoading: failed to load ' + name) try: ...
normal
{ "blob_id": "98940c898d58917e652fe1514ea758768b048dbc", "index": 9601, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef play_file(name, loop=0, time=0.0):\n try:\n file = 'data/audio/' + name\n pygame.mixer.music.load(file)\n pygame.mixer.music.play(loop, time)\n except Z...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [url('^$', views.showberanda, name='showberanda'), url( '^sentimenanalisis/$', views.showsentimenanalisis, name= 'showsentimenanalisis'), url('^bantuan/$', views.showbantuan, name= 'showbantuan'), url('^t...
flexible
{ "blob_id": "077c596f71aae22e85589fdaf78d5cdae8085443", "index": 8710, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^$', views.showberanda, name='showberanda'), url(\n '^sentimenanalisis/$', views.showsentimenanalisis, name=\n 'showsentimenanalisis'), url('^bantuan/$', views.s...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import warnings from functools import wraps import re import logging import pandas as pd import requests def return_df(field="data"): """return DataFrame data""" def decorator(func): @wraps(func) def wrapper(self, *args, **kwargs):...
normal
{ "blob_id": "bd2edd5139a9c5050c582a54cdacca2b0739f333", "index": 9151, "step-1": "<mask token>\n\n\nclass RQOpenClient(object):\n\n def __init__(self, username, password, logger=None, log_level=logging.\n DEBUG, base_url='https://rqopen.ricequant.com', timeout=(5, 10),\n return_df=True):\n ...
[ 11, 12, 14, 15, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .tacotron_v2_synthesizer import Tacotron2Synthesizer
flexible
{ "blob_id": "cf2fcd013c3e9992da36806ca93aacb4b5399396", "index": 3172, "step-1": "<mask token>\n", "step-2": "from .tacotron_v2_synthesizer import Tacotron2Synthesizer\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> class SpiderMiddlewares2(object): def process_request(self, request): print(u'SpiderMiddlewares2 process_request {}'.format(request.url)) return request def process_item(self, item): print(u'SpiderMiddlewares2 process_item {}'.format(item.data)) r...
flexible
{ "blob_id": "8a2ab260f4758bcca7b1a68d1fb65b7eebab5533", "index": 2518, "step-1": "<mask token>\n\n\nclass SpiderMiddlewares2(object):\n\n def process_request(self, request):\n print(u'SpiderMiddlewares2 process_request {}'.format(request.url))\n return request\n\n def process_item(self, item)...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def decimal_to_binary(num): if num == 0: return '0' binary = '' while num != 0: binary = str(num % 2) + binary num = num // 2 return binary <|reserved_special_token_0|> <|reserved_special_token_1|> def decimal_to_b...
flexible
{ "blob_id": "4e202cf7d7da865498ef5f65efdf5851c62082ff", "index": 6764, "step-1": "<mask token>\n", "step-2": "def decimal_to_binary(num):\n if num == 0:\n return '0'\n binary = ''\n while num != 0:\n binary = str(num % 2) + binary\n num = num // 2\n return binary\n\n\n<mask tok...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Dataset(object): def __init__(self): self.items_descriptions = {'image': 'A color image of varying height and width.', 'shape': 'Shape of the image', 'object/bbox': 'A list of bounding boxes, one per each object.', 'object...
flexible
{ "blob_id": "c33d625ebd6a40551d2ce0393fd78619601ea7ae", "index": 5834, "step-1": "<mask token>\n\n\nclass Dataset(object):\n\n def __init__(self):\n self.items_descriptions = {'image':\n 'A color image of varying height and width.', 'shape':\n 'Shape of the image', 'object/bbox':\...
[ 11, 12, 13, 14, 16 ]
from .line_detection_research import score_pixel_v3p2
normal
{ "blob_id": "305554fc86ddc116677b6d95db7d94d9f2213c41", "index": 5088, "step-1": "<mask token>\n", "step-2": "from .line_detection_research import score_pixel_v3p2\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-04-15 18:46 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('aposta', '0003_aposta_nome'), ] operations = [ ...
normal
{ "blob_id": "a917dd6171a78142fefa8c8bfad0110729fc1bb0", "index": 3190, "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 = [('aposta', '0...
[ 0, 1, 2, 3, 4 ]
#C:\utils\Python\Python27\python.exe incompletosClean.py incompletos\inc.dat incompletos\out.dat import sys import os import os.path bfTmp = '' lsOutTmp = [] InFileName = [] lsHTMLName = [] fileNameIn= sys.argv[1] fileNameOu= sys.argv[2] fo = open(fileNameIn) InFileName += [x.replace('\n', '') for x ...
normal
{ "blob_id": "031727fa42b87260abb671518b2baeff1c9524f9", "index": 8913, "step-1": "<mask token>\n", "step-2": "<mask token>\nInFileName += [x.replace('\\n', '') for x in fo.readlines()]\nfo.close()\nfor bfMatFile in InFileName:\n if os.path.isfile(bfMatFile):\n lsHTMLName = []\n fo = open(bfMat...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(1, n + 1): now = p[i] m = min(m, now) if now == m: cnt += 1 print(cnt) <|reserved_special_token_1|> n = int(input()) p = [220000] + list(map(int, input().split())) cnt = 0 m = 220000 for i in ...
flexible
{ "blob_id": "2a500968cf6786440c0d4240430433db90d1fc2f", "index": 5941, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, n + 1):\n now = p[i]\n m = min(m, now)\n if now == m:\n cnt += 1\nprint(cnt)\n", "step-3": "n = int(input())\np = [220000] + list(map(int, input().spli...
[ 0, 1, 2 ]
#cerner_2^5_2019 #Mason Seeger submission 1 from random import randint as r import operator as o #Only works with valid integers. A function for quick math brain training. def randomMath(): correct = 0 while(correct<10): str_ops = ['+', '-', '*', '/', '%'] ops = {'+': o.add, '-': o.sub, '*': o...
normal
{ "blob_id": "12f035962925c5380c782e8fad23f16fe9fb9435", "index": 5311, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef randomMath():\n correct = 0\n while correct < 10:\n str_ops = ['+', '-', '*', '/', '%']\n ops = {'+': o.add, '-': o.sub, '*': o.mul, '/': o.floordiv, '%': o.mo...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from . import common_wizard
flexible
{ "blob_id": "1844cfb3e174454e0e95d91e4e55679caddcd56e", "index": 1963, "step-1": "<mask token>\n", "step-2": "from . import common_wizard\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from urllib.request import urlopen from json import loads with urlopen('http://api.nbp.pl/api/exchangerates/tables/A/') as site: data = loads(site.read().decode('utf-8')) rates = data[0]['rates'] exchange = input('Jaką wartość chcesz wymienić na złotówki? ') value, code = exchange.split(' ') val...
normal
{ "blob_id": "3f3d7cdf7732b2a1568cd97574e1443225667327", "index": 9622, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith urlopen('http://api.nbp.pl/api/exchangerates/tables/A/') as site:\n data = loads(site.read().decode('utf-8'))\n rates = data[0]['rates']\n exchange = input('Jaką wartość chc...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_db(): db = SessionLocal() try: yield db finally: db.close() @app.post('/users/', response_model=schemas.UserCreate) def create_user(user: schemas.UserCreate, db: Session=Depends(get_db)): db_user = crud.get_user_by_mail(db, user.mail) if db_us...
flexible
{ "blob_id": "5961c593b46a8d3a0f7c62d862cce9a2814e42f4", "index": 9019, "step-1": "<mask token>\n\n\ndef get_db():\n db = SessionLocal()\n try:\n yield db\n finally:\n db.close()\n\n\n@app.post('/users/', response_model=schemas.UserCreate)\ndef create_user(user: schemas.UserCreate, db: Sess...
[ 4, 5, 6, 7, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): root = tk.Tk() root.resizable(width=False, height=False) root.title('Tugas Algoritma') canvas = tk.Canvas(root, height=500, width=800) canvas.pack() bg = tk.PhotoImage(file='bg.png') bl = ...
flexible
{ "blob_id": "8a9feae4ce209def2c98b7bed993f9b5c019a533", "index": 7480, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n root = tk.Tk()\n root.resizable(width=False, height=False)\n root.title('Tugas Algoritma')\n canvas = tk.Canvas(root, height=500, width=800)\n canvas.pack...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class UserModel: <|reserved_special_token_0|> def __init__(self, name, password, birth, sex, phone, email, id=0): if id == 0: self.id = self.id + 1 else: self.id = id self.name = name self.email = email s = hashlib.s...
flexible
{ "blob_id": "e675283f14a3d29fba878e7f6d9592130611c2be", "index": 1469, "step-1": "<mask token>\n\n\nclass UserModel:\n <mask token>\n\n def __init__(self, name, password, birth, sex, phone, email, id=0):\n if id == 0:\n self.id = self.id + 1\n else:\n self.id = id\n ...
[ 6, 7, 8, 9, 12 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.12 on 2018-07-26 19:11 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('articles', '0014_auto_20180726_0926'), ] operations = [ migrations.AlterFi...
normal
{ "blob_id": "671a7ee3fabee6ed8dfafe1bddefb1f94322b0e5", "index": 2477, "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 = [('articles', ...
[ 0, 1, 2, 3, 4 ]
from game import BaseGame class First(BaseGame): key = 'F' code = 'FIRST' short_description = 'Vinci se esce 1 o 2. x2.8' long_description = ( 'Si lancia un unico dado, se esce 1 o 2 vinci 2.8 volte quello che hai' ' puntato.') min_bet = 20 multiplier = 2.8 def has_won(sel...
normal
{ "blob_id": "81fa3129d971fe8296a89a7b772d61ff50a8b9f7", "index": 9284, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass First(BaseGame):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def has_won(self, draws):\n return dra...
[ 0, 2, 3, 4, 5 ]
from flask import Flask, render_template app = Flask(__name__) @app.route("/") def index(): headline = "Hello world from a variable!" # headline de la izq es el nombre de la variable en la vista # headline de la der es el nombre de la variable en el server return render_template("index.html", headline...
normal
{ "blob_id": "83bbb6433d1577be869bf840bdd42aa86e415da6", "index": 9328, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/')\ndef index():\n headline = 'Hello world from a variable!'\n return render_template('index.html', headline=headline)\n\n\n@app.route('/bye/')\ndef bye():\n hea...
[ 0, 2, 3, 4, 5 ]
# %% import numpy as np from numpy import sin, cos, pi import gym import seagul.envs from seagul.integration import rk4,euler from control import lqr, ctrb from torch.multiprocessing import Pool import matplotlib.pyplot as plt import matplotlib #matplotlib.use('Qt5Agg') import time global_start = time.time() # %% ...
normal
{ "blob_id": "358d4573ff386d6874d5bb5decfe71c71141bf1c", "index": 2525, "step-1": "<mask token>\n\n\ndef control(q):\n gs = np.array([pi / 2, 0, 0, 0])\n return -k.dot(q - gs)\n\n\ndef reward_fn(s, a):\n reward = np.sin(s[0]) + 2 * np.sin(s[0] + s[1])\n done = reward < 2\n return reward, done\n\n\n...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(1, n - 1): rem = n % i if rem == 0: sum = sum + i if sum == n: print('the number is perfect') else: print('not prime') <|reserved_special_token_1|> n = int(input('enter the number\n')) sum...
flexible
{ "blob_id": "5721786b61cf8706b1d401a46d06f2d32153df8b", "index": 765, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, n - 1):\n rem = n % i\n if rem == 0:\n sum = sum + i\nif sum == n:\n print('the number is perfect')\nelse:\n print('not prime')\n", "step-3": "n = in...
[ 0, 1, 2, 3 ]
# -*- coding: UTF-8 -*- from keywords.httpkeys1 import HTTP http1 = HTTP() # ip = '10.68.170.184:8080' ip = '10.68.170.184:8080' http1.post('http://'+ip+'/music_download/api/login','username=admin&password=123456') # http1.savejson('result','id') # http1.get('http://47.101.197.102:8080/music/api/user','{id}') # dat...
normal
{ "blob_id": "68e09f72e8338efbef108ffd0c93eff067bf7b07", "index": 135, "step-1": "<mask token>\n", "step-2": "<mask token>\nhttp1.post('http://' + ip + '/music_download/api/login',\n 'username=admin&password=123456')\nhttp1.upload('http://' + ip + '/music_download/api/song/upload',\n 'speed=0&styleId=c0a4...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def partition(data, l, h): i = l j = h pivot = data[l] while i < j: while data[i] <= pivot and i <= h - 1: i = i + 1 while data[j] > pivot and j >= l + 1: j = j - 1 if i < j: data[i], data[j] = data[j], data[i] ...
flexible
{ "blob_id": "1cd82883e9a73cfbe067d58c30659b9b2e5bf473", "index": 9349, "step-1": "<mask token>\n\n\ndef partition(data, l, h):\n i = l\n j = h\n pivot = data[l]\n while i < j:\n while data[i] <= pivot and i <= h - 1:\n i = i + 1\n while data[j] > pivot and j >= l + 1:\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def exponent(base, index): if index == 0 and base == 0: return -1 elif index == 0: return 1 elif base == 0: return 0 else: product = 1 for indices in range(index): ...
flexible
{ "blob_id": "a99426c0751885f17078e709fd523cf3a26f5286", "index": 5533, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef exponent(base, index):\n if index == 0 and base == 0:\n return -1\n elif index == 0:\n return 1\n elif base == 0:\n return 0\n else:\n prod...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class PluginBase(object): """ Clase base para todos los plugins """ __metaclass__ = PluginType pass <|reserved_special_token_1|> <|reserved_special_token_0|> class PluginType(type): <|reserved_special_token_0|> class PluginBase(object): """ Clase bas...
flexible
{ "blob_id": "b670655e3a8e88b97eed35e187b01d6524a16af3", "index": 7709, "step-1": "<mask token>\n\n\nclass PluginBase(object):\n \"\"\"\n Clase base para todos los plugins\n \"\"\"\n __metaclass__ = PluginType\n pass\n", "step-2": "<mask token>\n\n\nclass PluginType(type):\n <mask token>\n\n\n...
[ 3, 4, 5, 6, 7 ]
# -*- encoding:ascii -*- from mako import runtime, filters, cache UNDEFINED = runtime.UNDEFINED __M_dict_builtin = dict __M_locals_builtin = locals _magic_number = 6 _modified_time = 1383550959.0389481 _template_filename='templates/webapps/tool_shed/repository/browse_repository.mako' _template_uri='/webapps/tool_shed/r...
normal
{ "blob_id": "fd54bbfbc81aec371ad6c82bf402a5a3673a9f24", "index": 8892, "step-1": "<mask token>\n\n\ndef _mako_generate_namespaces(context):\n ns = runtime.TemplateNamespace('__anon_0x88e2e50', context.\n _clean_inheritance_tokens(), templateuri=u'/message.mako',\n callables=None, calling_uri=_te...
[ 3, 5, 7, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def favorite_book(name): print(f'One of my favorite books is {name}...') <|reserved_special_token_0|> <|reserved_special_token_1|> def favorite_book(name): print(f'One of my favorite books is {name}...') favorite_book('Alice in Wonderland') <...
flexible
{ "blob_id": "08848e51d5564bad927607be3fa3c86f2c1212c5", "index": 9668, "step-1": "<mask token>\n", "step-2": "def favorite_book(name):\n print(f'One of my favorite books is {name}...')\n\n\n<mask token>\n", "step-3": "def favorite_book(name):\n print(f'One of my favorite books is {name}...')\n\n\nfavor...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class HostApi(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def getHostById(self, **kwargs): """Retrieves host based on id Args: id, str: Host Id (required) scope, str: Authoriza...
flexible
{ "blob_id": "4243c863827f1378c364171ca7d8fdabd42be22f", "index": 3625, "step-1": "<mask token>\n\n\nclass HostApi(object):\n <mask token>\n <mask token>\n <mask token>\n\n def getHostById(self, **kwargs):\n \"\"\"Retrieves host based on id\n\n Args:\n\n id, str: Host Id (requ...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def load_data_from_csv(file_name, header=0, encoding='utf-8'): data_df = pd.read_csv(file_name, header=header, encoding=encoding) return data_df <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def load_data_from_csv(file_name, header=0...
flexible
{ "blob_id": "c879230efe12bde9042159da221a2b9b4c1d8349", "index": 198, "step-1": "<mask token>\n\n\ndef load_data_from_csv(file_name, header=0, encoding='utf-8'):\n data_df = pd.read_csv(file_name, header=header, encoding=encoding)\n return data_df\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef lo...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def writeUniquerecords(dirpath, filenames): sourcepath = os.path.join(dirpath, filenames) with open(sourcepath, 'r') as fp: lines = fp.readlines() destination_lines = [] for line in lines: if line not in destination_lines: destin...
flexible
{ "blob_id": "4ed730369cf065936569a8515de44042829c2143", "index": 1201, "step-1": "<mask token>\n\n\ndef writeUniquerecords(dirpath, filenames):\n sourcepath = os.path.join(dirpath, filenames)\n with open(sourcepath, 'r') as fp:\n lines = fp.readlines()\n destination_lines = []\n for li...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> driver.get('https://www.google.ca/imghp?hl=en&tab=ri&authuser=0&ogbl') <|reserved_special_token_0|> for name in names: box = driver.find_element_by_xpath('//*[@id="sbtc"]/div/div[2]/input') box.send_keys(name + str(' cover...
flexible
{ "blob_id": "6375ac80b081b7eafbc5c3fc7e84c4eff2604848", "index": 4041, "step-1": "<mask token>\n", "step-2": "<mask token>\ndriver.get('https://www.google.ca/imghp?hl=en&tab=ri&authuser=0&ogbl')\n<mask token>\nfor name in names:\n box = driver.find_element_by_xpath('//*[@id=\"sbtc\"]/div/div[2]/input')\n ...
[ 0, 1, 2, 3 ]
import os import sys from shutil import copyfile def buildDocumentation(): """ Build eMonitor Documentation with sphinx :param sys.argv: * html: build html documentation in directory */docs/output/html* * pdf: build pdf documentation in directory */docs/output/pdf* """ helptext = 'u...
normal
{ "blob_id": "e60c3a6aececd97ec08ae32b552bcda795375b3b", "index": 779, "step-1": "import os\nimport sys\nfrom shutil import copyfile\n\n\ndef buildDocumentation():\n \"\"\"\n Build eMonitor Documentation with sphinx\n\n :param sys.argv:\n\n * html: build html documentation in directory */docs/output...
[ 0 ]
import numpy as np import tkinter as tk import time HEIGHT = 100 WIDTH = 800 ROBOT_START_X = 700 ROBOT_START_Y = 50 SLEEP_TIME = 0.00001 SLEEP_TIME_RESET = 0.2 class Environment(tk.Tk, object): def __init__(self): super(Environment, self).__init__() self.action_space = ['g', 'b'] # go, break ...
normal
{ "blob_id": "ee272fe1a023d85d818a8532055dcb5dbcb6a707", "index": 4799, "step-1": "<mask token>\n\n\nclass Environment(tk.Tk, object):\n\n def __init__(self):\n super(Environment, self).__init__()\n self.action_space = ['g', 'b']\n self.num_actions = len(self.action_space)\n self.ti...
[ 4, 5, 6, 8, 10 ]
from leapp.models import Model, fields from leapp.topics import TransactionTopic class TargetRepositoryBase(Model): topic = TransactionTopic repoid = fields.String() class UsedTargetRepository(TargetRepositoryBase): pass class RHELTargetRepository(TargetRepositoryBase): pass class CustomTargetRe...
normal
{ "blob_id": "47dc9212a1059cbca8ec6732deaa835fa9967fd8", "index": 2990, "step-1": "<mask token>\n\n\nclass RHELTargetRepository(TargetRepositoryBase):\n pass\n\n\nclass CustomTargetRepository(TargetRepositoryBase):\n name = fields.Nullable(fields.String())\n baseurl = fields.Nullable(fields.String())\n ...
[ 9, 10, 11, 12, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> with open('C:\\Users\\lenovo\\Desktop\\哈工大社会计算与信息检索研究中心同义词词林扩展版.txt') as f: with open('convert.txt', 'a') as w: for line in f: data = line[8:-1].split() for item in data: tmp = data.copy() tm...
flexible
{ "blob_id": "9109e649a90730df022df898a7760140275ad724", "index": 4854, "step-1": "<mask token>\n", "step-2": "with open('C:\\\\Users\\\\lenovo\\\\Desktop\\\\哈工大社会计算与信息检索研究中心同义词词林扩展版.txt') as f:\n with open('convert.txt', 'a') as w:\n for line in f:\n data = line[8:-1].split()\n ...
[ 0, 1, 2 ]
from django.db import models class Kit(models.Model): name = models.CharField(max_length=100, null=True) main_image_url = models.URLField(max_length=1000) price = models.DecimalField(max_digits=10, decimal_places=2, default=0) description = models.CharField(max_length=1000, null=True) class Meta...
normal
{ "blob_id": "ea2183530667437e086bc89f137e464dec6f363a", "index": 1800, "step-1": "<mask token>\n\n\nclass KitSubImageUrl(models.Model):\n image_url = models.URLField(max_length=1000)\n kit = models.ForeignKey('kit.Kit', on_delete=models.CASCADE)\n\n\n class Meta:\n db_table = 'kit_sub_image_urls'...
[ 4, 5, 6, 7 ]
<|reserved_special_token_0|> def config_graph(): paths = [] path = {} path['input_dim'] = 4116 path['name'] = 'shared1' path['computation'] = construct_path(path['name'], [512, 512], batch_norm=False, dropout=True, dropout_rate=0.5, noise=False, noise_std=0.16) path['input'] = ...
flexible
{ "blob_id": "8039430f1b65cc76f9a78b1094f110de29f0f965", "index": 4885, "step-1": "<mask token>\n\n\ndef config_graph():\n paths = []\n path = {}\n path['input_dim'] = 4116\n path['name'] = 'shared1'\n path['computation'] = construct_path(path['name'], [512, 512],\n batch_norm=False, dropout...
[ 1, 2, 3, 4, 5 ]
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
normal
{ "blob_id": "53127de883fb5da3214d13904664566269becba6", "index": 3570, "step-1": "<mask token>\n\n\nclass BaseLoader(metaclass=abc.ABCMeta):\n\n @property\n def plugin_class(self):\n raise NotImplementedError()\n <mask token>\n\n @abc.abstractmethod\n def get_options(self):\n \"\"\"R...
[ 4, 11, 13, 14, 15 ]
# -*- coding: utf-8 -*- """ ====================== @author : Zhang Xu @time : 2021/9/8:16:29 @email : zxreaper@foxmail.com @content : tensorflow subclassing 复现 NPA ====================== """ import tensorflow as tf from tensorflow.keras import * from tensorflow.keras.layers import * from keras import ...
normal
{ "blob_id": "f3789d70f784345881f705fc809c49ad4e3526bc", "index": 1287, "step-1": "<mask token>\n\n\nclass NewsEncoder(tf.keras.Model):\n\n def __init__(self):\n super(NewsEncoder, self).__init__(name='NewsEncoder')\n self.userid_input_layer = Input()\n self.userid_embedding_layer = Embedd...
[ 5, 6, 7, 8, 9 ]
class Order: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @property def order_num(self): """ Return order num of the order. :return: str """ return self._order_number <|reserved_special_token_0|> <|reserved_sp...
flexible
{ "blob_id": "0dce4ea8ef21f2535194330b82ce5706ae694247", "index": 4676, "step-1": "class Order:\n <mask token>\n <mask token>\n <mask token>\n\n @property\n def order_num(self):\n \"\"\"\n Return order num of the order.\n :return: str\n \"\"\"\n return self._order...
[ 7, 10, 11, 15, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def solveMeFirst(a, b): return a + b <|reserved_special_token_0|> <|reserved_special_token_1|> def solveMeFirst(a, b): return a + b print(solveMeFirst(int(input()), int(input()))) <|reserved_special_token_1|> #!/bin/python3 def solveMeFirst...
flexible
{ "blob_id": "5d55c586c57de8f287d9f51f0cb1f188c8046c29", "index": 2977, "step-1": "<mask token>\n", "step-2": "def solveMeFirst(a, b):\n return a + b\n\n\n<mask token>\n", "step-3": "def solveMeFirst(a, b):\n return a + b\n\n\nprint(solveMeFirst(int(input()), int(input())))\n", "step-4": "#!/bin/pytho...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if os.path.isdir(project): print('ERROR: Project exists') exit() os.mkdir(project) os.chdir(project) <|reserved_special_token_0|> os.system(cmd) <|reserved_special_token_0|> with open('requirements.txt', 'w+') as ouf: ...
flexible
{ "blob_id": "c700af6d44cd036212c9e4ae4932bc60630f961e", "index": 6930, "step-1": "<mask token>\n", "step-2": "<mask token>\nif os.path.isdir(project):\n print('ERROR: Project exists')\n exit()\nos.mkdir(project)\nos.chdir(project)\n<mask token>\nos.system(cmd)\n<mask token>\nwith open('requirements.txt',...
[ 0, 1, 2, 3, 4 ]
from distutils.core import setup setup(name='greeker', version='0.3.2-git', description="scrambles nouns in an XML document to produce a specimen for layout testing", author="Brian Tingle", author_email="brian.tingle.cdlib.org@gmail.com", url="http://tingletech.github.com/greeker.py/", ...
normal
{ "blob_id": "1fda8274024bdf74e7fbd4ac4a27d6cfe6032a13", "index": 9790, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='greeker', version='0.3.2-git', description=\n 'scrambles nouns in an XML document to produce a specimen for layout testing'\n , author='Brian Tingle', author_email=\n ...
[ 0, 1, 2, 3 ]
# Copyright (C) 2018-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino.tools.mo.ops.pack import PackOp from openvino.tools.mo.front.extractor import FrontExtractorOp from openvino.tools.mo.front.mxnet.extractors.utils import get_mxnet_layer_attrs class StackFrontExtractor(FrontExtractorOp): ...
normal
{ "blob_id": "dd71feda1ed5ff7ef9dee1573ad63939a3e09691", "index": 7526, "step-1": "<mask token>\n\n\nclass StackFrontExtractor(FrontExtractorOp):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass StackFrontExtractor(FrontExtractorOp):\n <mask token>\n <mask token...
[ 1, 2, 3, 4, 5 ]
from kivy.app import App from kivy.lang import Builder from kivy.uix.screenmanager import ScreenManager, Screen import subprocess import socket from kivy.uix.button import Button from kivy.uix.button import Label from kivy.uix.boxlayout import BoxLayout Builder.load_string(""" <MenuScreen>: BoxLayout: orie...
normal
{ "blob_id": "237a647e7bf0b1c12abd78b1ef6e293e73232a6c", "index": 2217, "step-1": "from kivy.app import App\nfrom kivy.lang import Builder\nfrom kivy.uix.screenmanager import ScreenManager, Screen\nimport subprocess\nimport socket\nfrom kivy.uix.button import Button\nfrom kivy.uix.button import Label\nfrom kivy.u...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def molecule_to_list(molecule: str) ->list: """Splits up a molucule into elements and amount in order of appearance Args: molecule (str): The molecule to split up Raises: ValueError: If molecule sta...
flexible
{ "blob_id": "a14a1803a0bae755803c471b12035398de262dbc", "index": 9138, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef molecule_to_list(molecule: str) ->list:\n \"\"\"Splits up a molucule into elements and amount in order of appearance\n\n Args:\n molecule (str): The molecule to split...
[ 0, 1, 2, 3 ]
from flask_restful import Resource, reqparse from db import query import pymysql from flask_jwt_extended import jwt_required """ This module is used to retrieve the data for all the request_no's which have a false or a 0 select_status. This is done by selecting distinct request_no's from requests table for ...
normal
{ "blob_id": "d436362468b847e427bc14ca221cf0fe4b2623e3", "index": 4408, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AdminReqNoDetails(Resource):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass AdminReqNoDetails(Resource):\n\n @jwt_required\n def get(self):\n parser = r...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class AddReportForm(ReportBaseForm): """Form for adding new report.""" pass class EditReportForm(ReportBaseForm): """Form for editing a report.""" cleared_file = HiddenField('cleared_file') <|reserved_special_token_1|> <|reserved_special_token_0|> class EditUserForm...
flexible
{ "blob_id": "47b2857ac20e46897cc1f64371868ce5174799d6", "index": 4790, "step-1": "<mask token>\n\n\nclass AddReportForm(ReportBaseForm):\n \"\"\"Form for adding new report.\"\"\"\n pass\n\n\nclass EditReportForm(ReportBaseForm):\n \"\"\"Form for editing a report.\"\"\"\n cleared_file = HiddenField('c...
[ 5, 14, 20, 22, 24 ]
def search4vowels(word): """ Return sny vowels founded in a supplied word.""" vowels = set('aeiou') found = vowels.intersection(set(word)) #return found for vowels in found: print(vowels)
normal
{ "blob_id": "8a21a7005fb17cc82759079022b540cf4fd062c5", "index": 3458, "step-1": "<mask token>\n", "step-2": "def search4vowels(word):\n \"\"\" Return sny vowels founded in a supplied word.\"\"\"\n vowels = set('aeiou')\n found = vowels.intersection(set(word))\n for vowels in found:\n print...
[ 0, 1, 2 ]
# 玩家(攻击力)攻击敌人(血量)敌人受伤(减血)可能死亡(播放动画) # 敌人攻击玩家 玩家受伤(减血 碎屏) 可能死亡(游戏结束) # class Player: # def __init__(self,name,hp,atk): # self.name = name # self.hp = hp # self.atk = atk # # @property # def hp(self): # return self.__hp # @hp.setter # def hp(self,value): # if 0...
normal
{ "blob_id": "3065c87f79433e9fbbd2ff45c2915dfd5b1fa7cc", "index": 8427, "step-1": "class Player:\n\n def __init__(self, hp=100, atk=100):\n self.hp = hp\n self.atk = atk\n <mask token>\n <mask token>\n\n\nclass Enemy:\n\n def __init__(self, hp=100, atk=99):\n self.hp = hp\n ...
[ 6, 7, 8, 9, 11 ]
with open("input_trees.txt") as file: map = file.readlines() map = [ line.strip() for line in map ] slopes = [(1,1), (3,1), (5,1), (7,1),(1,2)] total = 1 for slope in slopes: treeCount = 0 row, column = 0, 0 while row + 1 < len(map): row += slope[1] column += slope[0] sp...
normal
{ "blob_id": "685fa78b9c3ec141ce1e9ab568e4ad8a0565d596", "index": 4285, "step-1": "<mask token>\n", "step-2": "with open('input_trees.txt') as file:\n map = file.readlines()\n map = [line.strip() for line in map]\n<mask token>\nfor slope in slopes:\n treeCount = 0\n row, column = 0, 0\n while row...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def interpolate_images(baseline, image, alphas): alphas_x = alphas[:, tf.newaxis, tf.newaxis, tf.newaxis, tf.newaxis] baseline_x = tf.expand_dims(baseline, axis=0) input_x = tf.expand_dims(image, axis=0) delta = input_x - baseline_x images = baseline_x + alphas_x * del...
flexible
{ "blob_id": "848e4abcd0b4f118030fc62f1272a19bfce9db4e", "index": 178, "step-1": "<mask token>\n\n\ndef interpolate_images(baseline, image, alphas):\n alphas_x = alphas[:, tf.newaxis, tf.newaxis, tf.newaxis, tf.newaxis]\n baseline_x = tf.expand_dims(baseline, axis=0)\n input_x = tf.expand_dims(image, axi...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if comm.rank == 0: print('Data = ', data) <|reserved_special_token_1|> <|reserved_special_token_0|> comm = MPI.COMM_WORLD mydata = comm.rank data = comm.gather(mydata) if comm.rank == 0: print('Data = ', data) <|reser...
flexible
{ "blob_id": "acf3d188bd6c99774ddf538dcc83f99ad56c7057", "index": 7431, "step-1": "<mask token>\n", "step-2": "<mask token>\nif comm.rank == 0:\n print('Data = ', data)\n", "step-3": "<mask token>\ncomm = MPI.COMM_WORLD\nmydata = comm.rank\ndata = comm.gather(mydata)\nif comm.rank == 0:\n print('Data = ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def index(request): all_games = game.objects.all() context = {'all_games': all_games} return render(request, 'game/index.html', context) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_speci...
flexible
{ "blob_id": "6623ac194e380c9554d72a1b20bf860b958dda97", "index": 5961, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef index(request):\n all_games = game.objects.all()\n context = {'all_games': all_games}\n return render(request, 'game/index.html', context)\n\n\n<mask token>\n", "step-3...
[ 0, 1, 2, 3, 4 ]
#################################################################################### # About # Date: April 12, 2018 # Notes ''' Code that renames a list of files in a directory MUST Run in Python 3 environment! jpeg Drop extra number at the end of unique ID add DEL or INS based on variant type ''' ''' Resources -----...
normal
{ "blob_id": "d483314fa7e8a2514fd5089b872b9e480e7454f4", "index": 8116, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.chdir(\n '/Volumes/lesleydata/manual_Curation_app/images/svviz_JMZook/1000_Rand_Samp_INS_DEL_2/app_images/DEL/PBDEL'\n )\nfor f in os.listdir():\n file_name, file_ext = os.pat...
[ 0, 1, 2, 3, 4 ]
def reverse_string(seq): return seq[::-1] def complement(seq): seq = seq.upper() basecomplement = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A', 'N': 'N'} letters = list(seq) letters = [basecomplement[base] for base in letters] return ''.join(letters) def reversecomplement(seq): seq = reverse_...
flexible
{ "blob_id": "0f2d215a34758f85a29ef7ed8264fccd5e85b66f", "index": 3017, "step-1": "def reverse_string(seq):\n return seq[::-1]\n\n\ndef complement(seq):\n seq = seq.upper()\n basecomplement = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A', 'N': 'N'}\n letters = list(seq)\n letters = [basecomplement[base] ...
[ 4, 5, 6, 7, 8 ]
import numpy as np import sympy as sp # (index: int, cos: bool) # 0 1 1 2 2 3 3 4 4 5 5 ... # {0, cos}, {1, cos}, {1, sen}, {2, cos}, {2, sen}, ... alternatingRange = lambda m : [{'index': j, 'cos': True if k == 0 else False} for j in range(m + 1) for k in range(2 if j != 0 else 1)] # data: "dict" # data = {'x': [x-p...
normal
{ "blob_id": "98c2fdf0dfc9a660a3eb9a359aa9ca14d83c60ce", "index": 4588, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef trigLSQ(data):\n noPoints = len(data['x'])\n order = int(noPoints / 2) if int(noPoints / 2) < noPoints / 2 else int(\n noPoints / 2) - 1\n c = lambda a: np.array([...
[ 0, 1, 2, 3, 4 ]