code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
from django.db import models # Create your models here. class person(models.Model): name=models.CharField(max_length=20,unique=True) age=models.IntegerField() email=models.CharField(max_length=20,unique=True) phone=models.CharField(max_length=10, unique=True) gender=models.CharField(max_length=10) ...
normal
{ "blob_id": "efe5df4005dbdb04cf4e7da1f350dab483c94c92", "index": 4459, "step-1": "<mask token>\n\n\nclass person(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask ...
[ 1, 2, 3, 4, 5 ]
def Hello_worlder(x): a = [] for i in range(x): a.append('Hello world') for i in a: print(i) Hello_worlder(10)
normal
{ "blob_id": "4f116f3eec9198a56a047ab42ed8e018ebb794bb", "index": 3528, "step-1": "<mask token>\n", "step-2": "def Hello_worlder(x):\n a = []\n for i in range(x):\n a.append('Hello world')\n for i in a:\n print(i)\n\n\n<mask token>\n", "step-3": "def Hello_worlder(x):\n a = []\n f...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @got_request_exception.connect def log_exception_to_sentry(app, exception=None, **kwargs): """ Logs an exception to sentry. :param app: The current application :param exception: The exception that occurred "...
flexible
{ "blob_id": "f739fb56eae1ada2409ef7d75958bad2018f5134", "index": 2743, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@got_request_exception.connect\ndef log_exception_to_sentry(app, exception=None, **kwargs):\n \"\"\"\n Logs an exception to sentry.\n\n :param app: The current application\n ...
[ 0, 1, 2, 3 ]
#!/usr/bin/python import socket import sys host = '10.211.55.5' port = 69 try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) except: print "socket() failed" sys.exit(1) filename = "Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2Ad3Ad4Ad5Ad6Ad7...
normal
{ "blob_id": "b318f5d443dbf8e4442707839649149e75653295", "index": 5917, "step-1": "#!/usr/bin/python \nimport socket \nimport sys\n\nhost = '10.211.55.5' \nport = 69\ntry:\n s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) \nexcept:\n print \"socket() failed\" \n sys.exit(1)\nfilename = \"Aa0Aa1Aa2Aa...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.extend(['detection', 'train']) <|reserved_special_token_0|> if test_mode in ['RNet', 'ONet']: detectors[1] = Detector(R_Net, 24, batch_size[1], model_path[1]) if test_mode == 'ONet': detectors[2] = Detecto...
flexible
{ "blob_id": "f97a892e6e0aa258ad917c4a73a66e89b0dc3253", "index": 267, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.extend(['detection', 'train'])\n<mask token>\nif test_mode in ['RNet', 'ONet']:\n detectors[1] = Detector(R_Net, 24, batch_size[1], model_path[1])\n if test_mode == 'ONet':\...
[ 0, 1, 2, 3, 4 ]
__author__ = 'dongdaqing' import threading,time class MyThread(threading.Thread): def __init__(self, name=None): threading.Thread.__init__(self) self.name = name def run(self): print time.strftime('%Y-%m-%d %H-%M-%S',time.localtime()) print self.name def test(): for i in r...
normal
{ "blob_id": "9c277030ef384d60e62c2c48e38a1271a43826d6", "index": 3557, "step-1": "__author__ = 'dongdaqing'\n\nimport threading,time\nclass MyThread(threading.Thread):\n def __init__(self, name=None):\n threading.Thread.__init__(self)\n self.name = name\n\n def run(self):\n print time....
[ 0 ]
"""Файл, который запускается при python qtester """
normal
{ "blob_id": "90fc6590dab51141124ca73082b8d937008ae782", "index": 7400, "step-1": "<mask token>\n", "step-2": "\"\"\"Файл, который запускается при python qtester\n\"\"\"", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
import os import os.path import numpy as np import pickle import codecs from konlpy.tag import Okt from hyperparams import params from gensim.models import FastText #tokenizer tokenizer = Okt() def make_word_dictionary(word_dict_pkl_path=params['default_word_dict_pkl_path'], training_data_path = params['d...
normal
{ "blob_id": "430e971d2ae41bfd60e7416ecb2c26bb08e4df45", "index": 6520, "step-1": "<mask token>\n\n\ndef make_word_dictionary(word_dict_pkl_path=params[\n 'default_word_dict_pkl_path'], training_data_path=params[\n 'default_training_data_path']):\n word_dict = dict()\n if os.path.isfile(word_dict_pkl_...
[ 1, 3, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('a is type:', type(a)) print('c is type:', type(c)) print('e is type:', type(e)) print(a + b) print(d / c) print(b / a) print(b // a) print(e) print(e + f) print(sys.float_info) <|reserved_special_token_1|> <|reserved_spe...
flexible
{ "blob_id": "2876c9f8db0395143b165b855b22e364e3cc8121", "index": 9008, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('a is type:', type(a))\nprint('c is type:', type(c))\nprint('e is type:', type(e))\nprint(a + b)\nprint(d / c)\nprint(b / a)\nprint(b // a)\nprint(e)\nprint(e + f)\nprint(sys.float_...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_xyz123(): cone_x = bc.primitives.Cone(1.0, 1.0) <|reserved_special_token_1|> __author__ = 'jjpr' <|reserved_special_token_0|> def test_xyz123(): cone_x = bc.primitives.Cone(1.0, 1.0) <|reserved_special_to...
flexible
{ "blob_id": "e6af221f1d6397d0fc52671cdd27d43549d0aecb", "index": 513, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_xyz123():\n cone_x = bc.primitives.Cone(1.0, 1.0)\n", "step-3": "__author__ = 'jjpr'\n<mask token>\n\n\ndef test_xyz123():\n cone_x = bc.primitives.Cone(1.0, 1.0)\n", ...
[ 0, 1, 2, 3 ]
import sys import random import pygame import pygame.locals import time # TODO high scores, difficulties # Absolutes (in pixels where not otherwise stated) CELL_SIDE_LENGTH = 40 # Side length of each cell CELL_MARGIN = 2 # Gap between cells GRID_HEIGHT = 10 # How many cells are in the grid GRID_WIDTH = 10 X_...
normal
{ "blob_id": "030bc0c7bdbbb09f722ffe4c82866726062f5317", "index": 1962, "step-1": "<mask token>\n\n\nclass Game:\n\n def __init__(self):\n pygame.init()\n global CLOCK, SURFACE\n CLOCK = pygame.time.Clock()\n SURFACE = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT))\n ...
[ 10, 16, 17, 21, 22 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def file_name(file_dir): root_tmp = [] dirs_tmp = [] files_tmp = [] for root, dirs, files in os.walk(file_dir): root_tmp.append(root) dirs_tmp.append(dirs) files_tmp.append(files) retu...
flexible
{ "blob_id": "96d5cf948a9b0f622889977e8b26993299bceead", "index": 770, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef file_name(file_dir):\n root_tmp = []\n dirs_tmp = []\n files_tmp = []\n for root, dirs, files in os.walk(file_dir):\n root_tmp.append(root)\n dirs_tmp.app...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(robot) <|reserved_special_token_0|> print(T) <|reserved_special_token_0|> print(sol.q) print(robot.fkine(sol.q)) <|reserved_special_token_0|> robot.plot(qtraj.q, movie='panda1.gif') <|reserved_special_token_0|> print(robot) ...
flexible
{ "blob_id": "cc1a1491ffbcf470705aeea079faac290dbaa25e", "index": 5965, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(robot)\n<mask token>\nprint(T)\n<mask token>\nprint(sol.q)\nprint(robot.fkine(sol.q))\n<mask token>\nrobot.plot(qtraj.q, movie='panda1.gif')\n<mask token>\nprint(robot)\n<mask token...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class RidgeLinearModel: <|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|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "a5dcc66ece4e58995fe86c3a399c45975a596b1a", "index": 5836, "step-1": "<mask token>\n\n\nclass RidgeLinearModel:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mas...
[ 6, 10, 11, 12, 13 ]
<|reserved_special_token_0|> class ForwardBackward(BaseTagger): <|reserved_special_token_0|> <|reserved_special_token_0|> def probabilities(self): """ Return the probabilities of a hidden state sequence given observed output sequence :return: """ raise NotImplement...
flexible
{ "blob_id": "8cc0314d48f81ceead863245443548297e8188f8", "index": 9610, "step-1": "<mask token>\n\n\nclass ForwardBackward(BaseTagger):\n <mask token>\n <mask token>\n\n def probabilities(self):\n \"\"\"\n Return the probabilities of a hidden state sequence given observed output sequence\n ...
[ 3, 4, 5, 7, 8 ]
<|reserved_special_token_0|> class Dataset_conf_ds(object): <|reserved_special_token_0|> def __init__(self, id_ds_conf_ds=-1, value_configuration=-1, FK_id_configuration_DCT_DCD=-1, FK_id_dataset_DS_DCD=-1): """ Constructor of the DDI_interactionDB object. All the parameters have a de...
flexible
{ "blob_id": "76d2c3f74e8fae160396b4015ccec478dba97b87", "index": 7422, "step-1": "<mask token>\n\n\nclass Dataset_conf_ds(object):\n <mask token>\n\n def __init__(self, id_ds_conf_ds=-1, value_configuration=-1,\n FK_id_configuration_DCT_DCD=-1, FK_id_dataset_DS_DCD=-1):\n \"\"\"\n Cons...
[ 2, 3, 5, 6, 7 ]
import os import re import click import pandas as pd from pymongo import MongoClient from pathlib import Path, PurePath def extract_dir_name(input_file): """ creates a directory path based on the specified file name :param input_file: file bane :return: full path, minus extension """ ...
normal
{ "blob_id": "f831b77850dfe22232092f66705e36970828a75b", "index": 4975, "step-1": "<mask token>\n\n\ndef open_dir(input_path, patterns):\n \"\"\"\n Opens the specified input path and returns any located excel file\n :param patterns: the file extensions to glob over (eg xls, csv)\n :param input_path: t...
[ 1, 2, 3, 5, 6 ]
<|reserved_special_token_0|> def init2(data): data.tbg = PhotoImage(file='tbg2.gif') data.click = PhotoImage(file='click.gif') data.notClick = PhotoImage(file='notClick.gif') data.player1X = 150 data.player1Y = 750 data.player2X = 550 data.player2Y = 750 data.winner = None data.spe...
flexible
{ "blob_id": "c893095be88636e6cb06eb3b939d8106fbb7a8ca", "index": 470, "step-1": "<mask token>\n\n\ndef init2(data):\n data.tbg = PhotoImage(file='tbg2.gif')\n data.click = PhotoImage(file='click.gif')\n data.notClick = PhotoImage(file='notClick.gif')\n data.player1X = 150\n data.player1Y = 750\n ...
[ 66, 79, 82, 95, 104 ]
# GeoPy can be used to interface to map box https://pypi.org/project/geopy/ from pygeodesy.ellipsoidalVincenty import LatLon from geojson import Polygon, Feature, FeatureCollection, dump import sys import random BEARING_SOUTH = 180.0 BEARING_EAST = 90.0 class Cell(object): def __init__(self, cellId, top_left_cel...
normal
{ "blob_id": "01f0ad8746ed9a9941faa699b146625ad3a0b373", "index": 4289, "step-1": "<mask token>\n\n\nclass Cell(object):\n\n def __init__(self, cellId, top_left_cell, top_right_cell,\n bottom_right_cell, bottom_left_cell):\n self.cellId = cellId\n self.top_left_cell = top_left_cell\n ...
[ 6, 7, 8, 9, 11 ]
# Copyright (c) 2015 OpenStack Foundation. # # All Rights Reserved. # # 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 # # Unle...
normal
{ "blob_id": "89a3c34b3145b93a4cfa78eeb055c8136ab2bfe6", "index": 2084, "step-1": "<mask token>\n\n\nclass OvsApi(object):\n <mask token>\n\n def __init__(self, ip, protocol='tcp', port='6640', timeout=10):\n super(OvsApi, self).__init__()\n self.ip = ip\n self.protocol = protocol\n ...
[ 18, 23, 25, 27, 35 ]
<|reserved_special_token_0|> class Grade(NamedTuple): score: int message: str comments: List[Comment] def clear(): os.system('cls' if os.name == 'nt' else 'clear') <|reserved_special_token_0|> def complete(comment): if comment.fields: print('Please provide supplementary information:'...
flexible
{ "blob_id": "bec3d8546cd7d27f7da48f5658480cf17c36a255", "index": 9462, "step-1": "<mask token>\n\n\nclass Grade(NamedTuple):\n score: int\n message: str\n comments: List[Comment]\n\n\ndef clear():\n os.system('cls' if os.name == 'nt' else 'clear')\n\n\n<mask token>\n\n\ndef complete(comment):\n if...
[ 9, 12, 13, 14, 17 ]
<|reserved_special_token_0|> def write_list(list): wb = openpyxl.Workbook() sheet = wb.active sheet.title = 'test' value = list for i in range(0, len(value)): for j in range(0, len(value[i])): sheet.cell(row=i + 1, column=j + 1, value=str(value[i][j])) wb.save('city.xlsx') ...
flexible
{ "blob_id": "f75e0ddf42cc9797cdf1c4a4477e3d16441af740", "index": 5478, "step-1": "<mask token>\n\n\ndef write_list(list):\n wb = openpyxl.Workbook()\n sheet = wb.active\n sheet.title = 'test'\n value = list\n for i in range(0, len(value)):\n for j in range(0, len(value[i])):\n sh...
[ 1, 2, 3, 4, 5 ]
# 遍历(循环) 出字符串中的每一个元素 str01 = "大发放而非asdfasfasdfa,,,,aadfa阿斯顿发水电费&&" # ----->字符串中的元素都是有索引的,根据索引可以得到对应的元素 # 而---3 a = str01[3] print(str01[3]) # 发---1 print(str01[1]) #---->计算字符串的长度 # 这个字符串中 有 35个元素 ,长度是35 l01 = len(str01) print(l01) str01 = "大放而非asdfasfasdfa,,,,aadfa阿斯顿发水电费&&" # 最后一个元素的索引:字符串...
normal
{ "blob_id": "7262d7a82834b38762616a30d4eac38078e4b616", "index": 6724, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(str01[3])\nprint(str01[1])\n<mask token>\nprint(l01)\n<mask token>\nwhile i <= index_last:\n print(str01[i])\n i += 1\nprint()\nprint('上面的循环结束了 执行到这里')\n<mask token>\n", "st...
[ 0, 1, 2, 3 ]
from django import forms class TeacherForm(forms.Form): name = forms.CharField(label='Your Name', max_length=100, widget=forms. TextInput(attrs={'class': 'form-control text-center w-75 mx-auto'})) email = forms.EmailField(widget=forms.TextInput(attrs={'class': 'form-control text-center w-75 mx...
normal
{ "blob_id": "7c5877eea78c3fa8b7928219edd52e2502c16c09", "index": 6392, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TeacherForm(forms.Form):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TeacherForm(forms.Form):\n name = forms.CharField(label='Your Name', max...
[ 0, 1, 2, 3 ]
# Copyright (c) 2017, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import unittest from distutils.version import StrictVersion import numpy as np from coremltools._deps ...
normal
{ "blob_id": "d3d90b8ccd0ec449c84ac0316c429b33353f4518", "index": 8900, "step-1": "<mask token>\n\n\n@unittest.skipIf(not _HAS_SKLEARN, 'Missing sklearn. Skipping tests.')\nclass ImputerTestCase(unittest.TestCase):\n <mask token>\n\n @classmethod\n def setUpClass(self):\n \"\"\"\n Set up th...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in arr: img = cv2.imread(i) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) img = cv2.resize(img, (32, 32)) img = img_to_array(img) img = np.expand_dims(img, axis=0) k = model.predict(img)[0] k = np.ar...
flexible
{ "blob_id": "c3e2bd635a7ff558ed56e7fb35e8b10e1c660c88", "index": 6804, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in arr:\n img = cv2.imread(i)\n img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)\n img = cv2.resize(img, (32, 32))\n img = img_to_array(img)\n img = np.expand_dims(img, axi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> conn.request('POST', '/api/v1/testsuites', payload, headers) <|reserved_special_token_0|> conn.request('POST', '/api/v1/testsuites', payload, headers) <|reserved_special_token_0|> conn.request('POST', '/api/v1/testcases', payload,...
flexible
{ "blob_id": "0cc1aaa182fcf002ff2ae6cbcd6cbb84a08a3bc1", "index": 936, "step-1": "<mask token>\n", "step-2": "<mask token>\nconn.request('POST', '/api/v1/testsuites', payload, headers)\n<mask token>\nconn.request('POST', '/api/v1/testsuites', payload, headers)\n<mask token>\nconn.request('POST', '/api/v1/testca...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @app.route('/') def hello_world(): return render_template('index.html') <|reserved_special_token_0|> @app.route('/off/') def off(): state = powerswitch.off() return json.dumps(state) @app.route('/toggle/') def toggle(): state = powerswitch.toggle() return json.du...
flexible
{ "blob_id": "18d3f58048b7e5d792eb2494ecc62bb158ac7407", "index": 254, "step-1": "<mask token>\n\n\n@app.route('/')\ndef hello_world():\n return render_template('index.html')\n\n\n<mask token>\n\n\n@app.route('/off/')\ndef off():\n state = powerswitch.off()\n return json.dumps(state)\n\n\n@app.route('/to...
[ 4, 6, 7, 8, 9 ]
from world.enums import * from world.content.species import SPECIES from world.content.chargen import * from evennia.utils.evmenu import get_input from evennia.utils.utils import list_to_string import re def start(caller): if not caller: return caller.ndb._menutree.points = { "attributes": 20, ...
normal
{ "blob_id": "99eeb039e1a369e450247d10ba22a1aa0b35dae9", "index": 6875, "step-1": "<mask token>\n\n\ndef start(caller):\n if not caller:\n return\n caller.ndb._menutree.points = {'attributes': 20, 'skills': 20}\n caller.ndb._menutree.character = {'home_planet': None, 'full_name':\n None, 'o...
[ 14, 15, 19, 22, 27 ]
<|reserved_special_token_0|> @app.callback(Output(component_id='global-box-1', component_property= 'figure'), [Input(component_id='global-dropdown', component_property= 'value')]) def global_update(select_global): if select_global == 'Global Cases Trend' or select_global is None: fig1000 = [] ...
flexible
{ "blob_id": "1e02d584cde0cdf251aa36abd27b683219ef87ed", "index": 7539, "step-1": "<mask token>\n\n\n@app.callback(Output(component_id='global-box-1', component_property=\n 'figure'), [Input(component_id='global-dropdown', component_property=\n 'value')])\ndef global_update(select_global):\n if select_gl...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class SoftMaxTrainer: def __init__(self, net): self.model = L.Classifier(net) def set_train_data(self, train_x, train_t, valid_x, valid_t, n_batch): train = tuple_dataset.TupleDataset(train_x, train_t) test = tuple_dataset.TupleDataset(valid_x, valid_t) ...
flexible
{ "blob_id": "474700968e563d34d6a0296ec62950e2e71fe1b0", "index": 1671, "step-1": "<mask token>\n\n\nclass SoftMaxTrainer:\n\n def __init__(self, net):\n self.model = L.Classifier(net)\n\n def set_train_data(self, train_x, train_t, valid_x, valid_t, n_batch):\n train = tuple_dataset.TupleDatas...
[ 4, 5, 6, 7, 8 ]
# Exercise 1 - linear.py import numpy as np import keras # Build the model model = keras.Sequential([keras.layers.Dense(units=1,input_shape=[1])]) # Set the loss and optimizer function model.compile(optimizer='sgd', loss='mean_squared_error') # Initialize input data xs = np.array([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype=...
normal
{ "blob_id": "c8fecb6bfbd39e7a82294c9e0f9e5eaf659b7fed", "index": 1610, "step-1": "<mask token>\n", "step-2": "<mask token>\nmodel.compile(optimizer='sgd', loss='mean_squared_error')\n<mask token>\nmodel.fit(xs, ys, epochs=500)\n<mask token>\nprint(model.predict(dataIn, 1, 1))\n", "step-3": "<mask token>\nmod...
[ 0, 1, 2, 3, 4 ]
class Privacy: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Privacy: def __init__(self, val): self.__val = 900 print('Private data member =', self.__val, '\n') <|reserved_special_token_0|> <|reserved_special_token_1|> class Privacy: ...
flexible
{ "blob_id": "b767519229058b50183d78bb97121f050e5b6bad", "index": 423, "step-1": "class Privacy:\n <mask token>\n\n\n<mask token>\n", "step-2": "class Privacy:\n\n def __init__(self, val):\n self.__val = 900\n print('Private data member =', self.__val, '\\n')\n\n\n<mask token>\n", "step-3"...
[ 1, 2, 3, 4, 5 ]
import time import ephem import serial import nmea import orientation import sys import threading from geomag import geomag #Constants initial_az = 180 initial_alt = 90 min_elevation = 10.0 sleep_time = 1.0 unwind_threshold = 180 sleep_on_unwind = 45.0 last_lon = '-88.787' last_lat = '41.355' last_heading = 0.0 moun...
normal
{ "blob_id": "468b5bd8d7b045ca8dd46c76a1829fc499e16950", "index": 5756, "step-1": "<mask token>\n\n\nclass SerialTester:\n\n def write(self, line):\n print(line)\n\n def read(self, num):\n return\n\n\nclass Antenna:\n azimuth = initial_az\n altitude = initial_alt\n parked = True\n\n ...
[ 15, 18, 21, 25, 26 ]
<|reserved_special_token_0|> class CohortTest(TestCase): def testAnalyzeNewGroups(self): cohort = Cohort(aStartDate=TimeFormatter.toDatetime( '2014-05-05 00:00:00'), aEndDate=TimeFormatter.toDatetime( '2014-06-01 23:59:59'), aInterval=7) groups = cohort.groups grou...
flexible
{ "blob_id": "f12bdfc054e62dc244a95daad9682790c880f20d", "index": 5367, "step-1": "<mask token>\n\n\nclass CohortTest(TestCase):\n\n def testAnalyzeNewGroups(self):\n cohort = Cohort(aStartDate=TimeFormatter.toDatetime(\n '2014-05-05 00:00:00'), aEndDate=TimeFormatter.toDatetime(\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def dashboard(request): context = {'context_list': ContextDefinition.objects.filter(Q(owner= request.user) & Q(inherited=False) & Q(abstract=False)).order_by( '-public', 'name'), 'full_abstract_list': get_list_allowed_abstract (request), 'my_abstract_list': Con...
flexible
{ "blob_id": "4db8b4403dd9064b7d5f935d4b9d111508c965fb", "index": 1268, "step-1": "<mask token>\n\n\ndef dashboard(request):\n context = {'context_list': ContextDefinition.objects.filter(Q(owner=\n request.user) & Q(inherited=False) & Q(abstract=False)).order_by(\n '-public', 'name'), 'full_abstr...
[ 1, 3, 4, 5, 6 ]
import os from pathlib import Path DEFAULT_ROOT_PATH = Path(os.path.expanduser(os.getenv("PLOTTER_ROOT", "~/.plotter/mainnet"))).resolve()
normal
{ "blob_id": "3a8164299fa51b7d781f2b80d77cfba05b5f6915", "index": 4157, "step-1": "<mask token>\n", "step-2": "<mask token>\nDEFAULT_ROOT_PATH = Path(os.path.expanduser(os.getenv('PLOTTER_ROOT',\n '~/.plotter/mainnet'))).resolve()\n", "step-3": "import os\nfrom pathlib import Path\nDEFAULT_ROOT_PATH = Path...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in a: if i.isalpha(): b.append(i) else: ind.append(a.index(i)) <|reserved_special_token_0|> for i in ind: c.insert(i, a[i]) print(''.join(c)) <|reserved_special_token_1|> a = input() b = [] ind...
flexible
{ "blob_id": "8fedaeb13fde117cf6b7ace23b59c26e4aab2bc2", "index": 4492, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in a:\n if i.isalpha():\n b.append(i)\n else:\n ind.append(a.index(i))\n<mask token>\nfor i in ind:\n c.insert(i, a[i])\nprint(''.join(c))\n", "step-3": "a ...
[ 0, 1, 2 ]
from api import * version_api = api(0) def is_bad_version(v): return version_api.is_bad(v) def first_bad_version(n): # -- DO NOT CHANGE THIS SECTION version_api.n = n # -- api_calls_count = 0 left, right = 1, n while left < right: mid = (left + right) // 2 is_bad = is_bad_versio...
normal
{ "blob_id": "df4c03d9faedf2d347593825c7221937a75a9c10", "index": 5360, "step-1": "<mask token>\n\n\ndef is_bad_version(v):\n return version_api.is_bad(v)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef is_bad_version(v):\n return version_api.is_bad(v)\n\n\ndef first_bad_version(n):\n version_ap...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/python # coding=utf-8 import re str1 = 'http://www.chinapesticide.org.cn/myquery/querydetail?pdno=' str2 = '&pdrgno=' f = open('aaa.txt', 'r') source = f.read() rr = re.compile(r'open[(\'](.*)[\']') s=rr.findall(source) for line in s: temps = line.split(',') a = temps[0] b = temps[1] print ...
normal
{ "blob_id": "387c48fcf00480a820fb407f5bad1d9f41b28e7a", "index": 9160, "step-1": "#!/usr/bin/python\n# coding=utf-8\n\nimport re\n\nstr1 = 'http://www.chinapesticide.org.cn/myquery/querydetail?pdno='\nstr2 = '&pdrgno='\nf = open('aaa.txt', 'r')\nsource = f.read()\nrr = re.compile(r'open[(\\'](.*)[\\']')\ns=rr.fi...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def count_words(sentence): sentence = re.findall("\\b[\\w'-]+\\b", sentence.lower().replace('_', ' ')) counts = defaultdict(lambda : 0) for word in sentence: counts[word] += 1 return counts <|reserved_s...
flexible
{ "blob_id": "7f5f16ea10980e0ade7357cdae38f47f8d7cdf01", "index": 2446, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef count_words(sentence):\n sentence = re.findall(\"\\\\b[\\\\w'-]+\\\\b\", sentence.lower().replace('_', ' '))\n counts = defaultdict(lambda : 0)\n for word in sentence:\n ...
[ 0, 1, 2, 3 ]
import math import numpy as np from statistics import median from src.filter.median import quickselect_median def bilateral_median_filter(flow, log_occlusen, auxiliary_field, image, weigth_auxiliary, weigth_filter, sigma_distance = 7, sigma_color =7 / 200, filter_size=5): """ :par...
normal
{ "blob_id": "1748c8dfcc3974b577d7bfacb5cabe4404b696bc", "index": 612, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef bilateral_median_filter(flow, log_occlusen, auxiliary_field, image,\n weigth_auxiliary, weigth_filter, sigma_distance=7, sigma_color=7 / 200,\n filter_size=5):\n \"\"\"\n\...
[ 0, 1, 2, 3 ]
<|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": "96bb865b66e5d9ba62bab210705338f1799cc490", "index": 7022, "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 = [('userProfile...
[ 0, 1, 2, 3, 4 ]
import shutil total, used, free = shutil.disk_usage("/") print("Total: %d MiB" % (total // (2**20))) print("Used: %d MiB" % (used // (2**20))) print("Free: %d MiB" % (free // (2**20))) from Camera import Camera import time import cv2 devices = Camera.getDevicesList() print(devices) i=0 Cameras = [] for device in...
normal
{ "blob_id": "5cdedce5f984f53b8e26d1580a9040b26023f247", "index": 2910, "step-1": "<mask token>\n\n\ndef gen(task_id):\n while True:\n print('Thread runned ' + str(task_id))\n img = Cameras[task_id].getImg()\n ret, jpeg = cv2.imencode('.jpg', img)\n frame = jpeg.tobytes()\n y...
[ 6, 7, 8, 9, 10 ]
# -*- coding: utf-8 -*- from __future__ import print_function, absolute_import, unicode_literals, division __all__ = ['getLevelName', 'getLevel'] #, 'getLevelOrName', '_checkLevel'] import logging # private re-implementations till Python Core fixes Lib/logging # XXX bug numbers here def getLevelName(level, format='...
normal
{ "blob_id": "ba8b46f830abaaaedf1730cba2f04fd677f11da4", "index": 182, "step-1": "<mask token>\n\n\ndef getLevel(levelName, no_match=logging.NOTSET):\n \"\"\"Return the numeric representation of levelName.\n\n see getLevelName() for background\n \"\"\"\n try:\n result = logging._nameToLevel.get...
[ 2, 3, 5, 6, 7 ]
# -*- coding: utf-8 -*- try: from greenlet import getcurrent as get_current_greenlet except ImportError: get_current_greenlet = int from thread import get_ident as get_current_thread from threading import Lock if get_current_greenlet is int: # Use thread get_ident = get_current_thread else: # Use gree...
normal
{ "blob_id": "f55b286448f114f3823f099a576af7bec1780a8c", "index": 461, "step-1": "<mask token>\n\n\nclass Local(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __delattr__(self, item):\n self.__lock__.acquire()\n try:\n try:\n ...
[ 8, 11, 12, 15, 16 ]
# -*- coding: utf-8 -*- """Labeled entry widget. The goal of these widgets is twofold: to make it easier for developers to implement dialogs with compound widgets, and to naturally standardize the user interface presented to the user. """ import logging import seamm_widgets as sw import tkinter as tk import tkinter....
normal
{ "blob_id": "111186f1d45b9cf3bf9065c7fa83a8f3f796bbe1", "index": 5841, "step-1": "<mask token>\n\n\nclass LabeledEntry(sw.LabeledWidget):\n <mask token>\n\n @property\n def value(self):\n return self.get()\n <mask token>\n\n def show(self, *args):\n \"\"\"Show only the specified subw...
[ 5, 6, 8, 9, 11 ]
from django.urls import path from photo.api.views import api_photo_detail_view, api_photos_view urlpatterns = [path('<int:id>', api_photo_detail_view, name='user_detail'), path('', api_photos_view, name='users')]
normal
{ "blob_id": "ab4145ccc0b360dcca9b9aa6ebe919bdddac65a2", "index": 3962, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('<int:id>', api_photo_detail_view, name='user_detail'),\n path('', api_photos_view, name='users')]\n", "step-3": "from django.urls import path\nfrom photo.api.vie...
[ 0, 1, 2 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- help_txt = """ :help, show this help menu. :help [command] for detail :dict [word], only find translation on dict.cn :google [sentence], only find translation on google api :lan2lan [sentence], translate from one language to another language :add [word], add new word to yo...
normal
{ "blob_id": "3fadb91bd2367819a540f687530f4b48ed878423", "index": 9149, "step-1": "<mask token>\n", "step-2": "help_txt = \"\"\"\n:help, show this help menu. :help [command] for detail\n:dict [word], only find translation on dict.cn\n:google [sentence], only find translation on google api\n:lan2lan [sentence], ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def http_server(file: str=None, host: str='localhost', port: int=5050 ) ->CanvasServer: """Creates a new HTTP server for displaying the network, using WebSockets to transmit data. The server will only start once its :meth:`~server.CanvasServer.start` method is called. Afte...
flexible
{ "blob_id": "b11e2837d3ba9c14770b8039186a2175adc41ea1", "index": 283, "step-1": "<mask token>\n\n\ndef http_server(file: str=None, host: str='localhost', port: int=5050\n ) ->CanvasServer:\n \"\"\"Creates a new HTTP server for displaying the network, using WebSockets to\n transmit data. The server will ...
[ 1, 2, 3, 4, 5 ]
from appJar import gui app = gui("Calculator", "560x240") ### FUNCTIONS ### n1, n2 = 0.0, 0.0 result = 0.0 isFirst = True calc = "" def doMath(btn): global result, n1, n2, isFirst, calc inputNumber() if(btn == "Add"): calc = "a" if(btn == "Substract"): calc = "s" if(btn == "Multiply"): calc =...
normal
{ "blob_id": "084299da1c2f41de96e60d37088466c7b61de38e", "index": 9750, "step-1": "<mask token>\n\n\ndef doMath(btn):\n global result, n1, n2, isFirst, calc\n inputNumber()\n if btn == 'Add':\n calc = 'a'\n if btn == 'Substract':\n calc = 's'\n if btn == 'Multiply':\n calc = 'm...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def fibonaci(n): for i in range(0, n): j = 1 i = i + j j = i return fibonaci <|reserved_special_token_1|> def ep(m, h, el, g=9.8): E = m * h * g if E < el: print('le plus grand ...
flexible
{ "blob_id": "869284fa531a93c1b9812ed90a560d0bb2f87e97", "index": 255, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fibonaci(n):\n for i in range(0, n):\n j = 1\n i = i + j\n j = i\n return fibonaci\n", "step-3": "def ep(m, h, el, g=9.8):\n E = m * h * g\n if E...
[ 0, 1, 2, 3, 4 ]
from paper_processor import PaperProcessor import logging logging.basicConfig( level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') q = "levamisole inhibitor" p = PaperProcessor(q)
normal
{ "blob_id": "96e64b715dbfc1c59ba44d608ad2694b165017b5", "index": 1975, "step-1": "<mask token>\n", "step-2": "<mask token>\nlogging.basicConfig(level=logging.DEBUG, format=\n '%(asctime)s - %(levelname)s - %(message)s')\n<mask token>\n", "step-3": "<mask token>\nlogging.basicConfig(level=logging.DEBUG, fo...
[ 0, 1, 2, 3, 4 ]
#! /usr/bin/env python3 # # This file is part of Toboggan, https://github.com/TheoryInPractice/Toboggan/, # and is Copyright (C) North Carolina State University, 2017. It is licensed # under the three-clause BSD license; see LICENSE. # # -*- coding: utf-8 -*- # python libs import sys import itertools # local imports fr...
normal
{ "blob_id": "1b4c9841fd10d065983974e93fe5dcbe048c1281", "index": 4180, "step-1": "<mask token>\n\n\ndef is_feasible(weights, flow, max_weight):\n \"\"\"Test whether set of guessed weights is feasible.\"\"\"\n min_weights = [1] + weights\n max_weights = [max_weight] + list(reversed(weights))\n for i i...
[ 1, 2, 3, 4, 5 ]
__doc__ = """ Dataset Module Utilities - mostly for handling files and datasets """ import glob import os import random from meshparty import mesh_io # Datasets ----------------------- SVEN_BASE = "seungmount/research/svenmd" NICK_BASE = "seungmount/research/Nick/" BOTH_BASE = "seungmount/research/nick_and_sven" DAT...
normal
{ "blob_id": "fd0db093b72dad4657d71788405fcca4ba55daff", "index": 8529, "step-1": "<mask token>\n\n\ndef fetch_dset_dirs(dset_name=None):\n \"\"\"\n Finds the global pathname to a list of directories which represent a\n dataset by name.\n \"\"\"\n assert dset_name is None or dset_name in DATASET_DI...
[ 3, 4, 6, 7, 8 ]
import os import urllib.request import zipfile import tarfile import matplotlib.pyplot as plt %matplotlib inline from PIL import Image import numpy as np # フォルダ「data」が存在しない場合は作成する data_dir = "./data/" if not os.path.exists(data_dir): os.mkdir(data_dir) # MNIStをダウンロードして読み込む from sklearn.datasets import fetch_open...
normal
{ "blob_id": "6f53a989ddf179b699186a78b5d8cf6d3d08cbb2", "index": 4756, "step-1": "import os\nimport urllib.request\nimport zipfile\nimport tarfile\n\nimport matplotlib.pyplot as plt\n%matplotlib inline\nfrom PIL import Image\nimport numpy as np\n\n# フォルダ「data」が存在しない場合は作成する\ndata_dir = \"./data/\"\nif not os.path...
[ 0 ]
from xai.brain.wordbase.nouns._teleconference import _TELECONFERENCE #calss header class _TELECONFERENCES(_TELECONFERENCE, ): def __init__(self,): _TELECONFERENCE.__init__(self) self.name = "TELECONFERENCES" self.specie = 'nouns' self.basic = "teleconference" self.jsondata = {}
normal
{ "blob_id": "9021fa440561461ee179f333aa04a155d06c6e86", "index": 7255, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass _TELECONFERENCES(_TELECONFERENCE):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass _TELECONFERENCES(_TELECONFERENCE):\n\n def __init__(self):\n _TELECONFERE...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def count_or_add_trigrams(trigram, trigrams_so_far): """ Takes a trigram, and a list of previously seen trigrams and yields the same list with all discovered and counted trigrams. Adds given trigram if not fo...
flexible
{ "blob_id": "753cc532e4d049bacff33c97de4d80bb9ab8ece8", "index": 2655, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef count_or_add_trigrams(trigram, trigrams_so_far):\n \"\"\"\n Takes a trigram, and a list of previously seen trigrams\n and yields the same list with all discovered and cou...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def enter_num(): """ get user input and do error checking for illegal digits. returns ------- num """ num = input('please enter a BASE 36 number, e.g. A36Z :> ') num = num.upper() for digit in num: digit = digit.upper() if digit not in WORD:...
flexible
{ "blob_id": "5a265ecb9f1d6d0e4a5c66d241fbfe4a6df97825", "index": 8191, "step-1": "<mask token>\n\n\ndef enter_num():\n \"\"\" get user input and do error checking for illegal digits.\n returns\n -------\n num\n \"\"\"\n num = input('please enter a BASE 36 number, e.g. A36Z :> ')\n num = num....
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class UDnCNN(NNRegressor): <|reserved_special_token_0|> <|reserved_special_token_0|> class DUDnCNN(NNRegressor): def __init__(self, D, C=64): super(DUDnCNN, self).__init__() self.D = D k = [0] k.extend([i for i in range(D // 2)]) k.ex...
flexible
{ "blob_id": "9c60d82d42716abb036dc7297a2dca66f0508984", "index": 7626, "step-1": "<mask token>\n\n\nclass UDnCNN(NNRegressor):\n <mask token>\n <mask token>\n\n\nclass DUDnCNN(NNRegressor):\n\n def __init__(self, D, C=64):\n super(DUDnCNN, self).__init__()\n self.D = D\n k = [0]\n ...
[ 4, 7, 8, 10, 11 ]
from conans import * class GlibConan(ConanFile): name = "glib" description = "Common C routines used by Gtk+ and other libs" license = "LGPL" settings = {"os": ["Linux"], "arch": ["x86_64", "armv8"]} build_requires = ( "generators/1.0.0", "autotools/1.0.0", ) requires = ( ...
normal
{ "blob_id": "e49c5c6475a1210a9657d7bbd0490c8d20863718", "index": 2285, "step-1": "<mask token>\n\n\nclass GlibConan(ConanFile):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def build(self):\n args = ['--disable-static'...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class node2vec_walk: def __init__(self, nx_G, is_directed, p, q): self.G = nx_G self.is_directed = is_directed self.p = p self.q = q def node2vec_walk(self, walk_length, start_node): G = self.G alias_nodes = self.alias_nodes ...
flexible
{ "blob_id": "fc2748d766ebce8c9577f1eebc8435e2aa58ae25", "index": 8605, "step-1": "<mask token>\n\n\nclass node2vec_walk:\n\n def __init__(self, nx_G, is_directed, p, q):\n self.G = nx_G\n self.is_directed = is_directed\n self.p = p\n self.q = q\n\n def node2vec_walk(self, walk_l...
[ 7, 8, 12, 13, 15 ]
<|reserved_special_token_0|> class EloCalculations: def __init__(self): self.teamcolors = {} for teamdata in colordata: c = teamdata['competitor'] self.teamcolors[c['abbreviatedName']] = ['#' + c['primaryColor' ], '#' + c['secondaryColor']] self.mat...
flexible
{ "blob_id": "4f84cf80292e2764ca3e4da79858058850646527", "index": 8862, "step-1": "<mask token>\n\n\nclass EloCalculations:\n\n def __init__(self):\n self.teamcolors = {}\n for teamdata in colordata:\n c = teamdata['competitor']\n self.teamcolors[c['abbreviatedName']] = ['#'...
[ 5, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> broker_url = 'redis://120.78.168.67/10' CELERY_RESULT_BACKEND = 'redis://120.78.168.67/0' CELERY_TIMEZONE = 'Asia/Shanghai' <|reserved_special_token_1|> # Celery配置文件 # 指定消息队列为Redis broker_url = "redis://120.78.168.67/10" CELERY_RESULT_BACKEND = "redis://1...
flexible
{ "blob_id": "095374aa7613f163fedbd7d253219478108d4f42", "index": 992, "step-1": "<mask token>\n", "step-2": "broker_url = 'redis://120.78.168.67/10'\nCELERY_RESULT_BACKEND = 'redis://120.78.168.67/0'\nCELERY_TIMEZONE = 'Asia/Shanghai'\n", "step-3": "# Celery配置文件\n\n# 指定消息队列为Redis\nbroker_url = \"redis://120....
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def time_func(func, arg): start = time.time() func(arg) return time.time() - start <|reserved_special_token_1|> import time def time_func(func, arg): start = time.time() func(arg) return time.time() ...
flexible
{ "blob_id": "7f406c1cd4d56da3a7d5f8739e0b65b0e61cf637", "index": 5290, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef time_func(func, arg):\n start = time.time()\n func(arg)\n return time.time() - start\n", "step-3": "import time\n\n\ndef time_func(func, arg):\n start = time.time()\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> df.pivot_table(index=['classes'], aggfunc='size') <|reserved_special_token_0|> for n in np.arange(0.5, C_parameter, 0.5): clf = svm.SVC(C=n).fit(X_train, y_train) yhat = clf.predict(X_test) cnf_matrix = confusion_matri...
flexible
{ "blob_id": "1b1b646a75fe2ff8d54e66d025b60bde0c9ed2d6", "index": 9361, "step-1": "<mask token>\n", "step-2": "<mask token>\ndf.pivot_table(index=['classes'], aggfunc='size')\n<mask token>\nfor n in np.arange(0.5, C_parameter, 0.5):\n clf = svm.SVC(C=n).fit(X_train, y_train)\n yhat = clf.predict(X_test)\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def rotate_img(image, angle, color, filter=Image.NEAREST): if image.mode == 'P' or filter == Image.NEAREST: matte = Image.new('1', image.size, 1) else: matte = Image.new('L', image.size, 255) bg = Image.new(image.mode, image.size, color) bg.paste(image.rota...
flexible
{ "blob_id": "28c4c09b81d63785750cee36a8efd77760cac451", "index": 7231, "step-1": "<mask token>\n\n\ndef rotate_img(image, angle, color, filter=Image.NEAREST):\n if image.mode == 'P' or filter == Image.NEAREST:\n matte = Image.new('1', image.size, 1)\n else:\n matte = Image.new('L', image.size...
[ 5, 8, 9, 11, 12 ]
import sys import requests def ggwave(message: str, protocolId: int = 1, sampleRate: float = 48000, volume: int = 50, payloadLength: int = -1): url = 'https://ggwave-to-file.ggerganov.com/' params = { 'm': message, # message to encode 'p': protocolId, # transmission protocol to use ...
normal
{ "blob_id": "f5d285b3a82151b5d7efdcd07d56cc5aaaac5836", "index": 7213, "step-1": "<mask token>\n\n\ndef ggwave(message: str, protocolId: int=1, sampleRate: float=48000, volume:\n int=50, payloadLength: int=-1):\n url = 'https://ggwave-to-file.ggerganov.com/'\n params = {'m': message, 'p': protocolId, 's...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> {'targets': [{'target_name': 'force-layout', 'sources': ['src/main.cc', 'src/layout.cc', 'src/quadTree.cc'], 'conditions': [['OS=="win"', { 'cflags': ['/WX', '/std:latest', '/m']}, {'cflags': ['-std=c++11', '-fpermissive', '-fexceptions']}]], 'cfl...
flexible
{ "blob_id": "0f916a1f638bf149f6992355cf8f33f74bc9bdb1", "index": 8439, "step-1": "<mask token>\n", "step-2": "{'targets': [{'target_name': 'force-layout', 'sources': ['src/main.cc',\n 'src/layout.cc', 'src/quadTree.cc'], 'conditions': [['OS==\"win\"', {\n 'cflags': ['/WX', '/std:latest', '/m']}, {'cflags...
[ 0, 1, 2 ]
<|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": "2fbf312e1f8388008bb9ab9ba0ee4ccee1a8beae", "index": 3594, "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 = [('cstasker', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class DataLoader: <|reserved_special_token_0|> def main(self): choice = messagebox.askyesno('askquestion', 'Cliquer sur Oui pour charger les données en mode Trasactionnel') if choice: self.modeTransaction = True self.db.conn.sta...
flexible
{ "blob_id": "a70dae504a4dfa3997a11e4c605accfab0024318", "index": 8796, "step-1": "<mask token>\n\n\nclass DataLoader:\n <mask token>\n\n def main(self):\n choice = messagebox.askyesno('askquestion',\n 'Cliquer sur Oui pour charger les données en mode Trasactionnel')\n if choice:\n ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def freqHist3(tbl): """python3 version ASSUME: values are frequencies, returns sorted list of (val,freq) items in descending freq order """ from functools import cmp_to_key def cmpd1(a, b): """decreasing order of frequencies""" return b[1] - a[1] flist =...
flexible
{ "blob_id": "b3758e42b52bb50d806832c6a3a76ae0537266de", "index": 8043, "step-1": "<mask token>\n\n\ndef freqHist3(tbl):\n \"\"\"python3 version\n\tASSUME: values are frequencies, returns sorted list of (val,freq) items in descending freq order\n\t\"\"\"\n from functools import cmp_to_key\n\n def cmpd1(a...
[ 10, 11, 13, 14, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(""" ----------导入模块中的所有函数----------""") make_pizza(16, 'pepperoni') make_pizza(12, 'mushrooms', 'green peppers', 'extra cheese') <|reserved_special_token_1|> from e19_pizza import * print(""" ----------导入模块中的所有函数----------...
flexible
{ "blob_id": "c54a046ebde1be94ec87061b4fba9e22bf0f4d0a", "index": 3508, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\"\"\"\n----------导入模块中的所有函数----------\"\"\")\nmake_pizza(16, 'pepperoni')\nmake_pizza(12, 'mushrooms', 'green peppers', 'extra cheese')\n", "step-3": "from e19_pizza import *\npr...
[ 0, 1, 2, 3 ]
import numpy as np from feature.features import Features class RealWorldFeatures(Features): def __init__(self): super().__init__('tsagkias/real_world_features') def _extract_features(self, df): # weather from http://www.dwd.de/DE/leistungen/klimadatendeutschland/klimadatendeutschland.html features = ...
normal
{ "blob_id": "f6b2e66379b483c6a573d34d73ae0d10de7315a3", "index": 6815, "step-1": "<mask token>\n\n\nclass RealWorldFeatures(Features):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass RealWorldFeatures(Features):\n\n def __init__(self):\n super().__init__('tsagkias/real_worl...
[ 1, 2, 3, 4, 5 ]
from datetime import datetime from iohelpers import lines_to_textfile from typing import Iterator, List, Sequence from zhmodules import ZhTopolectSynonyms, MandarinPronunciations, ZhTopolectPronunciations def missing_philippine_hokkien_words_generator(synonyms: ZhTopolectSynonyms, hokprons: ZhTopolectPronunciations):...
normal
{ "blob_id": "18366633489d905c96b0c30d65442bc2e2b188ea", "index": 4703, "step-1": "<mask token>\n\n\ndef missing_philippine_hokkien_words_generator(synonyms: ZhTopolectSynonyms,\n hokprons: ZhTopolectPronunciations):\n all_hokkien = set()\n for word, syn_data in synonyms.all_words():\n minnan = se...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 19 09:31:20 2021 @author: dclabby """ import os import cv2 import pickle from utils import locateLetterRegions # # Constants # sourceFolder = '/home/dclabby/Documents/Springboard/HDAIML_SEP/Semester03/MachineLearning/Project/solving_captchas_code_e...
normal
{ "blob_id": "6109efeb3462ac2c5a94a68fbfa4f2f0617dd927", "index": 1221, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef extractLetters(sourceFolder, trainRatio=0.8, destFolder=\n './data/separateLetters'):\n \"\"\" \n\n Parameters\n ----------\n sourceFolder : string\n DESC...
[ 0, 1, 2, 3 ]
# Copyright (c) 2012 - Samuel Loretan <tynril at gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modi...
normal
{ "blob_id": "109a0ba0952bd5923ecbefa41556de7aa9f9eea8", "index": 4197, "step-1": "# Copyright (c) 2012 - Samuel Loretan <tynril at gmail.com>\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for c in range(0, 7): num = int(input(f'Digite o {c + 1} valor: ')) res = num % 2 if res == 0: n[0].append(num) else: n[1].append(num) n[0].sort() n[1].sort() print(f'Numeros pares: {n[0]}') print(f...
flexible
{ "blob_id": "72bbbe78db746febc9a36a676e0fa2d97bf5e81e", "index": 8849, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor c in range(0, 7):\n num = int(input(f'Digite o {c + 1} valor: '))\n res = num % 2\n if res == 0:\n n[0].append(num)\n else:\n n[1].append(num)\nn[0].sort()\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Resources: <|reserved_special_token_0|> def __init__(self, title, author, publisher, year): self.title = title self.author = author self.publisher = publisher self.year = year <|reserved_special_token_0|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "0709d413ddbe41a0c97f94b7819fdfded241d3fc", "index": 691, "step-1": "<mask token>\n\n\nclass Resources:\n <mask token>\n\n def __init__(self, title, author, publisher, year):\n self.title = title\n self.author = author\n self.publisher = publisher\n self.year = year\...
[ 4, 8, 9, 10, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if classifier is not None: print('model is loaded from ', model_file) <|reserved_special_token_0|> while 1: hasFrame, frame = cap.read() if not hasFrame: break h, w, bpp = np.shape(frame) dim = int(w / ...
flexible
{ "blob_id": "e89ca4907373318bd55d0833730a30d981414992", "index": 2677, "step-1": "<mask token>\n", "step-2": "<mask token>\nif classifier is not None:\n print('model is loaded from ', model_file)\n<mask token>\nwhile 1:\n hasFrame, frame = cap.read()\n if not hasFrame:\n break\n h, w, bpp = ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ADCS2(object): def __init__(self, adcs2_data): self.gyro = tuple(struct.unpack('>hhh', adcs2_data)) <|reserved_special_token_0|> class AIS(object): def __init__(self, ais_data): self.boot_count, _, _, self.unique_mssi, _ = struct.unpack('>HhhH12s', ...
flexible
{ "blob_id": "505689803c8f4490619ab1a7579fde1e2c18c538", "index": 5532, "step-1": "<mask token>\n\n\nclass ADCS2(object):\n\n def __init__(self, adcs2_data):\n self.gyro = tuple(struct.unpack('>hhh', adcs2_data))\n <mask token>\n\n\nclass AIS(object):\n\n def __init__(self, ais_data):\n sel...
[ 8, 10, 19, 20, 21 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class VerifyHandphoneForm(Form): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class VerifyHandphoneForm(Form): handphone_hash = TextField('Enter verification code here', val...
flexible
{ "blob_id": "cb0df06ee474576b3024678fa0f63ce400d773ea", "index": 4096, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass VerifyHandphoneForm(Form):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass VerifyHandphoneForm(Form):\n handphone_hash = TextField('Enter verification code here', ...
[ 0, 1, 2, 3 ]
class Day8MemoryManeuver: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Day8MemoryManeuver: <|reserved_special_token_0|> <|reserved_special_token_0|> def _solve(self, structure, pos): if pos >= len(structure)...
flexible
{ "blob_id": "84d096a51fa052ee210e975ab61c0cbbf05bc5ae", "index": 8358, "step-1": "class Day8MemoryManeuver:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class Day8MemoryManeuver:\n <mask token>\n <mask token>\n\n def _solve(self, structure, pos):\n if pos >= len(structur...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class InspectTest(unittest.TestCase): def test_func(self): self.assertTrue(find_top_pyfile()) self.assertTrue(caller_name()) <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class LittleCatC...
flexible
{ "blob_id": "89605ff723d2f78e85cae458d576494718b5d456", "index": 1193, "step-1": "<mask token>\n\n\nclass InspectTest(unittest.TestCase):\n\n def test_func(self):\n self.assertTrue(find_top_pyfile())\n self.assertTrue(caller_name())\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask toke...
[ 2, 5, 6, 9, 10 ]
<|reserved_special_token_0|> def get_lastupdate_date(path): return os.path.getmtime(path) def convertIntToTimestamp(timeint): return str(datetime.datetime.fromtimestamp(timeint)) def getFilename(name): return os.path.basename(name) def creation_date(path): """ Try to get the date that a file...
flexible
{ "blob_id": "e83b6b1f4cb12fe3b932903eddddfb0dc0e7d98d", "index": 2765, "step-1": "<mask token>\n\n\ndef get_lastupdate_date(path):\n return os.path.getmtime(path)\n\n\ndef convertIntToTimestamp(timeint):\n return str(datetime.datetime.fromtimestamp(timeint))\n\n\ndef getFilename(name):\n return os.path....
[ 5, 8, 9, 11, 12 ]
<|reserved_special_token_0|> def create_window(): window = Toplevel(root) w, h = root.winfo_screenwidth(), root.winfo_screenheight() canvas = Canvas(window, width=w, height=h) canvas.create_text(w / 2, h / 2, text='this will close after 3 seconds', font='Arial') canvas.pack() window.ov...
flexible
{ "blob_id": "cac49a9a2cb753bb81c45ac1d2d887b1f48dd9bb", "index": 9562, "step-1": "<mask token>\n\n\ndef create_window():\n window = Toplevel(root)\n w, h = root.winfo_screenwidth(), root.winfo_screenheight()\n canvas = Canvas(window, width=w, height=h)\n canvas.create_text(w / 2, h / 2, text='this wi...
[ 1, 2, 3, 4, 5 ]
from django.contrib.auth.decorators import permission_required from django.db import models from students.models import Student # Create your models here. class Fine(models.Model): amount = models.DecimalField(max_digits=8, decimal_places=2, null=True, default=0) student = models.OneToOneField(Student, on_de...
normal
{ "blob_id": "22b697790516e1160ac501a58ad93ef5b579414a", "index": 7109, "step-1": "<mask token>\n\n\nclass Fine(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n db_table = 'fines'\n verbose_name_plural = 'Fines'\n verbose_name = 'Fi...
[ 1, 2, 3, 4, 5 ]
import pandas as pd # 데이터 로드 train_data = pd.read_csv('./dataset/train_park_daycare.csv') cctv = pd.read_csv("./dataset/cctv_origin.csv", encoding="EUC-KR") ## 데이터 전처리 # 데이터 추출 cctv = cctv.iloc[1:, :2] # 구 매핑 gu_dict_num = {'용산구': 0, '양천구': 1, '강동구': 2, '관악구': 3, '노원구': 4, '영등포': 5, '영등포구': 5, '마포구': 6, '서초구': 7, '성...
normal
{ "blob_id": "ea2e9399a8384600d8457a9de3f263db44dc883d", "index": 752, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in cctv['구분']:\n gu_list.append(gu_dict_num[i])\n<mask token>\ncctv.drop(['구분'], axis=1, inplace=True)\n<mask token>\nprint(new_data.info())\nnew_data.to_csv('./dataset/train_add_...
[ 0, 1, 2, 3, 4 ]
alien_color = 'green' if alien_color == 'green': print('you earned 5 points') alien_color2 = 'yellow' if alien_color2 == 'green': print ('your earned 5 points') if alien_color2 == 'yellow': print('Right answer') # 5.4 alien_color = 'green' if alien_color == 'green': print('you earned 5 po...
normal
{ "blob_id": "30e4c4c5ef944b0cd2d36b2fe5f7eee39dff1d16", "index": 6511, "step-1": "<mask token>\n", "step-2": "<mask token>\nif alien_color == 'green':\n print('you earned 5 points')\n<mask token>\nif alien_color2 == 'green':\n print('your earned 5 points')\nif alien_color2 == 'yellow':\n print('Right ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class EphemeralBehaviour(Behaviour): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class EphemeralBehaviour(Behaviour): <|reserved_special_token_0|> def behave(env: Environment, loc: tuple[int, int...
flexible
{ "blob_id": "2728c3ab26fbdbaac9c47054eafe1c114341f6f2", "index": 7736, "step-1": "<mask token>\n\n\nclass EphemeralBehaviour(Behaviour):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass EphemeralBehaviour(Behaviour):\n <mask token>\n\n def behave(env: Environment, loc: tuple[int...
[ 1, 2, 3, 4 ]
import numpy as np import pandas as pd import sklearn import sklearn.preprocessing import matplotlib.pyplot as plt import tensorflow as tf from enum import Enum from pytalib.indicators import trend from pytalib.indicators import base class Cell(Enum): BasicRNN = 1 BasicLSTM = 2 LSTMCellPeephole = 3 GR...
normal
{ "blob_id": "4379d89c2ada89822acbf523d2e364599f996f8c", "index": 5456, "step-1": "<mask token>\n\n\nclass Cell(Enum):\n BasicRNN = 1\n BasicLSTM = 2\n LSTMCellPeephole = 3\n GRU = 4\n\n\n<mask token>\n\n\ndef normalize_data(df):\n min_max_scaler = sklearn.preprocessing.MinMaxScaler()\n df['Open...
[ 7, 8, 9, 10, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> VERSION = 0, 2, 14 __version__ = '.'.join(map(str, VERSION)) __all__ = ['AzFileClient', 'AzFileSystem', 'BlobPathDecoder', 'TableStorage', 'TableStorageWrapper', 'export_decorator'] <|reserved_special_token_1|> from azfs.az...
flexible
{ "blob_id": "e7239b4bc3db9bd427b9be888621f66e81b5edeb", "index": 2242, "step-1": "<mask token>\n", "step-2": "<mask token>\nVERSION = 0, 2, 14\n__version__ = '.'.join(map(str, VERSION))\n__all__ = ['AzFileClient', 'AzFileSystem', 'BlobPathDecoder',\n 'TableStorage', 'TableStorageWrapper', 'export_decorator'...
[ 0, 1, 2, 3 ]
from functools import wraps from time import sleep def retry(retry_count = 2, delay = 5, action_description = 'not specified', allowed_exceptions=()): def decorator(func): @wraps(func) # to preserve metadata of the function to be decorated def wrapper(*args, **kwargs): for _ in range(re...
normal
{ "blob_id": "79e4592d5ea84cc7c97d68a9390eb5d387045cf0", "index": 4344, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef retry(retry_count=2, delay=5, action_description='not specified',\n allowed_exceptions=()):\n\n def decorator(func):\n\n @wraps(func)\n def wrapper(*args, **kw...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .file_uploader_routes import FILE_UPLOADER_BLUEPRINT
flexible
{ "blob_id": "c7dacdb53efb6935314c5e3718a4a2f1d862b07d", "index": 2340, "step-1": "<mask token>\n", "step-2": "from .file_uploader_routes import FILE_UPLOADER_BLUEPRINT\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in lines: if line == '\n' or line == lines[-1]: if line == lines[-1]: line = line.strip() group_responses.append(line) group_responses_flattened = [item for sublist in group_res...
flexible
{ "blob_id": "cb6ed6422a5591f1de0a947f75ad080f250e8443", "index": 7718, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in lines:\n if line == '\\n' or line == lines[-1]:\n if line == lines[-1]:\n line = line.strip()\n group_responses.append(line)\n group_res...
[ 0, 1, 2, 3 ]
import logging formatter = logging.Formatter("%(asctime)s [%(levelname)s] : %(message)s") log = logging.getLogger("othello") log.setLevel(logging.DEBUG) stream_hander = logging.StreamHandler() stream_hander.setFormatter(formatter) log.addHandler(stream_hander)
normal
{ "blob_id": "675fbdfd519d00ab10bf613e8abb7338e484fe65", "index": 57, "step-1": "<mask token>\n", "step-2": "<mask token>\nlog.setLevel(logging.DEBUG)\n<mask token>\nstream_hander.setFormatter(formatter)\nlog.addHandler(stream_hander)\n", "step-3": "<mask token>\nformatter = logging.Formatter('%(asctime)s [%...
[ 0, 1, 2, 3, 4 ]
import pandas as pd import numpy as np import seaborn as sns from matplotlib import pyplot as plt, ticker from analysis.report import lib_plot from analysis.report.lib_agent import known_agents from analysis.report.lib_fmt import fmt_thousands from lib_db import DBClient def main(db_client: DBClient): sns.set_th...
normal
{ "blob_id": "51b28650f8ae6cbda3d81695acd27744e9bfebd1", "index": 2528, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(db_client: DBClient):\n sns.set_theme()\n peer_ids = db_client.get_dangling_peer_ids()\n arrivals = db_client.get_inter_arrival_time(peer_ids)\n results_df = pd.D...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Ui_FormHello(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Ui_FormHello(object): def setupUi(self, FormHello): FormHello.setObjectName('FormHello') FormHello.resize...
flexible
{ "blob_id": "fc20a2bf09d510892a4d144fbbd2cb2012c3ad98", "index": 8579, "step-1": "<mask token>\n\n\nclass Ui_FormHello(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_FormHello(object):\n\n def setupUi(self, FormHello):\n FormHello.setObjectName('FormHello')\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def AtoD(vin): code = [(0) for i in range(12)] code[0] = 1 if vin > 0 else 0 for i in range(6): vin = vin - Wi_MSB[i] * (code[i] - 0.5) * 2 code[i + 1] = 1 if vin > 0 else 0 for i in range(5): vin = vin - Wi_LSB[i] * (code[i + 6] - 0.5) * 2 ...
flexible
{ "blob_id": "b5ac3695a224d531f5baa53a07d3c894d44e8c4c", "index": 395, "step-1": "<mask token>\n\n\ndef AtoD(vin):\n code = [(0) for i in range(12)]\n code[0] = 1 if vin > 0 else 0\n for i in range(6):\n vin = vin - Wi_MSB[i] * (code[i] - 0.5) * 2\n code[i + 1] = 1 if vin > 0 else 0\n fo...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app_name = 'bio' urlpatterns = [path('get_mtx_data', MainView.as_view())] <|reserved_special_token_1|> from django.urls import path from .views import MainView app_name = 'bio' urlpatterns = [path('get_mtx_data', MainView.as_vi...
flexible
{ "blob_id": "e3a984294cad5830358df50fa00111017cbe226d", "index": 3678, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'bio'\nurlpatterns = [path('get_mtx_data', MainView.as_view())]\n", "step-3": "from django.urls import path\nfrom .views import MainView\napp_name = 'bio'\nurlpatterns = [pat...
[ 0, 1, 2, 3 ]