code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
<|reserved_special_token_0|>
class FleurBaseWorkChain(BaseRestartWorkChain):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
@classmethod
def define(cls, spec):
super().define(spec)
spec.expose_inputs(FleurCalculation, exclude=('metadata.opti... | flexible | {
"blob_id": "1d4a51cfbd5df9ac9074c816a140309e04fff021",
"index": 4159,
"step-1": "<mask token>\n\n\nclass FleurBaseWorkChain(BaseRestartWorkChain):\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def define(cls, spec):\n super().define(spec)\n spec.expose_inputs(Fleur... | [
4,
7,
9,
14,
15
] |
#!/usr/bin/env python2.7
'''
lib script to encapsulate the camera info
'''
from xml.dom import minidom, Node
# what % of the file system remains before deleting files
# amount that we will cleanup relative to the filesystem total
CAMERA_XML_FILE = "/tmp/cameras.xml"
def cameras_get_info():
'''
cameras_ge... | normal | {
"blob_id": "510d411d79d5df8658703241f161b3e2a9ec5932",
"index": 4110,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef cameras_get_info():\n \"\"\"\n cameras_get_info - reads the camera info from the XML file and\n puts it into a python data structure and returns it.\n \"\"\"\n stat... | [
0,
1,
2,
3,
4
] |
#давайте напишем программу русской рулетки
import random
amount_of_bullets = int(input("Сколько вы хотите вставить патронов?"))
baraban = [0, 0, 0, 0, 0, 0]
# 0 -аналогия пустого гнезда
# 1 - аналогия гнезда с патроном
for i in range(amount_of_bullets):
print(i)
baraban[i] = 1
print("Посмотрите на барабан"... | normal | {
"blob_id": "6c0080aa62579b4cbdaf3a55102924bfe31ffb40",
"index": 8107,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(amount_of_bullets):\n print(i)\n baraban[i] = 1\nprint('Посмотрите на барабан', baraban)\n<mask token>\nfor i in range(how_much):\n random.shuffle(baraban)\n if... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Phase transition module
"""
import utils
import datetime
import itertools
import numpy as np
import recovery as rec
import sampling as smp
import graphs_signals as gs
import pathos.multiprocessing as mp
from tqdm import tqdm
## MAIN FUNCTIONS ##
def grid_evalua... | normal | {
"blob_id": "d65f858c3ad06226b83d2627f6d38e03eae5b36c",
"index": 266,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef line_evaluation(param_list, param_eval, file_name='line evaluation', **\n kwargs):\n \"\"\"\n Evaluates a list of parameter pairs across repeated trials and aggregates the... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def train(dataset: 'Dataset', epochs: int=10):
loader = DataLoader(dataset, batch_size=2, shuffle=True)
model = NNModel(n_input=2, n_output=3)
optimizer = torch.optim.Adam(model.parameters(), lr=0.01)
criterion =... | flexible | {
"blob_id": "68bcb76a9c736e21cc1f54c6343c72b11e575b5d",
"index": 5093,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef train(dataset: 'Dataset', epochs: int=10):\n loader = DataLoader(dataset, batch_size=2, shuffle=True)\n model = NNModel(n_input=2, n_output=3)\n optimizer = torch.optim.A... | [
0,
1,
2,
3
] |
#usage:
#crawl raw weibo text data from sina weibo users(my followees)
#in total, there are 20080 weibo tweets, because there is uplimit for crawler
# -*- coding: utf-8 -*-
import weibo
APP_KEY = 'your app_key'
APP_SECRET = 'your app_secret'
CALL_BACK = 'your call back url'
def run():
token = "your access token got... | normal | {
"blob_id": "8a04166e091e2da348928598b2356c8ad75dd831",
"index": 5889,
"step-1": "#usage:\n#crawl raw weibo text data from sina weibo users(my followees)\n#in total, there are 20080 weibo tweets, because there is uplimit for crawler\n\n# -*- coding: utf-8 -*-\nimport weibo\n\nAPP_KEY = 'your app_key'\nAPP_SECRET... | [
0
] |
from mock import Mock
from shelf.hook.background import action
from shelf.hook.event import Event
from tests.test_base import TestBase
import json
import os
import logging
from pyproctor import MonkeyPatcher
class ExecuteCommandTest(TestBase):
def setUp(self):
super(ExecuteCommandTest, self).setUp()
... | normal | {
"blob_id": "c312bf096c7f4aaf9269a8885ff254fd4852cfe0",
"index": 9996,
"step-1": "<mask token>\n\n\nclass ExecuteCommandTest(TestBase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass ExecuteCommandTest(TestBase):\n\n def setUp... | [
1,
5,
6,
7,
8
] |
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 20 07:48:47 2018
@author: hfuji
"""
import os
from PIL import Image
import glob
import shutil
src_jpg_dir = 'D:/Develop/data/VOCdevkit/VOC2007/JPEGImages/'
dst_bmp_dir = 'D:/Temp/'
jpg_files = glob.glob(src_jpg_dir + '*.jpg')
cnt = 0
for jpg_file in ... | normal | {
"blob_id": "a57059927a7bd3311c1d104bfc80877912c7d995",
"index": 125,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor jpg_file in jpg_files:\n basename = os.path.basename(jpg_file)\n if int(basename[:-4]) % 10 == 0:\n cnt += 1\n dirname = os.path.dirname(jpg_file)\n dirs = d... | [
0,
1,
2,
3,
4
] |
import random
import time
class Cells:
UNDEFINED = 0
DEAD = 1
ALIVE = 2
def __init__(self, nx, ny, density = 5):
self.nx = nx
self.ny = ny
self._cells = [[Cells.UNDEFINED for y in range(ny)] for x in range(nx)]
self._nextCells = [[Cells.UNDEFINED for y in range(ny)] for... | normal | {
"blob_id": "563e534e4794aa872dcdc5319b9a1943d19f940f",
"index": 1289,
"step-1": "<mask token>\n\n\nclass Cells:\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, nx, ny, density=5):\n self.nx = nx\n self.ny = ny\n self._cells = [[Cells.UNDEFINED for y in range(... | [
5,
6,
7,
8,
9
] |
from math import log
from collections import Counter
import copy
import csv
import carTreePlotter
import re
def calEntropy(dataSet):
"""
输入:二维数据集
输出:二维数据集标签的熵
描述:
计算数据集的标签的香农熵;香农熵越大,数据集越混乱;
在计算 splitinfo 和通过计算熵减选择信息增益最大的属性时可以用到
"""
entryNum = len(dataSet)
labelsCount... | normal | {
"blob_id": "b051a3dbe1c695fda9a0488dd8986d587bbb24a6",
"index": 5838,
"step-1": "<mask token>\n\n\ndef calEntropy(dataSet):\n \"\"\"\n 输入:二维数据集\n 输出:二维数据集标签的熵\n 描述:\n 计算数据集的标签的香农熵;香农熵越大,数据集越混乱;\n 在计算 splitinfo 和通过计算熵减选择信息增益最大的属性时可以用到\n \"\"\"\n entryNum = len(dataSet)\n labelsCount = ... | [
12,
18,
19,
21,
23
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def solution(genres, plays):
answer = []
cache = collections.defaultdict(list)
genre_order = collections.defaultdict(int)
order = collections.defaultdict()
for i in range(len(genres)):
cache[genres[i]... | flexible | {
"blob_id": "d56c80b4822b1bd0f2d4d816ed29a4da9d19a625",
"index": 3040,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef solution(genres, plays):\n answer = []\n cache = collections.defaultdict(list)\n genre_order = collections.defaultdict(int)\n order = collections.defaultdict()\n fo... | [
0,
1,
2,
3,
4
] |
from flask import request,Flask, render_template
from bs4 import BeautifulSoup as bs
from urllib.request import Request,urlopen
import re
app = Flask(__name__)
@app.route('/')
def addRegion():
return render_template('Website WordCount.html')
@app.route('/output_data', methods=['POST','GET'])
def output_data():
... | normal | {
"blob_id": "11dfb09286b8a5742550b5300c776ed82e69ead5",
"index": 2577,
"step-1": "<mask token>\n\n\n@app.route('/')\ndef addRegion():\n return render_template('Website WordCount.html')\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\n@app.route('/')\ndef addRegion():\n return render_template('Website W... | [
1,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class Nnt(list):
<|reserved_special_token_0|>
def __init__(self):
"""
Initialize the neural network base object.
"""
self.tag = None
def y(self, x):
"""
build sybolic expression of output {y} given input {x}
this also t... | flexible | {
"blob_id": "fb53ea6a7184c0b06fb8a4cbfaf2145cc5c2e8e2",
"index": 9468,
"step-1": "<mask token>\n\n\nclass Nnt(list):\n <mask token>\n\n def __init__(self):\n \"\"\"\n Initialize the neural network base object.\n \"\"\"\n self.tag = None\n\n def y(self, x):\n \"\"\"\n ... | [
5,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for count in range(2018):
len(spinlock) % count
<|reserved_special_token_1|>
<|reserved_special_token_0|>
STEP_VAL = 376
spinlock = []
for count in range(2018):
len(spinlock) % count
<|reserved_special_token_1|>
from... | flexible | {
"blob_id": "c3755ff5d4262dbf6eaf3df58a336f5e61531435",
"index": 5149,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor count in range(2018):\n len(spinlock) % count\n",
"step-3": "<mask token>\nSTEP_VAL = 376\nspinlock = []\nfor count in range(2018):\n len(spinlock) % count\n",
"step-4": "fr... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def display_board():
print('\n')
print(board[0] + ' | ' + board[1] + ' | ' + board[2] + ' | ' + board[3] +
' | ' + board[4] + ' 1 | 2 | 3 | 4 | 5')
print(board[5] + ' | ' + board[6] + ' | ' + board[7] + ' | ' + board[8] +
' | ' + board[9] + ' 6 | 7 | 8 ... | flexible | {
"blob_id": "605e088beed05c91b184e26c4a5d2a97cb793759",
"index": 2909,
"step-1": "<mask token>\n\n\ndef display_board():\n print('\\n')\n print(board[0] + ' | ' + board[1] + ' | ' + board[2] + ' | ' + board[3] +\n ' | ' + board[4] + ' 1 | 2 | 3 | 4 | 5')\n print(board[5] + ' | ' + board[6] + ... | [
7,
9,
11,
12,
13
] |
<|reserved_special_token_0|>
class Tiles:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def Blocked_At(pos):
if list(pos) in Tiles.Blocked:
return True
else:
return False
def Load_Texture(file, Size):
bitmap... | flexible | {
"blob_id": "3d1f7794763b058cc22c543709a97cb021d0fd23",
"index": 8404,
"step-1": "<mask token>\n\n\nclass Tiles:\n <mask token>\n <mask token>\n <mask token>\n\n def Blocked_At(pos):\n if list(pos) in Tiles.Blocked:\n return True\n else:\n return False\n\n def L... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
def weight_init(m):
class_name = m.__class__.__name__
if class_name.find('Conv') != -1:
xavier_uniform_(m.weight.data)
if class_name.find('Linear') != -1:
xavier_uniform_(m.weight.data)
<|reserved_special_token_0|>
def data_split_train(data_set, label_set):... | flexible | {
"blob_id": "fd45657083942dee13f9939ce2a4b71ba3f67397",
"index": 3587,
"step-1": "<mask token>\n\n\ndef weight_init(m):\n class_name = m.__class__.__name__\n if class_name.find('Conv') != -1:\n xavier_uniform_(m.weight.data)\n if class_name.find('Linear') != -1:\n xavier_uniform_(m.weight.... | [
3,
5,
7,
9,
10
] |
<|reserved_special_token_0|>
class Toybox(object):
<|reserved_special_token_0|>
def __init__(self, game_name: str, grayscale: bool=True, frameskip: int
=0, seed: Optional[int]=None, withstate: Optional[dict]=None):
"""
Construct a new Toybox state/game wrapper. Use this in a with bloc... | flexible | {
"blob_id": "c77e320cee90e8210e4c13d854649b15f6e24180",
"index": 2798,
"step-1": "<mask token>\n\n\nclass Toybox(object):\n <mask token>\n\n def __init__(self, game_name: str, grayscale: bool=True, frameskip: int\n =0, seed: Optional[int]=None, withstate: Optional[dict]=None):\n \"\"\"\n ... | [
27,
30,
39,
59,
65
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
engine.setProperty('rate', rate - 55)
engine.say('Hello , whats your name ?')
engine.say('I am mr. robot. What news would you like to listen to today ?')
engine.runAndWait()
<|reserved_special_token_1|>
<|reserved_special_token... | flexible | {
"blob_id": "d638194a37dc503b7dfb5410abf264be67c3a4f0",
"index": 4126,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nengine.setProperty('rate', rate - 55)\nengine.say('Hello , whats your name ?')\nengine.say('I am mr. robot. What news would you like to listen to today ?')\nengine.runAndWait()\n",
"ste... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def possi(y, x):
global n
if y < 0 or y >= n or x < 0 or x >= n or B[y][x]:
return False
return True
def move(d, ay, ax, by, bx):
ay += D[d][0]
by += D[d][0]
ax += D[d][1]
bx += D[d][1]
if possi(ay, ax) and possi(by, bx):
return True
r... | flexible | {
"blob_id": "feb912ac899208618f00c894458c1fda7a402652",
"index": 1452,
"step-1": "<mask token>\n\n\ndef possi(y, x):\n global n\n if y < 0 or y >= n or x < 0 or x >= n or B[y][x]:\n return False\n return True\n\n\ndef move(d, ay, ax, by, bx):\n ay += D[d][0]\n by += D[d][0]\n ax += D[d][... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
class TrailingShell:
<|reserved_special_token_0|>
def __init__(self, order, offset: int, tick_size: float, test=True,
init_ws=True):
self.tick_size = tick_size
self.exited = False
self.test = test
self.order = order
self.offset = of... | flexible | {
"blob_id": "ea4ec2e605ab6e8734f7631fe298c93467908b5f",
"index": 9582,
"step-1": "<mask token>\n\n\nclass TrailingShell:\n <mask token>\n\n def __init__(self, order, offset: int, tick_size: float, test=True,\n init_ws=True):\n self.tick_size = tick_size\n self.exited = False\n s... | [
14,
15,
16,
18,
25
] |
<|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": "42f021c728a88f34d09f94ea96d91abded8a29fb",
"index": 9553,
"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 = [('crm', '0040... | [
0,
1,
2,
3,
4
] |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""The GIFT module provides basic functions for interfacing with some of the GIFT tools.
In order to use the standalone MCR version of GIFT, you need to ensure that
the following commands are executed at ... | normal | {
"blob_id": "fef1cf75de8358807f29cd06d2338e087d6f2d23",
"index": 9162,
"step-1": "<mask token>\n\n\nclass GIFTCommand(BaseInterface):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, **inputs):\n super(GIFTCommand, self).... | [
8,
10,
15,
16,
18
] |
{"filter":false,"title":"cash.py","tooltip":"/pset6/cash/cash.py","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":12,"column":7},"end":{"row":12,"column":8},"action":"insert","lines":[" "],"id":308},{"start":{"row":12,"column":8},"end":{"row":12,"column":9},"action":"insert","lines":[">"]}],[{"start"... | normal | {
"blob_id": "d14c22ba6db90a93a19d61e105e31b3eb8f3a206",
"index": 1706,
"step-1": "<mask token>\n",
"step-2": "{'filter': false, 'title': 'cash.py', 'tooltip': '/pset6/cash/cash.py',\n 'undoManager': {'mark': 100, 'position': 100, 'stack': [[{'start': {\n 'row': 12, 'column': 7}, 'end': {'row': 12, 'colum... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def __gen_logger():
result = logging.getLogger('superslick')
return result
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def __gen_logger():
result = logging.getLogger(... | flexible | {
"blob_id": "cee9deeeabfec46ee5c132704e8fd653e55987f3",
"index": 3430,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef __gen_logger():\n result = logging.getLogger('superslick')\n return result\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef __gen_logger():\n result = logging.get... | [
0,
1,
2,
3,
4
] |
import numpy as np
from .build_processing_chain import build_processing_chain
from collections import namedtuple
from pprint import pprint
def run_one_dsp(tb_data, dsp_config, db_dict=None, fom_function=None, verbosity=0):
"""
Run one iteration of DSP on tb_data
Optionally returns a value for optimizati... | normal | {
"blob_id": "efe2d6f5da36679b77de32d631cca50c2c1dd29e",
"index": 5170,
"step-1": "<mask token>\n\n\nclass ParGrid:\n <mask token>\n\n def __init__(self):\n self.dims = []\n\n def add_dimension(self, name, i_arg, value_strs, companions=None):\n self.dims.append(ParGridDimension(name, i_arg,... | [
11,
14,
16,
18,
19
] |
<|reserved_special_token_0|>
class vu_meter:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def init_adc(self):
self.adc = ADC(0)
self.adcUnit = self.adc.channel(pin=self.adcPin)
self.adcMean = 0
def init_leds(self):
self.ledsColors = []
for x in ra... | flexible | {
"blob_id": "894d8d00fd05bf8648f1b95ecf30b70e7b4e841b",
"index": 8640,
"step-1": "<mask token>\n\n\nclass vu_meter:\n <mask token>\n <mask token>\n\n def init_adc(self):\n self.adc = ADC(0)\n self.adcUnit = self.adc.channel(pin=self.adcPin)\n self.adcMean = 0\n\n def init_leds(se... | [
7,
11,
12,
14,
15
] |
from Modules.Pitch.Factory import MainFactory
from Modules.ToJson import Oto
from audiolazy.lazy_midi import midi2str
import utaupy
import string
import random
import math
import os, subprocess, shutil
def RandomString(Length):
Letters = string.ascii_lowercase
return ''.join(random.choice(Letters) for i ... | normal | {
"blob_id": "ce11a5c2fbd6e0ea0f8ab293dc53afd07a18c25c",
"index": 6160,
"step-1": "<mask token>\n\n\ndef RandomString(Length):\n Letters = string.ascii_lowercase\n return ''.join(random.choice(Letters) for i in range(Length))\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef RandomString(Length):\n ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def sorting_l2(mat):
mat_l2 = norma_l2(mat)
mat_sort_index = np.argsort(mat_l2)
mat_sort_l2 = mat[mat_sort_index, :]
return mat_sort_l2[::-1]
<|reserved_special_token_1|>
import numpy as np
from Ejercicio1 imp... | flexible | {
"blob_id": "e280b003c95681ed4a887b0939077efeac9deefe",
"index": 1377,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef sorting_l2(mat):\n mat_l2 = norma_l2(mat)\n mat_sort_index = np.argsort(mat_l2)\n mat_sort_l2 = mat[mat_sort_index, :]\n return mat_sort_l2[::-1]\n",
"step-3": "impo... | [
0,
1,
2
] |
import os
import unittest
import json
from flask_sqlalchemy import SQLAlchemy
from flaskr import create_app
from models import setup_db, Question
DB_HOST = os.getenv('DB_HOST', '127.0.0.1:5432')
DB_USER = os.getenv('DB_USER', 'postgres')
DB_PASSWORD = os.getenv('DB_PASSWORD', 'postgres')
DB_NAME = os.getenv('DB_NAME'... | normal | {
"blob_id": "364ac79e0f885c67f2fff57dfe3ddde63f0c269e",
"index": 995,
"step-1": "<mask token>\n\n\nclass TriviaTestCase(unittest.TestCase):\n <mask token>\n\n def setUp(self):\n \"\"\"Define test variables and initialize app.\"\"\"\n self.app = create_app()\n self.client = self.app.tes... | [
15,
16,
18,
19,
23
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
try:
x = int(input('정수를 입력하세요: '))
print(x)
except:
print('정수가 아닙니다.')
<|reserved_special_token_1|>
#예외처리 문법을 활용하여 정수가 아닌 숫자를 입력했을때 에러문구가나오도록 작성.(에러문구:정수가아닙니다)
try:
x = int(input('정수를 입력하세요: '))
print(x)
except:
print('정수가 아닙니... | flexible | {
"blob_id": "906265182a9776fec5bad41bfc9ee68b36873d1e",
"index": 573,
"step-1": "<mask token>\n",
"step-2": "try:\n x = int(input('정수를 입력하세요: '))\n print(x)\nexcept:\n print('정수가 아닙니다.')\n",
"step-3": "#예외처리 문법을 활용하여 정수가 아닌 숫자를 입력했을때 에러문구가나오도록 작성.(에러문구:정수가아닙니다)\n\ntry:\n x = int(input('정수를 입력하세요:... | [
0,
1,
2
] |
#!/usr/bin/env python3
import base64
from apiclient import errors
import os
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
import mimetypes
def Get_Attachments(service, userId, msg_id, store_dir):
"""Get and store... | normal | {
"blob_id": "dee1ab3adb7f627680410c774be44ae196f63f6c",
"index": 587,
"step-1": "<mask token>\n\n\ndef Get_Attachments(service, userId, msg_id, store_dir):\n \"\"\"Get and store attachment from Message with given id.\n Args:\n service: Authorized Gmail API service instance.\n user... | [
2,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(IPython.display.Audio(data=my, rate=sr))
sd.play(my, sr)
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
my, sr = librosa.load(
'C:\\Users\\pranj\\Downloads\\IEMOCAP_full_release... | flexible | {
"blob_id": "14bf4befdce4270b4514b4e643964182f9c49ff4",
"index": 8434,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(IPython.display.Audio(data=my, rate=sr))\nsd.play(my, sr)\n<mask token>\n",
"step-3": "<mask token>\nmy, sr = librosa.load(\n 'C:\\\\Users\\\\pranj\\\\Downloads\\\\IEMOCAP_full... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if __name__ == '__main__':
import os
import time
from msl.equipment import EquipmentRecord, ConnectionRecord, Backend
from msl.equipment.resources.thorlabs import MotionControl
os.environ['PATH'] += os.pathsep ... | flexible | {
"blob_id": "04b5df5cfd052390f057c6f13b2e21d27bac6449",
"index": 943,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n import os\n import time\n from msl.equipment import EquipmentRecord, ConnectionRecord, Backend\n from msl.equipment.resources.thorlabs import Motio... | [
0,
1,
2
] |
<|reserved_special_token_0|>
class BookSerializer(serializers.ModelSerializer):
class Meta:
model = Book
fields = '__all__'
def create(self, validated_data):
formats = validated_data.pop('format', [])
book = Book.objects.create(**validated_data)
book.format.add(*form... | flexible | {
"blob_id": "9c50a3abd353d5ba619eaa217dcc07ab76fb850c",
"index": 2519,
"step-1": "<mask token>\n\n\nclass BookSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = Book\n fields = '__all__'\n\n def create(self, validated_data):\n formats = validated_data.pop('format', []... | [
9,
11,
12,
13,
14
] |
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
import pandas as pd
import numpy as np
from sklearn import datasets
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
# a = pd.... | normal | {
"blob_id": "d0448ca8e3fd2f3bb8a3a7ec052e29ab0be6351a",
"index": 471,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nplt.figure()\n<mask token>\nfor color, i, target_name in zip(colors, [0, 1, 2], target_names):\n plt.scatter(X_r[y == i, 0], X_r[y == i, 1], color=color, alpha=0.8, lw=\n lw, lab... | [
0,
1,
2,
3,
4
] |
import numpy as np
def calculate_distance_for_tour(tour, node_id_to_location_dict):
length = 0
num = 0
for i in tour:
j = tour[num - 1]
distance = np.linalg.norm(node_id_to_location_dict[i] - node_id_to_location_dict[j])
length += distance
num += 1
return length
def... | normal | {
"blob_id": "67d79a5c9eceef9f1ed69f79d6a9d1f421f3246c",
"index": 2757,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef calculate_distance_for_tour(tour, node_id_to_location_dict):\n length = 0\n num = 0\n for i in tour:\n j = tour[num - 1]\n distance = np.linalg.norm(node_id... | [
0,
1,
2,
3,
4
] |
import gym
from ddpg import DDPG
def main():
#env = gym.make('LunarLanderContinuous-v2')
#log_dir = 'log/lander'
env = gym.make('Pendulum-v0')
log_dir = 'log/pendulum'
# paper settings
# agent = DDPG(env, sigma=0.2, num_episodes=1000, buffer_size=1000000, batch_size=64,
# ... | normal | {
"blob_id": "153e7e66e2b796d011b78aed102d30e37bb0b80f",
"index": 1374,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n env = gym.make('Pendulum-v0')\n log_dir = 'log/pendulum'\n agent = DDPG(env, sigma=0.2, num_episodes=250, buffer_size=1000000,\n batch_size=64, tau=0.001... | [
0,
1,
2,
3,
4
] |
from django import http
from django.utils import simplejson as json
import urllib2
import logging
from google.appengine.api import urlfetch
import cmath
import math
from ams.forthsquare import ForthSquare
from ams.twitter import Twitter
OAUTH_TOKEN='3NX4ATMVS35LKIP25ZOKIVBRGAHFREKGNHTAKQ5NPGMCWOE0'
DEFAULT_RADIUS = ... | normal | {
"blob_id": "bd1fbdf70bae7d5853bac8fae83343dfa188ca19",
"index": 5391,
"step-1": "from django import http\nfrom django.utils import simplejson as json\nimport urllib2\nimport logging\nfrom google.appengine.api import urlfetch\nimport cmath\nimport math\nfrom ams.forthsquare import ForthSquare\nfrom ams.twitter i... | [
0
] |
def regexp_engine(pattern, letter):
return pattern in ('', '.', letter)
def match_regexp(pattern, substring):
if not pattern: # pattern is empty always True
return True
if substring: # if string is not empty try the regexp engine
if regexp_engine(pattern[0], substring[0]): # if reg and ... | normal | {
"blob_id": "fbfc1749252cf8cbd9f8f72df268284d3e05d6dc",
"index": 8024,
"step-1": "<mask token>\n\n\ndef match_regexp(pattern, substring):\n if not pattern:\n return True\n if substring:\n if regexp_engine(pattern[0], substring[0]):\n return match_regexp(pattern[1:], substring[1:])\... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def solution(n, money):
save = [0] * (n + 1)
save[0] = 1
for i in range(len(money)):
for j in range(1, n + 1):
if j - money[i] >= 0:
save[j] += save[j - money[i]] % 1000000007
return save[n]
<|reserved_spe... | flexible | {
"blob_id": "deeba82536d0366b3793bcbe78f78e4cfeabb612",
"index": 6241,
"step-1": "<mask token>\n",
"step-2": "def solution(n, money):\n save = [0] * (n + 1)\n save[0] = 1\n for i in range(len(money)):\n for j in range(1, n + 1):\n if j - money[i] >= 0:\n save[j] += sav... | [
0,
1,
2
] |
import time
import machine
from machine import Timer
import network
import onewire, ds18x20
import ujson
import ubinascii
from umqtt.simple import MQTTClient
import ntptime
import errno
#Thrown if an error that is fatal occurs,
#stop measurement cycle.
class Error(Exception):
pass
#Thrown if an error that is not ... | normal | {
"blob_id": "b934770e9e57a0ead124e245f394433ce853dec9",
"index": 8691,
"step-1": "<mask token>\n\n\nclass Error(Exception):\n pass\n\n\nclass Warning(Exception):\n pass\n\n\ndef gettimestr():\n rtc = machine.RTC()\n curtime = rtc.datetime()\n _time = '%04d' % curtime[0] + '%02d' % curtime[1] + '%0... | [
4,
5,
6,
8,
9
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for index in index_list:
data_js = THS_DateSerial(index,
'ths_pre_close_index;ths_open_price_index;ths_close_price_index;ths_high_price_index'
, ';;;', 'Days:Tradedays,Fill:Previous,Interval:D,block:history',
... | flexible | {
"blob_id": "7f62af951b49c3d1796c2811527ceb30ca931632",
"index": 8607,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor index in index_list:\n data_js = THS_DateSerial(index,\n 'ths_pre_close_index;ths_open_price_index;ths_close_price_index;ths_high_price_index'\n , ';;;', 'Days:Traded... | [
0,
1,
2,
3,
4
] |
from springframework.web.servlet import ModelAndView
from springframework.web.servlet.HandlerAdapter import HandlerAdapter
from springframework.web.servlet.mvc.Controller import Controller
from springframework.web.servlet.mvc.LastModified import LastModified
from springframework.utils.mock.inst import (
HttpServlet... | normal | {
"blob_id": "71e7a209f928672dbf59054b120eed6a77522dde",
"index": 6246,
"step-1": "<mask token>\n\n\nclass SimpleControllerHandlerAdapter(HandlerAdapter):\n\n def supports(self, handler: object) ->bool:\n return isinstance(handler, Controller)\n <mask token>\n <mask token>\n",
"step-2": "<mask t... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class Item(BaseModel):
name: str
price: float
class ValidationError(APIRoute):
def get_route_handler(self) ->Callable:
original_route_handler = super().get_route_handler()
async def customer_route_handler(request: Request) ->Response:
try:
... | flexible | {
"blob_id": "70188d011ef60b1586864c4b85a9f9e70e5a4caf",
"index": 7386,
"step-1": "<mask token>\n\n\nclass Item(BaseModel):\n name: str\n price: float\n\n\nclass ValidationError(APIRoute):\n\n def get_route_handler(self) ->Callable:\n original_route_handler = super().get_route_handler()\n\n ... | [
3,
4,
5,
6,
7
] |
import argparse
import sys
def get_precision_values(input_file):
prec_values = []
all_precs = []
means = []
medians = []
methods = []
with open(input_file) as lines:
for line in lines:
if "RESULTS_AGGREGATION" in line:
tokens = line.strip().split(',')
... | normal | {
"blob_id": "9976eb2dd84448b37b81629d352f4a7490ab2316",
"index": 2546,
"step-1": "import argparse\nimport sys\n\ndef get_precision_values(input_file):\n prec_values = []\n all_precs = []\n means = []\n medians = []\n methods = []\n with open(input_file) as lines:\n for line in lines:\n ... | [
0
] |
import sys
word = input()
if word[0].islower():
print('{}{}'.format(word[0].upper(), word[1:]))
sys.exit()
else:
print(word)
sys.exit()
| normal | {
"blob_id": "227e78312b5bad85df562b6ba360de352c305e7b",
"index": 3913,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif word[0].islower():\n print('{}{}'.format(word[0].upper(), word[1:]))\n sys.exit()\nelse:\n print(word)\n sys.exit()\n",
"step-3": "<mask token>\nword = input()\nif word[0... | [
0,
1,
2,
3
] |
import binascii
import collections
import enum
Balance = collections.namedtuple("Balance", ["total", "available", "reward"])
Balance.__doc__ = "Represents a balance of asset, including total, principal and reward"
Balance.total.__doc__ = "The total balance"
Balance.available.__doc__ = "The principal, i.e. the total m... | normal | {
"blob_id": "5762271de166994b2f56e8e09c3f7ca5245b7ce0",
"index": 6249,
"step-1": "<mask token>\n\n\nclass AssetID(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __repr__(self):\n return '{:s}:{:s}'.format(self.asset_name, self.policy_id)\n\n ... | [
4,
5,
7,
8,
10
] |
<|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 = [('data_refinery_common', '0015_dataset_email_ccdl_ok')]
op... | flexible | {
"blob_id": "b4b2307897f64bb30cad2fbaaa1b320ae2aa7456",
"index": 8553,
"step-1": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('data_refinery_common', '0015_dataset_emai... | [
1,
2,
3,
4,
5
] |
OK = 200
CREATED = 201
NOT_MODIFIED = 304
UNAUTHORIZED = 401
FORBIDDEN = 403
BAD_REQUEST = 400
NOT_FOUND = 404
CONFLICT = 409
UNPROCESSABLE = 422
INTERNAL_SERVER_ERROR = 500
NOT_IMPLEMENTED = 501
SERVICE_UNAVAILABLE = 503
ADMIN = 'admin'
ELITE = 'elite'
NOOB = 'noob'
WITHDRAW = 'withdraw'
FUND = 'fund'
| normal | {
"blob_id": "d90942f22cbbd9cfc3a431b7857cd909a7690966",
"index": 92,
"step-1": "<mask token>\n",
"step-2": "OK = 200\nCREATED = 201\nNOT_MODIFIED = 304\nUNAUTHORIZED = 401\nFORBIDDEN = 403\nBAD_REQUEST = 400\nNOT_FOUND = 404\nCONFLICT = 409\nUNPROCESSABLE = 422\nINTERNAL_SERVER_ERROR = 500\nNOT_IMPLEMENTED = 5... | [
0,
1
] |
import re
import numpy as np
# only read pgm file
def readfile(filename:str)->tuple:
'''read given pgm file'''
col = 0
row = 0
lst = list()
with open(filename, 'rb') as file:
header = list()
ls = list()
# remove first line
header.append((file.readline()).decode("utf-... | normal | {
"blob_id": "63be96c0d1231f836bbec9ce93f06bda32775511",
"index": 2259,
"step-1": "<mask token>\n\n\ndef convert(lst: list) ->list():\n \"\"\"String Unicode to int\"\"\"\n l = list()\n for item in lst:\n l.append(ord(item))\n return l\n\n\n<mask token>\n\n\ndef write(filename: str, data: list, ... | [
2,
3,
4,
5,
6
] |
#!/usr/bin/python3
###################################################
### Euler project
### zdrassvouitie @ 10/2016
###################################################
file_name = '013_largeSum_data'
tot = 0
with open(file_name, "r") as f:
stop = 1
while stop != 0:
line = f.readline()
if len(... | normal | {
"blob_id": "bcdf1c03d996520f3d4d8d12ec4ef34ea63ef3cf",
"index": 3936,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open(file_name, 'r') as f:\n stop = 1\n while stop != 0:\n line = f.readline()\n if len(line) < 1:\n break\n tot += float(line)\nprint(tot)\n",
... | [
0,
1,
2,
3
] |
from django.shortcuts import render, get_object_or_404
from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView
from accounts.models import Employee
from leave.models import ApplyLeave
from departments.models import Department, Position
from django.contrib.auth.models import User
from... | normal | {
"blob_id": "7c6ac2837751703ac4582ee81c29ccf67b8277bc",
"index": 1632,
"step-1": "<mask token>\n\n\nclass UpdatePerformanceView(SuccessMessageMixin, UpdateView):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass DetailPerformanceView(DetailView... | [
7,
12,
17,
20,
21
] |
<|reserved_special_token_0|>
def foo(x: int) ->int:
return x + 1
<|reserved_special_token_0|>
class Class:
cls_var: ClassVar[str]
def m(self):
xs: List[int] = []
<|reserved_special_token_0|>
def a():
pass
<|reserved_special_token_0|>
def b(a: int=1):
pass
<|reserved_special_... | flexible | {
"blob_id": "689c6c646311eba1faa93cc72bbe1ee4592e45bc",
"index": 8392,
"step-1": "<mask token>\n\n\ndef foo(x: int) ->int:\n return x + 1\n\n\n<mask token>\n\n\nclass Class:\n cls_var: ClassVar[str]\n\n def m(self):\n xs: List[int] = []\n\n\n<mask token>\n\n\ndef a():\n pass\n\n\n<mask token>\... | [
5,
7,
8,
10,
13
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while formula >= 0 and formula <= 3:
a = float(input('Enter a:'))
min_x = float(input('Enter minx:'))
max_x = float(input('Enter maxx:'))
step = int(input('Enter steps:'))
x = min_x
if formula == 1:
... | flexible | {
"blob_id": "44c4a1f4b32b45fd95eb8b0a42a718d05d967e04",
"index": 2536,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile formula >= 0 and formula <= 3:\n a = float(input('Enter a:'))\n min_x = float(input('Enter minx:'))\n max_x = float(input('Enter maxx:'))\n step = int(input('Enter steps... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def read_path(path):
path_set = set()
dir_path = os.listdir(path)
for item in dir_path:
child = os.path.join('%s/%s' % (path, item))
path_set.add(child)
return path_set
def filter(path_set):
filterable = []
pattern = re.compile('.*\\.[html|htm]+',... | flexible | {
"blob_id": "a63718ba5f23d6f180bdafcb12b337465d6fa052",
"index": 4734,
"step-1": "<mask token>\n\n\ndef read_path(path):\n path_set = set()\n dir_path = os.listdir(path)\n for item in dir_path:\n child = os.path.join('%s/%s' % (path, item))\n path_set.add(child)\n return path_set\n\n\nd... | [
4,
5,
7,
8,
10
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def index(request):
if request.method == 'POST':
form = EmailForm(request.POST)
if form.is_valid():
post = form.save(commit=False)
post.signup_date = timezone.now()
post.em... | flexible | {
"blob_id": "f2cdee7e5eebaeeb784cb901c3ac6301e90ac7b9",
"index": 866,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef index(request):\n if request.method == 'POST':\n form = EmailForm(request.POST)\n if form.is_valid():\n post = form.save(commit=False)\n post... | [
0,
1,
2,
3,
4
] |
import os
import sys
import random
import pygame
import time
from pygame import locals
SCREEN_WIDTH = 1280
SCREEN_HEIGHT = 1024
class Moto(pygame.sprite.Sprite):
def __init__(self, player_num, start_direction):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.image.load("motor" + str(pla... | normal | {
"blob_id": "1d1f1c9b70ca487b48593c85c3e0b5afc10f0b07",
"index": 6642,
"step-1": "<mask token>\n\n\nclass Player(object):\n\n def __init__(self, player_num, px, py, sx, sy, start_direction):\n self.player_num = player_num\n self.rect = pygame.Rect(px, py, sx, sy)\n self.direction = start_... | [
13,
15,
19,
22,
24
] |
def four_Ow_four(error):
'''
method to render the 404 error page
'''
return render_template('fourOwfour.html'),404 | normal | {
"blob_id": "851cfd4e71ffd2d5fed33616abca4444474669a3",
"index": 4508,
"step-1": "<mask token>\n",
"step-2": "def four_Ow_four(error):\n \"\"\"\n method to render the 404 error page\n \"\"\"\n return render_template('fourOwfour.html'), 404\n",
"step-3": "def four_Ow_four(error):\n '''\n met... | [
0,
1,
2
] |
<|reserved_special_token_0|>
class AttendanceUpdateForm(ModelForm):
class Meta:
model = Attendance
fields = 'enrollment_id', 'date', 'present', 'absent', 'outpass'
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class HolidaysUpdateForm(ModelForm):
class Meta:
model ... | flexible | {
"blob_id": "d48f02d8d5469b966f109e8652f25352bc9b3b80",
"index": 7252,
"step-1": "<mask token>\n\n\nclass AttendanceUpdateForm(ModelForm):\n\n\n class Meta:\n model = Attendance\n fields = 'enrollment_id', 'date', 'present', 'absent', 'outpass'\n",
"step-2": "<mask token>\n\n\nclass HolidaysUp... | [
1,
2,
3,
4,
5
] |
import unittest
import requests
class TestAudiobookResponse(unittest.TestCase):
def test_audiobook_can_insert(self):
""" test that audiobook can be inserted into db """
data = {
"audiotype": "Audiobook",
"metadata": {
"duration": 37477,
"ti... | normal | {
"blob_id": "e651edcbe68264e3f25180b10dc8e9d5620ecd6b",
"index": 3656,
"step-1": "<mask token>\n\n\nclass TestAudiobookResponse(unittest.TestCase):\n\n def test_audiobook_can_insert(self):\n \"\"\" test that audiobook can be inserted into db \"\"\"\n data = {'audiotype': 'Audiobook', 'metadata':... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
class Solution_ref(object):
def isIsomorphic(self, s, t):
return [s.find(i) for i in s] == [t.find(j) for j in t]
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution(object):
<|reserved_special_token_0|>
class Solution_ref(object):
def isI... | flexible | {
"blob_id": "b4e2897e20448d543c93402174db7da4066a8510",
"index": 5144,
"step-1": "<mask token>\n\n\nclass Solution_ref(object):\n\n def isIsomorphic(self, s, t):\n return [s.find(i) for i in s] == [t.find(j) for j in t]\n\n\n<mask token>\n",
"step-2": "class Solution(object):\n <mask token>\n\n\nc... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
s.bind((host, port))
s.listen(5)
<|reserved_special_token_0|>
while True:
c, addr = s.accept()
f = open('temp.json', 'wb')
l = c.recv(1024)
while l:
f.write(l)
l = c.recv(1024)
f.close()
c.c... | flexible | {
"blob_id": "792f62c72f1667f651567314b062d862abbc9aa5",
"index": 6692,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ns.bind((host, port))\ns.listen(5)\n<mask token>\nwhile True:\n c, addr = s.accept()\n f = open('temp.json', 'wb')\n l = c.recv(1024)\n while l:\n f.write(l)\n l ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def same_folders(src1, src2):
"""Assert if folder contains diffrent files"""
dcmp = dircmp(src1, src2)
if dcmp.left_only or dcmp.right_only:
return False
for sub_dcmp in dcmp.subdirs.values():
same_folders(sub_dcmp.left, sub_dcmp.right)
return True
@c... | flexible | {
"blob_id": "8928c2ff49cbad2a54252d41665c10437a471eeb",
"index": 1404,
"step-1": "<mask token>\n\n\ndef same_folders(src1, src2):\n \"\"\"Assert if folder contains diffrent files\"\"\"\n dcmp = dircmp(src1, src2)\n if dcmp.left_only or dcmp.right_only:\n return False\n for sub_dcmp in dcmp.sub... | [
6,
8,
9,
12,
15
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def do_pack():
timestamp = datetime.utcnow().strftime('%Y%m%d%H%M%S')
archive = 'web_static_' + timestamp + '.tgz'
local('mkdir -p versions')
local('tar -cvzf versions/{} web_static/'.format(archive))
my_file... | flexible | {
"blob_id": "6f3de70267956a6c7c3c5b261cf591051de4c548",
"index": 1968,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef do_pack():\n timestamp = datetime.utcnow().strftime('%Y%m%d%H%M%S')\n archive = 'web_static_' + timestamp + '.tgz'\n local('mkdir -p versions')\n local('tar -cvzf vers... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
gp = pd.read_csv('graph6.csv')
N=gp['Starting-node'].max()
M=gp['Ending-node'].max()
N=max(N,M)
gp=gp.sort_values(by='Cost')
gp=gp.reset_index()
gp=gp.reset_index()
gp['tree label']=gp['level_0']
index=gp['index'].max()
gp.drop('index',axis... | normal | {
"blob_id": "719f7b7b2d8df037583263588e93d884ab3820fe",
"index": 5963,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ngp.drop('index', axis=1, inplace=True)\ngp.drop('level_0', axis=1, inplace=True)\nfor n in range(index + 1):\n Count = []\n Visit = []\n Visit2 = []\n for i in range(11):\n ... | [
0,
1,
2,
3,
4
] |
#Adds states to the list
states = {
'Oregon' : 'OR' ,
'Flordia': 'FL' ,
'California':'CA',
'New York':'NY',
'Michigan': 'MI',
}
#Adds cities to the list
cities = {
'CA':'San Fransisco',
'MI': 'Detroit',
'FL': 'Jacksonville'
}
cities['NY'] = 'New York'
cities['OR'] = 'PortLa... | normal | {
"blob_id": "1bdc1274cceba994524442c7a0065498a9c1d7bc",
"index": 8919,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('-' * 10)\nprint('NY State has:', cities['NY'])\nprint('OR State has : ', cities['OR'])\nprint('-' * 10)\nprint(\"Michigan's abbreviation is: \", states['Michigan'])\nprint(\"Flord... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
@app.errorhandler(404)
def not_found(error):
logger.warning(f'page not found {error} - {request.url}')
return render_template('error_pages/404.html'), 404
@app.errorhandler(500)
def server_error(error):
logger.error(f'server error {error} - {request.url}')
return render_... | flexible | {
"blob_id": "9d142e8de5235d55cd99371c9884e8dc7a10c947",
"index": 8111,
"step-1": "<mask token>\n\n\n@app.errorhandler(404)\ndef not_found(error):\n logger.warning(f'page not found {error} - {request.url}')\n return render_template('error_pages/404.html'), 404\n\n\n@app.errorhandler(500)\ndef server_error(e... | [
2,
3,
4,
5,
6
] |
import json
import sys
import time
# boardName pageNum indexNewest
# Baseball 5000 5183
# Elephants 3500 3558
# Monkeys 3500 3672
# Lions 3300 3381
# Guardians 3500 3542
boardNameList = ["Baseball", "Elephants", "Monkeys", "Lions", "Guardians"]
def loadData(filename):
_data = json.loads(open(filename).read())
return... | normal | {
"blob_id": "306240db8a1652fe7cd79808c40e4354c3158d3e",
"index": 3434,
"step-1": "<mask token>\n\n\ndef loadData(filename):\n _data = json.loads(open(filename).read())\n return _data\n\n\ndef buildUserDict(userDict, _data, boardName):\n for article in _data:\n _user = article['b_作者'].split(' ')[0... | [
3,
4,
5,
6,
7
] |
"""Support for Deebot Vaccums."""
import logging
from typing import Any, Mapping, Optional
import voluptuous as vol
from deebot_client.commands import (
Charge,
Clean,
FanSpeedLevel,
PlaySound,
SetFanSpeed,
SetRelocationState,
SetWaterInfo,
)
from deebot_client.commands.clean import CleanAc... | normal | {
"blob_id": "1ab690b0f9c34b1886320e1dfe8b54a5ec6cd4d1",
"index": 8712,
"step-1": "<mask token>\n\n\nclass DeebotVacuum(DeebotEntity, StateVacuumEntity):\n <mask token>\n\n def __init__(self, vacuum_bot: VacuumBot):\n \"\"\"Initialize the Deebot Vacuum.\"\"\"\n device_info = vacuum_bot.device_... | [
5,
6,
9,
10,
13
] |
s = input()
ans = 0
t = 0
for c in s:
if c == "R":
t += 1
else:
ans = max(ans, t)
t = 0
ans = max(ans, t)
print(ans)
| normal | {
"blob_id": "85c97dfeb766f127fa51067e5155b2da3a88e3be",
"index": 4811,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor c in s:\n if c == 'R':\n t += 1\n else:\n ans = max(ans, t)\n t = 0\n<mask token>\nprint(ans)\n",
"step-3": "s = input()\nans = 0\nt = 0\nfor c in s:\n ... | [
0,
1,
2,
3
] |
#!usr/bin/env python3
from argoverse.map_representation.map_api import ArgoverseMap
from frame import Frame
import matplotlib.pyplot as plt
import pickle
import numpy as np
from argo import draw_local_map
# Frames in cluster visualization
def frame_in_pattern_vis(xmin, xmax, ymin, ymax):
dataset = 'ARGO'
if ... | normal | {
"blob_id": "1284de6474e460f0d95f5c76d066b948bce59228",
"index": 5575,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef velocity_field_visualization(xmin, xmax, ymin, ymax):\n with open('data_sample/argo_MixtureModel_%d_%d_%d_%d' % (xmin, xmax,\n ymin, ymax), 'rb') as mix_np:\n mix... | [
0,
1,
2,
3,
4
] |
import django_filters
from .models import Drinks, Brand
class DrinkFilter(django_filters.FilterSet):
BRAND_CHOICES = tuple(
(brand.name, brand.name) for brand in Brand.objects.all())
name = django_filters.CharFilter(lookup_expr='icontains')
price_lt = django_filters.NumberFilter(field_name='price'... | normal | {
"blob_id": "a096e811e50e25e47a9b76b1f813c51f4307bbfe",
"index": 331,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass DrinkFilter(django_filters.FilterSet):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n clas... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
@register.simple_tag
def gender(gender, masculine, feminine, neuter, plurale):
if gender == Obligee.GENDERS.MASCULINE:
return masculine
elif gender == Obligee.GENDERS.FEMININE:
return feminine
elif ge... | flexible | {
"blob_id": "c9d12f14fa0e46e4590746d45862fe255b415a1d",
"index": 396,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@register.simple_tag\ndef gender(gender, masculine, feminine, neuter, plurale):\n if gender == Obligee.GENDERS.MASCULINE:\n return masculine\n elif gender == Obligee.GENDE... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class TestExampleIO(BaseTestIO, unittest.TestCase):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def tearDown(self) ->None:
super().tearDown()
for entity in self.entities_to_test:
... | flexible | {
"blob_id": "e51c0d8c6430603d989d55a64fdf77f9e1a2397b",
"index": 1081,
"step-1": "<mask token>\n\n\nclass TestExampleIO(BaseTestIO, unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def tearDown(self) ->None:\n super().tearDown()\n for entity in self... | [
6,
7,
8,
10,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def test_petite_vue(request):
return render(request, 'petite_vue_app/test-form.html')
<|reserved_special_token_1|>
from django.shortcuts import render
def test_petite_vue(request):
return render(request, 'petite_vue... | flexible | {
"blob_id": "709f2425bc6e0b0b650fd6c657df6d85cfbd05fe",
"index": 84,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_petite_vue(request):\n return render(request, 'petite_vue_app/test-form.html')\n",
"step-3": "from django.shortcuts import render\n\n\ndef test_petite_vue(request):\n r... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
import discord
from discord.ext import commands
from os import path
import os
import datetime as dt
import numpy as np
import math
<|reserved_special_token_1|>
import discord
from discord.ext import commands
from os import path
import os
import datetime as... | flexible | {
"blob_id": "bc8d3a5e3ed845b4ab2d203bec47881be64ba3f8",
"index": 3723,
"step-1": "<mask token>\n",
"step-2": "import discord\nfrom discord.ext import commands\nfrom os import path\nimport os\nimport datetime as dt\nimport numpy as np\nimport math\n",
"step-3": "import discord\nfrom discord.ext import command... | [
0,
1,
2
] |
"""
This is the common util file
"""
from faker import Faker
from pytest_practical.helper.api_helpers import woo_request_helper
fake = Faker()
def generate_random_email_and_password():
"""
Function to generate random email id and password
"""
email = fake.email()
password_string = fake.password(... | normal | {
"blob_id": "0dab663847fdb4efa419882519616b7a89d0bbe8",
"index": 1716,
"step-1": "<mask token>\n\n\ndef generate_random_email_and_password():\n \"\"\"\n Function to generate random email id and password\n \"\"\"\n email = fake.email()\n password_string = fake.password()\n random_info = {'email'... | [
4,
7,
8,
9,
11
] |
"""
The :mod:`sklearn.experimental` module provides importable modules that enable
the use of experimental features or estimators.
The features and estimators that are experimental aren't subject to
deprecation cycles. Use them at your own risks!
"""
| normal | {
"blob_id": "d3952306679d5a4dc6765a7afa19ce671ff4c0b4",
"index": 8501,
"step-1": "<mask token>\n",
"step-2": "\"\"\"\nThe :mod:`sklearn.experimental` module provides importable modules that enable\nthe use of experimental features or estimators.\n\nThe features and estimators that are experimental aren't subje... | [
0,
1
] |
data = {
'title': 'Dva leteca (gostimo na 2)',
'song': [
'x - - - - - x - - - - -',
'- x - - - x - - - x - -',
'- - x - x - - - x - x -',
'- - - x - - - x - - - x'
],
'bpm': 120,
'timeSignature': '4/4'
}
from prog import BellMusicCreator
exportFile = __file__.replac... | normal | {
"blob_id": "957fb1bd34d13b86334da47ac9446e30afd01678",
"index": 5477,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nBellMusicCreator().write(data, fp=exportFile)\n",
"step-3": "data = {'title': 'Dva leteca (gostimo na 2)', 'song': [\n 'x - - - - - x - - - - -', '- x - - - x - - - x - -',\n '- -... | [
0,
1,
2,
3,
4
] |
from __future__ import absolute_import, unicode_literals
from django.db import DataError, IntegrityError, connection
import pytest
from .models import Page
pytestmark = pytest.mark.django_db
MYSQL_REASON = 'MySQL parses check constraints but are ignored by all engines'
def test_match():
Page.objects.create(u... | normal | {
"blob_id": "96065e7e61b63f915561f117d71092e4bfb9a5da",
"index": 1149,
"step-1": "<mask token>\n\n\n@pytest.mark.skipif('connection.vendor == \"mysql\"', reason=MYSQL_REASON)\ndef test_invalid_regex():\n exception = IntegrityError if connection.vendor == 'sqlite' else DataError\n with pytest.raises(excepti... | [
1,
3,
4,
5,
7
] |
<|reserved_special_token_0|>
def render_timestamp(sec, usec):
tt = time.localtime(sec)
return '%04d-%02d-%02dT%02d:%02d:%02d.%06d%s' % (tt.tm_year, tt.tm_mon,
tt.tm_mday, tt.tm_hour, tt.tm_min, tt.tm_sec, usec, get_tzoffset(sec))
<|reserved_special_token_0|>
class EveFilter(object):
def __ini... | flexible | {
"blob_id": "41889456fbb56d263e0039716519e8959316b67e",
"index": 3473,
"step-1": "<mask token>\n\n\ndef render_timestamp(sec, usec):\n tt = time.localtime(sec)\n return '%04d-%02d-%02dT%02d:%02d:%02d.%06d%s' % (tt.tm_year, tt.tm_mon,\n tt.tm_mday, tt.tm_hour, tt.tm_min, tt.tm_sec, usec, get_tzoffset... | [
12,
15,
16,
17,
19
] |
<|reserved_special_token_0|>
def gen_windows(plan_grid, n, m, window_model):
return STRUCT([T([1, 2])([j, i])(gen_cube_windows(plan_grid,
window_model)(i, j, n, m)) for i in range(n) for j in range(m) if
plan_grid[i][j]])
<|reserved_special_token_0|>
def gen_body(plan_grid, n, m):
c = CUBE... | flexible | {
"blob_id": "cb48a1601798f72f9cf3759d3c13969bc824a0f6",
"index": 707,
"step-1": "<mask token>\n\n\ndef gen_windows(plan_grid, n, m, window_model):\n return STRUCT([T([1, 2])([j, i])(gen_cube_windows(plan_grid,\n window_model)(i, j, n, m)) for i in range(n) for j in range(m) if\n plan_grid[i][j]]... | [
5,
7,
8,
9,
11
] |
# Adjust figure when using plt.gcf
ax = fig.gca()
ax.set_aspect('equal')
| normal | {
"blob_id": "24246427e2fde47bbc9d068605301f54c6ecbae5",
"index": 1797,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nax.set_aspect('equal')\n",
"step-3": "ax = fig.gca()\nax.set_aspect('equal')\n",
"step-4": "# Adjust figure when using plt.gcf\nax = fig.gca()\nax.set_aspect('equal')\n",
"step-5": ... | [
0,
1,
2,
3
] |
import uuid
from website.util import api_v2_url
from django.db import models
from osf.models import base
from website.security import random_string
from framework.auth import cas
from website import settings
from future.moves.urllib.parse import urljoin
def generate_client_secret():
return random_string(lengt... | normal | {
"blob_id": "8186b7bddbdcdd730a3f79da1bd075c25c0c3998",
"index": 3131,
"step-1": "<mask token>\n\n\nclass ApiOAuth2Application(base.ObjectIDMixin, base.BaseModel):\n \"\"\"Registration and key for user-created OAuth API applications\n\n This collection is also used by CAS to create the master list of avail... | [
17,
18,
21,
25,
26
] |
from accounts.models import User
from django.forms import ModelForm
from django import forms
from django.contrib.auth.forms import UserCreationForm
class UserRegistrationForm(UserCreationForm):
email = forms.EmailField(required=True)
password1 = forms.CharField(
widget=forms.PasswordInput,
# help_text=password_... | normal | {
"blob_id": "e50517910e191594034f60a021647f4415b6f1c4",
"index": 2822,
"step-1": "<mask token>\n\n\nclass UserRegistrationForm(UserCreationForm):\n <mask token>\n <mask token>\n\n\n class Meta:\n model = User\n fields = 'first_name', 'last_name', 'email', 'password1', 'password2'\n <mas... | [
3,
4,
5,
6,
7
] |
class Solution(object):
def oddCells(self, m, n, indices):
"""
:type m: int
:type n: int
:type indices: List[List[int]]
:rtype: int
"""
indice_x_dict = {}
indice_y_dict = {}
for x, y in indices:
indice_x_dict[x] = indice_x_dict.get... | normal | {
"blob_id": "148b849ae43617dde8dbb0c949defa2f390ce5cd",
"index": 9902,
"step-1": "<mask token>\n",
"step-2": "class Solution(object):\n <mask token>\n",
"step-3": "class Solution(object):\n\n def oddCells(self, m, n, indices):\n \"\"\"\n :type m: int\n :type n: int\n :type i... | [
0,
1,
2
] |
#!/usr/bin/env python3
"""
Calculates the maximization step in the EM algorithm for a GMM
"""
import numpy as np
def maximization(X, g):
"""
Returns: pi, m, S, or None, None, None on failure
"""
if type(X) is not np.ndarray or len(X.shape) != 2:
return None, None, None
if type(g) is not... | normal | {
"blob_id": "a55daebd85002640db5e08c2cf6d3e937b883f01",
"index": 1611,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef maximization(X, g):\n \"\"\"\n Returns: pi, m, S, or None, None, None on failure\n \"\"\"\n if type(X) is not np.ndarray or len(X.shape) != 2:\n return None, No... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with open('election_data.csv') as csvfile:
csvreader = csv.reader(csvfile, delimiter=',')
print(csvreader)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
csvpath = os.path.join('election_data.csv')
with open(... | flexible | {
"blob_id": "800d87a879987c47f1a66b729932279fc8d4fa38",
"index": 7314,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('election_data.csv') as csvfile:\n csvreader = csv.reader(csvfile, delimiter=',')\n print(csvreader)\n",
"step-3": "<mask token>\ncsvpath = os.path.join('election_data.c... | [
0,
1,
2,
3,
4
] |
# from django.urls import path,include
from django.conf.urls import include, url
from . import views
urlpatterns = [
url('buy',views.BuyPage,name='BuyPage'),
url('sell',views.SellPage,name='SellPage'),
url('',views.TradePage,name='TradePage'),
]
| normal | {
"blob_id": "5bbaffb35a89558b5cf0b4364f78d68ff2d69a01",
"index": 5726,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [url('buy', views.BuyPage, name='BuyPage'), url('sell', views\n .SellPage, name='SellPage'), url('', views.TradePage, name='TradePage')]\n",
"step-3": "from django.conf... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class SoftwareTask(Task):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __init__(self, sample_device=None, shared=None):
super(SoftwareTask, self).__init... | flexible | {
"blob_id": "45cdf33f509e7913f31d2c1d6bfada3a84478736",
"index": 2904,
"step-1": "<mask token>\n\n\nclass SoftwareTask(Task):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, sample_device=None, shared=None):\n super(SoftwareTask, self).__... | [
9,
10,
11,
12,
13
] |
class Node:
def __init__(self, info):
self.info = info
self.left = None
self.right = None
self.level = None
def __str__(self):
return str(self.info)
class BinarySearchTree:
def __init__(self):
self.root = None
def create(self, val):
i... | normal | {
"blob_id": "6ee36994f63d64e35c4e76f65e9c4f09797a161e",
"index": 511,
"step-1": "<mask token>\n\n\nclass BinarySearchTree:\n\n def __init__(self):\n self.root = None\n\n def create(self, val):\n if self.root == None:\n self.root = Node(val)\n else:\n current = sel... | [
3,
4,
5,
8,
9
] |
<|reserved_special_token_0|>
def normalize_mac_address(address):
return address.lower().replace('-', ':')
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def normalize_mac_address(address):
return address.lower().replace('-', ':')
def urlencode(s):
return ur... | flexible | {
"blob_id": "33b8baf2ca819315eaa5f16c7986390acb4d6efd",
"index": 878,
"step-1": "<mask token>\n\n\ndef normalize_mac_address(address):\n return address.lower().replace('-', ':')\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef normalize_mac_address(address):\n return address.lower().replace('-', ':... | [
1,
2,
3,
4,
5
] |
<|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_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.... | flexible | {
"blob_id": "1ea61ab4003de80ffe9fb3e284b6686d4bf20b15",
"index": 787,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = Tr... | [
0,
1,
2,
3,
4
] |
from os.path import exists
from_file = input('form_file')
to_file = input('to_file')
print(f"copying from {from_file} to {to_file}")
indata = open(from_file).read()#这种方式读取文件后无需close
print(f"the input file is {len(indata)} bytes long")
print(f"does the output file exist? {exists(to_file)}")
print("return to continue,... | normal | {
"blob_id": "4f0933c58aa1d41faf4f949d9684c04f9e01b473",
"index": 36,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(f'copying from {from_file} to {to_file}')\n<mask token>\nprint(f'the input file is {len(indata)} bytes long')\nprint(f'does the output file exist? {exists(to_file)}')\nprint('return t... | [
0,
1,
2,
3,
4
] |
N=input()
l=map(int,raw_input().split())
l.sort()
flag=0
if l[0]<0:
print 'False'
else:
for i in l:
if str(i)==str(i)[::-1]:
flag=flag+1
if flag>=1:
print 'True'
else:
print 'False'
| normal | {
"blob_id": "21050d66120787c1260efd42bb6456d7131fcc6b",
"index": 6101,
"step-1": "N=input()\nl=map(int,raw_input().split())\nl.sort()\nflag=0\n\nif l[0]<0:\n print 'False'\nelse:\n for i in l:\n if str(i)==str(i)[::-1]:\n flag=flag+1\n if flag>=1:\n print 'True'\n else:\n ... | [
0
] |
from django.contrib import admin
from django.urls import path
from petsApp import views
urlpatterns = [
path('user/<int:id>/', views.getUser),
path('user/addImage/', views.addImage),
path('user/getImage/<int:id>/', views.getImage),
path('user/signup/', views.signUp),
path('user/login/', views.logI... | normal | {
"blob_id": "2458b8169029b3af501b650d548925770b0da74e",
"index": 6656,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [path('user/<int:id>/', views.getUser), path('user/addImage/',\n views.addImage), path('user/getImage/<int:id>/', views.getImage), path(\n 'user/signup/', views.signUp... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
plt.imshow(a, interpolation='nearest', cmap='bone', origin='upper')
plt.colorbar()
plt.xticks(())
plt.yticks(())
plt.show()
<|reserved_special_token_1|>
<|reserved_special_token_0|>
a = np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0... | flexible | {
"blob_id": "f01f97f8998134f5e4b11232d1c5d341349c3c79",
"index": 4074,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nplt.imshow(a, interpolation='nearest', cmap='bone', origin='upper')\nplt.colorbar()\nplt.xticks(())\nplt.yticks(())\nplt.show()\n",
"step-3": "<mask token>\na = np.array([0.1, 0.2, 0.3,... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in range(len(p_i)):
if p_i[i] > p_cr:
x.append(u_ie[i])
else:
x.append(u_ip[i])
<|reserved_special_token_0|>
for i in range(len(x_)):
if x_[i] < 0:
x__.append(u_ix_a[i])
else:
... | flexible | {
"blob_id": "f9cc9348d36c131aa3d34e4f78f67b008a1b565a",
"index": 7121,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(len(p_i)):\n if p_i[i] > p_cr:\n x.append(u_ie[i])\n else:\n x.append(u_ip[i])\n<mask token>\nfor i in range(len(x_)):\n if x_[i] < 0:\n x__.a... | [
0,
1,
2,
3,
4
] |
points_dict = {
'+': 5,
'-': 4,
'*': 3,
'/': 2,
'(': -1,
}
op_list = ['+','-','*','/']
def fitness(x1,op,x2):
#Mengembalikan point dari penyambungan expresi dengan operasi dan bilangan berikutnya
try:
hasil = eval(f"{x1} {op} {x2}")
diff = points_dict[op] - abs(24-hasil)
... | normal | {
"blob_id": "c420fb855fbf5691798eadca476b6eccec4aee57",
"index": 7409,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef calc_points(expr):\n points = 0\n hasil = eval(expr)\n points -= abs(24 - hasil)\n for c in expr:\n points += points_dict.get(c, 0)\n return points\n\n\ndef ... | [
0,
3,
5,
6,
7
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.