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|> fresh_tomatoes.open_movies_page(movies) <|reserved_special_token_1|> <|reserved_special_token_0|> toy_story = media.Movie('Toy Story', 'A story of a boy and his toys that come to life', '<p><a href="https://en.wikipedia...
flexible
{ "blob_id": "e2f6e6e872f95471ebbc8b25bde08247fe8f7e61", "index": 8829, "step-1": "<mask token>\n", "step-2": "<mask token>\nfresh_tomatoes.open_movies_page(movies)\n", "step-3": "<mask token>\ntoy_story = media.Movie('Toy Story',\n 'A story of a boy and his toys that come to life',\n '<p><a href=\"http...
[ 0, 1, 2, 3, 4 ]
from __future__ import annotations import typing import requests import heapq from sklearn.metrics.pairwise import cosine_similarity from sklearn.feature_extraction.text import TfidfVectorizer from bs4 import BeautifulSoup from wikiAPI import get_JSON, get_intro, compare_titles from typing import List, Type, Callable ...
normal
{ "blob_id": "1fad591fde707c73bd52aa8518828c8b8be9cd32", "index": 2283, "step-1": "<mask token>\n\n\nclass Article:\n <mask token>\n title: str\n target: str\n g: float\n f: float\n parent: typing.Union[Article, Type(None)]\n heuristic: Callable[[str, str], float]\n\n def __init__(self, ti...
[ 12, 15, 17, 18, 23 ]
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
normal
{ "blob_id": "6339a1a06319a748030b3411c7a8d00f36336e65", "index": 9778, "step-1": "<mask token>\n\n\nclass RemovedResourceWarning(OpenStackDeprecationWarning):\n <mask token>\n\n\nclass RemovedFieldWarning(OpenStackDeprecationWarning):\n \"\"\"Indicates that a field has been removed in newer API versions an...
[ 11, 12, 13, 14, 15 ]
import unittest from validate_pw_complexity import * class Test_PW_Functions(unittest.TestCase): def test_pw_not_long_enough_min(self): sample_pass ="abcd" expected_result = False result = validate_pw_long(sample_pass) self.assertEqual(expected_result, result) def test_pw_ju...
normal
{ "blob_id": "dc7d75bf43f1ba55673a43f863dd08e99a1c0e0f", "index": 4820, "step-1": "<mask token>\n\n\nclass Test_PW_Functions(unittest.TestCase):\n <mask token>\n <mask token>\n\n def test_pw_long_enough_min(self):\n sample_pass = 'abcdadcaabc'\n expected_result = False\n result = val...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def adaptative_thresholding(img, threshold): I = img gray = cv2.cvtColor(I, cv2.COLOR_BGR2GRAY) orignrows, origncols = gray.shape M = int(np.floor(orignrows / 16) + 1) N = int(np.floor(origncols / 16) + 1) Mextend = round(M / 2) - 1 Nextend = round(N / 2) - 1 ...
flexible
{ "blob_id": "91d240b02b9d7a6c569656337521482d57918754", "index": 4333, "step-1": "<mask token>\n\n\ndef adaptative_thresholding(img, threshold):\n I = img\n gray = cv2.cvtColor(I, cv2.COLOR_BGR2GRAY)\n orignrows, origncols = gray.shape\n M = int(np.floor(orignrows / 16) + 1)\n N = int(np.floor(ori...
[ 6, 7, 8, 11, 13 ]
from flask import Flask, request from flask import render_template import sqlite3 import datetime app = Flask(__name__) @app.route('/') def index(date = ""): date = request.args.get('date') if not date: now = datetime.datetime.now() date = "%02d.%02d.%04d" % (now.day, now.month, now.year) ...
normal
{ "blob_id": "f6fe33e04ccdca1d9714caec412478d0cfc8b363", "index": 5559, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index(date=''):\n date = request.args.get('date')\n if not date:\n now = datetime.datetime.now()\n date = '%02d.%02d.%04d' % (now.day, now.month, now.year)\n conn = sqli...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Develop(Branch): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Develop(Branch): def process(self): if self.action is Actions.INIT: self.start...
flexible
{ "blob_id": "338bf2406c233d857e1a688391161d58e1dab23c", "index": 8910, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Develop(Branch):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Develop(Branch):\n\n def process(self):\n if self.action is Actions.INIT:\n self...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def input_db_name(conn): while True: db_name = input('Database name (default: concert_singer) > ') if not db_name: db_name = 'concert_singer' cur = conn.cursor() cur.execute('SELECT 1 FROM databases WHERE name = ?', (db_name,)) if cu...
flexible
{ "blob_id": "54ec1961f4835f575e7129bd0b2fcdeb97be2f03", "index": 93, "step-1": "<mask token>\n\n\ndef input_db_name(conn):\n while True:\n db_name = input('Database name (default: concert_singer) > ')\n if not db_name:\n db_name = 'concert_singer'\n cur = conn.cursor()\n ...
[ 6, 7, 8, 11, 12 ]
import os from datetime import datetime, timedelta from django.shortcuts import render from django.utils.decorators import method_decorator from rest_framework.viewsets import GenericViewSet, mixins from common.jwt_util import generate_jwt from .serializers import ApiUser, ApiUserSerializer, UserSerializer f...
normal
{ "blob_id": "0457ac2ecd0a951b0088c887539ab696797d68bc", "index": 4557, "step-1": "<mask token>\n\n\nclass UserLoginView(GenericAPIView):\n\n def _generate_tokens(self, user_id, with_refresh_token=True):\n \"\"\"\n 生成token 和refresh_token\n :param user_id: 用户id\n :return: token, refr...
[ 7, 8, 10, 11, 13 ]
''' Функція replace() може використовуватися для заміни будь-якого слова у рядку іншим словом. Прочитайте кожен рядок зі створеного у попередньому завданні файлу learning_python.txt і замініть слово Python назвою іншої мови, наприклад C при виведенні на екран. Це завдання написати в окремій функції. ''' def reader():...
normal
{ "blob_id": "6d80a89a47b68fd8d81739787897355671ca94e9", "index": 5815, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef reader():\n with open('possibilities.txt', 'r') as file1:\n file_lines = [x.strip() for x in file1.readlines()]\n for e in file_lines:\n n = e.replace(...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def multi(): scc = [6, 5, 4] sc = [6, 5] cc = [5, 4] crew = [4] captain = [5] ship = [6] n = 0 while n <= 2: inp = input('Hit enter to roll') if inp == '': roll5 = random.choices(range(1, 7), k=5) print(roll5) ...
flexible
{ "blob_id": "bb540ba4cd96e2485e77ba099f0a1a9ea03e1120", "index": 8144, "step-1": "<mask token>\n\n\ndef multi():\n scc = [6, 5, 4]\n sc = [6, 5]\n cc = [5, 4]\n crew = [4]\n captain = [5]\n ship = [6]\n n = 0\n while n <= 2:\n inp = input('Hit enter to roll')\n if inp == '':...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class cursos(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __str__(self): return self.nome class Meta: managed = False db_table = 'cursos' ve...
flexible
{ "blob_id": "20e5220ce23aaaedbfafe599b352f5d3a220e82e", "index": 6687, "step-1": "<mask token>\n\n\nclass cursos(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.nome\n\n\n class Meta:\n managed = False\n db_tab...
[ 11, 13, 14, 16, 17 ]
import sys V, E = map(int, sys.stdin.readline().split()) node = [] graphs = [] for i in range(V+1): node.append(i) for _ in range(E): graphs.append((list(map(int, sys.stdin.readline().split())))) graph = sorted(graphs, key=lambda x: x[2]) def get_parent(parent, x): if parent[x] == x: return x ...
normal
{ "blob_id": "2e794e281c6f34858cd32725cdc454eb18c28892", "index": 3415, "step-1": "<mask token>\n\n\ndef get_parent(parent, x):\n if parent[x] == x:\n return x\n parent[x] = get_parent(parent, parent[x])\n return parent[x]\n\n\ndef union_parent(parent, a, b):\n a = get_parent(parent, a)\n b ...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- import numpy as np import pandas as pd import pandas import numpy import json import torch.utils.data as data import os import torch def load_json(file): with open(file) as json_file: data = json.load(json_file) return data class VideoDataSet(data.Dataset): def __init_...
normal
{ "blob_id": "e5b5a0c8c0cbe4862243548b3661057240e9d8fd", "index": 6077, "step-1": "<mask token>\n\n\nclass VideoDataSet(data.Dataset):\n <mask token>\n\n def check_csv(self):\n for video in self.video_list:\n if not os.path.exists(self.feature_path + 'csv_mean_' + str(\n sel...
[ 17, 21, 28, 31, 32 ]
from typing import Optional,List from fastapi import FastAPI from pydantic import BaseModel, Field from redisqueue import RedisQueue,MyRedis import random class Award(BaseModel): name: str count: int class Item(BaseModel): luckname: str = Field(...,title="抽奖规则名称",max_lenght = 300) total: int = Field...
normal
{ "blob_id": "4550ed971eef36badf46a44adcc593324a5292cf", "index": 2637, "step-1": "<mask token>\n\n\nclass Award(BaseModel):\n name: str\n count: int\n\n\nclass Item(BaseModel):\n luckname: str = Field(..., title='抽奖规则名称', max_lenght=300)\n total: int = Field(..., title='抽奖总人数', gt=0)\n award: Opti...
[ 7, 8, 10, 11, 12 ]
import csv import sqlite3 import time from datetime import datetime, timedelta import pandas as pd import pytz import json import urllib import numpy as np DATABASE = '/var/www/html/citibikeapp/citibikeapp/citibike_change.db' def execute_query(cur,query, args=()): cur = cur.execute(query, args) rows = cur.fet...
normal
{ "blob_id": "9b8b196e1ad845ab745dabe5abe3be7bea0d5695", "index": 4835, "step-1": "<mask token>\n\n\ndef convertTime(et):\n \"\"\"'2017-06-01 11:41:53 AM' to '2017-06-01 11:41:53' \"\"\"\n hour = int(et[11:13])\n if et.find('PM') != -1 and hour != 12:\n dateString = et[:10]\n hour = hour + ...
[ 4, 7, 10, 12, 13 ]
<|reserved_special_token_0|> def _get_stats(candidate_pairs, truth_pairs): tp = len(candidate_pairs.intersection(truth_pairs)) prec = 1.0 * tp / len(candidate_pairs) rec = 1.0 * tp / len(truth_pairs) print(' returned: %d, tp=%.4f, prec=%.4f, rec=%.4f' % (len( candidate_pairs), tp, prec, rec))...
flexible
{ "blob_id": "18b73a06c80272aff5c0e4b10473e95bd58466f3", "index": 1197, "step-1": "<mask token>\n\n\ndef _get_stats(candidate_pairs, truth_pairs):\n tp = len(candidate_pairs.intersection(truth_pairs))\n prec = 1.0 * tp / len(candidate_pairs)\n rec = 1.0 * tp / len(truth_pairs)\n print(' returned: %d,...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app_user_one.get_user_info() app_user_one.change_status('in job market') app_user_one.get_user_info() <|reserved_special_token_0|> app_user_two.get_user_info() <|reserved_special_token_0|> new_post.get_post_info() <|reserved_spe...
flexible
{ "blob_id": "f59db28b669a41051cc6d0d4b8e14d1c7b0edd11", "index": 2555, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_user_one.get_user_info()\napp_user_one.change_status('in job market')\napp_user_one.get_user_info()\n<mask token>\napp_user_two.get_user_info()\n<mask token>\nnew_post.get_post_info()...
[ 0, 1, 2, 3, 4 ]
my_list = [9, 9, 9, 8, 8, 7, 7, 6, 6, 5, 4, 4, 4, 2, 2, 1] new_num = int(input('Enter a new number - ')) i = 0 for n in my_list: if new_num <= n: i += 1 my_list.insert(i, float(new_num)) print(my_list)
normal
{ "blob_id": "be16e13c0e03952e45f98b175975795bba19cf9a", "index": 2775, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor n in my_list:\n if new_num <= n:\n i += 1\nmy_list.insert(i, float(new_num))\nprint(my_list)\n", "step-3": "my_list = [9, 9, 9, 8, 8, 7, 7, 6, 6, 5, 4, 4, 4, 2, 2, 1]\nnew...
[ 0, 1, 2 ]
class Student(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def full_name(self): return '{} {}'.format(self._first_name, self._last_name) def detail_info(self): return 'Student Detail Info : {},{},{},{},{},{}'.format(self._id, ...
flexible
{ "blob_id": "f507fbe7c92134c0a7149aafe7de88debebd42f5", "index": 7760, "step-1": "class Student(object):\n <mask token>\n <mask token>\n <mask token>\n\n def full_name(self):\n return '{} {}'.format(self._first_name, self._last_name)\n\n def detail_info(self):\n return 'Student Detai...
[ 5, 7, 11, 13, 16 ]
import sys import os import utils def run(name, dim_k, dump='dump', add_cmd=''): res = all_res[name] model = 'ATT_ts' if res.split('_')[1] == 'att' else 'LastItem' cmd = f'python main.py -model={model} -ds=v3 -restore_model={res} -k={dim_k} -show_detail -{dump} -nb_topk=2000 -nb_rare_k=1000 -msg={name} {a...
normal
{ "blob_id": "548a236c4c485091d312593dcb0fa331ff98f1a8", "index": 6359, "step-1": "<mask token>\n\n\ndef run(name, dim_k, dump='dump', add_cmd=''):\n res = all_res[name]\n model = 'ATT_ts' if res.split('_')[1] == 'att' else 'LastItem'\n cmd = (\n f'python main.py -model={model} -ds=v3 -restore_mod...
[ 1, 3, 4, 5, 6 ]
""" get poly data(face center, face id, etc), select face, create object by face data setPosition for vertex (random) import sys module_path = '/home/shrimo/Desktop/course/git/vfx_dev/maya/general_lesson' if module_path not in sys.path: sys.path.append(module_path) import lesson_v01 reload(lesson_v01) lesson...
normal
{ "blob_id": "723d8819b5341f1397163533f59c17ba1a74b77d", "index": 1310, "step-1": "\"\"\"\nget poly data(face center, face id, etc), select face, create object by face data\nsetPosition for vertex (random)\n\nimport sys\nmodule_path = '/home/shrimo/Desktop/course/git/vfx_dev/maya/general_lesson'\nif module_path n...
[ 0 ]
<|reserved_special_token_0|> class TestPortfolioIdDelResponsePortfolioItemProductMedia(unittest.TestCase): <|reserved_special_token_0|> def setUp(self): pass def tearDown(self): pass def testPortfolioIdDelResponsePortfolioItemProductMedia(self): """Test PortfolioIdDelRespons...
flexible
{ "blob_id": "ae88418ccfdaa4b357a2491f6450dbcda55b1c21", "index": 2013, "step-1": "<mask token>\n\n\nclass TestPortfolioIdDelResponsePortfolioItemProductMedia(unittest.TestCase):\n <mask token>\n\n def setUp(self):\n pass\n\n def tearDown(self):\n pass\n\n def testPortfolioIdDelResponseP...
[ 4, 5, 6, 7, 8 ]
# -*- coding: utf-8 -*- from selenium.webdriver.common.keys import Keys from titan.components import Base class Input(Base): def clear(self): element = self.driver.find_element_by_xpath(self.params['xpath']) if self.params.get('clear', None): element.clear() return True ...
normal
{ "blob_id": "7503a0c8f83ff0ce370ed7bce733b09d9a2c69c4", "index": 817, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Input(Base):\n\n def clear(self):\n element = self.driver.find_element_by_xpath(self.params['xpath'])\n if self.params.get('clear', None):\n element.c...
[ 0, 2, 3, 4, 5 ]
#!/usr/bin/python from random import * prob = "change" cases = [ 10, 10, 10, 100, 100, 100000, 100000, 100000, 100000, 100000 ] cur = 0 st = [1,2,5,10,20,50,100,200,500,1000,2000,5000,10000] for (n) in cases : cout = "" ...
normal
{ "blob_id": "2cef5311a9ff9497ad6611fe7b47e4f7c5b1b3c7", "index": 7581, "step-1": "#!/usr/bin/python\n\nfrom random import *\n\nprob = \"change\"\n\ncases = [ \n 10,\n 10,\n 10,\n 100,\n 100,\n 100000,\n 100000,\n 100000,\n 100000,\n 100000\n...
[ 0 ]
one=[7.236287049225701e-06, -1.445911565527231e-12, -1.7498772740084537e-13, 5.109944355076077e-11, -2.5430545472048434e-10, -1.1709514644876058e-15, 3.210132219509301e-16, 2.502027767038304e-05, -1.975229899156637e-06, -1.4769695480936238e-08, 8.945619840357268e-10, 135323228000.64511, 130464457208.5385] two=[6.101651...
normal
{ "blob_id": "bdf3cb1830021b10d6c8966b3341fd9297d9a371", "index": 2045, "step-1": "<mask token>\n", "step-2": "<mask token>\n[1.5780628845471506e-10, -1.411490597458207e-12, -2.483949940281473e-13, \n 5.026488748046414e-11, -1.6612576871621329e-10, -1.6989844545344268e-15,\n 8.109443782655016e-16, 2.40404...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def processJson(dic): dicobj = json.loads(dic) print(dicobj) for k, v in dicobj.items(): dict_tmp = {} dict_tmp['file_name'] = k dict_tmp['urls'] = v print(k) print(v) result.append(dict_tmp) return result def procesV(): ...
flexible
{ "blob_id": "e9af8f7830be7db3ca57b0a24de48ef7fcb08d6c", "index": 8453, "step-1": "<mask token>\n\n\ndef processJson(dic):\n dicobj = json.loads(dic)\n print(dicobj)\n for k, v in dicobj.items():\n dict_tmp = {}\n dict_tmp['file_name'] = k\n dict_tmp['urls'] = v\n print(k)\n ...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def raizCubica(numero): r = pow(numero, 1 / 3) return r <|reserved_special_token_0|> <|reserved_special_token_1|> def raizCubica(numero): r = pow(numero, 1 / 3) return r <|reserved_special_token_0|> for x in range(5): numeros.insert...
flexible
{ "blob_id": "180f7f0ade9770c6669680bd13ac8f2fd55cc8c7", "index": 357, "step-1": "<mask token>\n", "step-2": "def raizCubica(numero):\n r = pow(numero, 1 / 3)\n return r\n\n\n<mask token>\n", "step-3": "def raizCubica(numero):\n r = pow(numero, 1 / 3)\n return r\n\n\n<mask token>\nfor x in range(5...
[ 0, 1, 2, 3, 4 ]
from adventurelib import * from horror import * from dating import * from popquiz import * from comedy import * from island import * start()
normal
{ "blob_id": "8a37299154aded37147e1650cbf52a5cdf7d91da", "index": 4225, "step-1": "<mask token>\n", "step-2": "<mask token>\nstart()\n", "step-3": "from adventurelib import *\nfrom horror import *\nfrom dating import *\nfrom popquiz import *\nfrom comedy import *\nfrom island import *\nstart()\n", "step-4":...
[ 0, 1, 2 ]
from tasks import video_compress, video_upload if __name__ == '__main__': video_compress.apply_async(["a"],queue='high') video_compress.apply_async(["b"],queue='low') video_upload.apply_async(["c"], queue='low') video_upload.apply_async(["d"], queue='high')
normal
{ "blob_id": "2cd7d4fe87de66e85bc0d060e2eaa68be39eed02", "index": 9461, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n video_compress.apply_async(['a'], queue='high')\n video_compress.apply_async(['b'], queue='low')\n video_upload.apply_async(['c'], queue='low')\n ...
[ 0, 1, 2, 3 ]
from django import forms class UploadForm(forms.Form): file = forms.FileField(label="Json с данными об отправлении")
normal
{ "blob_id": "0878bfa1151371ff3aaa59f8be5ea9af74ada331", "index": 4978, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass UploadForm(forms.Form):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass UploadForm(forms.Form):\n file = forms.FileField(label='Json с данными об отправлении')\n",...
[ 0, 1, 2, 3, 4 ]
import spacy nlp = spacy.load("en_core_web_sm") text = ( "Chick-fil-A is an American fast food restaurant chain headquartered in " "the city of College Park, Georgia, specializing in chicken sandwiches." ) # Disable the tagger and parser with ____.____(____): # Process the text doc = ____ # Print ...
normal
{ "blob_id": "6eecf0ff1ad762089db6e9498e906e68b507370c", "index": 1875, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith ____.____(____):\n doc = ____\n print(____)\n", "step-3": "<mask token>\nnlp = spacy.load('en_core_web_sm')\ntext = (\n 'Chick-fil-A is an American fast food restaurant ch...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """Transcoder with TOSHIBA RECAIUS API.""" import threading import queue import time import numpy as np from logzero import logger import requests import model.key AUTH_URL = 'https://api.recaius.jp/auth/v2/tokens' VOICE_URL = 'https://api.recaius.jp/asr/v2/voices' class Transcoder: """...
normal
{ "blob_id": "421b0c1871350ff541b4e56d1e18d77016884552", "index": 5199, "step-1": "<mask token>\n\n\nclass Transcoder:\n <mask token>\n\n def __init__(self):\n \"\"\"Constructor.\"\"\"\n logger.info('__init__:Enter')\n self._token = None\n self.transcript = None\n self._qu...
[ 9, 10, 12, 14, 16 ]
from zope import schema from zope import interface from zope import component from raptus.mailcone.rules_regex import _ from raptus.mailcone.rules import interfaces class IRegexItem(interfaces.IConditionItem): """ Interface for regex match filter """ regex = schema.TextLine(title=_('Regex'), required=True...
normal
{ "blob_id": "fe83b45bdc5970d63deab66b26b16752cd8ad8ef", "index": 7241, "step-1": "<mask token>\n\n\nclass IRegexItem(interfaces.IConditionItem):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass IRegexItem(interfaces.IConditionItem):\n <mask token>\n regex = sch...
[ 1, 2, 3, 4 ]
""" ___________________________________________________ | _____ _____ _ _ _ | | | __ \ | __ (_) | | | | | | |__) |__ _ __ __ _ _ _| |__) || | ___ | |_ | | | ___/ _ \ '_ \ / _` | | | | ___/ | |/ _ \| __| | | | | | __/ | | | (_| | |_| | | | | |...
normal
{ "blob_id": "81f49c55edff7678e9d1745e39a8370e2c31c9ea", "index": 8850, "step-1": "\"\"\"\n ___________________________________________________\n | _____ _____ _ _ _ |\n | | __ \\ | __ (_) | | | |\n | | |__) |__ _ __ __ _ _ _| |__) || | ___ | |_ |\...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def from_json_string(my_str): """Function returns a JSON file representation of an object (string)""" return json.loads(my_str) <|reserved_special_token_1|> import json def from_json_string(my_str): """Function ...
flexible
{ "blob_id": "b748c489b2c63546feada811aa3b66146ad8d28e", "index": 9450, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef from_json_string(my_str):\n \"\"\"Function returns a JSON file representation of an object (string)\"\"\"\n return json.loads(my_str)\n", "step-3": "import json\n\n\ndef f...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class RestaurantViewSet(ModelViewSet): serializer_class = RestaurantSerializer permission_classes = [permissions.IsAuthenticatedOrReadOnly] queryset = Restaurant.objects.all() def _get_recommended_restaurants(self) ->queryset: queryset = self.get_queryset() ...
flexible
{ "blob_id": "9e8b5cebd48b3b98e421c896d9835ada5ec4166e", "index": 2740, "step-1": "<mask token>\n\n\nclass RestaurantViewSet(ModelViewSet):\n serializer_class = RestaurantSerializer\n permission_classes = [permissions.IsAuthenticatedOrReadOnly]\n queryset = Restaurant.objects.all()\n\n def _get_recomm...
[ 34, 40, 41, 42, 56 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> planet_list.append('Jupiter') planet_list.append('Saturn') planet_list.extend(['Uranus', 'Neptune']) planet_list.insert(1, 'Earth') planet_list.insert(1, 'Venus') planet_list.append('Pluto') del planet_list[-1] print(planet_list) ...
flexible
{ "blob_id": "1280ab66b817011e22e560a78104bbc4340989e7", "index": 8495, "step-1": "<mask token>\n", "step-2": "<mask token>\nplanet_list.append('Jupiter')\nplanet_list.append('Saturn')\nplanet_list.extend(['Uranus', 'Neptune'])\nplanet_list.insert(1, 'Earth')\nplanet_list.insert(1, 'Venus')\nplanet_list.append(...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .dataset_readers import * from .models import *
flexible
{ "blob_id": "bc8bf06f1adedeb7b364308591bff09ac42d6c29", "index": 3702, "step-1": "<mask token>\n", "step-2": "from .dataset_readers import *\nfrom .models import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
import os import glob ONE_KB = 1024 def get_files(dirname, size_in_kb): """Return files in dirname that are >= size_in_kb""" return ( filename for _, _, files in os.walk(dirname) for filename in files if int(filename) >= size_in_kb * ONE_KB ) # Pybites solution def get_f...
normal
{ "blob_id": "0dec0f04cfe891eea74ef45484fa7433e3429dcd", "index": 7570, "step-1": "<mask token>\n\n\ndef get_files1(dirname, size_in_kb):\n \"\"\"Return files in dirname that are >= size_in_kb\"\"\"\n for file in glob.glob(os.path.join(dirname, '*')):\n if os.stat(file).st_size >= size_in_kb * ONE_KB...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class CommitAnalyzer: <|reserved_special_token_0|> def __init__(self, repo_path): self.repo_path = repo_path self.repo = Repo(self.repo_path) assert not self.repo.bare <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_tok...
flexible
{ "blob_id": "8479c70fed36dc6f1e6094c832fb22d8c2e53e3a", "index": 920, "step-1": "<mask token>\n\n\nclass CommitAnalyzer:\n <mask token>\n\n def __init__(self, repo_path):\n self.repo_path = repo_path\n self.repo = Repo(self.repo_path)\n assert not self.repo.bare\n <mask token>\n\n\n...
[ 2, 5, 6, 7, 8 ]
#Exercise 2 - Write a Python class which has two methods get_String and print_String. get_String accept a string #from the user and print_String print the string in upper case #string will be an input to a get_string method and whatever you put in will print when you make the print screen method class IOString(): ...
normal
{ "blob_id": "cf2973b94f1113013fe9baa946202ec75488f7d2", "index": 9697, "step-1": "class IOString:\n <mask token>\n\n def get_String(self):\n self.str1 = input()\n <mask token>\n\n\n<mask token>\n", "step-2": "class IOString:\n <mask token>\n\n def get_String(self):\n self.str1 = in...
[ 2, 3, 4, 5, 7 ]
<|reserved_special_token_0|> class InterpreterTest: <|reserved_special_token_0|> def tearDown(self): self.interpreter.unload_all() <|reserved_special_token_0|> def test_select_2(self): sql = """select e.id, last_name, department_id, departments.id, name from e...
flexible
{ "blob_id": "b3ee76bc0d93135d0908044a2424dd927a390007", "index": 6357, "step-1": "<mask token>\n\n\nclass InterpreterTest:\n <mask token>\n\n def tearDown(self):\n self.interpreter.unload_all()\n <mask token>\n\n def test_select_2(self):\n sql = \"\"\"select\n e.id, last_name...
[ 4, 5, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for x in range(11, m): S = S + x print('sum =', S) <|reserved_special_token_1|> m = int(input('请输入一个数:')) S = m for x in range(11, m): S = S + x print('sum =', S) <|reserved_special_token_1|> #求11+12+13+。。。+m m = int...
flexible
{ "blob_id": "49ffa225d433ef2263159ba2145da5ba2a95d1f2", "index": 4664, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor x in range(11, m):\n S = S + x\nprint('sum =', S)\n", "step-3": "m = int(input('请输入一个数:'))\nS = m\nfor x in range(11, m):\n S = S + x\nprint('sum =', S)\n", "step-4": "#求11+...
[ 0, 1, 2, 3 ]
import os os.environ['CITY_CONF'] = '/opt/ris-web/city/duisburg.py' from webapp import app app.run(debug=True, host='0.0.0.0')
normal
{ "blob_id": "4276fd61ad48b325961cd45be68eea6eab51f916", "index": 6085, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.run(debug=True, host='0.0.0.0')\n", "step-3": "<mask token>\nos.environ['CITY_CONF'] = '/opt/ris-web/city/duisburg.py'\n<mask token>\napp.run(debug=True, host='0.0.0.0')\n", "step...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ComplexCustom(complex): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ComplexCustom(complex): <|reserved_special_token_0|> d...
flexible
{ "blob_id": "c62647b0b226d97926d1f53975a7aac7c39949d8", "index": 7959, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ComplexCustom(complex):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ComplexCustom(complex):\n <mask token>\n\n def __format__(self, fmt):\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): parser = argparse.ArgumentParser(description= 'Create the symbol specifying the location of test fixtures.') parser.add_argument('--fixtures_location_file', type=str, required=True) parser.add_arg...
flexible
{ "blob_id": "d5c6582547df540ffc9c73d10a3405ec97487bba", "index": 4513, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n parser = argparse.ArgumentParser(description=\n 'Create the symbol specifying the location of test fixtures.')\n parser.add_argument('--fixtures_location_fi...
[ 0, 1, 2, 3, 4 ]
from mtots.parser import base from mtots.parser import combinator from mtots.parser.combinator import All from mtots.parser.combinator import Any from mtots.parser.combinator import AnyTokenBut from mtots.parser.combinator import Forward from mtots.parser.combinator import Peek from mtots.parser.combinator import Requi...
normal
{ "blob_id": "f9edbef46494cc2993c6a633fe35406524dbbf67", "index": 1199, "step-1": "<mask token>\n", "step-2": "from mtots.parser import base\nfrom mtots.parser import combinator\nfrom mtots.parser.combinator import All\nfrom mtots.parser.combinator import Any\nfrom mtots.parser.combinator import AnyTokenBut\nfr...
[ 0, 1 ]
class Virus: def __init__(self, _name, _age, _malignancy): self.name = _name self.age = _age self.malignancy = _malignancy def set_name(self, _name): self.name = _name def set_age(self, _age): self.age = _age <|reserved_special_token_0|> def update(self): ...
flexible
{ "blob_id": "49c3c3b8c4b097f520456736e31ac306a9f73ac7", "index": 3544, "step-1": "class Virus:\n\n def __init__(self, _name, _age, _malignancy):\n self.name = _name\n self.age = _age\n self.malignancy = _malignancy\n\n def set_name(self, _name):\n self.name = _name\n\n def se...
[ 5, 6, 7, 8, 9 ]
def part_1() ->int: start = 382345 end = 843167 total = 0 for number in range(start, end + 1): if check_number(str(number)): total += 1 return total <|reserved_special_token_0|> def check_number_2(problem_input: str) ->bool: previous = 0 current = 1 triple = True ...
flexible
{ "blob_id": "c46495eebbe796253f56b7472d5548b41c5d0bc4", "index": 2411, "step-1": "def part_1() ->int:\n start = 382345\n end = 843167\n total = 0\n for number in range(start, end + 1):\n if check_number(str(number)):\n total += 1\n return total\n\n\n<mask token>\n\n\ndef check_nu...
[ 3, 4, 5, 6, 7 ]
input_object = open("input.txt", "r") input_data = input_object.readlines() input_object.close() cleaned_data = [] for line in input_data: cleaned_data.append(int(line.strip())) input_size = len(cleaned_data) for i in range(0, input_size): for j in range(i, input_size): for k in range(j, input_size):...
normal
{ "blob_id": "72f3ae476581ff5acd6c7101764f4764285a47bd", "index": 4426, "step-1": "<mask token>\n", "step-2": "<mask token>\ninput_object.close()\n<mask token>\nfor line in input_data:\n cleaned_data.append(int(line.strip()))\n<mask token>\nfor i in range(0, input_size):\n for j in range(i, input_size):\n...
[ 0, 1, 2, 3 ]
''' Seperate a number into several, maximize their product ''' # recursive def solution1(n): if n <= 4: return n else: return max(map(lambda x: solution1(x)*solution1(n-x), range(1, n//2 + 1))) # dp def solution2(n): result_list = [1,2] for i in range(3, n+1): max_mult = max(l...
normal
{ "blob_id": "76db5955b29696ca03ab22ef14ac018e0618e9e3", "index": 2729, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solution2(n):\n result_list = [1, 2]\n for i in range(3, n + 1):\n max_mult = max(list(map(lambda x: result_list[x] * (i - x - 1),\n range(i - 1))))\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "11d96a8a400afb0861b92d8900e003826614c99a", "index": 7502, "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 = [('myems', '00...
[ 0, 1, 2, 3, 4 ]
import grpc import time import json import sys import uuid from arch.api.proto import inference_service_pb2 from arch.api.proto import inference_service_pb2_grpc import threading def run(address): ths = [] with grpc.insecure_channel(address) as channel: for i in range(1): th = threading.T...
normal
{ "blob_id": "5430e1861a6244c25c00699323efa0921a5af940", "index": 3709, "step-1": "<mask token>\n\n\ndef run(address):\n ths = []\n with grpc.insecure_channel(address) as channel:\n for i in range(1):\n th = threading.Thread(target=send, args=(channel,))\n ths.append(th)\n ...
[ 2, 3, 4, 5, 6 ]
import hashlib from django.conf import settings from django.core import mail from django.core.mail import EmailMultiAlternatives from django.template.loader import render_to_string from django.utils.crypto import get_random_string def hexdigest_sha256(*args): r = hashlib.sha256() for arg in args: r....
normal
{ "blob_id": "a35004e2b306ba1a8649ce66a1612f63a2b6bf39", "index": 2673, "step-1": "<mask token>\n\n\ndef hexdigest_sha256(*args):\n r = hashlib.sha256()\n for arg in args:\n r.update(str(arg).encode('utf-8'))\n return r.hexdigest()\n\n\n<mask token>\n\n\ndef notify_by_email(template, data, subject...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def main(): print('Loading model...') model, charset = load_model(MODEL_NAME) print(charset) seed_text = input('Enter a String: ').strip() print() generate_script(seed_text, model, charset) def generate_script(seed_text, model, charset): sys.stdout.write(seed...
flexible
{ "blob_id": "ed7b29a4d7f3a48884434373418c3528f2f397ac", "index": 271, "step-1": "<mask token>\n\n\ndef main():\n print('Loading model...')\n model, charset = load_model(MODEL_NAME)\n print(charset)\n seed_text = input('Enter a String: ').strip()\n print()\n generate_script(seed_text, model, cha...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class Zouts: <|reserved_special_token_0|> def search(self, StN, ZN, Motion): for elem in self.elements: print('elem:') print(str(type(elem.StN)) + str(type(StN))) print(elem.StN + '->' + StN + ':' + str(elem.StN == StN)) pri...
flexible
{ "blob_id": "71ebc6e9218085e887eda7843b5489837ed45c97", "index": 880, "step-1": "<mask token>\n\n\nclass Zouts:\n <mask token>\n\n def search(self, StN, ZN, Motion):\n for elem in self.elements:\n print('elem:')\n print(str(type(elem.StN)) + str(type(StN)))\n print(e...
[ 3, 6, 7, 10, 11 ]
class Rect(): def __init__(self, w, h): self.w = w self.h = h def half(self): return self.w / 2; bricks = [Rect(40, 25), Rect(30, 25), Rect(28, 25), Rect(13, 25)] def setup(): size(500, 500) noLoop() def draw(): posx = 0 posy = 0 i = 0 for...
normal
{ "blob_id": "807f0094a9736abdfa3f5b629615a80f1e0d13ef", "index": 3037, "step-1": "class Rect:\n\n def __init__(self, w, h):\n self.w = w\n self.h = h\n\n def half(self):\n return self.w / 2\n\n\n<mask token>\n\n\ndef setup():\n size(500, 500)\n noLoop()\n\n\n<mask token>\n", "s...
[ 4, 5, 6, 7, 8 ]
def odds(): n = 1 while True: yield n n += 2 <|reserved_special_token_0|> <|reserved_special_token_1|> def odds(): n = 1 while True: yield n n += 2 def pi_series(): odd_nums = odds() approximation = 0 while True: approximation += 4 / next(odd_nu...
flexible
{ "blob_id": "26ef7de89e2e38c419310cc66a33d5dc0575fc0d", "index": 5012, "step-1": "def odds():\n n = 1\n while True:\n yield n\n n += 2\n\n\n<mask token>\n", "step-2": "def odds():\n n = 1\n while True:\n yield n\n n += 2\n\n\ndef pi_series():\n odd_nums = odds()\n ...
[ 1, 2, 3, 4, 5 ]
from django.shortcuts import render, get_object_or_404 from django.utils import timezone from django.db.models import Count from django.db.models import QuerySet from django.db import connection from django.core.paginator import Paginator, PageNotAnInteger from django.http import HttpResponse from django.http import H...
normal
{ "blob_id": "bcc959dcdb60c55897158e85d73c59592b112c12", "index": 6381, "step-1": "<mask token>\n\n\nclass FastCountQuerySet:\n\n def __init__(self, queryset, tablename):\n self.queryset = queryset\n self.tablename = tablename\n\n def count(self):\n cursor = connection.cursor()\n ...
[ 25, 26, 28, 29, 35 ]
<|reserved_special_token_0|> class GregerUpdateAgent(Thread): <|reserved_special_token_0|> <|reserved_special_token_0|> @property def localRevisionRecord(self): """ Get local revision record (.gcm) """ localLog = logging.getLogger(self.logPath + '.localRevisionRecord')...
flexible
{ "blob_id": "a9b2a4d4924dcdd6e146ea346e71bf42c0259846", "index": 593, "step-1": "<mask token>\n\n\nclass GregerUpdateAgent(Thread):\n <mask token>\n <mask token>\n\n @property\n def localRevisionRecord(self):\n \"\"\"\n Get local revision record (.gcm)\n \"\"\"\n localLog ...
[ 5, 6, 7, 8, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> wn.title('MaskUp') wn.bgcolor('green') wn.bgpic('retro_city_title_page.gif') wn.setup(width=800, height=600) wn.tracer(0) wn.register_shape('human.gif') def game_loop(): score = 0 lives = 3 wn.register_shape('human.g...
flexible
{ "blob_id": "1593280a29b13461b13d8b2805d9ac53ce94c759", "index": 2948, "step-1": "<mask token>\n", "step-2": "<mask token>\nwn.title('MaskUp')\nwn.bgcolor('green')\nwn.bgpic('retro_city_title_page.gif')\nwn.setup(width=800, height=600)\nwn.tracer(0)\nwn.register_shape('human.gif')\n\n\ndef game_loop():\n sc...
[ 0, 2, 3, 4, 5 ]
import numpy as np import pickle as p from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt from numpy.random import randn from neural_network import network net = network([1,8,8,1], filename='./data/x', bias=True) # net.load_random() net.load() n = 32 x = np.array([[x] for x in np.linspace(0,1,n)]...
normal
{ "blob_id": "cf07344808f2d91d8949cfc4beb9f923926e6851", "index": 6208, "step-1": "<mask token>\n", "step-2": "<mask token>\nnet.load()\n<mask token>\nplt.plot(x, y)\n<mask token>\nfor ii in range(1001):\n c = net.retarded_training(x, y)\n print(ii, c)\n net.save()\n<mask token>\nplt.plot(X, Y, 'ro')\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def pytest_addoption(parser): print('Option ') parser.addoption('--destination', action='store', help= 'subsystem address', dest='destination') @pytest.fixture def destination(request): print(request.config.getoption('--html')) return request.config.getoption('--...
flexible
{ "blob_id": "ad88685e3f1cd5e0ddb42a5982a05ff8ee7b8111", "index": 1586, "step-1": "<mask token>\n\n\ndef pytest_addoption(parser):\n print('Option ')\n parser.addoption('--destination', action='store', help=\n 'subsystem address', dest='destination')\n\n\n@pytest.fixture\ndef destination(request):\n ...
[ 2, 5, 6, 7, 9 ]
<|reserved_special_token_0|> @pytest.fixture def contracts_relative_path(): return 'data/contracts.json' @pytest.fixture def compiled_contracts_path(test_dir, contracts_relative_path): return os.path.join(test_dir, contracts_relative_path) @pytest.fixture def compiled_contracts(compiled_contracts_path): ...
flexible
{ "blob_id": "438fe1ccf265706e202d7cc6044e57590f29801f", "index": 9375, "step-1": "<mask token>\n\n\n@pytest.fixture\ndef contracts_relative_path():\n return 'data/contracts.json'\n\n\n@pytest.fixture\ndef compiled_contracts_path(test_dir, contracts_relative_path):\n return os.path.join(test_dir, contracts_...
[ 10, 11, 17, 18, 21 ]
<|reserved_special_token_0|> def getIdInfo(token): try: idinfo = client.verify_id_token(token, CLIENT_ID) if idinfo['aud'] not in [CLIENT_ID]: return None if idinfo['iss'] not in ['accounts.google.com', 'https://accounts.google.com']: return None exc...
flexible
{ "blob_id": "2251a6064998f25cca41b018a383053d73bd09eb", "index": 2321, "step-1": "<mask token>\n\n\ndef getIdInfo(token):\n try:\n idinfo = client.verify_id_token(token, CLIENT_ID)\n if idinfo['aud'] not in [CLIENT_ID]:\n return None\n if idinfo['iss'] not in ['accounts.google....
[ 1, 2, 3, 4, 5 ]
# Autor : Kevin Oswaldo Palacios Jimenez # Fecha de creacion: 16/09/19 # Se genera un bucle con for # al no tener argumento print no genera ningun cambio # mas que continuar a la siguiente linea for i in range (1,11): encabezado="Tabla del {}" print(encabezado.format(i)) print() # ...
normal
{ "blob_id": "86f365612e9f15e7658160ecab1d3d9970ca364e", "index": 9699, "step-1": "<mask token>\n", "step-2": "for i in range(1, 11):\n encabezado = 'Tabla del {}'\n print(encabezado.format(i))\n print()\n for j in range(1, 11):\n salida = '{} x {} = {}'\n print(salida.format(i, j, i *...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def get_common(h, n): pi = get_partial_matched(n) begin = 0 matched = 0 while begin + matched < len(h): if matched < len(n) and h[begin + matched] == n[matched]: matched += 1 if matched == len(n): return len(n) - begin ...
flexible
{ "blob_id": "16a77c45a58e31c575511146dfceeaef0a2bc3a7", "index": 3640, "step-1": "<mask token>\n\n\ndef get_common(h, n):\n pi = get_partial_matched(n)\n begin = 0\n matched = 0\n while begin + matched < len(h):\n if matched < len(n) and h[begin + matched] == n[matched]:\n matched +...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class ConcertDetail(RetrieveUpdateDestroyAPIView): permission_classes = IsOwnerOrReadOnly, queryset = Concert.objects.all() serializer_class = ConcertSerializer <|reserved_special_token_1|> <|reserved_special_token_0|> class ConcertList(ListCreateAPIView): <|reserved_...
flexible
{ "blob_id": "74ad2ec2cd7cd683a773b0affde4ab0b150d74c5", "index": 4780, "step-1": "<mask token>\n\n\nclass ConcertDetail(RetrieveUpdateDestroyAPIView):\n permission_classes = IsOwnerOrReadOnly,\n queryset = Concert.objects.all()\n serializer_class = ConcertSerializer\n", "step-2": "<mask token>\n\n\ncl...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def add2nums(a, b): return a + b <|reserved_special_token_1|> # function to add two numbers def add2nums(a,b): return a+b
flexible
{ "blob_id": "6e2fb9d498294a580426ff408183f7beec135329", "index": 5592, "step-1": "<mask token>\n", "step-2": "def add2nums(a, b):\n return a + b\n", "step-3": "# function to add two numbers\ndef add2nums(a,b):\n return a+b\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] ...
[ 0, 1, 2 ]
import pygame from config import * from Map import * from NeuralNetwork import * class Pacman(object): RADIUS = int(TILE_WIDTH/2) def __init__(self, mapa, neural_net): self.mapa = mapa self.pos_x = 11 self.pos_y = 17 self.vel_x = 1 self.vel_y = 0 self.isAlive ...
normal
{ "blob_id": "d3b5d87b56421940449fdef48be6da9fa650dd90", "index": 1756, "step-1": "<mask token>\n\n\nclass Pacman(object):\n <mask token>\n\n def __init__(self, mapa, neural_net):\n self.mapa = mapa\n self.pos_x = 11\n self.pos_y = 17\n self.vel_x = 1\n self.vel_y = 0\n ...
[ 7, 8, 10, 11, 12 ]
<|reserved_special_token_0|> class StationTestCase(unittest.TestCase): def test_identifier(self): print('\n---------------- %s' % self) str1 = 'gsp-s001@x77uVYBT1G48CLzW9iwe2dr5jhUNEM772G' id1 = ID(str1) self.assertEqual(id1.address.network, NetworkID.Station) arr1 = [str1...
flexible
{ "blob_id": "533d0b883a0bbbb148f04826e4c0a2bcc31732e9", "index": 6702, "step-1": "<mask token>\n\n\nclass StationTestCase(unittest.TestCase):\n\n def test_identifier(self):\n print('\\n---------------- %s' % self)\n str1 = 'gsp-s001@x77uVYBT1G48CLzW9iwe2dr5jhUNEM772G'\n id1 = ID(str1)\n ...
[ 3, 4, 5, 6, 7 ]
print("Praktikum Programa Komputer ") print("Exercise 7.21") print("") print("===========================") print("Nama : Ivanindra Rizky P") print("NIM : I0320054") print("") print("===========================") print("") import random a = [23, 45, 98, 36] print('a = ', a) print('random 1') print('choice ...
normal
{ "blob_id": "6b731e329eec3947a17ef8ee8280f2ddf980c81c", "index": 7154, "step-1": "<mask token>\n", "step-2": "print('Praktikum Programa Komputer ')\nprint('Exercise 7.21')\nprint('')\nprint('===========================')\nprint('Nama : Ivanindra Rizky P')\nprint('NIM : I0320054')\nprint('')\nprint('===========...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ColumnKeyVerifier: <|reserved_special_token_0|> <|reserved_special_token_0|> def epilogue(self): pass <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ColumnKeyVerifier: def __init__(self): self.k...
flexible
{ "blob_id": "eca4abf706fd094a40fdfc8ea483d71b0a018ce9", "index": 4378, "step-1": "<mask token>\n\n\nclass ColumnKeyVerifier:\n <mask token>\n <mask token>\n\n def epilogue(self):\n pass\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ColumnKeyVerifier:\n\n def __init__(self):\n ...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class TestFileReader(unittest.TestCase): def test_reads_file(self): reader = FileReader('sample_reader_test.txt', regexes=[( 'name="(\\w+)"', 'END SEGMENT'), ('\\s*\\*\\s*START\\s*(\\w+)', 'END SEGMENT'), ('PYTHON\\s+SEGMENT\\s+(\\w[\\w\\d_]*)', None)]...
flexible
{ "blob_id": "92dc0bd3cfcddd98f99d8152d0221f047beb4fb0", "index": 9492, "step-1": "<mask token>\n\n\nclass TestFileReader(unittest.TestCase):\n\n def test_reads_file(self):\n reader = FileReader('sample_reader_test.txt', regexes=[(\n 'name=\"(\\\\w+)\"', 'END SEGMENT'), ('\\\\s*\\\\*\\\\s*STA...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> import pytest <|reserved_special_token_1|> """ ====================== @author:小谢学测试 @time:2021/9/8:8:34 @email:xie7791@qq.com ====================== """ import pytest # @pytest.fixture() # def login(): # print("登录方法") # de...
flexible
{ "blob_id": "b52429f936013ac60659950492b67078fabf3a13", "index": 4042, "step-1": "<mask token>\n", "step-2": "<mask token>\nimport pytest\n", "step-3": "\"\"\"\n======================\n@author:小谢学测试\n@time:2021/9/8:8:34\n@email:xie7791@qq.com\n======================\n\"\"\"\nimport pytest\n# @pytest.fixture(...
[ 0, 1, 2 ]
""" @file @brief One class which visits a syntax tree. """ import inspect import ast from textwrap import dedent import numpy from scipy.spatial.distance import squareform, pdist from .node_visitor_translator import CodeNodeVisitor def py_make_float_array(cst, op_version=None): """ Creates an array with a sin...
normal
{ "blob_id": "fdf6c28e65b50c52550a95c2d991b1eb3ec53a2f", "index": 3540, "step-1": "<mask token>\n\n\ndef py_make_float_array(cst, op_version=None):\n \"\"\"\n Creates an array with a single element\n from a constant.\n\n @param cst constant\n @param op_version unused\n @return...
[ 5, 6, 7, 9, 10 ]
from random import shuffle, choice from typing import Dict, List, Tuple note_to_midi: Dict[int, int] = { 1: 0, 2: 2, 3: 4, 4: 5, 5: 7, 6: 9, 7: 11, } midi_to_note: Dict[int, int] = { 0: 1, 2: 2, 4: 3, 5: 4, 7: 5, 9: 6, 11: 7, } class Note: num: int @c...
normal
{ "blob_id": "d70f77713abf4b35db9de72c1edbf4bf4580b2a4", "index": 8795, "step-1": "<mask token>\n\n\nclass Note:\n num: int\n\n @classmethod\n def choice(cls, *args: int):\n return Note(choice(args))\n\n @classmethod\n def from_midi(cls, midi: int, root: int):\n note = midi_to_note.ge...
[ 24, 26, 28, 33, 34 ]
<|reserved_special_token_0|> class CalendarAppointmentSlot(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @api.con...
flexible
{ "blob_id": "e03dfa0e02313c5478d4e97dcaf3bc27915bd878", "index": 1421, "step-1": "<mask token>\n\n\nclass CalendarAppointmentSlot(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @api.constrains('hour')\n def ch...
[ 7, 10, 12, 18, 19 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> f.write( 'User Name\tEntire User Name\tPassword\tAlias-Names\tGroup\tDirect Dialing\tCost Account\tPermissions\tComments\tUser-Defined\tPredefined Settings\tName 1\tName 2\tName 3\tName 4\tName 5\tDepartment\tAttention of\tPho...
flexible
{ "blob_id": "1b7048ef17b3512b9944ce7e197db27f4fd1aed0", "index": 1687, "step-1": "<mask token>\n", "step-2": "<mask token>\nf.write(\n 'User Name\\tEntire User Name\\tPassword\\tAlias-Names\\tGroup\\tDirect Dialing\\tCost Account\\tPermissions\\tComments\\tUser-Defined\\tPredefined Settings\\tName 1\\tName ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def play_43(): n = int(input('Enter n :')) l = [] for i in range(n): l.append(int(input())) for i in range(n - 1): for j in range(i + 1, n): if l[i] < l[j]: continue return 'no' retur...
flexible
{ "blob_id": "1605396a6edb31dd6fe9238a0506f8cfeb794d07", "index": 5568, "step-1": "<mask token>\n", "step-2": "def play_43():\n n = int(input('Enter n :'))\n l = []\n for i in range(n):\n l.append(int(input()))\n for i in range(n - 1):\n for j in range(i + 1, n):\n if l[i] <...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': print('New game!') deck = Deck() deck.shuffle() players = deck.deal() auction = Auction(players) auction.bid() tricks = Tricks(auction) tricks.play() <|reserved_special_...
flexible
{ "blob_id": "06161b1f45e435d0273dd193229ad2ecfd46c625", "index": 9002, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n print('New game!')\n deck = Deck()\n deck.shuffle()\n players = deck.deal()\n auction = Auction(players)\n auction.bid()\n tricks = Trick...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def taille_plus_grande_reponse(reponses): """ Prend en argument une liste. Renvoie la taille du plus grand élément de la liste. """ l = reponses maxi = 0 for i in range(len(l)): if len(str(l[i])) > maxi: maxi = len(str(l[i])) return maxi...
flexible
{ "blob_id": "7618d7fde3774a04ac2005dad104e54b9988d3e8", "index": 9487, "step-1": "<mask token>\n\n\ndef taille_plus_grande_reponse(reponses):\n \"\"\"\n Prend en argument une liste.\n Renvoie la taille du plus grand élément de la liste.\n \"\"\"\n l = reponses\n maxi = 0\n for i in range(len...
[ 8, 11, 13, 14, 21 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for char in string: if char.isupper(): upp_regist += 1 elif char.islower(): low_regist += 1 print('Some string:', string) if upp_regist > low_regist: print('Some edited string:', string.upper()) elif lo...
flexible
{ "blob_id": "c7c405535b2ca656d4d5f18013e3e2fdef70efea", "index": 8088, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor char in string:\n if char.isupper():\n upp_regist += 1\n elif char.islower():\n low_regist += 1\nprint('Some string:', string)\nif upp_regist > low_regist:\n pr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def deploy(): print('deploying') pass <|reserved_special_token_1|> <|reserved_special_token_0|> def pack(): local('git checkout') local('git commit -a -s -m "Fabric Pack Commit"') def deploy(): print('deploying') pass <|reserved_special_token_1|> <|reserv...
flexible
{ "blob_id": "98db990f406cc6815480cca33011c8b0b2ad67c7", "index": 2343, "step-1": "<mask token>\n\n\ndef deploy():\n print('deploying')\n pass\n", "step-2": "<mask token>\n\n\ndef pack():\n local('git checkout')\n local('git commit -a -s -m \"Fabric Pack Commit\"')\n\n\ndef deploy():\n print('dep...
[ 1, 2, 3, 4, 5 ]
from mx.handlers import MainHandler # handler for changing app language class Locale(MainHandler): """ handles requests to change LOCALE or language for internationalization. """ def get(self): locale = self.request.get('locale') if not locale : locale = LOCALE locale...
normal
{ "blob_id": "bdcbb946dadf168149342c651ad03eaf4b748401", "index": 6803, "step-1": "<mask token>\n\n\nclass Locale(MainHandler):\n <mask token>\n <mask token>\n\n\nclass MainPage(MainHandler):\n\n def get(self):\n self.render('home.html')\n\n def post(self):\n pw = self.request.get('pw')\...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def create_dir(directory): if not os.path.exists(directory): os.makedirs(directory) def get_full_paths_to_files(files_dir, filenames): return [os.path.join(files_dir, f) for f in filenames] def process_images(im_filenames, cg, params): finder, find_and_draw_lanes =...
flexible
{ "blob_id": "456d79a69c170a59af742648f16e0171cd5a2412", "index": 1412, "step-1": "<mask token>\n\n\ndef create_dir(directory):\n if not os.path.exists(directory):\n os.makedirs(directory)\n\n\ndef get_full_paths_to_files(files_dir, filenames):\n return [os.path.join(files_dir, f) for f in filenames]...
[ 5, 6, 7, 8, 10 ]
<|reserved_special_token_0|> class Fire(pyglet.sprite.Sprite): <|reserved_special_token_0|> <|reserved_special_token_0|> def update(self): self.rotation += self.rotate_speed self.x += self.velocity_x self.check_bounds() def remote_update(self, x, rotation): self.rotat...
flexible
{ "blob_id": "cf2bbe332237bd849df62be099f1719eaf1f2082", "index": 1523, "step-1": "<mask token>\n\n\nclass Fire(pyglet.sprite.Sprite):\n <mask token>\n <mask token>\n\n def update(self):\n self.rotation += self.rotate_speed\n self.x += self.velocity_x\n self.check_bounds()\n\n def...
[ 5, 6, 7, 8, 9 ]
import mysql.connector import hashlib import time from datetime import datetime from datetime import timedelta from pymongo import MongoClient from pymongo import IndexModel, ASCENDING, DESCENDING class MongoManager: def __init__(self, server_ip='localhost', client=None, expires=timedelta(days=30)): ""...
normal
{ "blob_id": "4cb5dcf0d943ef15421bb6bced65804533d232e3", "index": 4950, "step-1": "import mysql.connector\nimport hashlib\nimport time \nfrom datetime import datetime\nfrom datetime import timedelta\n\nfrom pymongo import MongoClient\nfrom pymongo import IndexModel, ASCENDING, DESCENDING\n\n\nclass MongoManager:\...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def xyplot(xdata, ydata, title): fname = '/Users/nalmog/Desktop/swa_equipped_cumulative_' + title + '.png' plt.plot(xdata, ydata) plt.ylabel('some numbers') plt.title(title) plt.xlabel('Percent of Fleet') ...
flexible
{ "blob_id": "10a7c1827abb8a87f5965453aa2d8f5e8b4914e5", "index": 6563, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef xyplot(xdata, ydata, title):\n fname = '/Users/nalmog/Desktop/swa_equipped_cumulative_' + title + '.png'\n plt.plot(xdata, ydata)\n plt.ylabel('some numbers')\n plt.ti...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def cmdline(): available_commands = ['help', 'quit', 'echo', 'pbar', 'joke'] keepgoing = True while keepgoing: typed = input("Type something. (Type 'help' for options)") words = [w for w in typed.spli...
flexible
{ "blob_id": "a028661f9bcaa6dfe5389cb57f31b07d7e981487", "index": 9890, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef cmdline():\n available_commands = ['help', 'quit', 'echo', 'pbar', 'joke']\n keepgoing = True\n while keepgoing:\n typed = input(\"Type something. (Type 'help' for...
[ 0, 1, 2, 3, 4 ]
# encoding=UTF-8 # This file serves the project in production # See http://wsgi.readthedocs.org/en/latest/ from __future__ import unicode_literals from moya.wsgi import Application application = Application( "./", ["local.ini", "production.ini"], server="main", logging="prodlogging.ini" )
normal
{ "blob_id": "cb0be932813a144cfb51b3aa2f6e0792e49c4945", "index": 3021, "step-1": "<mask token>\n", "step-2": "<mask token>\napplication = Application('./', ['local.ini', 'production.ini'], server=\n 'main', logging='prodlogging.ini')\n", "step-3": "from __future__ import unicode_literals\nfrom moya.wsgi i...
[ 0, 1, 2, 3 ]
import numpy as np from scipy.linalg import solve from matplotlib import pylab as plt def f(x): return (np.sin(x / 5) * np.exp(x / 10) + 5 * np.exp(-x / 2)) xx = np.arange(1, 15, 0.1) yy = f(xx) # 1 степень x = np.array([1,15]) y = f(x) A = np.array([[1,1], [1,15]]) w = solve(A, y) y1 = w[0] +...
normal
{ "blob_id": "a610ccf4fe154ee12de9212a10958fda2000b425", "index": 7122, "step-1": "<mask token>\n\n\ndef f(x):\n return np.sin(x / 5) * np.exp(x / 10) + 5 * np.exp(-x / 2)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef f(x):\n return np.sin(x / 5) * np.exp(x / 10) + 5 * np.exp(-x / 2)\n\n\n<mask t...
[ 1, 2, 3, 4, 5 ]
from django.conf.urls import url from cart import views urlpatterns=[ url(r'^add/$',views.cart_add,name='add'),#t添加购物车数据 url(r'^count/$',views.cart_count,name='count'),#huo获取购物车商品数量 url(r'^del/$',views.cart_del,name='delete'),#删除购物车商品记录 url(r'update/$',views.cart_update,name='update'),#更新购物车商品数目 u...
normal
{ "blob_id": "5b3a6b44bd9ea80da1983d8254c73bba3e2338e1", "index": 5166, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^add/$', views.cart_add, name='add'), url('^count/$',\n views.cart_count, name='count'), url('^del/$', views.cart_del, name=\n 'delete'), url('update/$', views.c...
[ 0, 1, 2, 3 ]
from django.shortcuts import render from django.contrib.auth.decorators import login_required from django.views.decorators.csrf import csrf_exempt # Create your views here. from projects.models import Project from django.db import connection from .utils import namedtuplefetchall from django.http import JsonResponse fro...
normal
{ "blob_id": "c2839046592469dfae7526f72be947126960ba19", "index": 621, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@login_required\n@csrf_exempt\ndef social(request):\n if request.method == 'POST':\n data = request.POST\n project_id = int(json.loads(data.get('projid')))\n he...
[ 0, 1, 2, 3 ]
# coding: utf-8 """ Idomoo API OpenAPI spec version: 2.0 Contact: dev.support@idomoo.com """ import pprint import six class GIFOutput(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: ...
normal
{ "blob_id": "2362c9a12f97f32f6136aaf16a55cf4acbaf9294", "index": 4753, "step-1": "<mask token>\n\n\nclass GIFOutput(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, gif_fps=None, color_depth=None, gif_loop=None,\n height=None, start=None, duration=...
[ 27, 28, 29, 31, 33 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for l in pdb: if not l.startswith('ATOM'): continue if int(l[22:26]) != resid: res.append([]) resid = int(l[22:26]) res[-1].append(l) for i in range(len(res) - 2): outp = open('%s%d-%dr.pdb'...
flexible
{ "blob_id": "d867d17b2873de7c63d0ff29eb585cce1a68dda6", "index": 6081, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor l in pdb:\n if not l.startswith('ATOM'):\n continue\n if int(l[22:26]) != resid:\n res.append([])\n resid = int(l[22:26])\n res[-1].append(l)\nfor i in r...
[ 0, 1, 2, 3, 4 ]
# Opus/UrbanSim urban simulation software. # Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington # See opus_core/LICENSE from opus_core.variables.variable import Variable from variable_functions import my_attribute_label class total_land_value_if_in_plan_type_group_SS...
normal
{ "blob_id": "52bb10e19c7a5645ca3cf91705b9b0affe75f570", "index": 4764, "step-1": "<mask token>\n\n\nclass total_land_value_if_in_plan_type_group_SSS(Variable):\n <mask token>\n\n def __init__(self, group):\n self.group = group\n Variable.__init__(self)\n\n def dependencies(self):\n ...
[ 6, 7, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> import numpy import math import operator <|reserved_special_token_1|> import numpy #Matrixmultiplikation #Matrixinvertierung #nicht p inv #selbst invertierbar machen import math import operator
flexible
{ "blob_id": "ece20c8c8fae2225cbac3552e254314b7116057c", "index": 7095, "step-1": "<mask token>\n", "step-2": "import numpy\nimport math\nimport operator\n", "step-3": "import numpy\n#Matrixmultiplikation\n#Matrixinvertierung\n#nicht p inv\n#selbst invertierbar machen\n\nimport math\nimport operator", "step...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def init_ssh(key: str, key_path: Path) ->None: if not key: logging.warning('Private Key required for SSH Git') return logging.info('Private Key found, writing to disk') key_path.mkdir(exist_ok=True) key_file = Path(key_path, 'id_rsa') if not key_file.ex...
flexible
{ "blob_id": "cb2dd08a09d2e39bd83f82940c3d9a79a5a27918", "index": 6523, "step-1": "<mask token>\n\n\ndef init_ssh(key: str, key_path: Path) ->None:\n if not key:\n logging.warning('Private Key required for SSH Git')\n return\n logging.info('Private Key found, writing to disk')\n key_path.mk...
[ 1, 2, 3, 4, 5 ]