code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def import_string(path): """ 根据字符串的形式去导入路径中的对象 :param path: 'src.engine.agent.AgentHandler' :return: """ module_path, cls_name = path.rsplit('.', maxsplit=1) module = importlib.import_module(module_p...
flexible
{ "blob_id": "8502ebdb13c68a9a56a1a4ba51370d8458ca81dc", "index": 7944, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef import_string(path):\n \"\"\"\n 根据字符串的形式去导入路径中的对象\n :param path: 'src.engine.agent.AgentHandler'\n :return:\n \"\"\"\n module_path, cls_name = path.rsplit('.', ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @admin.register(Predictions) class PredictionsAdmin(admin.ModelAdmin): pass <|reserved_special_token_1|> from django.contrib import admin from .models import Predictions @admin.register(Predictions) class PredictionsAdm...
flexible
{ "blob_id": "bab78e8a88f9a26cc13fe0c301f82880cee2b680", "index": 965, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@admin.register(Predictions)\nclass PredictionsAdmin(admin.ModelAdmin):\n pass\n", "step-3": "from django.contrib import admin\nfrom .models import Predictions\n\n\n@admin.registe...
[ 0, 1, 2 ]
# coding: utf-8 # In[1]: import pandas as pd import os,re,sys import numpy as np import glob as glob # In[2]: def createNewDataFrame(): columns = ['document_id','content','cat','subcat'] df_ = pd.DataFrame(columns=columns) return(df_) # In[3]: def getcategories(foldername): cats = folderna...
normal
{ "blob_id": "1aa01845ab98005b1fee33b4fc153bb029e450e0", "index": 2061, "step-1": "<mask token>\n\n\ndef createNewDataFrame():\n columns = ['document_id', 'content', 'cat', 'subcat']\n df_ = pd.DataFrame(columns=columns)\n return df_\n\n\ndef getcategories(foldername):\n cats = foldername.split('_')\n...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def select(): result = tkinter.colorchooser.askcolor(title='内裤颜色种类', initialcolor= 'purple') print(result) btn1['bg'] = result[1] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> root.minsize(300, 300) def select(): resu...
flexible
{ "blob_id": "dc261b29c1c11bb8449ff20a7f2fd120bef9efca", "index": 6090, "step-1": "<mask token>\n\n\ndef select():\n result = tkinter.colorchooser.askcolor(title='内裤颜色种类', initialcolor=\n 'purple')\n print(result)\n btn1['bg'] = result[1]\n\n\n<mask token>\n", "step-2": "<mask token>\nroot.minsi...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def errorbar(t, f, s, fp=None, **kwargs): with sb.axes_style('white'): fig, ax = pl.subplots(1, 1, figsize=(10, 3)) ax.errorbar(t, f, s, marker='o', color='b', linestyle='none', **kwargs) pl.setp(ax, xlim=[t.min(), t.max()], xlabel='Time [BJD]', ylabel= ...
flexible
{ "blob_id": "1e929bc3c97de859a16a4ac8d5ac2ebadefd0516", "index": 6624, "step-1": "<mask token>\n\n\ndef errorbar(t, f, s, fp=None, **kwargs):\n with sb.axes_style('white'):\n fig, ax = pl.subplots(1, 1, figsize=(10, 3))\n ax.errorbar(t, f, s, marker='o', color='b', linestyle='none', **kwargs)\n ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class ExcelOperation: def __init__(self, filename=None): self.xlApp = win32com.client.Dispatch('Excel.Application') if filename: self.filename = filename self.xlBook = self.xlApp.Workbooks.Open(filename) else: self.xlBook = ...
flexible
{ "blob_id": "b453006b4d4c5f17bb58110fe8197d7796ca0c6c", "index": 467, "step-1": "<mask token>\n\n\nclass ExcelOperation:\n\n def __init__(self, filename=None):\n self.xlApp = win32com.client.Dispatch('Excel.Application')\n if filename:\n self.filename = filename\n self.xlBo...
[ 42, 52, 64, 71, 87 ]
import rambench rambench.perform_benchmark()
normal
{ "blob_id": "3d1f2130043613dc8d5bbd773edd96c87c355de9", "index": 3455, "step-1": "<mask token>\n", "step-2": "<mask token>\nrambench.perform_benchmark()\n", "step-3": "import rambench\nrambench.perform_benchmark()\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import numpy as np import matplotlib.pyplot as plt # some important constants x_bound = y_bound = 1. dx = dy = 0.05 k = 0.1 nx, ny = int(x_bound/dx), int(y_bound/dy) dx2, dy2 = dx*dx, dy*dy dt = (dx2 / k) / 4.0 t_end = 80 * dt # set the grid u0 = np.zeros((nx, ny)) u_exact = np.zeros((nx, ny)) u = np.zeros((nx, ny))...
normal
{ "blob_id": "c556aaf6aecb3c91d9574e0a158a9fa954108d70", "index": 8193, "step-1": "<mask token>\n\n\ndef get_exact(x, y, t, trunc):\n \"\"\"Get the exact solution at a set t\n \"\"\"\n Z = 0\n for n in range(1, trunc):\n for m in range(1, trunc):\n Z_num = -120 * ((-n) ** 4 * np.pi *...
[ 2, 4, 5, 6, 7 ]
#!/usr/bin/env python import errno import logging import os import re import sys import argparse def parse_map(map_str): file_map = [] for line in map_str.split('\n'): if not line: continue find, replace = line.split(' -- ', 1) file_map.append((find, replace)) return f...
normal
{ "blob_id": "03d07f5f4647e904c288e828b8f8e7de35740054", "index": 3737, "step-1": "<mask token>\n\n\ndef map_file(file_map, d, f):\n for find, repl in file_map:\n if '/' in find:\n source = os.path.join(d, f)\n includes_path = True\n else:\n source = f\n ...
[ 8, 10, 11, 12, 14 ]
import requests import json def get(): market = 'Premium' url = 'https://coinpremiums.herokuapp.com/json' try: result = "" premiums = requests.get(url).json() for exchange, exchange_currencies in premiums['premium'].items(): result += '[[{} | '.format(exchange.title()...
normal
{ "blob_id": "b5581be044013df9ff812f285f99ca67c4f96a62", "index": 2927, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get():\n market = 'Premium'\n url = 'https://coinpremiums.herokuapp.com/json'\n try:\n result = ''\n premiums = requests.get(url).json()\n for exchan...
[ 0, 1, 2, 3 ]
import rpy2.robjects as robjects from rpy2.robjects.packages import importr # print(robjects.__file__) import sys sys.path.append('./') import importlib import json import os from web_app.function.WordCould import word_img # importlib.reload(sys) # #sys.setdefaultencoding('gbk') class Ubiquitination(): def __ini...
normal
{ "blob_id": "a6ae4324580a8471969e0229c02ea1670728f25b", "index": 3767, "step-1": "<mask token>\n\n\nclass Ubiquitination:\n <mask token>\n\n def load_R(self):\n pass\n\n def data_path(self, name):\n exp_path = './web_app/data/disease/exp_data/{}.txt'.format(name)\n clinical_path = '...
[ 7, 8, 10, 12, 13 ]
# coding=utf-8 """ Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Example Given a binary tree as follow: 1 / \ 2 3 / \ 4 5 The maximum depth is 3. """ """ Definition of TreeNode: """ class ...
normal
{ "blob_id": "262d6722f4c158d0a41b22433792cdc35651d156", "index": 9459, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n \"\"\"\n @param root: The root of binary tree.\n @return: An integer\n \"\"\"\n\n def maxDept...
[ 1, 3, 4, 5, 6 ]
# CSE 415 Winter 2019 # Assignment 1 # Jichun Li 1531264 # Part A # 1 def five_x_cubed_plus_1(x): return 5 * (x ** 3) + 1 #2 def pair_off(ary): result = [] for i in range(0, int(len(ary) / 2 * 2), 2): result.append([ary[i], ary[i + 1]]) if (int (len(ary) % 2) == 1): result.append([ar...
normal
{ "blob_id": "681788ffe7672458e8d334316aa87936746352b1", "index": 4054, "step-1": "def five_x_cubed_plus_1(x):\n return 5 * x ** 3 + 1\n\n\n<mask token>\n", "step-2": "def five_x_cubed_plus_1(x):\n return 5 * x ** 3 + 1\n\n\ndef pair_off(ary):\n result = []\n for i in range(0, int(len(ary) / 2 * 2),...
[ 1, 2, 3, 4, 5 ]
import unittest from collections import Counter class Solution(object): def findOriginalArray(self, changed): """ :type changed: List[int] :rtype: List[int] """ n = len(changed) if n % 2 != 0: return [] freq = Counter(changed) changed.so...
normal
{ "blob_id": "d5acda0d5d066d381a7f6310eb4fe6280d7e84de", "index": 5309, "step-1": "<mask token>\n\n\nclass TestSolution(unittest.TestCase):\n\n def test_findOriginalArray(self):\n solution = Solution()\n self.assertEqual(solution.findOriginalArray([1, 3, 4, 2, 6, 8]), [1,\n 3, 4])\n\n\...
[ 2, 3, 5, 6 ]
import copy from typing import List, Optional, Tuple, NamedTuple, Union, Callable import torch from torch import Tensor from torch_sparse import SparseTensor import time import torch_quiver as qv from torch.distributed import rpc def subgraph_nodes_n(nodes, i): row, col, edge_index = None, None, None return r...
normal
{ "blob_id": "3f4f396d1d18611e0248a08b42328422ca4b8146", "index": 4766, "step-1": "<mask token>\n\n\nclass Adj(NamedTuple):\n adj_t: SparseTensor\n e_id: Optional[Tensor]\n size: Tuple[int, int]\n <mask token>\n\n\nclass RandomIndexSampler(torch.utils.data.Sampler):\n\n def __init__(self, num_nodes...
[ 12, 15, 18, 20, 21 ]
# -*- coding: utf-8 -*- ''' * EAFS * Copyright (C) 2009-2011 Adam Etienne <eadam@lunasys.fr> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation version 3. * * This program is distributed i...
normal
{ "blob_id": "2f5244c6144f5aafce29e5aba32bd7e3fc7ecf5b", "index": 3632, "step-1": "# -*- coding: utf-8 -*-\n'''\n * EAFS\n * Copyright (C) 2009-2011 Adam Etienne <eadam@lunasys.fr>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License...
[ 0 ]
l = input().split("+") l.sort() print('+'.join(l))
normal
{ "blob_id": "30d891c18f3635b7419fa0d0539b2665ad60b22c", "index": 4748, "step-1": "<mask token>\n", "step-2": "<mask token>\nl.sort()\nprint('+'.join(l))\n", "step-3": "l = input().split('+')\nl.sort()\nprint('+'.join(l))\n", "step-4": "l = input().split(\"+\")\r\r\nl.sort()\r\r\nprint('+'.join(l))\r\r\n", ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(n): a[i] = int(a[i]) for i in range(n - 1): for j in range(n - i - 1): if a[j] > a[j + 1]: a[j], a[j + 1] = a[j + 1], a[j] print('Sortes array :', a) <|reserved_special_token_1|> a = i...
flexible
{ "blob_id": "5c2a6802e89314c25f0264bbe2bc7ed2689a255a", "index": 782, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n):\n a[i] = int(a[i])\nfor i in range(n - 1):\n for j in range(n - i - 1):\n if a[j] > a[j + 1]:\n a[j], a[j + 1] = a[j + 1], a[j]\nprint('Sortes ar...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> auth.set_access_token('956917059287375875-EThit80MxgQPTJlh7ZObqyHsoV8Q2D7', 'eLv893meGppqfX3xOr8SJ93kpsbZpoOiRsVM3XTgJryZM') <|reserved_special_token_0|> auth.set_access_token('956917059287375875-EThit80MxgQPTJlh7ZObqyHsoV8Q2D...
flexible
{ "blob_id": "b68cc09347584dfc613b2e38d036b124c9af7952", "index": 1904, "step-1": "<mask token>\n", "step-2": "<mask token>\nauth.set_access_token('956917059287375875-EThit80MxgQPTJlh7ZObqyHsoV8Q2D7',\n 'eLv893meGppqfX3xOr8SJ93kpsbZpoOiRsVM3XTgJryZM')\n<mask token>\nauth.set_access_token('956917059287375875-...
[ 0, 1, 2, 3, 4 ]
from typing import List import scrapy from cssselect import Selector class RwidSpider(scrapy.Spider): name = 'rwid' allowed_domains = ['0.0.0.0'] # REQUEST LOGIN DARI URLS start_urls = ['http://0.0.0.0:9999/'] # LOGIN DISINI def parse(self, response): # apa bedanya yield & return ...
normal
{ "blob_id": "2185d332f7cd4cbf17d6b72a19297d156c2182a1", "index": 2233, "step-1": "<mask token>\n\n\nclass RwidSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n\n def parse(self, response):\n data = {'username': 'user', 'password': 'user12345'}\n return scrapy.FormReq...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase from collections import Counter import generator.resume_parser as resume_parser import os import json class TestResumeParser(TestCase): def load_resume(self, resume_name): path_to_directory = "generator/fixtures/{...
normal
{ "blob_id": "4bbfb35e4b03e2bfd46dd0fe5bfd54fb01ba11df", "index": 1996, "step-1": "<mask token>\n\n\nclass TestResumeParser(TestCase):\n <mask token>\n <mask token>\n\n def generate_counter(self, resume_name):\n json_file = self.load_resume(resume_name)\n return self.convert_to_counter(json...
[ 10, 22, 24, 25, 26 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- ########## # websocket-client # https://pypi.python.org/pypi/websocket-client/ # sudo -H pip install websocket-client ##### from websocket import create_connection ws = create_connection( "ws://192.168.1.132:81/python" ) msg = '#0000FF' print "Envoi d’un message à l’ESP"...
normal
{ "blob_id": "3b26181097025add5919e752aa53e57eea49c943", "index": 4923, "step-1": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n##########\n# websocket-client\n# https://pypi.python.org/pypi/websocket-client/\n# sudo -H pip install websocket-client\n#####\n\nfrom websocket import create_connection\nws = crea...
[ 0 ]
"""empty message Revision ID: 0bb5933fe69f Revises: 09c6fdb3cf81 Create Date: 2021-03-11 16:48:06.771046 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '0bb5933fe69f' down_revision = '09c6fdb3cf81' branch_labels = None depends_on = None def upgrade(): # ...
normal
{ "blob_id": "f727c0551f20fb0dc72b4d81b7b3ed8ce9b1b6f4", "index": 2072, "step-1": "<mask token>\n\n\ndef downgrade():\n op.drop_constraint(None, 'user', type_='unique')\n op.drop_constraint(None, 'user', type_='unique')\n op.drop_column('user', 'money')\n", "step-2": "<mask token>\n\n\ndef upgrade():\n...
[ 1, 2, 3, 4, 5 ]
from django.views import generic from .models import GPS # This is the view for my home page. It is a list view because it needs to display a list of all # of the GPS units that are currently in the database. class HomeView(generic.ListView): model = GPS template_name = 'inv_templates/home.html' context_obj...
normal
{ "blob_id": "67db3a66e5525d41de13df665167a0db2d81056e", "index": 2721, "step-1": "<mask token>\n\n\nclass Remove_ItemView(generic.ListView):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Update_ItemView(generic.ListView):\n model = GPS\n template_name = 'inv_templates/update_item.html'\n...
[ 7, 11, 12, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def something3(): x = session.query(models.Review).filter(models.Review.time < end_time ).count() <|reserved_special_token_0|> <|reserved_special_token_1|> something1 <|reserved_special_token_0|> something2 <|re...
flexible
{ "blob_id": "5b91b7025b0e574d45f95a0585128018d83c17ea", "index": 563, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef something3():\n x = session.query(models.Review).filter(models.Review.time < end_time\n ).count()\n\n\n<mask token>\n", "step-3": "something1\n<mask token>\nsomething2\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class StonewallConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class StonewallConfig(AppConfig): name = 'stonewall' <|reserved_special_token_1|> from djan...
flexible
{ "blob_id": "8364264851895ccabeb74fd3fab1d4f39da717f8", "index": 8398, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass StonewallConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass StonewallConfig(AppConfig):\n name = 'stonewall'\n", "step-4": "from django.apps impo...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_nearest_method(method_name, parser): """ all candidates toked all protocol untoked input: queries: [ (protocol, (candidate, sen_id, start, K), (candidate, sen_id, start, K), ...) (protocol, (candidate, sen_id, start, K), (candidate, sen_id, ...
flexible
{ "blob_id": "ed2f3bbc7eb0a4d8f5ccdb7a12e00cbddab04dd0", "index": 577, "step-1": "<mask token>\n\n\ndef get_nearest_method(method_name, parser):\n \"\"\"\n all candidates toked\n all protocol untoked\n input:\n queries:\n [\n (protocol, (candidate, sen_id, start, K), (candidate, sen_id, s...
[ 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """Form content type.""" from briefy.plone.content.interfaces import IBriefyContent from plone.dexterity.content import Container from zope.interface import implementer class IForm(IBriefyContent): """Interface for a Composite Page.""" @implementer(IForm) class Form(Container): """A ...
normal
{ "blob_id": "6e3de57f7c65e9f6195dabc3326b05744249cefe", "index": 7991, "step-1": "<mask token>\n\n\n@implementer(IForm)\nclass Form(Container):\n \"\"\"A Form.\"\"\"\n", "step-2": "<mask token>\n\n\nclass IForm(IBriefyContent):\n <mask token>\n\n\n@implementer(IForm)\nclass Form(Container):\n \"\"\"A ...
[ 2, 3, 4, 5, 6 ]
from os import getenv LISTEN_IP = getenv('LISTEN_IP', '0.0.0.0') LISTEN_PORT = int(getenv('LISTEN_PORT', 51273)) LISTEN_ADDRESS = LISTEN_IP, LISTEN_PORT CONFIRMATION = getenv('CONFIRMATION') if CONFIRMATION: CONFIRMATION = CONFIRMATION.encode() class UDPProtocol: def __init__(self, consumer): self...
normal
{ "blob_id": "cca543f461724c3aac8fef23ef648883962bd706", "index": 4607, "step-1": "<mask token>\n\n\nclass UDPProtocol:\n <mask token>\n\n def connection_made(self, transport):\n self.transport = transport\n <mask token>\n <mask token>\n <mask token>\n\n def stop(self):\n self.tran...
[ 3, 5, 8, 9, 11 ]
<|reserved_special_token_0|> def populateTimeInterval(rec): out_ts = (rec['event_time'] - TEMP_TS) // DELTA_MINS * DELTA_MINS + TEMP_TS rec['intvl_date'] = datetime.datetime.strftime(out_ts, '%Y-%m-%d') rec['intvl_hhmm'] = datetime.datetime.strftime(out_ts, '%H%M') return rec def processBatch(data_f...
flexible
{ "blob_id": "fcccbc8d582b709aa27500ef28d86103e98eee4c", "index": 7980, "step-1": "<mask token>\n\n\ndef populateTimeInterval(rec):\n out_ts = (rec['event_time'] - TEMP_TS) // DELTA_MINS * DELTA_MINS + TEMP_TS\n rec['intvl_date'] = datetime.datetime.strftime(out_ts, '%Y-%m-%d')\n rec['intvl_hhmm'] = date...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def __handle_import(): import sys import os cur_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) lib_path = os.path.join(cur_path, '../../build/lib/') sys.path.append(lib_path) proto_path = os.path.join(cur_path, '...
flexible
{ "blob_id": "24595979199199ecc6bc6f3a26e0db418def8b78", "index": 9675, "step-1": "<mask token>\n", "step-2": "def __handle_import():\n import sys\n import os\n cur_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))\n lib_path = os.path.join(cur_path, '../../build/lib/')\n sys....
[ 0, 1, 2 ]
#!/usr/bin/env python """ Author: Adam White, Matthew Schlegel, Mohammad M. Ajallooeian, Sina Ghiassian Purpose: Skeleton code for Monte Carlo Exploring Starts Control Agent for use on A3 of Reinforcement learning course University of Alberta Fall 2017 """ """ /* * Copyright (c) HAOTIAN ZHU ,COMPUT301,...
normal
{ "blob_id": "4e02edcf8a512060fa92ede11f33993978584147", "index": 1997, "step-1": "\n\n\n\n#!/usr/bin/env python\n\n\"\"\"\n Author: Adam White, Matthew Schlegel, Mohammad M. Ajallooeian, Sina Ghiassian\n Purpose: Skeleton code for Monte Carlo Exploring Starts Control Agent\n\t\t for use on A3 of Reinforcemen...
[ 0 ]
from django import forms from myapp.models import Student from myapp.models import Employee class EmpForm(forms.ModelForm): class Meta: model = Student fields = "__all__" class StudentForm(forms.Form): firstname = forms.CharField(label="Enter first name:", max_length=50) lastname = forms...
normal
{ "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 ]
word=input() letter,digit=0,0 for i in word: if('a'<=i and i<='z') or ('A'<=i and i<='Z'): letter+=1 if '0'<=i and i<='9': digit+=1 print("LETTERS {0} \n DIGITS {1}".format(letter,digit))
normal
{ "blob_id": "f2a508ae99697d6ba320b158a1000379b975d568", "index": 2227, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in word:\n if 'a' <= i and i <= 'z' or 'A' <= i and i <= 'Z':\n letter += 1\n if '0' <= i and i <= '9':\n digit += 1\nprint(\"\"\"LETTERS {0} \n DIGITS {1}\"\"\"...
[ 0, 1, 2, 3 ]
# This file is part of the functional_calculator_oop.py Task # Create a class called Calculator class Calculator: def Add(self, num1, num2): return num1 + num2 def Subtract(self, num1, num2): return num1 - num2 def Multiply(self, num1, num2): return num1 * num2 def Divide(sel...
normal
{ "blob_id": "d2972fb7cff08e15957f9baeaa6fd9a6f5bbb006", "index": 1127, "step-1": "class Calculator:\n <mask token>\n\n def Subtract(self, num1, num2):\n return num1 - num2\n <mask token>\n\n def Divide(self, num1, num2):\n return num1 / num2\n\n\n<mask token>\n", "step-2": "class Calc...
[ 3, 4, 5, 6, 7 ]
from rest_framework import serializers from plan.models import RoughRequirement, DetailedRequirement from plan.models import OfferingCourse, FieldOfStudy, IndicatorFactor from plan.models import BasisTemplate class SimpleOfferingCourseSerializer(serializers.ModelSerializer): class Meta: model = OfferingCou...
normal
{ "blob_id": "596f7dfacc931f5e756c71b8622f4001df19934b", "index": 5964, "step-1": "<mask token>\n\n\nclass RequirementSerializer(serializers.ModelSerializer):\n <mask token>\n\n\n class Meta:\n model = RoughRequirement\n fields = ['id', 'index', 'title', 'description',\n 'detailed_r...
[ 8, 11, 12, 13, 14 ]
# -*- coding: utf-8 -*- # https://github.com/Raschka-research-group/coral-cnn/tree/master/model-code/resnet34 from absl import flags, app from Rank_consistent_model_fix import * from Rank_consistent_model import * from random import shuffle, random import tensorflow as tf import numpy as np # import cv2 import os impo...
normal
{ "blob_id": "9ffe350ff9a568111620ef7dafef83d341f6f01e", "index": 9409, "step-1": "<mask token>\n\n\ndef _func(filename, label):\n image_string = tf.io.read_file(filename)\n decode_image = tf.image.decode_jpeg(image_string, channels=3)\n decode_image = tf.image.resize(decode_image, [FLAGS.img_size - 8, F...
[ 7, 8, 9, 10, 12 ]
# -*- coding: utf-8 -*- ''' Created on Dec 22, 2014 @author: Alan Tai ''' from handlers.handler_webapp2_extra_auth import BaseHandler from models.models_porn_info import WebLinkRoot, WebLinkPornTemp, WebLinkPorn,\ Tag from dictionaries.dict_key_value_pairs import KeyValuePairsGeneral from bs4 import BeautifulSoup ...
normal
{ "blob_id": "f6cebf6ec848a06f81c4e1f584ebb83f4d9ff47c", "index": 3549, "step-1": "# -*- coding: utf-8 -*-\n'''\nCreated on Dec 22, 2014\n\n@author: Alan Tai\n'''\nfrom handlers.handler_webapp2_extra_auth import BaseHandler\nfrom models.models_porn_info import WebLinkRoot, WebLinkPornTemp, WebLinkPorn,\\\n Tag...
[ 0 ]
#!/usr/bin/python3 #start up curses import curses HEIGHT = 24 WIDTH = 80 TESTING = True curses.initscr() stdscr = curses.newwin(HEIGHT, WIDTH, 0, 0) curses.noecho() #don't echo keys stdscr.keypad(1) #function for displaying other players decision #statement is the number of the other player's death funciton returne...
normal
{ "blob_id": "a6f03340c2f60c061977fed6807703cdaeb1b7fd", "index": 7976, "step-1": "<mask token>\n\n\ndef decision(statement, player):\n stdscr.clear()\n stdscr.border(0)\n stdscr.timeout(-1)\n decision = 'play again' if statement == 1 else 'return to main menu'\n stdscr.addstr(3, 5, 'Your Partner h...
[ 4, 5, 8, 9, 10 ]
from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from database_setup import Base, Country, TouristPlaces, Users # Create database and create a shortcut for easier to update database engine = create_engine('sqlite:///country_catalog.db') Base.metadata.bind = engine DBSession = sessionmaker(b...
normal
{ "blob_id": "21b9844fce10d16a14050a782ce7e15e3f6fb657", "index": 5737, "step-1": "<mask token>\n", "step-2": "<mask token>\nsession.add(user_1)\nsession.commit()\n<mask token>\nsession.add(country_1)\nsession.commit()\n<mask token>\nsession.add(country_2)\nsession.commit()\n<mask token>\nsession.add(country_3)...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='dcnn_visualizer', version='', packages=['dcnn_visualizer', 'dcnn_visualizer.backward_functions'], url='', license='', author= 'Aiga SUZUKI', author_email='tochikuji@gmail.com', description='', requires=['nu...
flexible
{ "blob_id": "b9a75f4e106efade3a1ebdcfe66413107d7eccd0", "index": 7884, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='dcnn_visualizer', version='', packages=['dcnn_visualizer',\n 'dcnn_visualizer.backward_functions'], url='', license='', author=\n 'Aiga SUZUKI', author_email='tochikuji@...
[ 0, 1, 2 ]
from django.db import models from utils.models import BaseModel # Create your models here. class ContentCategory(BaseModel): '''广告内容类别''' name = models.CharField(verbose_name='名称',max_length=50) key = models.CharField(verbose_name='类别键名',max_length=50) class Meta: db_table = 'tb_content_catego...
normal
{ "blob_id": "fd96bf5595ce6ec1f95d0f7a9d1c4ff582826ac0", "index": 1439, "step-1": "<mask token>\n\n\nclass ContentCategory(BaseModel):\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n db_table = 'tb_content_category'\n verbose_name = '广告内容类别'\n verbose_name_plural ...
[ 5, 6, 7, 8, 10 ]
import matplotlib.pyplot as pt import numpy as np from scipy.optimize import leastsq #################################### # Setting up test data def norm(x, media, sd): norm = [] for i in range(x.size): norm += [1.0/(sd*np.sqrt(2*np.pi))*np.exp(-(x[i] - media)**2/(2*sd**2))] return np.array(norm)...
normal
{ "blob_id": "b3ce17401476afe2edfda3011d5602ba492cd705", "index": 5817, "step-1": "<mask token>\n\n\ndef res(p, y, x):\n m, dm, sd1, sd2 = p\n m1 = m\n m2 = m1 + m\n y_fit = norm(x, m1, sd1) + norm(x, m2, sd2)\n error = y - y_fit\n return error\n\n\n<mask token>\n", "step-2": "<mask token>\n\n...
[ 1, 2, 3, 4, 5 ]
import config import math import pygame import utils class Rocket: def __init__(self): self.x = config.initialPosition['x']*config.game['scale'] + config.game['width']/2; self.y = config.game['height'] - config.game['floorHeight'] - config.initialPosition['y']*config.game['scale']; self.angle = config.initial...
normal
{ "blob_id": "7a1a9d2e773fb783d8522f1ea51e753d5d3782e9", "index": 7517, "step-1": "<mask token>\n\n\nclass Rocket:\n <mask token>\n <mask token>\n\n def update(self, x, y, angle, leftPower, rightPower):\n self.x = x * config.game['scale'] + config.game['width'] / 2\n self.y = config.game['h...
[ 2, 3, 4, 5, 6 ]
print(input()in[str(i**i+i)for i in range(11)]) num = int(input()) suma = 0 x = 0 while(suma < num): x += 1 suma = x**x + x print(True if suma == num else False
normal
{ "blob_id": "20fe9b68e65f6f017897bfa8e99d0c21ba1617fb", "index": 1522, "step-1": "print(input()in[str(i**i+i)for i in range(11)])\n\n\n\nnum = int(input())\nsuma = 0\nx = 0\nwhile(suma < num):\n x += 1\n suma = x**x + x\nprint(True if suma == num else False\n\n\n", "step-2": null, "step-3": null, "st...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def domain_name(url): while 'https://' in url or 'http://' in url or 'www.' in url: url = url.replace('https://', ' ' ) if 'https://' in url else url.replace('http://', ' ' ) if 'http://' in url else url.replace('www.', ' '...
flexible
{ "blob_id": "2b9dfd0cfd62276330f1a4f983f318076f329437", "index": 5026, "step-1": "<mask token>\n", "step-2": "def domain_name(url):\n while 'https://' in url or 'http://' in url or 'www.' in url:\n url = url.replace('https://', ' '\n ) if 'https://' in url else url.replace('http://', ' '\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .dependencies import have from .syntax import PythonHighlighter from .utils import count_locations, image_path, interface_style, natural_sort <|reserved_special_token_1|> # © MNELAB developers # # License: BSD (3-clause) from .dependencies import hav...
flexible
{ "blob_id": "837534ebc953dae966154921709398ab2b2e0b33", "index": 578, "step-1": "<mask token>\n", "step-2": "from .dependencies import have\nfrom .syntax import PythonHighlighter\nfrom .utils import count_locations, image_path, interface_style, natural_sort\n", "step-3": "# © MNELAB developers\n#\n# License:...
[ 0, 1, 2 ]
# This script allows you to copy all files with a certain extention to a new folder without integrating the sub folders # Created by Maurice de Kleijn Vrije Universiteit Amsterdam Spatial Information laboratory for the datamanagement of the the archaological project Barin Hoyuk # 22062016 Python 2.7 import shutil impo...
normal
{ "blob_id": "778cf8064fa45e3e25a66f2165dcf6885c72fb8a", "index": 634, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.system('dir ' + org_GIS + '*' + ext + ' /s/d/b >' + org_GIS + 'tempext.txt')\n<mask token>\nfor line in lines:\n ln = line.rstrip('\\n')\n shutil.copy(ln, outputfolder)\nfile1.clo...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> with open('rosalind_ba3d.txt', 'r') as f: kmer_length = int(f.readline().strip()) seq = f.readline().strip() <|reserved_special_token_0|> for offset in range(len(seq) - kmer_length + 1): prefix = seq[offset:offset + kmer_length - 1] suffix = s...
flexible
{ "blob_id": "050f060bb9d3d46f8b87c9802356bd0da8f926f8", "index": 6244, "step-1": "<mask token>\n", "step-2": "with open('rosalind_ba3d.txt', 'r') as f:\n kmer_length = int(f.readline().strip())\n seq = f.readline().strip()\n<mask token>\nfor offset in range(len(seq) - kmer_length + 1):\n prefix = seq[...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class ConsoleLogger: <|reserved_special_token_0|> def set_level(self, level): self.logger.setLevel(level) <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "5299f2c66fd287be667ecbe11b8470263eafab5c", "index": 702, "step-1": "<mask token>\n\n\nclass ConsoleLogger:\n <mask token>\n\n def set_level(self, level):\n self.logger.setLevel(level)\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __...
[ 3, 6, 7, 8, 11 ]
#Task 4 - writing a code that prints all the commit message from repository import requests r = requests.get('https://api.github.com/repos/smeiklej/secu2002_2017/commits') text = r.json() #asking the code to print out the commit message for all rows in the text for row in text: print row['commit']['message']
normal
{ "blob_id": "d07046e33bbfa404c354fef3e8990a3fa0203060", "index": 1843, "step-1": "#Task 4 - writing a code that prints all the commit message from repository\nimport requests\nr = requests.get('https://api.github.com/repos/smeiklej/secu2002_2017/commits')\ntext = r.json()\n\n#asking the code to print out the com...
[ 0 ]
''' Created on May 18, 2010 @author: Abi.Mohammadi & Majid.Vesal ''' from threading import current_thread import copy import time from deltapy.core import DeltaException, Context import deltapy.security.services as security_services import deltapy.security.session.services as session_services import deltapy.unique...
normal
{ "blob_id": "80469fd945a21c1bd2b5590047016a4b60880c88", "index": 7006, "step-1": "<mask token>\n\n\nclass Session:\n <mask token>\n\n\n class StateEnum:\n \"\"\"\n A class for defining session state.\n \"\"\"\n ACTIVE = 'Active'\n INACTIVE = 'Inactive'\n CLOSED = '...
[ 18, 21, 25, 28, 31 ]
<|reserved_special_token_0|> def arribo(): global reloj global tiempoUltEvento global estadoServ global tiempoServicioTotal global areaQ global numCliEnCola global cola global tiempoLibre global completaronDemora listaEventos[0] = reloj + generarTiempoExponencial(tiempoEntreArr...
flexible
{ "blob_id": "62cc731982846f08b3f3caace5df1bfafd421869", "index": 1701, "step-1": "<mask token>\n\n\ndef arribo():\n global reloj\n global tiempoUltEvento\n global estadoServ\n global tiempoServicioTotal\n global areaQ\n global numCliEnCola\n global cola\n global tiempoLibre\n global co...
[ 6, 7, 8, 9, 10 ]
"""This is a collection of utilities for httpy and httpy applications. """ import cgi import linecache import mimetypes import os import stat import sys from Cookie import SimpleCookie from StringIO import StringIO from urllib import unquote from httpy.Response import Response def uri_to_fs(config, resource_uri_pat...
normal
{ "blob_id": "472cdca501890d1d07c7363a48532ed3a184727c", "index": 8516, "step-1": "\"\"\"This is a collection of utilities for httpy and httpy applications.\n\"\"\"\n\nimport cgi\nimport linecache\nimport mimetypes\nimport os\nimport stat\nimport sys\nfrom Cookie import SimpleCookie\nfrom StringIO import StringIO...
[ 0 ]
decoded = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p"...
normal
{ "blob_id": "23236cd8262eb414666db88215c01d973abf1d97", "index": 1247, "step-1": "<mask token>\n\n\ndef decode(value):\n out_value = ''\n char = [value[i:i + 2] for i in range(0, len(value), 2)]\n for i in range(0, len(char)):\n out_value += decoded[encoded.index(char[i])]\n return out_value\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_runs_counts_by_match(): ipl_df = read_csv_data_to_df('data/ipl_dataset.csv') df1 = pd.DataFrame(ipl_df[['match_code', 'runs', 'venue']]) df2 = df1.groupby(['match_code', 'runs'], as_index=False).count() d...
flexible
{ "blob_id": "4f06d87ec79c20206ff45ba72ab77844076be553", "index": 9707, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_runs_counts_by_match():\n ipl_df = read_csv_data_to_df('data/ipl_dataset.csv')\n df1 = pd.DataFrame(ipl_df[['match_code', 'runs', 'venue']])\n df2 = df1.groupby(['mat...
[ 0, 1, 2, 3, 4 ]
from bisect import bisect_left as bisect while True: xp, yp = set(), set() veneer = [] W, H = map(int, input().split()) if not W: break N = int(input()) for i in range(N): x1, y1, x2, y2 = map(int, input().split()) veneer.append((x1, y1, x2, y2)) xp.add(x1) ...
normal
{ "blob_id": "e0fbb5ad6d822230865e34c1216b355f700e5cec", "index": 7822, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n xp, yp = set(), set()\n veneer = []\n W, H = map(int, input().split())\n if not W:\n break\n N = int(input())\n for i in range(N):\n x1, y1, ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('SYL_2整型数组_12 合并排序数组')
flexible
{ "blob_id": "571636be9d213d19bddfd1d04688bc0955c9eae5", "index": 4427, "step-1": "<mask token>\n", "step-2": "print('SYL_2整型数组_12 合并排序数组')\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
""" Platformer Game """ import arcade import os from Toad_arcade import Toad # Constants SCREEN_WIDTH = 1920 SCREEN_HEIGHT = 1080 SCREEN_TITLE = "PyToads - Battletoads reimplementation" # Constants used to scale our sprites from their original size CHARACTER_SCALING = 1 TILE_SCALING = 0.5 COIN_SCALING = 0.5 MOVEMENT_S...
normal
{ "blob_id": "28d8f9d9b39c40c43a362e57a7907c0a38a6bd05", "index": 748, "step-1": "<mask token>\n\n\nclass MyGame(arcade.Window):\n <mask token>\n\n def __init__(self, width, height, title):\n \"\"\"\n Initializer\n \"\"\"\n super().__init__(width, height, title)\n file_pat...
[ 6, 7, 9, 12, 13 ]
"""Resolwe collection serializer.""" import logging from rest_framework import serializers from resolwe.flow.models import Collection, Data, DescriptorSchema from resolwe.rest.fields import ProjectableJSONField from .base import ResolweBaseSerializer from .descriptor import DescriptorSchemaSerializer from .fields im...
normal
{ "blob_id": "d6f8ec0fd8be0fa7019a84af47d08ab8b5b32d92", "index": 1449, "step-1": "<mask token>\n\n\nclass BaseCollectionSerializer(ResolweBaseSerializer):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def get_status(self, coll...
[ 6, 8, 9, 11, 12 ]
#https://www.geeksforgeeks.org/count-of-substrings-of-length-k-with-exactly-k-distinct-characters/ #https://www.geeksforgeeks.org/count-number-of-substrings-with-exactly-k-distinct-characters/
normal
{ "blob_id": "2ca40a53291a62bbdb4386decc5a2dfa84431836", "index": 6630, "step-1": "#https://www.geeksforgeeks.org/count-of-substrings-of-length-k-with-exactly-k-distinct-characters/\n#https://www.geeksforgeeks.org/count-number-of-substrings-with-exactly-k-distinct-characters/\n", "step-2": null, "step-3": nul...
[ 1 ]
<|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": "1573af9cdf4817acbe80031e22489386ea7899cf", "index": 4782, "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 = [('monitor', '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def attttaaaaacccckkkk(): enemy = hero.findNearest(hero.findEnemies()) if enemy: if enemy and hero.isReady('cleave'): hero.cleave(enemy) else: hero.attack(enemy) <|reserved_special_token_0|> <|reserved_speci...
flexible
{ "blob_id": "ce365e011d8cc88d9aa6b4df18ea3f4e70d48f5c", "index": 4887, "step-1": "<mask token>\n", "step-2": "def attttaaaaacccckkkk():\n enemy = hero.findNearest(hero.findEnemies())\n if enemy:\n if enemy and hero.isReady('cleave'):\n hero.cleave(enemy)\n else:\n hero...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .routes import generate_routes
flexible
{ "blob_id": "06339e9cd506f147d03c54aee82473e233b4ec2e", "index": 8853, "step-1": "<mask token>\n", "step-2": "from .routes import generate_routes\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> def get_user(user_id=None, **kwargs): if user_id is not None: return User.query.get(user_id) username = kwargs.pop('username') if username is not None: return User.query.filter_by(username=username).first() raise NotImplementedError <|reserved_special_tok...
flexible
{ "blob_id": "49c15f89225bb1dd1010510fe28dba34f6a8d085", "index": 4866, "step-1": "<mask token>\n\n\ndef get_user(user_id=None, **kwargs):\n if user_id is not None:\n return User.query.get(user_id)\n username = kwargs.pop('username')\n if username is not None:\n return User.query.filter_by(...
[ 1, 2, 3, 4, 5 ]
# ============================================================================ # Archivo cnn_sisben.py # autor Johan S. Mendez, Jose D. Mendez # fecha 27/Agos/2020 # Clasificacion de beneficiarios del nuevo sistema de clasificacion del sisben # agrupado en 4 grandes grupos de beneficiarios, se utiliza un red neuronal ...
normal
{ "blob_id": "bfb52a5ee6d88d63c4ef89dae26bb8cbecb091c6", "index": 4200, "step-1": "<mask token>\n", "step-2": "<mask token>\nseed(1)\n<mask token>\nset_random_seed(2)\nprint('\\x1b[91m Lectura de datos \\x1b[0m')\n<mask token>\nmodel.add(Conv1D(64, 32, input_shape=(x_train.shape[1], 1), activation='elu'))\nmode...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class NumericKeyboard(Bubble): def on_touch_up(self, touch): app = App.get_running_app() if not self.collide_point(*touch.pos ) and not self.parent.collide_point(*touch.pos): self.parent.remove_widget(self.parent.bubb) app.root.ids....
flexible
{ "blob_id": "7da8a074704b1851ac352477ef72a4c11cea1a0b", "index": 6737, "step-1": "<mask token>\n\n\nclass NumericKeyboard(Bubble):\n\n def on_touch_up(self, touch):\n app = App.get_running_app()\n if not self.collide_point(*touch.pos\n ) and not self.parent.collide_point(*touch.pos):\...
[ 5, 9, 10, 11, 16 ]
<|reserved_special_token_0|> def get_grads_correct(seed): util.set_seed(seed) theta_grads_correct = [] phi_grads_correct = [] log_weight, log_q = losses.get_log_weight_and_log_q(generative_model, inference_network, obs, num_particles) optimizer_phi.zero_grad() optimizer_theta.zero_grad...
flexible
{ "blob_id": "8f558593e516aa4a769b7c5e1c95c8bc23a36420", "index": 1232, "step-1": "<mask token>\n\n\ndef get_grads_correct(seed):\n util.set_seed(seed)\n theta_grads_correct = []\n phi_grads_correct = []\n log_weight, log_q = losses.get_log_weight_and_log_q(generative_model,\n inference_network...
[ 5, 6, 8, 9, 10 ]
# -*- coding: utf-8 -*- __author__ = 'virtual' statuses = { None: {'name': 'None', }, -1: { 'name': 'unknown', }, 0: { 'name': '',}, 1: { 'name': 'Новый',}, 2: { 'name': '',}, 3: { 'name': 'Активный', }, 4: { 'name': 'Приостановленный',}, 5: { 'name': 'Заблокированный', }, 6: { 'n...
normal
{ "blob_id": "a847fc32af2602db3b5545c15186c0209eb8ae8d", "index": 4008, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_status_name(status):\n return '[%d]%s' % (status, statuses[status]['name'])\n", "step-3": "__author__ = 'virtual'\nstatuses = {None: {'name': 'None'}, (-1): {'name': 'unk...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if len(argv) == 2: docdir = argv[1] <|reserved_special_token_0|> spot.InsertBefore('Hello COM client world!') newdoc.SaveAs(docdir + 'pycom.doc') newdoc.SaveAs(docdir + 'copy.doc') newdoc.Close() <|reserved_special_token_0|> f...
flexible
{ "blob_id": "df19aa720993c2385a6d025cf7ec8f3935ee4191", "index": 9343, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(argv) == 2:\n docdir = argv[1]\n<mask token>\nspot.InsertBefore('Hello COM client world!')\nnewdoc.SaveAs(docdir + 'pycom.doc')\nnewdoc.SaveAs(docdir + 'copy.doc')\nnewdoc.Close...
[ 0, 1, 2, 3, 4 ]
from bottle import response,request,route,run from json import dumps import ConfigParser import pickle import pandas as pd import numpy as np from sklearn.pipeline import Pipeline from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.cross_...
normal
{ "blob_id": "f0b5ad49fc47adc54fb16a151b4a0ed563f53a42", "index": 9482, "step-1": "from bottle import response,request,route,run\nfrom json import dumps\nimport ConfigParser\nimport pickle\nimport pandas as pd\nimport numpy as np\nfrom sklearn.pipeline import Pipeline\nfrom sklearn.feature_extraction.text import ...
[ 0 ]
<|reserved_special_token_0|> class Post(models.Model): blog = models.ForeignKey(Blog, on_delete=models.DO_NOTHING) user = models.ForeignKey(User, on_delete=models.CASCADE) header = models.CharField(max_length=50) text = models.CharField(max_length=2048) create_date = models.DateTimeField(auto_now=...
flexible
{ "blob_id": "de77edaccdaada785f41828135ad2da4ae2b403e", "index": 725, "step-1": "<mask token>\n\n\nclass Post(models.Model):\n blog = models.ForeignKey(Blog, on_delete=models.DO_NOTHING)\n user = models.ForeignKey(User, on_delete=models.CASCADE)\n header = models.CharField(max_length=50)\n text = mod...
[ 6, 8, 9, 10, 11 ]
# -*- coding: utf-8 -*- """ Created on Thu May 24 18:18:36 2018 @author: Nicole """ from __future__ import division import Rod import matplotlib.pyplot as plt import math class Truss: def __init__(self,node1,node2,size,result,ax): self.node1=node1 self.node2=node2 self.rod=Rod.Rod(node1,...
normal
{ "blob_id": "f01a1b6d0de4ba685c489af2742159447f943d2d", "index": 5605, "step-1": "<mask token>\n\n\nclass Truss:\n\n def __init__(self, node1, node2, size, result, ax):\n self.node1 = node1\n self.node2 = node2\n self.rod = Rod.Rod(node1, node2, result)\n self.size = size\n ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class NSDescriptorsViewSet(viewsets.ModelViewSet): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def get_success_headers(self, data): return {'Location': data['_links']['self']} def list(self, request, *args, **kwargs)...
flexible
{ "blob_id": "5e2fcc6379a8ecee0378d26108e4deab9d17dba6", "index": 7483, "step-1": "<mask token>\n\n\nclass NSDescriptorsViewSet(viewsets.ModelViewSet):\n <mask token>\n <mask token>\n <mask token>\n\n def get_success_headers(self, data):\n return {'Location': data['_links']['self']}\n\n def ...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> __all__ = ['Swarmpose'] <|reserved_special_token_1|> #a list of functions/Classes to be inported when a user imports * from swarmpose __all__ = ['Swarmpose']
flexible
{ "blob_id": "e375501e6b815530e61af9181d4cade83d4588ca", "index": 8762, "step-1": "<mask token>\n", "step-2": "__all__ = ['Swarmpose']\n", "step-3": "#a list of functions/Classes to be inported when a user imports * from swarmpose\n__all__ = ['Swarmpose']", "step-4": null, "step-5": null, "step-ids": [ ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def fun_nthfibonaccinumber(n): n1 = 1 n2 = 1 if n == 0: return n2 else: for i in range(0, n - 1): sum = n1 + n2 n1 = n2 n2 = sum return n2 <|reserved_special_token_1|> # Background: Th...
flexible
{ "blob_id": "40744a8530df28f0bd8648900beb8a66e2d44cd0", "index": 7730, "step-1": "<mask token>\n", "step-2": "def fun_nthfibonaccinumber(n):\n n1 = 1\n n2 = 1\n if n == 0:\n return n2\n else:\n for i in range(0, n - 1):\n sum = n1 + n2\n n1 = n2\n n2 =...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with webdriver.Chrome() as browser: browser.get('http://suninjuly.github.io/selects1.html') time.sleep(1) x = int(browser.find_element_by_id('num1').text) y = int(browser.find_element_by_id('num2').text) sum_xy...
flexible
{ "blob_id": "42be9077ec51a9be1d4923011a38cd64d829f876", "index": 1529, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith webdriver.Chrome() as browser:\n browser.get('http://suninjuly.github.io/selects1.html')\n time.sleep(1)\n x = int(browser.find_element_by_id('num1').text)\n y = int(brow...
[ 0, 1, 2, 3 ]
#! /usr/bin/env python3 import sys def stage_merge_checksums( old_survey=None, survey=None, brickname=None, **kwargs): ''' For debugging / special-case processing, read previous checksums, and update them with current checksums values, then write out the result. ''' ...
normal
{ "blob_id": "a98d03b169b59704b3b592cee0b59f5389fd77b3", "index": 8899, "step-1": "<mask token>\n\n\ndef main():\n import argparse\n parser = argparse.ArgumentParser()\n parser.add_argument('--old-output', required=True, help=\n '\"Old\" output directory to read old checksum file from.')\n pars...
[ 1, 2, 3, 4, 5 ]
from flask import render_template, request, redirect, url_for from flask_login import current_user from application import app, db, login_required from application.auth.models import User from application.memes.models import Meme from application.comments.forms import CommentForm # only a dummy new comment form @app...
normal
{ "blob_id": "fe1d47b63e88935f8b2eb4bac883f3028d6f560b", "index": 4515, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/comments/new/')\n@login_required(role='ANY')\ndef comments_form():\n return render_template('comments/new.html', form=CommentForm())\n", "step-3": "from flask import...
[ 0, 1, 2, 3 ]
v0 = 5 g = 9.81 t = 0.6 y = v0 * t - 0.5 * g * t ** 2 print(y)
normal
{ "blob_id": "378032a8d02bc49e5ed8ebccbeddfbb281c2cbd7", "index": 6231, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(y)\n", "step-3": "v0 = 5\ng = 9.81\nt = 0.6\ny = v0 * t - 0.5 * g * t ** 2\nprint(y)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> class OfflineMetric: def __init__(self, *args, **kwargs): self.__name__ = self.name() <|reserved_special_token_0|> def handle_batch(self, model, x, labels, pred): raise NotImplementedError() def result(self): raise NotImplementedError() <|res...
flexible
{ "blob_id": "16bf4583b872f038edccbac4e567c1854d65e216", "index": 4962, "step-1": "<mask token>\n\n\nclass OfflineMetric:\n\n def __init__(self, *args, **kwargs):\n self.__name__ = self.name()\n <mask token>\n\n def handle_batch(self, model, x, labels, pred):\n raise NotImplementedError()\n...
[ 18, 20, 32, 39, 46 ]
import os import numpy import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D def plotObject(obj): fig = plt.figure() ax = fig.add_subplot(111, projection='3d') x,y,z = numpy.nonzero(obj>0) ax.scatter(x,y,z,c='r',s=10) xb,yb,zb = numpy.nonzero(obj<0) ax.scatter(xb,yb,zb,c='b',s=1) plt.show() c...
normal
{ "blob_id": "8475792cc2d55f030f0bd9e7d0240e3b59ed996b", "index": 7774, "step-1": "<mask token>\n\n\nclass GridData:\n\n def __init__(self, datafile, labelfile):\n f = open(datafile, 'rb')\n f2 = open(labelfile, 'r')\n self.samples = []\n self.labels = []\n self.label_names =...
[ 2, 4, 5, 7, 8 ]
""" db.集合.update() """ """ 实例 被替换了 > db.test1000.update({'name':'dapeng'},{'name':'大鹏'}) WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 }) > db.test1000.find() { "_id" : ObjectId("5c35549d7ad0cf935d3c150d"), "name" : "大鹏" } { "_id" : ObjectId("5c3554f37ad0cf935d3c150e"), "nInserted" : 1 } { "_id" : Obj...
normal
{ "blob_id": "7d8c2aa5674704d4443034c29bbdc715da9fd567", "index": 5022, "step-1": "<mask token>\n", "step-2": "\"\"\"\ndb.集合.update()\n\n\"\"\"\n\"\"\"\n实例 被替换了\n> db.test1000.update({'name':'dapeng'},{'name':'大鹏'})\nWriteResult({ \"nMatched\" : 1, \"nUpserted\" : 0, \"nModified\" : 1 })\n> db.test1000.find()\n...
[ 0, 1 ]
<|reserved_special_token_0|> def latinize_word(word): """performs bee latin on a word""" if word[0].lower() in 'bcdfghjklmnpqrstvwxyz': word = word[1:] + word[0] + 'uzz' else: word += 'buzz' return word.lower() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_s...
flexible
{ "blob_id": "5810739300067e8f207d09bf971484a278372a9a", "index": 5246, "step-1": "<mask token>\n\n\ndef latinize_word(word):\n \"\"\"performs bee latin on a word\"\"\"\n if word[0].lower() in 'bcdfghjklmnpqrstvwxyz':\n word = word[1:] + word[0] + 'uzz'\n else:\n word += 'buzz'\n return ...
[ 1, 2, 3, 4, 5 ]
import requests from requests.auth import HTTPBasicAuth def __run_query(self, query): URL = 'https://api.github.com/graphql' request = requests.post(URL, json=query,auth=HTTPBasicAuth('gleisonbt', 'Aleister93')) if request.status_code == 200: return request.json() else: ...
normal
{ "blob_id": "fa511411e59880fd80fba0ccc49c95d42cb4b78d", "index": 6962, "step-1": "<mask token>\n\n\ndef __run_query(self, query):\n URL = 'https://api.github.com/graphql'\n request = requests.post(URL, json=query, auth=HTTPBasicAuth('gleisonbt',\n 'Aleister93'))\n if request.status_code == 200:\n...
[ 1, 2, 3, 4, 5 ]
# type: ignore[no-redef] import pytest @pytest.mark.asyncio @pytest.mark.core async def test_async_executor(executor): def func(): pass result = await executor.run(func) assert result is None def func(): return 1 result = await executor.run(func) assert result == 1 def ...
normal
{ "blob_id": "67b483d9d002cc66dd368cf53fdc49ebb7b4f4d4", "index": 9556, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.asyncio\n@pytest.mark.core\nasync def test_async_executor(executor):\n\n def func():\n pass\n result = await executor.run(func)\n assert result is None\n\...
[ 0, 1, 2, 3 ]
import numpy from math import cos, sin, radians, tan class Window: # construtor def __init__(self, world, xyw_min=None, xyw_max=None): self.world = world # caso em q é None if xyw_min is None or xyw_max is None: self.xyw_min = (-100, -100) self.xyw_max = (100, 10...
normal
{ "blob_id": "deb0cd745eae97a6dbabdfab37e1c6d75e5372f0", "index": 8422, "step-1": "<mask token>\n\n\nclass Window:\n\n def __init__(self, world, xyw_min=None, xyw_max=None):\n self.world = world\n if xyw_min is None or xyw_max is None:\n self.xyw_min = -100, -100\n self.xyw_...
[ 15, 16, 18, 20, 22 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> prov_config.enable_ssl(leaf_domain_label=https_cert) <|reserved_special_token_0|> aks_service.wait_for_deployment(show_output=True) print(aks_service.state) <|reserved_special_token_1|> <|reserved_special_token_0|> workspace_na...
flexible
{ "blob_id": "2941ecde72325d46b5c3899d4b1a213daff67147", "index": 2613, "step-1": "<mask token>\n", "step-2": "<mask token>\nprov_config.enable_ssl(leaf_domain_label=https_cert)\n<mask token>\naks_service.wait_for_deployment(show_output=True)\nprint(aks_service.state)\n", "step-3": "<mask token>\nworkspace_na...
[ 0, 1, 2, 3, 4 ]
import re print("Welcome to the Python Calculator") print("To stop calculator type: quit") previous = 0 run = True def perform_math(): '''(numbers) -> numbers accepts numbers from the user and performs continuous mathematical equations on them. precondition input must be numbers and m...
normal
{ "blob_id": "4122da21abab462a28c925c1afa5792ec729a75a", "index": 5087, "step-1": "<mask token>\n\n\ndef perform_math():\n \"\"\"(numbers) -> numbers\n\n accepts numbers from the user and performs continuous\n mathematical equations on them.\n\n precondition input must be numbers and mathematical sign...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def summarize(text): sentences_token = sent_tokenize(text) vectorizer = CountVectorizer(min_df=1, decode_error='replace') sent_bow = vectorizer.fit_transform(sentences_token) transformer = TfidfTransformer(norm='...
flexible
{ "blob_id": "b75ebcd278ae92274bbbe8d1ce5cb3bb7fa14a2c", "index": 9637, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef summarize(text):\n sentences_token = sent_tokenize(text)\n vectorizer = CountVectorizer(min_df=1, decode_error='replace')\n sent_bow = vectorizer.fit_transform(sentences_...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class State_Underway(State): def __init__(self): super(State_Underway, self).__init__('Underway') class State_Paused(State): def __init__(self): super(State_Paused, self).__init__('Paused') class State_Completed(State): def __init__(self): super(...
flexible
{ "blob_id": "e40b34f0ee51cc14615c6225a7676929e6d2876a", "index": 2975, "step-1": "<mask token>\n\n\nclass State_Underway(State):\n\n def __init__(self):\n super(State_Underway, self).__init__('Underway')\n\n\nclass State_Paused(State):\n\n def __init__(self):\n super(State_Paused, self).__ini...
[ 25, 26, 30, 31, 34 ]
class State(object): def __init__(self, stateName, stateLevel): self.stateName = stateName; self.stateLevel = stateLevel;
normal
{ "blob_id": "73082ed2824ee65f7f4cbac47b9ebad19cec4196", "index": 7226, "step-1": "class State(object):\ndef __init__(self, stateName, stateLevel):\n self.stateName = stateName;\n self.stateLevel = stateLevel;\t\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ ...
[ 0 ]
<|reserved_special_token_0|> def read_csv_json(file_name) ->pandas.DataFrame: if file_name.endswith('json') or file_name.endswith('jsonl'): df = pandas.read_json(file_name, lines=True) elif file_name.endswith('csv'): df = pandas.read_csv(file_name) else: raise NotImplementedError ...
flexible
{ "blob_id": "23f491bbf26ede9052ecdab04b8c00cc78db5a7e", "index": 8831, "step-1": "<mask token>\n\n\ndef read_csv_json(file_name) ->pandas.DataFrame:\n if file_name.endswith('json') or file_name.endswith('jsonl'):\n df = pandas.read_json(file_name, lines=True)\n elif file_name.endswith('csv'):\n ...
[ 9, 13, 16, 18, 19 ]
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String, ForeignKey, Float from sqlalchemy.orm import relationship, backref ORMBase = declarative_base() def create_all(engine): ORMBase.metadata.create_all(engine)
normal
{ "blob_id": "c7ca8235864ce5de188c4aa2feb9ad82d4fa9b0f", "index": 4023, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef create_all(engine):\n ORMBase.metadata.create_all(engine)\n", "step-3": "<mask token>\nORMBase = declarative_base()\n\n\ndef create_all(engine):\n ORMBase.metadata.create_...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_rect(): rect = Rectangle([[0, 0], [10, 10]], confidence=0.8, labels=[{'name': 'test'}]) test = Rectangle([[0, 0], [5, 5]]) assert rect.area == 100 assert rect.intersection(test) == 25 assert ...
flexible
{ "blob_id": "b65d25198d55ab4a859b9718b7b225fa92c13a2b", "index": 1202, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_rect():\n rect = Rectangle([[0, 0], [10, 10]], confidence=0.8, labels=[{'name':\n 'test'}])\n test = Rectangle([[0, 0], [5, 5]])\n assert rect.area == 100\n ...
[ 0, 1, 2, 3, 4 ]
""" opsi-utils Test utilities """ import os import tempfile from contextlib import contextmanager from pathlib import Path from typing import Generator @contextmanager def temp_context() -> Generator[Path, None, None]: origin = Path().absolute() try: with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) ...
normal
{ "blob_id": "3c2a611fd001f145703853f5ecfe70d0e93844e4", "index": 4665, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@contextmanager\ndef temp_context() ->Generator[Path, None, None]:\n origin = Path().absolute()\n try:\n with tempfile.TemporaryDirectory(ignore_cleanup_errors=True\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def df_to_sql_T_1(filefullpath, sheet, row_name): excel_df = pd.read_excel(filefullpath, sheetname=sheet) excel_df = excel_df.dropna(how='all') excel_df = excel_df.dropna(axis=1, how='all') excel_df = excel_df.T excel_df.columns = excel_df.loc[row_name] excel_df = ...
flexible
{ "blob_id": "d261efa72e1ab77507a1fd84aa2e462c6969af56", "index": 6579, "step-1": "<mask token>\n\n\ndef df_to_sql_T_1(filefullpath, sheet, row_name):\n excel_df = pd.read_excel(filefullpath, sheetname=sheet)\n excel_df = excel_df.dropna(how='all')\n excel_df = excel_df.dropna(axis=1, how='all')\n exc...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='RBM', version='0.0.1', description= 'Restricted Boltzmann Machines', long_description='README', install_requires=['numpy', 'pandas']) <|reserved_special_token_1|> from distutils.core import setup setup(name=...
flexible
{ "blob_id": "fab7ee8a7336ba2c044adce4cc8483af78b775ba", "index": 1827, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='RBM', version='0.0.1', description=\n 'Restricted Boltzmann Machines', long_description='README',\n install_requires=['numpy', 'pandas'])\n", "step-3": "from distutils...
[ 0, 1, 2, 3 ]
#coding=utf-8 import unittest,time,os from time import sleep from appium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from HTMLTestRunner import HTMLTestRunner from appium.webdriver.common.touch_action import TouchAction from pub_Student import login,logout # Returns ...
normal
{ "blob_id": "8d7697a0e49dc9e966b9657171c66ccda57279d6", "index": 1930, "step-1": "<mask token>\n\n\nclass TestStudent(unittest.TestCase):\n\n def setUp(self):\n desired_caps = {}\n desired_caps['platformName'] = 'Android'\n desired_caps['platformVersion'] = '7.0'\n desired_caps['au...
[ 5, 6, 7, 8, 9 ]
from rest_framework import serializers, viewsets, routers from lamp_control.models import Lamp class LampSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Lamp fields = '__all__' class LampViewSet(viewsets.ModelViewSet): serializer_class = LampSerializer queryset ...
normal
{ "blob_id": "aff1d702e591efcfc0fc93150a3fbec532408137", "index": 55, "step-1": "<mask token>\n\n\nclass LampViewSet(viewsets.ModelViewSet):\n serializer_class = LampSerializer\n queryset = Lamp.objects.all()\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass LampSerializer(serializers.HyperlinkedMo...
[ 2, 3, 5, 6, 7 ]