code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> def get_data(YOUTUBE_API_KEY, videoId, maxResults, nextPageToken): """ Получение информации со страницы с видео по video id """ YOUTUBE_URI = ( 'https://www.googleapis.com/youtube/v3/commentThreads?key={KEY}&textFormat=plainText&' + 'part=snippet&v...
flexible
{ "blob_id": "4ed5ceb784fb1e3046ab9f10c4b556f2e94274db", "index": 7054, "step-1": "<mask token>\n\n\ndef get_data(YOUTUBE_API_KEY, videoId, maxResults, nextPageToken):\n \"\"\"\n Получение информации со страницы с видео по video id\n \"\"\"\n YOUTUBE_URI = (\n 'https://www.googleapis.com/youtub...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class FlaskConfig(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class FlaskConfig(object): SECRET_KEY = os.environ.get('FLASK_SECRET_KEY') or 'TuLAsWbcoKr5YhDE'...
flexible
{ "blob_id": "a0349abb3a56ff4bc1700dbf0fa5a1fc2e3453ce", "index": 6469, "step-1": "<mask token>\n\n\nclass FlaskConfig(object):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass FlaskConfig(object):\n SECRET_KEY = os.environ.get('FLASK_SECRET_KEY') or 'TuLAsWbcoKr5Y...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import os, pickle, json, ast import pandas as pd from scipy import spatial import numpy as np from scipy import stats from sklearn.model_selection import train_test_split from sklearn import preprocessing from sklearn.svm import LinearSVC from sklearn.metrics import preci...
normal
{ "blob_id": "c23bd136991bfb41f153321420c2fcfba0c843f4", "index": 1513, "step-1": "<mask token>\n\n\nclass TaskSolver:\n <mask token>\n <mask token>\n <mask token>\n\n def task_calculate_cosin_similarity(self, word1, word2, print_to_screen\n =True):\n sim = 0\n if word1 in self.W2...
[ 7, 11, 12, 15, 16 ]
""" pokespeare.http.py ~~~~~~~~~~~~~~~~~~ Contains definitions of custom HTTP clients, allowing for more flexibility on the library choice """ import abc import requests from typing import Dict, Tuple, Any from .exceptions import HTTPError, UnexpectedError import requests_cache class HTTPClient(abc.ABC): """Bas...
normal
{ "blob_id": "1a126ba7e73eb2e7811ab32146fe5aee6c6b30f9", "index": 4290, "step-1": "<mask token>\n\n\nclass HTTPClient(abc.ABC):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @abc.abstractmethod\n def post(self, url: str, **kwargs: Dict[str, Any]) ->Any:\n ...
[ 8, 10, 11, 14, 15 ]
#!/usr/local/bin/python ''' side_on.py Open a 3d trajectory file (x y z) and produce a side-on plot of the y-z plane, with straight line between start and end and a virtual wall superimposed at 10 yards. arg1 = infile arg2 = optional outfile ''' import sys import matplotlib.pyplot as plt infile...
normal
{ "blob_id": "146aca6c7da17ddccb815638292cbcdda66f28e6", "index": 7035, "step-1": "#!/usr/local/bin/python\n\n''' side_on.py\n\n Open a 3d trajectory file (x y z) and produce a side-on plot of the\n y-z plane, with straight line between start and end and a virtual\n wall superimposed at 10 yards.\n\n ...
[ 0 ]
<|reserved_special_token_0|> class TransactionStack: <|reserved_special_token_0|> def transaction_stack(self, transaction, customer_name, company_name, no_of_share, cost, time): new_transaction = {'transaction': transaction, 'customer_name': customer_name, 'company_name': company_...
flexible
{ "blob_id": "30a2358e8396d24d6c3cd72d04321aa9f9f83995", "index": 8233, "step-1": "<mask token>\n\n\nclass TransactionStack:\n <mask token>\n\n def transaction_stack(self, transaction, customer_name, company_name,\n no_of_share, cost, time):\n new_transaction = {'transaction': transaction, 'cu...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Database created........') print('List of databases after creating new one') print(client.list_database_names()) <|reserved_special_token_0|> meta.create_all(engine) <|reserved_special_token_1|> client = MongoClient('loc...
flexible
{ "blob_id": "5b7567129d447ae2b75f4a8f9c26127f8b7553ec", "index": 7818, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Database created........')\nprint('List of databases after creating new one')\nprint(client.list_database_names())\n<mask token>\nmeta.create_all(engine)\n", "step-3": "client = ...
[ 0, 1, 2, 3 ]
from redis_db import RedisClient from setting import TEST_URL import requests class Test_Proxy(): def __init__(self): self.db=RedisClient() def proxy_test(self, proxy): url = TEST_URL proxies={ "http":proxy, "https":proxy } # print("{}(测试中)".form...
normal
{ "blob_id": "2cbdb828ab6e0ad44154f0c5b2a1d807fd0d2520", "index": 8783, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Test_Proxy:\n\n def __init__(self):\n self.db = RedisClient()\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Test_Proxy:\n\n def __init__(self):\n ...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def stats_print(): print('The coffee machine has:') print(str(water) + ' of water') print(str(milk) + ' of milk') print(str(coffee) + ' of coffee beans') print(str(cups) + ' of disposable cups') print(str...
flexible
{ "blob_id": "4e98ebd040297cb9472368478452bc484e0aaa04", "index": 3255, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef stats_print():\n print('The coffee machine has:')\n print(str(water) + ' of water')\n print(str(milk) + ' of milk')\n print(str(coffee) + ' of coffee beans')\n prin...
[ 0, 2, 6, 7, 8 ]
#Import dependencies import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import numpy as np import string import operator from sklearn.feature_extraction.text import CountVectorizer import pickle import nltk from nltk.corpus import stopwords #nltk.download('stopwords') from nltk.tokenize import wo...
normal
{ "blob_id": "82f86284dddf48bf2c65ddf55eb6d7a372306373", "index": 7182, "step-1": "<mask token>\n\n\ndef positive_words(scrape_results_df):\n\n def text_process(text):\n nopunc = [char for char in text if char not in string.punctuation]\n nopunc = ''.join(nopunc)\n return [word for word in...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- import requests import os def line(body): url = "https://notify-api.line.me/api/notify" access_token = 'I89UnoDRgRSInUXJOTg5fAniBE08CUuxVqj8ythMLt8' headers = {'Authorization': 'Bearer ' + access_token} message = body payload = {'message': message} r = requests.post(url...
normal
{ "blob_id": "8b598703df67fb8287fe6cdccda5b73bf2892da8", "index": 4878, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef line(body):\n url = 'https://notify-api.line.me/api/notify'\n access_token = 'I89UnoDRgRSInUXJOTg5fAniBE08CUuxVqj8ythMLt8'\n headers = {'Authorization': 'Bearer ' + acces...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Game: def __init__(self, Grille, PlayerX, PlayerY, Score=0): self.PlayerX = PlayerX self.PlayerY = PlayerY self.Score = Score self.Grille = Grille def copy(self): return copy.deepcopy(self) <|reserved_special_token_0|> def Affich...
flexible
{ "blob_id": "86177dfa9b8bed5916703edcc16ea4d01cbabf84", "index": 3278, "step-1": "<mask token>\n\n\nclass Game:\n\n def __init__(self, Grille, PlayerX, PlayerY, Score=0):\n self.PlayerX = PlayerX\n self.PlayerY = PlayerY\n self.Score = Score\n self.Grille = Grille\n\n def copy(s...
[ 8, 11, 14, 15, 17 ]
#!/usr/bin/python2 import md5 from pwn import * import time LIMIT = 500 TARGET = "shell2017.picoctf.com" PORT = 46290 FILE = "hash.txt" def generate_hashes(seed): a = [] current_hash = seed for i in range(1000): current_hash = md5.new(current_hash).hexdigest() a.append(current_hash)...
normal
{ "blob_id": "5e78992df94cbbe441495b7d8fb80104ec000748", "index": 6728, "step-1": "<mask token>\n\n\ndef generate_hashes(seed):\n a = []\n current_hash = seed\n for i in range(1000):\n current_hash = md5.new(current_hash).hexdigest()\n a.append(current_hash)\n return a\n\n\ndef find_prev...
[ 5, 7, 9, 10, 11 ]
<|reserved_special_token_0|> class sfp_googlesearch(SpiderFootPlugin): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def watchedEvents(self): return ['INTERNET_NAME'] def producedEv...
flexible
{ "blob_id": "3a6eaa238e78e7a818bcf6e18cc7881eadf94b07", "index": 7863, "step-1": "<mask token>\n\n\nclass sfp_googlesearch(SpiderFootPlugin):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def watchedEvents(self):\n return ['INTERNET_NAME']\n\n def prod...
[ 4, 5, 7, 8, 9 ]
<|reserved_special_token_0|> class Unit(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Unit(models.Model): <|reserved_special_token_0|> <|res...
flexible
{ "blob_id": "fa880adcb9f009ffc206de59e8284ac6350fef4c", "index": 5948, "step-1": "<mask token>\n\n\nclass Unit(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Unit(models.Model):\n <mask token>\n <mask token>\n <mask token>\...
[ 1, 2, 3, 4, 5 ]
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License from .attack_models import (DriftAttack, AdditiveGaussian, RandomGaussian, BitFlipAttack, RandomSignFlipAttack) from typing import Dict def get_attack(attack_config: Dict): if attack_config["attack_model"] == 'drif...
normal
{ "blob_id": "11320922d24b27c5cfa714f88eb0a757deef987f", "index": 8546, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_attack(attack_config: Dict):\n if attack_config['attack_model'] == 'drift':\n return DriftAttack(attack_config=attack_config)\n elif attack_config['attack_model']...
[ 0, 1, 2, 3, 4 ]
import re BASICPATTERN = '[!/](%s)\s{,1}(.*)' # example "/animefind baka" -> (animefind, baka) # returns compiled BASICPATTERN for each given string def basicRegex(strings): if not isinstance(strings,list): return [] ans = [] for string in strings: pattern = re.compile(BASICPATTERN % st...
normal
{ "blob_id": "1a28aea824752d18cbd462693f8f8980dba4974e", "index": 9387, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef basicRegex(strings):\n if not isinstance(strings, list):\n return []\n ans = []\n for string in strings:\n pattern = re.compile(BASICPATTERN % string.strip(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('Hello' * 5) <|reserved_special_token_1|> print ("Hello"*5)
flexible
{ "blob_id": "9ae7b6d081529a5c70b7362c852647b3638e7e98", "index": 8105, "step-1": "<mask token>\n", "step-2": "print('Hello' * 5)\n", "step-3": "print (\"Hello\"*5)\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|> setup(name='pybanery', version='1.0', description= 'Python interface for Kanbanery', author='Pablo Lluch', author_email= 'pablo.lluch@gmail.com', py_modules=['pybanery'], scripts=['pybanery']) <|reserved_special_token_1|...
flexible
{ "blob_id": "60c862accbb9cda40ed4c45491f643f065e2868a", "index": 6467, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='pybanery', version='1.0', description=\n 'Python interface for Kanbanery', author='Pablo Lluch', author_email=\n 'pablo.lluch@gmail.com', py_modules=['pybanery'], script...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def train(): args = get_args() os.makedirs(args.model_path, exist_ok=True) set_seed(args.seed) """ To follow this training routine you need a DataLoader that yields the tuples of the following format: (Bx3xHxW FloatTensor x, BxHxW LongTensor y, BxN LongTens...
flexible
{ "blob_id": "75e6554ea3c327c87a2a65710a7f1d55e9933bb0", "index": 276, "step-1": "<mask token>\n\n\ndef train():\n args = get_args()\n os.makedirs(args.model_path, exist_ok=True)\n set_seed(args.seed)\n \"\"\"\n To follow this training routine you need a DataLoader that yields the tuples of the...
[ 1, 3, 4, 5, 6 ]
import datetime class Event(object): def __init__(self): self.id = None self.raw = None self.create_dt = datetime.datetime.now() self.device_id = None self.collector_id = None self.device_hostname = None self.device_domain_name = None self.device_ip...
normal
{ "blob_id": "7554b00f8c4d40f1d3ee2341f118048ca7ad10ea", "index": 709, "step-1": "<mask token>\n\n\nclass Event(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Event(object):\n <mask token>\n\n def to_dict(self):\n d = {}\n for item in self.__dict__:\n ...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Train size: {}'.format(len(train))) print('Test size: {}'.format(len(test))) <|reserved_special_token_0|> vf.add(Dense(800, activation='sigmoid', input_shape=784, optimizer='Momentum')) vf.add(Dropout(0.5, input_shape=800))...
flexible
{ "blob_id": "94d296b5a13bfa59dba5812da31707f9db9080af", "index": 1292, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Train size: {}'.format(len(train)))\nprint('Test size: {}'.format(len(test)))\n<mask token>\nvf.add(Dense(800, activation='sigmoid', input_shape=784, optimizer='Momentum'))\nvf.add...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class StudentForm(forms.Form): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class EmployeeForm(forms.ModelForm): class Meta: model = Employee fields = '__all__' <|reserved_spec...
flexible
{ "blob_id": "0b141ecca501c21df50e76d0841dd5651274f0da", "index": 8509, "step-1": "<mask token>\n\n\nclass StudentForm(forms.Form):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass EmployeeForm(forms.ModelForm):\n\n\n class Meta:\n model = Employee\n fields = '__...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class testAbRectangularGridBuilder(unittest.TestCase): def getMockHiResAlphaMtxAndCstCellDet(self, posCellCentroids=None): class _mockClass: def __init__(self, posCellCentroids): self.posCellCentroids = posCellCentroids self.cell...
flexible
{ "blob_id": "6175ce6534d44d703df6cdef94fc2b1285e25f49", "index": 2202, "step-1": "<mask token>\n\n\nclass testAbRectangularGridBuilder(unittest.TestCase):\n\n def getMockHiResAlphaMtxAndCstCellDet(self, posCellCentroids=None):\n\n\n class _mockClass:\n\n def __init__(self, posCellCentroids):...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plugin.register_formats(SBMLFormat, SBMLDirectory, JSONFormat, JSONDirectory, CommunityModelFormat, CommunityModelManifest, CommunityModelDirectory, GrowthRates, Fluxes, MicomResultsDirectory, MicomMediumFile, MicomMed...
flexible
{ "blob_id": "9a6f159d9208ee9e337de7b717e2e25c7e7f9f06", "index": 4277, "step-1": "<mask token>\n", "step-2": "<mask token>\nplugin.register_formats(SBMLFormat, SBMLDirectory, JSONFormat,\n JSONDirectory, CommunityModelFormat, CommunityModelManifest,\n CommunityModelDirectory, GrowthRates, Fluxes, MicomRe...
[ 0, 1, 2, 3, 4 ]
s = input() st = '>>-->' st2 = '<--<<' sch1 = sch2 = 0 i = 0 j = 0 k = -1 while i != -1: i = s.find(st, j) if (k != i) and (i != -1): k = i sch1 += 1 j += 1 j = 0 i = 0 k = -1 while i != -1: i = s.find(st2, j) if (k != i) and (i != -1): k = i sch2 += 1 j += 1 prin...
normal
{ "blob_id": "c18e452592d53f22858f2307c60aa997b809c3c3", "index": 4356, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile i != -1:\n i = s.find(st, j)\n if k != i and i != -1:\n k = i\n sch1 += 1\n j += 1\n<mask token>\nwhile i != -1:\n i = s.find(st2, j)\n if k != i and i ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class LinkedList: def __init__(self): self.head = None def insertAtHead(self, newNode, curNode): newNode.next = curNode if curNode is not None: curNode.prev = newNode self.head = newNode <|reserved_special_token_0|> def printF...
flexible
{ "blob_id": "a3cbdecbbfc49e8ac045f4aabbea6b9f54ed3d5f", "index": 4904, "step-1": "<mask token>\n\n\nclass LinkedList:\n\n def __init__(self):\n self.head = None\n\n def insertAtHead(self, newNode, curNode):\n newNode.next = curNode\n if curNode is not None:\n curNode.prev = ...
[ 5, 7, 8, 9, 11 ]
import ujson as json import platform import socket import os from pathlib import Path def test_json(text): jobj = json.loads(text) l = len(jobj['coordinates']) x = 0 y = 0 z = 0 for coord in jobj['coordinates']: x += coord['x'] y += coord['y'] z += coord['z'] print(x / l...
normal
{ "blob_id": "6f99b4e4204e85c78f9c02a5cd53cd76f52c022c", "index": 617, "step-1": "<mask token>\n\n\ndef notify(msg):\n with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:\n if not s.connect_ex(('localhost', 9001)):\n s.sendall(bytes(msg, 'utf8'))\n\n\n<mask token>\n", "step-2": "<m...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def del_flu_sym(x, t=1, Ka=1, Ktt=0.5): intens = x ** 2 return intens <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def del_flu_sym(x, t=1, Ka=1, Ktt=0.5): intens = x ** 2 return intens <|reserved_special_token_0|> print(dl...
flexible
{ "blob_id": "903a431ac39734338b4d464629b4b04a87dc9e8e", "index": 1776, "step-1": "<mask token>\n\n\ndef del_flu_sym(x, t=1, Ka=1, Ktt=0.5):\n intens = x ** 2\n return intens\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef del_flu_sym(x, t=1, Ka=1, Ktt=0.5):\n intens = x ** 2\n return intens\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @pytest.mark.parametrize('input, expected', [pytest.param(5, 12, marks= pytest.mark.example), pytest.param(50, 20492570929, marks=pytest.mark. regression)]) def test_challenge116(input, expected): """ Regression test...
flexible
{ "blob_id": "c9279434736d4e94564170fe98163ad3be9470b1", "index": 4844, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.parametrize('input, expected', [pytest.param(5, 12, marks=\n pytest.mark.example), pytest.param(50, 20492570929, marks=pytest.mark.\n regression)])\ndef test_challe...
[ 0, 1, 2, 3 ]
# http://www.dalkescientific.com/writings/diary/archive/2007/10/07/wide_finder.html ''' Making a faster standard library approach As I was writing an email to Fredrik describing these results, I came up with another approach to speeding up the performance, using only the standard library. Fredrik showed that using a ...
normal
{ "blob_id": "734fd4c492f2fd31a0459e90e5c4a7468120b4cd", "index": 2369, "step-1": "# http://www.dalkescientific.com/writings/diary/archive/2007/10/07/wide_finder.html\n'''\nMaking a faster standard library approach\n\nAs I was writing an email to Fredrik describing these results,\nI came up with another approach ...
[ 0 ]
import json from gamestate.gamestate_module import Gamestate from time import time from gamestate import action_getter as action_getter def test_action_getter(): path = "./../Version_1.0/Tests/General/Action_1.json" document = json.loads(open(path).read()) gamestate = Gamestate.from_document(document["gam...
normal
{ "blob_id": "b16691429d83f6909a08b10cc0b310bb62cd550d", "index": 3985, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_action_getter():\n path = './../Version_1.0/Tests/General/Action_1.json'\n document = json.loads(open(path).read())\n gamestate = Gamestate.from_document(document['g...
[ 0, 1, 2, 3 ]
# Generated by Django 3.0.5 on 2020-05-18 12:50 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('cart', '0010_auto_20200518_1718'), ] operations = [ migrations.AlterField( model_name='order', name='fianl_code', ...
normal
{ "blob_id": "da783355c5f888a66f623fa7eeeaf0e4e9fcfa48", "index": 4982, "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 = [('cart', '001...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def getlessonlist(): path = os.path.expanduser('~/.buzzers') dirs = os.walk(os.path.expanduser('~/.buzzers/lessons')) lessons = [] for root, d, fs in dirs: fullfs = [(root + '/' + f) for f in fs] ...
flexible
{ "blob_id": "de003440be513d53b87f526ea95c0fbbc4a9f66f", "index": 2584, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getlessonlist():\n path = os.path.expanduser('~/.buzzers')\n dirs = os.walk(os.path.expanduser('~/.buzzers/lessons'))\n lessons = []\n for root, d, fs in dirs:\n ...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # encoding: utf-8 """ @description: 有序字典 (notice: python3.6 以后字典已经有序了) @author: baoqiang @time: 2019/11/28 1:34 下午 """ from collections import OrderedDict def run206_01(): print('Regular dict:') # d = {'a':'A','b':'B','c':'C'} d = {} d['a'] = 'A' d['b'] = 'B' d['c'] = ...
normal
{ "blob_id": "4a7d8db2bc3b753ea1a12120e1ad85f31d572dc7", "index": 4237, "step-1": "<mask token>\n\n\ndef run206_01():\n print('Regular dict:')\n d = {}\n d['a'] = 'A'\n d['b'] = 'B'\n d['c'] = 'C'\n for k, v in d.items():\n print(k, v)\n print('OrderedDict:')\n d = OrderedDict()\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class nodo: def __init__(self, x, y, n, c): self.columna = x self.fila = y self.nombre = n self.color = c <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class nodo: def __init__(self, x, y, n, c): ...
flexible
{ "blob_id": "70373c74e459efb2a310d94ae906910423e8bfd4", "index": 6631, "step-1": "<mask token>\n\n\nclass nodo:\n\n def __init__(self, x, y, n, c):\n self.columna = x\n self.fila = y\n self.nombre = n\n self.color = c\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass nodo:...
[ 2, 3, 4, 5, 6 ]
# -- !/python3.10 # Mikhail (myke) Kolodin, 2021 # 2021-10-21 2021-10-21 1.2 # retext.py # Заменить во входном тексте указанное слово на случайный вариант # из предложенного набора заменителей. # Параметры - в командной строке. import re, random, sys fin = 'retext-in.txt' fot = 'retext-out.txt' t1 = """ here we go...
normal
{ "blob_id": "d1a179acfda9e76a11f362671fafb50773e2b9d3", "index": 9405, "step-1": "<mask token>\n\n\ndef redo(text: str, aword: str, subs: list) ->str:\n \"\"\" заменятель \"\"\"\n return re.sub(f'(\\\\W){aword}(\\\\W)', '\\\\1' + random.choice(subs) + '\\\\2',\n ' ' + text + ' ').strip()\n\n\ndef te...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def test_insert_and_get_db(data): db.insert(data) result = db.get_db() return result == data <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_insert_and_get_db(data): db.insert(data) result = db.get_db() return ...
flexible
{ "blob_id": "d5cb875dc31ca3dd7b165206415c346a076dd6e4", "index": 2901, "step-1": "<mask token>\n\n\ndef test_insert_and_get_db(data):\n db.insert(data)\n result = db.get_db()\n return result == data\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef test_insert_and_get_db(data):\n db.insert(dat...
[ 1, 2, 3, 4 ]
import random import glob import json import time from torch.utils.data import Dataset, DataLoader, SubsetRandomSampler from SimpleDataLoader import CustomDataset, get_params_from_filename import numpy as np from DNN_model import Net import torch.optim as optim import torch.nn as nn import torch from tqdm import tqdm ...
normal
{ "blob_id": "1f63f9234596787e4859b740d3a7fbfaacc9c0c8", "index": 9930, "step-1": "<mask token>\n\n\ndef zero_pad(values, max_m):\n m = len(values)\n values += [0] * (max_m - m)\n\n\ndef solve_with_solver(values_copy, n):\n return xpress_solver(values_copy, n)\n\n\ndef solve_with_net(values_copy, n):\n ...
[ 3, 5, 7, 9, 10 ]
<|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": "388772386f25d6c2f9cc8778b7ce1b2ad0920851", "index": 6986, "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', '0004...
[ 0, 1, 2, 3, 4 ]
import pyhs2 import sys import datetime i = datetime.datetime.now() # args if len(sys.argv) < 2: print "Run with python version 2.6" print "Requires arg: <orgId>" sys.exit() orgId = sys.argv[1] print "\n\nCreating document external ID manifest for Org ID: " + orgId ## strings fileLine = "%s\...
normal
{ "blob_id": "29c630b56eb56d91d1e917078138a2bbf562e0bf", "index": 579, "step-1": "import pyhs2\nimport sys\nimport datetime\ni = datetime.datetime.now()\n\n# args\nif len(sys.argv) < 2:\n print \"Run with python version 2.6\"\n print \"Requires arg: <orgId>\"\n sys.exit()\n\norgId = sys.argv[...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('token.txt', 'r') as f: token = f.read() headers = {'X-Xapp-Token': token} with open('dataset_24476_4.txt', 'r') as id: for line in id: address = 'https://api.artsy.net/api/artists/' + lin...
flexible
{ "blob_id": "e1ecc08f66e094841647f72b78bcd29ed8d32668", "index": 5976, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('token.txt', 'r') as f:\n token = f.read()\n headers = {'X-Xapp-Token': token}\n with open('dataset_24476_4.txt', 'r') as id:\n for line in id:\n addr...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- import os import sys import socket import signal import functools import atexit import tempfile from subprocess import Popen, PIPE, STDOUT from threading import Thread from queue import Queue, Empty from time import sleep import json from .exceptions import CommandError, TimeoutWaitingFor ON_PO...
normal
{ "blob_id": "7f220a970d65a91228501f7db59089e6c0604fb5", "index": 9915, "step-1": "<mask token>\n\n\ndef wait_condition(cond, timeout=1, sleeptime=0.01):\n \"\"\"Wait for condition to return anything other than None\n \"\"\"\n if timeout is None:\n timeout = 1\n if timeout < sleeptime:\n ...
[ 7, 11, 13, 14, 16 ]
<|reserved_special_token_0|> def outputQ() ->int: try: outputQ = int(input()) return outputQ finally: print('output quantity:' + str(outputQ)) <|reserved_special_token_0|> def quantityToOutput(outputQ: int) ->list: outputCount = 0 outputList = list() while outputCount <...
flexible
{ "blob_id": "da19bc4fc999bd48a3d55b8cb5f47ba6208bc02b", "index": 4502, "step-1": "<mask token>\n\n\ndef outputQ() ->int:\n try:\n outputQ = int(input())\n return outputQ\n finally:\n print('output quantity:' + str(outputQ))\n\n\n<mask token>\n\n\ndef quantityToOutput(outputQ: int) ->li...
[ 2, 4, 5, 6, 7 ]
from django.urls import path from . import views as user_views from produtos import views as prod_views from django.contrib.auth import views as auth_views app_name = 'user' urlpatterns = [ path('detalhes/', user_views.painel, name="painel"), path('produto/ajax/delete_prod/', prod_views.deleteProd, name="dele...
normal
{ "blob_id": "a7f2791e359b848a217beadc77fc983d971ef8b0", "index": 8436, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'user'\nurlpatterns = [path('detalhes/', user_views.painel, name='painel'), path(\n 'produto/ajax/delete_prod/', prod_views.deleteProd, name='deleteProd'),\n path('produt...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Wolfram(IPlugin): def can_perform(self, friday, request): return 'result' in request and 'resolvedQuery' in request['result' ] and 'action' in request['result'] and request['result']['action' ] == 'wisdom.unknown' def perform(self, friday, r...
flexible
{ "blob_id": "57564c2e94a65187bf5e033ee06926fb593e11a7", "index": 7733, "step-1": "<mask token>\n\n\nclass Wolfram(IPlugin):\n\n def can_perform(self, friday, request):\n return 'result' in request and 'resolvedQuery' in request['result'\n ] and 'action' in request['result'] and request['resu...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class FunctionalUnit: <|reserved_special_token_0|> <|reserved_special_token_0|> def __str__(self): return ( """ Id: {} Instruction Count: {} Latency: {} Status: {} ...
flexible
{ "blob_id": "a2a94e87bb9af1ccaf516581d6662d776caf0b0d", "index": 6284, "step-1": "<mask token>\n\n\nclass FunctionalUnit:\n <mask token>\n <mask token>\n\n def __str__(self):\n return (\n \"\"\"\n Id: {}\n Instruction Count: {}\n Latency:...
[ 7, 8, 11, 12, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: data = urllib.request.urlopen(img_url) raw_data = data.read() nparr = np.frombuffer(raw_data, np.byte) image_raw = cv2.imdecode(nparr, cv2.IMREAD_ANYCOLOR) cv2.imshow('test', image_raw) if cv2.w...
flexible
{ "blob_id": "c120db53e1ea5a5b865b891cf602a13113fb1e41", "index": 4113, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n data = urllib.request.urlopen(img_url)\n raw_data = data.read()\n nparr = np.frombuffer(raw_data, np.byte)\n image_raw = cv2.imdecode(nparr, cv2.IMREAD_ANYCOLOR)...
[ 0, 1, 2, 3, 4 ]
# -*- coding:utf-8 -* import tushare as ts import numpy as np import pandas as pd import datetime import chardet import urllib import urllib2 import re from bs4 import BeautifulSoup import time from pandas import Series,DataFrame def get_relation(stock1,stock2): hist_data = ts.get_hist_data(stock1,start='2018...
normal
{ "blob_id": "00f2aafe1a0c66d0414d189b9fa3bbc2da9fd727", "index": 2066, "step-1": "# -*- coding:utf-8 -*\nimport tushare as ts\nimport numpy as np\nimport pandas as pd\nimport datetime\nimport chardet\nimport urllib\nimport urllib2\nimport re\nfrom bs4 import BeautifulSoup\nimport time\nfrom pandas import Series...
[ 0 ]
from . import scramsha1, scrammer
normal
{ "blob_id": "8c336edddadbf4689721b474c254ded061ecf4b5", "index": 743, "step-1": "<mask token>\n", "step-2": "from . import scramsha1, scrammer\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
#coding=utf8 uu=u'中国' s = uu.encode('utf-8') if s == '中国' : print 11111 print u"一次性还本息".encode('utf-8')
normal
{ "blob_id": "9bf4725c054578aa8da2a563f67fd5c72c2fe831", "index": 8918, "step-1": "#coding=utf8\n\nuu=u'中国'\ns = uu.encode('utf-8')\nif s == '中国' :\n print 11111\nprint u\"一次性还本息\".encode('utf-8')\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class VimaptAbortOperationException(VimaptException): pass <|reserved_special_token_1|> from .VimaptException import VimaptException class VimaptAbortOperationException(VimaptException): pass
flexible
{ "blob_id": "f52bac3e658a34b82721746364fab11d25d470c4", "index": 5302, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass VimaptAbortOperationException(VimaptException):\n pass\n", "step-3": "from .VimaptException import VimaptException\n\n\nclass VimaptAbortOperationException(VimaptException)...
[ 0, 1, 2 ]
#!/usr/bin/env python # $Id: iprscan5_urllib2.py 2809 2015-03-13 16:10:25Z uludag $ # ====================================================================== # # Copyright 2009-2014 EMBL - European Bioinformatics Institute # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file ex...
normal
{ "blob_id": "3dd9ce6d5d1ba0bebadae4068e2c898802180e1d", "index": 8825, "step-1": "#!/usr/bin/env python\n# $Id: iprscan5_urllib2.py 2809 2015-03-13 16:10:25Z uludag $\n# ======================================================================\n#\n# Copyright 2009-2014 EMBL - European Bioinformatics Institute\n#\n#...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class MusicStore(Store): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class MusicStore(Store): def make_product(self, name): """Overides from parent - return a new ...
flexible
{ "blob_id": "0a50b31155afce2558ec066267a9fd0c56964759", "index": 5653, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass MusicStore(Store):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass MusicStore(Store):\n\n def make_product(self, name):\n \"\"\"Overides from parent - retur...
[ 0, 1, 2, 3, 4 ]
import pytest from pandas import ( Index, NaT, ) import pandas._testing as tm def test_astype_str_from_bytes(): # https://github.com/pandas-dev/pandas/issues/38607 idx = Index(["あ", b"a"], dtype="object") result = idx.astype(str) expected = Index(["あ", "a"], dtype="object") tm.assert_inde...
normal
{ "blob_id": "13b2fea09f5a4300563dd8870fe1841b47756b36", "index": 9972, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_astype_invalid_nas_to_tdt64_raises():\n idx = Index([NaT.asm8] * 2, dtype=object)\n msg = 'Cannot cast Index to dtype timedelta64\\\\[ns\\\\]'\n with pytest.raises(T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> """Project agnostic helper functions that could be migrated to and external lib. """
flexible
{ "blob_id": "f15bb4ab93ecb2689bf74687852e60dfa98caea9", "index": 7374, "step-1": "<mask token>\n", "step-2": "\"\"\"Project agnostic helper functions that could be migrated to and external lib.\n\"\"\"\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
import gitlab from core import settings gl = gitlab.Gitlab('https://gitlab.intecracy.com/', private_token='dxQyb5fNbLnBxvvpFjyc') gl.auth() project = gl.projects.get(settings.projectID) print(project) pipelines = project.pipelines.get(26452) print pipelines pipelines_jobs = pipelines.jobs.list()[2] jobs = project.j...
normal
{ "blob_id": "c7f8731fe58a0e0065827b82bb4ad4af670541db", "index": 5101, "step-1": "import gitlab\nfrom core import settings\n\n\ngl = gitlab.Gitlab('https://gitlab.intecracy.com/', private_token='dxQyb5fNbLnBxvvpFjyc')\n\ngl.auth()\n\nproject = gl.projects.get(settings.projectID)\nprint(project)\npipelines = proj...
[ 0 ]
#!/usr/bin/python2 import sys import argparse """ This program generates an extract table having the following format: <S1> <S2> <S3> ... <Sn> ||| <T1> <T2> <T3> ... <Tk> ||| 0-0 Each line is a mapping from a source sentence to target sentence with special delimiter characters. You can give the output of this s...
normal
{ "blob_id": "cf0cf028d5f67e8deca8ebd3ad76d9c1e3563002", "index": 258, "step-1": "#!/usr/bin/python2\n\nimport sys\nimport argparse\n\n\"\"\"\nThis program generates an extract table having the following format:\n <S1> <S2> <S3> ... <Sn> ||| <T1> <T2> <T3> ... <Tk> ||| 0-0\n\nEach line is a mapping from a sour...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): """ primary game method """ view = View() view.root.mainloop() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): """ primary game me...
flexible
{ "blob_id": "640eae824e43e394bf0624dd4cf7dcec78f43604", "index": 4947, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n \"\"\"\n primary game method\n \"\"\"\n view = View()\n view.root.mainloop()\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef main():\n \"\"\"\...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python import sys def trim_reads(fastq, selection, extra_cut, orientation, output, outputType, seqLen, trim): # Store all read/sequence ids that did not match with KoRV ids = [] with open(selection, 'r') as f: for line in f: ids.append(line.strip()) ...
normal
{ "blob_id": "3f3ed40bf800eddb2722171d5fd94f6c292162de", "index": 5865, "step-1": "<mask token>\n\n\ndef main():\n trim = sys.stdin.read()\n if len(sys.argv) > 7:\n trim_reads(sys.argv[1], sys.argv[2], int(sys.argv[3]), int(sys.argv\n [4]), sys.argv[5], sys.argv[6], int(sys.argv[7]), trim)...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i, s in enumerate(stick): if s == '(': temp.append(s) elif stick[i - 1] == '(': temp.pop() cnt += len(temp) else: temp.pop() cnt += 1 print(cnt) <|reserved_special_token_1|...
flexible
{ "blob_id": "9f38148c19f0cb9522725d9eb27c91f70055cba1", "index": 4998, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i, s in enumerate(stick):\n if s == '(':\n temp.append(s)\n elif stick[i - 1] == '(':\n temp.pop()\n cnt += len(temp)\n else:\n temp.pop()\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def stats_count_info(request): root_path = request.app['PATH-DB'] cpt = 0 d = dict() dirs_data = dict() for root, dirs, files in os.walk(root_path, topdown=False): cpt += len(files) size = sum(getsize(join(root, name)) for name in files) subdir_...
flexible
{ "blob_id": "7c9b51ae7cde9c3a00888dac6df710b93af6dd7f", "index": 4836, "step-1": "<mask token>\n\n\ndef stats_count_info(request):\n root_path = request.app['PATH-DB']\n cpt = 0\n d = dict()\n dirs_data = dict()\n for root, dirs, files in os.walk(root_path, topdown=False):\n cpt += len(file...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python # -*- coding: UTF-8 -*- """Project Euler: 0010 https://projecteuler.net/problem=10 Summation of primes The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. """ import math import sys PROBLEM = 10 SOLVED = True SPEED = 29.16 TAGS = ['primes']...
normal
{ "blob_id": "adf8b52f6e71546b591ceb34a9425c28f74883fa", "index": 6288, "step-1": "#!/usr/bin/env python\n# -*- coding: UTF-8 -*-\n\"\"\"Project Euler: 0010\n\nhttps://projecteuler.net/problem=10\n\nSummation of primes\n\nThe sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.\n\nFind the sum of all the primes belo...
[ 0 ]
<|reserved_special_token_0|> class dm107s: <|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|> def incremt(self, rl, pt, th, yw): ...
flexible
{ "blob_id": "ee8e117db0348aa37d6aa37e6c06255101f1cff4", "index": 2752, "step-1": "<mask token>\n\n\nclass dm107s:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def incremt(self, rl, pt, th, yw):\n self._value_to_change ...
[ 23, 29, 33, 39, 43 ]
<|reserved_special_token_0|> def index(): return 'too many secrets', 200, {'Content-Type': 'text/plain; charset=utf-8'} def get_at(): return oidc.get_access_token(), 200, {'Content-Type': 'text/plain; charset=utf-8'} <|reserved_special_token_0|> def get_test1(): return 'successful ca...
flexible
{ "blob_id": "ef3fa538828315845de5e2f7d4949f690e44276e", "index": 6009, "step-1": "<mask token>\n\n\ndef index():\n return 'too many secrets', 200, {'Content-Type':\n 'text/plain; charset=utf-8'}\n\n\ndef get_at():\n return oidc.get_access_token(), 200, {'Content-Type':\n 'text/plain; charset=...
[ 10, 11, 13, 15, 19 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> driver.get('https://www.baidu.com') <|reserved_special_token_0|> elem.send_keys('python selenium', Keys.ENTER) print(driver.page_source) <|reserved_special_token_1|> <|reserved_special_token_0|> driver = webdriver.Chrome() driv...
flexible
{ "blob_id": "3c8352ff2fc92ada1b58603df2a1a402e57842be", "index": 8606, "step-1": "<mask token>\n", "step-2": "<mask token>\ndriver.get('https://www.baidu.com')\n<mask token>\nelem.send_keys('python selenium', Keys.ENTER)\nprint(driver.page_source)\n", "step-3": "<mask token>\ndriver = webdriver.Chrome()\ndri...
[ 0, 1, 2, 3, 4 ]
import pytest from domain.story import Story from tests.dot_dictionary import DotDict @pytest.fixture() def deployed_story_over_a_weekend(): revision_0 = DotDict({ 'CreationDate': "2019-07-11T14:33:20.000Z" }) revision_1 = DotDict({ 'CreationDate': "2019-07-31T15:33:20.000Z", 'Descr...
normal
{ "blob_id": "d10c74338ea18ef3e5fb6a4dd2224faa4f94aa62", "index": 9950, "step-1": "<mask token>\n\n\ndef test_find_current_start_state():\n assert 'In-Progress' == Story.find_current_state_name({'Backlog',\n 'To-Do', 'In-Progress', 'Completed', 'Ready For Prod', 'Deployed'},\n {'In-Progress', 'De...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> fig.show() <|reserved_special_token_1|> <|reserved_special_token_0|> df = pd.read_csv('phone.csv') fig = ff.create_distplot([df['Avg Rating'].tolist()], ['Samsung'], show_hist=False) fig.show() <|reserved_special_token_1|...
flexible
{ "blob_id": "5ae4f489da7b4f0913c9b16c86cc60537cc51234", "index": 9858, "step-1": "<mask token>\n", "step-2": "<mask token>\nfig.show()\n", "step-3": "<mask token>\ndf = pd.read_csv('phone.csv')\nfig = ff.create_distplot([df['Avg Rating'].tolist()], ['Samsung'],\n show_hist=False)\nfig.show()\n", "step-4...
[ 0, 1, 2, 3, 4 ]
""" Use the same techniques such as (but not limited to): 1) Sockets 2) File I/O 3) raw_input() from the OSINT HW to complete this assignment. Good luck! """ import socket import re import time host = "cornerstoneairlines.co" # IP address here port = 45 # Port here def execute_cmd(cm...
normal
{ "blob_id": "e0f25addad8af4541f1404b76d4798d2223d9715", "index": 5116, "step-1": "<mask token>\n\n\ndef execute_cmd(cmd):\n \"\"\"\n Sockets: https://docs.python.org/2/library/socket.html\n How to use the socket s:\n\n # Establish socket connection\n s = socket.socket(socke...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python ############################################################################### # # # Project: # Purpose: # # # Author: Massimo Di Stefano , epiesasha@me.com # ############################################################################### # Copyright (c) 2009, Massimo Di Stefano <epiesasha@me.c...
normal
{ "blob_id": "59338170b44be037f749790a7942c2bcca1fc078", "index": 2434, "step-1": "#!/usr/bin/env python\n###############################################################################\n#\n#\n# Project:\n# Purpose:\n#\n#\n# Author: Massimo Di Stefano , epiesasha@me.com\n#\n#####################################...
[ 0 ]
import re from collections import OrderedDict OPENING_TAG = '<{}>' CLOSING_TAG= '</{}>' U_LIST = '<ul>{}</ul>' LIST_ITEM = '<li>{}</li>' STRONG = '<strong>{}</strong>' ITALIC = '<em>{}</em>' PARAGRAPH = '<p>{}</p>' HEADERS = OrderedDict({'######': 'h6', '#####': 'h5', '###...
normal
{ "blob_id": "6b0b60ec571cf026d0f0cff3d9517362c16b459b", "index": 6092, "step-1": "<mask token>\n\n\ndef replace_bold_tags(l=''):\n line_with_bold = re.match('(.*)__(.*)__(.*)', l)\n if line_with_bold:\n return line_with_bold.group(1) + STRONG.format(line_with_bold.group(2)\n ) + line_with...
[ 5, 6, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> charObj.append(seriesObj) charObj.set_categories(cat) sheet.add_chart(charObj, 'I2') <|reserved_special_token_0|> charObj.append(seriesObj) charObj.set_categories(cat) sheet.add_chart(charObj, 'I18') <|reserved_special_token_0|> c...
flexible
{ "blob_id": "bb9ff561ff94bbe4d20f14287ba313386ea78609", "index": 9121, "step-1": "<mask token>\n", "step-2": "<mask token>\ncharObj.append(seriesObj)\ncharObj.set_categories(cat)\nsheet.add_chart(charObj, 'I2')\n<mask token>\ncharObj.append(seriesObj)\ncharObj.set_categories(cat)\nsheet.add_chart(charObj, 'I18...
[ 0, 1, 2, 3, 4 ]
def most_frequent_char(lst): char_dict = {} for word in lst: for char in word: if char in char_dict: char_dict[char] += 1 else: char_dict[char] = 1 max_value = max(char_dict.values()) max_keys = [] for key, value in char_dict.items(): ...
normal
{ "blob_id": "be1ddaf5b4a7fb203fea62d061b06afb45d6867d", "index": 4690, "step-1": "<mask token>\n", "step-2": "def most_frequent_char(lst):\n char_dict = {}\n for word in lst:\n for char in word:\n if char in char_dict:\n char_dict[char] += 1\n else:\n ...
[ 0, 1 ]
# A class is like a blueprint for creating objects. An object has properties and methods(functions) associated with it. Almost everything in Python is an object # import connect # from connect import connect #create class import pymysql # import MySQLdb conn = pymysql.connect(host='127.0.0.1',user='root',password='',...
normal
{ "blob_id": "ea045d04b40341f34c780dceab1f21df93b7207a", "index": 7689, "step-1": "<mask token>\n\n\nclass User:\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Customer(User):\n\n def __init__(self, name, email, age):\n self.name = name\n self.email = email\n self.age = a...
[ 4, 5, 8, 10, 11 ]
<|reserved_special_token_0|> class Bitcoin: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Bitcoin: <|reserved_special_token_0|> def __init__(self): ...
flexible
{ "blob_id": "3bfe4021d5cf9bd24c0fb778b252bc04c6ac47ed", "index": 1847, "step-1": "<mask token>\n\n\nclass Bitcoin:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Bitcoin:\n <mask token>\n\n def __init__(self):\n pass\n <mask token>...
[ 1, 2, 4, 5, 6 ]
''' Various tools for cleaning out nulls and imputing '''
normal
{ "blob_id": "bd310ab0bc193410b8f93ad5516b0731d2eba54f", "index": 6268, "step-1": "<mask token>\n", "step-2": "'''\nVarious tools for cleaning out nulls and imputing \n'''\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CoopHtmlEditorAppConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CoopHtmlEditorAppConfig(AppConfig): name = 'coo...
flexible
{ "blob_id": "641cbe2f35925d070249820a2e3a4f1cdd1cf642", "index": 8697, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass CoopHtmlEditorAppConfig(AppConfig):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass CoopHtmlEditorAppConfig(AppConfig):\n name = 'coop_html_edito...
[ 0, 1, 2, 3, 4 ]
# "Time Warner Python" Salma Hashem netid: sh5640 #Design costumer service application by asking users series of questions, and based on the customers' answers to the questions, provide them with instructions. #Ask the user to choose from the following options print("Choose from the following options: ") #assign each...
normal
{ "blob_id": "736b84bbcf1d5954b491068be4060edeade2c1c5", "index": 2205, "step-1": "<mask token>\n", "step-2": "print('Choose from the following options: ')\n<mask token>\nprint(one, '\\n', two, '\\n', three, '\\n', four, '\\n', five)\n<mask token>\nif value == 1:\n modem_on = input('\\nIs your modem on? (Ent...
[ 0, 1, 2, 3 ]
from people.models import Medium, Profile, Staff, Instructor, Student, Alumni, Donation, Address, Award, Reference, Experience, Skill, Education, ImporterUsers from anonymizer import Anonymizer class MediumAnonymizer(Anonymizer): model = Medium attributes = [ ('medium_id', "integer"), ('descr...
normal
{ "blob_id": "63182a8708729606f96794cddb163f707252ba61", "index": 3205, "step-1": "<mask token>\n\n\nclass DonationAnonymizer(Anonymizer):\n model = Donation\n attributes = [('id', 'SKIP'), ('profile_id', 'SKIP'), ('amount',\n 'integer'), ('date', 'date'), ('description', 'varchar'), ('notes',\n ...
[ 16, 18, 28, 29, 30 ]
<|reserved_special_token_0|> class GenomicJobControllerTest(BaseTestCase): def setUp(self): super(GenomicJobControllerTest, self).setUp() self.data_file_dao = GenomicGcDataFileDao() self.event_data_dao = MessageBrokenEventDataDao() self.incident_dao = GenomicIncidentDao() ...
flexible
{ "blob_id": "bd179fda18551d4f3d8a4d695a9da38ee607ef1d", "index": 2168, "step-1": "<mask token>\n\n\nclass GenomicJobControllerTest(BaseTestCase):\n\n def setUp(self):\n super(GenomicJobControllerTest, self).setUp()\n self.data_file_dao = GenomicGcDataFileDao()\n self.event_data_dao = Mess...
[ 9, 13, 17, 22, 25 ]
""" Copyright (c) 2018, salesforce.com, inc. All rights reserved. SPDX-License-Identifier: BSD-3-Clause For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause Graph Search Policy Network. """ from typing import List, NamedTuple, Union import torch import tor...
normal
{ "blob_id": "4a892c3532a3e3ddcd54705336dce820ff49b91b", "index": 6289, "step-1": "<mask token>\n\n\nclass GraphWalkAgent(nn.Module):\n\n def __init__(self, args):\n super(GraphWalkAgent, self).__init__()\n self.model = args.model\n self.relation_only = args.relation_only\n self.his...
[ 10, 13, 16, 18, 20 ]
# -*- coding: utf-8 -*- """ Created on Sun Sep 19 17:15:58 2021 @author: Professional """ #son = int(input("Biror son kiriting: ") ) #print(son, "ning kvadrati", son*son, "ga teng") #print (son, "ning kubi", son*son*son, "ga teng") #yosh = int(input("Yoshingiz nechida: ")) #print("Siz", 2021 - yosh, "yil...
normal
{ "blob_id": "0d32fe36f71ffb3df56738664c5dbd0b8ae585e3", "index": 3303, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\"yig'indisi \", a + b)\nprint('ayirmasi ', a - b)\nprint(\"bo'linmasi \", a / b)\nprint(\"ko'paytmasi \", a * b)\n", "step-3": "<mask token>\na = int(input('Birinchi sonni kiriti...
[ 0, 1, 2, 3 ]
from datetime import * import datetime import time time_one = datetime.time(1, 2, 3) print("Time One :: ", time_one) time_two = datetime.time(hour=23, minute=59, second=59, microsecond=99) print("Time Two :: ", time_two) date_one = datetime.date(month=3, year=2019, day=31) print("Date One :: ", date_one) today = dat...
normal
{ "blob_id": "1ed7dba63db38e53a1dc5fac3c36f0dd98075c1f", "index": 4305, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Time One :: ', time_one)\n<mask token>\nprint('Time Two :: ', time_two)\n<mask token>\nprint('Date One :: ', date_one)\n<mask token>\nprint('Today :: ', today, today.timetuple())\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for c1, c2 in zip(s1, s2): ans += c1 + c2 print(ans) <|reserved_special_token_1|> s1 = 'パトカー' s2 = 'タクシー' ans = '' for c1, c2 in zip(s1, s2): ans += c1 + c2 print(ans) <|reserved_special_token_1|> # coding: utf-8 # ...
flexible
{ "blob_id": "4d7e30714ae209e1d09d895dadf7a19928fe253f", "index": 6623, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor c1, c2 in zip(s1, s2):\n ans += c1 + c2\nprint(ans)\n", "step-3": "s1 = 'パトカー'\ns2 = 'タクシー'\nans = ''\nfor c1, c2 in zip(s1, s2):\n ans += c1 + c2\nprint(ans)\n", "step-4": ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def qsub(job, exe_path, queue=QUEUE_NAME): o_path = job['o_path'] if job['o_path'] is not None else '/dev/null' e_path = job['e_path'] if job['e_path'] is not None else '/dev/null' for p in [o_path, e_path]: ...
flexible
{ "blob_id": "427d3d386d4b8a998a0b61b8c59984c6003f5d7b", "index": 6975, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef qsub(job, exe_path, queue=QUEUE_NAME):\n o_path = job['o_path'] if job['o_path'] is not None else '/dev/null'\n e_path = job['e_path'] if job['e_path'] is not None else '/de...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CriteriaForm(forms.Form): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CriteriaForm(forms.Form): query = forms.CharField(widget=forms.Textarea) <|reserved_spec...
flexible
{ "blob_id": "b6529dc77d89cdf2d49c689dc583b78c94e31c4d", "index": 4716, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass CriteriaForm(forms.Form):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass CriteriaForm(forms.Form):\n query = forms.CharField(widget=forms.Textarea)\n", "step-4"...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def load_stop_word(): stop_word = set() with open('data/stop_word.txt', 'r', encoding='utf-8') as file: for line in file.readlines(): stop_word.add(line.strip()) return stop_word <|reserved_special_token_0|> def write_dict(word_dict): file = open('d...
flexible
{ "blob_id": "4942b20a8e4f58c52b82800fb4c59db169cd8048", "index": 3562, "step-1": "<mask token>\n\n\ndef load_stop_word():\n stop_word = set()\n with open('data/stop_word.txt', 'r', encoding='utf-8') as file:\n for line in file.readlines():\n stop_word.add(line.strip())\n return stop_wo...
[ 2, 3, 4, 5, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(2): renderer.set_drawing_axis(i) renderer.draw_ws_obstacles() renderer.draw_ws_point(source, color='k', shape='o') renderer.background_matrix_eval = False renderer.draw_ws_img(U[-1] if i == 0 els...
flexible
{ "blob_id": "007cce815f3ad4e47593ff00ff2e73d5d9961d9e", "index": 3211, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(2):\n renderer.set_drawing_axis(i)\n renderer.draw_ws_obstacles()\n renderer.draw_ws_point(source, color='k', shape='o')\n renderer.background_matrix_eval = Fal...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TemplateTestBCAlgorithm: @staticmethod @abstractmethod def list_to_backend_type(data: List) ->TTensor: """ Convert list to backend specific type :param data: List of data. :return: Converted data. """ @staticmethod @abs...
flexible
{ "blob_id": "de88e2d2cf165b35f247ea89300c91b3c8c07fea", "index": 7844, "step-1": "<mask token>\n\n\nclass TemplateTestBCAlgorithm:\n\n @staticmethod\n @abstractmethod\n def list_to_backend_type(data: List) ->TTensor:\n \"\"\"\n Convert list to backend specific type\n\n :param data: ...
[ 9, 11, 12, 13, 14 ]
from __future__ import with_statement from fabric.api import * from fabric.colors import * from fabric.utils import puts from fabric.context_managers import shell_env env.hosts = ['git@tweetset.com'] def deploy(): "deploys the project to the server" with prefix('source /srv/django-envs/tweetset/bin/activate')...
normal
{ "blob_id": "6111c9730c556ab3ab95f7685ffa135a2bbeb2ca", "index": 5950, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef deploy():\n \"\"\"deploys the project to the server\"\"\"\n with prefix('source /srv/django-envs/tweetset/bin/activate'):\n with shell_env(DJANGO_SETTINGS_MODULE='twe...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def function_addrs(r2): """ Yield a list of all the function's start addresses. """ for addr in r2.cmdj('aflqj'): yield int(addr, 16) <|reserved_special_token_0|> def basic_block_coverage(r2, translation_blocks): """ Calculate the basic block coverage b...
flexible
{ "blob_id": "2aee4af2e5a5c3f59dde4d9dd46f8d124a32fb27", "index": 2590, "step-1": "<mask token>\n\n\ndef function_addrs(r2):\n \"\"\"\n Yield a list of all the function's start addresses.\n \"\"\"\n for addr in r2.cmdj('aflqj'):\n yield int(addr, 16)\n\n\n<mask token>\n\n\ndef basic_block_cover...
[ 3, 4, 5, 6, 7 ]
import bluetooth import serial import struct # Definition of Bluetooth rfcomm socket bd_addr = "98:D3:37:00:8D:39" # The address from the HC-05 sensor port = 1 sock = bluetooth.BluetoothSocket(bluetooth.RFCOMM) sock.connect((bd_addr,port)) # Definition of Serial port ser = serial.Serial("/dev/ttyACM0", 57600) def BT...
normal
{ "blob_id": "605c78795b5a072d330d44a150f26ad410d9d084", "index": 2962, "step-1": "import bluetooth\nimport serial\nimport struct\n\n# Definition of Bluetooth rfcomm socket\nbd_addr = \"98:D3:37:00:8D:39\" # The address from the HC-05 sensor\nport = 1\nsock = bluetooth.BluetoothSocket(bluetooth.RFCOMM)\nsock.conn...
[ 0 ]
<|reserved_special_token_0|> @with_tempfile def test_invalid_call(path): assert_raises(ValueError, create_sibling_github, 'bogus', dataset=path) ds = Dataset(path).create() assert_raises(gh.BadCredentialsException, ds.create_sibling_github, 'bogus', github_user='') <|reserved_special_token_0|> ...
flexible
{ "blob_id": "035043460805b7fe92e078e05708d368130e3527", "index": 8965, "step-1": "<mask token>\n\n\n@with_tempfile\ndef test_invalid_call(path):\n assert_raises(ValueError, create_sibling_github, 'bogus', dataset=path)\n ds = Dataset(path).create()\n assert_raises(gh.BadCredentialsException, ds.create_s...
[ 1, 2, 3, 4, 5 ]
# Stubs for binascii # Based on http://docs.python.org/3.2/library/binascii.html import sys from typing import Union, Text if sys.version_info < (3,): # Python 2 accepts unicode ascii pretty much everywhere. _Bytes = Text _Ascii = Text else: # But since Python 3.3 ASCII-only unicode strings are accep...
normal
{ "blob_id": "9ba74c7ecbd20c59883aff4efdc7e0369ff65daf", "index": 5267, "step-1": "<mask token>\n\n\ndef a2b_base64(string: _Ascii) ->bytes:\n ...\n\n\n<mask token>\n\n\ndef a2b_qp(string: _Ascii, header: bool=...) ->bytes:\n ...\n\n\ndef b2a_qp(data: _Bytes, quotetabs: bool=..., istext: bool=..., header:\n...
[ 13, 15, 16, 17, 19 ]
from psycopg2 import extras as ex import psycopg2 as pg import json import datetime import os from functools import reduce data_list = [{'projectName': '伊犁哈萨克自治州友谊医院开发区分院保洁服务项目', 'pingmu': '服务', 'purUnit': '新疆伊犁哈萨克自治州友谊医院', 'adminiArea': '新疆维吾尔自治区', 'bulletTime': '2020年09月02日 19:20', 'obtBidTime': '2020年09月02日至2020年...
normal
{ "blob_id": "e9af8f7830be7db3ca57b0a24de48ef7fcb08d6c", "index": 8453, "step-1": "<mask token>\n\n\ndef processJson(dic):\n dicobj = json.loads(dic)\n print(dicobj)\n for k, v in dicobj.items():\n dict_tmp = {}\n dict_tmp['file_name'] = k\n dict_tmp['urls'] = v\n print(k)\n ...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> species(label='C=C([CH]C)C(=C)[CH]C(24182)', structure=SMILES( '[CH2]C(=CC)C([CH2])=CC'), E0=(249.687, 'kJ/mol'), modes=[ HarmonicOscillator(frequencies=([325, 375, 415, 465, 420, 450, 1700, 1750, 2750, 2770, 2790, 2810, 2830, 2850, 1350, 1400, 1...
flexible
{ "blob_id": "63093190ee20e10698bd99dcea94ccf5d076a006", "index": 8921, "step-1": "<mask token>\n", "step-2": "species(label='C=C([CH]C)C(=C)[CH]C(24182)', structure=SMILES(\n '[CH2]C(=CC)C([CH2])=CC'), E0=(249.687, 'kJ/mol'), modes=[\n HarmonicOscillator(frequencies=([325, 375, 415, 465, 420, 450, 1700, ...
[ 0, 1, 2 ]
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 # (c) Simen Sommerfeldt, @sisomm, simen.sommerfeldt@gmail.com Licensed as CC-BY-SA import os import argparse,time import pygame import paho.mqtt.client as paho parser = argparse.ArgumentParser() parser.add_argument("-s","--server", default="127.0.0.1", help="The I...
normal
{ "blob_id": "9852d2a15047b110c7f374fd75e531c60c954724", "index": 3920, "step-1": "<mask token>\n\n\ndef task_goodbye():\n pygame.mixer.music.load('../sounds/despicable.wav')\n pygame.mixer.music.play()\n\n\ndef task_hello():\n pygame.mixer.music.load('../sounds/mday.wav')\n pygame.mixer.music.play()\...
[ 4, 5, 6, 8, 9 ]
import math z = 1j cosinus_real = math.cos(z.real) cosinus_imaginary = math.cos(z.imag) sinus_real = math.sin(z.real) sinus_imag = math.sin(z.imag) print (cosinus_real) print (cosinus_imaginary) print (sinus_real) print (sinus_imag)
normal
{ "blob_id": "7ea608b73f592cffc7723b4319cf1a87b3e9b443", "index": 4220, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(cosinus_real)\nprint(cosinus_imaginary)\nprint(sinus_real)\nprint(sinus_imag)\n", "step-3": "<mask token>\nz = 1.0j\ncosinus_real = math.cos(z.real)\ncosinus_imaginary = math.cos(...
[ 0, 1, 2, 3, 4 ]
class CUtil: @staticmethod def generate_board(initial_board, grid_size): board_dictionary = dict() iterator = 0 board_identifiers = CUtil.__generate_board_identifiers(grid_size) for row in initial_board: for data in row: identifier = board_identifiers...
flexible
{ "blob_id": "929e6deeb017fd338c63439f689d05331b016d0f", "index": 1951, "step-1": "class CUtil:\n\n @staticmethod\n def generate_board(initial_board, grid_size):\n board_dictionary = dict()\n iterator = 0\n board_identifiers = CUtil.__generate_board_identifiers(grid_size)\n for r...
[ 6, 7, 8, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def count_singlekey(inputDict, keyword): countDict = {} for abName, abInfo in inputDict.iteritems(): if countDict.has_key(abInfo[keyword]): countDict[abInfo[keyword]][1] += 1 else: countDict[abInfo[keyword]] = [...
flexible
{ "blob_id": "b164dc8183c0dc460aa20883553fc73acd1e45ec", "index": 7828, "step-1": "<mask token>\n", "step-2": "def count_singlekey(inputDict, keyword):\n countDict = {}\n for abName, abInfo in inputDict.iteritems():\n if countDict.has_key(abInfo[keyword]):\n countDict[abInfo[keyword]][1]...
[ 0, 1, 2, 3 ]