code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
#! /usr/bin/env python2 ############################################################ # Program is part of PySAR v1.2 # # Copyright(c) 2015, Heresh Fattahi, Zhang Yunjun # # Author: Heresh Fattahi, Zhang Yunjun # ####################################################...
normal
{ "blob_id": "9515dcdfc0ece1a6740d6e7075bbcd1c20977590", "index": 9157, "step-1": "#! /usr/bin/env python2\n############################################################\n# Program is part of PySAR v1.2 #\n# Copyright(c) 2015, Heresh Fattahi, Zhang Yunjun #\n# Author: Heresh Fa...
[ 0 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render from django.http import JsonResponse from knowdb.models import Knowledge import random # Create your views here. def answer(request): ret = {} data = Knowledge.objects.all() num = random.choice(range(1,int...
normal
{ "blob_id": "eb558644283d992af2c324d457dbe674b714235f", "index": 735, "step-1": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.shortcuts import render\nfrom django.http import JsonResponse\nfrom knowdb.models import Knowledge\n\nimport random\n# Create your views here.\n\ndef an...
[ 0 ]
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # Copyright © YXC # CreateTime: 2016-03-09 10:06:02 """ Example of functions with arbitrary number arguments """ def optional_argument_func(arg1='', arg2=''): """ Function with two optional arguments """ print("arg1:{0}".format(arg1)) ...
normal
{ "blob_id": "061a78650e2abf6a9d1e4796dd349174a8df5cb8", "index": 8747, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef optional_argument_func(arg1='', arg2=''):\n \"\"\"\n Function with two optional arguments\n \"\"\"\n print('arg1:{0}'.format(arg1))\n print('arg2:{0}'.format(arg2))...
[ 0, 1, 2, 3, 4 ]
import unittest import sys import os #Add project root to path sys.path.append('../..') from speckle.SpeckleClient import SpeckleApiClient class TestSpeckleStream(unittest.TestCase): def setUp(self): self.s = SpeckleApiClient() self.user = {'email':'testuser@arup.com','password':'testpassword',...
normal
{ "blob_id": "b39403171ed264c8fae5ea4ae9d17f77cfcab497", "index": 9122, "step-1": "<mask token>\n\n\nclass TestSpeckleStream(unittest.TestCase):\n\n def setUp(self):\n self.s = SpeckleApiClient()\n self.user = {'email': 'testuser@arup.com', 'password':\n 'testpassword', 'username': 'te...
[ 7, 11, 12, 13, 14 ]
def lucas(): yield 2 a = 2 b = 1 while True: yield b a, b = b, a + b l = lucas() for i in range(10): print('{}: {}'.format(i, next(l)))
normal
{ "blob_id": "4745c00ca0f3ca4316117228a9d44bdb5df02877", "index": 7799, "step-1": "<mask token>\n", "step-2": "def lucas():\n yield 2\n a = 2\n b = 1\n while True:\n yield b\n a, b = b, a + b\n\n\n<mask token>\n", "step-3": "def lucas():\n yield 2\n a = 2\n b = 1\n while ...
[ 0, 1, 2, 3 ]
def solution(S): # write your code in Python 3.6 # Definitions log_sep = ',' num_sep = '-' time_sep = ':' # Initialization from collections import defaultdict # defaultdict initialize missing key to default value -> 0 bill = defaultdict(int) total = defaultdict(int) calls = S...
normal
{ "blob_id": "bf8bbeb408cb75af314ef9f3907456036e731c0b", "index": 294, "step-1": "<mask token>\n", "step-2": "def solution(S):\n log_sep = ','\n num_sep = '-'\n time_sep = ':'\n from collections import defaultdict\n bill = defaultdict(int)\n total = defaultdict(int)\n calls = S.splitlines()...
[ 0, 1, 2 ]
from data_structures.datacenter import Datacenter, urllib, json, URL = "http://www.mocky.io/v2/5e539b332e00007c002dacbe" def get_data(url, max_retries=5, delay_between_retries=1): """ Fetch the data from http://www.mocky.io/v2/5e539b332e00007c002dacbe and return it as a JSON object. ​ Args: ...
normal
{ "blob_id": "e56a7912b9940b1cab6c19d0047f1f60f0083f66", "index": 4911, "step-1": "from data_structures.datacenter import Datacenter, urllib, json,\n\n\nURL = \"http://www.mocky.io/v2/5e539b332e00007c002dacbe\"\n\n\ndef get_data(url, max_retries=5, delay_between_retries=1):\n \"\"\"\n Fetch the data from ht...
[ 0 ]
#!usr/bin/env python # -*- coding:utf-8 -*- """ @author: Jack @datetime: 2018/8/31 13:32 @E-mail: zhangxianlei117@gmail.com """ def isValid(s): stack = [] for ss in s: if ss in '([{': stack.append(ss) if ss in ')]}': if len(stack) <= 0: return Fal...
normal
{ "blob_id": "607f0aac0d6d2c05737f59803befcff37d559398", "index": 5117, "step-1": "#!usr/bin/env python\n# -*- coding:utf-8 -*-\n\"\"\"\n@author: Jack\n@datetime: 2018/8/31 13:32\n@E-mail: zhangxianlei117@gmail.com\n\"\"\"\n\n\ndef isValid(s):\n stack = []\n for ss in s:\n if ss in '([{':\n ...
[ 0 ]
version https://git-lfs.github.com/spec/v1 oid sha256:7f0b7267333e6a4a73d3df0ee7f384f7b3cb6ffb14ed2dc8a5894b853bac8957 size 1323
normal
{ "blob_id": "f1972baee8b399c9a52561c8f015f71cb9922bb0", "index": 4875, "step-1": "version https://git-lfs.github.com/spec/v1\noid sha256:7f0b7267333e6a4a73d3df0ee7f384f7b3cb6ffb14ed2dc8a5894b853bac8957\nsize 1323\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ...
[ 0 ]
from flask import Flask from flask import render_template import datetime from person import Person import requests from post import Post app = Flask(__name__) all_posts = all_posts = requests.get( "https://api.npoint.io/5abcca6f4e39b4955965").json() post_objects = [] for post in all_posts: post_obj = Post(po...
normal
{ "blob_id": "895ece0b8d45cd64e43f8ddc54824f7647254185", "index": 2547, "step-1": "<mask token>\n\n\n@app.route('/guess/<name>')\ndef guesser(name):\n person = Person(name=name)\n return render_template('guess.html', name=person.name, gender=person.\n gender, age=person.age, country=person.country)\n...
[ 2, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def main(): reader = csv.reader(row for row in fileinput.input() if not row. startswith('#')) circles = lps.parse_lps(reader) for circle in circles: circle.r = R print(circle) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_spe...
flexible
{ "blob_id": "00f62fec7f5372c5798b0ebf3f3783233360581e", "index": 2987, "step-1": "<mask token>\n\n\ndef main():\n reader = csv.reader(row for row in fileinput.input() if not row.\n startswith('#'))\n circles = lps.parse_lps(reader)\n for circle in circles:\n circle.r = R\n print(cir...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if d == m: print(a[0]) elif 0 < d < m: for i in range(hmin, hmax + 1): fin1 = a[0] - i + m if hmin <= fin1 - a[-1] <= hmax or fin1 == a[-1]: print(a[0] - i) found = 1 bre...
flexible
{ "blob_id": "3da82bcff0a4f91c1245892bc01e9f743ea354a8", "index": 4484, "step-1": "<mask token>\n", "step-2": "<mask token>\nif d == m:\n print(a[0])\nelif 0 < d < m:\n for i in range(hmin, hmax + 1):\n fin1 = a[0] - i + m\n if hmin <= fin1 - a[-1] <= hmax or fin1 == a[-1]:\n prin...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @transaction.atomic def computers(request): ctx = {} computer = Computer.objects.all() ctx['brand'] = Brand.objects.all() if request.method == 'POST': if request.POST['computer_id'] != '': computer = computer.filter(computer_id__icontains=request.POST[ ...
flexible
{ "blob_id": "18689741a33e6d17e694ee0619a1f36d8d178cbb", "index": 3223, "step-1": "<mask token>\n\n\n@transaction.atomic\ndef computers(request):\n ctx = {}\n computer = Computer.objects.all()\n ctx['brand'] = Brand.objects.all()\n if request.method == 'POST':\n if request.POST['computer_id'] !...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while t: t -= 1 y = [] z = [] x = str(input()) for i in range(len(x)): if not int(i) % 2: y.append(x[i]) else: z.append(x[i]) print(''.join(y) + ' ' + ''.join(z)) <...
flexible
{ "blob_id": "ac32fb5fcd71790f9dbf0794992a9dc92a202c9b", "index": 7972, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile t:\n t -= 1\n y = []\n z = []\n x = str(input())\n for i in range(len(x)):\n if not int(i) % 2:\n y.append(x[i])\n else:\n z.appen...
[ 0, 1, 2, 3 ]
#!usr/bin/env python #-*- coding:utf-8 -*- # this model is for decision tree # objective: To cluster different service # JialongLi 2017/03/18 import re import os import sys import pickle import copy import random import pydotplus USER_NUM = 1000 reload(sys) sys.setdefaultencoding( "utf-8" ) from ...
normal
{ "blob_id": "65c0d940bacc2d016121812c435cc60f3fc1ba90", "index": 7233, "step-1": "#!usr/bin/env python\r\n#-*- coding:utf-8 -*-\r\n\r\n# this model is for decision tree\r\n# objective: To cluster different service\r\n# JialongLi 2017/03/18\r\n\r\nimport re\r\nimport os\r\nimport sys\r\nimport pickle\r\nimport co...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def face_detector(img, face_cascade, eye_cascade, face_f): xf = face_f[0] yf = face_f[1] wf = face_f[2] hf = face_f[3] xi = 0 yi = 0 wi = img.shape[1] hi = img.shape[0] c = float(0.1) prin...
flexible
{ "blob_id": "1df3a5dc8ed767e20d34c2836eed79872a21a016", "index": 9948, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef face_detector(img, face_cascade, eye_cascade, face_f):\n xf = face_f[0]\n yf = face_f[1]\n wf = face_f[2]\n hf = face_f[3]\n xi = 0\n yi = 0\n wi = img.shape[...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_Kmeans(*data): x, labels_true = data clst = cluster.KMeans() clst.fit(x) predicted_labels = clst.predict(x) print('ARI: %s' % adjusted_rand_score(labels_true, predicted_labels)) print('Sum center...
flexible
{ "blob_id": "bd419d0a197a5e5a99a370e45cdb53a276ac5507", "index": 5633, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_Kmeans(*data):\n x, labels_true = data\n clst = cluster.KMeans()\n clst.fit(x)\n predicted_labels = clst.predict(x)\n print('ARI: %s' % adjusted_rand_score(lab...
[ 0, 2, 3, 4, 5 ]
import matplotlib.pyplot as plotOp import numpy as np from random import randint import re as regexOp
normal
{ "blob_id": "6c0a1d4ffd64e0566be53937d9b48975f2530852", "index": 7767, "step-1": "<mask token>\n", "step-2": "import matplotlib.pyplot as plotOp\nimport numpy as np\nfrom random import randint\nimport re as regexOp\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def maxSideLength(self, mat: List[List[int]], threshold: int) ->int: def squareSum(r1: int, c1: int, r2: int, c2: int) ->int: return pre...
flexible
{ "blob_id": "c8f2df1471a9581d245d52437470b6c67b341ece", "index": 7297, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def maxSideLength(self, mat: List[List[int]], threshold: int) ->int:\n\n def squareSum(r1: int, c1: int, r2: int, c2: in...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.plot(dev_x, dev_y, label='All Devs') <|reserved_special_token_0|> plt.plot(dev_x, py_dev_y, label='Python') plt.xlabel('Ages') plt.ylabel('Median Salary') plt.title('Median Salary (USD) by Age') plt.legend() plt.show() <|res...
flexible
{ "blob_id": "796a13de72c2879956c5f9c9c9bdef7253760c9d", "index": 9895, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.plot(dev_x, dev_y, label='All Devs')\n<mask token>\nplt.plot(dev_x, py_dev_y, label='Python')\nplt.xlabel('Ages')\nplt.ylabel('Median Salary')\nplt.title('Median Salary (USD) by Age')...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def two_teams(sailors): result = [] temp = [[], []] for i in sailors.items(): if i[1] > 40 or i[1] < 20: temp[0].append(i[0]) else: temp[1].append(i[0]) result.append(sorted(temp[0])) result.append(s...
flexible
{ "blob_id": "de634c95fddf4591cb15cd0eb20e798043075798", "index": 2464, "step-1": "<mask token>\n", "step-2": "def two_teams(sailors):\n result = []\n temp = [[], []]\n for i in sailors.items():\n if i[1] > 40 or i[1] < 20:\n temp[0].append(i[0])\n else:\n temp[1].ap...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class demo: <|reserved_special_token_0|> def __init__(self): self._myKey = RPiKeyButtons() def _getKeyButtonName(self, keyBtn): if keyBtn == CONFIG_KEY.BUTTON_ACT_A: return 'BUTTON_A' if keyBtn == CONFIG_KEY.BUTTON_ACT_B: retur...
flexible
{ "blob_id": "50c274e0365f2556a46eb58edcd1f0a7301e89db", "index": 8716, "step-1": "<mask token>\n\n\nclass demo:\n <mask token>\n\n def __init__(self):\n self._myKey = RPiKeyButtons()\n\n def _getKeyButtonName(self, keyBtn):\n if keyBtn == CONFIG_KEY.BUTTON_ACT_A:\n return 'BUTTO...
[ 6, 12, 15, 16, 17 ]
# Copyright (C) 2019 Catalyst Cloud Ltd # # 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 la...
normal
{ "blob_id": "cc23eeed44ff66d68c700163cca8b9f4986d497d", "index": 7681, "step-1": "<mask token>\n\n\nclass BaseTask(object):\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 <mas...
[ 14, 17, 18, 20, 26 ]
def count_words(word): count = 0 count = len(word.split()) return count if __name__ == '__main__': print count_words("Boj is dope")
normal
{ "blob_id": "9f3b7d6dbf57157b5ebd6ad72f46befc94798a5f", "index": 3845, "step-1": "def count_words(word):\n\tcount = 0\n\tcount = len(word.split())\n\treturn count\n\n\nif __name__ == '__main__':\n\tprint count_words(\"Boj is dope\")\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "s...
[ 0 ]
<|reserved_special_token_0|> class TubeloadResolver(ResolveUrl): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def get_url(self, host, media_id): return self._default_get_url(host, media_id, template= 'https...
flexible
{ "blob_id": "8dfea24545ec4bb95b66d4b5ff3c4936990eb73a", "index": 9500, "step-1": "<mask token>\n\n\nclass TubeloadResolver(ResolveUrl):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def get_url(self, host, media_id):\n return self._default_get_url(host, media_id, template=...
[ 2, 3, 4, 5, 6 ]
import torch.nn as nn def my_loss(): return nn.CrossEntropyLoss()
normal
{ "blob_id": "418f2e1cbe4fb3ef369e981e72bf40eeddfd052e", "index": 2408, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef my_loss():\n return nn.CrossEntropyLoss()\n", "step-3": "import torch.nn as nn\n\n\ndef my_loss():\n return nn.CrossEntropyLoss()\n", "step-4": null, "step-5": null, ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Trap(GameObject): <|reserved_special_token_0|> def __init__(self, gamedir, filename=None): self.attacks = list() self.x = 0 self.y = 0 self.radius = 0 self.is_first_round = True GameObject.__init__(self, gamedir, filename) ...
flexible
{ "blob_id": "f2a94f6bfe86af439a8248b40732340c45d89b93", "index": 9925, "step-1": "<mask token>\n\n\nclass Trap(GameObject):\n <mask token>\n\n def __init__(self, gamedir, filename=None):\n self.attacks = list()\n self.x = 0\n self.y = 0\n self.radius = 0\n self.is_first_r...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> browser.get('https://www.google.com') time.sleep(3) browser.maximize_window() <|reserved_special_token_0|> print(title) assert 'Google' == title browser.close() <|reserved_special_token_1|> <|reserved_special_token_0|> capabili...
flexible
{ "blob_id": "d84641ce2854d4af26cd46abbe9557d6006cfc2e", "index": 681, "step-1": "<mask token>\n", "step-2": "<mask token>\nbrowser.get('https://www.google.com')\ntime.sleep(3)\nbrowser.maximize_window()\n<mask token>\nprint(title)\nassert 'Google' == title\nbrowser.close()\n", "step-3": "<mask token>\ncapabi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @exception_handler def get_doi_not_in_index(index, dois): es = get_client() results = es.search(index=index, body={'query': {'bool': {'filter': [{ 'terms': {'doi.keyword': dois}}]}}, 'fields': ['doi'], 'size': len( dois), '_source': False}, request_timeout=60 * 5) ...
flexible
{ "blob_id": "9f760c0cf2afc746a1fc19ac68d1b2f406c7efe1", "index": 5767, "step-1": "<mask token>\n\n\n@exception_handler\ndef get_doi_not_in_index(index, dois):\n es = get_client()\n results = es.search(index=index, body={'query': {'bool': {'filter': [{\n 'terms': {'doi.keyword': dois}}]}}, 'fields': ...
[ 7, 8, 9, 11, 13 ]
<|reserved_special_token_0|> def recieve_data(): while True: data = conn.recv(1024) if not data: break conn.sendall(data) msg = pickle.loads(data) time = float(msg[0]) gain = float(msg[1]) yield time, gain conn.close() def animate(i): x...
flexible
{ "blob_id": "a4d5064decdc9963dae1712c7c6918b3e5902bf2", "index": 9825, "step-1": "<mask token>\n\n\ndef recieve_data():\n while True:\n data = conn.recv(1024)\n if not data:\n break\n conn.sendall(data)\n msg = pickle.loads(data)\n time = float(msg[0])\n ga...
[ 2, 3, 4, 5, 6 ]
def get_value(li, row, column): if row < 0 or column < 0: return 0 try: return li[row][column] except IndexError: return 0 n = int(input()) results = {} for asdf in range(n): table = [] title, rows, columns = input().split() rows = int(rows) columns =...
normal
{ "blob_id": "badbfdbdeb8b4fd40b1c44bf7dcff6457a0c8795", "index": 7162, "step-1": "<mask token>\n", "step-2": "def get_value(li, row, column):\n if row < 0 or column < 0:\n return 0\n try:\n return li[row][column]\n except IndexError:\n return 0\n\n\n<mask token>\n", "step-3": "d...
[ 0, 1, 2, 3, 4 ]
from flask import Blueprint application_vue_demo = Blueprint('application_vue_demo', __name__) from . import views
normal
{ "blob_id": "a33abd253288140f8051aced1d0ed1e41b2fc786", "index": 8067, "step-1": "<mask token>\n", "step-2": "<mask token>\napplication_vue_demo = Blueprint('application_vue_demo', __name__)\n<mask token>\n", "step-3": "from flask import Blueprint\napplication_vue_demo = Blueprint('application_vue_demo', __n...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def get_model(num_feat=294, lr=0.001, drop_out=0.1, layer_dims=''): model = Sequential() act_fn = 'relu' if len(layer_dims) == 0: layer_dims = [10, 5, 0.2] else: layer_dims = [float(d) for d in layer_dims.split('-')] model.add(Dense(int(num_feat * layer...
flexible
{ "blob_id": "ed35a9bc3dd267c9a5fe76ccbb1b4ac5261fc3c8", "index": 1993, "step-1": "<mask token>\n\n\ndef get_model(num_feat=294, lr=0.001, drop_out=0.1, layer_dims=''):\n model = Sequential()\n act_fn = 'relu'\n if len(layer_dims) == 0:\n layer_dims = [10, 5, 0.2]\n else:\n layer_dims = ...
[ 1, 3, 4, 5, 6 ]
import hashlib hash = 'yzbqklnj' int = 0 while not hashlib.md5("{}{}".format(hash, int).encode('utf-8')).hexdigest().startswith('000000'): print("Nope luck for {}{}".format(hash, int)) int += 1 print("Key: {}{}".format(hash, int)) print("Number: {}").format(int)
normal
{ "blob_id": "9ae9fd6da5c3d519d87af699dd4ea9b564a53d79", "index": 5481, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile not hashlib.md5('{}{}'.format(hash, int).encode('utf-8')).hexdigest(\n ).startswith('000000'):\n print('Nope luck for {}{}'.format(hash, int))\n int += 1\nprint('Key: {}{}'...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def logged_menu(logged_user): print('Welcome you are logged in as: ' + logged_user.get_username()) while True: command = input('{}@hackabank# '.format(logged_user.get_username())) if command == 'info': ...
flexible
{ "blob_id": "ee4fd4aef7ecdfbc8ff53028fdedc558814f46a7", "index": 2383, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef logged_menu(logged_user):\n print('Welcome you are logged in as: ' + logged_user.get_username())\n while True:\n command = input('{}@hackabank# '.format(logged_user.g...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Tests for the storage format CLI arguments helper.""" import argparse import unittest from plaso.cli import tools from plaso.cli.helpers import storage_format from plaso.lib import errors from tests.cli import test_lib as cli_test_lib class StorageFormatArgumentsHe...
normal
{ "blob_id": "2075e7e05882524c295c8542ca7aefae2cf3e0fc", "index": 5951, "step-1": "<mask token>\n\n\nclass StorageFormatArgumentsHelperTest(cli_test_lib.CLIToolTestCase):\n <mask token>\n <mask token>\n\n def testAddArguments(self):\n \"\"\"Tests the AddArguments function.\"\"\"\n argument_...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> Importex.atest() <|reserved_special_token_1|> import Importex Importex.atest() <|reserved_special_token_1|> # 同一目录下的引用调用还是随意导入使用的 # 跨包使用就需要使用TwoUsage里面的两种方式。 import Importex Importex.atest()
flexible
{ "blob_id": "1a66e7f59ada43deb8e28b9806dc4fb9be4ae247", "index": 5771, "step-1": "<mask token>\n", "step-2": "<mask token>\nImportex.atest()\n", "step-3": "import Importex\nImportex.atest()\n", "step-4": "# 同一目录下的引用调用还是随意导入使用的\n# 跨包使用就需要使用TwoUsage里面的两种方式。\n\nimport Importex\n\nImportex.atest()\n", "step-...
[ 0, 1, 2, 3 ]
class Tool: def __init__(self, name, weight): self.name = name self.weight = weight def __repr__(self): return f'Tool({self.name!r},{self.weight})' tools = [ Tool('수준계', 3.5), Tool('해머', 1.25), Tool('스크류드라이버', .5), Tool('끌', .25) ] print(repr(tools)) tools.sort(reverse...
normal
{ "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 ]
# What is the 10 001st prime number? primes = [2] def is_prime(a, primes): b = a for x in primes: d, m = divmod(b, x) if m == 0: return False else: return True a = 3 while len(primes) <= 10001: # There's something faster than just checking all of them, but this ...
normal
{ "blob_id": "e5e516b6a39a6df03f1e5f80fe2d9e3978e856aa", "index": 2310, "step-1": "# What is the 10 001st prime number?\n\nprimes = [2]\n\n\ndef is_prime(a, primes):\n b = a\n for x in primes:\n d, m = divmod(b, x)\n if m == 0:\n return False\n else:\n return True\n\n\na =...
[ 0 ]
def filter_lines(in_filename, in_filename2,out_filename): """Read records from in_filename and write records to out_filename if the beginning of the line (taken up to the first comma at or after position 11) is found in keys (which must be a set of byte strings). """ proper_convert = 0 missing_...
normal
{ "blob_id": "502e0f0c6376617dc094fcdd47bea9773d011864", "index": 900, "step-1": "<mask token>\n", "step-2": "def filter_lines(in_filename, in_filename2, out_filename):\n \"\"\"Read records from in_filename and write records to out_filename if\n the beginning of the line (taken up to the first comma at or...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class interface(kernel.service.service): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class interface(kernel.service.service): def __init__(self, name): self.name =...
flexible
{ "blob_id": "237f1f72ac3ef381f115a88025518f387825ff79", "index": 9696, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass interface(kernel.service.service):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass interface(kernel.service.service):\n\n def __init__(self, name):\n self.n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def Move(direction, delay=0.2): PressKey(dk[config[direction]]) time.sleep(delay) ReleaseKey(dk[config[direction]]) def Action(direction, pull=None): delay = 0.6 if pull: delay = 1 PressKey(dk[config[pull]]) ReleaseKey(dk[config[pull]]) ...
flexible
{ "blob_id": "1e7789b154271eb8407a027c6ddf6c941cc69a41", "index": 3070, "step-1": "<mask token>\n\n\ndef Move(direction, delay=0.2):\n PressKey(dk[config[direction]])\n time.sleep(delay)\n ReleaseKey(dk[config[direction]])\n\n\ndef Action(direction, pull=None):\n delay = 0.6\n if pull:\n del...
[ 2, 3, 4, 5, 6 ]
import pandas as pd from greyatomlib.pandas_project.q01_read_csv_data_to_df.build import read_csv_data_to_df def get_runs_counts_by_match(): ipl_df = read_csv_data_to_df("data/ipl_dataset.csv") df1 = pd.DataFrame(ipl_df[['match_code','runs','venue']]) df2 = df1.groupby(['match_code','runs'], as_index=Fals...
normal
{ "blob_id": "4f06d87ec79c20206ff45ba72ab77844076be553", "index": 9707, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_runs_counts_by_match():\n ipl_df = read_csv_data_to_df('data/ipl_dataset.csv')\n df1 = pd.DataFrame(ipl_df[['match_code', 'runs', 'venue']])\n df2 = df1.groupby(['mat...
[ 0, 1, 2, 3, 4 ]
#--------------------------------------------- # File name: phase2app.py # Description: Launches GUI for Twitter User Timeline Sentiment Analysis program # Author: Gilbert Yap (gilberty@bu.edu) # Date: October 03, 2020 #--------------------------------------------- from PySide2.QtWidgets import QApplication, QDialog, ...
normal
{ "blob_id": "8cabacb64f3b193b957c61d6e1ca21f2046e52d1", "index": 8199, "step-1": "<mask token>\n\n\nclass Ui_Window(QDialog):\n\n def __init__(self):\n super(Ui_Window, self).__init__()\n self.ui = Ui_Dialog()\n self.ui.setupUi(self)\n regex = QRegExp('\\\\w+')\n validator =...
[ 9, 11, 12, 13, 14 ]
import pygame from evolution import Darwin from Sensor import Robot, obstacleArray # Game Settings pygame.init() background_colour = (0, 0, 0) (width, height) = (1000, 600) target_location = (800, 300) screen = pygame.display.set_mode((width, height)) pygame.display.set_caption("Omar's Simulation") screen.fill(backgr...
normal
{ "blob_id": "cbcbc0d01c32693ebbdbcf285efdc8e521c447ee", "index": 3998, "step-1": "<mask token>\n", "step-2": "<mask token>\npygame.init()\n<mask token>\npygame.display.set_caption(\"Omar's Simulation\")\nscreen.fill(background_colour)\n<mask token>\nfor i in range(population_size):\n robots.append(Robot(175...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def exec(bucket_id, project_id, reverse_opt): client = storage.Client() bucket = client.bucket(bucket_id, user_project=project_id) blobs = bucket.list_blobs() blob_list = [] try: for blob in blobs: ...
flexible
{ "blob_id": "562b2c3567e42699cfd0804a5780af7ede142e13", "index": 1056, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef exec(bucket_id, project_id, reverse_opt):\n client = storage.Client()\n bucket = client.bucket(bucket_id, user_project=project_id)\n blobs = bucket.list_blobs()\n blob...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 16 20:47:28 2019 @author: jaco """
flexible
{ "blob_id": "d806d1b31712e3d8d60f4bfbc60c6939dfeeb357", "index": 9579, "step-1": "<mask token>\n", "step-2": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Dec 16 20:47:28 2019\n\n@author: jaco\n\"\"\"\n\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, ...
[ 0, 1 ]
<|reserved_special_token_0|> @plugin_runner.register(chain='scrooge') def ralph3_profit_center(**kwargs): new_pc = total = 0 for pc in get_from_ralph('profit-centers', logger): created = update_profit_center(pc) if created: new_pc += 1 total += 1 return True, '{} new pr...
flexible
{ "blob_id": "d3f52d4713ba4b7b4cd736b26809968e259be63c", "index": 6883, "step-1": "<mask token>\n\n\n@plugin_runner.register(chain='scrooge')\ndef ralph3_profit_center(**kwargs):\n new_pc = total = 0\n for pc in get_from_ralph('profit-centers', logger):\n created = update_profit_center(pc)\n i...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if len(sys.argv) < 2: print('Syntax : python %s <port>') % str(sys.argv[0]) else: print('-' * 55) print('HTB WEB-CHALLENGE coded by ZyperX [Freelance]') print('-' * 55) r = requests.session() port = str(sys...
flexible
{ "blob_id": "88ec9484e934ce27b13734ca26f79df71b7677e6", "index": 82, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(sys.argv) < 2:\n print('Syntax : python %s <port>') % str(sys.argv[0])\nelse:\n print('-' * 55)\n print('HTB WEB-CHALLENGE coded by ZyperX [Freelance]')\n print('-' * 55)...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> stock_in = By.XPATH, "//android.widget.TextView[contains(@text,'门店入库')]" transfer_in = By.XPATH, "//android.widget.TextView[contains(@text,'调拨入库')]" take_receive = By.ID, '%s:id/take_receive' % basePage.package_name details_text =...
flexible
{ "blob_id": "d1b025ddbf7d0ad48ff92a098d074820a3eb35ed", "index": 6723, "step-1": "<mask token>\n", "step-2": "<mask token>\nstock_in = By.XPATH, \"//android.widget.TextView[contains(@text,'门店入库')]\"\ntransfer_in = By.XPATH, \"//android.widget.TextView[contains(@text,'调拨入库')]\"\ntake_receive = By.ID, '%s:id/tak...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Aug 31 14:35:49 2019 @author: devinpowers """ # Lab 1 in CSE 231 #Quadratic Formula # Find the roots in the Quadratic Formula import math a = float(input("Enter the coeddicient a: ")) b = float(input("Enter the coeddicient b: ")) c = float(input(...
normal
{ "blob_id": "2acfd0bbad68bb9d55aeb39b180f4326a225f6d5", "index": 1218, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(' Coefficients:')\nprint(' Coefficient of a = ', a)\nprint(' Coefficient of b = ', b)\nprint(' Coefficient of c = ', c)\n<mask token>\nprint('The roots of the equation:')\nprint(' R...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def ortoolsSolverRange(num, cap, refill, fun, goal): model = cp_model.CpModel() token = [model.NewIntVar(1, cap, 't%i' % i) for i in range(1, num + 1)] play = [model.NewIntVar(1, cap, 'q%i' % i) for i in range(1, num + 1)] compare = [model.NewBoolVar('c%i' % i) for i in ra...
flexible
{ "blob_id": "da98835e48a759cbe7bd29ddba1fac20c006827d", "index": 4996, "step-1": "<mask token>\n\n\ndef ortoolsSolverRange(num, cap, refill, fun, goal):\n model = cp_model.CpModel()\n token = [model.NewIntVar(1, cap, 't%i' % i) for i in range(1, num + 1)]\n play = [model.NewIntVar(1, cap, 'q%i' % i) for...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def report_error(error_text): """Logs error to Stackdriver. :param error_text: The text to log to Stackdriver :type error_text: string """ client = google.cloud.logging.Client() logger = client.logger('automated_error_catch') logger.log_text(error_text) <|res...
flexible
{ "blob_id": "bf2b3b74f772026328cdd04412455ee758c43d3f", "index": 8142, "step-1": "<mask token>\n\n\ndef report_error(error_text):\n \"\"\"Logs error to Stackdriver.\n :param error_text: The text to log to Stackdriver\n :type error_text: string\n \"\"\"\n client = google.cloud.logging.Client()\n ...
[ 10, 12, 13, 14, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def first_repeat(chars): for x in chars: if chars.count(x) > 1: return x return '-1'
flexible
{ "blob_id": "bf683f8e7fb5ad5f7cd915a8a01d9adf7d13e739", "index": 3375, "step-1": "<mask token>\n", "step-2": "def first_repeat(chars):\n for x in chars:\n if chars.count(x) > 1:\n return x\n return '-1'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, ...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open(sourceFile, 'r') as paragraph: paragraph = paragraph.read().split('\n\n') for sentence in paragraph: sentWithPunctuation = sentence sentNoPunctuation = re.sub('[^\\w\\s]', '', sentence) words = sentNoPunc...
flexible
{ "blob_id": "3cd7abf9659fe1db0ef3aa58df8dd7fd959e10a6", "index": 386, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(sourceFile, 'r') as paragraph:\n paragraph = paragraph.read().split('\\n\\n')\nfor sentence in paragraph:\n sentWithPunctuation = sentence\n sentNoPunctuation = re.sub('...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def itertools_groupby_example(list_of_nodes): graph = defaultdict(list) for key, group in groupby(l, lambda x: x[0]): graph[key].append(list(group)) print(dict(graph)) def itertools_false_filter_example(iterator): l = [] for item in filterfalse(lambda x: x > ...
flexible
{ "blob_id": "629353392e3a4f346f734543ae3f2b8dc616a6c3", "index": 5816, "step-1": "<mask token>\n\n\ndef itertools_groupby_example(list_of_nodes):\n graph = defaultdict(list)\n for key, group in groupby(l, lambda x: x[0]):\n graph[key].append(list(group))\n print(dict(graph))\n\n\ndef itertools_fa...
[ 7, 10, 11, 12, 14 ]
import os import numpy as np import pandas as pd import random import platform import subprocess import shlex import teradata from joblib import dump import shutil from tqdm import tqdm def get_session(db, usr, pwd): """Функция устанавливает соединение с ТД и возвращает сессию""" if platform....
normal
{ "blob_id": "a05c94ae0ee41cfef5687f741e07a54ae793e40d", "index": 2183, "step-1": "<mask token>\n\n\ndef get_session(db, usr, pwd):\n \"\"\"Функция устанавливает соединение с ТД и возвращает сессию\"\"\"\n if platform.system() == 'Windows':\n driver = 'Teradata'\n else:\n driver = 'Teradata...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> import matplotlib.pyplot as plotOp import numpy as np from random import randint import re as regexOp
flexible
{ "blob_id": "6c0a1d4ffd64e0566be53937d9b48975f2530852", "index": 7767, "step-1": "<mask token>\n", "step-2": "import matplotlib.pyplot as plotOp\nimport numpy as np\nfrom random import randint\nimport re as regexOp\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
class player: def __init__(self, name: str, symbol: str): self._name = name self._symbol = symbol def decide_next_move(self): """ Checks all possible combinations to decide best next move :return: board position """ pass def get_next_move(self): ...
normal
{ "blob_id": "3cc894570189fe545f5db3150d0b69c16dc211dc", "index": 981, "step-1": "class player:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class player:\n\n def __init__(self, name: str, symbol: str):\n self._name = name\n self._symbol = symbol\n <mask token>\n <...
[ 1, 2, 3, 4 ]
# -*- coding:utf-8 -*- import sys import time class ProgressBar: @staticmethod def progress_test(): bar_length = 100 for percent in range(0, 101): hashes = '#' * int(percent / 100.0 * bar_length) spaces = ' ' * (bar_length - len(hashes)) sys.stdout.write("\...
normal
{ "blob_id": "f928eb34155046107c99db8ded11747d5960c767", "index": 2527, "step-1": "<mask token>\n\n\nclass ProgressBar:\n <mask token>\n\n\n class ProgressBar1:\n\n def __init__(self, width=50):\n self.pointer = 0\n self.width = width\n\n def __call__(self, x):\n ...
[ 1, 3, 4, 5, 6 ]
''' 단어 수학 시간 : 68ms (~2초), 메모리 : 29200KB (~256MB) 분류 : greedy ''' import sys input = sys.stdin.readline # 입력 N = int(input()) # 단어의 개수 arr = [list(input().strip()) for _ in range(N)] # 풀이 alphabet = [] for word in arr: for a in word: if a not in alphabet: alphabet.append(a) value_list = [] ...
normal
{ "blob_id": "6efc7ff304a05dfc5a7bed7d646e5d6ac034ce85", "index": 4706, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor word in arr:\n for a in word:\n if a not in alphabet:\n alphabet.append(a)\n<mask token>\nfor a in alphabet:\n value = 0\n for word in arr:\n if a no...
[ 0, 1, 2, 3, 4 ]
from hops import constants class Cluster(object): """ Represents a Cluster in Cluster Analysis computed for a featuregroup or training dataset in the featurestore """ def __init__(self, cluster_json): """ Initialize the cluster object from JSON payload Args: :clus...
normal
{ "blob_id": "753c87a3d22aeca1001eb770831b846b175d873e", "index": 9139, "step-1": "<mask token>\n\n\nclass Cluster(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Cluster(object):\n <mask token>\n\n def __init__(self, cluster_json):\n \"\"\"\n Initialize t...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class MoleculeDriver(enum.Enum): docker = 1 lxd = 2 vagrant = 3 class TestPlatform(enum.Enum): linux = 1 ubuntu = 2 centos = 3 <|reserved_special_token_0|> def print_sub_header(sub_header_text): print(colorama.Fore.CYAN + colorama.Style.BRIGHT + '--' + ...
flexible
{ "blob_id": "5bdc08b66916959d462314b8a6e5794e5fa12b55", "index": 7986, "step-1": "<mask token>\n\n\nclass MoleculeDriver(enum.Enum):\n docker = 1\n lxd = 2\n vagrant = 3\n\n\nclass TestPlatform(enum.Enum):\n linux = 1\n ubuntu = 2\n centos = 3\n\n\n<mask token>\n\n\ndef print_sub_header(sub_hea...
[ 10, 11, 13, 14, 16 ]
""" This file is part of the tractor library. See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information. Created on Jan 06, 2012. """ from StringIO import StringIO from datetime import datetime from tractor.attachment import AttachmentWrapper from tractor.attachment import Base64Converter from tract...
normal
{ "blob_id": "41681a80807800efc06b3912533d739dab2cd085", "index": 1999, "step-1": "<mask token>\n\n\nclass AttachmentTestCase(BaseTestCase):\n\n def set_up(self):\n BaseTestCase.set_up(self)\n self.init_data = dict(content='Important attachment content.',\n file_name='test_file1.txt', ...
[ 5, 10, 11, 12, 14 ]
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2020 sungminoh <smoh2044@gmail.com> # # Distributed under terms of the MIT license. """ You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that a...
normal
{ "blob_id": "332c530d221c9441d6ff3646f8e9226dc78067f9", "index": 2902, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n\n def change(self, amount: int, coins: List[int]) ->int:\n coins = sorted(coins, reverse=True)\n\n...
[ 1, 2, 4, 5, 6 ]
<|reserved_special_token_0|> class InowasFlopyCalculationAdapter: <|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_specia...
flexible
{ "blob_id": "fb64003c1acbddcbe952a17edcbf293a54ef28ae", "index": 2185, "step-1": "<mask token>\n\n\nclass InowasFlopyCalculationAdapter:\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 def __init__(self, versio...
[ 7, 11, 12, 13, 14 ]
""" In search.py, you will implement generic search algorithms which are called by Pacman agents (in searchAgents.py). """ import util class SearchProblem: """ This class outlines the structure of a search problem, but doesn't implement any of the methods (in object-oriented terminology: an abstract class...
normal
{ "blob_id": "e7b96c0161e65f3f22f2ad0832fc6d1bb529f150", "index": 9772, "step-1": "<mask token>\n\n\nclass SearchProblem:\n \"\"\"\n This class outlines the structure of a search problem, but doesn't implement\n any of the methods (in object-oriented terminology: an abstract class).\n\n You do not nee...
[ 8, 10, 12, 13, 15 ]
<|reserved_special_token_0|> class Stop(object): """docstring for Stop""" def __init__(self, arg): self.fields = ['stop_id', 'stop_name', 'stop_lat', 'stop_lon', 'stop_calle', 'stop_numero', 'stop_entre', 'stop_esquina'] self.d = {} self.parse(arg) def __repr__(self):...
flexible
{ "blob_id": "39ecbf914b0b2b25ce4290eac4198199b90f95e0", "index": 5384, "step-1": "<mask token>\n\n\nclass Stop(object):\n \"\"\"docstring for Stop\"\"\"\n\n def __init__(self, arg):\n self.fields = ['stop_id', 'stop_name', 'stop_lat', 'stop_lon',\n 'stop_calle', 'stop_numero', 'stop_entre...
[ 9, 10, 12, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> for i in range(1, 11): encabezado = 'Tabla del {}' print(encabezado.format(i)) print() for j in range(1, 11): salida = '{} x {} = {}' print(salida.format(i, j, i * j)) else: print() <|reserved_special_token_1|> #...
flexible
{ "blob_id": "86f365612e9f15e7658160ecab1d3d9970ca364e", "index": 9699, "step-1": "<mask token>\n", "step-2": "for i in range(1, 11):\n encabezado = 'Tabla del {}'\n print(encabezado.format(i))\n print()\n for j in range(1, 11):\n salida = '{} x {} = {}'\n print(salida.format(i, j, i *...
[ 0, 1, 2 ]
import configparser import sqlite3 import time import uuid from duoquest.tsq import TableSketchQuery def input_db_name(conn): while True: db_name = input('Database name (default: concert_singer) > ') if not db_name: db_name = 'concert_singer' cur = conn.cursor() cur.ex...
normal
{ "blob_id": "54ec1961f4835f575e7129bd0b2fcdeb97be2f03", "index": 93, "step-1": "<mask token>\n\n\ndef input_db_name(conn):\n while True:\n db_name = input('Database name (default: concert_singer) > ')\n if not db_name:\n db_name = 'concert_singer'\n cur = conn.cursor()\n ...
[ 6, 7, 8, 11, 12 ]
<|reserved_special_token_0|> def openfile(name): f = open(name, 'r', encoding='utf-8') text = f.readlines() f.close() return text def makedict(text): A = [] for line in text: if 'lex:' in line: a = [] a.append(line[6:].replace('\n', '')) elif 'gramm:' ...
flexible
{ "blob_id": "29e54a9ec0d65965645ac4aabf8c247a8857a25f", "index": 3778, "step-1": "<mask token>\n\n\ndef openfile(name):\n f = open(name, 'r', encoding='utf-8')\n text = f.readlines()\n f.close()\n return text\n\n\ndef makedict(text):\n A = []\n for line in text:\n if 'lex:' in line:\n ...
[ 5, 6, 7, 8, 9 ]
#!/usr/bin/python # -*- coding: utf-8 -*- from fieldsets import getSingleField, SortAsc from sqlalchemy import func from ladderdb import ElementNotFoundException, EmptyRankingListException from db_entities import Player, Result from bottle import route,request from globe import db,env @route('/player') def output( ):...
normal
{ "blob_id": "97d128694709c4fe0d9ec2b2749d8e4ec5df7322", "index": 8812, "step-1": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nfrom fieldsets import getSingleField, SortAsc\nfrom sqlalchemy import func\nfrom ladderdb import ElementNotFoundException, EmptyRankingListException\nfrom db_entities import Player, Res...
[ 0 ]
from flask import Flask, flash, abort, redirect, url_for, request, render_template, make_response, json, Response import os, sys import config import boto.ec2.elb import boto from boto.ec2 import * app = Flask(__name__) @app.route('/') def index(): list = [] creds = config.get_ec2_conf() for region in con...
normal
{ "blob_id": "22c2425f1dc14b6b0005ebf2231af8abf43aa2e1", "index": 5273, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n list = []\n creds = config.get_ec2_conf()\n for region in config.region_list():\n conn = connect_to_region(region, aws_access_key_id=creds[\n 'AWS_ACCESS_...
[ 6, 7, 8, 9 ]
# -*- coding: utf-8 -*- from .base import BaseSchema from marshmallow import fields class BaseTickSchema(BaseSchema): """ Time : 时间 High : 最高价 Low : 最低价 Volume : 交易量 Last : 最新价 """ Time = fields.String() High = fields.String() Low = ...
normal
{ "blob_id": "6cc23a3e2fa3b1baddf05b30a1054a7faf0371a6", "index": 5528, "step-1": "<mask token>\n\n\nclass BaseTickSchema(BaseSchema):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass BaseTickSchema(BaseSchema):\n ...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python # coding: utf-8 # # PyCity School Analysis # 1. Charter school types show better performace than District School types in all the scores. # 2. Overall students are performing better in english between (80 to 84%), than math (76 to 84%) # ### Note # * Instructions have been included for each seg...
normal
{ "blob_id": "8488fdd216c30c3cb4b0060305af6708d890bc86", "index": 8203, "step-1": "<mask token>\n", "step-2": "<mask token>\nDistrict_Summary_df\n<mask token>\nschool_summary_df\n<mask token>\ntop_performing.head()\n<mask token>\ntop_performing.head()\n<mask token>\ngrade_math_score\n<mask token>\ngrade_reading...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- from django.db import models from django.contrib.auth.models import User # Create your models here. class Event(models.Model): name = models.CharField('Назва', max_length=200) date = models.DateField('Дата') address = models.CharField('Адреса', max_length=255, blank=True, null=True)...
normal
{ "blob_id": "137f9310256f66ccd9fbe6626659c3c4daea0efc", "index": 8949, "step-1": "<mask token>\n\n\nclass Atendent(models.Model):\n user = models.ForeignKey(User)\n event = models.ForeignKey(Event, null=True, blank=True)\n state = models.IntegerField(null=True, blank=True)\n", "step-2": "<mask token>\...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class ScoreLoop: def __init__(self): self.scores = fetch_scores() self.sprites = pygame.sprite.Group() self.get_score_sprites() self.space_cooldown = True <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|...
flexible
{ "blob_id": "047b3398a73c9e7d75d43eeeab85f52c05ff90c3", "index": 4534, "step-1": "<mask token>\n\n\nclass ScoreLoop:\n\n def __init__(self):\n self.scores = fetch_scores()\n self.sprites = pygame.sprite.Group()\n self.get_score_sprites()\n self.space_cooldown = True\n <mask toke...
[ 2, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def train(epoch, model, dataloader, criterion, optimizer, scheduler): global global_train_step model.train() total_loss = 0.0 bleu_score = 0.0 distinct_1_score, distinct_2_score = 0.0, 0.0 for i, (src, tgt, src_lens, tgt_lens) in tqdm(enumerate(dataloader, 0), ...
flexible
{ "blob_id": "bc6c3383684cbba775d17f81ead3346fe1a01f90", "index": 5102, "step-1": "<mask token>\n\n\ndef train(epoch, model, dataloader, criterion, optimizer, scheduler):\n global global_train_step\n model.train()\n total_loss = 0.0\n bleu_score = 0.0\n distinct_1_score, distinct_2_score = 0.0, 0.0...
[ 3, 4, 5, 6, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> FIGURES_DIR.mkdir(exist_ok=True, parents=True) <|reserved_special_token_1|> <|reserved_special_token_0|> script_name = pathlib.Path(sys.argv[0]).stem FIGURES_DIR = pathlib.Path(__file__).parents[2 ] / 'figures' / 'simulatio...
flexible
{ "blob_id": "fc26574ac8628d7e2896e3e6d055ac61264c7db0", "index": 1302, "step-1": "<mask token>\n", "step-2": "<mask token>\nFIGURES_DIR.mkdir(exist_ok=True, parents=True)\n", "step-3": "<mask token>\nscript_name = pathlib.Path(sys.argv[0]).stem\nFIGURES_DIR = pathlib.Path(__file__).parents[2\n ] / 'figure...
[ 0, 1, 2, 3, 4 ]
from .test_function import * from .support_funcs import * table_DIXMAAN = dict() table_DIXMAAN['A'] = (1, 0, 0.125, 0.125, 0, 0, 0, 0) table_DIXMAAN['B'] = (1, 0.0625, 0.0625, 0.0625, 0, 0, 0, 1) table_DIXMAAN['C'] = (1, 0.125, 0.125, 0.125, 0, 0, 0, 0) table_DIXMAAN['D'] = (1, 0.26, 0.26, 0.26, 0, 0, 0, 0) table_DIXM...
normal
{ "blob_id": "7026f4549019c25cb736af556fe46fd360fba46f", "index": 2238, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef DIXMAAN(type):\n\n def DIXMAAN_(n):\n name = 'DIXMAAN%c function (CUTE)' % type\n alpha, beta, gamma, sigma, k1, k2, k3, k4 = table_DIXMAAN[type]\n m = n /...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Embedding(Module): def __init__(self, embed_nums, embed_dims, bias=False, name='embedding'): super(Embedding, self).__init__(name=name) self.embed_nums = embed_nums self.embed_dims = embed_dims with utils.scope(name): self.weight = nn...
flexible
{ "blob_id": "c773b273ad6953bf9c74b11c44aff16e9fd0860e", "index": 3468, "step-1": "<mask token>\n\n\nclass Embedding(Module):\n\n def __init__(self, embed_nums, embed_dims, bias=False, name='embedding'):\n super(Embedding, self).__init__(name=name)\n self.embed_nums = embed_nums\n self.emb...
[ 7, 9, 10, 12, 13 ]
<|reserved_special_token_0|> class StaticBox(wx.Dialog): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class StaticBox(wx.Dialog): def __init__(self, parent, id, title): wx.Dialog.__init__(se...
flexible
{ "blob_id": "96bf6220bfc884e3a19f70a63d9ecba449e2e7e2", "index": 6108, "step-1": "<mask token>\n\n\nclass StaticBox(wx.Dialog):\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass StaticBox(wx.Dialog):\n\n def __init__(self, parent, id, title):\n wx.Dialog.__i...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def my_logistic(x, a, b, c): return c / (1 + a * np.exp(-b * x)) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> matplotlib.use('Agg') <|reserved_special_token_0|> df_mrns.sort_values('COLLECTION_DT', inplace=True) df_mrns.drop_duplicates('M...
flexible
{ "blob_id": "dcef5f34a62939d992a109e991552e612bf5bad5", "index": 4619, "step-1": "<mask token>\n\n\ndef my_logistic(x, a, b, c):\n return c / (1 + a * np.exp(-b * x))\n\n\n<mask token>\n", "step-2": "<mask token>\nmatplotlib.use('Agg')\n<mask token>\ndf_mrns.sort_values('COLLECTION_DT', inplace=True)\ndf_mr...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(suv_data.head(10)) print('the no of passengers in the list is' + str(len(suv_data.index))) sns.countplot(x='Purchased', data=suv_data) sns.countplot(x='Purchased', hue='Gender', data=suv_data) suv_data['Age'].plot.hist() suv...
flexible
{ "blob_id": "c955057d7f8d5289898ecb96a290f5a7d241b787", "index": 6440, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(suv_data.head(10))\nprint('the no of passengers in the list is' + str(len(suv_data.index)))\nsns.countplot(x='Purchased', data=suv_data)\nsns.countplot(x='Purchased', hue='Gender', ...
[ 0, 1, 2, 3, 4 ]
from django.contrib import admin from django.urls import path, include from django.conf import settings from rest_framework_swagger.views import get_swagger_view schema_view = get_swagger_view(title='API') from django.contrib.auth import views as auth_views urlpatterns = [ path('django-admin/', admin.site.urls)...
normal
{ "blob_id": "987d6c769a4f593405e889ed2b0e3f9955900406", "index": 856, "step-1": "<mask token>\n", "step-2": "<mask token>\nif settings.DEBUG and 'debug_toolbar' in settings.INSTALLED_APPS:\n import debug_toolbar\n urlpatterns = [path('__debug__/', include(debug_toolbar.urls))\n ] + urlpatterns\n",...
[ 0, 1, 2, 3, 4 ]
import csv as csv import hashlib from sets import Set def func_hash(parameter): hash_object = hashlib.sha384(parameter) table_hash = hash_object.hexdigest() return table_hash def myFunk(): with open('users.csv', 'w') as fp: a = csv.writer(fp, delimiter=',') roles = ['inspector', 'admin'] d...
normal
{ "blob_id": "96d13a883590ca969e997bbb27bcdbee1b24252f", "index": 2730, "step-1": "<mask token>\n\n\ndef myFunk():\n with open('users.csv', 'w') as fp:\n a = csv.writer(fp, delimiter=',')\n roles = ['inspector', 'admin']\n data = [['Userneme', 'hash_password', 'role'], ['Olya', func_hash(\...
[ 1, 2, 3, 4, 5 ]
""" URL Configuration to test mounting created urls from registries """ from django.contrib import admin from django.urls import include, path from staticpages.loader import StaticpagesLoader staticpages_loader = StaticpagesLoader() urlpatterns = [ path("admin/", admin.site.urls), # Add base pages urls usi...
normal
{ "blob_id": "333914f99face050376e4713ca118f2347e50018", "index": 989, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns.append(path('sub/', include(\n 'sandbox.staticpages_testapp.sub_urls')))\n", "step-3": "<mask token>\nstaticpages_loader = StaticpagesLoader()\nurlpatterns = [path('admin/...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class FilebasedUniqueConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class FilebasedUniqueConfig(AppConfig): name = 'paperme...
flexible
{ "blob_id": "2d17229afe154937132c1e4f8c138896da34ab61", "index": 1430, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass FilebasedUniqueConfig(AppConfig):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass FilebasedUniqueConfig(AppConfig):\n name = 'papermerge.filebase...
[ 0, 1, 2, 3 ]
import os, sys from scrapy.cmdline import execute sys.path.append(os.path.dirname(os.path.abspath(__file__))) execute('scrapy crawl laptop'.split())
normal
{ "blob_id": "71ff8e8a62a3b2731071ed7a039b51c150ebaca4", "index": 3671, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append(os.path.dirname(os.path.abspath(__file__)))\nexecute('scrapy crawl laptop'.split())\n", "step-3": "import os, sys\nfrom scrapy.cmdline import execute\nsys.path.append(os...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def download_image(url: str) ->bool: img_tag_regex = '<img.*?src="(.*?)"[^\\>]+>' response = requests.get(url) if response.status_code != 200: return False text = response.text image_links = re.findal...
flexible
{ "blob_id": "268c36f6fb99383ea02b7ee406189ffb467d246c", "index": 6554, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef download_image(url: str) ->bool:\n img_tag_regex = '<img.*?src=\"(.*?)\"[^\\\\>]+>'\n response = requests.get(url)\n if response.status_code != 200:\n return False...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python from math import ceil, floor, sqrt def palindromes(n: int) -> int: """yield successive palindromes starting at n""" # 1 -> 2 -> 3 ... 9 -> 11 -> 22 -> 33 -> 44 .. 99 -> 101 # 101 -> 111 -> 121 -> 131 -> ... -> 191 -> 202 -> 212 # 989 -> 999 -> 1001 -> 1111 -> 1221 # 9889 -> 9...
normal
{ "blob_id": "b07073a7f65dbc10806b68729f21a8bc8773a1ab", "index": 3836, "step-1": "<mask token>\n\n\nclass Solution:\n\n def primePalindrome(self, N: int) ->int:\n \"\"\"return lowest prime palindrome >= N\"\"\"\n for p in palindromes(N):\n if isPrime(p):\n return p\n", ...
[ 2, 3, 4, 5, 6 ]
from .hacker import HackerRegistrationPage from .judge import JudgeRegistrationPage from .mentor import MentorRegistrationPage from .organizer import OrganizerRegistrationPage from .user import UserRegistrationPage
normal
{ "blob_id": "34f3212b0254cbcb5e1ca535a29d4fe820dcaad8", "index": 2978, "step-1": "<mask token>\n", "step-2": "from .hacker import HackerRegistrationPage\nfrom .judge import JudgeRegistrationPage\nfrom .mentor import MentorRegistrationPage\nfrom .organizer import OrganizerRegistrationPage\nfrom .user import Use...
[ 0, 1 ]
import cv2 import numpy as np from pycocotools.coco import maskUtils # from dataset.augmentors import FlipTransform, joints_to_point8, point8_to_joints, AugImgMetadata # from dataset.base_dataflow import Meta from dataset.augmentors import FlipTransform, joints_to_point8, point8_to_joints, AugImgMetadata from data...
normal
{ "blob_id": "e47223622a2718830d830dbb779800659d659ae3", "index": 8472, "step-1": "<mask token>\n\n\ndef augment(components, augmentors, use_o=False):\n \"\"\"\n Augmenting of images.\n\n :param components: components\n :return: updated components.\n \"\"\"\n img_path = components[0]\n height...
[ 2, 4, 5, 6, 7 ]
from django.test import TestCase from ..models import FearConditioningData, FearConditioningModule from ..registry import DataViewsetRegistry, ModuleRegistry class ModuleRegistryTest(TestCase): def test_register_module_create_view(self) -> None: registry = ModuleRegistry() registry.register(Fear...
normal
{ "blob_id": "14cc048f517efd3dad9960f35fff66a78f68fb45", "index": 8975, "step-1": "<mask token>\n\n\nclass DataViewsetRegistryTest(TestCase):\n <mask token>\n", "step-2": "<mask token>\n\n\nclass DataViewsetRegistryTest(TestCase):\n\n def test_register_data_model(self) ->None:\n registry = DataView...
[ 1, 2, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def truecase_is(string): """ -> lower/title/upper/other """ if string.islower(): return 'l' if string.istitle(): return 't' if string.isupper(): return 'u' return 'o' <|reserved_spec...
flexible
{ "blob_id": "75ddcdd4e80b962198ff9de1d996837927c3ac1a", "index": 824, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef truecase_is(string):\n \"\"\" -> lower/title/upper/other \"\"\"\n if string.islower():\n return 'l'\n if string.istitle():\n return 't'\n if string.isuppe...
[ 0, 3, 4, 5, 6 ]
from django.urls import path from . import views from django.contrib.auth import views as auth_views urlpatterns = [ path('',views.index,name='index'), path('sign',views.sign,name='sign'), # path('password_reset/',auth_views.PasswordResetView.as_view(),name='password_reset'), # path('password_reset/do...
normal
{ "blob_id": "7e35c35c8ef443155c45bdbff4ce9ad07b99f144", "index": 9983, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', views.index, name='index'), path('sign', views.sign,\n name='sign'), path('reset_password/', auth_views.PasswordResetView.\n as_view(template_name='password_...
[ 0, 1, 2, 3 ]
# from django.shortcuts import render # from django.http import HttpResponse from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage from django.views import generic from django.urls import reverse_lazy from django.shortcuts import render, redirect, get_object_or_404 from django.contrib.auth import aut...
normal
{ "blob_id": "c4b4585501319fd8a8106c91751bb1408912827a", "index": 3180, "step-1": "<mask token>\n\n\ndef top(request):\n return render(request, 'new_questions.html', {'title': 'Топ вопросов',\n 'questions': paginate(request, models.Question.objects.get_hot()),\n 'tags': paginate(request, models.T...
[ 8, 12, 13, 18, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('mykey.key', 'rb') as mykey: key = mykey.read() <|reserved_special_token_0|> with open('encryptedpassword.txt', 'rb') as encrypted_password_file: encrypte_file = encrypted_password_file.read() <|reserved_special_...
flexible
{ "blob_id": "df828344b81a40b7101adcc6759780ea84f2c6b4", "index": 4698, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('mykey.key', 'rb') as mykey:\n key = mykey.read()\n<mask token>\nwith open('encryptedpassword.txt', 'rb') as encrypted_password_file:\n encrypte_file = encrypted_password_...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @pytest.mark.parametrize('nrow,njob', [(793, 13), (700, 1), (700, 700)]) def test_distribute_jobs_sequential(nrow, njob): assigned = [] for i in range(njob): assigned.extend(utils.distribute_jobs(i, njob, nrow, interlaced=False)) assigned = np.sort(np.asarray(assigned)...
flexible
{ "blob_id": "a513dfd84b5d9267b7e96fedc88e5b6dabeea19e", "index": 640, "step-1": "<mask token>\n\n\n@pytest.mark.parametrize('nrow,njob', [(793, 13), (700, 1), (700, 700)])\ndef test_distribute_jobs_sequential(nrow, njob):\n assigned = []\n for i in range(njob):\n assigned.extend(utils.distribute_job...
[ 4, 6, 7, 8, 9 ]
import numpy as np import scipy.io as sio import os import torch from torchvision.utils import save_image from tools import * def test(config, base, loaders, brief): compute_and_save_features(base, loaders) results = evalutate(config, base, brief) return results def evalutate(config, base, brief=False): re...
normal
{ "blob_id": "b21796a9e10314f80cac3151d1fdbb139966303f", "index": 5555, "step-1": "<mask token>\n\n\ndef test(config, base, loaders, brief):\n compute_and_save_features(base, loaders)\n results = evalutate(config, base, brief)\n return results\n\n\ndef evalutate(config, base, brief=False):\n results =...
[ 2, 3, 4, 5, 6 ]