code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> class Handlers: <|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|> <|reserv...
flexible
{ "blob_id": "32e3eed2e279706bca2925d3d9d897a928243b4c", "index": 4518, "step-1": "<mask token>\n", "step-2": "class Handlers:\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-3": "class Handlers:\n cha...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def _from_meminfo_ptr(ptr, dicttype): d = TypedDict(meminfo=ptr, dcttype=dicttype) return d class TypedDict(MutableMapping): """A typed-dictionary usable in Numba compiled functions. Implements the MutableMapping interface. """ @classmethod def empty(cls, k...
flexible
{ "blob_id": "ad44e9411ba6a07c54bb55b0d8af9d0c16c6b71b", "index": 5173, "step-1": "<mask token>\n\n\ndef _from_meminfo_ptr(ptr, dicttype):\n d = TypedDict(meminfo=ptr, dcttype=dicttype)\n return d\n\n\nclass TypedDict(MutableMapping):\n \"\"\"A typed-dictionary usable in Numba compiled functions.\n\n ...
[ 19, 24, 28, 29, 33 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> BOT_NAME = 'reddit_scraper' SPIDER_MODULES = ['reddit_scraper.spiders'] NEWSPIDER_MODULE = 'reddit_scraper.spiders' <|reserved_special_token_1|> # -*- coding: utf-8 -*- # Scrapy settings for reddit_scraper project # # For simplicity, this file contains on...
flexible
{ "blob_id": "a352768c2928cb7a33b9f1a31a0b3d8e56a8376a", "index": 5588, "step-1": "<mask token>\n", "step-2": "BOT_NAME = 'reddit_scraper'\nSPIDER_MODULES = ['reddit_scraper.spiders']\nNEWSPIDER_MODULE = 'reddit_scraper.spiders'\n", "step-3": "# -*- coding: utf-8 -*-\n\n# Scrapy settings for reddit_scraper pr...
[ 0, 1, 2 ]
import cv2 def movemouse(event, x, y, flags, param): global img img2 = img.copy() # img2 = cv2.cvtColor(img2, cv2.COLOR_BGR2HSV) if event == cv2.EVENT_MOUSEMOVE: font = cv2.FONT_HERSHEY_SIMPLEX message = '{}'.format(img2[y, x]) cv2.putText(img2, message, (int(w / 2.5), int(h /...
normal
{ "blob_id": "cae0aeea2ebd0a429cf6ecc9acab8f5f103e9669", "index": 1989, "step-1": "<mask token>\n\n\ndef main():\n cv2.namedWindow('image')\n cv2.setMouseCallback('image', movemouse)\n cv2.waitKey()\n cv2.destroyAllWindows()\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef movemouse(event, x, ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class NewsEncoder(tf.keras.Model): def __init__(self): super(NewsEncoder, self).__init__(name='NewsEncoder') self.userid_input_layer = Input() self.userid_embedding_layer = Embedding() self.userid_dense_layer = Dense() self.userid_flatten_layer...
flexible
{ "blob_id": "f3789d70f784345881f705fc809c49ad4e3526bc", "index": 1287, "step-1": "<mask token>\n\n\nclass NewsEncoder(tf.keras.Model):\n\n def __init__(self):\n super(NewsEncoder, self).__init__(name='NewsEncoder')\n self.userid_input_layer = Input()\n self.userid_embedding_layer = Embedd...
[ 5, 6, 7, 8, 9 ]
import os from os.path import join import json import pandas as pd import time import numpy as np import torch def str2bool(v): # convert string to boolean type for argparser input if isinstance(v, bool): return v if v.lower() in ('yes', 'true', 't', 'y', '1'): return True elif v.lower(...
normal
{ "blob_id": "a9302dbf724f9548411fbf2959f36b4cc5742ff8", "index": 4999, "step-1": "<mask token>\n\n\ndef str_or_none(v):\n if v is None:\n return None\n if v.lower() == 'none':\n return None\n else:\n return v\n\n\n<mask token>\n\n\ndef name2dic(s):\n return {x.split('-')[0]: x.sp...
[ 5, 8, 9, 12, 13 ]
<|reserved_special_token_0|> def _not_divisible(n): return lambda x: x % n > 0 def primes(): yield 2 it = _odd_iter() while True: n = next(it) yield n it = filter(_not_divisible(n), it) def main(): for n in primes(): if n < 1000: print(n) els...
flexible
{ "blob_id": "ad94118b43e130aec5df3976fd0460164de17511", "index": 8361, "step-1": "<mask token>\n\n\ndef _not_divisible(n):\n return lambda x: x % n > 0\n\n\ndef primes():\n yield 2\n it = _odd_iter()\n while True:\n n = next(it)\n yield n\n it = filter(_not_divisible(n), it)\n\n\...
[ 6, 9, 10, 11, 13 ]
<|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": "562888201719456ed2f3c32e81ffd7d2c39dabc3", "index": 7303, "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 = [('jobs', '000...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Migration(SchemaMigration): def forwards(self, orm): db.add_column(u'smslink_phoneuser', 'last_contacted', self.gf( 'django.db.models.fields.DateTimeField')(null=True, blank=True), keep_default=False) <|reserved_special_token_0|> <|reserv...
flexible
{ "blob_id": "2c1de638ac25a9f27b1af94fa075b7c1b9df6884", "index": 993, "step-1": "<mask token>\n\n\nclass Migration(SchemaMigration):\n\n def forwards(self, orm):\n db.add_column(u'smslink_phoneuser', 'last_contacted', self.gf(\n 'django.db.models.fields.DateTimeField')(null=True, blank=True)...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Counter_cl(v_class_master): def __init__(self): super().__init__() self.counter = v_variable(v_slv(32)) self.counter_max = v_variable(v_slv(32)) self.state = v_variable(v_enum(counter_state.idle)) def _onPull(self): if self.state == ...
flexible
{ "blob_id": "046db03b146ce0182ba7889908f536a09de051d5", "index": 5069, "step-1": "<mask token>\n\n\nclass Counter_cl(v_class_master):\n\n def __init__(self):\n super().__init__()\n self.counter = v_variable(v_slv(32))\n self.counter_max = v_variable(v_slv(32))\n self.state = v_vari...
[ 7, 8, 9, 12, 15 ]
#!/usr/bin/python # -*- coding: utf-8 -*- plugins_list = [] class PluginType(type): def __init__(cls, name, bases, attrs): super(PluginType, cls).__init__(name, bases, attrs) # registrar el plugin en la lista if not cls in plugins_list: plugins_list.append(cls) class PluginB...
normal
{ "blob_id": "b670655e3a8e88b97eed35e187b01d6524a16af3", "index": 7709, "step-1": "<mask token>\n\n\nclass PluginBase(object):\n \"\"\"\n Clase base para todos los plugins\n \"\"\"\n __metaclass__ = PluginType\n pass\n", "step-2": "<mask token>\n\n\nclass PluginType(type):\n <mask token>\n\n\n...
[ 3, 4, 5, 6, 7 ]
""" 统计飞船信息 """ class GameStats: def __init__(self, setting): self.setting = setting self.ships_left = self.setting.ship_limit self.game_active = True
normal
{ "blob_id": "3ab26612111e3df59f41f5b5e0bf23398e015a8a", "index": 1595, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass GameStats:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass GameStats:\n\n def __init__(self, setting):\n self.setting = setting\n self.ships_left = s...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> """ 默认查询所有 > db.test1000.find() { "_id" : ObjectId("5c3559ab648171cce9135dd6"), "name" : "zhangdapeng" } { "_id" : ObjectId("5c3559af648171cce9135dd7"), "name" : "zhangdapeng1" } { "_id" : ObjectId("5c3559b2648171cce9135dd8"), "name" : "zhangd...
flexible
{ "blob_id": "d8e0198244c3df77fa0258cc97a55042e36d056f", "index": 7756, "step-1": "<mask token>\n", "step-2": "\"\"\"\n默认查询所有\n > db.test1000.find()\n { \"_id\" : ObjectId(\"5c3559ab648171cce9135dd6\"), \"name\" : \"zhangdapeng\" }\n { \"_id\" : ObjectId(\"5c3559af648171cce9135dd7\"), \"name\" : \"zhan...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @main.route('/link') @cache.cached(key_prefix=make_cache_key, timeout=60) def get_link(): url = request.args.get('url') params = {'video': True, 'audio': True, 'screenshot': False} if request.args.get('iframe'): ...
flexible
{ "blob_id": "c4096cfae7182875a79ba7837187cd94b4379922", "index": 1100, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@main.route('/link')\n@cache.cached(key_prefix=make_cache_key, timeout=60)\ndef get_link():\n url = request.args.get('url')\n params = {'video': True, 'audio': True, 'screenshot...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Container(containers.DeclarativeContainer): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Container(...
flexible
{ "blob_id": "e8ba1ae98b247eaf90d83339e5fdc27287a70c73", "index": 2561, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Container(containers.DeclarativeContainer):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Container(containers.DeclarativeContai...
[ 0, 1, 2, 3, 4 ]
import tkinter as tk from telnetConn import telnetConnection fields = 'Host Address', 'UserName', 'Password', 'Message To', 'Text' def fetch(entries): input_list = [] for entry in entries: field = entry[0] text = entry[1].get() input_list.append(text) # print('%s:...
normal
{ "blob_id": "3328c2ae0816c146398ecde92a056d1e77683696", "index": 7357, "step-1": "<mask token>\n\n\ndef fetch(entries):\n input_list = []\n for entry in entries:\n field = entry[0]\n text = entry[1].get()\n input_list.append(text)\n telnetConnection(input_list[0], input_list[1], inp...
[ 2, 3, 4, 5, 6 ]
pal = [] for i in range(100, 1000): for j in range(100, 1000): s = str(i * j) if s[::-1] == s: pal.append(int(s)) print(max(pal))
normal
{ "blob_id": "179a9cf0713001e361f39aa30192618b392c78c7", "index": 6972, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(100, 1000):\n for j in range(100, 1000):\n s = str(i * j)\n if s[::-1] == s:\n pal.append(int(s))\nprint(max(pal))\n", "step-3": "pal = []\nfo...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def process_names(): """ Opening, reading name file and building name array. """ with open(input_names_file, 'r') as data: plaintext = data.read() name_array = plaintext.split('\n') final_name_lis...
flexible
{ "blob_id": "8c539dbbb762717393b9a71ddca8eb3872890854", "index": 288, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef process_names():\n \"\"\"\n Opening, reading name file and building name array.\n \"\"\"\n with open(input_names_file, 'r') as data:\n plaintext = data.read()\n ...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python import argparse import sys import os import cmudl.hw2p2 as hw2p2 class CLI(object): def __init__(self): parser = argparse.ArgumentParser( description='CMU Deep Learning Utilities', ) parser.add_argument('command', help='Subcommand to run') # p...
normal
{ "blob_id": "0f74e0f0600c373c3ddd470f18dbb86cf213fb58", "index": 9257, "step-1": "<mask token>\n\n\nclass CLI(object):\n <mask token>\n\n def hw2p2(self):\n parser = argparse.ArgumentParser()\n parser.add_argument('-s', type=str, default=None)\n args = parser.parse_args(sys.argv[2:])\n...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class MyTestCase(unittest.TestCase): <|reserved_special_token_0|> def test_2(self): a = t(20) b = t(1) a.left = b c = t(40) a.right = c d = t(35) c.left = d self.assertEqual(sr.searchRange(a, 17, 37), [20, 35]) <|r...
flexible
{ "blob_id": "c63e5a2178e82ec6e0e1e91a81145afb735bf7bf", "index": 216, "step-1": "<mask token>\n\n\nclass MyTestCase(unittest.TestCase):\n <mask token>\n\n def test_2(self):\n a = t(20)\n b = t(1)\n a.left = b\n c = t(40)\n a.right = c\n d = t(35)\n c.left = ...
[ 2, 4, 5, 6 ]
<|reserved_special_token_0|> class NewState(ObstacleState): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class NewState(ObstacleState): <|reserved_special_token_0|> def hit(self) ->None: """ Just remove hit po...
flexible
{ "blob_id": "7d21e76383b80e8a4433fb11cb3b64efee7a6d3b", "index": 7008, "step-1": "<mask token>\n\n\nclass NewState(ObstacleState):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass NewState(ObstacleState):\n <mask token>\n\n def hit(self) ->None:\n \"\"\"\n Just rem...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> def tree_state(x): if x <= 19: state = 'alive' return state elif x <= 49: rand = random.randrange(tree_age, 51, 1) if rand == 50: state = 'dead' else: state = 'alive' return state else: state = 'de...
flexible
{ "blob_id": "763f552329a0d38900e08081a1017b33cd882868", "index": 9391, "step-1": "<mask token>\n\n\ndef tree_state(x):\n if x <= 19:\n state = 'alive'\n return state\n elif x <= 49:\n rand = random.randrange(tree_age, 51, 1)\n if rand == 50:\n state = 'dead'\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(f'copying from {from_file} to {to_file}') <|reserved_special_token_0|> print(f'the input file is {len(indata)} bytes long') print(f'does the output file exist? {exists(to_file)}') print('return to continue, CTRL-C to abort')...
flexible
{ "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 ]
#!/usr/bin/env python # Core Library modules import os # Third party modules import nose # First party modules import lumixmaptool.copy as copy # Tests def get_parser_test(): """Check if the evaluation model returns a parser object.""" copy.get_parser() def parse_mapdata_test(): current_folder = os.p...
normal
{ "blob_id": "4dfdbc692858a627248cbe47d19b43c2a27ec70e", "index": 7373, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef parse_mapdata_test():\n current_folder = os.path.dirname(os.path.realpath(__file__))\n misc_folder = os.path.join(current_folder, 'misc')\n maplistdata_path = os.path.joi...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """Chatbot learning 학습시 생성된 vocab 딕셔너리 파일을 Cindy ui 실행시 경로를 동일시 해주어야 연결성 있는 문장을 생성해줍니다. """ from tensorflow.keras import models from tensorflow.keras import layers from tensorflow.keras import optimizers, losses, metrics from tensorflow.keras import preprocessing import numpy as np import pa...
normal
{ "blob_id": "bd06030ace665a0686c894a863e5c779b6d0931c", "index": 6447, "step-1": "<mask token>\n\n\ndef convert_text_to_index(sentences, vocabulary, type):\n sentences_index = []\n for sentence in sentences:\n sentence_index = []\n if type == DECODER_INPUT:\n sentence_index.extend(...
[ 3, 6, 7, 8, 9 ]
class mySeq: def __init__(self): self.mseq = ['I', 'II', 'III', 'IV'] def __len__(self): return len(self.mseq) def __getitem__(self, key): if 0 <= key < 4: return self.mseq[key] if __name__ == '__main__': m = mySeq() print('Len of mySeq : ', len(m)) for i...
normal
{ "blob_id": "b86dedad42d092ae97eb21227034e306ca640912", "index": 5890, "step-1": "class mySeq:\n <mask token>\n\n def __len__(self):\n return len(self.mseq)\n <mask token>\n\n\n<mask token>\n", "step-2": "class mySeq:\n\n def __init__(self):\n self.mseq = ['I', 'II', 'III', 'IV']\n\n ...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> def get_date(date): date = date.split('/') time = str(date[0]) day_str = calendar.day_name[calendar.weekday(int(date[3]), int(date[2]), int(date[1]))] day_num = str(int(date[1])) month = calendar.month_name[int(date[2])] year = str(date[3]) if int(day_n...
flexible
{ "blob_id": "79390f3ae5dc4cc9105a672d4838a8b1ba53a248", "index": 3959, "step-1": "<mask token>\n\n\ndef get_date(date):\n date = date.split('/')\n time = str(date[0])\n day_str = calendar.day_name[calendar.weekday(int(date[3]), int(date[2]),\n int(date[1]))]\n day_num = str(int(date[1]))\n ...
[ 6, 8, 9, 10, 11 ]
<|reserved_special_token_0|> class TwoPair(RankedHand): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class ThreeKind(RankedHand): def __init__(self, three_kind_rank): self.rank = 3 ...
flexible
{ "blob_id": "a0d1ef11d00e2ddd65b648a87f493b7adcda5115", "index": 9412, "step-1": "<mask token>\n\n\nclass TwoPair(RankedHand):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass ThreeKind(RankedHand):\n\n def __init__(self, three_kind_rank):\n self.rank...
[ 25, 28, 42, 43, 45 ]
import numpy as np import matplotlib.pyplot as plt import sympy as sp import matplotlib.pyplot as plt from sympy import sympify, Symbol curr_pos = 0 import numpy as np def bisection(st,maxnum,maxer,xlf,xuf): file2 = open("test.txt","w") file2.write("Hello World") file2.close() fi = open("test.txt", "w") x...
normal
{ "blob_id": "a1c1f18e7b95f36a214a1a16f2434be2825829c3", "index": 3110, "step-1": "<mask token>\n\n\ndef bisection(st, maxnum, maxer, xlf, xuf):\n file2 = open('test.txt', 'w')\n file2.write('Hello World')\n file2.close()\n fi = open('test.txt', 'w')\n x = sp.Symbol('x')\n y = sp.Symbol('y')\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Renderer: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def get_width(self): return self.width def draw_board(self): for i in range(0, 6): horLines = Line(Point(0, i * self.height / 6), Point(...
flexible
{ "blob_id": "85a3682f144f02aa412d45c901f76c65de2e816d", "index": 5599, "step-1": "<mask token>\n\n\nclass Renderer:\n <mask token>\n <mask token>\n <mask token>\n\n def get_width(self):\n return self.width\n\n def draw_board(self):\n for i in range(0, 6):\n horLines = Line...
[ 8, 9, 10, 12, 14 ]
# line_count.py import sys count = 0 for line in sys.stdin: count += 1 # print goes to sys.stdout print count
normal
{ "blob_id": "46194829fc54c2f3e51febde572e05bcff261fb2", "index": 7126, "step-1": "# line_count.py\nimport sys\ncount = 0\nfor line in sys.stdin:\n\tcount += 1\n# print goes to sys.stdout\nprint count", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
"""I referred below sample. https://ja.wikipedia.org/wiki/Adapter_%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3#:~:text=Adapter%20%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3%EF%BC%88%E3%82%A2%E3%83%80%E3%83%97%E3%82%BF%E3%83%BC%E3%83%BB%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3%EF%BC%89,%E5%A4%89%E6%9B%B4%E3%81%99%E3%82%8B%E3%81%93%E3%81%A...
normal
{ "blob_id": "829e23ce2388260467ed159aa7e1480d1a3d6045", "index": 6546, "step-1": "<mask token>\n\n\nclass Product:\n <mask token>\n\n def __init__(self, cost: int) ->None:\n self.__cost = cost\n\n def get_yen(self) ->int:\n return self.__cost\n\n\nclass ProductAdapter(ProductPrice):\n \...
[ 7, 9, 12, 13, 14 ]
#game that has a timer and you need to stop the timer #with 0 at the end. import simplegui #necessary global variables #time for the timer time = 0 #the display for the timer(string form) watch = '' #tries and correct presses tries = 0 correct = 0 #changes time to watch(number to string of form A:B...
normal
{ "blob_id": "b3c22b4a453aa55da980b090df2749ff9f1066e6", "index": 5932, "step-1": "<mask token>\n\n\ndef increment():\n global time\n time = time + 1\n\n\ndef start():\n timer.start()\n\n\ndef stop():\n global correct, tries\n timer.stop()\n if time != 0:\n tries = tries + 1\n if t...
[ 4, 5, 6, 8, 10 ]
#예외처리 문법을 활용하여 정수가 아닌 숫자를 입력했을때 에러문구가나오도록 작성.(에러문구:정수가아닙니다) try: x = int(input('정수를 입력하세요: ')) print(x) except: print('정수가 아닙니다.')
normal
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> """ Like Places but possibly script based and temporary. Like a whisper command where is keeps tracks of participants. """
flexible
{ "blob_id": "378c07c512425cb6ac6c998eaaa86892b02a37b8", "index": 6905, "step-1": "<mask token>\n", "step-2": "\"\"\"\nLike Places but possibly script based and temporary.\nLike a whisper command where is keeps tracks of participants.\n\"\"\"", "step-3": null, "step-4": null, "step-5": null, "step-ids":...
[ 0, 1 ]
# # Copyright (c) 2018-2020 by Kristoffer Paulsson <kristoffer.paulsson@talenten.se>. # # This software is available under the terms of the MIT license. Parts are licensed under # different terms if stated. The legal terms are attached to the LICENSE file and are # made available on: # # https://opensource.org/lice...
normal
{ "blob_id": "f494dc99febfad99b371d72f542556a9024bc27d", "index": 5333, "step-1": "<mask token>\n\n\nclass TestVerified(TestCase):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TestTrusted(TestCase):\n\n def setUp(self):\n self.instance = Trusted()\n\n def tearDown(self):\n ...
[ 9, 13, 14, 17, 18 ]
from django import forms from django.core.validators import RegexValidator from dashboard.validators import validate_domainonly_email class addUserForm(forms.Form): username = forms.CharField(label='User Name', required="required", disabled="", min_length=6, max_length=128, help_tex...
normal
{ "blob_id": "39b6ca21b8d4856e2b2edfcbd00b75fbce6dfff7", "index": 1407, "step-1": "<mask token>\n\n\nclass addUserForm(forms.Form):\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 token>\n\n\nclass addUserForm(for...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> socket.bind('tcp://10.20.32.221:5555') while True: message = socket.recv() print('Received request: %s' % message) time.sleep(1) socket.send(b'World') <|reserved_special_token_1|> <|reserved_special_token_0|> co...
flexible
{ "blob_id": "ccba923fa4b07ca9c87c57797e1e6c7da3a71183", "index": 4315, "step-1": "<mask token>\n", "step-2": "<mask token>\nsocket.bind('tcp://10.20.32.221:5555')\nwhile True:\n message = socket.recv()\n print('Received request: %s' % message)\n time.sleep(1)\n socket.send(b'World')\n", "step-3":...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class IngredientForm(forms.ModelForm): class Meta: model = Ingredient exclude = 'recipe', labels = {'quantity': 'Qty'} def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) placeholders = {'quantity': 'eg: 0.1', 'unit': '...
flexible
{ "blob_id": "7484bd9012bc9952b679073ae036de4554d362be", "index": 5175, "step-1": "<mask token>\n\n\nclass IngredientForm(forms.ModelForm):\n\n\n class Meta:\n model = Ingredient\n exclude = 'recipe',\n labels = {'quantity': 'Qty'}\n\n def __init__(self, *args, **kwargs):\n super...
[ 6, 7, 9, 12, 15 ]
../../2.0.2/mpl_examples/axes_grid/simple_axesgrid2.py
normal
{ "blob_id": "73d1129418711c35046a99c1972a413357079836", "index": 3022, "step-1": "../../2.0.2/mpl_examples/axes_grid/simple_axesgrid2.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
''' Created on Mar 7, 2019 @author: hzhang0418 ''' import pymp from v6.mono import Mono class BruteForce(Mono): def __init__(self, features, labels, params): super(BruteForce, self).__init__(features, labels, params) def _count_inconsistencies(self): if self.num_cores==1: ...
normal
{ "blob_id": "32c18bd578bbf91c76604f063421a65a4f7a8b63", "index": 2204, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass BruteForce(Mono):\n <mask token>\n\n def _count_inconsistencies(self):\n if self.num_cores == 1:\n for ni in self.nonmatch_indices:\n self...
[ 0, 3, 4, 5, 6 ]
import Bio import os import sys from Bio import PDB from Bio.PDB import PDBIO from Bio.PDB.PDBParser import PDBParser import math import numpy from collections import Counter import random from Bio.PDB import * import gzip def get_center(res_list): coord = [] for atom in residue: #...
normal
{ "blob_id": "8b29c12c294a8614d8be96c312ecffa9d3bcb3f8", "index": 4575, "step-1": "<mask token>\n\n\ndef get_center(res_list):\n coord = []\n for atom in residue:\n at = atom.coord\n x = at[0]\n y = at[1]\n z = at[2]\n atcord = [x, y, z]\n coord.append(atcord)\n ...
[ 1, 2, 3, 4, 5 ]
import time with open("src/time.txt", "w") as f: f.write(str(int(time.time())))
normal
{ "blob_id": "0058a6d3c9d4e600885b876614362ea4401ce2fe", "index": 1640, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('src/time.txt', 'w') as f:\n f.write(str(int(time.time())))\n", "step-3": "import time\nwith open('src/time.txt', 'w') as f:\n f.write(str(int(time.time())))\n", "step...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(beloning, beloningICOR) <|reserved_special_token_0|> print(beloning, beloningPROG) <|reserved_special_token_0|> print(beloning, beloningCSN) <|reserved_special_token_0|> print('de gemiddelde beloning is:€ ', gemiddelde / 3) ...
flexible
{ "blob_id": "74bca94cbcba0851e13d855c02fbc13fb0b09e6a", "index": 4263, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(beloning, beloningICOR)\n<mask token>\nprint(beloning, beloningPROG)\n<mask token>\nprint(beloning, beloningCSN)\n<mask token>\nprint('de gemiddelde beloning is:€ ', gemiddelde / 3)...
[ 0, 1, 2 ]
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from collections import defaultdict from typing import List, Dict, Optional, Tuple import torch.jit from torch import n...
normal
{ "blob_id": "27d5ff5b0253eea36d6b492e929c4220f4b4a5eb", "index": 1564, "step-1": "<mask token>\n\n\nclass ModelIncrStateFlattener(BaseIncrStateFlattener):\n <mask token>\n\n def reorder_decoder_incremental_state(self, flat_incr_state: Dict[str,\n torch.Tensor], inds: torch.Tensor) ->Dict[str, torch....
[ 24, 31, 32, 36, 43 ]
<|reserved_special_token_0|> def parse_args(args=None): parser = argparse.ArgumentParser( 'Plots information from haplotagging_stats tsv') parser.add_argument('--input_csv', '-i', dest='input_csv', default=None, required=True, type=str, help='CSV file holding data') parser.add_argument('--...
flexible
{ "blob_id": "0c7816028e6cbd12684b0c7484835e735f1d2838", "index": 4327, "step-1": "<mask token>\n\n\ndef parse_args(args=None):\n parser = argparse.ArgumentParser(\n 'Plots information from haplotagging_stats tsv')\n parser.add_argument('--input_csv', '-i', dest='input_csv', default=None,\n re...
[ 3, 5, 6, 7, 8 ]
import pytest from a3 import * from test_utils import * from numpy import allclose def test_problem_7_1_8(): assert(check_linalg()) assert(abs(problem_7_1_8(5000)-84.8)<1)
normal
{ "blob_id": "c7553cadb49c9c7e80a7800b9bff4d5f64796494", "index": 7568, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_problem_7_1_8():\n assert check_linalg()\n assert abs(problem_7_1_8(5000) - 84.8) < 1\n", "step-3": "import pytest\nfrom a3 import *\nfrom test_utils import *\nfrom n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def rm(ids): cmd = f"{runtime} rm {' '.join(ids)}" sys.stdout.write(f'{cmd}\n') run_shell_cmd(cmd) def stop(ids): cmd = f"{runtime} stop {' '.join(ids)}" sys.stdout.write(f'{cmd}\n') run_shell_cmd(cmd) <|reserved_special_token_0|> <|reserved_special_token_1|>...
flexible
{ "blob_id": "eb3a32c17d8e5e9f717e813d5612d077c8feac48", "index": 7145, "step-1": "<mask token>\n\n\ndef rm(ids):\n cmd = f\"{runtime} rm {' '.join(ids)}\"\n sys.stdout.write(f'{cmd}\\n')\n run_shell_cmd(cmd)\n\n\ndef stop(ids):\n cmd = f\"{runtime} stop {' '.join(ids)}\"\n sys.stdout.write(f'{cmd}...
[ 2, 3, 5, 6, 7 ]
"""! @brief Example 04 @details pyAudioAnalysis spectrogram calculation and visualization example @author Theodoros Giannakopoulos {tyiannak@gmail.com} """ import numpy as np import scipy.io.wavfile as wavfile import plotly import plotly.graph_objs as go from pyAudioAnalysis import ShortTermFeatures as aF layout = go....
normal
{ "blob_id": "cb40141eddce9ce11fbd8475fc7c3d37438208a6", "index": 6862, "step-1": "<mask token>\n\n\ndef normalize_signal(signal):\n signal = np.double(signal)\n signal = signal / 2.0 ** 15\n signal = signal - signal.mean()\n return signal / (np.abs(signal).max() + 1e-10)\n\n\n<mask token>\n", "step...
[ 1, 2, 3, 4, 5 ]
import ctypes import time from order_queue.order import Order class stock(ctypes.Structure): _fields_ = [('stock_id', ctypes.c_int), ('order_type',ctypes.c_int),('Time',ctypes.c_char * 40),('user_id',ctypes.c_int),('volume',ctypes.c_int), ('price',ctypes.c_double) ] class exchange(ctypes.St...
normal
{ "blob_id": "7491a17256b9bc7af0953202e45f0fd9d5c34c40", "index": 8376, "step-1": "<mask token>\n\n\nclass exchange(ctypes.Structure):\n <mask token>\n\n\nclass TestSturcture(ctypes.Structure):\n _fields_ = [('a', ctypes.c_int), ('n', ctypes.c_int)]\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass...
[ 3, 5, 6, 8, 12 ]
/opt/python3.7/lib/python3.7/_weakrefset.py
normal
{ "blob_id": "22f7f725d89db354b2e66ff145550192826af5ea", "index": 9109, "step-1": "/opt/python3.7/lib/python3.7/_weakrefset.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
""" Created on Feb 10, 2013 @author: jens Deprecated module for crystallogrphy related geometry operations. And a lot of other stuff that I put here. """ import numpy as np atomtable = {'H': 1, 'He': 2, 'Li': 3, 'Be': 4, 'B': 5, 'C': 6, 'N': 7, 'O': 8, 'F': 9, 'Ne': 10, 'Na': 11, 'Mg': 12, 'Al': 13, '...
normal
{ "blob_id": "27e685750e5caa2f80c5a6399b07435ee9aa9fb9", "index": 7936, "step-1": "<mask token>\n\n\ndef xd_element(name):\n \"\"\"\n Return the element of an atom as defined in it's label.\n \"\"\"\n try:\n name = name[:2]\n except:\n pass\n try:\n covalence_radius[name]\n ...
[ 23, 33, 40, 50, 51 ]
from rest_framework import serializers from .models import * __all__ = ( 'CatalogCoinListSerializer', 'CatalogCoinSerializer', 'SeriesListSerializer', 'CoinListSerializer', 'CoinSerializer', 'CountriesListSerializer', ) class CountriesListSerializer(serializers.ModelSerializer): class Meta: mode...
normal
{ "blob_id": "b77da75b01e96ff89f873f4c5764a62cf68cd576", "index": 217, "step-1": "<mask token>\n\n\nclass SeriesListSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = Serie\n fields = 'name',\n\n\nclass CatalogCoinListSerializer(serializers.ModelSerializer):\n\n\n class Meta:...
[ 7, 8, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(0, len(data[0, :]) - 3): for j in range(0, len(data[0, :]) - 3): product_hor = data[j, i] * data[j, i + 1] * data[j, i + 2] * data[j, i + 3] if product_hor > max_product_hor: ...
flexible
{ "blob_id": "bacaaf5c91232d85f451c2c17a42cd2ec6966684", "index": 1499, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, len(data[0, :]) - 3):\n for j in range(0, len(data[0, :]) - 3):\n product_hor = data[j, i] * data[j, i + 1] * data[j, i + 2] * data[j,\n i + 3]\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class MyNode(at.Node): separator = '|' def test_render(): """Render string cast.""" root = MyNode('root') s0 = MyNode('sub0', parent=root) MyNode('sub0B', parent=s0) MyNode('sub0A', parent=s0) MyNode('sub1', parent=root) r = at.RenderTree(root) expect...
flexible
{ "blob_id": "a430b4629ee06dbfb267f839599383624e37451e", "index": 4582, "step-1": "<mask token>\n\n\nclass MyNode(at.Node):\n separator = '|'\n\n\ndef test_render():\n \"\"\"Render string cast.\"\"\"\n root = MyNode('root')\n s0 = MyNode('sub0', parent=root)\n MyNode('sub0B', parent=s0)\n MyNode...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class mysql(MakePackage): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class mysql(MakePackage): dependenci...
flexible
{ "blob_id": "ec90c731a0e546d9d399cbb68c92be1acca8cbe0", "index": 518, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass mysql(MakePackage):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass mysql(MakePackage):\n dependencies = ['cmake']\n fetch = ...
[ 0, 1, 2, 3, 4 ]
#! /usr/bin/env python3 import EchooFunctions, cgi, MySQLdb, hashlib, time, requests, os print ('Content-type: text/html\n') form = cgi.FieldStorage() #database connection user = "i494f18_team34" db_pass = "my+sql=i494f18_team34" db_con = MySQLdb.connect(host="db.soic.indiana.edu", port = 3306, user=user, passwd=db_...
normal
{ "blob_id": "dc88686d3cbb4223b4de6847bf4fc29b93054b00", "index": 495, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Content-type: text/html\\n')\n<mask token>\nif 'echooUser' in str(os.environ):\n userName = EchooFunctions.getUserName()\n userName = userName[0]\n userID = EchooFunctions....
[ 0, 1, 2, 3, 4 ]
from odoo import models, fields, api, _ class SaleAdvancePaymentInv(models.TransientModel): _inherit = "sale.advance.payment.inv" date_start_invoice_timesheet = fields.Date( string='Start Date', help="Only timesheets not yet invoiced (and validated, if applicable) from this period will be inv...
normal
{ "blob_id": "75b1674066958a8fa28e74121a35d688bcc473d9", "index": 9743, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass SaleAdvancePaymentInv(models.TransientModel):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass SaleAdvancePaymentInv(models.Transie...
[ 0, 1, 2, 3, 4 ]
#! /usr/bin/env python3 import os import requests # import json external_ip = "xx" data_path = "/data/feedback/" url = "http://{}/feedback/".format(external_ip) def read(): # read file file_list = os.listdir(data_path) result_list = [] for file in file_list: with open(data_path + file) as f:...
normal
{ "blob_id": "6f1bb9fde9ed9667ab81baa9e8ec965d711a0556", "index": 9853, "step-1": "<mask token>\n\n\ndef read():\n file_list = os.listdir(data_path)\n result_list = []\n for file in file_list:\n with open(data_path + file) as f:\n content = f.readlines()\n dict = {}\n ...
[ 4, 5, 6, 7, 8 ]
from typing import Any, Callable, Generator, List, Optional import pytest from _pytest import nodes from _pytest.config import hookimpl from _pytest.python import Function, PyCollector # type: ignore from hypothesis.errors import InvalidArgument # pylint: disable=ungrouped-imports from .._hypothesis import create_t...
normal
{ "blob_id": "2060f0af351c1487f8aa45943dbaa050f4291c58", "index": 7791, "step-1": "<mask token>\n\n\nclass SchemathesisCase(PyCollector):\n <mask token>\n\n def _get_test_name(self, endpoint: Endpoint) ->str:\n return f'{self.name}[{endpoint.method}:{endpoint.path}]'\n\n def _gen_items(self, endpo...
[ 4, 6, 7, 8, 9 ]
# ????? c=0 for i in range(12): if 'r' in input(): c+=1 # ?? print(c)
normal
{ "blob_id": "294b0dc7587ecd37887591da5a1afe96a4349f6b", "index": 8711, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(12):\n if 'r' in input():\n c += 1\nprint(c)\n", "step-3": "c = 0\nfor i in range(12):\n if 'r' in input():\n c += 1\nprint(c)\n", "step-4": "# ????...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- import sys from os import listdir, makedirs, unlink from os.path import isdir, join, isfile, exists from shutil import copy import random def clearDirectory( path ):#将dataset里面的文件都删除 for the_file in listdir(path): file_path = join(path, the_file) try: if isfile(file_path): ...
normal
{ "blob_id": "a714ac227d5185d7b4a932695ba6698e18d96341", "index": 629, "step-1": "# -*- coding: utf-8 -*-\nimport sys\nfrom os import listdir, makedirs, unlink\nfrom os.path import isdir, join, isfile, exists\nfrom shutil import copy\nimport random\n\ndef clearDirectory( path ):#将dataset里面的文件都删除\n\tfor the_file i...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> # -*- coding: utf-8 -*- """Digital Forensics Virtual File System (dfVFS). dfVFS, or Digital Forensics Virtual File System, is a Python module that provides read-only access to file-system objects from various storage media types and file formats. """
flexible
{ "blob_id": "f7d3096d669946e13186a893ffc53067e0fd0a0a", "index": 1065, "step-1": "<mask token>\n", "step-2": "# -*- coding: utf-8 -*-\n\"\"\"Digital Forensics Virtual File System (dfVFS).\n\ndfVFS, or Digital Forensics Virtual File System, is a Python module\nthat provides read-only access to file-system objec...
[ 0, 1 ]
from pymongo import MongoClient class MongoDB(): def __init__(self, host, port, db, table): self.host = host self.port = port self.client = MongoClient(host=self.host, port=self.port) self.db = self.client[db] self.table = self.db[table] # 获取一条数据 def get_one(self, q...
normal
{ "blob_id": "b5f88a6d119f2c3ce8fb77cf8c45b6c9252f5128", "index": 7619, "step-1": "<mask token>\n\n\nclass MongoDB:\n <mask token>\n\n def get_one(self, query):\n return self.table.find_one(query, property={'_id': False})\n <mask token>\n\n def add(self, kv_dict):\n return self.table.ins...
[ 5, 6, 7, 8, 9 ]
# 심사문제 22 # 표준 입력으로 정수 두 개가 입력됩니다(첫 번째 입력 값의 범위는 1~20, 두 번째 입력 값의 범위는 10~30이며 첫 번째 입력 값은 두 번째 입력 값보다 항상 작습니다). # 첫 번째 정수부터 두 번째 정수까지를 지수로 하는 2의 거듭제곱 리스트를 출력하는 프로그램을 만드세요 # (input에서 안내 문자열은 출력하지 않아야 합니다). 단, 리스트의 두 번째 요소와 뒤에서 두 번째 요소는 삭제한 뒤 출력하세요. 출력 결과는 리스트 형태라야 합니다. start, stop = list(map(int, input().split())) 1 10 ...
normal
{ "blob_id": "1f8040776a55d6fe52b64c714d4003469460e454", "index": 7186, "step-1": "# 심사문제 22\n# 표준 입력으로 정수 두 개가 입력됩니다(첫 번째 입력 값의 범위는 1~20, 두 번째 입력 값의 범위는 10~30이며 첫 번째 입력 값은 두 번째 입력 값보다 항상 작습니다).\n# 첫 번째 정수부터 두 번째 정수까지를 지수로 하는 2의 거듭제곱 리스트를 출력하는 프로그램을 만드세요\n# (input에서 안내 문자열은 출력하지 않아야 합니다). 단, 리스트의 두 번째 요소와 뒤에서 두 번...
[ 0 ]
<|reserved_special_token_0|> @app.route('/') def index(): pokemon_data = mongo.db.pokemon.find_one() return render_template('index.html', pokemon_data=pokemon_data) @app.route('/stats') def stats(): session = Session(engine) stats = session.query(pokemon_sql).all() pokemon_list = [] for poke...
flexible
{ "blob_id": "15e1ce95398ff155fe594c3b39936d82d71ab9e2", "index": 5015, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n pokemon_data = mongo.db.pokemon.find_one()\n return render_template('index.html', pokemon_data=pokemon_data)\n\n\n@app.route('/stats')\ndef stats():\n session = Session(eng...
[ 3, 4, 5, 6, 7 ]
from ctypes import * import os import sys import time import datetime import subprocess import RPi.GPIO as GPIO from PIL import Image from PIL import ImageDraw from PIL import ImageFont #import Adafruit_GPIO as GPIO import Adafruit_GPIO.SPI as SPI import ST7735 as TFT import pigpio # use BCM pin define pin_meas = 24 ...
normal
{ "blob_id": "d250cc0aafdd48cb0eb56108d9c7148153cde002", "index": 6840, "step-1": "<mask token>\n", "step-2": "<mask token>\ntime.sleep(1)\n<mask token>\nif len(sys.argv) < 6:\n error_str = str(sys.argv[0]\n ) + ' led1_current led2_current led_stable_time int_time1 int_time2'\n print(error_str)\nel...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python3 import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # or any {'0', '1', '2' os.environ['KERAS_BACKEND'] = 'tensorflow' import numpy as np import sys from util import load_model from keras.preprocessing.text import hashing_trick from keras.preprocessing.sequence import pad_sequences from southpar...
normal
{ "blob_id": "ed7b29a4d7f3a48884434373418c3528f2f397ac", "index": 271, "step-1": "<mask token>\n\n\ndef main():\n print('Loading model...')\n model, charset = load_model(MODEL_NAME)\n print(charset)\n seed_text = input('Enter a String: ').strip()\n print()\n generate_script(seed_text, model, cha...
[ 4, 5, 6, 7, 8 ]
import _thread import os from queue import Queue from threading import Thread import random import io import vk_api from vk_api.longpoll import VkLongPoll, VkEventType from datetime import datetime, timedelta import time from nltk.tokenize import RegexpTokenizer from nltk.corpus import stopwords from wordcloud import W...
normal
{ "blob_id": "03ce69924c885e59e40689dc63e50d54b89649f7", "index": 2924, "step-1": "<mask token>\n\n\ndef cloud(user_id):\n wall = tools.get_all('wall.get', 100, {'owner_id': user_id})['items']\n wall = list(filter(lambda x: datetime.fromtimestamp(x['date']).year ==\n current_year, wall))\n tokeniz...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class test(wx.Frame): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class test(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, 'TestFrame', size=(500, 500)) <|res...
flexible
{ "blob_id": "e204cbbf36ac180eba0e95916345088c77bca7c0", "index": 5001, "step-1": "<mask token>\n\n\nclass test(wx.Frame):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass test(wx.Frame):\n\n def __init__(self, parent, id):\n wx.Frame.__init__(self, parent, id, 'TestFrame', s...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class StockPicking(orm.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class StockPicking(orm.Model): <|reserved_special_token_0|> def _get_invoice_vals(self, cr, uid, key, inv_type, journal_...
flexible
{ "blob_id": "b111d799b9e71cf36253c37f83dc0cdc8887a32e", "index": 7404, "step-1": "<mask token>\n\n\nclass StockPicking(orm.Model):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass StockPicking(orm.Model):\n <mask token>\n\n def _get_invoice_vals(self, cr, uid, key, inv_type, jou...
[ 1, 2, 3, 4, 5 ]
from core import Postgresdb db = Postgresdb() print(db)
normal
{ "blob_id": "962a9781e4f2ad787dd695896b6455c9b336603a", "index": 7178, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(db)\n", "step-3": "<mask token>\ndb = Postgresdb()\nprint(db)\n", "step-4": "from core import Postgresdb\ndb = Postgresdb()\nprint(db)\n", "step-5": null, "step-ids": [ ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def add_nodes(g): nodes = ['a', 'b', 'c', 'd'] for n in nodes: g.add_node(n) def add_desc(g): desc = [('b', 'a'), ('b', 'c'), ('d', 'c')] for d in desc: g.add_desc(d) def add_edges(g): edges = [('b', 'a'), ('b', 'c'), ('d', 'c')] for e in edges:...
flexible
{ "blob_id": "8efee4ad16e938e85a500e5aebf5154b5708b277", "index": 9287, "step-1": "<mask token>\n\n\ndef add_nodes(g):\n nodes = ['a', 'b', 'c', 'd']\n for n in nodes:\n g.add_node(n)\n\n\ndef add_desc(g):\n desc = [('b', 'a'), ('b', 'c'), ('d', 'c')]\n for d in desc:\n g.add_desc(d)\n\n...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cleanedHostIntersection.saveAsTextFile('out/nasa_logs_same_hosts.csv') <|reserved_special_token_1|> <|reserved_special_token_0|> conf = SparkConf().setAppName('same_host').setMaster('local') sc = SparkContext(conf=conf) julyFir...
flexible
{ "blob_id": "36fce3837e0341d94ff6099a06be8cf757a1cfa9", "index": 3596, "step-1": "<mask token>\n", "step-2": "<mask token>\ncleanedHostIntersection.saveAsTextFile('out/nasa_logs_same_hosts.csv')\n", "step-3": "<mask token>\nconf = SparkConf().setAppName('same_host').setMaster('local')\nsc = SparkContext(conf...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class FreeReplier(RegularReplier): <|reserved_special_token_0|> def run(self): while self._running or self.input.qsize(): try: client, message = self.input.get(timeout=2) except Empty: continue result = s...
flexible
{ "blob_id": "42ebd42801b7d1563c9f204f296afba5fa3c6d3c", "index": 1592, "step-1": "<mask token>\n\n\nclass FreeReplier(RegularReplier):\n <mask token>\n\n def run(self):\n while self._running or self.input.qsize():\n try:\n client, message = self.input.get(timeout=2)\n ...
[ 5, 6, 7, 8, 10 ]
<|reserved_special_token_0|> class completeness(cpnest.model.Model): def __init__(self, catalog): self.names = ['z', 'h', 'om', 'ol'] self.bounds = [[0.001, 0.012], [0.5, 1.0], [0.04, 1.0], [0.0, 1.0]] self.omega = lal.CreateCosmologicalParameters(0.7, 0.5, 0.5, -1.0, 0.0, 0....
flexible
{ "blob_id": "fa5468741e9884f6c8bcacaf9d560b5c93ee781a", "index": 8906, "step-1": "<mask token>\n\n\nclass completeness(cpnest.model.Model):\n\n def __init__(self, catalog):\n self.names = ['z', 'h', 'om', 'ol']\n self.bounds = [[0.001, 0.012], [0.5, 1.0], [0.04, 1.0], [0.0, 1.0]]\n self.o...
[ 2, 9, 13, 15, 16 ]
<|reserved_special_token_0|> class GetData: key = ( 'fDs8VW%2BvtwQA8Q9LhBW%2BT2ETVBWWJaITjKfpzDsNJO8ugDsvdboInI16ZD295Txxtxwhc4G3PwMAvxd%2FWvz2gQ%3D%3D&pageNo=1&numOfRows=999' ) url = ( 'http://apis.data.go.kr/B552657/ErmctInfoInqireService/getEgytBassInfoInqire?serviceKey=' +...
flexible
{ "blob_id": "58ca520a2f43cef26a95de446f9c7a82819b0b66", "index": 833, "step-1": "<mask token>\n\n\nclass GetData:\n key = (\n 'fDs8VW%2BvtwQA8Q9LhBW%2BT2ETVBWWJaITjKfpzDsNJO8ugDsvdboInI16ZD295Txxtxwhc4G3PwMAvxd%2FWvz2gQ%3D%3D&pageNo=1&numOfRows=999'\n )\n url = (\n 'http://apis.data.go...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class Queue: def __init__(self): self.container = deque() def enqueue(self, data): self.container.appendleft(data) def dequeue(self): return self.container.pop() def is_empty(self): return len(self.container) == 0 <|reserved_special_...
flexible
{ "blob_id": "2898506b9fd5b112f93a1ff6b010848244c398bd", "index": 7197, "step-1": "<mask token>\n\n\nclass Queue:\n\n def __init__(self):\n self.container = deque()\n\n def enqueue(self, data):\n self.container.appendleft(data)\n\n def dequeue(self):\n return self.container.pop()\n\n...
[ 6, 7, 8, 9, 11 ]
<|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": "a6cb7a134fb8480d344743bcb7bc8766146d256f", "index": 8238, "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 = T...
[ 0, 1, 2, 3, 4 ]
import typing from pydantic import AnyUrl from .base import FBObject class MediaPayload(FBObject): url: AnyUrl class Coors(FBObject): lat: float long: float class LocationPayload(FBObject): coordinates: Coors class AttachmentFallback(FBObject): title: str url: AnyUrl payload: typin...
normal
{ "blob_id": "1f6176e9285d810934ae745cf8759b5cd6f408c8", "index": 8767, "step-1": "<mask token>\n\n\nclass LocationPayload(FBObject):\n coordinates: Coors\n\n\nclass AttachmentFallback(FBObject):\n title: str\n url: AnyUrl\n payload: typing.Any = None\n type: str = 'fallback'\n\n\nclass Attachment(...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def small_unet(pretrained_weights=False, patch_size=128): input_ = Input((patch_size, patch_size, 1)) skips = [] output = input_ for shape, filters in zip([5, 3, 3, 3, 3, 3, 3], [16, 32, 64, 64, 64, 64, 64]): skips.append(output) print(output.shape...
flexible
{ "blob_id": "b8d45a0028cb4e393ddca9dd6d246289328d1791", "index": 4044, "step-1": "<mask token>\n\n\ndef small_unet(pretrained_weights=False, patch_size=128):\n input_ = Input((patch_size, patch_size, 1))\n skips = []\n output = input_\n for shape, filters in zip([5, 3, 3, 3, 3, 3, 3], [16, 32, 64, 64...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class searchContactView(APIView): def get(self, request, *args, **kwargs): try: try: payload = JwtQueryParamAuthentication.authenticate(self, request)[0] except Exception as e: return Response({'statu...
flexible
{ "blob_id": "4b5794ff79371c2e49c5d2b621805b08c4ff7acb", "index": 8898, "step-1": "<mask token>\n\n\nclass searchContactView(APIView):\n\n def get(self, request, *args, **kwargs):\n try:\n try:\n payload = JwtQueryParamAuthentication.authenticate(self,\n requ...
[ 14, 18, 21, 25, 26 ]
from random import randint import matplotlib.pyplot as plt def generate_list(length: int) -> list: """Generate a list with given length with random integer values in the interval [0, length] Args: length (int): List length Returns: list: List generated with random values """ retu...
normal
{ "blob_id": "8804bfc5bed8b93e50279f0cbab561fe09d92a64", "index": 6522, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef plot_table(timestamps: dict, threadList: list, mList: list) ->None:\n \"\"\"Plot standard deviation chart\n\n Args:\n k (list): Threads/Process used\n deviatio...
[ 0, 1, 2, 3, 4 ]
from mpi4py import MPI import matplotlib from tmm import coh_tmm import pandas as pd import os from numpy import pi from scipy.interpolate import interp1d from joblib import Parallel, delayed import numpy as np import glob import matplotlib.pyplot as plt import pickle as pkl import seaborn as sns from scipy.optimize im...
normal
{ "blob_id": "f23bc0c277967d8e7a94a49c5a81ed5fb75d36cc", "index": 9327, "step-1": "<mask token>\n\n\nclass Memory:\n <mask token>\n <mask token>\n\n\n<mask token>\n\n\nclass DesignTracker:\n\n def __init__(self, epochs, **kwargs):\n \"\"\"\n This class tracks the best designs discovered.\n ...
[ 11, 16, 20, 22, 26 ]
def test_number(): pass
normal
{ "blob_id": "687ab41e9ce94c8d14154a941504845a8fa9f2d9", "index": 8660, "step-1": "<mask token>\n", "step-2": "def test_number():\n pass\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np def plot3D(xValues, labels, figure = 0): minClass = min(labels) numberOfClasses = int(max(labels) - minClass) fig = plt.figure(figure) ax = plt.axes(projection='3d') colors = ["r", "b", "y", "c", "m"] fo...
normal
{ "blob_id": "8dfd92ab0ce0e71b41ce94bd8fcf057c8995a2a4", "index": 1668, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef plot3D(xValues, labels, figure=0):\n minClass = min(labels)\n numberOfClasses = int(max(labels) - minClass)\n fig = plt.figure(figure)\n ax = plt.axes(projection='3d')...
[ 0, 1, 2, 3 ]
from PyQt5 import QtCore, QtWidgets from .main_window_base import Ui_MainWindow from .custom_sort_filter_proxy_model import CustomSortFilterProxyModel from .tree_model import TreeModel model_filename = "widgets/default.txt" class MainWindow(Ui_MainWindow, QtCore.QObject): def __init__(self, qmain_window): ...
normal
{ "blob_id": "7a918518d8c9ff1184a634d1a5c799e735dfbc8a", "index": 1707, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass MainWindow(Ui_MainWindow, QtCore.QObject):\n\n def __init__(self, qmain_window):\n super().__init__()\n self.setupUi(qmain_window)\n self._proxy_model = ...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> apiv1_urls = [url('^users/', include('user.urls')), url('^meetings/', include('meeting.urls')), url('^docs/', include( 'rest_framework_docs.urls')), url('^auth/', include('auth.urls')), url( '^fcm/devices/', include('d...
flexible
{ "blob_id": "aa00e4569aeae58e3f0ea1a8326e35c0776f7727", "index": 4849, "step-1": "<mask token>\n", "step-2": "<mask token>\napiv1_urls = [url('^users/', include('user.urls')), url('^meetings/',\n include('meeting.urls')), url('^docs/', include(\n 'rest_framework_docs.urls')), url('^auth/', include('auth....
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class SpriteObject(pygame.sprite.Sprite): <|reserved_special_token_0|> def update(self): self.rotate() def rotate(self): self.angle += 0.3 self.image = pygame.transform.rotate(self.original_image, self.angle) self.rect = self.image.get_rect(ce...
flexible
{ "blob_id": "b90c6a3f8fe084bc2acc0b733750124a1387527c", "index": 1712, "step-1": "<mask token>\n\n\nclass SpriteObject(pygame.sprite.Sprite):\n <mask token>\n\n def update(self):\n self.rotate()\n\n def rotate(self):\n self.angle += 0.3\n self.image = pygame.transform.rotate(self.or...
[ 3, 4, 5, 6, 8 ]
from rest_framework.views import APIView from .serializers import UserSerializer from rest_framework import permissions from .models import users from rest_framework.response import Response from django.http import JsonResponse from rest_framework import viewsets from profiles.models import profile from profiles.serial...
normal
{ "blob_id": "c5a7f269f579bd1960afa4f700b5c3436ac6d91a", "index": 2733, "step-1": "<mask token>\n\n\nclass GetDefaultUsers(APIView):\n <mask token>\n <mask token>\n\n\nclass GetSpecificUser(APIView):\n permission_classes = [permissions.IsAuthenticated]\n\n def post(self, request, id=None, *args, **kwa...
[ 4, 5, 6, 7, 8 ]
""" This type stub file was generated by pyright. """ import editobj3.introsp as introsp import editobj3.editor as editor from owlready2 import * from editobj3.observe import * from typing import Any, Optional __all__ = ["EditedInstances", "OntologyInstanceEditor"] class EditedInstances(object): def __init__(self, ...
normal
{ "blob_id": "440c116327ee587b5a305953772523011ece5dda", "index": 9641, "step-1": "<mask token>\n\n\nclass TabPaneRepartitor(editor.PaneRepartitor):\n\n def __init__(self, instance_editor, tab_edited_class):\n self.instance_editor = ...\n self.tab_edited_class = ...\n\n def is_displayed_in_oth...
[ 13, 16, 20, 23, 25 ]
import unittest2 as unittest class GpTestCase(unittest.TestCase): def __init__(self, methodName='runTest'): super(GpTestCase, self).__init__(methodName) self.patches = [] self.mock_objs = [] def apply_patches(self, patches): if self.patches: raise Exception('Test c...
normal
{ "blob_id": "e9c88e18472281438783d29648c673aa08366abb", "index": 1686, "step-1": "<mask token>\n\n\nclass GpTestCase(unittest.TestCase):\n\n def __init__(self, methodName='runTest'):\n super(GpTestCase, self).__init__(methodName)\n self.patches = []\n self.mock_objs = []\n\n def apply_...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def get_similar_words(words): words = [w.lower() for w in words] if len(words) > 1: maxScore = 0 firstWord = '' secondWord = '' labelCom = list(combinations(words, 2)) for i in labelCom: labelMean1 = wn.synsets(i[0]) ...
flexible
{ "blob_id": "879482e4df9c3d7f32d9b2a883201ae043e1189f", "index": 871, "step-1": "<mask token>\n\n\ndef get_similar_words(words):\n words = [w.lower() for w in words]\n if len(words) > 1:\n maxScore = 0\n firstWord = ''\n secondWord = ''\n labelCom = list(combinations(words, 2))\...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': hostname = 'forecast.derivacloud.org' catalog_id = '5' model = Model.from_catalog(DerivaServer('https', hostname, credentials= get_credential(hostname)).connect_ermrest(catalog_id)) ...
flexible
{ "blob_id": "a745f72081e06ff3399f9d7f65a30d7eef594689", "index": 2292, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n hostname = 'forecast.derivacloud.org'\n catalog_id = '5'\n model = Model.from_catalog(DerivaServer('https', hostname, credentials=\n get_crede...
[ 0, 1, 2, 3 ]
__version__ = '18.07.0'
normal
{ "blob_id": "3cac7829cf0c07ddc704a25ec3c781c9510a8e0c", "index": 3613, "step-1": "<mask token>\n", "step-2": "__version__ = '18.07.0'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> class Get(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> def setUp(self): pass <|reserved_special_token_0|> def test_gettoken(self): url = 'https://jdapi.jd100.com/uc/v1/sys/opterToken' params = {'opterTmpToken':...
flexible
{ "blob_id": "773c217f7f76bd82ed3dabf7ae1aba1871f0932f", "index": 8539, "step-1": "<mask token>\n\n\nclass Get(unittest.TestCase):\n <mask token>\n <mask token>\n\n def setUp(self):\n pass\n <mask token>\n\n def test_gettoken(self):\n url = 'https://jdapi.jd100.com/uc/v1/sys/opterToke...
[ 6, 7, 8, 11, 12 ]
def displayBoard(missedLetters, correctLetters, secretWord, alfabet_board, theme): print(hangnam_pics[len(missedLetters)]) print('Тема:', theme) for index in range(len(secretWord)): dashed_word = '' for char in secretWord: if char in correctLetters: dashed_wor...
flexible
{ "blob_id": "720ab0c0fcb40a50d73770e4ada6a78465e9ff96", "index": 2755, "step-1": "def displayBoard(missedLetters, correctLetters, secretWord, alfabet_board,\n theme):\n print(hangnam_pics[len(missedLetters)])\n print('Тема:', theme)\n for index in range(len(secretWord)):\n dashed_word = ''\n ...
[ 4, 6, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(1, 4000): req = requests.get(url) req.raise_for_status() soup = bs4.BeautifulSoup(req.text, 'lxml') comic = soup.select('#main-comic') comicUrl = 'http:' + comic[0].get('src') urllib.request....
flexible
{ "blob_id": "66e77b8237850a29127402310bfab3061f7ebca4", "index": 2346, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, 4000):\n req = requests.get(url)\n req.raise_for_status()\n soup = bs4.BeautifulSoup(req.text, 'lxml')\n comic = soup.select('#main-comic')\n comicUrl = '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def make_album_two(artist_name, album_title, number_of_songs=None): """Build a dictionary describing a music album""" music_album = {'Artist': artist_name.title(), 'Album': album_title.title()} if number_of_songs: music_album['Number of Songs'] = number_of_songs re...
flexible
{ "blob_id": "19888c998e8787533e84413272da1183f16fcdb1", "index": 2974, "step-1": "<mask token>\n\n\ndef make_album_two(artist_name, album_title, number_of_songs=None):\n \"\"\"Build a dictionary describing a music album\"\"\"\n music_album = {'Artist': artist_name.title(), 'Album': album_title.title()}\n ...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os from contextlib import contextmanager import yaml from omegaconf import OmegaConf class CrypTenConfig: ...
normal
{ "blob_id": "501ca508df5d72b0190b933f07c4bd505d7090c0", "index": 6464, "step-1": "<mask token>\n\n\nclass CrypTenConfig:\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\n @contextmanager\n de...
[ 2, 7, 10, 12, 13 ]