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|>
class IntQueue(Queue):
<|reserved_special_token_0|>
def __init__(self, maxSize):
"""
maxSize is the maximum number of items
that can be in the queue at any given time
"""
self.front = 0
... | flexible | {
"blob_id": "0ed99037d7ff708b7931fbc3553b1aeb19a20f53",
"index": 810,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass IntQueue(Queue):\n <mask token>\n\n def __init__(self, maxSize):\n \"\"\"\n maxSize is the maximum number of items\n that can be in the queue at any given time... | [
0,
8,
11,
12,
13
] |
<|reserved_special_token_0|>
def to_image(det):
size = 512
val_trans = [Normalization([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])]
val_trans = Compose(val_trans)
for i in range(5, 200):
path = f'D:/temp_data/mask/test/{i}.jpg '
print(path)
image = cv2.imread(path)
image = cv2.res... | flexible | {
"blob_id": "97e7ca02d85267492a0dcbbda9d8754a0a3735a5",
"index": 5315,
"step-1": "<mask token>\n\n\ndef to_image(det):\n size = 512\n val_trans = [Normalization([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])]\n val_trans = Compose(val_trans)\n for i in range(5, 200):\n path = f'D:/temp_data/mask/test/{i}.j... | [
2,
3,
4,
5,
6
] |
#!/usr/bin/python
import sys
import os
class ParseError(Exception):
pass
def remove_inline_comments(text):
ret = []
in_comment_block = False
p = 0
while True:
if (op := text.find('/*', p)) > 0:
in_comment_block = True
if op != p:
ret.append(text[p... | normal | {
"blob_id": "11e9e4dd5c9c6158fed40080d4cc221f28a0eba0",
"index": 8097,
"step-1": "<mask token>\n\n\nclass AIns:\n <mask token>\n <mask token>\n\n\nclass CIns:\n comp = {'0': '101010', '1': '111111', '-1': '111010', 'D': '001100',\n 'A': '110000', 'M': '110000', '!D': '001101', '!A': '110001', '!M... | [
9,
14,
15,
16,
19
] |
<|reserved_special_token_0|>
class Templating(templating.Templating):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Templating(templating.Templating):
"""
Application-specific templating imp... | flexible | {
"blob_id": "18391df9a3e52400fe4fc54d6381b9ce21e25f0b",
"index": 2296,
"step-1": "<mask token>\n\n\nclass Templating(templating.Templating):\n <mask token>\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass Templating(templating.Templating):\n \"\"\"\n Application-specific temp... | [
1,
3,
4,
5,
6
] |
"""Functional tests for h2 frames."""
__author__ = "Tempesta Technologies, Inc."
__copyright__ = "Copyright (C) 2023 Tempesta Technologies, Inc."
__license__ = "GPL2"
from h2.errors import ErrorCodes
from h2.exceptions import StreamClosedError
from framework import deproxy_client, tester
from helpers import checks_f... | normal | {
"blob_id": "e474cb3db74b5344bd861aacf779cb9f77830ef6",
"index": 5661,
"step-1": "<mask token>\n\n\nclass TestH2FrameEnabledDisabledTsoGroGso(\n TestH2FrameEnabledDisabledTsoGroGsoBase, NetWorker):\n\n def test_headers_frame_with_continuation(self):\n client, server = self.setup_tests()\n sel... | [
27,
33,
37,
46,
48
] |
#/usr/bin/env python3
def nth_prime(n):
ans = 2
known = []
for _ in range(n):
while not all(ans%x != 0 for x in known):
ans += 1
known.append(ans)
return ans
if __name__ == "__main__":
n = int(input("Which one? "))
print(nth_prime(n))
| normal | {
"blob_id": "21fb9622add4d19b2914118e3afd3867b2368a50",
"index": 4913,
"step-1": "<mask token>\n",
"step-2": "def nth_prime(n):\n ans = 2\n known = []\n for _ in range(n):\n while not all(ans % x != 0 for x in known):\n ans += 1\n known.append(ans)\n return ans\n\n\n<mask t... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in range(b - 1):
if (i + 1) * a % b == c:
frag = 'YES'
break
print(frag)
<|reserved_special_token_1|>
a, b, c = map(int, input().split())
frag = 'NO'
for i in range(b - 1):
if (i + 1) * a % b == c:... | flexible | {
"blob_id": "6ad36f2b115c822a50a38e88a8d7d524fc5b045b",
"index": 195,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(b - 1):\n if (i + 1) * a % b == c:\n frag = 'YES'\n break\nprint(frag)\n",
"step-3": "a, b, c = map(int, input().split())\nfrag = 'NO'\nfor i in range(b -... | [
0,
1,
2
] |
<|reserved_special_token_0|>
def compute_reward(score_batch, input_lengths, output, sentences_batch,
reference_batch, device, sentence_lengths_batch, number_of_sample=5,
lamb=0.1):
reward_batch = []
rl_label_batch = torch.zeros(output.size()[:2]).unsqueeze(2)
for i_data in range(len(input_lengths)... | flexible | {
"blob_id": "cc6e827eec5256ce0dbe13958b6178c59bcd94a7",
"index": 8802,
"step-1": "<mask token>\n\n\ndef compute_reward(score_batch, input_lengths, output, sentences_batch,\n reference_batch, device, sentence_lengths_batch, number_of_sample=5,\n lamb=0.1):\n reward_batch = []\n rl_label_batch = torch.... | [
1,
2,
3,
4,
5
] |
"""
Kontrollülesanne 7.4c - Elutee number (tähtaeg 28.okt. (incl))
Maksimaalne failide arv: 1
Töö liik: Individuaaltöö
Numeroloogias peetakse tähtsaks elutee numbrit, mille arvutamiseks tuleb liita kokku sünnikuupäeva ja -aasta numbrid
nii, et jõutakse lõpuks ühe numbrini.
Näiteks, oletame, et sünnikuupäev on 15.05.... | normal | {
"blob_id": "971187dc0e0f02282c8945940d07c011e247667a",
"index": 9401,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef elutee(s):\n n = 0\n for i in s:\n if i != '.':\n n += int(i)\n if n < 10:\n return n\n else:\n return elutee(str(n))\n\n\n<mask token>... | [
0,
1,
2,
3,
4
] |
#juego trivia hecho por mayu xD
print('¡hola! te invito a jugar mi juego trivia, trataremos temas como termux xd y entre otras cosas')
n1 = input('\n por favor dime como te llamas:')
print('\nmucho gusto', n1, ',empecemos')
puntaje = 0
print('me puedes decir con que comando en linux puedo listar la informacion de ... | normal | {
"blob_id": "0c297e6f79682896e98c7a2933a4da6d9af7d7fe",
"index": 9060,
"step-1": "<mask token>\n",
"step-2": "print(\n '¡hola! te invito a jugar mi juego trivia, trataremos temas como termux xd y entre otras cosas'\n )\n<mask token>\nprint('\\nmucho gusto', n1, ',empecemos')\n<mask token>\nprint(\n 'm... | [
0,
1,
2,
3
] |
import urllib.request
import io
import cv2
import numpy as np
img_url = 'http://192.168.0.2:7079/hi'
while True:
data = urllib.request.urlopen(img_url)
raw_data = data.read()
nparr = np.frombuffer(raw_data, np.byte)
image_raw = cv2.imdecode(nparr, cv2.IMREAD_ANYCOLOR)
cv2.imshow("test", image_raw)... | normal | {
"blob_id": "c120db53e1ea5a5b865b891cf602a13113fb1e41",
"index": 4113,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile True:\n data = urllib.request.urlopen(img_url)\n raw_data = data.read()\n nparr = np.frombuffer(raw_data, np.byte)\n image_raw = cv2.imdecode(nparr, cv2.IMREAD_ANYCOLOR)... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
@colander.deferred
def deferred_country_widget(node, kw):
country_codes_data = kw.get('country_codes_data', [])
return widget.Select2Widget(values=country_codes_data)
<|reserved_special_token_0|>
@colander.deferred
def deferred_title_prefix_widget(node, kw):
title_prefix_d... | flexible | {
"blob_id": "3a3400426b054b2fc3d060141a1f84e5db553e59",
"index": 3424,
"step-1": "<mask token>\n\n\n@colander.deferred\ndef deferred_country_widget(node, kw):\n country_codes_data = kw.get('country_codes_data', [])\n return widget.Select2Widget(values=country_codes_data)\n\n\n<mask token>\n\n\n@colander.de... | [
5,
6,
7,
8,
9
] |
a=eval(input('enter a list: '))
n=len(a)
if (n%2==0):
for i in range(0,n//2):
a[i],a[n//2+i]=a[n//2+i],a[i]
print('after swap:',a)
else:
for i in range(0,n//2):
a[i],a[n//2+i+1]=a[n//2+i+1],a[i]
print('after swap:',a)
| normal | {
"blob_id": "18435f43e2f52e3d2e9ff6411f8dd0510d2da54d",
"index": 656,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif n % 2 == 0:\n for i in range(0, n // 2):\n a[i], a[n // 2 + i] = a[n // 2 + i], a[i]\n print('after swap:', a)\nelse:\n for i in range(0, n // 2):\n a[i], a[n // ... | [
0,
1,
2,
3
] |
import hashlib
def createMD5(str):
# 创建md5对象
hl = hashlib.md5()
hl.update(str.encode(encoding='utf-8'))
return hl.hexdigest() | normal | {
"blob_id": "ea78f754ffff26bac1e53ed1e842fd79112b8ee7",
"index": 6811,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef createMD5(str):\n hl = hashlib.md5()\n hl.update(str.encode(encoding='utf-8'))\n return hl.hexdigest()\n",
"step-3": "import hashlib\n\n\ndef createMD5(str):\n hl = ... | [
0,
1,
2,
3
] |
# -*- utf-8 -*-
from django.db import models
class FieldsTest(models.Model):
pub_date = models.DateTimeField()
mod_date = models.DateTimeField()
class BigS(models.Model):
s = models.SlugField(max_length=255)
class Foo(models.Model):
a = models.CharField(max_length=10)
d = models.DecimalField(... | normal | {
"blob_id": "d6cfe7132855d832d8fd1ea9ca9760bd22109a92",
"index": 1893,
"step-1": "<mask token>\n\n\nclass Bar(models.Model):\n b = models.CharField(max_length=10)\n a = models.ForeignKey(Foo, related_name='bars', on_delete=models.CASCADE)\n\n\nclass DTModel(models.Model):\n name = models.CharField(max_l... | [
5,
6,
8,
10,
13
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in range(1, n + 1):
print(i)
if i < n:
print('+')
a.append(i)
print('= {}'.format(sum(a)))
<|reserved_special_token_1|>
n = 7
a = []
for i in range(1, n + 1):
print(i)
if i < n:
print('... | flexible | {
"blob_id": "de9b85c250dea15ff9201054957ebc38017a8c35",
"index": 5435,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(1, n + 1):\n print(i)\n if i < n:\n print('+')\n a.append(i)\nprint('= {}'.format(sum(a)))\n",
"step-3": "n = 7\na = []\nfor i in range(1, n + 1):\n pr... | [
0,
1,
2,
3
] |
# -*- coding: utf-8 -*-
import argparse
import redis
from Tkinter import *
import ttk
import json
import time
import thread
R = None
NAME = {}
PROBLEM_NAME = {}
CONTEST_ID = None
QUEUE_NAME = None
BACKUP_QUEUE_NAME = None
RUNID_FIELD = "runid"
SUBMIT_TIME_FIELD = "submit_time"
STATUS_FIELD = "status"
STATUS_FINISHED... | normal | {
"blob_id": "76e1f811d06af0e6e83ae989a236a5cd22c55e01",
"index": 2985,
"step-1": "<mask token>\n\n\nclass PrinterTkinter:\n\n def __init__(self):\n self.root = Tk()\n self.root.title('气球发放')\n self.runid_to_node = dict()\n self.runid_to_uid = dict()\n self.runid_to_pid = dic... | [
5,
8,
10,
12,
13
] |
from oscar.app import Shop
from apps.catalogue.app import application as catalogue_app
class BaseApplication(Shop):
catalogue_app = catalogue_app
application = BaseApplication()
| normal | {
"blob_id": "c8bb6ead7e305f466e24b47811d6ed38c8cfec0a",
"index": 2691,
"step-1": "<mask token>\n\n\nclass BaseApplication(Shop):\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass BaseApplication(Shop):\n catalogue_app = catalogue_app\n\n\n<mask token>\n",
"step-3": "<mask token>\n... | [
1,
2,
3,
4
] |
from typing import List, Tuple
test_string = "2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2"
with open('data/day8_input.txt', 'r') as fp:
my_string = fp.read()
class Node:
def __init__(self):
self.metadata = list()
self.children = list()
def checksum(self):
return sum([x for x in self.met... | normal | {
"blob_id": "3bea4413a41a9eecb5e3184d090b646e17892b5c",
"index": 5277,
"step-1": "<mask token>\n\n\nclass Node:\n\n def __init__(self):\n self.metadata = list()\n self.children = list()\n\n def checksum(self):\n return sum([x for x in self.metadata])\n\n def add_child(self, child):\... | [
8,
9,
10,
11,
12
] |
<|reserved_special_token_0|>
class QStudyingsView(QObjectsView):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class QStudyingsView(QObjectsView):
<|reserved_special_token_0|>
def init_table(self):
self.table.setColumn... | flexible | {
"blob_id": "f7174bf4e7612921e730ac87141c85654a2f2411",
"index": 6194,
"step-1": "<mask token>\n\n\nclass QStudyingsView(QObjectsView):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass QStudyingsView(QObjectsView):\n <mask token>\n\n def init_table(self):\n self.table.set... | [
1,
2,
3,
4
] |
from flask import render_template
from database import db
from api import app
from models import create_models
# Create a URL route in application for "/"
@app.route('/')
def home():
return render_template('home.html')
# If in stand alone mode, run the application
if __name__ == '__main__':
db.connect()
c... | normal | {
"blob_id": "5a0a8205977e59ff59a5d334a487cf96eee514d2",
"index": 7211,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@app.route('/')\ndef home():\n return render_template('home.html')\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\n@app.route('/')\ndef home():\n return render_template('ho... | [
0,
1,
2,
3,
4
] |
# Create your views here.
from django.http import HttpResponse, HttpResponseRedirect
from django.template import Context, loader
from django.db import transaction
from django.db.models import Q
from maximus.models import Mercenary, Team, TeamMember, Tournament, TournamentTeam, TournamentMatchup, Matchup, MatchupStatis... | normal | {
"blob_id": "f66f82c5c2842fc4fcae2251d4a16a9850230041",
"index": 3547,
"step-1": "<mask token>\n\n\ndef edit_team(request):\n\n def get():\n team_id = request.GET['team']\n team = Team.objects.get(id=team_id)\n model = Context({'team': team})\n t = loader.get_template('edit_team.ht... | [
6,
7,
9,
10,
11
] |
import numpy as np
import matplotlib.pyplot as plt
conf_arr = [[2987, 58, 955, 832, 1991, 181, 986], [142, 218, 195, 44, 235,
11, 27], [524, 8, 3482, 478, 2406, 708, 588], [140, 0, 386, 12491, 793,
182, 438], [368, 15, 883, 635, 6331, 71, 1357], [77, 0, 942, 394, 223,
4530, 176], [224, 7, 601, 929, 2309, ... | normal | {
"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
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
urlpatterns = [path('', views.index, name='index'), path('login', Login.
as_view(), name='login'), path('logout', logout, name='logout'), path(
'cart/', views.cart, name='cart'), path('order/', views.order, name=
'orde... | flexible | {
"blob_id": "c8aa93a33a6513129b4980180c4eb8d5d5eb3b5b",
"index": 2592,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [path('', views.index, name='index'), path('login', Login.\n as_view(), name='login'), path('logout', logout, name='logout'), path(\n 'cart/', views.cart, name='cart')... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class SchematicsPlugin(BasePlugin):
<|reserved_special_token_0|>
def __init__(self, schema_name_resolver=None):
super().__init__()
self.schema_name_resolver = schema_name_resolver or resolver
self.spec = None
self.openapi_version = None
sel... | flexible | {
"blob_id": "1c5655563d05498f016fb2d41a07331b9e8de5e8",
"index": 2019,
"step-1": "<mask token>\n\n\nclass SchematicsPlugin(BasePlugin):\n <mask token>\n\n def __init__(self, schema_name_resolver=None):\n super().__init__()\n self.schema_name_resolver = schema_name_resolver or resolver\n ... | [
9,
12,
13,
14,
16
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def lambda_handler(event, context):
print(requests)
apiKey = os.environ['newrelic_api_key']
headers = {'content-type': 'application/json', 'Accept-Charset':
'UTF-8', 'X-api-key': apiKey}
r = requests.get(... | flexible | {
"blob_id": "e89600f109335ffdb00c13f617d61496c547ba61",
"index": 5612,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef lambda_handler(event, context):\n print(requests)\n apiKey = os.environ['newrelic_api_key']\n headers = {'content-type': 'application/json', 'Accept-Charset':\n 'U... | [
0,
1,
2
] |
<|reserved_special_token_0|>
class Person:
alive = True
<|reserved_special_token_0|>
def __init__(self, name, age, gender):
self.name = name
self.age = age
self.gender = gender
self.salary = 0
def greet(self):
print('Hello ', self.name)
def greetByTime(se... | flexible | {
"blob_id": "11feb13f38f2484c867a8b3fa525ffecf419dfe5",
"index": 9957,
"step-1": "<mask token>\n\n\nclass Person:\n alive = True\n <mask token>\n\n def __init__(self, name, age, gender):\n self.name = name\n self.age = age\n self.gender = gender\n self.salary = 0\n\n def g... | [
5,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
class Opcode1(Opcode):
<|reserved_special_token_0|>
def __init__(self, mem, ptr):
super().__init__(mem, ptr, 1, 4)
self.__first = self.get_val(1)
self.__second = self.get_val(2)
self.__res = mem[ptr + 3]
def run(self):
self.memory[self... | flexible | {
"blob_id": "653e65281984ebb06467aeadb6f0e2b11f1bcb4d",
"index": 496,
"step-1": "<mask token>\n\n\nclass Opcode1(Opcode):\n <mask token>\n\n def __init__(self, mem, ptr):\n super().__init__(mem, ptr, 1, 4)\n self.__first = self.get_val(1)\n self.__second = self.get_val(2)\n self... | [
43,
44,
55,
57,
62
] |
from __future__ import unicode_literals
from functools import partial
from django.contrib.auth import get_user_model
from .default_settings import settings
from . import signals
class AuditMiddleware(object):
"""
middleware to add the user from requests to ModelChange objects.
This is independent of req... | normal | {
"blob_id": "0e03a3b3401075384e580bc2bb8af1a106f1d238",
"index": 2141,
"step-1": "<mask token>\n\n\nclass AuditMiddleware(object):\n <mask token>\n <mask token>\n\n def process_response(self, request, response):\n signals.audit_presave.disconnect(dispatch_uid=(settings.\n DISPATCH_UID,... | [
2,
4,
5,
6,
7
] |
def parse(num):
strnum = str(num)
words = []
for item in range(len(strnum)-1, -1, -1):
words.append(strnum[item])
hundred = words[:3]
thousand = words[3:6]
million = words[6:len(words)]
hundred = hundred[::-1]
thousand = thousand[::-1]
million = million[::-1]
units = [... | normal | {
"blob_id": "843901b65a556e57470f73be2657e9fd3c0facc6",
"index": 9721,
"step-1": "<mask token>\n",
"step-2": "def parse(num):\n strnum = str(num)\n words = []\n for item in range(len(strnum) - 1, -1, -1):\n words.append(strnum[item])\n hundred = words[:3]\n thousand = words[3:6]\n mill... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def cnn_model():
model = Sequential()
model.add(ZeroPadding2D((1, 1), input_shape=(1, 20, window_sizes)))
model.add(Convolution2D(32, nb_kernels, nb_kernels))
model.add(Activation('relu'))
model.add(MaxPooling2D(strides=(nb_pools, nb_pools), dim_ordering='th'))
mod... | flexible | {
"blob_id": "721f23d2b6109194b8bca54b1cd04263e30cdf24",
"index": 3964,
"step-1": "<mask token>\n\n\ndef cnn_model():\n model = Sequential()\n model.add(ZeroPadding2D((1, 1), input_shape=(1, 20, window_sizes)))\n model.add(Convolution2D(32, nb_kernels, nb_kernels))\n model.add(Activation('relu'))\n ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class MyUserManager(BaseUserManager):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class MyUserManager(BaseUserManager):
<|reserved_special_token_0|>
def create_superuser(self, email, password, fu... | flexible | {
"blob_id": "f5f14e4d114855b7eef555db182ee991bdf26c39",
"index": 8832,
"step-1": "<mask token>\n\n\nclass MyUserManager(BaseUserManager):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass MyUserManager(BaseUserManager):\n <mask token>\n\n def create_superuser(self, email, passwor... | [
1,
2,
3,
4,
5
] |
import unittest, warnings
from pony.orm import *
from pony.orm import core
from pony.orm.tests.testutils import raises_exception
db = Database('sqlite', ':memory:')
class Person(db.Entity):
id = PrimaryKey(int)
name = Required(str)
tel = Optional(str)
db.generate_mapping(check_tables=False)... | normal | {
"blob_id": "33c39b098cb9d3368b8f74a7433e0943fe252da5",
"index": 5672,
"step-1": "<mask token>\n\n\nclass TestValidate(unittest.TestCase):\n\n @db_session\n def setUp(self):\n db.execute('delete from Person')\n registry = getattr(core, '__warningregistry__', {})\n for key in list(regis... | [
6,
8,
9,
10,
12
] |
<|reserved_special_token_0|>
class KMeans:
def __init__(self, k=5, max_iters=100, random_seed=42):
self.k = k
self.max_iters = max_iters
np.random.seed(random_seed)
def _initialise_centroids(self, X):
random_indices = np.random.permutation(X.shape[0])
random_indices =... | flexible | {
"blob_id": "d267c8cbe51fb1bacc9404a1385f1daa4a0db7f2",
"index": 884,
"step-1": "<mask token>\n\n\nclass KMeans:\n\n def __init__(self, k=5, max_iters=100, random_seed=42):\n self.k = k\n self.max_iters = max_iters\n np.random.seed(random_seed)\n\n def _initialise_centroids(self, X):\n... | [
6,
7,
8,
10,
12
] |
'''
Each new term in the Fibonacci sequence is generated by adding the previous two terms.
By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million,
find the sum of the even-valued terms.
'... | normal | {
"blob_id": "02a1f84e72b412636d86b9bdb59856ae8c309255",
"index": 9373,
"step-1": "'''\nEach new term in the Fibonacci sequence is generated by adding the previous two terms. \nBy starting with 1 and 2, the first 10 terms will be:\n\n1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...\n\nBy considering the terms in the Fibona... | [
0
] |
import numpy as np
import itertools
from scipy.linalg import eig, schur
from eigen_rootfinding.polynomial import MultiCheb, MultiPower
from eigen_rootfinding.utils import memoize
from scipy.stats import ortho_group
def indexarray(matrix_terms, which, var):
"""Compute the array mapping monomials under multiplicatio... | normal | {
"blob_id": "14fb6776ac30802edf43c43acbee64263c6bdd7b",
"index": 2777,
"step-1": "<mask token>\n\n\ndef ms_matrices(E, Q, matrix_terms, dim):\n \"\"\"Compute the Möller-Stetter matrices in the monomial basis from a\n reduced Macaulay matrix\n\n Parameters\n ----------\n E : (m, k) ndarray\n ... | [
5,
6,
8,
10,
12
] |
<|reserved_special_token_0|>
class DataParser:
<|reserved_special_token_0|>
def __init__(self, csvfile, data_centers):
"""DataParser constructor."""
self.accepted_records = []
self.ignored_records = []
with open(csvfile, 'r') as file:
reader = self.create_reader(fi... | flexible | {
"blob_id": "af609f1558276bab96477d3a2c61d813b9dd3d82",
"index": 9660,
"step-1": "<mask token>\n\n\nclass DataParser:\n <mask token>\n\n def __init__(self, csvfile, data_centers):\n \"\"\"DataParser constructor.\"\"\"\n self.accepted_records = []\n self.ignored_records = []\n wi... | [
5,
6,
7,
8,
9
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 2 13:34:19 2020
@author: ShihaoYang
"""
from pyltp import SentenceSplitter
from pyltp import Segmentor
from pyltp import Postagger
from pyltp import Parser
from pyltp import NamedEntityRecognizer
import os
import jieba
import re
os.getcwd()
os.ch... | normal | {
"blob_id": "dc41c64d09e5fdd0e234f516eeec0cbd2433876c",
"index": 8507,
"step-1": "<mask token>\n\n\nclass Sentence(object):\n\n def __init__(self, text):\n self.text = text\n self.data = dict()\n\n def SentS(self):\n sents = SentenceSplitter.split(self.text)\n return sents\n\n ... | [
9,
11,
12,
14,
16
] |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Brandon Bennett <bennetb@gmail.com>
#
# Send a notification via notifyserver (https://github.com/nemith/notifyserver)
# on highlight/private message or new DCC.
#
# History:
#
# 2015-02-07, Brandon Bennett <bennetb@gmail.com>:
# version 0.1: initial release
#
SCRIPT... | normal | {
"blob_id": "0ae9ad7af26e3d19f2d3967c02611503c32aea70",
"index": 2593,
"step-1": "<mask token>\n\n\nclass Config(object):\n _DEFAULT = {'url': 'http://localhost:9999/notify', 'title':\n 'IRC Notification', 'activate_label': '', 'sound': ''}\n\n def __init__(self):\n self._opts = {}\n f... | [
5,
7,
9,
10,
12
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(str01[3])
print(str01[1])
<|reserved_special_token_0|>
print(l01)
<|reserved_special_token_0|>
while i <= index_last:
print(str01[i])
i += 1
print()
print('上面的循环结束了 执行到这里')
<|reserved_special_token_0|>
<|reserved_s... | flexible | {
"blob_id": "7262d7a82834b38762616a30d4eac38078e4b616",
"index": 6724,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(str01[3])\nprint(str01[1])\n<mask token>\nprint(l01)\n<mask token>\nwhile i <= index_last:\n print(str01[i])\n i += 1\nprint()\nprint('上面的循环结束了 执行到这里')\n<mask token>\n",
"st... | [
0,
1,
2,
3
] |
from django.http import HttpResponse
from django.views.decorators.http import require_http_methods
from django.shortcuts import render, redirect
from app.models import PaidTimeOff, Schedule
from django.utils import timezone
from django.contrib import messages
from app.decorators import user_is_authenticated
from app.... | normal | {
"blob_id": "7245d4db6440d38b9302907a6203c1507c373112",
"index": 6970,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef index_get(request, user_id, user, pto):\n schedules = Schedule.to_calendar(Schedule.objects.filter(pto=pto))\n context = pto.__dict__\n context.update({'schedules': sched... | [
0,
2,
3,
4,
5
] |
#OpenCV create samples commands
#opencv_createsamples -img watch5050.jpg -bg bg.txt -info info/info.lst -pngoutput info -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 1950
#opencv_createsamples -info info/info.lst -num 1950 -w 20 -h 20 -vec positives.vec
#Training command
#opencv_traincascade -data data -vec p... | normal | {
"blob_id": "62e0c3b6095a65a4508eddfa9c0a1cb31d6c917b",
"index": 8887,
"step-1": "#OpenCV create samples commands\r\n#opencv_createsamples -img watch5050.jpg -bg bg.txt -info info/info.lst -pngoutput info -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 1950\r\n#opencv_createsamples -info info/info.lst -num 195... | [
1
] |
from kivy.uix.progressbar import ProgressBar
from kivy.animation import Animation
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
from kivy.uix.image import Image
from kivy.graphics import Color, Rectangle
from kivy.core.window import Window
from kivy.uix.boxlayout import BoxLayout
from kivy... | normal | {
"blob_id": "35cd1c45294b826784eab9885ec5b0132624c957",
"index": 4028,
"step-1": "<mask token>\n\n\nclass KaliteUI(object):\n\n def __init__(self, kaliteApp):\n dropdown = DropDown()\n dropdown_btn = Button(text='menu', size_hint_x=None, size_hint_y=\n None, size=(150, 40), font_size=... | [
9,
11,
14,
15,
16
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(v1)
<|reserved_special_token_0|>
print(v2)
<|reserved_special_token_0|>
print(v3)
<|reserved_special_token_0|>
print(v4)
<|reserved_special_token_1|>
v1 = 3 + 4 * 2
print(v1)
v2 = (2 + 6) * 2
print(v2)
v3 = 2 ** 3 ** 2
pr... | flexible | {
"blob_id": "e6694403eecf2c4511c1fce959b5939f5f457bb8",
"index": 9384,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(v1)\n<mask token>\nprint(v2)\n<mask token>\nprint(v3)\n<mask token>\nprint(v4)\n",
"step-3": "v1 = 3 + 4 * 2\nprint(v1)\nv2 = (2 + 6) * 2\nprint(v2)\nv3 = 2 ** 3 ** 2\nprint(v3)\n... | [
0,
1,
2
] |
import random
# library to create window in the terminal
import curses
# initialized curses by returning a window object
stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
stdscr.keypad(True)
curses.curs_set(0)
height, width = stdscr.getmaxyx()
# create a new window of a given size
window = cur... | normal | {
"blob_id": "153d37b58a10847aae1fa7dbec4c7576c3d97fb2",
"index": 3407,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ncurses.noecho()\ncurses.cbreak()\nstdscr.keypad(True)\ncurses.curs_set(0)\n<mask token>\nwindow.keypad(1)\nwindow.timeout(100)\n<mask token>\nwindow.addch(int(food[0]), int(food[1]), curs... | [
0,
1,
2,
3,
4
] |
from sys import exit
# Outside
def outside():
print """
Oyoiyoi ... The train isn't running due to the HVV being complete crap.
Well, the Rewe around the corner is still open
and there's a HSV bar around the corner.
You want to get your drank on, right now!
Where do you go?
"""
choice =... | normal | {
"blob_id": "b3bace532f687edc966c6aef5f454bde9367204f",
"index": 4500,
"step-1": "from sys import exit\n\n# Outside\ndef outside():\n print \"\"\"\n Oyoiyoi ... The train isn't running due to the HVV being complete crap.\n Well, the Rewe around the corner is still open\n and there's a HSV bar around ... | [
0
] |
<|reserved_special_token_0|>
class StudentDebtsController:
def __init__(self, master, model, view):
self._master = master
self._model = model
self._view = view
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0... | flexible | {
"blob_id": "8aacc8dbfdd70d24689ae17b9c29b1ffc80fb231",
"index": 9013,
"step-1": "<mask token>\n\n\nclass StudentDebtsController:\n\n def __init__(self, master, model, view):\n self._master = master\n self._model = model\n self._view = view\n <mask token>\n <mask token>\n <mask t... | [
2,
3,
6,
7,
8
] |
<|reserved_special_token_0|>
class Tarefas(Screen):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class Tarefa(BoxLayout):
def __init__(self, text='', **kwargs):
super().__init__(**kwargs)
self.ids.label.text = text
class Test(App):
def build(self):
return Ger... | flexible | {
"blob_id": "66b42791325a53172d4514cdd16ccd58d4edb186",
"index": 2409,
"step-1": "<mask token>\n\n\nclass Tarefas(Screen):\n <mask token>\n <mask token>\n\n\nclass Tarefa(BoxLayout):\n\n def __init__(self, text='', **kwargs):\n super().__init__(**kwargs)\n self.ids.label.text = text\n\n\nc... | [
5,
8,
9,
11
] |
<|reserved_special_token_0|>
class BaseConnection(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __init__(self, hostname, logger=None, sudo=False, threads=1, eager=
True, detect_sudo=False, use_ssh=False, interpreter=None,
ssh_optio... | flexible | {
"blob_id": "ae38995d153deed2e6049b7b65fb5f28dfcef470",
"index": 1442,
"step-1": "<mask token>\n\n\nclass BaseConnection(object):\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, hostname, logger=None, sudo=False, threads=1, eager=\n True, detect_sudo=False, use_ssh=False, i... | [
19,
23,
27,
30,
31
] |
import pickle
import numpy as np
import torch
import time
import torchvision
import matplotlib
import matplotlib.pyplot as plt
def load_cifar_data(data_files):
data = []
labels = []
for file in data_files:
with open(file, 'rb') as fo:
data_dict = pickle.load(fo, encoding='bytes')
... | normal | {
"blob_id": "66fe0a3b84773ee1d4f91d8fde60f1fc5b3d7e4c",
"index": 6454,
"step-1": "<mask token>\n\n\ndef load_cifar_data(data_files):\n data = []\n labels = []\n for file in data_files:\n with open(file, 'rb') as fo:\n data_dict = pickle.load(fo, encoding='bytes')\n if len(da... | [
8,
10,
12,
13,
14
] |
<|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": "b99093fb13c59d4b9bb0a4f32fb62423d6752118",
"index": 6480,
"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 = [('scenario', ... | [
0,
1,
2,
3,
4
] |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .BLWecc import (
curve,
setCurve,
getPublicKey,
getPrivateKey,
getAddress as getAddressByCode,
pub2add as getAddressByPublicKey,
sign,
verifyTx as verify,
)
| normal | {
"blob_id": "25ee13314c7cf828b8805d9f483bd5ee12073228",
"index": 8004,
"step-1": "<mask token>\n",
"step-2": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom .BLWecc import curve, setCurve, getPublicKey, getPrivateKey, getAddress as getAddres... | [
0,
1,
2
] |
'''
Character class
'''
import pygame
from time import sleep
class Character:
def __init__(self, screen, side_length, border_width, valid_points, start_point, end_point, current_position, a_colour, na_colour,\
keys=None, k_colour=None):
self.screen = screen # pygame screen
self.side_length = side_length # ... | normal | {
"blob_id": "f7f96b19bdc20f732566709a7801002fe49d49eb",
"index": 3214,
"step-1": "<mask token>\n\n\nclass Character:\n\n def __init__(self, screen, side_length, border_width, valid_points,\n start_point, end_point, current_position, a_colour, na_colour, keys\n =None, k_colour=None):\n sel... | [
5,
6,
7,
8,
9
] |
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
# Define a function to compute color histogram features
# Pass the color_space flag as 3-letter all caps string
# like 'HSV' or 'LUV' etc.
# KEEP IN MIND IF YOU DECIDE TO USE THIS FUNCTION LATER
# IN YOUR PROJECT THAT IF ... | normal | {
"blob_id": "f178ae70ce54244624c2254d0d6256b83144db33",
"index": 5085,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef bin_spatial(img, color_space='RGB', size=(32, 32)):\n colour_dict = {'RGB': 'RGB', 'BGR': cv2.COLOR_BGR2RGB, 'HLS': cv2.\n COLOR_BGR2HLS, 'HSV': cv2.COLOR_BGR2HSV, 'LUV'... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class LinkedList(object):
<|reserved_special_token_0|>
def __init__(self, iterable=()):
"""Constructor for the Linked List object."""
self.head = None
self._counter = 0
if isinstance(iterable, (str, tuple, list)):
for item in iterable:
... | flexible | {
"blob_id": "192bd3c783f6f822f8e732ddf47d7fc3b22c032b",
"index": 1618,
"step-1": "<mask token>\n\n\nclass LinkedList(object):\n <mask token>\n\n def __init__(self, iterable=()):\n \"\"\"Constructor for the Linked List object.\"\"\"\n self.head = None\n self._counter = 0\n if isi... | [
6,
10,
12,
14,
15
] |
from output.models.nist_data.list_pkg.nmtokens.schema_instance.nistschema_sv_iv_list_nmtokens_min_length_5_xsd.nistschema_sv_iv_list_nmtokens_min_length_5 import NistschemaSvIvListNmtokensMinLength5
obj = NistschemaSvIvListNmtokensMinLength5(
value=[
"f",
"D",
"T",
"a",
"b"... | normal | {
"blob_id": "3941f283893c259033d7fb3be83c8071433064ba",
"index": 7170,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nobj = NistschemaSvIvListNmtokensMinLength5(value=['f', 'D', 'T', 'a', 'b',\n 'C', 'o', 't', 't', 'w'])\n",
"step-3": "from output.models.nist_data.list_pkg.nmtokens.schema_instance.n... | [
0,
1,
2,
3
] |
class Solution:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
def findLength(self, A: [int], B: [int]) ->int:
"""
动态规划, 维护一个公共子串长度表DP
DP[i][j]表示A中以第i个元素,B中以第j个元素结尾的公共子串长度
如果A[i]==B[j], DP[i][j]=DP[i-1][j-1]+1
... | flexible | {
"blob_id": "b8219c21dc2cdd497d3de48c59c146a1fd1509ec",
"index": 6673,
"step-1": "class Solution:\n <mask token>\n\n\n<mask token>\n",
"step-2": "class Solution:\n\n def findLength(self, A: [int], B: [int]) ->int:\n \"\"\"\n 动态规划, 维护一个公共子串长度表DP\n DP[i][j]表示A中以第i个元素,B中以第j个元素结尾的公共子串长度\... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def x_shortcut(lng):
return floor((lng + 180) * NR_SHORTCUTS_PER_LNG)
def y_shortcut(lat):
return floor((90 - lat) * NR_SHORTCUTS_PER_LAT)
def big_zone(xmax, xmin, ymax, ymin):
return (xmax - xmin > 2 / NR_SHORTCUTS_PER_LNG and ymax - ymin > 2 /
NR_SHORTCUTS_PER_LA... | flexible | {
"blob_id": "52e43f795c864340734de2640e3c1a70b05e8ea0",
"index": 7248,
"step-1": "<mask token>\n\n\ndef x_shortcut(lng):\n return floor((lng + 180) * NR_SHORTCUTS_PER_LNG)\n\n\ndef y_shortcut(lat):\n return floor((90 - lat) * NR_SHORTCUTS_PER_LAT)\n\n\ndef big_zone(xmax, xmin, ymax, ymin):\n return (xma... | [
11,
13,
15,
17,
22
] |
<|reserved_special_token_0|>
class IssuanceController(QObject):
def __init__(self, model):
super().__init__()
self._database_controller = DatabaseController()
self._model = model
<|reserved_special_token_0|>
@pyqtSlot(str)
def change_student_id(self, value):
self._mod... | flexible | {
"blob_id": "1d4df09256324cce50fad096cdeff289af229728",
"index": 3132,
"step-1": "<mask token>\n\n\nclass IssuanceController(QObject):\n\n def __init__(self, model):\n super().__init__()\n self._database_controller = DatabaseController()\n self._model = model\n <mask token>\n\n @pyq... | [
8,
9,
12,
13,
14
] |
from django.db import models
from django.contrib.auth.models import User
from django.core.validators import MaxValueValidator, MinValueValidator
class Person(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='person')
age = models.PositiveSmallIntegerField()
bio = mode... | normal | {
"blob_id": "6de9fffd91d2f7602f7c681253211077704ba8c4",
"index": 2039,
"step-1": "<mask token>\n\n\nclass Product(models.Model):\n title = models.CharField(max_length=32)\n description = models.TextField(max_length=360)\n price = models.IntegerField()\n image = models.CharField(max_length=255, null=T... | [
6,
7,
9,
10,
12
] |
import os, subprocess
def greet(name):
hostname = subprocess.check_output("hostname").decode("utf-8")[:-1]
return "Hello, {}! I'm {}#{}.".format(name, hostname, os.getppid())
| normal | {
"blob_id": "9bd55a2f224acfa2cb34d0ca14a25e8864d644b3",
"index": 5250,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef greet(name):\n hostname = subprocess.check_output('hostname').decode('utf-8')[:-1]\n return \"Hello, {}! I'm {}#{}.\".format(name, hostname, os.getppid())\n",
"step-3": "i... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
sns.set()
<|reserved_special_token_0|>
MG.pyroplot.spider(color='green', alpha=0.5, mode='fill')
VCCR.pyroplot.spider(color='red', alpha=0.5, mode='fill')
FG.pyroplot.spider(color='purple', alpha=0.5, mode='fill')
FGCP.pyroplot.sp... | flexible | {
"blob_id": "f6fee18898636ad6b0dc6d96d28dead4e09b8035",
"index": 1650,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsns.set()\n<mask token>\nMG.pyroplot.spider(color='green', alpha=0.5, mode='fill')\nVCCR.pyroplot.spider(color='red', alpha=0.5, mode='fill')\nFG.pyroplot.spider(color='purple', alpha=0.5... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
def create_map(rows):
maze = []
for row in rows:
row = row[:-1]
subarr = []
for i in row:
subarr.append(i)
maze.append(subarr)
return maze
def print_map(chart):
for subarr in chart:
print(subarr)
def find_start(chart):
... | normal | {
"blob_id": "bde37f3b41c810ab465de5e0ae374703af9f01f3",
"index": 9033,
"step-1": "def create_map(rows):\n maze = []\n for row in rows:\n row = row[:-1]\n subarr = []\n for i in row:\n subarr.append(i)\n maze.append(subarr)\n return maze\n\n\ndef print_map(chart):\n... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in range(85):
so2_ash_masked[:, i, :] = so2_ash[:, i, :] * mask
so2_only_masked[:, i, :] = so2_only[:, i, :] * mask
<|reserved_special_token_0|>
plt.rcParams.update(params)
<|reserved_special_token_0|>
fig.text(0.5, ... | flexible | {
"blob_id": "e77c855ba87bc36ab09b0a3eca5c1b7123535794",
"index": 2802,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(85):\n so2_ash_masked[:, i, :] = so2_ash[:, i, :] * mask\n so2_only_masked[:, i, :] = so2_only[:, i, :] * mask\n<mask token>\nplt.rcParams.update(params)\n<mask token... | [
0,
1,
2,
3,
4
] |
import re
print("Кулик Валерія Максимівна\n "
"Лабораторна робота №2 \n "
"Варіант 10 \n "
"Завдання №1. Обчислити формулу")
def int_input(text):
while True:
user_input = input(text)
if re.match('^[0-9]{1,}$', user_input):
break
else:
print("По... | normal | {
"blob_id": "e8e52cd0a0685e827ecbc6272657de5158fa0d94",
"index": 7037,
"step-1": "import re\n\nprint(\"Кулик Валерія Максимівна\\n \"\n \"Лабораторна робота №2 \\n \"\n \"Варіант 10 \\n \"\n \"Завдання №1. Обчислити формулу\")\n\n\ndef int_input(text):\n while True:\n user_input = inp... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(a.shape)
print(a)
print('\n')
print(a[0][5])
print(a[1][1])
print(a[1][-6])
print(a[1])
print(a[0])
print(a[0, :])
print(a[:, 1])
print('\n')
print('even numbers from first row')
print(a[0, 1:8:2])
<|reserved_special_token_0... | flexible | {
"blob_id": "8cc97ebe0ff7617eaf31919d40fa6c312d7b6f94",
"index": 8814,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(a.shape)\nprint(a)\nprint('\\n')\nprint(a[0][5])\nprint(a[1][1])\nprint(a[1][-6])\nprint(a[1])\nprint(a[0])\nprint(a[0, :])\nprint(a[:, 1])\nprint('\\n')\nprint('even numbers from f... | [
0,
1,
2,
3,
4
] |
# DATA TYPES (DATA TİPLERİ)
# STRİNGS (KARAKTER DİZİNLERİ)
# Bir karakter dizinini tanımlamak için tırnaklar kullanılır. birkaç satır ka-
# rakter dizini yazıyorsak 3 tırnak kullanılır:
print("""Üç tırnaklı
karakter
dizinine
örnek""")
üç tırnaklı
karakter
dizinine
örnek
print('Tek tırnak: Tek satırlık... | normal | {
"blob_id": "61f2fbed184ff6f842ba9527456da453844f8dc6",
"index": 1362,
"step-1": "# DATA TYPES (DATA TİPLERİ)\r\n\r\n# STRİNGS (KARAKTER DİZİNLERİ)\r\n\r\n# Bir karakter dizinini tanımlamak için tırnaklar kullanılır. birkaç satır ka-\r\n# rakter dizini yazıyorsak 3 tırnak kullanılır:\r\nprint(\"\"\"Üç tırnaklı\r... | [
0
] |
# #----------------------------------------#
# 3.4
#
# Question:
# Write a program which can map() to make a list whose elements are square of elements in [1,2,3,4,5,6,7,8,9,10].
#
| normal | {
"blob_id": "8c71bc5d53bf5c4cb20784659eddf8a97efb86ef",
"index": 8336,
"step-1": "#\t#----------------------------------------#\n#\t3.4\n#\t\n#\tQuestion:\n#\tWrite a program which can map() to make a list whose elements are square of elements in [1,2,3,4,5,6,7,8,9,10].\n#\t\n",
"step-2": null,
"step-3": nul... | [
1
] |
<|reserved_special_token_0|>
def get_file_list(save_path, wld='*.105*.hdf'):
"""
Args:
save_path: path to folder where raw MODIS files are
wld: common wildcard in all of the raw MODIS files
Returns:
list of files to analyze in the raw folder
"""
return glob.glob(os.path.... | flexible | {
"blob_id": "afb09f9d5860994f38e8553b19e7ebc339cc2df6",
"index": 8785,
"step-1": "<mask token>\n\n\ndef get_file_list(save_path, wld='*.105*.hdf'):\n \"\"\"\n\n Args:\n save_path: path to folder where raw MODIS files are\n wld: common wildcard in all of the raw MODIS files\n\n Returns:\n ... | [
6,
11,
12,
13,
16
] |
#!/usr/bin/python
import sys
import random
def has_duplicates(list) :
"""Returns True if there are duplicate in list, false otherwise"""
copy = list[:]
copy.sort()
for item in range(len(list)-1):
if copy[item] == copy[item + 1]:
return True;
return False;
def gen_birthdays(n):
"""returns a list ... | normal | {
"blob_id": "e34e1e220c6d0fe2dc3d42caaefb04b178cdd120",
"index": 3768,
"step-1": "#!/usr/bin/python\nimport sys\nimport random\n\ndef has_duplicates(list) :\n \"\"\"Returns True if there are duplicate in list, false otherwise\"\"\"\n copy = list[:]\n copy.sort()\n for item in range(len(list)-1):\n if copy... | [
0
] |
from channels.routing import route
from .consumers import message_consumer
channel_routing = [
route("slack.rtm.message", message_consumer)
] | normal | {
"blob_id": "8439972b4458ba66d98f6a80a82a35576df472a4",
"index": 8096,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nchannel_routing = [route('slack.rtm.message', message_consumer)]\n",
"step-3": "from channels.routing import route\nfrom .consumers import message_consumer\nchannel_routing = [route('sl... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class UserRegistrationForm(forms.Form):
<|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|>
def save(self... | flexible | {
"blob_id": "5f680fb21fe1090dfb58f5b9260739b91ae04d99",
"index": 9922,
"step-1": "<mask token>\n\n\nclass UserRegistrationForm(forms.Form):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def save(self):\n new_user = User... | [
6,
8,
9,
10,
11
] |
<|reserved_special_token_0|>
def t200():
return np.random.choice(2, 200, p=[0.1, 0.9])
<|reserved_special_token_0|>
def t1000():
return np.random.choice(2, 1000, p=[0.1, 0.9])
<|reserved_special_token_0|>
def prob_cond_given_pos(prob_cond, prob_pos_given_cond, prob_neg_given_no_cond
):
x = np.... | flexible | {
"blob_id": "076d9f0c14a8070993039bbda2ffe4d52c8d2273",
"index": 1512,
"step-1": "<mask token>\n\n\ndef t200():\n return np.random.choice(2, 200, p=[0.1, 0.9])\n\n\n<mask token>\n\n\ndef t1000():\n return np.random.choice(2, 1000, p=[0.1, 0.9])\n\n\n<mask token>\n\n\ndef prob_cond_given_pos(prob_cond, prob... | [
4,
6,
7,
8,
9
] |
#!/bin/env python3
"""
A tool for painting and saving Game Boy tiles.
Usage: `python3 gb-tile-painter.py`
Please see: README.md.
"""
from sys import argv, exit
# If we got an argument and it is --help or -h
if len(argv) == 2 and (argv[1] == "--help" or argv[1] == "-h"):
print(__doc__) # Print the docstring
... | normal | {
"blob_id": "c153c7a3a11a09ed645540632daec42e8905432a",
"index": 4165,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif len(argv) == 2 and (argv[1] == '--help' or argv[1] == '-h'):\n print(__doc__)\n exit(0)\n<mask token>\nif __name__ == '__main__':\n window = MainWindow()\n window.mainloop(... | [
0,
1,
2,
3
] |
# Generated by Django 3.1.6 on 2021-07-17 10:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shop', '0032_product_sex'),
]
operations = [
migrations.AddField(
model_name='product',
name='price_ret_sale',
... | normal | {
"blob_id": "09660cfcff7d5da0339da201cb18b6f63bec2df9",
"index": 1394,
"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 = [('shop', '003... | [
0,
1,
2,
3,
4
] |
"""
리스트에 있는 숫자들의 최빈값을 구하는 프로그램을 만들어라.
[12, 17, 19, 17, 23] = 17
[26, 37, 26, 37, 91] = 26, 37
[28, 30, 32, 34, 144] = 없다
최빈값 : 자료의 값 중에서 가장 많이 나타난 값
① 자료의 값이 모두 같거나 모두 다르면 최빈값은 없다.
② 자료의 값이 모두 다를 때, 도수가 가장 큰 값이 1개 이상 있으면 그 값은 모두 최빈값이다.
"""
n_list = [[12, 17, 19, 17, 23],
[26, 37, 26, 37, 91],
[28,... | normal | {
"blob_id": "39f9341313e29a22ec5e05ce9371bf65e89c91bd",
"index": 25,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor numbers in n_list:\n n_dict = {}\n for n in numbers:\n if n in n_dict:\n n_dict[n] += 1\n else:\n n_dict[n] = 1\n mode = []\n if len(n_di... | [
0,
1,
2,
3
] |
# coding: utf-8
"""
login.py
~~~~~~~~
木犀官网登陆API
"""
from flask import jsonify, request
from . import api
from muxiwebsite.models import User
from muxiwebsite import db
@api.route('/login/', methods=['POST'])
def login():
email = request.get_json().get("email")
pwd = request.get_json().get("pass... | normal | {
"blob_id": "a0dbb374f803cb05a35f823f54ef5f14eaf328b2",
"index": 3688,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@api.route('/login/', methods=['POST'])\ndef login():\n email = request.get_json().get('email')\n pwd = request.get_json().get('password')\n user = User.query.filter_by(email... | [
0,
1,
2,
3
] |
from __future__ import absolute_import
from django.conf.urls import patterns, url
from sentry_plugins.jira_ac.views import JiraConfigView, \
JiraDescriptorView, JiraInstalledCallback, JiraUIWidgetView
urlpatterns = patterns(
'',
url(r'^plugin$', JiraUIWidgetView.as_view()),
url(r'^config$', JiraConfi... | normal | {
"blob_id": "2440f5bc774f2e2f746a246cbb2e305965c9e576",
"index": 7788,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = patterns('', url('^plugin$', JiraUIWidgetView.as_view()), url\n ('^config$', JiraConfigView.as_view()), url(\n '^atlassian-connect\\\\.json$', JiraDescriptorView.as_vi... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if sys.version_info[0] < 3:
warnings.warn('At least Python 3.0 is required to run this program',
RuntimeWarning)
else:
print('Normal continuation')
<|reserved_special_token_1|>
import sys, warnings
if sys.versio... | flexible | {
"blob_id": "a6d5552fa0648fcf9484a1498e4132eb80ecfc86",
"index": 2304,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif sys.version_info[0] < 3:\n warnings.warn('At least Python 3.0 is required to run this program',\n RuntimeWarning)\nelse:\n print('Normal continuation')\n",
"step-3": "im... | [
0,
1,
2,
3
] |
from typing import Any
from jinja2.environment import Environment
MAX_RANGE = ... # type: int
UNSAFE_FUNCTION_ATTRIBUTES = ... # type: Any
UNSAFE_METHOD_ATTRIBUTES = ... # type: Any
UNSAFE_GENERATOR_ATTRIBUTES = ... # type: Any
def safe_range(*args): ...
def unsafe(f): ...
def is_internal_attribute(obj, attr): ..... | normal | {
"blob_id": "697f4dd640ddba0411eb6eb68e7ce079a6330670",
"index": 9837,
"step-1": "<mask token>\n\n\nclass SandboxedEnvironment(Environment):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def intercept_unop(self, operator):\n ...\n <mask token>\n <ma... | [
10,
11,
13,
17,
21
] |
<|reserved_special_token_0|>
class Solution:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class Solution:
def reverseList(self, head):
prev = None
while head:
curr = head
head = head.next
curr.next = prev
prev = curr
r... | flexible | {
"blob_id": "682495fec200ddad5a68f06bb0ec24e59036e66b",
"index": 3286,
"step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n\n\nclass Solution:\n\n def reverseList(self, head):\n prev = None\n while head:\n curr = head\n head = head.next\n ... | [
6,
7,
8,
9,
11
] |
import os, gc, random
from time import time
import pickle
import numpy as np
import pandas as pd
from sklearn.metrics import log_loss, f1_score, accuracy_score
from collections import Counter
from IPython.display import clear_output
import torch
from transformers import (
AutoTokenizer, RobertaTokenizerFast,
B... | normal | {
"blob_id": "458124aa0d6f04268ad052f74d546b12d3f3f5f7",
"index": 8989,
"step-1": "<mask token>\n\n\nclass Timer:\n\n def __init__(self):\n self._time = 0\n self.is_stopped = False\n self._start()\n <mask token>\n <mask token>\n\n @property\n def time(self):\n self._stop... | [
23,
29,
31,
33,
35
] |
from django.contrib import admin
from .models import CarouselImage, Budget
admin.site.register(CarouselImage)
admin.site.register(Budget)
| normal | {
"blob_id": "98fb70e1911522365292c86603481656e7b86d73",
"index": 8337,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nadmin.site.register(CarouselImage)\nadmin.site.register(Budget)\n",
"step-3": "from django.contrib import admin\nfrom .models import CarouselImage, Budget\nadmin.site.register(CarouselI... | [
0,
1,
2
] |
'''
Created on June 10 2013
@author: Eugene Shim
This unit test suite is designed to test the unitTestParser module.
At the moment, the functions of that module are too simple to really
unit test effectively
'''
#Standard library modules
import unittest
#the module being tested
import unitTest... | normal | {
"blob_id": "5d0a45b93bd7972333f5574188c65484c065e9cf",
"index": 1327,
"step-1": "'''\nCreated on June 10 2013\n\n@author: Eugene Shim\n\n This unit test suite is designed to test the unitTestParser module.\n \n \n At the moment, the functions of that module are too simple to really\n unit test ef... | [
0
] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Customer',
fields=[
('id', models.AutoField(ver... | normal | {
"blob_id": "6bc400896c004f0fdddbbd3dd73ef9aaa19eb4db",
"index": 1053,
"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
] |
from django import urls
from django.urls import path
from genius.views import (home, Class_create, Class_Update, Class_Delete, Class_Detail, Classes, Add_name,
Student_Main, Student_Create, Student_Update, Student_Delete, Student_Detail, Search)
app_name = 'genius'
urlpatterns = [
path('... | normal | {
"blob_id": "fd6a32652b845b2a6d6d8934c0dde91afdddd9f3",
"index": 9046,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napp_name = 'genius'\nurlpatterns = [path('', home, name='home'), path('class/', Classes, name=\n 'class'), path('class/add-name', Add_name, name='add-name'), path(\n 'class/create',... | [
0,
1,
2,
3
] |
# coding=utf-8
import pytest
from twitter_tunes.scripts import redis_data
from mock import patch
REDIS_PARSE = [
(b"{'trend3': 'url3', 'trend2': 'url2', 'trend1': 'url1'}",
{'trend1': 'url1', 'trend2': 'url2', 'trend3': 'url3'}),
(b"{}", {}),
(b"{'hello':'its me'}", {'hello': 'its me'}),
(b"{'... | normal | {
"blob_id": "7f4a5779564efde7eaf08741d00254dd4aa37569",
"index": 4218,
"step-1": "<mask token>\n\n\n@pytest.mark.parametrize('data, parsed', REDIS_PARSE)\ndef test_parse_redis_data(data, parsed):\n \"\"\"Test to see if data dict in bytes is parsed.\"\"\"\n assert redis_data.parse_redis_data(data) == parsed... | [
7,
8,
10,
11,
12
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if display is None or 'localhost' in display:
matplotlib.use('agg')
<|reserved_special_token_0|>
parser.add_argument('--n-samples', type=int, default=5000)
parser.add_argument('--use-localization', action='store_true')
parser.... | flexible | {
"blob_id": "f4bc5663ab2b2a6dbb41a2fc3d7ca67100b455a4",
"index": 838,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif display is None or 'localhost' in display:\n matplotlib.use('agg')\n<mask token>\nparser.add_argument('--n-samples', type=int, default=5000)\nparser.add_argument('--use-localization'... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Dock(pydantic.BaseModel):
fleet_name: str = ''
params: List[DockParameter] = []
class Config:
orm_mode = True
<|reserved_special_token_1|>
from typing import List
import pydantic
from ..rmf_fleet_m... | flexible | {
"blob_id": "62d0818395a6093ebf2c410aaadeb8a0250707ab",
"index": 3865,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Dock(pydantic.BaseModel):\n fleet_name: str = ''\n params: List[DockParameter] = []\n\n\n class Config:\n orm_mode = True\n",
"step-3": "from typing import Lis... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def S_q(theta, a0=1, b0=0.01):
w = theta[:, :-1]
s = tf.reshape(theta[:, -1], shape=[-1, 1])
y_hat = 1.0 / (1.0 + tf.exp(-tf.matmul(Xs, tf.transpose(w))))
y = tf.reshape((ys + 1.0) / 2.0, shape=[-1, 1])
dw_data = tf.matmul(tf.transpose(y - y_hat), Xs)
dw_prior = -s... | flexible | {
"blob_id": "a0a9527268fb5f8ea24de700f7700b874fbf4a6b",
"index": 4838,
"step-1": "<mask token>\n\n\ndef S_q(theta, a0=1, b0=0.01):\n w = theta[:, :-1]\n s = tf.reshape(theta[:, -1], shape=[-1, 1])\n y_hat = 1.0 / (1.0 + tf.exp(-tf.matmul(Xs, tf.transpose(w))))\n y = tf.reshape((ys + 1.0) / 2.0, shape... | [
4,
5,
7,
8,
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_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
dependencies = [(... | flexible | {
"blob_id": "bfd8385e8f4886b91dde59c04785134b9cd6a2b6",
"index": 3893,
"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 = [('api_rest', ... | [
0,
1,
2,
3,
4
] |
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditio... | normal | {
"blob_id": "9fa534664056a8cf9e9a64ccc7d6dd4de2ec0936",
"index": 1514,
"step-1": "<mask token>\n\n\nclass Trainer(object):\n <mask token>\n\n def __init__(self, data_loader, model_name, model, optimizer_fn,\n final_steps, lr_scheduler_fn=None, step=0, ckpt_path=None, log_path\n =None, n_epoch... | [
8,
12,
13,
14,
15
] |
<|reserved_special_token_0|>
class UnknownCommand(Exception):
pass
<|reserved_special_token_0|>
class Tamagotchi:
def __init__(self) ->None:
self._age = 0
self._food_level = INITIAL_FOOD_LEVEL
self._energy_level = INITIAL_ENERGY_LEVEL
self._poop_level = INITIAL_POOP_LEVEL
... | flexible | {
"blob_id": "1dd09a09f542099091d94d466ebd7cc149884eb4",
"index": 7385,
"step-1": "<mask token>\n\n\nclass UnknownCommand(Exception):\n pass\n\n\n<mask token>\n\n\nclass Tamagotchi:\n\n def __init__(self) ->None:\n self._age = 0\n self._food_level = INITIAL_FOOD_LEVEL\n self._energy_lev... | [
10,
11,
12,
13,
16
] |
<|reserved_special_token_0|>
def _send(body, subject):
msg = MIMEMultipart()
msg['From'] = FROM
msg['To'] = TO
msg['Subject'] = subject
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP(host=HOST, port=int(PORT))
server.starttls()
server.login(FROM, PASSWORD)
senders = serv... | flexible | {
"blob_id": "60c3f6775d5112ff178bd3774c776819573887bb",
"index": 9367,
"step-1": "<mask token>\n\n\ndef _send(body, subject):\n msg = MIMEMultipart()\n msg['From'] = FROM\n msg['To'] = TO\n msg['Subject'] = subject\n msg.attach(MIMEText(body, 'plain'))\n server = smtplib.SMTP(host=HOST, port=in... | [
1,
2,
3,
4,
5
] |
from django.http.response import HttpResponse
from django.shortcuts import render , HttpResponse
import requests
from django.conf import settings
from .forms import WeatherForm
# Create your views here.
def get_weather(request):
form = WeatherForm()
error = ""
output = {}
if request.method == 'POST':
... | normal | {
"blob_id": "be5a683309317f1f6ebc20ad3511fd2b2510e806",
"index": 5535,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_weather(request):\n form = WeatherForm()\n error = ''\n output = {}\n if request.method == 'POST':\n form = WeatherForm(request.POST)\n if form.is_va... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
from .variational_legacy import *
<|reserved_special_token_1|>
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .variational_legacy import *
| flexible | {
"blob_id": "ea07cb640e76ced8be92b55ee14e1d3058e073c9",
"index": 845,
"step-1": "<mask token>\n",
"step-2": "from .variational_legacy import *\n",
"step-3": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom .variational_legacy import *\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'POST':
githubName = request.form.get('githubname')
responseUser = requests.get('{}{}'.format(base_url, githubName))
response... | flexible | {
"blob_id": "62094d036596f39e7cf936fe7a91e67d53ee055e",
"index": 9557,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@app.route('/', methods=['GET', 'POST'])\ndef index():\n if request.method == 'POST':\n githubName = request.form.get('githubname')\n responseUser = requests.get('{}{... | [
0,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class predict(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def trainExtraTreeRegressor(self):
self.__tree_reg.fit(... | flexible | {
"blob_id": "ee49ce63951721458cb98b370285d04231bb2c20",
"index": 7438,
"step-1": "<mask token>\n\n\nclass predict(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def trainExtraTreeRegressor(self):\n self.__tree_reg.fit(self.train_... | [
4,
8,
14,
17,
18
] |
import tornado.httpserver
import tornado.websocket
import tornado.ioloop
import tornado.web
import tornado.options
import serial
import time
from datetime import timedelta
import cv2
import time
from datetime import datetime
#for webcam users
camera=cv2.VideoCapture(0)
#for picam users
#import picam
#camera=picam.Op... | normal | {
"blob_id": "1e9afe6435285da6c6efb678177587d7ba5a01b2",
"index": 1397,
"step-1": "import tornado.httpserver\nimport tornado.websocket\nimport tornado.ioloop\nimport tornado.web\nimport tornado.options\nimport serial\nimport time\nfrom datetime import timedelta\nimport cv2\nimport time\nfrom datetime import datet... | [
0
] |
# Definition for a Node.
class Node:
def __init__(self, val, children):
self.val = val
self.children = children
class Solution(object):
def postorder(self, root):
"""
:type root: Node
:rtype: List[int]
"""
if not root:
return([])
if no... | normal | {
"blob_id": "93ec15a37bd5f022e8f6e226e3bf0e91cc0457c6",
"index": 2178,
"step-1": "class Node:\n <mask token>\n\n\nclass Solution(object):\n\n def postorder(self, root):\n \"\"\"\n :type root: Node\n :rtype: List[int]\n \"\"\"\n if not root:\n return []\n ... | [
3,
4,
5,
6,
7
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.