code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def main():
SetCodePage('ms932')
CreateScenaFile(FileName='C2219 ._SN', MapName='Ruan', Location=
'C2219.x', MapIndex=84, MapDefaultBGM='ed60015', Flags=0,
EntryFunctionIndex=65535, Reserved=0, Included... | flexible | {
"blob_id": "55c2bf914a77c573d1b6835f54c82921d9fa6ad6",
"index": 1010,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n SetCodePage('ms932')\n CreateScenaFile(FileName='C2219 ._SN', MapName='Ruan', Location=\n 'C2219.x', MapIndex=84, MapDefaultBGM='ed60015', Flags=0,\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class GetFromURL(tornado.web.RequestHandler):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def get(self, index=None, schema=None, entry=None, query=None):
query = dict()
resultGenerator = ResultGenerator()
query[c.OPERATION] = c.GET
... | flexible | {
"blob_id": "5a13c7e3be8a0b5f3baf7106a938fc97f078c5bc",
"index": 7335,
"step-1": "<mask token>\n\n\nclass GetFromURL(tornado.web.RequestHandler):\n <mask token>\n <mask token>\n\n def get(self, index=None, schema=None, entry=None, query=None):\n query = dict()\n resultGenerator = ResultGen... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if __name__ == '__main__':
pn1 = Point(9, 8)
pn2 = Point(6, 4)
print(f'dist: {pn1} and {pn1} = {ShapeUtils.distance(pn1, pn2)}')
rc1 = Rectangle(40, 20, 120, 300)
rc2 = Rectangle(30, 21, 350, 400)
print(f'd... | flexible | {
"blob_id": "b984dc052201748a88fa51d25c3bd3c22404fa96",
"index": 6571,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n pn1 = Point(9, 8)\n pn2 = Point(6, 4)\n print(f'dist: {pn1} and {pn1} = {ShapeUtils.distance(pn1, pn2)}')\n rc1 = Rectangle(40, 20, 120, 300)\n ... | [
0,
1,
2,
3
] |
# coding:utf-8
import requests
import io
from zipfile import ZipFile
if __name__ == '__main__':
sentence_url = "http://www.manythings.org/anki/deu-eng.zip"
r = requests.get(sentence_url)
z = ZipFile(io.BytesIO(r.content))
file = z.read('deu.txt')
eng_ger_data = file.decode()
eng_ger_data = eng_... | normal | {
"blob_id": "559c665e5544dd864d2f020c967ac8a8665af134",
"index": 6805,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n sentence_url = 'http://www.manythings.org/anki/deu-eng.zip'\n r = requests.get(sentence_url)\n z = ZipFile(io.BytesIO(r.content))\n file = z.read(... | [
0,
1,
2,
3
] |
from collections import defaultdict
squares = dict()
for i in range(2000):
squares[i * i] = i
perims = defaultdict(int)
for a in range(1, 1001):
for b in range(a + 1, 1001):
if a * a + b * b not in squares:
continue
c = squares[a * a + b * b]
perims[a + b + c] += 1
for perim,... | normal | {
"blob_id": "a3299a2945a638c74c2d16bc28079ed692718fbd",
"index": 2703,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(2000):\n squares[i * i] = i\n<mask token>\nfor a in range(1, 1001):\n for b in range(a + 1, 1001):\n if a * a + b * b not in squares:\n continue\n ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class BertBasedTODModel(nn.Module):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class BertBasedTODModel(nn.Module):
<|reserved_special_token_0|>
def forward(self, input_ids, attention_mask, token... | flexible | {
"blob_id": "74e70056ddfd8963a254f1a789a9058554c5489e",
"index": 2586,
"step-1": "<mask token>\n\n\nclass BertBasedTODModel(nn.Module):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass BertBasedTODModel(nn.Module):\n <mask token>\n\n def forward(self, input_ids, attention_mask, ... | [
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class TestCuboid(TestCase):
<|reserved_special_token_0|>
def test_input_value(self):
self.assertRaises(TypeError, cuboid_volume, 'ank')
<|reserved_special_token_0|>
def test_addition_input_value(self):
self.assertRaises(TypeError, add, 'ank', 6)
<|reser... | flexible | {
"blob_id": "394f835064d070a30040b6f01b25b6f0e005827d",
"index": 5010,
"step-1": "<mask token>\n\n\nclass TestCuboid(TestCase):\n <mask token>\n\n def test_input_value(self):\n self.assertRaises(TypeError, cuboid_volume, 'ank')\n <mask token>\n\n def test_addition_input_value(self):\n s... | [
3,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
def increment():
global time
time = time + 1
def start():
timer.start()
def stop():
global correct, tries
timer.stop()
if time != 0:
tries = tries + 1
if time % 10 == 0:
correct = correct + 1
def reset():
global time, correct, ... | flexible | {
"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
] |
vozrast=int(input("сколько вам лет?"))
print ("через 10 лет вам бóдет", vozrast+10) | normal | {
"blob_id": "8e3f23733235d73fab14e80ee0a3706ae351c7a2",
"index": 4525,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('через 10 лет вам бóдет', vozrast + 10)\n",
"step-3": "vozrast = int(input('сколько вам лет?'))\nprint('через 10 лет вам бóдет', vozrast + 10)\n",
"step-4": "vozrast=int(input(\... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def del_ops3(str1, str2):
common1 = [x for x in str1 if x in str2]
common2 = [x for x in str2 if x in str1]
if len(common2) < len(common1):
common1, common2 = common2, common1
if len(common1) == 0 or len(common2) == 0:
total = ... | flexible | {
"blob_id": "f9d1013fa278b9078e603b012abbdde0be2e0962",
"index": 7926,
"step-1": "<mask token>\n",
"step-2": "def del_ops3(str1, str2):\n common1 = [x for x in str1 if x in str2]\n common2 = [x for x in str2 if x in str1]\n if len(common2) < len(common1):\n common1, common2 = common2, common1\n... | [
0,
1,
2
] |
<|reserved_special_token_0|>
class AetNode(object):
def __init__(self, x, tx, my):
self.x = x
self.tx = tx
self.my = my
def op(self):
return self.x
class AetList(object):
def __init__(self, y):
self.y = y
self.numy = 0
self.l = []
pass
... | flexible | {
"blob_id": "0a7a95755924fd264169286cc5b5b7587d7ee8e4",
"index": 4608,
"step-1": "<mask token>\n\n\nclass AetNode(object):\n\n def __init__(self, x, tx, my):\n self.x = x\n self.tx = tx\n self.my = my\n\n def op(self):\n return self.x\n\n\nclass AetList(object):\n\n def __ini... | [
8,
10,
11,
12,
14
] |
import json
import math
import pandas as pd
import datetime
record_file = r"D:\Doc\data\BBOS.log"
all_records = []
with open(record_file, "r") as f:
all_line = f.readlines()
for line in all_line:
record_time = line[line.index("[") + 1: line.index("]")]
record_order = json.loads(line[l... | normal | {
"blob_id": "fbbadb5cbd2b324686fc5faa0b1bc6236fc8d87b",
"index": 9218,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open(record_file, 'r') as f:\n all_line = f.readlines()\n for line in all_line:\n record_time = line[line.index('[') + 1:line.index(']')]\n record_order = json.lo... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in file:
for j in i:
if j != '\n':
inp += j
else:
inp += ' '
inp += ' '
file.close()
<|reserved_special_token_0|>
for i in inp:
if i != ' ':
tmp += i
else:
... | flexible | {
"blob_id": "bb847480e7e4508fbfb5e7873c4ed390943e2fcf",
"index": 3589,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in file:\n for j in i:\n if j != '\\n':\n inp += j\n else:\n inp += ' '\ninp += ' '\nfile.close()\n<mask token>\nfor i in inp:\n if i != ' ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for word, frequency in sorted(elements, key=lambda x: x[1], reverse=True):
cell = table.add_row().cells
cell[0].text = str(word)
cell[1].text = str(frequency)
doc.save('results.docx')
<|reserved_special_token_1|>
<|... | flexible | {
"blob_id": "9ad36f157abae849a1550cb96e650746d57f491d",
"index": 9732,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor word, frequency in sorted(elements, key=lambda x: x[1], reverse=True):\n cell = table.add_row().cells\n cell[0].text = str(word)\n cell[1].text = str(frequency)\ndoc.save('re... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
@api_view(['GET'])
def get_status(request):
if request.method == 'GET':
return HttpResponse(content='Service is OK!')
<|reserved_special_token_1|>
from django.http import HttpResponse
from rest_framework.decorator... | flexible | {
"blob_id": "f021940c16b7ed7fdf1088f2137d3ef724719c80",
"index": 1726,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@api_view(['GET'])\ndef get_status(request):\n if request.method == 'GET':\n return HttpResponse(content='Service is OK!')\n",
"step-3": "from django.http import HttpRespo... | [
0,
1,
2
] |
from django.conf.urls import url, include
from . import views
from django.conf import settings
from django.conf.urls.static import static
app_name = 'stock_main'
urlpatterns = [
url(r'^$', views.Stock_main.as_view(), name='stock_main'),
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_RO... | normal | {
"blob_id": "16302f23edf16e201c3f3e9800dc4a9290ddc29e",
"index": 7038,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n",
"step-3": "<mask token>\napp_name = 'stock_main'\nurlpatterns = [url('^$', views.Stock_main.as_view(), n... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class LocNet:
def __init__(self, scope, buttom_layer):
self.scope = scope
with tf.variable_scope(scope) as scope:
self.build_graph(buttom_layer)
self.gt_loc = tf.placeholder(dtype=tf.float32, shape=(None, 4),
name='gt_loc')
... | flexible | {
"blob_id": "dd4dc1c4a0dc47711d1d0512ef3f6b7908735766",
"index": 3149,
"step-1": "<mask token>\n\n\nclass LocNet:\n\n def __init__(self, scope, buttom_layer):\n self.scope = scope\n with tf.variable_scope(scope) as scope:\n self.build_graph(buttom_layer)\n self.gt_loc = tf.... | [
2,
3,
4,
5,
6
] |
from django.db import models
from django.template.defaultfilters import slugify
# Create your models here.
class SlugStampMixin(object):
'''
An Worflow is an ordered collection of a Protocols
'''
def save(self, *args, **kwargs):
super(SlugStampMixin, self).save(*args, **kwargs) # Method may n... | normal | {
"blob_id": "c30f11e9bac54771df5198971c312624f68d0a33",
"index": 4259,
"step-1": "<mask token>\n\n\nclass SlugStampMixin(object):\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass SlugStampMixin(object):\n <mask token>\n\n def save(self, *args, **kwargs):\n ... | [
1,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def sendmail(subject, template, to, context):
template_str = 'app/' + template + '.html'
html_msg = render_to_string(template_str, {'data': context})
plain_msg = strip_tags(html_msg)
from_email = 'ridham.shah.adi... | flexible | {
"blob_id": "0349a8a4841b024afd77d20ae18810645fad41cd",
"index": 4883,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef sendmail(subject, template, to, context):\n template_str = 'app/' + template + '.html'\n html_msg = render_to_string(template_str, {'data': context})\n plain_msg = strip_... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def solution2(n):
result_list = [1, 2]
for i in range(3, n + 1):
max_mult = max(list(map(lambda x: result_list[x] * (i - x - 1),
range(i - 1))))
result_list.append(max_mult)
print(resu... | flexible | {
"blob_id": "76db5955b29696ca03ab22ef14ac018e0618e9e3",
"index": 2729,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef solution2(n):\n result_list = [1, 2]\n for i in range(3, n + 1):\n max_mult = max(list(map(lambda x: result_list[x] * (i - x - 1),\n range(i - 1))))\n ... | [
0,
1,
2,
3,
4
] |
# Any object containing execute(self) method is considered to be IDE App
# this is Duck typing concept
class PyCharm:
def execute(self):
print("pycharm ide runnig")
class MyIde:
def execute(self):
print("MyIde running")
class Laptop:
def code(self,ide):
ide.execut... | normal | {
"blob_id": "9ab3dd87f17ac75a3831e9ec1f0746ad81fad70d",
"index": 501,
"step-1": "<mask token>\n\n\nclass MyIde:\n <mask token>\n\n\nclass Laptop:\n\n def code(self, ide):\n ide.execute()\n\n\n<mask token>\n",
"step-2": "class PyCharm:\n <mask token>\n\n\nclass MyIde:\n\n def execute(self):\n... | [
3,
5,
7,
8,
9
] |
<|reserved_special_token_0|>
@app_views.route('cities/<city_id>/places', strict_slashes=False, methods=[
'GET'])
def get_all_places(city_id):
""" gets all places in a city """
city = storage.get('City', city_id)
if not city:
abort(404)
return jsonify([place.to_dict() for place in city.plac... | flexible | {
"blob_id": "d67a2eca4e2fde443b99f5133c2657cdf4ac00de",
"index": 4173,
"step-1": "<mask token>\n\n\n@app_views.route('cities/<city_id>/places', strict_slashes=False, methods=[\n 'GET'])\ndef get_all_places(city_id):\n \"\"\" gets all places in a city \"\"\"\n city = storage.get('City', city_id)\n if ... | [
3,
4,
5,
6,
7
] |
#coding=utf-8
'初始化Package,加载url,生成app对象'
import web
from myapp.urls import urls
app = web.application(urls, globals())
| normal | {
"blob_id": "4480b305a6f71ff64022f2b890998326bf402bf0",
"index": 1669,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napp = web.application(urls, globals())\n",
"step-3": "<mask token>\nimport web\nfrom myapp.urls import urls\napp = web.application(urls, globals())\n",
"step-4": "#coding=utf-8\r\n'初始... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def test_ogr_toposjon_objects_is_dict():
ds = ogr.Open('data/topojson/topojson2.topojson')
lyr = ds.GetLayer(0)
assert lyr.GetName() == 'a_layer'
assert lyr.GetLayerDefn().GetFieldCount() == 2
assert lyr.GetLayerDefn().GetFieldDefn(0).GetName() == 'id'
assert lyr.G... | flexible | {
"blob_id": "270dba92af583e37c35ed5365f764adfdc2f947d",
"index": 2112,
"step-1": "<mask token>\n\n\ndef test_ogr_toposjon_objects_is_dict():\n ds = ogr.Open('data/topojson/topojson2.topojson')\n lyr = ds.GetLayer(0)\n assert lyr.GetName() == 'a_layer'\n assert lyr.GetLayerDefn().GetFieldCount() == 2\... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def noOfStepsDP(n, k):
dp = [0] * max(n + 1, 3)
dp[0] = 1
dp[1] = 1
dp[2] = 2
for i in range(3, n + 1):
dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3]
return dp[n]
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def noOfSteps(n, k):
if n < 0:
... | flexible | {
"blob_id": "6c2699ff8e739595a2648d53745dc3c788536d7b",
"index": 1907,
"step-1": "<mask token>\n\n\ndef noOfStepsDP(n, k):\n dp = [0] * max(n + 1, 3)\n dp[0] = 1\n dp[1] = 1\n dp[2] = 2\n for i in range(3, n + 1):\n dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3]\n return dp[n]\n\n\n<mask toke... | [
1,
2,
3,
4,
5
] |
#给定一个非负整数数组 A,返回一个数组,在该数组中, A 的所有偶数元素之后跟着所有奇数元素。你可以返回满足此条件的任何数组作为答案
class Solution:
def sortArrayByParity(self, A: List[int]) -> List[int]:
l=[]
r=[]
for x in A:
if(x%2==0):
l.append(x)
else:
r.append(x)
ans=l+r
return a... | normal | {
"blob_id": "ae4d12ff88cf08b2e19b212c80549adc0a0d47dc",
"index": 2030,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def sortArrayByParity(self, A: List[int]) ->List[int]:\n l = []\n r = []\n for x in A:\n if x %... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def Float32():
return tf.float32
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def Float32():
return tf.float32
def Float16():
return tf.float16
<|reserved_special_... | flexible | {
"blob_id": "c60b8eec57d845c73ee3e00432747d23748c1706",
"index": 9537,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef Float32():\n return tf.float32\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef Float32():\n return tf.float32\n\n\ndef Float16():\n return tf.float16\n",
"step... | [
0,
1,
2,
3
] |
from __future__ import division, print_function, absolute_import
"""
The dataset is stored in a CSV file, so we can use the TFLearn load_csv() function to
load the data from the CSV file into a python list.
We specify the 'target_column' argument to indicate that our labels (survived or not)
are located in the first... | normal | {
"blob_id": "87e9c1d264523d02b287dedb44472fc08b488908",
"index": 9630,
"step-1": "<mask token>\n\n\ndef preprocess(passengers, columns_to_delete):\n for column_to_delete in sorted(columns_to_delete, reverse=True):\n [passenger.pop(column_to_delete) for passenger in passengers]\n for i in range(len(p... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
app_name = 'stock_main'
urlpatterns = [url('^$', views.Stock_main.as_view(), name='stock_mai... | flexible | {
"blob_id": "16302f23edf16e201c3f3e9800dc4a9290ddc29e",
"index": 7038,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n",
"step-3": "<mask token>\napp_name = 'stock_main'\nurlpatterns = [url('^$', views.Stock_main.as_view(), n... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
app_name = 'restuarant'
urlpatterns = [path('orderplaced/', views.orderplaced), path('restaurant/',
views.restuarent, name='restuarant'), path('login/restaurant/', views.
restLogin, name='rlogin'), path('register/restauran... | flexible | {
"blob_id": "63830a3c09a2d0a267b030a336062d5e95b9a71a",
"index": 3308,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napp_name = 'restuarant'\nurlpatterns = [path('orderplaced/', views.orderplaced), path('restaurant/',\n views.restuarent, name='restuarant'), path('login/restaurant/', views.\n restL... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if __name__ == '__main__':
video_compress.apply_async(['a'], queue='high')
video_compress.apply_async(['b'], queue='low')
video_upload.apply_async(['c'], queue='low')
video_upload.apply_async(['d'], queue='high')
... | flexible | {
"blob_id": "2cd7d4fe87de66e85bc0d060e2eaa68be39eed02",
"index": 9461,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n video_compress.apply_async(['a'], queue='high')\n video_compress.apply_async(['b'], queue='low')\n video_upload.apply_async(['c'], queue='low')\n ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class FrenetPath:
def __init__(self):
self.t = []
self.d = []
self.d_d = []
self.d_dd = []
self.d_ddd = []
self.s = []
self.s_d = []
self.s_dd = []
self.s_ddd = []
self.cd = 0.0
self.cv = 0.0
... | flexible | {
"blob_id": "4647a7d0996ceeef4f39cf3182ac3944d25cb349",
"index": 8197,
"step-1": "<mask token>\n\n\nclass FrenetPath:\n\n def __init__(self):\n self.t = []\n self.d = []\n self.d_d = []\n self.d_dd = []\n self.d_ddd = []\n self.s = []\n self.s_d = []\n s... | [
20,
21,
24,
25,
27
] |
#!/usr/bin/python3
"""Unittest for max_integer([..])
"""
import unittest
max_integer = __import__('6-max_integer').max_integer
class TestMaxInteger(unittest.TestCase):
""" Interactive tests """
def test_max(self):
"""Tests max_integer"""
self.assertEqual(max_integer([1, 2, 3]), 3)
self... | normal | {
"blob_id": "f799fdfde537bbe8f6c49a5e1a15cf6f910a0d45",
"index": 889,
"step-1": "<mask token>\n\n\nclass TestMaxInteger(unittest.TestCase):\n <mask token>\n\n def test_max(self):\n \"\"\"Tests max_integer\"\"\"\n self.assertEqual(max_integer([1, 2, 3]), 3)\n self.assertEqual(max_intege... | [
2,
3,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in conf_arr:
a = 0
tmp_arr = []
a = sum(i, 0)
for j in i:
tmp_arr.append(float(j) / float(a))
norm_conf.append(tmp_arr)
<|reserved_special_token_0|>
plt.clf()
<|reserved_special_token_0|>
ax.set_a... | flexible | {
"blob_id": "923a2979df3c37583eec712880ad821541bd898b",
"index": 8735,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in conf_arr:\n a = 0\n tmp_arr = []\n a = sum(i, 0)\n for j in i:\n tmp_arr.append(float(j) / float(a))\n norm_conf.append(tmp_arr)\n<mask token>\nplt.clf()\n<... | [
0,
1,
2,
3
] |
import time
from numpy import empty
from src.utils import normalize_input_sentence, evaluate, add_begin_and_trailing_tag, check_for_terminal_argument
from classes.BaseTagger import BaseTagger
from src.CONSTANT import POS_TAG_KEYNAME, WORD_KEYNAME, TRUETAG_KEYNAME, DEFAULT_TRAINING_FILENAME
import sys
import os
# TOD... | normal | {
"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|>
def average(run):
print('____________________________________')
sum = 0
for i in range(0, len(run)):
sum += run[i]
avg = sum / len(run)
print('Average score of the team is :', avg)
def high(run):
print('______________________________________')
max... | flexible | {
"blob_id": "3d7ca468a1f7aa1602bff22167e9550ad515fa79",
"index": 4777,
"step-1": "<mask token>\n\n\ndef average(run):\n print('____________________________________')\n sum = 0\n for i in range(0, len(run)):\n sum += run[i]\n avg = sum / len(run)\n print('Average score of the team is :',... | [
4,
5,
6,
7,
8
] |
import cv2 as cv
import numpy as np
import pytesseract as tes
text = get_text_from_image("resizedReceipt.jpg")
print(text)
def get_text_from_image(imageName):
img = preprocess(imageName)
result = tes.image_to_string(img)
return result
def preprocess(image_name):
image = cv.imread(image_name)
g... | normal | {
"blob_id": "e480136aca96e45cc8a7ca34c1a9d09b96a5a4da",
"index": 4152,
"step-1": "<mask token>\n\n\ndef get_text_from_image(imageName):\n img = preprocess(imageName)\n result = tes.image_to_string(img)\n return result\n\n\n<mask token>\n\n\ndef find_receipt_box(image):\n \"\"\"\n Finds a contour a... | [
5,
7,
8,
9,
10
] |
# -*- coding: utf-8 -*-
from services.interfaces.i_service import IService
from services.dbservices.db_service import DBService
class GetCommunitiesByOffsetService(IService):
def __init__(self, core, parameters):
super(GetCommunitiesByOffsetService, self).__init__(core, parameters)
def run(self):
... | normal | {
"blob_id": "051bd11c42815ec8f8ece8eae9d33890da77129c",
"index": 148,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass GetCommunitiesByOffsetService(IService):\n <mask token>\n\n def run(self):\n return DBService(self.core).getNextFields('Communities', self.\n parameters['... | [
0,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
load_dotenv()
<|reserved_special_token_0|>
print('Ready!')
@bot.command()
async def stop(ctx):
await ctx.message.delete()
await ctx.voice_client.disconnect()
@bot.command()
async def wew(ctx):
await ctx.message.del... | flexible | {
"blob_id": "41842e8b75860c65e87e9db1f7ae058957e37e45",
"index": 1822,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nload_dotenv()\n<mask token>\nprint('Ready!')\n\n\n@bot.command()\nasync def stop(ctx):\n await ctx.message.delete()\n await ctx.voice_client.disconnect()\n\n\n@bot.command()\nasync ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def year_choices():
return [(r, r) for r in range(1984, datetime.date.today().year + 1)]
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def year_choices():
return [(r, r) fo... | flexible | {
"blob_id": "90bb70b0a97c7872c8581a176ebacc50df8e1f72",
"index": 464,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef year_choices():\n return [(r, r) for r in range(1984, datetime.date.today().year + 1)]\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef year_choices():\n return [(r, ... | [
0,
1,
2,
3
] |
import cv2
import numpy as np
import matplotlib.pyplot as plt
'''
def diff_of_gaussians(img):
grey_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
blur_img_grey = cv2.GaussianBlur(grey_img, (9,9), 0)
blur_img_colour = cv2.GaussianBlur(img, (9,9), 0)
#plt.fig... | normal | {
"blob_id": "c3a7a8a006f717057a7ad2920f19d82842b04a85",
"index": 9510,
"step-1": "<mask token>\n\n\ndef canny(img):\n grey_img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)\n blurred_img = cv2.GaussianBlur(grey_img, (9, 9), 0)\n canny_filtered = cv2.Canny(blurred_img, 30, 150)\n return canny_filtered\n\n\n... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
K_model.summary()
<|reserved_special_token_0|>
for line in k_file.readlines():
line = line.rstrip()
contents = line.split('\t')
label = contents.pop()
labels.append([float(label)])
features.append([float(i) for... | flexible | {
"blob_id": "1c2a862f995869e3241dd835edb69399141bfb64",
"index": 8926,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nK_model.summary()\n<mask token>\nfor line in k_file.readlines():\n line = line.rstrip()\n contents = line.split('\\t')\n label = contents.pop()\n labels.append([float(label)])... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def run_task(*_):
env = normalize(GymEnv('DartWalker2d-v1', record_video=False))
policy_sep = GaussianHLCPolicy(env_spec=env.spec, hidden_sizes=(64, 32),
sub_out_dim=3, option_dim=2)
policy_sep = joblib.load(... | flexible | {
"blob_id": "9f479ad2acf4f6deb0ca4db606c3d804979c10bd",
"index": 3804,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef run_task(*_):\n env = normalize(GymEnv('DartWalker2d-v1', record_video=False))\n policy_sep = GaussianHLCPolicy(env_spec=env.spec, hidden_sizes=(64, 32),\n sub_out_di... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def blur():
image = cv2.imread(IMG_PATH + '/jjang.jpg')
kernel_sizes = [(1, 1), (3, 3), (5, 5), (7, 7), (7, 1), (1, 7)]
filter_imgs = {}
blur_imgs = {}
for ksize in kernel_sizes:
title = f'ksize: {ksize}'
kernel = np.ones(ksize)
kernel /= kernel... | flexible | {
"blob_id": "8e5d05d925d47a85ad7c211f26af7951be048d32",
"index": 9351,
"step-1": "<mask token>\n\n\ndef blur():\n image = cv2.imread(IMG_PATH + '/jjang.jpg')\n kernel_sizes = [(1, 1), (3, 3), (5, 5), (7, 7), (7, 1), (1, 7)]\n filter_imgs = {}\n blur_imgs = {}\n for ksize in kernel_sizes:\n ... | [
2,
4,
5,
6,
7
] |
version https://git-lfs.github.com/spec/v1
oid sha256:91f725dc0dba902c5c2c91c065346ab402c8bdbf4b5b13bdaec6773df5d06e49
size 964
| normal | {
"blob_id": "42187f460a64572d2581ed5baec41eaff47466f8",
"index": 8672,
"step-1": "version https://git-lfs.github.com/spec/v1\noid sha256:91f725dc0dba902c5c2c91c065346ab402c8bdbf4b5b13bdaec6773df5d06e49\nsize 964\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]... | [
0
] |
import graphics
from graphics import *
class Renderer():
def __init__(self, engine, width=700, height=600):
self.width = width
self.height = height
self.engine = engine
self.win = GraphWin("Game Board", width, height)
self.win.setBackground("blue")
def update(self):
... | normal | {
"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
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with open('final_regroup.csv', 'w', newline='') as train:
writer = csv.writer(train)
with open('final_syn_train.csv', 'r') as zhidao:
reader = csv.reader(zhidao)
cluster = []
cur = []
stand ... | flexible | {
"blob_id": "3a09cbd71d23b1320af9b8ddcfc65b223e487b21",
"index": 1811,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('final_regroup.csv', 'w', newline='') as train:\n writer = csv.writer(train)\n with open('final_syn_train.csv', 'r') as zhidao:\n reader = csv.reader(zhidao)\n ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def get_random_ip_or_user(start, end, prefix='172.16.90.', type='ip'):
if type == 'ip' and max(start, end) > 255:
end = 255
i = random.randint(start, end)
return prefix + str(i)
def get_random_ips_users(start, end, num, prefix='172.16.90.', type='ip'):
if type ==... | flexible | {
"blob_id": "a7fae2da8abba6e05b4fc90dec8826194d189853",
"index": 2758,
"step-1": "<mask token>\n\n\ndef get_random_ip_or_user(start, end, prefix='172.16.90.', type='ip'):\n if type == 'ip' and max(start, end) > 255:\n end = 255\n i = random.randint(start, end)\n return prefix + str(i)\n\n\ndef ge... | [
6,
7,
8,
9,
11
] |
<|reserved_special_token_0|>
def create_training_data():
for category in CATEGORIES:
path = os.path.join(DATADIR, category)
classIndex = CATEGORIES.index(category)
for img in os.listdir(path):
try:
img_array = cv2.imread(os.path.join(path, img), cv2.
... | flexible | {
"blob_id": "13c9f0f58ec6da317c3802f594bb0db7c275dee9",
"index": 21,
"step-1": "<mask token>\n\n\ndef create_training_data():\n for category in CATEGORIES:\n path = os.path.join(DATADIR, category)\n classIndex = CATEGORIES.index(category)\n for img in os.listdir(path):\n try:\n... | [
1,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class DetailView(generic.DetailView):
model = Project
template_name = 'projects/detail.html'
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class IndexView(generic.ListView):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def get_queryset(se... | flexible | {
"blob_id": "23d15c719cd26ea67a032a91a3e73f0d8d3bcfd1",
"index": 6662,
"step-1": "<mask token>\n\n\nclass DetailView(generic.DetailView):\n model = Project\n template_name = 'projects/detail.html'\n",
"step-2": "<mask token>\n\n\nclass IndexView(generic.ListView):\n <mask token>\n <mask token>\n\n ... | [
2,
4,
5,
6,
7
] |
#from getData import getRatings
import numpy as np
num_factors = 10
num_iter = 75
regularization = 0.05
lr = 0.005
folds=5
#to make sure you are able to repeat results, set the random seed to something:
np.random.seed(17)
def split_matrix(ratings, num_users, num_movies):
#Convert data into (IxJ... | normal | {
"blob_id": "b4267612e7939b635542099e1ba31e661720607a",
"index": 3129,
"step-1": "<mask token>\n\n\ndef split_matrix(ratings, num_users, num_movies):\n X = np.zeros((num_users, num_movies))\n for r in np.arange(len(ratings)):\n X[ratings[r, 0] - 1, ratings[r, 1] - 1] = ratings[r, 2]\n return X\n\... | [
2,
3,
4,
5,
7
] |
import os
from flask import Flask,request
from flask_restful import Resource,Api,reqparse
from flask_jwt import JWT,jwt_required
from resources.Users import UserRegister
from security import authenticate,identity
from resources.items import Item, ItemList
from resources.stores import Store, StoreList
app = Flask(__nam... | normal | {
"blob_id": "bf8f7b51b685f0e9131cb4d8a0bfc16ee5ad1263",
"index": 3281,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napi.add_resource(StoreList, '/stores')\napi.add_resource(Store, '/store/<string:name>')\napi.add_resource(ItemList, '/items')\napi.add_resource(Item, '/item/<string:name>')\napi.add_resou... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
@attr.s
class MusicDB(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
@feat.default
def _feat_default(self):
our_feat = utils.load_tracks(givegenre=True, outliers=False, fill=False
)
miao = ou... | flexible | {
"blob_id": "0e57e25c11ba97aef5467f61d99065609e127f5b",
"index": 2782,
"step-1": "<mask token>\n\n\n@attr.s\nclass MusicDB(object):\n <mask token>\n <mask token>\n <mask token>\n\n @feat.default\n def _feat_default(self):\n our_feat = utils.load_tracks(givegenre=True, outliers=False, fill=F... | [
4,
6,
8,
9,
11
] |
import time
import pickle
class BayesNetClassifier:
def __init__(self, train_file, out_file):
self.train_file = train_file
self.out_file = out_file
self.word_count_loc = {}
self.word_probs = {}
self.l_probs = {}
self.word_counts = {}
self.common_wo... | normal | {
"blob_id": "dee7b12862d02837fbb0f2310b136dd768ca7bab",
"index": 3277,
"step-1": "<mask token>\n\n\nclass BayesNetClassifier:\n\n def __init__(self, train_file, out_file):\n self.train_file = train_file\n self.out_file = out_file\n self.word_count_loc = {}\n self.word_probs = {}\n ... | [
3,
6,
7,
8,
10
] |
'''
Created on 5 Mar 2010
@author: oppianmatt
'''
# hook to find setup tools if not installed
try:
from ez_setup import use_setuptools
use_setuptools()
except ImportError:
pass
from setuptools import setup, find_packages
setup(
name = "django-defaultsite",
version = "1.1",
packages = find_pac... | normal | {
"blob_id": "5580e5942370c925b759b09675306cdfbc7dd4f1",
"index": 3633,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntry:\n from ez_setup import use_setuptools\n use_setuptools()\nexcept ImportError:\n pass\n<mask token>\nsetup(name='django-defaultsite', version='1.1', packages=find_packages(\n... | [
0,
1,
2,
3
] |
import os
import argparse
from data.downloader import *
from data.utils import *
from data.danmaku import *
from utils import *
key = '03fc8eb101b091fb'
parser = argparse.ArgumentParser(description='Download Video From Bilibili')
parser.add_argument('-d', type=str, help='dataset')
parser.add_argument('-o', type=str, de... | normal | {
"blob_id": "479411727de14e8032b6d01cdb844632111af688",
"index": 5275,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nparser.add_argument('-d', type=str, help='dataset')\nparser.add_argument('-o', type=str, default='dataset', help='output directory')\nparser.add_argument('-f', type=str, default='mp4', he... | [
0,
1,
2,
3
] |
import datetime
import logging
import os
import requests
from bs4 import BeautifulSoup
import telebot
from azure.storage.blob import BlobClient
import hashlib
import azure.functions as func
def hash_string(input_string: str) -> str:
return hashlib.sha256(input_string.encode("utf-8")).hexdigest()
... | normal | {
"blob_id": "670a23aa910a6709735281b7e64e5254a19277c6",
"index": 7924,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef hash_string(input_string: str) ->str:\n return hashlib.sha256(input_string.encode('utf-8')).hexdigest()\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef hash_string(inp... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class PredictionQueryToken(Model):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __init__(self, session=None, continuation=None, max_count=None,
order_by=None, tags=None, iteration_id=None, start_time=None,
end_time=None, application=None):
... | flexible | {
"blob_id": "0719448e7eb8d48e636be1332c904beebf27e02d",
"index": 4163,
"step-1": "<mask token>\n\n\nclass PredictionQueryToken(Model):\n <mask token>\n <mask token>\n\n def __init__(self, session=None, continuation=None, max_count=None,\n order_by=None, tags=None, iteration_id=None, start_time=No... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def assert_number(arg):
if not isinstance(arg, (int, float)):
raise TypeError(f'Expected number, got {type(arg)}')
<|reserved_special_token_1|>
def assert_number(arg):
if not isinstance(arg, (int, float)):
raise TypeError(f"Expected... | flexible | {
"blob_id": "2de62c73507acac597d70557adfe8286e2f28a1f",
"index": 5569,
"step-1": "<mask token>\n",
"step-2": "def assert_number(arg):\n if not isinstance(arg, (int, float)):\n raise TypeError(f'Expected number, got {type(arg)}')\n",
"step-3": "def assert_number(arg):\n if not isinstance(arg, (in... | [
0,
1,
2
] |
<|reserved_special_token_0|>
def canny(img):
grey_img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
blurred_img = cv2.GaussianBlur(grey_img, (9, 9), 0)
canny_filtered = cv2.Canny(blurred_img, 30, 150)
return canny_filtered
<|reserved_special_token_0|>
def dispay_lines(img, lines):
line_img = np.zero... | flexible | {
"blob_id": "c3a7a8a006f717057a7ad2920f19d82842b04a85",
"index": 9510,
"step-1": "<mask token>\n\n\ndef canny(img):\n grey_img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)\n blurred_img = cv2.GaussianBlur(grey_img, (9, 9), 0)\n canny_filtered = cv2.Canny(blurred_img, 30, 150)\n return canny_filtered\n\n\n... | [
4,
5,
6,
7,
8
] |
#This version assumes domains = train/test set
import numpy as np
from ..utils import Dataset
import math
import random
from .interface import TopicModel
from .man_model.models import *
from .man_model import utils
from .man_model.options import opt
import torch.utils.data as data_utils
from tqdm import tqdm
from colle... | normal | {
"blob_id": "8f01934472805b5ad6dca328483a7ac79ae7748a",
"index": 6474,
"step-1": "<mask token>\n\n\nclass MultinomialAdversarialNetwork(TopicModel):\n <mask token>\n\n def prepare_data(self, d):\n \"\"\"\n Assume d is a dictionary of dataset where d[domain] = another dataset class\n As... | [
4,
5,
6,
8,
9
] |
workdir = './model/adamW-BCE/model_seresnext50_32x4d_i768_runmila_2fold_50ep'
seed = 300
n_fold = 2
epoch = 50
resume_from = None
batch_size = 32
num_workers = 32
imgsize = (768, 768) #(height, width)
loss = dict(
name='BCEWithLogitsLoss',
params=dict(),
)
optim = dict(
name='AdamW',
params=dict(
... | normal | {
"blob_id": "8030bdb6c9f0b7114916d7abc245ff680d1fc917",
"index": 6790,
"step-1": "<mask token>\n",
"step-2": "workdir = './model/adamW-BCE/model_seresnext50_32x4d_i768_runmila_2fold_50ep'\nseed = 300\nn_fold = 2\nepoch = 50\nresume_from = None\nbatch_size = 32\nnum_workers = 32\nimgsize = 768, 768\nloss = dict... | [
0,
1,
2
] |
from utils import *
name = 'topological'
def topological(above):
"Topologically sort a DAG by removing a layer of sources until empty."
result = []
while above:
sources = set(above) - set(flatten(above.values()))
result.extend(sources)
for node in sources:
del above[nod... | normal | {
"blob_id": "a8ea91797942616779ae0acc884db1e521c7ad28",
"index": 3927,
"step-1": "<mask token>\n\n\ndef topological(above):\n \"\"\"Topologically sort a DAG by removing a layer of sources until empty.\"\"\"\n result = []\n while above:\n sources = set(above) - set(flatten(above.values()))\n ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def PlotUndirectedGraph(A, color):
NodesNames = list(string.ascii_uppercase)
NNodes = A.shape[0]
G = nx.DiGraph()
for i in range(NNodes):
G.add_node(NodesNames[i])
for i in range(NNodes):
for ... | flexible | {
"blob_id": "61388b2edb35055cccbdc98ed52caedcd0b02983",
"index": 5624,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef PlotUndirectedGraph(A, color):\n NodesNames = list(string.ascii_uppercase)\n NNodes = A.shape[0]\n G = nx.DiGraph()\n for i in range(NNodes):\n G.add_node(Nodes... | [
0,
1,
2,
3
] |
#
# Copyright 2021 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | normal | {
"blob_id": "24b1afb18e1cfdc8d5a62f5ee0147b2d73bc10d8",
"index": 7492,
"step-1": "<mask token>\n\n\nclass ConcurrentExecutor:\n <mask token>\n <mask token>\n <mask token>\n\n def run_io_func_sync(self, func, args=(), kwargs=None):\n \"\"\"\n :param func: callable\n :param args: f... | [
3,
6,
8,
10,
11
] |
# -*- coding:utf-8 -*-
import sys
from PyQt4 import QtGui,QtCore
import experiment
class Node(QtGui.QGraphicsEllipseItem):
def __init__(self,name):
super(Node, self).__init__()
self.__name = name
def getName(self):
... | normal | {
"blob_id": "edbb721784dff81e3e1ab5e0458a4080508807fe",
"index": 4335,
"step-1": "<mask token>\n\n\nclass Text(QtGui.QGraphicsTextItem):\n <mask token>\n\n def getName(self):\n return self.__name\n\n\nclass GUI(QtGui.QWidget):\n\n def __init__(self):\n super(GUI, self).__init__()\n ... | [
18,
20,
23,
25,
32
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def use_flask() ->bool:
env_var = BoolVar('USE_FLASK', False)
return EnvReader().safe_read(env_var)
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def use_flask() ->bool:
... | flexible | {
"blob_id": "ffe10ee8b2ebaad565e9aef5047440a067d4e239",
"index": 7528,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef use_flask() ->bool:\n env_var = BoolVar('USE_FLASK', False)\n return EnvReader().safe_read(env_var)\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef use_flask() ->bo... | [
0,
1,
2,
3,
4
] |
ii = [('LeakWTI2.py', 6)]
| normal | {
"blob_id": "997b68e42547b8f8a1059776c55c3ad16df494da",
"index": 1468,
"step-1": "<mask token>\n",
"step-2": "ii = [('LeakWTI2.py', 6)]\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
<|reserved_special_token_0|>
class PandaAgent:
def __init__(self, blocks, noise=5e-05, block_init_xy_poses=None,
use_platform=False, use_vision=False, real=False,
use_planning_server=False, use_learning_server=False,
alternate_orientations=False):
"""
Build the Panda world... | flexible | {
"blob_id": "5c1465bc70010ecabc156a04ec9877bbf66a229d",
"index": 5150,
"step-1": "<mask token>\n\n\nclass PandaAgent:\n\n def __init__(self, blocks, noise=5e-05, block_init_xy_poses=None,\n use_platform=False, use_vision=False, real=False,\n use_planning_server=False, use_learning_server=False,\... | [
20,
22,
24,
25,
26
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(B + S.count('?') if T == 1 else max(B - S.count('?'), (B - S.count(
'?')) % 2))
<|reserved_special_token_1|>
S = input()
T = int(input())
B = abs(S.count('L') - S.count('R')) + abs(S.count('U') - S.count('D'))
print(B... | flexible | {
"blob_id": "ce263424b856c07e04bd66cda7ebda646583b1fe",
"index": 5962,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(B + S.count('?') if T == 1 else max(B - S.count('?'), (B - S.count(\n '?')) % 2))\n",
"step-3": "S = input()\nT = int(input())\nB = abs(S.count('L') - S.count('R')) + abs(S.cou... | [
0,
1,
2
] |
<|reserved_special_token_0|>
def get_grocery_id(upc):
cmd = 'SELECT id FROM grocery WHERE upc = ?'
rtVal = do_command(cmd, [upc])
if len(rtVal) > 0:
return rtVal[0]['id']
else:
return -1
<|reserved_special_token_0|>
def remove_grocery(upc):
id = get_grocery_id(upc)
if id !=... | flexible | {
"blob_id": "92b24fe82929ed4590e5350188673c2245136d03",
"index": 5554,
"step-1": "<mask token>\n\n\ndef get_grocery_id(upc):\n cmd = 'SELECT id FROM grocery WHERE upc = ?'\n rtVal = do_command(cmd, [upc])\n if len(rtVal) > 0:\n return rtVal[0]['id']\n else:\n return -1\n\n\n<mask token>... | [
3,
5,
6,
9,
10
] |
import sklearn
import pandas as pd
import numpy as np
from sklearn import datasets, ensemble
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import train_test_split
import statistics as st
import itertools
from sklearn.model_selection import cross_val_score
from sklearn.experimen... | normal | {
"blob_id": "0d862715524bd35347626e7708c7c8f8b370bb3a",
"index": 7769,
"step-1": "<mask token>\n\n\ndef expandgrid(*itrs):\n product = list(itertools.product(*itrs))\n return {'Var{}'.format(i + 1): [x[i] for x in product] for i in range(\n len(itrs))}\n\n\n<mask token>\n",
"step-2": "<mask token>... | [
1,
2,
3,
4,
5
] |
from rest_framework.pagination import PageNumberPagination
class QuoteListPagination(PageNumberPagination):
page_size = 30
| normal | {
"blob_id": "4245da12eb7f9dd08c863e368efbd0bcf0b8fa04",
"index": 6816,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass QuoteListPagination(PageNumberPagination):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass QuoteListPagination(PageNumberPagination):\n page_size = 30\n",
"step-... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def do_upgrade(env, ver, cursor):
"""Change schema name from taskboard_schema to agiletools_version
"""
cursor.execute('UPDATE system SET name=%s WHERE name=%s', (
'agiletools_version', 'taskboard_schema'))
... | flexible | {
"blob_id": "56ed5bb22d77f4d8c061f97d832a60ed9a106549",
"index": 5231,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef do_upgrade(env, ver, cursor):\n \"\"\"Change schema name from taskboard_schema to agiletools_version\n \"\"\"\n cursor.execute('UPDATE system SET name=%s WHERE name=%s', ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
main(sys.argv)
<|reserved_special_token_1|>
import sys
from ulang.runtime.main import main
main(sys.argv)
| flexible | {
"blob_id": "e0c5498d9b18a6a32fcd2725ef4f6a1adaef6c68",
"index": 2098,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nmain(sys.argv)\n",
"step-3": "import sys\nfrom ulang.runtime.main import main\nmain(sys.argv)\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
__all__ = [
'mesh_add_vertex_to_face_edge'
]
def mesh_add_vertex_to_face_edge(mesh, key, fkey, v):
"""Add an existing vertex of the mesh to an existing face.
Parameters
----------
mesh :... | normal | {
"blob_id": "d9b6efce92e30267a9f992c4fea698fe14e0c3e4",
"index": 1398,
"step-1": "<mask token>\n\n\ndef mesh_add_vertex_to_face_edge(mesh, key, fkey, v):\n \"\"\"Add an existing vertex of the mesh to an existing face.\n\n Parameters\n ----------\n mesh : compas.datastructures.Mesh\n The mesh d... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
dependencies = [(... | flexible | {
"blob_id": "e9bf5a40360d35f32bd2ad5aa404225f49895a14",
"index": 4221,
"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 = [('core',\n ... | [
0,
1,
2,
3,
4
] |
import numpy as np
import cv2
from DataTypes import FishPosition
class FishSensor(object):
def __init__(self):
self.cap = cv2.VideoCapture(0)
self.cap.set(3, 280)
self.cap.set(4, 192)
#cv2.namedWindow("image")
#lower_b, lower_g, lower_r = 0, 0, 80
lower_b, lower_g, lower_r = ... | normal | {
"blob_id": "9cea27abebda10deefa9e05ddefa72c893b1eb18",
"index": 1676,
"step-1": "import numpy as np\nimport cv2\nfrom DataTypes import FishPosition\n\nclass FishSensor(object):\n def __init__(self):\n\t self.cap = cv2.VideoCapture(0)\n\t self.cap.set(3, 280)\n\t self.cap.set(4, 192)\n\n\t #cv2.na... | [
0
] |
from django.urls import path
from . import views # 현재 패키지에서 views 모듈을 가져옴
urlpatterns = [
path('', views.home, name='home'),
path('ppt1',views.ppt1,name='ppt1'),
path('ppt2',views.ppt2,name='ppt2'),
] | normal | {
"blob_id": "9db1887c5379623687d1dea343d72122bab66303",
"index": 2143,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [path('', views.home, name='home'), path('ppt1', views.ppt1,\n name='ppt1'), path('ppt2', views.ppt2, name='ppt2')]\n",
"step-3": "from django.urls import path\nfrom . ... | [
0,
1,
2,
3
] |
from rest_framework import serializers
from django.contrib import auth
from rest_framework.exceptions import ValidationError
from django.contrib.auth.password_validation import validate_password
from django.utils.translation import gettext as _
from rest_users.utils.api import _build_initial_user
User = auth.get_user_... | normal | {
"blob_id": "88e34878cdad908ed4ac30da82355aaa46ed719b",
"index": 5429,
"step-1": "<mask token>\n\n\nclass RegisterUserSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = User\n fields = '__all__'\n\n def validate_password(self, password):\n user = _build_initial_user(s... | [
10,
13,
14,
15,
21
] |
"""Identifying Antecedent Pronoun"""
from question import Question,Packet
qdict={
"correct pronoun-antecedent agreement":[
"<u>He</u> came home to <u>his</u> own car.",
"<u>He</u> found <u>his</u> sneakers in the garage.",
"<u>Harry</u> gave <u>himself</u> a baseball for Christmas.",
"<u>Jill</u> found <u>her</u> miss... | normal | {
"blob_id": "94b1e0280eff165f63e117969d5e1bf9d1e35193",
"index": 1598,
"step-1": "\"\"\"Identifying Antecedent Pronoun\"\"\"\nfrom question import Question,Packet\n\nqdict={\n\"correct pronoun-antecedent agreement\":[\n\"<u>He</u> came home to <u>his</u> own car.\",\n\"<u>He</u> found <u>his</u> sneakers in the ... | [
0
] |
<|reserved_special_token_0|>
def install(package):
if hasattr(pip, 'main'):
pip.main(['install', package])
else:
pip._internal.main(['install', package])
<|reserved_special_token_0|>
def get_gdrive_service():
creds = None
if os.path.exists('token.pickle'):
with open('token.... | flexible | {
"blob_id": "f32b9dc36b2452fea8c8f284fbf800f22608c3ae",
"index": 8541,
"step-1": "<mask token>\n\n\ndef install(package):\n if hasattr(pip, 'main'):\n pip.main(['install', package])\n else:\n pip._internal.main(['install', package])\n\n\n<mask token>\n\n\ndef get_gdrive_service():\n creds ... | [
9,
11,
12,
13,
19
] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# sphinx_gallery_thumbnail_number = 3
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import NullFormatter # useful for `logit` scale
import matplotlib.ticker as ticker
import matplotlib as mpl
mpl.style.use('classic')
# Data for plotting
ch... | normal | {
"blob_id": "66904cbe3e57d9cc1ee385cd8a4c1ba3767626bd",
"index": 923,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nmpl.style.use('classic')\n<mask token>\nax1.plot(chi2, color='r', linestyle='--', linewidth=2, markersize=5, label=\n '$\\\\chi^B_2$')\nax1.axis([0, 300, -0.05, 0.2])\nax1.set_xlabel('$... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import datetime
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Author',
fields=[
('id', models... | normal | {
"blob_id": "4a118f9081a8b3baf0b074c8dc14eaeef4559c08",
"index": 6684,
"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 = []\n operat... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 1 19:16:16 2019
@author: pc
"""
from socket import *
import threading
import time
import cv2
import struct
import pickle
import zlib
import cartoon_edit
import face_capture_edit
import pencil_edit
class Video_Server(threading.Thread):
def __init__ (self, port, vers... | normal | {
"blob_id": "6b138dabf57166ec971052fff7df89ae0346e083",
"index": 1582,
"step-1": "<mask token>\n\n\nclass Video_Server(threading.Thread):\n <mask token>\n <mask token>\n\n def run(self):\n detector, predictor = face_capture_edit.face_init(self.\n face_shape_predictor)\n print('f... | [
2,
3,
4,
5,
6
] |
if input is not None:
element = S(input)
if newChild is not None:
newChild = S(newChild)
element.replaceChild(existingChild, newChild)
| normal | {
"blob_id": "fdbb64159b72bf902efc3aa2eaa534e199dccf84",
"index": 8442,
"step-1": "<mask token>\n",
"step-2": "if input is not None:\n element = S(input)\nif newChild is not None:\n newChild = S(newChild)\nelement.replaceChild(existingChild, newChild)\n",
"step-3": null,
"step-4": null,
"step-5": nu... | [
0,
1
] |
#!/usr/bin/python
# Copyright 2012 Google Inc. All Rights Reserved.
"""Antirollback clock user space support.
This daemon serves several purposes:
1. Maintain a file containing the minimum time, and periodically
update its value.
2. At startup, write the minimum time to /proc/ar_clock.
The kernel will n... | normal | {
"blob_id": "92e7a7825b3f49424ec69196b69aee00bc84da68",
"index": 8879,
"step-1": "#!/usr/bin/python\n# Copyright 2012 Google Inc. All Rights Reserved.\n\n\"\"\"Antirollback clock user space support.\n\nThis daemon serves several purposes:\n 1. Maintain a file containing the minimum time, and periodically\n ... | [
0
] |
from decimal import Decimal
from django.conf import settings
from blood.models import Bank, Blood
class Cart(object):
def __init__(self, request):
self.session = request.session
cart = self.session.get(settings.CART_SESSION_ID)
if not cart:
cart = self.session[settings.CART_SES... | normal | {
"blob_id": "a638504737d0069d4fa40b0fc5026203904563e8",
"index": 5537,
"step-1": "<mask token>\n\n\nclass Cart(object):\n <mask token>\n <mask token>\n\n def save(self):\n self.session[settings.CART_SESSION_ID] = self.cart\n self.session.modified = True\n <mask token>\n\n def __iter_... | [
5,
6,
8,
9,
11
] |
# #Create a function that takes a text file and returns the number of words
# ___ count_words filepath
# w.. o.. ? ? __ file # read
# strng = ?.r..
# strng_list = ?.s.. " "
# r.. l.. ?
#
# print ? "words1.txt"
| normal | {
"blob_id": "b83310c18294def950cef6710c7644c7e8a3208f",
"index": 5219,
"step-1": "# #Create a function that takes a text file and returns the number of words\n# ___ count_words filepath\n# w.. o.. ? ? __ file # read\n# strng = ?.r..\n# strng_list = ?.s.. \" \"\n# r.. l.. ?\n#\n# prin... | [
1
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if __name__ == '__main__':
cap = cv2.VideoCapture('dfd1.mp4')
mog = cv2.createBackgroundSubtractorMOG2(detectShadows=0)
count = 0
while True:
list = []
ret, frame = cap.read()
ret1, frame1 =... | flexible | {
"blob_id": "28a0ae0492fb676044c1f9ced7a5a4819e99a8d9",
"index": 8890,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n cap = cv2.VideoCapture('dfd1.mp4')\n mog = cv2.createBackgroundSubtractorMOG2(detectShadows=0)\n count = 0\n while True:\n list = []\n ... | [
0,
1,
2,
3
] |
import os.path
class State:
def __init__(self):
self.states=[]
self.actions=[]
class Candidate:
def __init__(self,height,lines,holes,bump,fit):
self.heightWeight = height
self.linesWeight = lines
self.holesWeight = holes
self.bumpinessWeight = bump
... | normal | {
"blob_id": "94100d0253ee82513fe024b2826e6182f852db48",
"index": 2349,
"step-1": "import os.path\nclass State:\n\n\n def __init__(self):\n self.states=[]\n self.actions=[]\n\n\n\nclass Candidate:\n\n def __init__(self,height,lines,holes,bump,fit):\n\n self.heightWeight = height\n ... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class AttendaceConfig(AppConfig):
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class AttendaceConfig(AppConfig):
name = 'attendace'
<|reserved_special_token_1|>
from djan... | flexible | {
"blob_id": "d5d61b23dc14ffdfe7fe6f983164916863928eaf",
"index": 3685,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass AttendaceConfig(AppConfig):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass AttendaceConfig(AppConfig):\n name = 'attendace'\n",
"step-4": "from django.apps impo... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class CMU_Generator:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def read_data(self, phase):
all_data, even_data = [], {}
for action_idx, action in enumerate(self.actions):
action_path = '{}/{}/{}'.format(self.in_path, phase, action)
... | flexible | {
"blob_id": "2c58a9e83f80d437160b87ec64c7631e7a35bf90",
"index": 6315,
"step-1": "<mask token>\n\n\nclass CMU_Generator:\n <mask token>\n <mask token>\n\n def read_data(self, phase):\n all_data, even_data = [], {}\n for action_idx, action in enumerate(self.actions):\n action_pat... | [
3,
5,
6,
7,
8
] |
from typing import List
h = 5
w = 4
horizontalCuts = [3]
verticalCuts = [3]
class Solution:
def maxArea(self, h: int, w: int, horizontalCuts: List[int], verticalCuts: List[int]) -> int:
horizontalCuts.sort()
verticalCuts.sort()
horizontalCuts.append(h)
verticalCuts.append(w)
... | normal | {
"blob_id": "8fb559810fbf79f0849ed98e51d3f2ad1ccc4b8b",
"index": 8296,
"step-1": "<mask token>\n\n\nclass Solution:\n\n def maxArea(self, h: int, w: int, horizontalCuts: List[int],\n verticalCuts: List[int]) ->int:\n horizontalCuts.sort()\n verticalCuts.sort()\n horizontalCuts.appe... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
pg.alert(name)
if name == 'Caroline':
pg.alert('Hi ' + name)
points += 5
t.sleep(1)
wb.open('https://www.textgiraffe.com/Caroline/Page2/')
elif name == 'Bob':
pg.alert(name + ',you are a great person!')
poi... | flexible | {
"blob_id": "16e10db90a0a0d8ee7ca5b0c7f86cc81432d87d1",
"index": 4391,
"step-1": "<mask token>\n",
"step-2": "<mask token>\npg.alert(name)\nif name == 'Caroline':\n pg.alert('Hi ' + name)\n points += 5\n t.sleep(1)\n wb.open('https://www.textgiraffe.com/Caroline/Page2/')\nelif name == 'Bob':\n p... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(pd.pivot_table(df, values='Date', index='Hospital_Name', aggfunc=np.size)
)
print(df2.sum())
<|reserved_special_token_1|>
<|reserved_special_token_0|>
df = pd.DataFrame([['Hospital1', '2019-10-01'], ['Hospital2', '201... | flexible | {
"blob_id": "8d8f1f0dbb76b5c536bd1a2142bb61c51dd75075",
"index": 9573,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(pd.pivot_table(df, values='Date', index='Hospital_Name', aggfunc=np.size)\n )\nprint(df2.sum())\n",
"step-3": "<mask token>\ndf = pd.DataFrame([['Hospital1', '2019-10-01'], ['H... | [
0,
1,
2,
3
] |
import datetime
import logging
import os
from functools import lru_cache
from authlib.jose import JsonWebKey, jwt
from flask import g, request, jsonify
from lorem_ipsum.model import User, AppContext
import lorem_ipsum
from lorem_ipsum.model import Permission, BlacklistToken
LOGGER = logging.getLogger('lorem-ipsum')
... | normal | {
"blob_id": "97d4387c7bfd141b5a7019b221adb550105d4351",
"index": 604,
"step-1": "<mask token>\n\n\nclass AuthorizationError(ValueError):\n pass\n\n\nclass BearerTokenValidator:\n\n def __init__(self, access_token, app_context: AppContext):\n self.access_token = access_token\n user_service = a... | [
10,
12,
17,
19,
21
] |
#!/usr/bin/python3
"""display your id from github.
"""
from sys import argv
import requests
if __name__ == "__main__":
get = requests.get('https://api.github.com/user',
auth=(argv[1], argv[2])).json().get('id')
print(get)
| normal | {
"blob_id": "8280f321b102cace462761f9ece2aebf9e28a432",
"index": 3941,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n get = requests.get('https://api.github.com/user', auth=(argv[1], argv[2])\n ).json().get('id')\n print(get)\n",
"step-3": "<mask token>\nfrom s... | [
0,
1,
2,
3
] |
import sys
import os
from django.conf import settings
BASE_DIR=os.path.dirname(__file__)
settings.configure(
DEBUG=True,
SECRET_KEY='ki==706e99f0ps9w5s*!kx%1^=5jq_k1c&4r@#e&ng9=xlm5_',
ROOT_URLCONF='sitebuilder.urls',
MIDDLEWARE_CLASSES=(),
INSTALLED_APPS=(
'django.contrib.staticfiles',
'django.contrib.webd... | normal | {
"blob_id": "d30e5e24dd06a4846fdde3c9fcac0a5dac55ad0d",
"index": 5916,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsettings.configure(DEBUG=True, SECRET_KEY=\n 'ki==706e99f0ps9w5s*!kx%1^=5jq_k1c&4r@#e&ng9=xlm5_', ROOT_URLCONF=\n 'sitebuilder.urls', MIDDLEWARE_CLASSES=(), INSTALLED_APPS=(\n 'd... | [
0,
1,
2,
3,
4
] |
# This package includes different measures to evaluate topics
| normal | {
"blob_id": "3dcca85c8003b57ad37734bbbe171ab8cef0f56c",
"index": 1894,
"step-1": "# This package includes different measures to evaluate topics\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
1
]
} | [
1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.