code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
''' runSPP.py - wrap spp peak caller ======================================== :Tags: Python Purpose ------- Runs the spp peak caller. The workflow follows the tutorial at: http://compbio.med.harvard.edu/Supplements/ChIP-seq/tutorial.html Usage ----- Documentation ------------- Requirements: * spp >= ? * snow >...
normal
{ "blob_id": "e886b88a0b7e8c06772fe8a9554cab1bfe9e94a7", "index": 7208, "step-1": "<mask token>\n\n\ndef bamToBed(infile, outfile):\n \"\"\"convert bam to bed with bedtools.\"\"\"\n statement = 'bamToBed -i %(infile)s > %(outfile)s' % locals()\n E.debug(\"executing statement '%s'\" % statement)\n retc...
[ 3, 4, 5, 6, 7 ]
import os import pandas as pd from sklearn.decomposition import PCA import matplotlib.pyplot as plt name="/home/t3cms/thessel/Workflow1.5/stop_data/stop_train_sig_wc.csv" name_bkg="/home/t3cms/thessel/Workflow1.5/stop_data/stop_train_bkg_wc.csv" drop_cols=[0,1,2,15] names = [i for i in range(16)] #columns=[]...
normal
{ "blob_id": "f8bb2851192a53e94e503c0c63b17477878ad9a7", "index": 6926, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Before PCA', final_df)\nfor i in pca_df.columns:\n final_df[i] = pca_df[i]\nprint('After PCA', final_df)\n<mask token>\nfinal_df.iloc[:cut].to_csv('pca_stop_train_sig_wc.csv', h...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def is_prime(num): if num <= 1: return False i = 2 while i * i <= num: if num % i == 0: return False i += 1 return True <|reserved_special_token_0|> <|reserved_special_toke...
flexible
{ "blob_id": "07fdf6605d970d2491116ad82a1119499b561d1f", "index": 4144, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef is_prime(num):\n if num <= 1:\n return False\n i = 2\n while i * i <= num:\n if num % i == 0:\n return False\n i += 1\n return True\n\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class MatlabConfig(Controller): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class MatlabConfig(Controller): executable = File(Undefined, output=False, desc= 'Full path of the matlab executable')...
flexible
{ "blob_id": "4a8e8994ec8734664a5965b81da9d146d8504f8d", "index": 6096, "step-1": "<mask token>\n\n\nclass MatlabConfig(Controller):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass MatlabConfig(Controller):\n executable = File(Undefined, output=False, desc=\n 'Full path of t...
[ 1, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def keypress(): global keys keys['space'] = keys['quit'] = keys['next'] = False for event in pygame.event.get(): if event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE: keys['space'] = True elif event.type == pygame.KEYUP and event.key == p...
flexible
{ "blob_id": "aeaab602cbb9fa73992eb5259e8603ecb11ba333", "index": 4863, "step-1": "<mask token>\n\n\ndef keypress():\n global keys\n keys['space'] = keys['quit'] = keys['next'] = False\n for event in pygame.event.get():\n if event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE:\n ...
[ 1, 2, 3, 4, 5 ]
__author__ = 'Administrator' import socket,os,time server = socket.socket() server.bind(("localhost",9999)) server.listen() while True: conn,addr = server.accept() while True: data = conn.recv(1024) if not data: break cmd,filename = data.decode().split() if o...
normal
{ "blob_id": "0a19efea0c8d7e5e248ca3265ffcb55604dc500c", "index": 7576, "step-1": "__author__ = 'Administrator'\n\nimport socket,os,time\n\nserver = socket.socket()\n\nserver.bind((\"localhost\",9999))\n\nserver.listen()\n\nwhile True:\n conn,addr = server.accept()\n\n while True:\n data = conn.recv...
[ 0 ]
<|reserved_special_token_0|> class _spectra: def __init__(self, x, y): self.x = x self.y = y <|reserved_special_token_0|> def y(self): return intensities <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class _spectra: def __init_...
flexible
{ "blob_id": "8f5d9918260e2f50fb229a7067f820a186101b99", "index": 1080, "step-1": "<mask token>\n\n\nclass _spectra:\n\n def __init__(self, x, y):\n self.x = x\n self.y = y\n <mask token>\n\n def y(self):\n return intensities\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass...
[ 3, 5, 6, 8, 11 ]
from datetime import datetime import struct BEACON_LENGTH = 84 EPS_LENGTH = 20 COM_LENGTH = 10 # reverse engineered ADCS1_LENGTH = 7 ADCS2_LENGTH = 6 AIS_LENGTH = 20 class EPS(object): def __init__(self, eps_data): if len(eps_data) != EPS_LENGTH: raise InputException(len(eps_data), EPS_LENGTH...
normal
{ "blob_id": "505689803c8f4490619ab1a7579fde1e2c18c538", "index": 5532, "step-1": "<mask token>\n\n\nclass ADCS2(object):\n\n def __init__(self, adcs2_data):\n self.gyro = tuple(struct.unpack('>hhh', adcs2_data))\n <mask token>\n\n\nclass AIS(object):\n\n def __init__(self, ais_data):\n sel...
[ 8, 10, 19, 20, 21 ]
import requests import json l = list() 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/" +...
normal
{ "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 ]
<|reserved_special_token_0|> def getTextWithoutSpaces(text): withoutLineBreaks = text.replace('\n', '') withoutSpaces = re.sub(' +', ' ', withoutLineBreaks) return withoutSpaces def getSentences(sentences, text): data = re.findall('\\b[a-zA-Z]+|[.!?]', text) unique_words = set(data) sentence...
flexible
{ "blob_id": "6d7db5b9a64ec25763f5af6ceec1a46d629d549c", "index": 472, "step-1": "<mask token>\n\n\ndef getTextWithoutSpaces(text):\n withoutLineBreaks = text.replace('\\n', '')\n withoutSpaces = re.sub(' +', ' ', withoutLineBreaks)\n return withoutSpaces\n\n\ndef getSentences(sentences, text):\n data...
[ 3, 5, 6, 7, 8 ]
from eums.test.api.api_test_helpers import create_option from eums.test.factories.question_factory import MultipleChoiceQuestionFactory from eums.test.api.authenticated_api_test_case import AuthenticatedAPITestCase from eums.test.config import BACKEND_URL from eums.models.question import MultipleChoiceQuestion ENDPOI...
normal
{ "blob_id": "1152f144e17c11416f9ed56b4408f18615b16dc2", "index": 5187, "step-1": "<mask token>\n\n\nclass OptionsEndPointTest(AuthenticatedAPITestCase):\n <mask token>\n <mask token>\n\n\nclass ReceivedOptionsEndPointTest(AuthenticatedAPITestCase):\n\n def test_should_only_get_received_options(self):\n ...
[ 7, 8, 9, 10, 12 ]
/Users/andreilyskov/anaconda/lib/python3.5/sre_compile.py
normal
{ "blob_id": "faf4f4d26236ac555594ef6913a0d43c3516f1f2", "index": 2063, "step-1": "/Users/andreilyskov/anaconda/lib/python3.5/sre_compile.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
#!/bin/python import sys import notify2 import subprocess from time import sleep def notification(message: str): """ Display notification to the desktop Task: 1. show() -> it will generate a complete new pop 2. update() -> it will update the payload part of same notification pop-up, not is...
normal
{ "blob_id": "8a7904881d936a3cb421ed5550856b600894fcee", "index": 5397, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef notification(message: str):\n \"\"\"\n Display notification to the desktop\n Task:\n 1. show() -> it will generate a complete new pop\n 2. update() -> it wi...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class MonthUnitTests(unittest.TestCase): def test_header(self): cal = Month(5, 2012) result = cal.header() self.assertEqual(' May 2012', result) def test_header_different_month(self): cal = Month(3, 2012) result = cal.header() ...
flexible
{ "blob_id": "36c1d75171d772138b820651e11a3a7bc3a6521c", "index": 8226, "step-1": "<mask token>\n\n\nclass MonthUnitTests(unittest.TestCase):\n\n def test_header(self):\n cal = Month(5, 2012)\n result = cal.header()\n self.assertEqual(' May 2012', result)\n\n def test_header_differ...
[ 13, 14, 15, 16, 17 ]
# encoding:UTF-8 # 题目:斐波那契数列。 def fib(n): if n==1 or n==2: return 1 return fib(n-1)+fib(n-2) print (fib(10))
normal
{ "blob_id": "59376f6565cd72e20087609253a41c04c6327a27", "index": 6324, "step-1": "<mask token>\n", "step-2": "def fib(n):\n if n == 1 or n == 2:\n return 1\n return fib(n - 1) + fib(n - 2)\n\n\n<mask token>\n", "step-3": "def fib(n):\n if n == 1 or n == 2:\n return 1\n return fib(n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> db_handle.drop_database(DB_NAME) <|reserved_special_token_0|> with open(RELATIVE_CONFIG_PATH + USER_COLLECTION + '.csv', 'r') as user_fh: for user_row in user_fh: user_row = user_row.rstrip() if user_row: ...
flexible
{ "blob_id": "a8b1b218e6649545000803c91c803580cfdbd4f1", "index": 459, "step-1": "<mask token>\n", "step-2": "<mask token>\ndb_handle.drop_database(DB_NAME)\n<mask token>\nwith open(RELATIVE_CONFIG_PATH + USER_COLLECTION + '.csv', 'r') as user_fh:\n for user_row in user_fh:\n user_row = user_row.rstri...
[ 0, 1, 2, 3, 4 ]
from settings import * helpMessage = ''' **Vocal / Musique** `{0}join` Va rejoindre le salon vocale dans laquelle vous êtes. `{0}leave` Va partir du salon vocale dans laquelle vous êtes. `{0}play [YouTube Url]` *ou* `{0}play [musique ou video à rechercher]` Commencera à jouer l'audio de la vidéo / chans...
normal
{ "blob_id": "f7283750923e1e430ff1f648878bbb9a0c73d2c4", "index": 7880, "step-1": "<mask token>\n", "step-2": "<mask token>\nhelpMessage = (\n \"\"\"\n**Vocal / Musique**\n\n`{0}join`\nVa rejoindre le salon vocale dans laquelle vous êtes.\n\n`{0}leave`\nVa partir du salon vocale dans laquelle vous êtes.\n\n`...
[ 0, 1, 2, 3 ]
import pickle import select import socket import sys from threading import Thread from typing import Dict, Tuple import pygame from pygame.locals import * import c from models import * class Game: location: list[int, int] = [c.WIDTH / 2, c.HEIGHT / 2] velocity: list[int, int] = [0, 0] current_player: Pl...
normal
{ "blob_id": "418798369578e80ecbf82da802b23dc6ca922569", "index": 7107, "step-1": "<mask token>\n\n\nclass Game:\n location: list[int, int] = [c.WIDTH / 2, c.HEIGHT / 2]\n velocity: list[int, int] = [0, 0]\n current_player: Player = None\n other_players: Dict[str, Tuple[Player, Tuple[int, int]]] = {}\...
[ 10, 11, 12, 14, 15 ]
#-------------------------------------------------------------------------------- # G e n e r a l I n f o r m a t i o n #-------------------------------------------------------------------------------- # Name: Exercise 2.6 - Planetary Orbits # # Usage: Calculate information for planetary orbits # # Description: ...
normal
{ "blob_id": "83b65b951b06b117c2e85ba348e9b591865c1c2e", "index": 3145, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('v2: {0}\\tL2: {1}'.format(v2, L2))\n<mask token>\nprint('T: {0}\\te:{1}'.format(T, e))\n", "step-3": "L1 = float(input('Enter distance to the sun: '))\nv1 = float(input('Enter ve...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_timestamp_from_interval(interval_number): return interval_number * interval_length_minutes * 60 def get_datetime_from_utc_timestamp(utc_timestamp): return datetime.datetime.utcfromtimestamp(utc_timestamp).replace(tzinfo =datetime.timezone.utc) <|reserved_specia...
flexible
{ "blob_id": "f3bfa30f51c4a91844457c72fbf2b2b8368d8476", "index": 1874, "step-1": "<mask token>\n\n\ndef get_timestamp_from_interval(interval_number):\n return interval_number * interval_length_minutes * 60\n\n\ndef get_datetime_from_utc_timestamp(utc_timestamp):\n return datetime.datetime.utcfromtimestamp(...
[ 2, 3, 4, 5, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [url('^porta/list$', porta_list, name='porta_list'), url( '^porta/detail/(?P<pk>\\d+)$', porta_detail, name='porta_detail'), url( '^porta/new/$', porta_new, name='porta_new'), url( '^porta/update/(?P<pk>\...
flexible
{ "blob_id": "5e355732f07029aa644617ac9b5e9ad50ee9397f", "index": 1161, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^porta/list$', porta_list, name='porta_list'), url(\n '^porta/detail/(?P<pk>\\\\d+)$', porta_detail, name='porta_detail'), url(\n '^porta/new/$', porta_new, name...
[ 0, 1, 2, 3 ]
import sys a = 3 b = 4 c = 5.66 d = 8.0 e = complex(c,d) f = complex(float(a),float(b)) print("a is type:",type(a)) print("c is type:",type(c)) print("e is type:",type(e)) print(a + b) print(d / c) print(b / a) #2个除约成整型 print(b // a) print(e) print(e + f) print(sys.float_info)
normal
{ "blob_id": "2876c9f8db0395143b165b855b22e364e3cc8121", "index": 9008, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('a is type:', type(a))\nprint('c is type:', type(c))\nprint('e is type:', type(e))\nprint(a + b)\nprint(d / c)\nprint(b / a)\nprint(b // a)\nprint(e)\nprint(e + f)\nprint(sys.float_...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_body() ->None: for func in (weight, shower, food, water): assert ilen(func()) >= 1 <|reserved_special_token_1|> from more_itertools import ilen from my.body import weight, shower, food, water def test_b...
flexible
{ "blob_id": "e06b740f27e41b9f120c962fd76a38a29d54af3c", "index": 973, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_body() ->None:\n for func in (weight, shower, food, water):\n assert ilen(func()) >= 1\n", "step-3": "from more_itertools import ilen\nfrom my.body import weight, ...
[ 0, 1, 2 ]
from models import Cell,Board import random from pdb import set_trace as bp status={'end':-1} game=None class Game_Service(object): def __init__(self,row_num,col_num): self._row_num=row_num self._col_num=col_num mine_percent=0.3 self._mine_num=int(mine_percent*float(self._row_nu...
normal
{ "blob_id": "4af72cab6444922ca66641a08d45bcfe5a689844", "index": 6763, "step-1": "<mask token>\n\n\nclass Game_Service(object):\n\n def __init__(self, row_num, col_num):\n self._row_num = row_num\n self._col_num = col_num\n mine_percent = 0.3\n self._mine_num = int(mine_percent * f...
[ 5, 6, 7, 9, 10 ]
<|reserved_special_token_0|> class Place(models.Model): name = models.CharField(max_length=50) address = models.CharField(max_length=80) def __str__(self): return self.name class Restaurant(models.Model): place = models.OneToOneField(Place, on_delete=models.CASCADE, primary_key=True...
flexible
{ "blob_id": "8afce5b47c7c9c67a8be493f7f4de1510352b1c7", "index": 4559, "step-1": "<mask token>\n\n\nclass Place(models.Model):\n name = models.CharField(max_length=50)\n address = models.CharField(max_length=80)\n\n def __str__(self):\n return self.name\n\n\nclass Restaurant(models.Model):\n p...
[ 10, 12, 16, 17, 21 ]
from keras.models import load_model from DataManager import * def loadModel(name): model = load_model('./Model/%s.h5' % name) return model def predict(tag): test = getPIData(tag, '2019-11-05', '2019-11-06') test_arg = addFeature(test) test_norm = normalize(test_arg) X_test, Y_test = buildTra...
normal
{ "blob_id": "a6154c5d855dc53d73db08bbb5b5d7437056e156", "index": 1566, "step-1": "<mask token>\n\n\ndef loadModel(name):\n model = load_model('./Model/%s.h5' % name)\n return model\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef loadModel(name):\n model = load_model('./Model/%s.h5' % name)\n ...
[ 1, 2, 3, 4 ]
ID = '113' TITLE = 'Path Sum II' DIFFICULTY = 'Medium' URL = 'https://oj.leetcode.com/problems/path-sum-ii/' BOOK = False PROBLEM = r"""Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and `sum = 22`, ...
normal
{ "blob_id": "9a62a57f6d9af7ef09c8ed6e78a100df7978da6e", "index": 8631, "step-1": "<mask token>\n", "step-2": "ID = '113'\nTITLE = 'Path Sum II'\nDIFFICULTY = 'Medium'\nURL = 'https://oj.leetcode.com/problems/path-sum-ii/'\nBOOK = False\nPROBLEM = \"\"\"Given a binary tree and a sum, find all root-to-leaf paths...
[ 0, 1, 2 ]
def printPar(): for i in range(len(par)): print "par[{0:d}] = {1:d}".format(i,par[i]) def printImpar(): for i in range(len(impar)): print "impar[{0:d}] = {1:d}".format(i,impar[i]) par = [] impar = [] for i in range(15): n= int(raw_input()) if n%2 == 0: if len(par)<4: ...
normal
{ "blob_id": "7e33475a6ab7ad0d1e9d7d00b8443329e265fe69", "index": 6793, "step-1": "def printPar():\n for i in range(len(par)):\n print \"par[{0:d}] = {1:d}\".format(i,par[i])\ndef printImpar():\n for i in range(len(impar)):\n print \"impar[{0:d}] = {1:d}\".format(i,impar[i])\npar = []\nimpar =...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> default_args = {'owner': 'Jaimin', 'depends_on_past': False, 'start_date': datetime.now(), 'email': ['airflow@airflow.com'], 'email_on_failure': False, 'email_on_retry': False, 'retries': 1, 'retry_delay': timedelta( ...
flexible
{ "blob_id": "49492ad1a1734be02ebefb77095fd560a7a7efd8", "index": 7155, "step-1": "<mask token>\n", "step-2": "<mask token>\ndefault_args = {'owner': 'Jaimin', 'depends_on_past': False, 'start_date':\n datetime.now(), 'email': ['airflow@airflow.com'], 'email_on_failure': \n False, 'email_on_retry': False,...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def find_jobs(): html_text = requests.get( 'https://www.timesjobs.com/candidate/job-search.html?searchType=personalizedSearch&from=submit&txtKeywords=python&txtLocation=' ).text soup = BeautifulSoup(html_text, 'lxml') jobs = soup.find_all('li', class_='clearfix...
flexible
{ "blob_id": "92b71c67130cd37b2143fbd9ad71fe9a18b3f7e8", "index": 2622, "step-1": "<mask token>\n\n\ndef find_jobs():\n html_text = requests.get(\n 'https://www.timesjobs.com/candidate/job-search.html?searchType=personalizedSearch&from=submit&txtKeywords=python&txtLocation='\n ).text\n soup = ...
[ 1, 2, 3, 4, 5 ]
import random import torch import numpy as np from torch.autograd import Variable class SupportSetManager(object): FIXED_FIRST = 0 RANDOM = 1 def __init__(self, datasets, config, sample_per_class): self.config = config (TEXT, LABEL, train, dev, test) = datasets[0] self.TEXT = TEXT ...
normal
{ "blob_id": "13a2814e8744c6c09906d790185ed44fc2b3f23e", "index": 3642, "step-1": "<mask token>\n\n\nclass SupportSetManager(object):\n <mask token>\n <mask token>\n\n def __init__(self, datasets, config, sample_per_class):\n self.config = config\n TEXT, LABEL, train, dev, test = datasets[0...
[ 6, 8, 9, 10, 12 ]
# -*- coding: utf-8 -*- #COMECE AQUI ABAIXO p1=float(input('digite o p1:')) c1=float(input('digite o c1:')) p2=float(input('digite o p2:')) c2=float(input('digite o c2:')) if p1*c1=p2*c2: print('O') if pi*c1>p2*c2: print('-1') else: print('1')
normal
{ "blob_id": "210fcb497334ad8bf5433b917fc199c3e22f0f6e", "index": 6978, "step-1": "# -*- coding: utf-8 -*-\n#COMECE AQUI ABAIXO\n\np1=float(input('digite o p1:'))\nc1=float(input('digite o c1:'))\np2=float(input('digite o p2:'))\nc2=float(input('digite o c2:'))\n\nif p1*c1=p2*c2:\n print('O')\n\nif pi*c1>p2*c2...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> bind = '0.0.0.0:' + str(os.environ.get('MAESTRO_PORT', 5005)) workers = os.environ.get('MAESTRO_GWORKERS', 2) <|reserved_special_token_1|> import os bind = '0.0.0.0:' + str(os.environ.get('MAESTRO_PORT', 5005)) workers = os.env...
flexible
{ "blob_id": "818e6842d4a1f8978ec14bca06981ec933c00376", "index": 6280, "step-1": "<mask token>\n", "step-2": "<mask token>\nbind = '0.0.0.0:' + str(os.environ.get('MAESTRO_PORT', 5005))\nworkers = os.environ.get('MAESTRO_GWORKERS', 2)\n", "step-3": "import os\nbind = '0.0.0.0:' + str(os.environ.get('MAESTRO_...
[ 0, 1, 2, 3 ]
from django import forms from django.forms import ModelForm, fields, widgets from .models import NewsStory class StoryForm(ModelForm): class Meta: model = NewsStory fields = ['title' , 'pub_date' , 'content'] widgets = { 'pub_date': forms.DateInput(format=('%m/%d/%Y'), attrs={'c...
normal
{ "blob_id": "47a5ddcea2f6d8ce80793192d26c98ccc0e0340d", "index": 1771, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass StoryForm(ModelForm):\n\n\n class Meta:\n model = NewsStory\n fields = ['title', 'pub_date', 'content']\n widgets = {'pub_date': forms.DateInput(format='...
[ 0, 1, 2, 3 ]
import requests import json, csv import pandas as pd API_KEY = 'AIzaSyALrKc3-W0u_Ku-J2OpyjnqFhV5wKlwKGs' list_video_id = ['7cmvABXyUC0', '9eH-7x7swEM', 'JndzGxbwvG0', 'l0P5_E6J_g0'] fieldnames = ['videoid', 'viewCount', 'likeCount', 'dislikeCount', 'favoriteCount', 'commentCount'] rows = [] for video_id in list_video_...
normal
{ "blob_id": "3c341b17f260cc745c8659ee769493216522ac19", "index": 2073, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor video_id in list_video_id:\n url = ('https://www.googleapis.com/youtube/v3/videos?id=' + video_id +\n '&part=statistics&key=' + API_KEY)\n response = requests.get(url).js...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 import sys sys.path.insert(0, '../../common/python/') from primality import prime_factors """ phi(n) = n*sum_{p|n} (1 - 1/p) 1/phi(n) = (1/n)*sum_{p|n} p/(p - 1) n/phi(n) = sum_{p|n} p/(p - 1) """ def n_over_phi(n): top = 1 bot = 1 pfactors = prime_factors(n) for p, count i...
normal
{ "blob_id": "2d248ac1df1845bc5a2ee62a7171c1c47ca6d0ca", "index": 3665, "step-1": "<mask token>\n\n\ndef n_over_phi(n):\n top = 1\n bot = 1\n pfactors = prime_factors(n)\n for p, count in pfactors.items():\n top *= p\n bot *= p - 1\n return top / bot\n\n\ndef maximise_n_over_phi(upto)...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> np.random.seed(5) <|reserved_special_token_0|> model.add(Dense(64, input_dim=input_data_number, activation='relu')) model.add(Dense(64, activation='relu')) model.add(Dense(7, activation='softmax')) model.compile(optimizer='adam', ...
flexible
{ "blob_id": "bfa5739949c26758e3762fcff8347d23ad70f704", "index": 6114, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.random.seed(5)\n<mask token>\nmodel.add(Dense(64, input_dim=input_data_number, activation='relu'))\nmodel.add(Dense(64, activation='relu'))\nmodel.add(Dense(7, activation='softmax'))\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def getLettercount(mess): charcount = getCanditatemap() for char in mess: if char in charcount: charcount[char] += 1 return charcount <|reserved_special_token_0|> def englishFreqMatch(message): matchscore = 0 freqOrder = getFreqOrder(message.low...
flexible
{ "blob_id": "63a9060e9933cc37b7039833be5f071cc7bf45bf", "index": 7873, "step-1": "<mask token>\n\n\ndef getLettercount(mess):\n charcount = getCanditatemap()\n for char in mess:\n if char in charcount:\n charcount[char] += 1\n return charcount\n\n\n<mask token>\n\n\ndef englishFreqMatc...
[ 2, 3, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): def oddCells(self, m, n, indices): """ :type m: int :type n: int :type indices: List[List[int]] :rtyp...
flexible
{ "blob_id": "148b849ae43617dde8dbb0c949defa2f390ce5cd", "index": 9902, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n", "step-3": "class Solution(object):\n\n def oddCells(self, m, n, indices):\n \"\"\"\n :type m: int\n :type n: int\n :type i...
[ 0, 1, 2 ]
import tkinter.ttk import tkinter as tk def update_info(info_t, data): # temp = info_t.selection_set("x") # print(temp) # info_t.delete(temp) # temp = info_t.selection_set("y") # info_t.delete(temp) pass def path_to_string(s): res = "" for i in range(len(s)-1): res += str(s[i...
normal
{ "blob_id": "a4d47b9a28ec66f6a0473498674ebc538d909519", "index": 5111, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef path_to_string(s):\n res = ''\n for i in range(len(s) - 1):\n res += str(s[i][0])\n res += ', '\n res += str(s[i][1])\n res += ' > '\n res += ...
[ 0, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(libras) <|reserved_special_token_1|> quilogramas = float(input('Insira o peso em Kg:')) libras = quilogramas / 0, 45 print(libras) <|reserved_special_token_1|> quilogramas = float ( input ( "Insira o peso em Kg:" )) ...
flexible
{ "blob_id": "9c35e64fd773c79dc20e6b388478e892bda85788", "index": 1599, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(libras)\n", "step-3": "quilogramas = float(input('Insira o peso em Kg:'))\nlibras = quilogramas / 0, 45\nprint(libras)\n", "step-4": "quilogramas = float ( input ( \"Insira o ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def request_dyn(): logger.info('dyn: 开始测试请求') postUrl = '%s/raframework/browse/dyn' % serverUrl postData = {'page': '/conf/CDSConfig.jsp', 'amp': '', 'action': 'returnXML', 'LOCALE_LANGUAGE': 'en_US', 'rightToLeft': 'false', 'accessibilityMode': 'false', 'theme...
flexible
{ "blob_id": "c5d92ec592250d5bc896d32941364b92ff1d21e9", "index": 3793, "step-1": "<mask token>\n\n\ndef request_dyn():\n logger.info('dyn: 开始测试请求')\n postUrl = '%s/raframework/browse/dyn' % serverUrl\n postData = {'page': '/conf/CDSConfig.jsp', 'amp': '', 'action':\n 'returnXML', 'LOCALE_LANGUAGE...
[ 3, 5, 6, 8, 9 ]
from external.odds.betclic.api import get_odds # FDJ parsing is broken - their UI has been refactored with JS framework & # protected async JSON API usage (requires HEADERS) and more complex to isolate & group match odds # hence move to another betting website - which is still full html rendered
normal
{ "blob_id": "8b583ee55df409020a605b467479236e610a2efe", "index": 3646, "step-1": "<mask token>\n", "step-2": "from external.odds.betclic.api import get_odds\n", "step-3": "from external.odds.betclic.api import get_odds\n\n# FDJ parsing is broken - their UI has been refactored with JS framework &\n# protected...
[ 0, 1, 2 ]
# -*- encoding: utf-8 -*- from django.conf.urls import patterns, url urlpatterns = patterns('apps.profiles.views', url(r'^$', 'index', name='profiles'), # Show a specific profile. url(r'^view/(?P<username>[a-zA-Z0-9_-]+)/$', 'view_profile', name='profiles_view'), url(r'^edit/$', 'edit_profile', name...
normal
{ "blob_id": "5707e24596dfe2d85e9a7caa93aa3e253a41ae40", "index": 6620, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('apps.profiles.views', url('^$', 'index', name=\n 'profiles'), url('^view/(?P<username>[a-zA-Z0-9_-]+)/$', 'view_profile',\n name='profiles_view'), url('^edit...
[ 0, 1, 2, 3 ]
# 4, [[1,0],[2,0],[3,1],[3,2]] # 3->1->0 # \ ^ # \ | # \> 2 # 1,0,2,3 # stack 3 # # 0 1 2 3 # 1,0 # stack 1 # 0 # # def findOrder(numCourses, prerequisites): # if len(prerequisites) == 0: # order = [] # for i in range(0, numCourses): # order.append(i) # return or...
normal
{ "blob_id": "56892e125934d5de937b92a08bd7707c12c70928", "index": 689, "step-1": "<mask token>\n", "step-2": "def findOrder(numCourses, prerequisites):\n if len(prerequisites) == 0:\n order = []\n for i in range(0, numCourses):\n order.append(i)\n return order\n edges = {}\...
[ 0, 1, 2, 3 ]
# Generated by Django 2.1.7 on 2020-01-09 08:19 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('goods', '0004_auto_20200109_0713'), ] operations = [ migrations.AlterField( model_name='banner', name='show_type', ...
normal
{ "blob_id": "b7687240413441e1d3ed0085e5953f8089cbf4c9", "index": 9303, "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 = [('goods', '00...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- class FizzBuzz: def convert(self, number): # raise NotImplementedError # for number in range(1, 101): if number%3 == 0 and number%5 != 0: return ("Fizz") elif number%3 != 0 and number%5 == 0: return("Buzz") ...
normal
{ "blob_id": "fb9d639bca59ecb081e7d9f30f97bdcd35627d34", "index": 6124, "step-1": "<mask token>\n", "step-2": "class FizzBuzz:\n <mask token>\n", "step-3": "class FizzBuzz:\n\n def convert(self, number):\n if number % 3 == 0 and number % 5 != 0:\n return 'Fizz'\n elif number % 3...
[ 0, 1, 2, 3 ]
# Author: Charse # py 列表的使用 import copy name = ["111", "222", "333", "444", "555"] # 从列表中取得元素 print(name[0], name[2]) # 111 333 print(name[1:3]) # 切片 ['222', '333'] print(name[:3]) # ['111', '222', '333'] 与下标从0开始是一样的 print(name[0:3]) # ['111', '222', '333'] print(name[-2:]) # ['444', '555'] 与name # 往列表中添加...
normal
{ "blob_id": "d517c1e2eb4d37a2584f1603c704efce6834df92", "index": 7443, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(name[0], name[2])\nprint(name[1:3])\nprint(name[:3])\nprint(name[0:3])\nprint(name[-2:])\nname.append('666')\nname.insert(1, '999')\nprint(name)\n<mask token>\nprint(name)\nname.pop...
[ 0, 1, 2, 3, 4 ]
from django import forms from .models import Recipe, Ingredient, Category, Tag from blog.widgets import CustomClearableFileInput class NewCategoriesForm(forms.ModelForm): friendly_name = forms.CharField(label='... or add your own category', required=False) class Meta(): ...
normal
{ "blob_id": "7484bd9012bc9952b679073ae036de4554d362be", "index": 5175, "step-1": "<mask token>\n\n\nclass IngredientForm(forms.ModelForm):\n\n\n class Meta:\n model = Ingredient\n exclude = 'recipe',\n labels = {'quantity': 'Qty'}\n\n def __init__(self, *args, **kwargs):\n super...
[ 6, 7, 9, 12, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .slinklist import SingleLinkedList
flexible
{ "blob_id": "2a5d498a386190bdd2c05bc2b14db0fecd707162", "index": 1128, "step-1": "<mask token>\n", "step-2": "from .slinklist import SingleLinkedList\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# coding=utf-8 # Copyright 2019 The Google Research Authors. # # 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 applicab...
normal
{ "blob_id": "f253816d08407950caad28f1ce630ac2b099aa70", "index": 3241, "step-1": "<mask token>\n\n\ndef make_experiment_dir(postfix):\n home = os.path.expanduser('~')\n exp_dir = os.path.join(home, postfix)\n mkdir_p(exp_dir)\n return exp_dir\n\n\ndef save_fig(folder, filename):\n if folder is Non...
[ 10, 12, 13, 14, 16 ]
def fibonacci(num): f_1 = 0 f_2 = 1 answer = 0 for i in range(num-1): answer = f_1 + f_2 f_1 = f_2 f_2 = answer return answer # 아래는 테스트로 출력해 보기 위한 코드입니다. print(fibonacci(3))
normal
{ "blob_id": "c3d0a9bdbfd5b6f2b960ee2c1f11ec4acf508310", "index": 8458, "step-1": "<mask token>\n", "step-2": "def fibonacci(num):\n f_1 = 0\n f_2 = 1\n answer = 0\n for i in range(num - 1):\n answer = f_1 + f_2\n f_1 = f_2\n f_2 = answer\n return answer\n\n\n<mask token>\n",...
[ 0, 1, 2, 3 ]
function handler(event, context, callback){ var AWS = require("aws-sdk"), DDB = new AWS.DynamoDB({ apiVersion: "2012-08-10", region: "us-east-1" }), city_str = event.city_str.toUpperCase(), data = { city_str: city_str, ...
normal
{ "blob_id": "7bac3b224586f8c42a104123432a7321a1251369", "index": 7115, "step-1": "function handler(event, context, callback){\r\n var \r\n AWS = require(\"aws-sdk\"),\r\n DDB = new AWS.DynamoDB({\r\n apiVersion: \"2012-08-10\",\r\n region: \"us-east-1\"\r\n }),\r\n ...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: img = cv.imread(imgpath) newimg1 = jarvis_judice_ninke_1(img) * 255 newimg2 = jarvis_judice_ninke_2(img) * 255 cv.imshow('Imagem original', img) cv.imshow('Jarvis, Judice e Ninke metodo 1', newimg1) cv...
flexible
{ "blob_id": "bf764457e6af25d2d9406b18af51f63b36ab823a", "index": 8564, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n img = cv.imread(imgpath)\n newimg1 = jarvis_judice_ninke_1(img) * 255\n newimg2 = jarvis_judice_ninke_2(img) * 255\n cv.imshow('Imagem original', img)\n cv.imshow('J...
[ 0, 1, 2, 3, 4 ]
from django.forms import ModelForm, ChoiceField, Form, FileField, ModelChoiceField, HiddenInput, ValidationError from market.models import * class OrderForm(ModelForm): """Order form used in trader view.""" # from http://stackoverflow.com/questions/1697702/how-to-pass-initial-parameter-to-djangos-modelform-ins...
normal
{ "blob_id": "044e3479c32357e22ca3165d8601d8bd2a439fcb", "index": 2329, "step-1": "<mask token>\n\n\nclass OrderForm(ModelForm):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n model = Order\n fields = 'stock', 'order...
[ 3, 4, 5, 6, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @admin.register(User) class AuthorizationUserAdmin(admin.ModelAdmin): <|reserved_special_token_0|> pass <|reserved_special_token_1|> <|reserved_special_token_0|> @admin.register(User) class AuthorizationUserAdmin(ad...
flexible
{ "blob_id": "d3585e7b761fa7b2eeaacf09f84bb6a4abc1cf02", "index": 6806, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@admin.register(User)\nclass AuthorizationUserAdmin(admin.ModelAdmin):\n <mask token>\n pass\n", "step-3": "<mask token>\n\n\n@admin.register(User)\nclass AuthorizationUserAdm...
[ 0, 1, 2, 3, 4 ]
import math as m import functions_by_alexandra as fba import funs from functions_by_alexandra import User, a from pkg import bps, geom print(type(funs)) print(type(funs.add )) # # print(add(2,3)) print("Result: ", funs.add(10, 20)) print("Result: ", fba.add(10,20)) print(type(fba )) print(a ) print(m...
normal
{ "blob_id": "b53b0e6ff14750bbba3c2e5e2ea2fc5bb1abccec", "index": 3135, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(type(funs))\nprint(type(funs.add))\nprint('Result: ', funs.add(10, 20))\nprint('Result: ', fba.add(10, 20))\nprint(type(fba))\nprint(a)\nprint(m.pi)\n<mask token>\nprint(p)\nprint(b...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python #-*- coding : utf-8 -*- import string import keyword alphas = string.letters + '_' nums = string.digits keywords = keyword.kwlist checklst = alphas + nums print 'Welcome to the Identifier Checker v1.0' myInput = raw_input('Identifier to test? ') if myInput in keywords: print 'Okay as a keywor...
normal
{ "blob_id": "2420c835ff91c1269cb16fca2e60e191e1e8ce13", "index": 6457, "step-1": "#!/usr/bin/env python\n#-*- coding : utf-8 -*-\n\nimport string\nimport keyword\n\nalphas = string.letters + '_'\nnums = string.digits\nkeywords = keyword.kwlist\nchecklst = alphas + nums\n\nprint 'Welcome to the Identifier Checker...
[ 0 ]
import os import sys import time import json import socket from urllib import request, parse from concurrent.futures import ThreadPoolExecutor from multiprocessing import Process import psutil from daemon import DaemonBase from host_performence import * class MyDaemon(DaemonBase): """Real Daemon class""" d...
normal
{ "blob_id": "6e253747182716f84aa6326aafe15ff82be17378", "index": 1351, "step-1": "<mask token>\n\n\nclass MyDaemon(DaemonBase):\n <mask token>\n\n def __init__(self, api_url, monitor_port, pidfile, stdin='/dev/null',\n stdout='/dev/null', stderr='/dev/null'):\n self.api_url = api_url\n ...
[ 4, 5, 7, 8, 9 ]
<|reserved_special_token_0|> class WindowFeatureExtractor(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def transform(self, X, y=None): return self.vectorizer.transform(X, y) <|reserved_special_token_0|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "48677d73f6489ce789884a9dff5d50c23f47d8b3", "index": 260, "step-1": "<mask token>\n\n\nclass WindowFeatureExtractor(object):\n <mask token>\n <mask token>\n <mask token>\n\n def transform(self, X, y=None):\n return self.vectorizer.transform(X, y)\n <mask token>\n <mask token>...
[ 2, 7, 8, 9, 10 ]
""" Soil and water decomposition rates """ import math from water_balance import WaterBalance from utilities import float_eq, float_lt, float_le, float_gt, float_ge, clip __author__ = "Martin De Kauwe" __version__ = "1.0 (25.02.2011)" __email__ = "mdekauwe@gmail.com" class DecompFactors(object): """ Calcula...
normal
{ "blob_id": "74f3b4001a0520a25a314ff537719b679ba0fca4", "index": 2578, "step-1": "<mask token>\n\n\nclass DecompFactors(object):\n <mask token>\n\n def __init__(self, control, params, state, fluxes, met_data):\n \"\"\"\n Parameters\n ----------\n control : integers, structure\n ...
[ 2, 5, 6, 7, 8 ]
from django.db import models from django.contrib.auth.models import User, Group from userena.models import UserenaBaseProfile from django.db.models.signals import post_save from tastypie.models import create_api_key class UserProfile(UserenaBaseProfile): # user reference user = models.OneToOneField(User) ...
normal
{ "blob_id": "6e6f153857879da625f57f0382f1997fcae4f6c8", "index": 6041, "step-1": "<mask token>\n\n\nclass UserProfile(UserenaBaseProfile):\n user = models.OneToOneField(User)\n facebook_id = models.CharField(max_length=128, blank=True, null=True)\n\n\n class Meta:\n permissions = ('change_profile...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def connect(hostip=hostip, hostport=hostport): server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) IP_address = hostip Port = hostport server.connect((IP_address, Port)) return server def terminal_mode(): server = connect() server.send(bytes('Connected...
flexible
{ "blob_id": "5cdf8cd4bfebb9aab2e8f421047fc1ba3190d566", "index": 3451, "step-1": "<mask token>\n\n\ndef connect(hostip=hostip, hostport=hostport):\n server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n IP_address = hostip\n Port = hostport\n server.connect((IP_address, Port))\n return serv...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def _insert_grace_notes(song): for phrase in song.phrases: for pe in phrase.phrase_elements: if type(pe) != Segment: continue segment = pe initial_len = len(segment...
flexible
{ "blob_id": "ac83d7d39319c08c35302abfb312ebee463b75b2", "index": 5130, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef _insert_grace_notes(song):\n for phrase in song.phrases:\n for pe in phrase.phrase_elements:\n if type(pe) != Segment:\n continue\n ...
[ 0, 1, 3, 4, 6 ]
numbers = [1, 1, 1, 1, 1] new_numbers = [2, 2, 2, 3, 3] print(numbers + new_numbers) print(numbers * 5)
normal
{ "blob_id": "843df062702c9abf34cf14d911d927d786f1d912", "index": 1573, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(numbers + new_numbers)\nprint(numbers * 5)\n", "step-3": "numbers = [1, 1, 1, 1, 1]\nnew_numbers = [2, 2, 2, 3, 3]\nprint(numbers + new_numbers)\nprint(numbers * 5)\n", "step-4"...
[ 0, 1, 2 ]
import os, re DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:' } } INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.admin', 'django.contrib.sessions', 'django.contrib.contenttypes', 'django.contrib.sites', 'maintenancemode'...
normal
{ "blob_id": "34ecf2bd9bc72a98aba4584880a198dd24899dbe", "index": 6218, "step-1": "<mask token>\n", "step-2": "<mask token>\nDATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME':\n ':memory:'}}\nINSTALLED_APPS = ('django.contrib.auth', 'django.contrib.admin',\n 'django.contrib.sessions'...
[ 0, 1, 2, 3 ]
import requests import datetime import time from tqdm import tqdm import json import logging logging.basicConfig(filename='logo.log', level=logging.DEBUG, filemode='w') logging.debug('debug message') logging.info('info message') # from pprint import pprint id_vk = input('введите id пользователя вк: ') token_vk = input...
normal
{ "blob_id": "a22bc3bdb5e35060eff7f523b90d605ff2dd3878", "index": 9581, "step-1": "<mask token>\n\n\ndef ya_headers():\n return {'Content-type': 'application/json', 'Authorization': 'OAuth {}'\n .format(token_ya)}\n\n\ndef put_folder(path):\n url = 'https://cloud-api.yandex.net/v1/disk/resources/'\n ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> @implementer(IMicrosite) class Microsite(Container): <|reserved_special_token_0|> def getLocallyAllowedTypes(self): """ By now we allow all allowed types without constrain. TODO: fully implement ISelectableConstrainTypes """ portal_types = ...
flexible
{ "blob_id": "3d5d88edca5d746b830363cc9451bda94c1d7aa4", "index": 2905, "step-1": "<mask token>\n\n\n@implementer(IMicrosite)\nclass Microsite(Container):\n <mask token>\n\n def getLocallyAllowedTypes(self):\n \"\"\"\n By now we allow all allowed types without constrain.\n TODO: fully i...
[ 2, 3, 4, 5, 6 ]
import pandas as pd from sklearn.preprocessing import MinMaxScaler #loading data from CSV training_data_df = pd.read_csv("sales_data_training.csv") test_data_df = pd.read_csv("sales_data_test.csv") #scaler scaler = MinMaxScaler(feature_range=(0,1)) #scale both inputs and outputs scaled_training = scaler.fit_transfor...
normal
{ "blob_id": "050e2207ac7331444d39305869c4b25bcbc53907", "index": 244, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\n 'Note: total_earnings values were scaled by multiplying by {:.10f} and adding {:.6f}'\n .format(scaler.scale_[8], scaler.min_[8]))\n<mask token>\nscaled_training_df.to_csv('...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def canonicalize_name(name): return _canonicalize_regex.sub('-', name).lower() def page_index(packages): yield PAGE_FMT for p in packages: name = p.name url = name yield ENTRY_FMT.format(url=canonicalize_name(p.name), name=name) def page_package(pac...
flexible
{ "blob_id": "bd25b97de78f04510e43f13d356eb6c0025e223d", "index": 8121, "step-1": "<mask token>\n\n\ndef canonicalize_name(name):\n return _canonicalize_regex.sub('-', name).lower()\n\n\ndef page_index(packages):\n yield PAGE_FMT\n for p in packages:\n name = p.name\n url = name\n yi...
[ 5, 6, 7, 8, 10 ]
<|reserved_special_token_0|> def is_feasible(weights, flow, max_weight): """Test whether set of guessed weights is feasible.""" min_weights = [1] + weights max_weights = [max_weight] + list(reversed(weights)) for i in range(1, len(min_weights)): min_weights[i] = min_weights[i] if min_weights[i...
flexible
{ "blob_id": "1b4c9841fd10d065983974e93fe5dcbe048c1281", "index": 4180, "step-1": "<mask token>\n\n\ndef is_feasible(weights, flow, max_weight):\n \"\"\"Test whether set of guessed weights is feasible.\"\"\"\n min_weights = [1] + weights\n max_weights = [max_weight] + list(reversed(weights))\n for i i...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- u"""Hellweg execution template. :copyright: Copyright (c) 2017 RadiaSoft LLC. All Rights Reserved. :license: http://www.apache.org/licenses/LICENSE-2.0.html """ from __future__ import absolute_import, division, print_function from pykern import pkcollections from pykern import pkio from pyker...
normal
{ "blob_id": "9e6fd6620b4ec6a574d7948fb0d14b0a2ad0d24e", "index": 5240, "step-1": "<mask token>\n\n\ndef background_percent_complete(report, run_dir, is_running):\n if is_running:\n return {'percentComplete': 0, 'frameCount': 0}\n dump_file = _dump_file(run_dir)\n if os.path.exists(dump_file):\n ...
[ 22, 26, 32, 36, 37 ]
from django.contrib.auth.models import User from rest_framework.serializers import ModelSerializer from app_calendar.models import Holiday, Country, Event, User class CountrySerializer(ModelSerializer): class Meta: model = Country fields = '__all__' class UserSerializer(ModelSerializer): ...
normal
{ "blob_id": "5b366b0f6813f686600df9da4a17f190f034a10c", "index": 2046, "step-1": "<mask token>\n\n\nclass EventSerializer(ModelSerializer):\n\n\n class Meta:\n model = Event\n fields = '__all__'\n\n\nclass HolidaySerializerRead(ModelSerializer):\n country = CountrySerializer()\n\n\n class ...
[ 4, 5, 6, 7 ]
<|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": "1ce7b292f89fdf3f978c75d4cdf65b6991f71d6f", "index": 7499, "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 = [('core', '000...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def index_page(url): res = requests.get(url) res.encoding = res.apparent_encoding next_page(res.text) def next_page(html): data = json.loads(html) for i in data['data']['list']: img_url = i['cover'] img_name = i['title'] get_img(img_url, img_n...
flexible
{ "blob_id": "ff8b6bc607dac889da05b9f7e9b3595151153614", "index": 7358, "step-1": "<mask token>\n\n\ndef index_page(url):\n res = requests.get(url)\n res.encoding = res.apparent_encoding\n next_page(res.text)\n\n\ndef next_page(html):\n data = json.loads(html)\n for i in data['data']['list']:\n ...
[ 3, 4, 5, 6, 7 ]
import logging import argparse import getpass import errno import re import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText import dns.resolver class Mail(object): def __init__(self, recipient=None, sender=None, subject=None, body=None): self.recipient = recipi...
normal
{ "blob_id": "3a678f9b5274f008a510a23b2358fe2a506c3221", "index": 4061, "step-1": "<mask token>\n\n\nclass Mail(object):\n <mask token>\n <mask token>\n\n @property\n def message(self):\n m = MIMEMultipart('alternative')\n m['Subject'] = self.subject\n m['From'] = self.sender\n ...
[ 5, 6, 7, 8, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> engine.setProperty('rate', 150) <|reserved_special_token_0|> print(rate) <|reserved_special_token_0|> while i < l: engine.save_to_file(a[i], 'TTS/trump/{}.mp3'.format(str(i))) engine.runAndWait() if i + 3 < l: ...
flexible
{ "blob_id": "32f4f7ad61b99848c907e092c5ed7a839f0b352b", "index": 6399, "step-1": "<mask token>\n", "step-2": "<mask token>\nengine.setProperty('rate', 150)\n<mask token>\nprint(rate)\n<mask token>\nwhile i < l:\n engine.save_to_file(a[i], 'TTS/trump/{}.mp3'.format(str(i)))\n engine.runAndWait()\n if i...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ErrorReport: <|reserved_special_token_0|> def startLog(self): timestamp = str(datetime.datetime.now()) fileName = 'Log_' + timestamp + '.txt.' self.logFile = open(fileName, 'w') def endLog(self): self.logFile.close() def writeError(...
flexible
{ "blob_id": "6abc8b97117257e16da1f7b730b09ee0f7bd4c6e", "index": 4715, "step-1": "<mask token>\n\n\nclass ErrorReport:\n <mask token>\n\n def startLog(self):\n timestamp = str(datetime.datetime.now())\n fileName = 'Log_' + timestamp + '.txt.'\n self.logFile = open(fileName, 'w')\n\n ...
[ 4, 6, 7, 8, 9 ]
import numpy as np import argparse import torch from gridworlds.envs import GridWorldEnv, generate_obs_dict from gridworlds.constants import possible_objects import nengo_spa as spa from collections import OrderedDict from spatial_semantic_pointers.utils import encode_point, ssp_to_loc, get_heatmap_vectors import mat...
normal
{ "blob_id": "34a456efc72b303aed5f722bb415d30ff62addab", "index": 7391, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.random.seed(seed)\n<mask token>\nnp.random.seed(params['seed'])\n<mask token>\nfor i in range(n_goals):\n sp_name = possible_objects[i]\n if use_dataset_goals:\n object_lo...
[ 0, 1, 2, 3, 4 ]
def create_meme(word): return f'this is your meme NEW VERSION {word}'
normal
{ "blob_id": "32b3e65add5fb44320898b682e8f94f1460a32e7", "index": 628, "step-1": "<mask token>\n", "step-2": "def create_meme(word):\n return f'this is your meme NEW VERSION {word}'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# -*- coding: utf-8 -*- from celery import shared_task from djcelery.models import PeriodicTask, CrontabSchedule import datetime from django.db.models import Max, Count from services import * # 测试任务 @shared_task() def excute_sql(x,y): print "%d * %d = %d" % (x, y, x * y) return x * y # 监控任务:查询数据库并进行告警 @sha...
normal
{ "blob_id": "6f259210cbe8969046cba1031ab42d77e913abea", "index": 6265, "step-1": "# -*- coding: utf-8 -*-\nfrom celery import shared_task\nfrom djcelery.models import PeriodicTask, CrontabSchedule\nimport datetime\nfrom django.db.models import Max, Count\n\nfrom services import *\n\n\n# 测试任务\n@shared_task()\ndef...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import BaggingClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.neighbors import KNeighborsClassifier <|reserved_special_token_1|> ### # This Python module cont...
flexible
{ "blob_id": "5029f3e2000c25d6044f93201c698773e310d452", "index": 3391, "step-1": "<mask token>\n", "step-2": "from sklearn.tree import DecisionTreeClassifier\nfrom sklearn.ensemble import BaggingClassifier\nfrom sklearn.ensemble import RandomForestClassifier\nfrom sklearn.neighbors import KNeighborsClassifier\...
[ 0, 1, 2 ]
def squirrel_play(temp, is_summer): if is_summer == True: if 60 <= temp <= 100: return True else: return False if is_summer == False: if 60 <= temp <= 90: return True else: return False
normal
{ "blob_id": "48755cf48c6696259d0c319d382021f33751ac01", "index": 9497, "step-1": "<mask token>\n", "step-2": "def squirrel_play(temp, is_summer):\n if is_summer == True:\n if 60 <= temp <= 100:\n return True\n else:\n return False\n if is_summer == False:\n if 6...
[ 0, 1 ]
#!/usr/bin/env python from program_class import Program import tmdata import os def main(): """""" args1 = {"progname" : "whoami", "command" : "/usr/bin/whoami", "procnum" : 1, "autolaunch" : True, "starttime" : 5, "restart" : "never", "retries" : 2, "stopsig" : "SSIG", "stoptime" : 10, "e...
normal
{ "blob_id": "c58f40d369388b94778e8583176f1ba8b81d0c5e", "index": 4083, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n \"\"\"\"\"\"\n args1 = {'progname': 'whoami', 'command': '/usr/bin/whoami', 'procnum':\n 1, 'autolaunch': True, 'starttime': 5, 'restart': 'never',\n ...
[ 0, 1, 2, 3, 4 ]
from sklearn.linear_model import LinearRegression, LogisticRegression import numpy as np import pickle import os def Run(datasetFile): # Get file from user userFile = open(datasetFile, "r") # Starter list of all instances of the data file instanceList = [] instanceCount = 0 featureCou...
normal
{ "blob_id": "ee7efea569b685ad8d6922e403421227e9ea6922", "index": 6277, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef Run(datasetFile):\n userFile = open(datasetFile, 'r')\n instanceList = []\n instanceCount = 0\n featureCount = 0\n for instance in userFile:\n tempStr = inst...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-06-07 12:30 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependenc...
normal
{ "blob_id": "c6c13ab24e4907eecf1db4fded28d4fc8126c834", "index": 1170, "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 = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def quitScreen(): messagebox.showinfo('collecting data', '點擊視窗開始分析') root.destroy() root2 = Tk() root2.destroy() def getTextInput(): global result, result2 result = text.get(1.0, tk.END + '-1c') result2 = text2.get(1.0, tk.END + '-1c') <|reserved_special_to...
flexible
{ "blob_id": "a126b1775ffe1ba1aebc288ce17fac8ada0b0756", "index": 312, "step-1": "<mask token>\n\n\ndef quitScreen():\n messagebox.showinfo('collecting data', '點擊視窗開始分析')\n root.destroy()\n root2 = Tk()\n root2.destroy()\n\n\ndef getTextInput():\n global result, result2\n result = text.get(1.0, ...
[ 5, 6, 8, 9, 10 ]
import sys import os # Module "sys" # # See docs for the sys module: https://docs.python.org/3.7/library/sys.html # Print out the command line arguments in sys.argv, one per line: # Print out the plaform from sys: # for arg in sys.argv: # print(arg) # Print out the Python version from sys:print(sys.platform) ...
normal
{ "blob_id": "3fed96e9bedb157a14cf9c441de5aae8b4f6edc8", "index": 8664, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('platform: ' + sys.platform + '\\n' + 'maxsize: ' + str(sys.maxsize) +\n '\\n' + 'argv: ' + str(sys.argv))\nprint('Process ID: ' + str(os.getpid()) + '\\n' + 'cwd: ' + os.getcwd(...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class showpng(Thread): def __init__(self, data): Thread.__init__(self) self.data = data def run(self): img = Image.open(BytesIO(self.data)) img.show() def islogin(session): try: session.cookies.load(ignore_discard=True) except Ex...
flexible
{ "blob_id": "c268c61e47698d07b7c1461970dc47242af55777", "index": 1637, "step-1": "<mask token>\n\n\nclass showpng(Thread):\n\n def __init__(self, data):\n Thread.__init__(self)\n self.data = data\n\n def run(self):\n img = Image.open(BytesIO(self.data))\n img.show()\n\n\ndef isl...
[ 4, 5, 7, 8, 9 ]
# Generated by Django 2.2 on 2021-01-31 14:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0004_product_pr_number'), ] operations = [ migrations.RemoveField( model_name='payment', name='PA_id', ...
normal
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def caesar(plaintext, key): if int(key) < 0: return plaintext_ascii = [(ord(char) + int(key)) for char in plaintext] for ascii in plaintext_ascii: if ascii < 97 and ascii > 90 or ascii > 122: ...
flexible
{ "blob_id": "9a7c6998e9e486f0497d3684f9c7a422c8e13521", "index": 7076, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef caesar(plaintext, key):\n if int(key) < 0:\n return\n plaintext_ascii = [(ord(char) + int(key)) for char in plaintext]\n for ascii in plaintext_ascii:\n if ...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python import os, glob, sys, math, time, argparse import ROOT from ROOT import TFile, TTree, TH2D def main(): parser = argparse.ArgumentParser(description='Program that takes as an argument a pattern of LEAF rootfiles (* wildcards work) enclosed by quotation marks ("<pattern>") and creates a root...
normal
{ "blob_id": "44c04cf79d02823318b06f02af13973960413bea", "index": 6915, "step-1": "#!/usr/bin/env python\n\nimport os, glob, sys, math, time, argparse\nimport ROOT\nfrom ROOT import TFile, TTree, TH2D\n\n\n\ndef main():\n parser = argparse.ArgumentParser(description='Program that takes as an argument a pattern...
[ 0 ]
<|reserved_special_token_0|> class SSLTransport: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __exit__(self, *_): self.close() def fileno(self): return self.socket.fileno() def read(self, len=1024...
flexible
{ "blob_id": "78d59e903fecd211aa975ae4c8dc01b17c8fad44", "index": 8471, "step-1": "<mask token>\n\n\nclass SSLTransport:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __exit__(self, *_):\n self.close()\n\n def fileno(self):\n return self.socket.fileno()\n\n ...
[ 19, 23, 27, 28, 30 ]
from manimlib.imports import * import math class A_Swerve(Scene): def construct(self): chassis = Square(side_length=2, stroke_width=0, fill_color=GRAY, fill_opacity=1).shift(2*RIGHT) fr = Dot().shift(UP+3*RIGHT) fl = Dot().shift(UP+RIGHT) rl = Dot().shift(DOWN+RIGHT) rr = Dot().shift(DOWN+3*RIGH...
normal
{ "blob_id": "bdde3a3725510d4a83b09421e4b8538a38e29584", "index": 8196, "step-1": "<mask token>\n\n\nclass A_Swerve(Scene):\n\n def construct(self):\n chassis = Square(side_length=2, stroke_width=0, fill_color=GRAY,\n fill_opacity=1).shift(2 * RIGHT)\n fr = Dot().shift(UP + 3 * RIGHT)\...
[ 2, 3, 4, 5, 6 ]
from django.shortcuts import render, HttpResponse, redirect from .models import Book, Author # This is the models.py Database # Create your views here. def main(request): context = { "the_books" : Book.objects.all(), #Book Class model.py } return render(request, "index.html", context) def book(re...
normal
{ "blob_id": "02bec34b138d53235dc944adeae8ccb8d6b3d340", "index": 4424, "step-1": "<mask token>\n\n\ndef book(request):\n Book.objects.create(title=request.POST['b_title'], desc=request.POST[\n 'b_desc'])\n return redirect('/')\n\n\ndef author(request):\n context = {'the_auths': Author.objects.all...
[ 5, 6, 7, 8, 9 ]
#dependencies go here import numpy as np import datetime as dt from datetime import timedelta import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func from flask import Flask, jsonify #Set up the engine to connect to HW8 datab...
normal
{ "blob_id": "7ab964352c1d51b70e3a1a7bf0a624f2d96cfd55", "index": 8168, "step-1": "<mask token>\n\n\n@app.route('/')\ndef home():\n \"\"\"List all available api routes.\"\"\"\n return (\n f'Available Routes:<br/>/api/v1.0/precipitation<br/>/api/v1.0/stations<br/>/api/v1.0/tobs<br/>/api/v1.0/<start><b...
[ 3, 6, 7, 9, 10 ]
<|reserved_special_token_0|> class BusInfo: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @staticmethod def init(): apiKey = os.getenv('BUS_TOKEN') ...
flexible
{ "blob_id": "7eefcfdb9682cb09ce2d85d11aafc04977016ba4", "index": 8332, "step-1": "<mask token>\n\n\nclass BusInfo:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @staticmethod\n def init():\n apiKey = os.getenv('BUS_TOKEN')\n Bu...
[ 5, 6, 7, 8, 9 ]
''' Trolls are attacking your comment section! A common way to deal with this situation is to remove all of the vowels from the trolls' comments, neutralizing the threat. Your task is to write a function that takes a string and return a new string with all vowels removed. For example, the string "This website is for...
normal
{ "blob_id": "4dea0967a0ee3e9eb3b46145739dfeb233f3a120", "index": 5307, "step-1": "<mask token>\n\n\ndef disemvowel(s):\n return s.translate(None, 'aeiouAEIOU')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef disemvowel(string):\n returnString = ''\n vowels = ['a', 'e', 'i', 'o', 'u']\n upper...
[ 1, 2, 3, 4, 5 ]
import sys from io import BytesIO import telegram from flask import Flask, request, send_file from fsm import TocMachine API_TOKEN = '375541027:AAFvLkySNkMSGgOl7PtsPIsJgnxophQpllQ' WEBHOOK_URL = 'https://a140f4ad.ngrok.io/show-fsm' app = Flask(__name__) bot = telegram.Bot(token=API_TOKEN) machine = TocMachine( ...
normal
{ "blob_id": "984efa858e782777472d84aab85471616a05b0e0", "index": 2886, "step-1": "<mask token>\n\n\ndef _set_webhook():\n status = bot.set_webhook(WEBHOOK_URL)\n if not status:\n print('Webhook setup failed')\n sys.exit(1)\n else:\n print('Your webhook URL has been set to \"{}\"'.fo...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def bfs(graph, start): queue = [start] queued = list() path = list() while queue: print('Queue is: %s' % queue) vertex = queue.pop(0) print('Processing %s' % vertex) for candidate in graph[vertex]: i...
flexible
{ "blob_id": "7bb49712c4ef482c64f3c2a457a766de691ba7c3", "index": 9427, "step-1": "<mask token>\n", "step-2": "def bfs(graph, start):\n queue = [start]\n queued = list()\n path = list()\n while queue:\n print('Queue is: %s' % queue)\n vertex = queue.pop(0)\n print('Processing %s...
[ 0, 1 ]