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|> for i in range(5): print(tej[i]) <|reserved_special_token_1|> tej = 'votary' for i in range(5): print(tej[i]) <|reserved_special_token_1|> tej="votary" for i in range(5): print(tej[i])
flexible
{ "blob_id": "1f385fda1bdc0008ff91b935998c95c8ffcbd297", "index": 2797, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(5):\n print(tej[i])\n", "step-3": "tej = 'votary'\nfor i in range(5):\n print(tej[i])\n", "step-4": "tej=\"votary\"\nfor i in range(5):\n\tprint(tej[i])\n", "st...
[ 0, 1, 2, 3 ]
# Library for Stalker project #Libraries import pandas as pd import seaborn as sns from IPython.display import Image, display import matplotlib.pyplot as plt # Google search from googlesearch import search # Tldextract to get domain of url import tldextract as tld # BeautifulSoup from bs4 import BeautifulSoup as bs f...
normal
{ "blob_id": "9c7ecd3c878d43633606439aa63f840176f20dee", "index": 7941, "step-1": "<mask token>\n\n\ndef find_webs(query):\n urls = []\n rrss = ['facebook', 'twitter', 'linkedin', 'instagram', 'youtube',\n 'pinterest', 'angel']\n sites = []\n red_social = False\n for s in search(query, tld='...
[ 14, 15, 16, 20, 22 ]
<|reserved_special_token_0|> class DownVoteHandler(MainHandler): def get(self): user = self.get_user() if user: post_id = self.request.get('post_id') post = PostData.get_by_id(int(post_id)) voter_list = post.voter_list if post.author == user: ...
flexible
{ "blob_id": "5711613df0bda10512466f147febcffacfe1607b", "index": 7794, "step-1": "<mask token>\n\n\nclass DownVoteHandler(MainHandler):\n\n def get(self):\n user = self.get_user()\n if user:\n post_id = self.request.get('post_id')\n post = PostData.get_by_id(int(post_id))\n...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "e14b8d0f85042ceda955022bee08b3b3b4c2361d", "index": 7367, "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 = [('Asha', '000...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Tue Aug 18 18:53:02 2020 @author: vinhe I followed below tutorial to push newly created csv to google sheets: https://medium.com/craftsmenltd/from-csv-to-google-sheet-using-python-ef097cb014f9 """ import gspread from oauth2client.service_account import ServiceAcc...
normal
{ "blob_id": "ac2edcd6ea71ebdc5b1df5fd4211632b5d8e2704", "index": 3019, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('C:/users/vinhe/code/projects/golf/golf_stats.csv', 'r') as file_obj:\n content = file_obj.read()\n client.import_csv(spreadsheet.id, data=content)\n", "step-3": "<mask ...
[ 0, 1, 2, 3, 4 ]
num=5 a=5 for row in range(num,0,-1): for col in range(row,0,-1): print(a,end="") a-=1 print()
normal
{ "blob_id": "a567a2dc1dbb59979d849a5a772e4592910a9f27", "index": 2783, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor row in range(num, 0, -1):\n for col in range(row, 0, -1):\n print(a, end='')\n a -= 1\n print()\n", "step-3": "num = 5\na = 5\nfor row in range(num, 0, -1):\n for...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_token_lookups_with_full_data(): token_lookup = mango.SplTokenLookup.load(mango.SplTokenLookup. DefaultDataFilepath) assert token_lookup.find_by_symbol('BTC').mint == PublicKey( '9n4nbM75f5Ui33ZbP...
flexible
{ "blob_id": "5e7a589af69a604021ed9558fcce721a8e254fee", "index": 5269, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_token_lookups_with_full_data():\n token_lookup = mango.SplTokenLookup.load(mango.SplTokenLookup.\n DefaultDataFilepath)\n assert token_lookup.find_by_symbol('BTC...
[ 0, 1, 2, 3, 4 ]
from igbot import InstaBot from settings import username, pw from sys import argv def execute_script(InstaBot): InstaBot.get_unfollowers() #InstaBot.unfollow() #InstaBot.follow() #InstaBot.remove_followers() def isheadless(): if len(argv) > 1: if argv[1] == 'head': return False else: raise ValueError("...
normal
{ "blob_id": "f379092cefe83a0a449789fbc09af490081b00a4", "index": 3818, "step-1": "<mask token>\n\n\ndef isheadless():\n if len(argv) > 1:\n if argv[1] == 'head':\n return False\n else:\n raise ValueError(\"optional arg must be : 'head'\")\n return True\n\n\n<mask token>\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def parse_config_file_from_disk(path, confname='diskconf.json'): json_path = str(path) + '/' + str(confname) if not os.path.exists(json_path): module_print('\tPath not exists: ' + str(json_path)) return None try: with open(json_path, 'r') as f: ...
flexible
{ "blob_id": "927470fe0087b17e5fe67a9b8b3cc13a40d8be1a", "index": 7554, "step-1": "<mask token>\n\n\ndef parse_config_file_from_disk(path, confname='diskconf.json'):\n json_path = str(path) + '/' + str(confname)\n if not os.path.exists(json_path):\n module_print('\\tPath not exists: ' + str(json_path...
[ 7, 8, 9, 10, 11 ]
<|reserved_special_token_0|> @pytest.mark.django_db class TestImage(TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def setUp(self): file1 = File(name='file1.jpg', file=BytesIO(b'abcdef')) attachment1 = G(Attachment, original_filename=...
flexible
{ "blob_id": "e5bf57e7a171f7e42928b78d09dda7593a231cf9", "index": 9841, "step-1": "<mask token>\n\n\n@pytest.mark.django_db\nclass TestImage(TestCase):\n <mask token>\n <mask token>\n <mask token>\n\n def setUp(self):\n file1 = File(name='file1.jpg', file=BytesIO(b'abcdef'))\n attachment...
[ 2, 3, 4, 5, 6 ]
import os,sys import logging from flask import Flask from flask_bootstrap import Bootstrap from flask_sqlalchemy import SQLAlchemy def create_app(): app = Flask(__name__) Bootstrap(app) return app logging.basicConfig(level=logging.DEBUG) app = create_app() app.config['WTF_CSRF_ENABLED'] = True app.config[...
normal
{ "blob_id": "bd726c86bdecd0b63eb48d056932706d3ecf147d", "index": 7665, "step-1": "<mask token>\n\n\ndef create_app():\n app = Flask(__name__)\n Bootstrap(app)\n return app\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef create_app():\n app = Flask(__name__)\n Bootstrap(app)\n return ap...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> orange.eat() apple.eat() <|reserved_special_token_1|> from foods.fruits import * orange.eat() apple.eat()
flexible
{ "blob_id": "ad84a5bfcf82dff1f4a7e8f08f3c4243ad24de52", "index": 7318, "step-1": "<mask token>\n", "step-2": "<mask token>\norange.eat()\napple.eat()\n", "step-3": "from foods.fruits import *\norange.eat()\napple.eat()\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|> for j in range(1, 5): for k in range(1, 14): if j == 1: cardlist.append(['S', '{}'.format(k)]) elif j == 2: cardlist.append(['H', '{}'.format(k)]) elif j == 3: cardli...
flexible
{ "blob_id": "937a101cf5c7e943fc62d18b77357eea151fdfaf", "index": 7789, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor j in range(1, 5):\n for k in range(1, 14):\n if j == 1:\n cardlist.append(['S', '{}'.format(k)])\n elif j == 2:\n cardlist.append(['H', '{}'.for...
[ 0, 1, 2, 3 ]
""" table.py [-m] base1 base2 ... baseN Combines output from base1.txt, base2.txt, etc., which are created by the TestDriver (such as timcv.py) output, and displays tabulated comparison statistics to stdout. Each input file is represented by one column in the table. Optional argument -m shows a final column with the m...
normal
{ "blob_id": "4e94e9e2b45d3786aa86be800be882cc3d5a80b5", "index": 8328, "step-1": "<mask token>\n\n\ndef suck(f):\n hamdevall = spamdevall = 0.0, 0.0\n cost = 0.0\n bestcost = 0.0\n fp = 0\n fn = 0\n un = 0\n fpp = 0.0\n fnp = 0.0\n unp = 0.0\n htest = 0\n stest = 0\n get = f.r...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class CalibraterBase: def __init__(self, model_path: Union[str, Path], op_types_to_calibrate: Optional[Sequence[str]]=None, augmented_model_path= 'augmented_model.onnx', symmetric=False, use_external_data_format=False ): """ :param model_path: ...
flexible
{ "blob_id": "a61132d2d504ed31d4e1e7889bde670853968559", "index": 5739, "step-1": "<mask token>\n\n\nclass CalibraterBase:\n\n def __init__(self, model_path: Union[str, Path], op_types_to_calibrate:\n Optional[Sequence[str]]=None, augmented_model_path=\n 'augmented_model.onnx', symmetric=False, u...
[ 46, 56, 59, 60, 68 ]
from .parse_categories import extract_categories from .parse_sections import extract_sections from .utils import remove_xml_comments def parse_page(page): if 'redirect' in page.keys(): return page_text = page['revision']['text']['#text'] page_text = remove_xml_comments(page_text) title = page[...
normal
{ "blob_id": "0ad2e6d7e3fd61943fc1dfe6662110a6f48c1bd5", "index": 5347, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef parse_page(page):\n if 'redirect' in page.keys():\n return\n page_text = page['revision']['text']['#text']\n page_text = remove_xml_comments(page_text)\n title ...
[ 0, 1, 2 ]
from features.steps.web.test_home_page import * from features.steps.mobile.test_home_page import * from features.steps.web.test_login_page import *
normal
{ "blob_id": "b09d0806dfc6f4badfd9f2ac9c3f6d17d3df8e8c", "index": 3254, "step-1": "<mask token>\n", "step-2": "from features.steps.web.test_home_page import *\nfrom features.steps.mobile.test_home_page import *\nfrom features.steps.web.test_login_page import *\n", "step-3": null, "step-4": null, "step-5":...
[ 0, 1 ]
## This file is the celeryconfig for the Task Worker (scanworker). from scanworker.commonconfig import * import sys sys.path.append('.') BROKER_CONF = { 'uid' : '{{ mq_user }}', 'pass' : '{{ mq_password }}', 'host' : '{{ mq_host }}', 'port' : '5672', 'vhost' : '{{ mq_vhost }}', } BROKER_URL = 'amqp://...
normal
{ "blob_id": "1a569b88c350124968212cb910bef7b09b166152", "index": 8990, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append('.')\n<mask token>\n", "step-3": "<mask token>\nsys.path.append('.')\nBROKER_CONF = {'uid': '{{ mq_user }}', 'pass': '{{ mq_password }}', 'host':\n '{{ mq_host }}', '...
[ 0, 1, 2, 3, 4 ]
class Rational: def __init__(self, numer, denom): self.numer = numer self.denom = denom <|reserved_special_token_0|> <|reserved_special_token_0|> def __mul__(self, other): return Rational(self.numer * other.numer, self.denom * other.denom) <|reserved_special_token_0|> <...
flexible
{ "blob_id": "8098b9c27689dd4168ef05c03d4ec00f67f8090e", "index": 4771, "step-1": "class Rational:\n\n def __init__(self, numer, denom):\n self.numer = numer\n self.denom = denom\n <mask token>\n <mask token>\n\n def __mul__(self, other):\n return Rational(self.numer * other.numer...
[ 3, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class EPInfoLight(EP): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "e5abab3f718bbbd25dcfc49290383203d53248c3", "index": 9464, "step-1": "<mask token>\n\n\nclass EPInfoLight(EP):\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", "ste...
[ 1, 3, 4, 6, 8 ]
x = 5 y = x print(id(x)) print(id(y)) print() y = 3 print(id(x)) print(id(y)) print() z = [1, 4, 3, 25] w = z print(z) print(w) print(id(z)) print(id(w)) print() w[1] = 10 print(z) print(w) print(id(z)) print(id(w)) # So when you assign a mutable, you're actually assigning a reference to the mutable, # and I...
normal
{ "blob_id": "956adc5961188458393b56564649ad0a3a787669", "index": 7327, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(id(x))\nprint(id(y))\nprint()\n<mask token>\nprint(id(x))\nprint(id(y))\nprint()\n<mask token>\nprint(z)\nprint(w)\nprint(id(z))\nprint(id(w))\nprint()\n<mask token>\nprint(z)\nprin...
[ 0, 1, 2, 3 ]
import numpy as np import pickle import preprocessor import pandas as pd import sys from scipy import spatial class Predict: def __init__(self, text): """ taking the user input string loading trained feature numpy array loading the output for the numpy array loading the ve...
normal
{ "blob_id": "26df6ddf3533a8648b59f0fa2b03f89c93af7491", "index": 8154, "step-1": "<mask token>\n\n\nclass Predict:\n\n def __init__(self, text):\n \"\"\"\n taking the user input string\n loading trained feature numpy array\n loading the output for the numpy array\n loading t...
[ 3, 4, 5, 6 ]
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() from django.conf import settings from django.conf.urls.static import static from django.contrib.staticfiles.urls import staticfiles_urlpatterns from dajaxice.co...
normal
{ "blob_id": "68a503b2a94304530e20d79baf9fb094024ba67e", "index": 539, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.autodiscover()\n<mask token>\ndajaxice_autodiscover()\n<mask token>\nurlpatterns += staticfiles_urlpatterns()\nurlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 3.2.8 on 2021-10-20 08:25 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('app', '0006_auto_20211020_0817'), ] operations = [ migrations.AlterModelOptions( name='currencies', options={'verbose_name':...
normal
{ "blob_id": "a6cc0078fb37f9c63e119046193f521290c9fb21", "index": 4634, "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 = [('app', '0006...
[ 0, 1, 2, 3, 4 ]
import urllib.request from urllib.request import Request, urlopen import json from requests import get from requests.exceptions import RequestException from contextlib import closing from bs4 import BeautifulSoup """ Web Scraper ====================================================================== """ ...
normal
{ "blob_id": "4c9a3983180cc75c39da41f7f9b595811ba0dc35", "index": 8390, "step-1": "<mask token>\n\n\ndef simple_get(url):\n \"\"\"\n Attempts to get the content at `url` by making an HTTP GET request.\n If the content-type of response is some kind of HTML/XML, return the\n text content, otherwise retu...
[ 5, 6, 7, 8, 9 ]
# 1.闭包 # 2.装饰圈初识 # 3.标准版装饰器
normal
{ "blob_id": "a1ebb00d7cda65cb528b2253e817d925214cdce3", "index": 5847, "step-1": "# 1.闭包\n# 2.装饰圈初识\n# 3.标准版装饰器", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 1 ] }
[ 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: x, y, z = mc.player.getTilePos() color = random.randrange(0, 9) mc.setBlock(x, y, z - 1, 38, color) time.sleep(0.01) <|reserved_special_token_1|> from mcpi.minecraft import Minecraft import random, t...
flexible
{ "blob_id": "a2e00af84f743e949b53840ae6d5509e08935486", "index": 7978, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n x, y, z = mc.player.getTilePos()\n color = random.randrange(0, 9)\n mc.setBlock(x, y, z - 1, 38, color)\n time.sleep(0.01)\n", "step-3": "from mcpi.minecraft i...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(numbers + new_numbers) print(numbers * 5) <|reserved_special_token_1|> numbers = [1, 1, 1, 1, 1] new_numbers = [2, 2, 2, 3, 3] print(numbers + new_numbers) print(numbers * 5)
flexible
{ "blob_id": "843df062702c9abf34cf14d911d927d786f1d912", "index": 1573, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(numbers + new_numbers)\nprint(numbers * 5)\n", "step-3": "numbers = [1, 1, 1, 1, 1]\nnew_numbers = [2, 2, 2, 3, 3]\nprint(numbers + new_numbers)\nprint(numbers * 5)\n", "step-4"...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Binding: def __init__(self, parent, binding): self.parent = parent self.binding = binding <|reserved_special_token_0|> def add(self, var_name, value): self.binding[var_name] = value <|reserved_special_token_0|> class FunctionCall: def...
flexible
{ "blob_id": "5fa91a5061a5e87a4a2b8fece0378299e87e5a48", "index": 6694, "step-1": "<mask token>\n\n\nclass Binding:\n\n def __init__(self, parent, binding):\n self.parent = parent\n self.binding = binding\n <mask token>\n\n def add(self, var_name, value):\n self.binding[var_name] = v...
[ 42, 50, 56, 68, 73 ]
''' Created on Nov 16, 2013 @author: mo ''' import unittest from Board import TicTacToe_Board from ComputerPlayer import ComputerPlayer from utils import debug_print as d_pr from main import StartNewGame class Test(unittest.TestCase): def setUp(self): self.the_board = TicTacToe_Board() de...
normal
{ "blob_id": "1968923cd923e68dc5ff2148802f18e40a5e6c33", "index": 939, "step-1": "<mask token>\n\n\nclass Test(unittest.TestCase):\n <mask token>\n\n def tearDown(self):\n pass\n\n def test_these_should_win_for_x(self):\n self.assertEqual(TicTacToe_Board.IsWinningBoard_static([['x', 'x',\n ...
[ 9, 12, 13, 14, 16 ]
import matplotlib.pyplot as plt import numpy as np plt.rcParams['savefig.dpi'] = 300 #图片像素 plt.rcParams['figure.dpi'] = 300 #分辨率 plt.rcParams['font.sans-serif']=['SimHei'] plt.rcParams['axes.unicode_minus'] = False x_axis = [20,40,60,80,100] rf = [184,174,166,159,157.5] anns = [186,179,170,164,161] adaboost = [187.5,1...
normal
{ "blob_id": "13342922022f0a0e8928c81c1c4716125af0b2c4", "index": 418, "step-1": "<mask token>\n", "step-2": "<mask token>\nax.set_xticks(x + width / 2)\nax.set_xticklabels(x_axis)\nplt.legend((p_rf[0], p_anns[0], p_adaboost[0]), ('RF', 'ANNs', 'AdaBoost'),\n loc='best', fontsize=20)\nplt.xticks(fontsize=18)...
[ 0, 1, 2, 3, 4 ]
from typing import Dict, List pilha = list() print(pilha)
normal
{ "blob_id": "f3f3bbb715f16dc84221f3349aa5f26e9a6dc7c8", "index": 2726, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(pilha)\n", "step-3": "<mask token>\npilha = list()\nprint(pilha)\n", "step-4": "from typing import Dict, List\npilha = list()\nprint(pilha)\n", "step-5": null, "step-ids": [...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def getData(): power_file = './data/power_20210129_20210429_preprocess_1hour' power_df = read_csv(power_file + '.csv', encoding='CP949', converters={ 'date': int}) print(power_df.shape) sensor_file = 'data/sensor_20210129_20210429_preprocess_1hour' sensor_df = ...
flexible
{ "blob_id": "013189cd67cc44efd539c75ed235a0753d95f54e", "index": 2165, "step-1": "<mask token>\n\n\ndef getData():\n power_file = './data/power_20210129_20210429_preprocess_1hour'\n power_df = read_csv(power_file + '.csv', encoding='CP949', converters={\n 'date': int})\n print(power_df.shape)\n ...
[ 1, 2, 3, 4, 5 ]
""" Templating support library and renderer configuration. """ from restish import templating class Templating(templating.Templating): """ Application-specific templating implementation. Overriding "args" methods makes it trivial to push extra, application-wide data to the templates without any assis...
normal
{ "blob_id": "18391df9a3e52400fe4fc54d6381b9ce21e25f0b", "index": 2296, "step-1": "<mask token>\n\n\nclass Templating(templating.Templating):\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Templating(templating.Templating):\n \"\"\"\n Application-specific temp...
[ 1, 3, 4, 5, 6 ]
class Day8MemoryManeuver: def __init__(self, use_reference_count=False): """ Args: use_reference_count (bool): True: If an entry has child nodes, the meta data are referring to the results of the child node False: Sum all meta data up ...
normal
{ "blob_id": "84d096a51fa052ee210e975ab61c0cbbf05bc5ae", "index": 8358, "step-1": "class Day8MemoryManeuver:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class Day8MemoryManeuver:\n <mask token>\n <mask token>\n\n def _solve(self, structure, pos):\n if pos >= len(structur...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def print_theta(theta, name='theta'): theta_pd = pd.DataFrame(theta.reshape(1, -1), index=[name], columns=[ 'mean', 'variance', 'max_range', 'min_range', 'anisotropy', 'head_west']) print(theta_pd) <|reserved_special_token_0|> def visualize_one_m(m, vmin=-4, vm...
flexible
{ "blob_id": "09fb99a15c2727da2ef96028aca5513337449f62", "index": 3772, "step-1": "<mask token>\n\n\ndef print_theta(theta, name='theta'):\n theta_pd = pd.DataFrame(theta.reshape(1, -1), index=[name], columns=[\n 'mean', 'variance', 'max_range', 'min_range', 'anisotropy',\n 'head_west'])\n pri...
[ 11, 13, 17, 19, 20 ]
class Tool: <|reserved_special_token_0|> def __repr__(self): return f'Tool({self.name!r},{self.weight})' <|reserved_special_token_0|> <|reserved_special_token_1|> class Tool: def __init__(self, name, weight): self.name = name self.weight = weight def __repr__(self): ...
flexible
{ "blob_id": "173b8e66ead62e3aa70805e42e06ea05257d5ee2", "index": 2965, "step-1": "class Tool:\n <mask token>\n\n def __repr__(self):\n return f'Tool({self.name!r},{self.weight})'\n\n\n<mask token>\n", "step-2": "class Tool:\n\n def __init__(self, name, weight):\n self.name = name\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def open_dir(input_path, patterns): """ Opens the specified input path and returns any located excel file :param patterns: the file extensions to glob over (eg xls, csv) :param input_path: the starting path :return: generator of all found files """ for ext in p...
flexible
{ "blob_id": "f831b77850dfe22232092f66705e36970828a75b", "index": 4975, "step-1": "<mask token>\n\n\ndef open_dir(input_path, patterns):\n \"\"\"\n Opens the specified input path and returns any located excel file\n :param patterns: the file extensions to glob over (eg xls, csv)\n :param input_path: t...
[ 1, 2, 3, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(kwadraty, slownik, sep='\n') <|reserved_special_token_1|> lista = [x for x in range(11)] kwadraty = [(i ** 2) for i in lista] kwadraty = [(i, i ** 2, i ** 3) for i in range(-10, 11)] zbior_wyr = {'aa', '1233', '111111'} s...
flexible
{ "blob_id": "248b9b9d613f71e0130353f0792083b7d3f6ccd6", "index": 7000, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(kwadraty, slownik, sep='\\n')\n", "step-3": "lista = [x for x in range(11)]\nkwadraty = [(i ** 2) for i in lista]\nkwadraty = [(i, i ** 2, i ** 3) for i in range(-10, 11)]\nzbior_...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Category(Enum): ONES = 1 TWOS = 2 THREES = 3 FOURS = 4 FIVES = 5 SIXES = 6 YACHT = auto() FULL_HOUSE = auto() FOUR_OF_A_KIND = auto() LITTLE_STRAIGHT = auto() BIG_STRAIGHT = auto...
flexible
{ "blob_id": "40bc8122d98d407341a56251f9abfab019e0acd8", "index": 625, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Category(Enum):\n ONES = 1\n TWOS = 2\n THREES = 3\n FOURS = 4\n FIVES = 5\n SIXES = 6\n YACHT = auto()\n FULL_HOUSE = auto()\n FOUR_OF_A_KIND = auto()...
[ 0, 2, 3, 4 ]
__author__ = 'xcbtrader' # -*- coding: utf-8 -*- from bitcoin import * def crear_addr_word(word): priv = sha256(word) pub = privtopub(priv) addr = pubtoaddr(pub) wif = encode_privkey(priv, 'wif') return addr, priv, wif word = input('Entra la palabra para crear direccion bitcoin:? ') addr, priv, wif = crear_addr...
normal
{ "blob_id": "cc7a44754dc1371733420fd3a1e51ab6b5e7c4d8", "index": 6898, "step-1": "<mask token>\n\n\ndef crear_addr_word(word):\n priv = sha256(word)\n pub = privtopub(priv)\n addr = pubtoaddr(pub)\n wif = encode_privkey(priv, 'wif')\n return addr, priv, wif\n\n\n<mask token>\n", "step-2": "<mask...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def test_line(): p1 = [0, 0, 0] p2 = [1, 0, 0] line = Line(p1, p2) assert line.start == p1 assert line.end == p2 <|reserved_special_token_0|> def test___getitem__(): p1 = [0, 0, 0] p2 = [1, 0, 0] line = Line(p1, p2) assert line[0] == p1 assert l...
flexible
{ "blob_id": "03629e62b11e66eeb0e111fee551c75c8463cbb8", "index": 1059, "step-1": "<mask token>\n\n\ndef test_line():\n p1 = [0, 0, 0]\n p2 = [1, 0, 0]\n line = Line(p1, p2)\n assert line.start == p1\n assert line.end == p2\n\n\n<mask token>\n\n\ndef test___getitem__():\n p1 = [0, 0, 0]\n p2 ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def find_lt(a, x): """ Find rightmost value less than x in list a Input: list a and value x Output: rightmost value less than x in a """ i = bisect_left(a, x) if i: return a[i - 1] raise ValueError def find_ge(a, x): """ Find leftmost item...
flexible
{ "blob_id": "da751e96c225ebc2d30f3cce01ba2f64d0a29257", "index": 3763, "step-1": "<mask token>\n\n\ndef find_lt(a, x):\n \"\"\"\n Find rightmost value less than x in list a\n Input: list a and value x\n Output: rightmost value less than x in a\n \"\"\"\n i = bisect_left(a, x)\n if i:\n ...
[ 7, 8, 9, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: if os.environ.get('DEBUG'): import settings_local as settings else: import settings_prod as settings except ImportError: import settings <|reserved_special_token_0|> if redis_env: redis = Redis...
flexible
{ "blob_id": "4c3a27bf1f7e617f4b85dc2b59efa184751b69ac", "index": 3868, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n if os.environ.get('DEBUG'):\n import settings_local as settings\n else:\n import settings_prod as settings\nexcept ImportError:\n import settings\n<mask toke...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('your name is:' + x) print(p) <|reserved_special_token_1|> x = str(input('please input your name:')) y = int(input('please input your age:')) p = int(2017 - y + 100) print('your name is:' + x) print(p) <|reserved_specia...
flexible
{ "blob_id": "929f580e8e559f8309e19f72208bf4ff0d537668", "index": 4935, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('your name is:' + x)\nprint(p)\n", "step-3": "x = str(input('please input your name:'))\ny = int(input('please input your age:'))\np = int(2017 - y + 100)\nprint('your name is:' +...
[ 0, 1, 2, 3 ]
date = input() if date == ("DEC 25") or date == ("OCT 31"): print("yup") else: print("nope")
normal
{ "blob_id": "bc5b368a710b8dfc4492b996c42c46638e1f538c", "index": 9811, "step-1": "<mask token>\n", "step-2": "<mask token>\nif date == 'DEC 25' or date == 'OCT 31':\n print('yup')\nelse:\n print('nope')\n", "step-3": "date = input()\nif date == 'DEC 25' or date == 'OCT 31':\n print('yup')\nelse:\n ...
[ 0, 1, 2, 3 ]
import math def vol_shell(r1, r2): a=abs((4/3)*math.pi*((r1**3)-(r2**3))) return round(a,3) print(vol_shell(3,3))
normal
{ "blob_id": "cd234911c1f990b8029dfa792d132847bf39a6aa", "index": 445, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef vol_shell(r1, r2):\n a = abs(4 / 3 * math.pi * (r1 ** 3 - r2 ** 3))\n return round(a, 3)\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef vol_shell(r1, r2):\n a = ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class AppData: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_sp...
flexible
{ "blob_id": "7be54b2bd99680beed3e8e9cb14225756a71a4ea", "index": 1135, "step-1": "<mask token>\n\n\nclass AppData:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass AppData:\n\n def __init__(se...
[ 1, 5, 8, 9, 10 ]
import random from common.ast import * from mutate.mutate_ctrl import * def _check_parent_type(node, nodes, types): par = node while(nodes[par] != None): par = nodes[par] if type(par) in types: return True return False def mutate_operator(root, nodes, path): candidates = [...
normal
{ "blob_id": "c0524301a79788aa34a039fc46799021fb45362c", "index": 7141, "step-1": "<mask token>\n\n\ndef mutate_operator(root, nodes, path):\n candidates = [node for node in nodes.keys() if type(node) in OP_TYPES.\n keys() and _check_parent_type(node, nodes, OP_PARENT_TYPES)]\n if len(candidates) == ...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 13 17:34:32 2019 @author: fanlizhou Analyze codon usage of sequence from 'SP_gene_seq.txt' and 'LP_gene_seq.txt' Plot heatmap of amino acid usage and codon usage Plot codon usage in each gene for each amino acid. Genes were arranged so that the ge...
normal
{ "blob_id": "ae7a2de8742e353818d4f5a28feb9bce04d787bb", "index": 8382, "step-1": "<mask token>\n\n\ndef parse_args():\n parser = argparse.ArgumentParser(description=\n 'Analyze codon usage of SP and LP\\n')\n parser.add_argument('sp_file', help='one input SP data file\\n')\n parser.add_argument('...
[ 11, 13, 16, 20, 21 ]
<|reserved_special_token_0|> class KnowValues(unittest.TestCase): def test_ls_contributing(self): """ To test the list of contributing centers """ sv = nao(gto=mol) pb = prod_basis() pb.sv = sv pb.sv.ao_log.sp2rcut[0] = 10.0 pb.prod_log = sv.ao_log pb.prod_...
flexible
{ "blob_id": "f82ddc34fde76ddfbbe75116526af45b83c1b102", "index": 7895, "step-1": "<mask token>\n\n\nclass KnowValues(unittest.TestCase):\n\n def test_ls_contributing(self):\n \"\"\" To test the list of contributing centers \"\"\"\n sv = nao(gto=mol)\n pb = prod_basis()\n pb.sv = sv...
[ 2, 3, 4, 5, 6 ]
__author__ = 'mvoronin'
normal
{ "blob_id": "e5a7b0cbc82b57578f6dcbf676e8f589c6e9ac1b", "index": 5663, "step-1": "<mask token>\n", "step-2": "__author__ = 'mvoronin'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from pyzabbix import ZabbixMetric, ZabbixSender, ZabbixAPI from datetime import datetime from re import findall # current_time = datetime.now().strftime("%H:%M:%S %d.%m.%Y") class ZabbixItem(): def __init__(self, user, password, ext_group, ext_template, zabbix_host): self.user = user self.passwor...
normal
{ "blob_id": "14826b5b121ba2939519492c1e1d8700c32396d2", "index": 8963, "step-1": "<mask token>\n\n\nclass ZabbixItem:\n\n def __init__(self, user, password, ext_group, ext_template, zabbix_host):\n self.user = user\n self.password = password\n self.zabbix_host = zabbix_host\n self....
[ 6, 8, 9, 11, 12 ]
#!/usr/bin/env python3 """ Python class to access Netonix® WISP Switch WebAPI ** NEITHER THIS CODE NOR THE AUTHOR IS ASSOCIATED WITH NETONIX® IN ANY WAY.** This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software,...
normal
{ "blob_id": "743d261052e4532c1304647501719ad897224b4e", "index": 8991, "step-1": "<mask token>\n\n\nclass Netonix:\n <mask token>\n\n def _get(self, url, params=None, timeout=15, **kwargs):\n full_url = 'https://' + self.ip + self.url[url]\n return self.s.get(full_url, params=params, timeout=...
[ 9, 11, 13, 14, 20 ]
import tensorflow as tf import numpy as np import math import sys import os import numpy as np BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(BASE_DIR) sys.path.append(os.path.join(BASE_DIR, '../utils')) import tf_util # from transform_nets import input_transform_net, feature_transform_net import...
normal
{ "blob_id": "e4a0f26afe8c78e4abbd85834c96ed5ba84e1f0b", "index": 3894, "step-1": "<mask token>\n\n\nclass Network:\n\n def placeholder_inputs(self, batch_size, num_point):\n source_pointclouds_pl = tf.placeholder(tf.float32, shape=(\n batch_size, num_point, 3))\n return source_pointcl...
[ 4, 6, 7, 8, 9 ]
""" It's annoying that we have to do it here but for something like Ant, we're not going to be able to specify it easily inside of the rbf_hyper_parameters file. Because, for something like Ant, we have 2 COM dimensions, and Bipedal we have 1. So, we're going to do something similar to shaping_functions. The way it'...
normal
{ "blob_id": "5529813e10e4a30a60c28242be9d1a8822fb58af", "index": 9685, "step-1": "<mask token>\n\n\ndef action_scaling(env, action_scaler):\n \"\"\"\n This is actually going to just be \"action scaling\". Because,\n it's all about the ratio, and the ratio doesn't change!\n \"\"\"\n try:\n s...
[ 3, 4, 6, 7, 8 ]
import sys import urllib import urlparse import xbmcgui import xbmcplugin import xbmcaddon import shutil from shutil import copyfile base_url = sys.argv[0] addon_handle = int(sys.argv[1]) args = urlparse.parse_qs(sys.argv[2][1:]) addon = xbmcaddon.Addon() xbmcplugin.setContent(addon_handle, 'videos') ...
normal
{ "blob_id": "15bcfd8859322034ec76a8c861d2151153ab54af", "index": 5120, "step-1": "import sys\r\nimport urllib\r\nimport urlparse\r\nimport xbmcgui\r\nimport xbmcplugin\r\nimport xbmcaddon\r\nimport shutil\r\nfrom shutil import copyfile\r\n\r\nbase_url = sys.argv[0]\r\naddon_handle = int(sys.argv[1])\r\nargs = u...
[ 0 ]
<|reserved_special_token_0|> class Item: <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, barcode): self.barcode = barcode self.marc = None self.record = None self.title = None self.author = None self.year = None def _get_ma...
flexible
{ "blob_id": "abfff0901e5f825a473119c93f53cba206609428", "index": 7482, "step-1": "<mask token>\n\n\nclass Item:\n <mask token>\n <mask token>\n\n def __init__(self, barcode):\n self.barcode = barcode\n self.marc = None\n self.record = None\n self.title = None\n self.au...
[ 6, 7, 8, 11, 12 ]
# Generated by Django 2.1.7 on 2019-03-23 17:14 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('currency_exchange', '0007_auto_20190323_1751'), ] operations = [ migrations.AddField( model_name='tasks', name='hour...
normal
{ "blob_id": "1f63ce2c791f0b8763aeae15df4875769f6de848", "index": 4942, "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 = [('currency_ex...
[ 0, 1, 2, 3, 4 ]
old_file = open("new.csv", "r") new_file = open("new1,csv", "w") for line in old_file.readlines(): cleaned_line =line.replace(',','.') new_file.write(cleaned_line) old_file.close new_file.close
normal
{ "blob_id": "b3d26d01d45c073192d06c8e94c06f7eae267b14", "index": 968, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in old_file.readlines():\n cleaned_line = line.replace(',', '.')\n new_file.write(cleaned_line)\nold_file.close\nnew_file.close\n", "step-3": "old_file = open('new.csv', '...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def bubbleSort(arr): k = len(arr) for i in range(k): for j in range(0, k - i - 1): if arr[j] > arr[j + 1]: arr[j], arr[j + 1] = arr[j + 1], arr[j] <|reserved_special_token_0|> <|reserved_special_token_1|> def b...
flexible
{ "blob_id": "178f9dcd9cbea140abebd509b56979417b5d7503", "index": 6785, "step-1": "<mask token>\n", "step-2": "def bubbleSort(arr):\n k = len(arr)\n for i in range(k):\n for j in range(0, k - i - 1):\n if arr[j] > arr[j + 1]:\n arr[j], arr[j + 1] = arr[j + 1], arr[j]\n\n\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class User(AbstractUser): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Profile(models.Model): ...
flexible
{ "blob_id": "360813a573f672e3ec380da4237a6e131dbcb7e6", "index": 2345, "step-1": "<mask token>\n\n\nclass User(AbstractUser):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Profile(models.Model):\n \"\"\"Profile model\"\...
[ 5, 6, 8, 9, 10 ]
from rest_framework import serializers from .models import Good, Favorite, Comment class GoodSerializer(serializers.ModelSerializer): class Meta: model = Good fields = ('user', 'article', 'created_at') class FavoriteSerializer(serializers.ModelSerializer): class Meta: model = Favori...
normal
{ "blob_id": "fc8b9029955de6b11cbfe8e24107c687f49685c1", "index": 9179, "step-1": "<mask token>\n\n\nclass CommentSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = Comment\n fields = 'text', 'image', 'user', 'article', 'created_at'\n", "step-2": "<mask token>\n\n\nclass Favor...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Post(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __str__(self): return '{}'.format(self.title) <|reserved_special_token_1|> <|r...
flexible
{ "blob_id": "4fa9c00a07c8263a6a3afd460b84f21637a771ec", "index": 3081, "step-1": "<mask token>\n\n\nclass Post(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return '{}'.format(self.title)\n", "step-2": "<mask token>\n...
[ 2, 3, 4, 5, 6 ]
from django.contrib import admin from .models import StoreId # Register your models here. class StoreIdAdmin(admin.ModelAdmin): list_display = ('userid', 'aladin_id', 'yes24_id', 'ridibooks_id', 'start_date', 'end_date') search_fields = ['userid', 'aladin_id', 'yes24_id', 'ridibooks_id'] admin.site.register(S...
normal
{ "blob_id": "6475fd59ba2414ea9a174297a8d94e5a2e0a7d8f", "index": 3783, "step-1": "<mask token>\n\n\nclass StoreIdAdmin(admin.ModelAdmin):\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass StoreIdAdmin(admin.ModelAdmin):\n list_display = ('userid', 'aladin_id', 'yes...
[ 1, 2, 3, 4, 5 ]
import math def sieve(limit): ans = [] a = [1] * limit a[0] = a[1] = 0 for i in range(2, limit): if a[i] == 0: continue ans.append(i) for j in range(i*i, limit, i): a[j] = 0; return ans is_square = lambda x: int(math.sqrt(x) + 1e-9) ** 2 == x N = 10...
normal
{ "blob_id": "ff6dc347637a81c9f6a541775646b4901d719790", "index": 9478, "step-1": "<mask token>\n\n\ndef sieve(limit):\n ans = []\n a = [1] * limit\n a[0] = a[1] = 0\n for i in range(2, limit):\n if a[i] == 0:\n continue\n ans.append(i)\n for j in range(i * i, limit, i)...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class FormulaTemplate: def __init__(self, vi, w, k, h, m, timeout=3000000): self.k = k self.h = h self.m = m self.w = w self.vi = vi n = len(vi) self.n = n self.aeij = [[Int('ae' + str(i) + str(j)) for j in range(n)] for...
flexible
{ "blob_id": "81fce5314a7611de11648e412151112e29271871", "index": 4626, "step-1": "<mask token>\n\n\nclass FormulaTemplate:\n\n def __init__(self, vi, w, k, h, m, timeout=3000000):\n self.k = k\n self.h = h\n self.m = m\n self.w = w\n self.vi = vi\n n = len(vi)\n ...
[ 11, 14, 15, 16, 22 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def solution(a, b): answer = 0 for i in range(0, len(a)): answer += a[i] * b[i] print(answer) return answer <|reserved_special_token_0|> <|reserved_special_token_1|> def solution(a, b): answer = 0 for i in range(0, len(a))...
flexible
{ "blob_id": "5fd34c698c2060d5399ba43f6746527961aa574b", "index": 9239, "step-1": "<mask token>\n", "step-2": "def solution(a, b):\n answer = 0\n for i in range(0, len(a)):\n answer += a[i] * b[i]\n print(answer)\n return answer\n\n\n<mask token>\n", "step-3": "def solution(a, b):\n answ...
[ 0, 1, 2, 3 ]
#coding=utf-8 # ycat 2017-10-20 create # AGV的控制 import sys,os import json import setup if __name__ == '__main__': setup.setCurPath(__file__) import utility import enhance import threading import time import log import re import lock import json_codec import driver.agv.hdcAgvApi as api g_threads =[] g_carts = No...
normal
{ "blob_id": "e2feb12b88babbbfa4cc8447c91e8a5b6c30f78b", "index": 1466, "step-1": "<mask token>\n\n\n@utility.init()\ndef init():\n if utility.is_test():\n return\n api.init()\n time.sleep(3)\n\n\ndef wait():\n global g_threads\n for t in g_threads:\n t.join()\n g_threads.clear()\n...
[ 26, 29, 30, 34, 38 ]
<|reserved_special_token_0|> class DeathsByEthnicity(PowerBiQuerier): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class DeathsByEthnicity(PowerBiQuerier): <|reserved_special_token_0|> def _parse_data(self, response_json: Dic...
flexible
{ "blob_id": "d975b74370acc72101f808e70bef64cee39a5ab8", "index": 6204, "step-1": "<mask token>\n\n\nclass DeathsByEthnicity(PowerBiQuerier):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass DeathsByEthnicity(PowerBiQuerier):\n <mask token>\n\n def _parse_data(self, response_json...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def sum_series(n, x=0, y=1): """sum_series returns the nth number of the Fibonacci, the Lucas sequence or the Foo sequence where the first position is indexed at 0. Arguments x and y as integers are optional...
flexible
{ "blob_id": "ca75e23d91eef8a5c5b78c0ea7c903b80640af25", "index": 7957, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef sum_series(n, x=0, y=1):\n \"\"\"sum_series returns the nth number of the Fibonacci, the Lucas sequence\n or the Foo sequence where the first position is indexed at 0. ...
[ 0, 1, 2, 3, 4 ]
import csv import os import requests from bs4 import BeautifulSoup # open html file and parsing lxml with open ('/Users/neeraj.joshi/Downloads/index.html') as html_file: soup = BeautifulSoup(html_file, 'lxml') #row = soup.find_all('tr') #column = row.find_all('td') #print(soup) # create a file by any name and in o...
normal
{ "blob_id": "47be41bd5838b828acdc90c3ef5abdeec9da1e85", "index": 1579, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('/Users/neeraj.joshi/Downloads/index.html') as html_file:\n soup = BeautifulSoup(html_file, 'lxml')\n<mask token>\nfor tree in soup.find_all('tr'):\n data = []\n for to...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python from collections import defaultdict from cluster.common import Cluster from cluster.tools import print_table def check_status(args): """ Print node details :param args: Arguments from argparse :type args: argparse.Namespace """ cluster = Cluster(jobs_qstat=True, nodes=True,...
normal
{ "blob_id": "381b59ab9fa85561932a9bfb9ab8cef635901a35", "index": 7249, "step-1": "<mask token>\n\n\ndef main():\n \"\"\" Execute main program\n \"\"\"\n import argparse\n parser = argparse.ArgumentParser(description='Check nodes status.')\n parser.add_argument('-o', '--show-job-owners', action='st...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/python # coding=utf8 # author: Sun yang import running if __name__ == '__main__': running.go()
normal
{ "blob_id": "12442e4debc7fbf102ab88b42464f4ca8eb91351", "index": 8454, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n running.go()\n", "step-3": "import running\nif __name__ == '__main__':\n running.go()\n", "step-4": "#!/usr/bin/python\r\n# coding=utf8\r\n# author:...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class FlatbuffersConversionData(object): """Holds data needed to convert a set of json files to flatbuffer binaries. Attributes: schema: The path to the flatbuffer schema file. input_files: A list of input files to convert. output_path: The path to the output directory ...
flexible
{ "blob_id": "4989db28db0f823a54ff0942fbc40fc4640da38f", "index": 3224, "step-1": "<mask token>\n\n\nclass FlatbuffersConversionData(object):\n \"\"\"Holds data needed to convert a set of json files to flatbuffer binaries.\n\n Attributes:\n schema: The path to the flatbuffer schema file.\n input_files: ...
[ 15, 18, 20, 22, 25 ]
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.feature_extraction.text import CountVectorizer from sklearn.decomposition import TruncatedSVD from sklearn.metrics.pairwise import cosine_similarity def get_df_4_model(user_id, n_recommendations = 20000): '''this func...
normal
{ "blob_id": "5c8de06176d06c5a2cf78ac138a5cb35e168d617", "index": 5122, "step-1": "<mask token>\n\n\ndef get_df_4_model(user_id, n_recommendations=20000):\n \"\"\"this function generates the latent dataframes used for the prediction model\"\"\"\n print('Generating dataframe for recommendation model')\n r...
[ 3, 4, 5, 6, 7 ]
#Una empresa les paga a sus empleados con base en las horas trabajadas en la semana. #Realice un algoritmo para determinar el sueldo semanal de N trabajadores #y, además, calcule cuánto pagó la empresa por los N empleados. base = int(input("Dinero por hora trabajada: ")) emp = int(input("Dime el nº de empleados...
normal
{ "blob_id": "963e736fd4a942fb1c51e1e0a357ad6be48aed9a", "index": 5985, "step-1": "\r\n#Una empresa les paga a sus empleados con base en las horas trabajadas en la semana.\r\n#Realice un algoritmo para determinar el sueldo semanal de N trabajadores\r\n#y, además, calcule cuánto pagó la empresa por los N empleados...
[ 0 ]
<|reserved_special_token_0|> class StrComparison(MethodResource, Resource): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class StrComparison(MethodResource, Resource): def get(self, domain): domain_found = '' similar = False for row in df...
flexible
{ "blob_id": "6d974580ff546bda17caa1e61e2621b4bc705f3f", "index": 2952, "step-1": "<mask token>\n\n\nclass StrComparison(MethodResource, Resource):\n <mask token>\n", "step-2": "<mask token>\n\n\nclass StrComparison(MethodResource, Resource):\n\n def get(self, domain):\n domain_found = ''\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class NeuralNetwork: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def withSeed(self, seed): self.seed = seed return self <|reserved_special_token_0|> def withMinErrorPercen...
flexible
{ "blob_id": "0af45914c8c111a42b0b9684f5f0ee19ef5eeb70", "index": 7548, "step-1": "<mask token>\n\n\nclass NeuralNetwork:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def withSeed(self, seed):\n self.seed = seed\n return self\n <mask token>\n\n def withMinErro...
[ 7, 12, 13, 14, 19 ]
<|reserved_special_token_0|> def mapfn(k, v): for w in v.split(): yield w, 1 def reducefn(k, vs): result = 0 for v in vs: result += v return result <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def mapfn(k, v): for w in v.split(): ...
flexible
{ "blob_id": "09c6dd0f32b8d71dacdd8b10d995ea1575f91f6f", "index": 2887, "step-1": "<mask token>\n\n\ndef mapfn(k, v):\n for w in v.split():\n yield w, 1\n\n\ndef reducefn(k, vs):\n result = 0\n for v in vs:\n result += v\n return result\n\n\n<mask token>\n", "step-2": "<mask token>\n\n...
[ 2, 3, 4, 5, 6 ]
import time inputStr = """crruafyzloguvxwctqmphenbkd srcjafyzlcguvrwctqmphenbkd srijafyzlogbpxwctgmphenbkd zrijafyzloguvxrctqmphendkd srijabyzloguvowcqqmphenbkd srijafyzsoguvxwctbmpienbkd srirtfyzlognvxwctqmphenbkd srijafyzloguvxwctgmphenbmq senjafyzloguvxectqmphenbkd srijafyeloguvxwwtqmphembkd srijafyzlogurxtctqmpken...
normal
{ "blob_id": "9620479e9ac27c1c7833c9a31b9cb18408b8d361", "index": 4019, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor string in inputList:\n hasDoubleDupes = False\n hasTripleDupes = False\n for char in string:\n numRepeatsChar = string.count(char)\n if numRepeatsChar == 2 and ...
[ 0, 1, 2, 3, 4 ]
DEFAULT_SERVER_LISTEN_PORT = 2011 DEFAULT_CLIENT_LISTEN_PORT = 2012 import pickle import socket from player import Player from averageddata import * import zlib import g import pygame from collections import defaultdict from periodic import Periodic import random from projectile import Projectile TICKTIME = 0.05 cla...
normal
{ "blob_id": "b7be9fd366d03068a5d6c3cee703d579b9866fd3", "index": 7992, "step-1": "DEFAULT_SERVER_LISTEN_PORT = 2011\nDEFAULT_CLIENT_LISTEN_PORT = 2012\n\nimport pickle\nimport socket\nfrom player import Player\nfrom averageddata import *\nimport zlib\nimport g\nimport pygame\nfrom collections import defaultdict\...
[ 0 ]
from db import do_command, do_command_no_return, do_insert def get_grocery(upc): cmd = "SELECT name FROM grocery WHERE upc = ?" rtVal = do_command(cmd, [upc]) length = len(rtVal) if length > 0: return {'success': bool(len(rtVal)), 'grocery': rtVal[0]} return {'success': bool(len(rtVal))...
normal
{ "blob_id": "92b24fe82929ed4590e5350188673c2245136d03", "index": 5554, "step-1": "<mask token>\n\n\ndef get_grocery_id(upc):\n cmd = 'SELECT id FROM grocery WHERE upc = ?'\n rtVal = do_command(cmd, [upc])\n if len(rtVal) > 0:\n return rtVal[0]['id']\n else:\n return -1\n\n\n<mask token>...
[ 3, 5, 6, 9, 10 ]
# Generated from /home/mridul/PycharmProjects/BTP_2k18-19/PlSql.g4 by ANTLR 4.7.2 from antlr4 import * from io import StringIO from typing.io import TextIO import sys def serializedATN(): with StringIO() as buf: buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\u020e") buf.write("\u...
normal
{ "blob_id": "b6dbed95b321ac93c712c4735d601a00650b8dc4", "index": 1552, "step-1": "<mask token>\n\n\nclass PlSqlLexer(Lexer):\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 <ma...
[ 1, 3, 4, 5, 6 ]
class Classifier(object): """ Trained classifier """ def __init__(self, classifier, scaler, orient, color_space, pix_per_cell, cell_per_block, spatial_size, hist_bins): """ Initializes an instance. Parameters ---------- classifier : Trained SciPy classif...
normal
{ "blob_id": "9188d58a6d9e832b8908b823d57249fcdd80ff51", "index": 171, "step-1": "<mask token>\n", "step-2": "class Classifier(object):\n <mask token>\n <mask token>\n", "step-3": "class Classifier(object):\n <mask token>\n\n def __init__(self, classifier, scaler, orient, color_space,\n pix...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @register.simple_tag def random_quote(): """Returns a random quote to be displayed on the community sandwich page""" quotes = [ """Growth is never by mere chance; it is the result of forces working together. -Jam...
flexible
{ "blob_id": "6e73625adc10064cdb1b5f0546a4fc7320e9f5dc", "index": 8366, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@register.simple_tag\ndef random_quote():\n \"\"\"Returns a random quote to be displayed on the community sandwich page\"\"\"\n quotes = [\n \"\"\"Growth is never by mere...
[ 0, 1, 2, 3, 4 ]
n=int(input("n=")) x=int(input("x=")) natija=pow(n,x)+pow(6,x) print(natija)
normal
{ "blob_id": "0d6490ae5f60ef21ad344e20179bd1b0f6aa761e", "index": 6214, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(natija)\n", "step-3": "n = int(input('n='))\nx = int(input('x='))\nnatija = pow(n, x) + pow(6, x)\nprint(natija)\n", "step-4": "n=int(input(\"n=\"))\r\nx=int(input(\"x=\"))\r\nn...
[ 0, 1, 2, 3 ]
# Copyright (c) 2008-2016 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """Test the `interpolation` module.""" from __future__ import division import logging import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_eq...
normal
{ "blob_id": "9e987e057ee5322765415b84e84ef3c4d2827742", "index": 5466, "step-1": "<mask token>\n\n\n@pytest.fixture()\ndef test_data():\n \"\"\"Return data used for tests in this file.\"\"\"\n x = np.array([8, 67, 79, 10, 52, 53, 98, 34, 15, 58], dtype=float)\n y = np.array([24, 87, 48, 94, 98, 66, 14, ...
[ 7, 9, 10, 11, 13 ]
""" Utilities for calculations based on antenna positions, such as baseline and phase factor. """ import os import numpy as np import pickle c = 299792458 # m / s data_prefix = os.path.dirname(os.path.abspath(__file__)) + "/" try: ant_pos = dict(pickle.load(open(data_prefix + "ant_dict.pk", "rb"))) def base...
normal
{ "blob_id": "c455263b82c04fe2c5cc1e614f10a9962795f87e", "index": 4349, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n ant_pos = dict(pickle.load(open(data_prefix + 'ant_dict.pk', 'rb')))\n\n def baselength(ant_ID1, ant_ID2):\n \"\"\"\n (Convenience function)\n Return the...
[ 0, 1, 2, 3, 4 ]
from django.shortcuts import render, get_object_or_404 # Create your views here. from django.http import HttpResponse from .models import Post from django.utils import timezone def list_of_posts(request): posts = (Post.objects .filter(published_date__lte=timezone.now()) .order_b...
normal
{ "blob_id": "71a0900dc09b1ff55e4e5a4cc7cab617b9c73406", "index": 4519, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef post_detail(request, pk):\n post = get_object_or_404(Post, pk=pk)\n return render(request, 'blog/post_detail.html', {'post': post})\n", "step-3": "<mask token>\n\n\ndef li...
[ 0, 1, 2, 3, 4 ]
import sys import os import traceback from src.properties import * from src.utils import * from subprocess import call from src.entity.cursor import Cursor from curses import * def main(screen, file_path): setUpEnv() text = readFileIfExist(file_path) while 1: try: text = startEditing(s...
normal
{ "blob_id": "7a6d45ef87d93af9a15bd352b893164d3a36c399", "index": 7545, "step-1": "<mask token>\n\n\ndef main(screen, file_path):\n setUpEnv()\n text = readFileIfExist(file_path)\n while 1:\n try:\n text = startEditing(screen, text)\n printQuitOptions(screen)\n cha...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class ClientTaskStatus(object): <|reserved_special_token_0|> <|reserved_special_token_0|> def start(self): while True: try: self.get_task_status_info() lines = StatusTask(self._taskstatus) OutputManagement.ou...
flexible
{ "blob_id": "de0d0588106ab651a8d6141a44cd9e286b0ad3a5", "index": 1299, "step-1": "<mask token>\n\n\nclass ClientTaskStatus(object):\n <mask token>\n <mask token>\n\n def start(self):\n while True:\n try:\n self.get_task_status_info()\n lines = StatusTask(s...
[ 2, 3, 4, 5, 6 ]
""""Pirata barba Negra ( màs de 2 pasos a las izquierda o a la derecha y se cae): rampa para subir a su barco (5 pasos de ancho y 15 de largo")leer por teclado un valor entero. a) si el entero es par 1 paso hacia adelante b)si el entero es impar , pero el entero - 1 es divisible por 4, el pirata da un paso a la derec...
normal
{ "blob_id": "1829bd8e87c470a71fea97dd3a47c30477b6e6f1", "index": 3109, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile numero_usuario < 0:\n print(\n 'Parece que el pirata se ha quedado dormido en la rampa intenta despertarlo ingresando otro nùmero '\n )\n numero_usuario = int(i...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "264896da4d92797b9f31e28c19a2e315efff815a", "index": 138, "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 = [('exchange', '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': print('In Sample.py........') ModBMW = Bmw.Bmw() ModBMW.outModels() ModAudi = Audi.Audi() ModAudi.outModels() ModNissan = Nissan.Nissan() ModNissan.outModels() <|reserved_sp...
flexible
{ "blob_id": "e15524d7ae87cbf0b10c54ee0bdc613ba589c1a9", "index": 3812, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n print('In Sample.py........')\n ModBMW = Bmw.Bmw()\n ModBMW.outModels()\n ModAudi = Audi.Audi()\n ModAudi.outModels()\n ModNissan = Nissan.N...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> connection.execute(stmt) func.update_annotations_db(Twitter_Sentiment_Analysis, connection, 'Export_csv5.csv') <|reserved_special_token_1|> <|reserved_special_token_0|> connection, Twitter_Sentiment_Analysis = func.Database...
flexible
{ "blob_id": "a558b42106b036719fe38ee6efd1c5b933290f52", "index": 47, "step-1": "<mask token>\n", "step-2": "<mask token>\nconnection.execute(stmt)\nfunc.update_annotations_db(Twitter_Sentiment_Analysis, connection,\n 'Export_csv5.csv')\n", "step-3": "<mask token>\nconnection, Twitter_Sentiment_Analysis = ...
[ 0, 1, 2, 3, 4 ]
''' HTTP Test for channel details ''' import sys sys.path.append('..') from json import load, dumps import urllib.request import urllib.parse import pytest PORT_NUMBER = '5204' BASE_URL = 'http://127.0.0.1:' + PORT_NUMBER #BASE_URL now is 'http://127.0.0.1:5321' @pytest.fixture def register_loginx2_create_invite(): ...
normal
{ "blob_id": "c22b37bff74de7ea99f2009652dd00e57bb316b8", "index": 4383, "step-1": "<mask token>\n\n\n@pytest.fixture\ndef register_loginx2_create_invite():\n \"\"\"\n Registers, logs in 2 users, creates new channel\n \"\"\"\n req = urllib.request.Request(f'{BASE_URL}/workspace/reset', headers={\n ...
[ 4, 5, 6, 7, 8 ]
class _ProtectedClass: pass class MyClass: pass class OtherClass(MyClass): pass def _protected_fun() ->MyClass: return variable <|reserved_special_token_0|> def my_fun2() ->MyClass: return variable <|reserved_special_token_0|> <|reserved_special_token_1|> class _ProtectedClass: pa...
flexible
{ "blob_id": "b5949b40d731178bdbab776af8877921dcdfbf15", "index": 3215, "step-1": "class _ProtectedClass:\n pass\n\n\nclass MyClass:\n pass\n\n\nclass OtherClass(MyClass):\n pass\n\n\ndef _protected_fun() ->MyClass:\n return variable\n\n\n<mask token>\n\n\ndef my_fun2() ->MyClass:\n return variable...
[ 5, 6, 7, 8, 9 ]
""" * author - kajol * date - 12/24/2020 * time - 1:24 PM * package - com.bridgelabz.basicprograms * Title - Print a table of the powers of 2 that are less than or equal to 2^N """ try: number = int(input("Enter number: ")) #print power of 2 within given range if number < 31: for num...
normal
{ "blob_id": "b0f0bcfb5739d46de54cbe46614e82bf5a2d13fb", "index": 9038, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n number = int(input('Enter number: '))\n if number < 31:\n for num in range(1, number + 1):\n print('2 ^', num, '=', 2 ** num)\n else:\n print('Ent...
[ 0, 1, 2 ]
import pandas as pd import numpy as np import csv #import nltk #nltk.download('punkt') from nltk.tokenize import sent_tokenize csv_file=open("/home/debajit15/train+dev.csv") pd.set_option('display.max_colwidth', None) df=pd.read_csv(csv_file,sep=','); df = df[pd.notnull(df['Aspects'])] #print(df['Opinion_Words'].iloc[0...
normal
{ "blob_id": "c18c407476375fb1647fefaedb5d7ea0e0aabe3a", "index": 929, "step-1": "<mask token>\n\n\ndef train_validate_test_split(df, train_percent=0.8, validate_percent=0.2,\n seed=None):\n np.random.seed(seed)\n perm = np.random.permutation(df.index)\n m = len(df.index)\n train_end = int(train_pe...
[ 2, 3, 4, 5, 6 ]