code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
import numpy as np
z = np.linspace(2,10,5) #from 2 to 10, with 5 elements
# OUT: array( [ 2. , 4. , 6. , 8. , 10. ] )
np.random.seed(0)
z1 = np.random.randint(10, size = 6)
# OUT: array( [5, 0, 3, 3, 7, 9] )
z = np.array([1,2,3,4,5])
z < 3
# OUT: array([T,T,F,F,F])
z[z<3]
# OUT: array([1,2])
a = np.array([1,2,3,4,... | normal | {
"blob_id": "be5147efda879165107378527ebf44890c03be75",
"index": 6679,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nnp.random.seed(0)\n<mask token>\nz < 3\nz[z < 3]\n<mask token>\na + b\na + 30\n<mask token>\nprint(a)\na.shape()\na.ndim()\na[0, 2]\na[0, :]\na[:, 1]\nnp.min(a)\nnp.zeros(5)\nnp.zeros_lik... | [
0,
1,
2,
3,
4
] |
from http import HTTPStatus
#from pytest_chalice.handlers import RequestHandler
import app
from chalice.test import Client
def test_index_with_url():
with Client(app.app) as client:
response = client.http.get('/?url=https://google.com')
assert response.status_code == HTTPStatus.MOVED_PERMANENTLY
... | normal | {
"blob_id": "e7e9a53d4c41448521b324d51641a46827faa692",
"index": 2607,
"step-1": "<mask token>\n\n\ndef test_index_with_url():\n with Client(app.app) as client:\n response = client.http.get('/?url=https://google.com')\n assert response.status_code == HTTPStatus.MOVED_PERMANENTLY\n assert ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def kde_Gaussian_fitting(miu, bandwidth):
kde_analyzer = KernelDensity(kernel='gaussian', bandwidth=bandwidth).fit(
miu)
return kde_analyzer
<|reserved_special_token_0|>
def second_moment_all_dist(batch_dim_dist):
return batch_dim_dist.pow(2).sum(dim=1).mean(dim=0)... | flexible | {
"blob_id": "0ee902d59d3d01b6ec8bb4cc8d5e8aa583644397",
"index": 1298,
"step-1": "<mask token>\n\n\ndef kde_Gaussian_fitting(miu, bandwidth):\n kde_analyzer = KernelDensity(kernel='gaussian', bandwidth=bandwidth).fit(\n miu)\n return kde_analyzer\n\n\n<mask token>\n\n\ndef second_moment_all_dist(bat... | [
12,
13,
17,
21,
22
] |
# Copyright 2014 Rackspace Hosting
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | normal | {
"blob_id": "120021e44f6df9745db35ea2f38f25acecca9252",
"index": 3201,
"step-1": "<mask token>\n\n\n@test(depends_on_classes=[AfterConfigurationsCreation], groups=[tests.\n DBAAS_API_CONFIGURATIONS])\nclass ListConfigurations(ConfigurationsTestBase):\n\n @test\n def test_configurations_list(self):\n ... | [
29,
40,
43,
52,
53
] |
from distutils.core import setup
setup(name='json_config', version='0.0.01', packages=['', 'test'], url='',
license='', author='craig.ferguson', author_email='', description=
'Simple Functional Config For Changing Environments')
| normal | {
"blob_id": "ee57e6a1ccbec93f3def8966f5621ea459f3d228",
"index": 6538,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsetup(name='json_config', version='0.0.01', packages=['', 'test'], url='',\n license='', author='craig.ferguson', author_email='', description=\n 'Simple Functional Config For Chang... | [
0,
1,
2
] |
import copy
import datetime
from sacred import Experiment
from tqdm import tqdm
from mms_msg.databases.classical.full_overlap import WSJ2Mix
import paderbox as pb
import padertorch as pt
ex = Experiment('mixture_generator_create_json')
@ex.config
def defaults():
json_path = 'database.json'
database = {
... | normal | {
"blob_id": "f39130099ccf467623d65ac328fd02538044d36a",
"index": 6476,
"step-1": "<mask token>\n\n\n@ex.automain\ndef main(json_path, database, _log):\n database_config = database\n database = pt.configurable.config_to_instance(database)\n database_dict = {'datasets': {dataset_name: dict(tqdm(database.\... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def get_signature(now_):
h = hmac.new(key='d1b964811afb40118a12068ff74a12f4'.encode('utf-8'),
digestmod=sha1)
grant_type = 'password'
client_id = 'c3cef7c66a1843f8b3a9e6a1e3160e20'
source = 'com.zhihu.web'
now = now_
h.update((grant_type + client_id + sourc... | flexible | {
"blob_id": "757a69f9ceaa3434c6d9f8b1fcdbadd991190f29",
"index": 9315,
"step-1": "<mask token>\n\n\ndef get_signature(now_):\n h = hmac.new(key='d1b964811afb40118a12068ff74a12f4'.encode('utf-8'),\n digestmod=sha1)\n grant_type = 'password'\n client_id = 'c3cef7c66a1843f8b3a9e6a1e3160e20'\n sou... | [
1,
2,
3,
4,
5
] |
from django.apps import AppConfig
class PrimaryuserConfig(AppConfig):
name = 'PrimaryUser'
| normal | {
"blob_id": "82c10076ba73723b696e3e33280296c2a24f20b9",
"index": 4187,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass PrimaryuserConfig(AppConfig):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass PrimaryuserConfig(AppConfig):\n name = 'PrimaryUser'\n",
"step-4": "from django.app... | [
0,
1,
2,
3
] |
class Rect:
def __init__(self, w, h):
self.w = w
self.h = h
def half(self):
return self.w / 2
<|reserved_special_token_0|>
def setup():
size(500, 500)
noLoop()
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Rect:
def __init__(self, w, h):
... | flexible | {
"blob_id": "807f0094a9736abdfa3f5b629615a80f1e0d13ef",
"index": 3037,
"step-1": "class Rect:\n\n def __init__(self, w, h):\n self.w = w\n self.h = h\n\n def half(self):\n return self.w / 2\n\n\n<mask token>\n\n\ndef setup():\n size(500, 500)\n noLoop()\n\n\n<mask token>\n",
"s... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def leaveKout_CV(X, y, n_scz_te, rep, perms, classifiers, parameters, count,
freq_bands, x_size, auc, nz_coef_idx, nz_coef_val, n_BAitaSig=None):
"""
Calculates the leave K out cross validation.
Parameters
... | flexible | {
"blob_id": "69511933697905fb4f365c895264596f19dc1d8d",
"index": 5021,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef leaveKout_CV(X, y, n_scz_te, rep, perms, classifiers, parameters, count,\n freq_bands, x_size, auc, nz_coef_idx, nz_coef_val, n_BAitaSig=None):\n \"\"\"\n Calculates the ... | [
0,
3,
4,
5,
6
] |
"""Test radix sort."""
import random
from collections import OrderedDict
from que_ import Queue
def test_stringify_nums():
"""."""
from radixsort import stringify_nums
nums = [1, 2, 3, 4, 5]
stringified_nums = stringify_nums(nums)
assert stringified_nums == ['1', '2', '3', '4', '5']
def test_wh... | normal | {
"blob_id": "fd907dbcea01679c08aeae6bcbf6e61786f40260",
"index": 2511,
"step-1": "<mask token>\n\n\ndef test_stringify_nums():\n \"\"\".\"\"\"\n from radixsort import stringify_nums\n nums = [1, 2, 3, 4, 5]\n stringified_nums = stringify_nums(nums)\n assert stringified_nums == ['1', '2', '3', '4',... | [
4,
5,
6,
7,
8
] |
from docutils import nodes
from docutils.parsers.rst import directives, Directive
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.lexers.special import TextLexer
from pygments.formatters.html import HtmlFormatter
class Pygments(Directive):
""" Source code syntax hightli... | normal | {
"blob_id": "d3dcef6a1a6bcfc1161c4de46081703b8fe7016d",
"index": 9606,
"step-1": "<mask token>\n\n\nclass Pygments(Directive):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def run(self):\n self.assert_has_content()\n try:\n ... | [
2,
4,
5,
6,
7
] |
import requests
from bs4 import BeautifulSoup
import json
import geojson
import re
import time
_apiKey = "SNgeI1tCT-oihjeZDGi6WqcM0a9QAttLhKTecPaaETQ"
def Geocode(address, apiKey):
URL = 'https://geocode.search.hereapi.com/v1/geocode'
# Параметры запроса
params = {
'q': address,
'apiKey':... | normal | {
"blob_id": "d32496c9bce86f455b24cd9c6dc263aee1bf82af",
"index": 3552,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef Geocode(address, apiKey):\n URL = 'https://geocode.search.hereapi.com/v1/geocode'\n params = {'q': address, 'apiKey': apiKey}\n import pdb\n pdb.set_trace()\n respo... | [
0,
2,
3,
4,
5
] |
#!/usr/bin/env python
from bumblebee.motion import *
from simulation.path import *
from simulation.settings import *
import tf.transformations
from geometry_msgs.msg import TransformStamped,Transform,Quaternion,Vector3
from bumblebee.baseTypes import basicGraph,slidingGraph
from simulation.dataset import stereo_simul... | normal | {
"blob_id": "4b3de2d817aa6f8b92d513bcdba612362becefdc",
"index": 9070,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsty.use('seaborn')\n<mask token>\nrospy.init_node('graph_poses_extract')\nfor f in replayFiles:\n print('new SLiding Graph')\n inlierData = []\n rmsData = []\n inlierRatio = [... | [
0,
1,
2,
3,
4
] |
# Generated by Django 3.0.6 on 2020-06-23 10:58
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('printer', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='printers_stat',
name='type_printers',
... | normal | {
"blob_id": "e7bb5e9a91ec6a1644ddecd52a676c8136087941",
"index": 4719,
"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 = [('printer', '... | [
0,
1,
2,
3,
4
] |
import pygame
import os
from time import sleep
screen = pygame.display.set_mode((900,700))
screen.fill((255,255,255))
pygame.display.set_caption("NTUFOODIERECOMMENDSYSTEM")
'''
###########################
──╔╗────╔╗
──║║───╔╝╚╗
╔═╝╠╦══╬╗╔╬╦══╦═╗╔══╦═╦╗─╔╗
║╔╗╠╣╔═╝║║╠╣╔╗║╔╗╣╔╗║╔╣║─║║
║╚╝║║╚═╗║╚╣║╚╝║║... | normal | {
"blob_id": "2a8032c23e3c7aa3a7b0593c79db7adbc0353f93",
"index": 2125,
"step-1": "<mask token>\n\n\nclass button:\n\n def __init__(self, colour, x, y, width, height, text=''):\n self.colour = colour\n self.x = x\n self.y = y\n self.width = width\n self.height = height\n ... | [
11,
12,
15,
22,
23
] |
<|reserved_special_token_0|>
class Skip_GAN(object):
def __init__(self, sess, epoch, batch_size, dataset_name, result_dir,
z_dim, y_dim, checkpoint_dir, num_resblock, Cycle_lr, Class_weight,
Resnet_weight):
self.sess = sess
self.dataset_name = dataset_name
self.result_dir ... | flexible | {
"blob_id": "d3b00a8d410248aedb1c43354e89ccc298b56a3c",
"index": 7693,
"step-1": "<mask token>\n\n\nclass Skip_GAN(object):\n\n def __init__(self, sess, epoch, batch_size, dataset_name, result_dir,\n z_dim, y_dim, checkpoint_dir, num_resblock, Cycle_lr, Class_weight,\n Resnet_weight):\n s... | [
2,
3,
4,
5,
6
] |
<|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": "ec39dae7217ddc48b1ab5163d234542cb36c1d48",
"index": 5351,
"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 = [('Store', '00... | [
0,
1,
2,
3,
4
] |
import sys
import os
sys.path.append("C:/Users/Laptop/Documents/Repos/udacity_stats_functions/descriptive")
import normal_distribution_06
#import sampling_distributions_07
def lower_upper_confidence_intervals(avg, SD):
#avg is x bar. The mean value at the "would be" point. ie Bieber Tweeter
#SD is standard err... | normal | {
"blob_id": "d423b0bc6cd9ea9795317750141ad5f5eab01636",
"index": 1886,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef lower_upper_confidence_intervals(avg, SD):\n lower = avg - 2 * SD\n upper = avg + 2 * SD\n return lower, upper\n\n\n<mask token>\n",
"step-3": "<mask token>\nsys.path.a... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class GoalCategory(NestedSet):
nsm_parent_field = 'parent_goal_category'
def on_update(self):
self.validate_name_with_goal()
super(GoalCategory, self).on_update()
self.validate_one_root()
def validate_name_with_goal(self):
if frappe.db.exists(... | flexible | {
"blob_id": "c6055c6b67ac28d304ed34ddc2f81e59da8e7f1b",
"index": 1103,
"step-1": "<mask token>\n\n\nclass GoalCategory(NestedSet):\n nsm_parent_field = 'parent_goal_category'\n\n def on_update(self):\n self.validate_name_with_goal()\n super(GoalCategory, self).on_update()\n self.valida... | [
4,
5,
6,
7,
8
] |
from django.shortcuts import render
from django.http import HttpResponse
from chats.models import Chat
from usuario.models import Usuario
# Create your views here.
def chat(request):
chat_list = Chat.objects.order_by("id_chat")
chat_dict = {'chat': chat_list}
return render(request,'chats/Chat.html', ... | normal | {
"blob_id": "4a14265a9a2338be66e31110bba696e224b6a70f",
"index": 8395,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef chat(request):\n chat_list = Chat.objects.order_by('id_chat')\n chat_dict = {'chat': chat_list}\n return render(request, 'chats/Chat.html', context=chat_dict)\n",
"step... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def test_answer():
import sys
answer1 = None
answer2 = None
answer3 = None
try:
answer1 = fizz_buzz(3, 5, 16)
answer2 = fizz_buzz(2, 7, 20)
answer3 = fizz_buzz(100)
except:
... | flexible | {
"blob_id": "d00873c3ee72b55cb5b74f78a98de61a25b3cc21",
"index": 7227,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_answer():\n import sys\n answer1 = None\n answer2 = None\n answer3 = None\n try:\n answer1 = fizz_buzz(3, 5, 16)\n answer2 = fizz_buzz(2, 7, 20)\... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def incr_reads(request, book_id):
if request.POST:
try:
readers = Book.objects.get(id=book_id).incr_reads()
return HttpResponse(readers)
except Book.DoesNotExist:
pass
return HttpResponse('FAILED')
def index(request):
"""
... | flexible | {
"blob_id": "bcbcb4ea3a3b8b5c11e9b107103418ae79a3921c",
"index": 3628,
"step-1": "<mask token>\n\n\ndef incr_reads(request, book_id):\n if request.POST:\n try:\n readers = Book.objects.get(id=book_id).incr_reads()\n return HttpResponse(readers)\n except Book.DoesNotExist:\n... | [
2,
3,
4,
5,
6
] |
from sklearn.datasets import fetch_mldata
from sklearn.preprocessing import OneHotEncoder
from sklearn.model_selection import train_test_split
import numpy as np
import os
import tarfile
import pickle
import subprocess
import sys
if sys.version_info.major == 2:
# Backward compatibility with python 2.
from six.... | normal | {
"blob_id": "6eec95932ef445ba588f200233495f59c4d77aac",
"index": 5396,
"step-1": "<mask token>\n\n\ndef get_gpu_name():\n try:\n out_str = subprocess.run(['nvidia-smi', '--query-gpu=gpu_name',\n '--format=csv'], stdout=subprocess.PIPE).stdout\n out_list = out_str.decode('utf-8').split... | [
5,
6,
7,
8,
11
] |
array = [1, 2, 3, 4, 5]
for x in array:
print(x)
| normal | {
"blob_id": "224e13331ad93278f47a5582bbd24208d9ce5dcc",
"index": 3705,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor x in array:\n print(x)\n",
"step-3": "array = [1, 2, 3, 4, 5]\nfor x in array:\n print(x)\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
<|reserved_special_token_0|>
class Cluster(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Cluster(object):
<|reserved_special_token_0|>
def __init__(self, cluster_json):
"""
Initialize the cluster... | flexible | {
"blob_id": "753c87a3d22aeca1001eb770831b846b175d873e",
"index": 9139,
"step-1": "<mask token>\n\n\nclass Cluster(object):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Cluster(object):\n <mask token>\n\n def __init__(self, cluster_json):\n \"\"\"\n Initialize t... | [
1,
2,
3,
4
] |
import io
import os
from setuptools import setup
setup(name='testcov-plugin',
version='1.0',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={
'plugins': ['testp = testcov.plugin:testp'],
},
description="Test for coverage bug")
| normal | {
"blob_id": "88f5aa56eca6b61ba2b428bff0efdf4ec7f5f5d9",
"index": 1913,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsetup(name='testcov-plugin', version='1.0', packages=['testcov'],\n namespace_packages=['testcov'], entry_points={'plugins': [\n 'testp = testcov.plugin:testp']}, description='Test ... | [
0,
1,
2,
3
] |
########################################################################################################################
# DEVELOPER README: #
# This is the main script, where the GUI is initialised from. All of the main ... | normal | {
"blob_id": "cc58e3944ee2bfb55cc2867395782a94c196e635",
"index": 6784,
"step-1": "########################################################################################################################\n# DEVELOPER README: ... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print('Hello! What is your name?')
<|reserved_special_token_0|>
print('Well, ' + myName + ', I am thinking of a number between 1 and 20.')
while guesses_taken < 6:
print('Take a guess.')
guess = input()
guess = int(gue... | flexible | {
"blob_id": "3302dc058032d9fe412bde6fd89699203526a72d",
"index": 4695,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Hello! What is your name?')\n<mask token>\nprint('Well, ' + myName + ', I am thinking of a number between 1 and 20.')\nwhile guesses_taken < 6:\n print('Take a guess.')\n gue... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
"""
@author: chris
Modified from THOMAS MCTAVISH (2010-11-04).
mpiexec -f ~/machinefile -enable-x -n 96 python Population.py --noplot
"""
from __future__ import with_statement
from __future__ import division
import sys
sys.path.append('../NET/sheff/weasel/')
sys.path.append('../NET/sheffprk/... | normal | {
"blob_id": "06ea697989f8f9ac539559690dcfd7aa73151e0f",
"index": 2700,
"step-1": "# -*- coding: utf-8 -*-\n\"\"\"\n@author: chris\n\nModified from THOMAS MCTAVISH (2010-11-04).\n\nmpiexec -f ~/machinefile -enable-x -n 96 python Population.py --noplot\n\"\"\"\n\nfrom __future__ import with_statement\nfrom __futur... | [
0
] |
# -*- coding: utf-8 -*-
elements = str(input("Type the elements of list: ")).split()
elements = list(map(float,elements))
times = int(input("How many times you wish shift to right: "))
for _ in range(times):
removed = elements.pop()
elements.insert(0,removed)
print(elements) | normal | {
"blob_id": "307bb7461a729ba979f6a862fe7c292c42f96ce6",
"index": 1164,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor _ in range(times):\n removed = elements.pop()\n elements.insert(0, removed)\nprint(elements)\n",
"step-3": "elements = str(input('Type the elements of list: ')).split()\neleme... | [
0,
1,
2,
3
] |
import numpy as np
from scipy.stats import loguniform
import sys
def generate_parameters(seed):
np.random.seed(seed)
out={}
out['nfeatures'] = np.random.randint(3, 25)
out['lr'] = float(loguniform.rvs(0.001, 0.01, size=1))
out['gamma'] = np.random.uniform(0.75, 0.05)
out['penalty'] = float(logu... | normal | {
"blob_id": "7571e86be1077ae0f7ae542824cfcaaa2949dc83",
"index": 8731,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef generate_parameters(seed):\n np.random.seed(seed)\n out = {}\n out['nfeatures'] = np.random.randint(3, 25)\n out['lr'] = float(loguniform.rvs(0.001, 0.01, size=1))\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class TestSchedule(RunbotCase):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class TestSchedule(RunbotCase):
<|reserved_special_token_0|>
@patch('odoo.addons.runbot.models.build.os.path.getmtime')... | flexible | {
"blob_id": "aa515b1b919eb557cd8c7e5f4d22773980b5af96",
"index": 8213,
"step-1": "<mask token>\n\n\nclass TestSchedule(RunbotCase):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass TestSchedule(RunbotCase):\n <mask token>\n\n @patch('odoo.addons.runbot.models.build.os.path.getmt... | [
1,
2,
3,
4,
5
] |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Yuan
import time
import sys
def jindutiao(jindu,zonge):
ret = (jindu/zonge)*100
r = "\r%s%d%%"%("="*jindu,ret)
sys.stdout.write(r)
sys.stdout.flush()
if __name__ =="__main__":
for i in range(101):
time.sleep(0.1)
jindutia... | normal | {
"blob_id": "f7afd08fb8316e44c314d17ef382b98dde7eef91",
"index": 1605,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef jindutiao(jindu, zonge):\n ret = jindu / zonge * 100\n r = '\\r%s%d%%' % ('=' * jindu, ret)\n sys.stdout.write(r)\n sys.stdout.flush()\n\n\n<mask token>\n",
"step-3"... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class total_land_value_if_in_plan_type_group_SSS(Variable):
<|reserved_special_token_0|>
def __init__(self, group):
self.group = group
Variable.__init__(self)
def dependencies(self):
return [my_attribute_label('is_in_plan_type_group_%s' % self.group),... | flexible | {
"blob_id": "52bb10e19c7a5645ca3cf91705b9b0affe75f570",
"index": 4764,
"step-1": "<mask token>\n\n\nclass total_land_value_if_in_plan_type_group_SSS(Variable):\n <mask token>\n\n def __init__(self, group):\n self.group = group\n Variable.__init__(self)\n\n def dependencies(self):\n ... | [
6,
7,
9,
10,
11
] |
<|reserved_special_token_0|>
class Session(Destroyable):
def __init__(self, physical_device, queue_index=None):
super(Session, self).__init__()
self.instance = lava.instance()
if physical_device not in lava.devices():
raise RuntimeError('Provided invalid / outdated device obje... | flexible | {
"blob_id": "193dcf7bd658f88afe0a1f2fa28605f262e45bc2",
"index": 1554,
"step-1": "<mask token>\n\n\nclass Session(Destroyable):\n\n def __init__(self, physical_device, queue_index=None):\n super(Session, self).__init__()\n self.instance = lava.instance()\n if physical_device not in lava.d... | [
5,
6,
7,
8,
9
] |
#!/usr/bin/env python3
"""Transfer learning with xception"""
import tensorflow.keras as K
from GPyOpt.methods import BayesianOptimization
import pickle
import os
import numpy as np
class my_model():
"""A model bassed on xception"""
def make_model(self, param):
"""makes the model"""
self.lr = ... | normal | {
"blob_id": "d015a1b27a3a9e7f5e6614da752137064000b905",
"index": 239,
"step-1": "<mask token>\n\n\nclass my_model:\n <mask token>\n\n def make_model(self, param):\n \"\"\"makes the model\"\"\"\n self.lr = param[0][0]\n dr = param[0][1]\n layer_units0 = param[0][2]\n layer... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(dir(math))
<|reserved_special_token_1|>
import math
print(dir(math))
<|reserved_special_token_1|>
import math
print(dir(math))
# Prints a list of entities residing in the math module | flexible | {
"blob_id": "94056e8920d265831da67bd1d999330a47a7ef0d",
"index": 1991,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(dir(math))\n",
"step-3": "import math\nprint(dir(math))\n",
"step-4": "import math\nprint(dir(math))\n\n# Prints a list of entities residing in the math module",
"step-5": nul... | [
0,
1,
2,
3
] |
# coding=UTF-8
"""
View for managing accounts
"""
from django.contrib import messages
from django.http import Http404, HttpResponse
from django.shortcuts import redirect
from django import forms
from athena.core import render_to_response
from athena.users.models import User
from athena.users import must_be_admin
def... | normal | {
"blob_id": "a01ca49c3fa8ea76de2880c1b04bf15ccd341edd",
"index": 924,
"step-1": "<mask token>\n\n\ndef klist(**kwargs):\n kwargs.update({'teachers': [x for x in User.objects.filter(status=1) if\n not x.is_demo()], 'admins': User.objects.filter(status=2)})\n return kwargs\n\n\n<mask token>\n\n\n@must... | [
3,
6,
7,
8,
10
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
router.register('post', PostViewSet)
router.register('post_upvote', UpvoteView)
router.register('comment', CommentViewSet)
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
router = SimpleRo... | flexible | {
"blob_id": "db309283137383cd698f235e7326c6e5c50f6cf3",
"index": 6671,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nrouter.register('post', PostViewSet)\nrouter.register('post_upvote', UpvoteView)\nrouter.register('comment', CommentViewSet)\n<mask token>\n",
"step-3": "<mask token>\nrouter = SimpleRo... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def main():
if len(sys.argv) < 2:
print('usage: sqlite_file ...')
sys.exit()
db_filenames = sys.argv[1:]
num_of_dbs = len(db_filenames)
conn = sqlite3.connect(':memory:')
c = conn.cursor()
... | flexible | {
"blob_id": "b24ce9ed2df11df4cbf47949915685c09ec7543a",
"index": 7070,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n if len(sys.argv) < 2:\n print('usage: sqlite_file ...')\n sys.exit()\n db_filenames = sys.argv[1:]\n num_of_dbs = len(db_filenames)\n conn = sq... | [
0,
1,
2,
3,
4
] |
import pytest
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import extract_tables_columns
def test_get_tables():
sql_str = "SELECT * FROM table1, table2 WHERE table1.column1 = table2.column1;"
assert(extract_tables_columns.get_tables(sql_str)) == [('TA... | normal | {
"blob_id": "72286078841c7fe5b297767576741dbbd0a80411",
"index": 3457,
"step-1": "<mask token>\n\n\ndef test_get_tables():\n sql_str = (\n 'SELECT * FROM table1, table2 WHERE table1.column1 = table2.column1;')\n assert extract_tables_columns.get_tables(sql_str) == [('TABLE1',\n 'TABLE1'), ('T... | [
3,
4,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class User(AbstractNamedUser):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class User(AbstractNamedUser):
USERNAME_FIELD = 'email'
REQU... | flexible | {
"blob_id": "e7d7a002547047a9bcae830be96dd35db80a86e8",
"index": 7001,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass User(AbstractNamedUser):\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass User(AbstractNamedUser):\n USERNAME_FIELD = 'email'\n REQUIRED_FIELDS... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
cnn.add(Convolution2D(32, 3, 3, input_shape=(rgb, rgb, 3), activation='relu'))
cnn.add(MaxPool2D(pool_size=(2, 2)))
cnn.add(Flatten())
cnn.add(Dense(output_dim=128, activation='relu'))
cnn.add(Dense(output_dim=1, activation='sigmo... | flexible | {
"blob_id": "9fa5f4b4aeb7fe42d313a0ec4e57ce15acbfcf46",
"index": 3960,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ncnn.add(Convolution2D(32, 3, 3, input_shape=(rgb, rgb, 3), activation='relu'))\ncnn.add(MaxPool2D(pool_size=(2, 2)))\ncnn.add(Flatten())\ncnn.add(Dense(output_dim=128, activation='relu'))... | [
0,
1,
2,
3,
4
] |
from yoloPydarknet import pydarknetYOLO
import cv2
import imutils
import time
yolo = pydarknetYOLO(obdata="../darknet/cfg/coco.data", weights="yolov3.weights",
cfg="../darknet/cfg/yolov3.cfg")
video_out = "yolo_output.avi"
start_time = time.time()
if __name__ == "__main__":
VIDEO_IN = cv2.VideoCapture(0)
... | normal | {
"blob_id": "669eb2e898c3a127ae01e0ee3020a3674e5e340d",
"index": 1091,
"step-1": "from yoloPydarknet import pydarknetYOLO\nimport cv2\nimport imutils\nimport time\n\nyolo = pydarknetYOLO(obdata=\"../darknet/cfg/coco.data\", weights=\"yolov3.weights\", \n cfg=\"../darknet/cfg/yolov3.cfg\")\nvideo_out = \"yolo_... | [
0
] |
__author__ = 'sudab'
""" Generate a grid world """
import os, sys, getopt, pdb, string
import random
import numpy as np
import pygame
from skimage import io
import cv2
import pygame.locals as pgl
class Gridworld():
# a gridworld with uneven terrain
def __init__(self, filename=None, initial=0, nrows=8, ncols=8,... | normal | {
"blob_id": "1fbd4e45b061b4d6cefb46e3bc612533ec94250b",
"index": 481,
"step-1": "__author__ = 'sudab'\n\"\"\" Generate a grid world \"\"\"\nimport os, sys, getopt, pdb, string\nimport random\nimport numpy as np\nimport pygame\nfrom skimage import io\nimport cv2\nimport pygame.locals as pgl\n\nclass Gridworld():\... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
setup(name='coding_exercises', version='1.0', description=
'Coding Exercises in Python', author='Gustavo Gama', author_email=
'gustavo.gama@gmail.com', url='https://gama.igenesis.com.br', packages=
find_packages())
<... | flexible | {
"blob_id": "5f4abc7e9397034737ee214b0d0aae39ebf1548b",
"index": 8098,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsetup(name='coding_exercises', version='1.0', description=\n 'Coding Exercises in Python', author='Gustavo Gama', author_email=\n 'gustavo.gama@gmail.com', url='https://gama.igenesi... | [
0,
1,
2,
3
] |
# Basic script which send some request via rest api to the test-management-tool.
# Be sure you setup host and api_token variable
import http.client
host = "localhost:8000"
api_token = "fuukp8LhdxxwoVdtJu5K8LQtpTods8ddLMq66wSUFXGsqJKpmJAa1YyqkHN3"
# Connection
conn = http.client.HTTPConnection(host)
# Create a heade... | normal | {
"blob_id": "0cc1aaa182fcf002ff2ae6cbcd6cbb84a08a3bc1",
"index": 936,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nconn.request('POST', '/api/v1/testsuites', payload, headers)\n<mask token>\nconn.request('POST', '/api/v1/testsuites', payload, headers)\n<mask token>\nconn.request('POST', '/api/v1/testca... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
app_name = 'blogs'
urlpatterns = [path('', views.index, name='index'), re_path(
'^blogs/(?P<blog_id>\\d+)/$', views.blog, name='blog'), path(
'new_blog/', views.new_blog, name='new_blog'), re_path(
'^edit_blog/(?P<blog... | flexible | {
"blob_id": "d73491d6673abdabad85176c5f75a191995c806d",
"index": 1260,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napp_name = 'blogs'\nurlpatterns = [path('', views.index, name='index'), re_path(\n '^blogs/(?P<blog_id>\\\\d+)/$', views.blog, name='blog'), path(\n 'new_blog/', views.new_blog, nam... | [
0,
1,
2,
3
] |
from django.conf.urls import url
from . import views
from .HouseView import CreateHouseView
app_name = 'voronoi'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^search/$', views.search, name='search'),
url(r'^house/create/$', CreateHouseView.as_view(), name='create'),
#url(r'^get_search... | normal | {
"blob_id": "e3ee00efa0e929b87ca33b79dc6a6064b8758d4a",
"index": 2640,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napp_name = 'voronoi'\nurlpatterns = [url('^$', views.index, name='index'), url('^search/$', views\n .search, name='search'), url('^house/create/$', CreateHouseView.as_view\n (), nam... | [
0,
1,
2,
3
] |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.web_perf.metrics import timeline_based_metric
from telemetry.web_perf.metrics.trace_event_stats import TraceEventStats
from telemetry.web_per... | normal | {
"blob_id": "47f88bc3836490e08f464f71351096b54118420e",
"index": 5297,
"step-1": "<mask token>\n\n\nclass IndexedDBTimelineMetric(timeline_based_metric.TimelineBasedMetric):\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass IndexedDBTimelineMetric(timeline_based_metri... | [
1,
3,
4,
5,
6
] |
####################################
## Readable code versus less code ##
####################################
import threading
from web_server.general_api import general_api as api
logger = api.__get_logger('ConnTimeout.run')
class ConnTimeout(object):
def __init__(self, timeout, function, servers=5, args=[], ... | normal | {
"blob_id": "ed5ba72443b70c84941af3d112e0246cb3ae97d9",
"index": 5337,
"step-1": "<mask token>\n\n\nclass ConnTimeout(object):\n\n def __init__(self, timeout, function, servers=5, args=[], kwargs=[]):\n self.timeout = timeout\n self.timer = None\n self.count = 0\n self.f = function... | [
5,
6,
7,
8,
11
] |
from data_loaders.data_module import ChestDataModule
from utils.visualisation import showInRow
from models import get_model
from transforms.finetuning import ChestTrainTransforms, ChestValTransforms
from models.baseline import BaseLineClassifier
from pytorch_lightning.loggers import WandbLogger
from pytorch_lightnin... | normal | {
"blob_id": "05ca7bbc3285a9e37921c0e514a2e31b05abe051",
"index": 6396,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nseed_everything(12345)\n<mask token>\nif torch.cuda.is_available():\n classifier = classifier.cuda()\ntrainer.fit(classifier, dm)\n",
"step-3": "<mask token>\nseed_everything(12345)\... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class DataViewsetRegistryTest(TestCase):
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class DataViewsetRegistryTest(TestCase):
def test_register_data_model(self) ->None:
registry = DataViewsetRegistry()
registry.regis... | flexible | {
"blob_id": "14cc048f517efd3dad9960f35fff66a78f68fb45",
"index": 8975,
"step-1": "<mask token>\n\n\nclass DataViewsetRegistryTest(TestCase):\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass DataViewsetRegistryTest(TestCase):\n\n def test_register_data_model(self) ->None:\n registry = DataView... | [
1,
2,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
parser.add_argument('-pred_path', type=str, required=True)
parser.add_argument('-n_list_path', type=str, required=True)
parser.add_argument('-refer_path', type=str, required=True)
<|reserved_special_token_0|>
with open(args.pred_p... | flexible | {
"blob_id": "4437075901751adeaf3df63345e270a9b0090c14",
"index": 1918,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nparser.add_argument('-pred_path', type=str, required=True)\nparser.add_argument('-n_list_path', type=str, required=True)\nparser.add_argument('-refer_path', type=str, required=True)\n<mas... | [
0,
1,
2,
3,
4
] |
# Compute grid scores using the new dataset format
import matplotlib
import os
# allow code to work on machines without a display or in a screen session
display = os.environ.get('DISPLAY')
if display is None or 'localhost' in display:
matplotlib.use('agg')
import argparse
import numpy as np
import torch
import to... | normal | {
"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
] |
import math
def upsample1(d, p):
# 普通结界
assert 1 <= p <= 10
return d + p
def upsample2(d, p):
# 倍增结界
assert 2 <= p <= 3
return d * p
def downsample(d, p):
# 聚集结界
assert 2 <= p <= 10
return math.ceil(d / p)
# 初始化杀伤力范围
lethal_radius = 1
# 结界参数(z, p)
config = [(1, 6),
... | normal | {
"blob_id": "cb6f68c8b8a6cead1d9fcd25fa2a4e60f7a8fb28",
"index": 9746,
"step-1": "<mask token>\n\n\ndef upsample1(d, p):\n assert 1 <= p <= 10\n return d + p\n\n\ndef upsample2(d, p):\n assert 2 <= p <= 3\n return d * p\n\n\ndef downsample(d, p):\n assert 2 <= p <= 10\n return math.ceil(d / p)\... | [
3,
4,
5,
6,
7
] |
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Dense, Flatten, Conv2D, BatchNormalization, LeakyReLU, Reshape, Conv2DTranspose
import tensorflow_hub as hub
from collections import Counter
import numpy as np
import sys
sys.path.append('../data')
from imageio import imwri... | normal | {
"blob_id": "919239391c6f74d0d8627d3b851beb374eb11d25",
"index": 4785,
"step-1": "<mask token>\n\n\nclass DeepFont(tf.keras.Model):\n\n def __init__(self):\n super(DeepFont, self).__init__()\n self.batch_size = 128\n self.model = tf.keras.Sequential()\n self.model.add(tf.keras.laye... | [
10,
11,
12,
13,
14
] |
'''
@Description:
@Version: 1.0
@Autor: Henggao
@Date: 2020-02-20 16:17:05
@LastEditors: Henggao
@LastEditTime: 2020-02-20 16:32:45
'''
name = "henggao"
def change():
name = "Brill"
print(name)
print(locals())
print(globals())
change()
print(name) | normal | {
"blob_id": "6c7162a9bd81d618abda204c24031c5a5acc61b4",
"index": 7967,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef change():\n name = 'Brill'\n print(name)\n print(locals())\n print(globals())\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef change():\n name = 'Brill'\n ... | [
0,
1,
2,
3,
4
] |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from django.core.urlresolvers import reverse
from google_product_feeder.feed import CSVMerchantFeed, MERCHANT_FEED_COLUMNS
CSV_HEADINGS = ','.join(MERCHANT_FEED_COLUMNS) + '\r\n'
class AttrNameF... | normal | {
"blob_id": "924fd89a835528fa28e1226912a2e4be9c4e1d5d",
"index": 152,
"step-1": "<mask token>\n\n\nclass UppercaseBrandFeed(CSVMerchantFeed):\n\n def get_brand(self, obj):\n return obj.brand.upper()\n\n\nclass CSVMerchantFeedTest(TestCase):\n\n def test_csv_empty(self):\n feed = CSVMerchantFe... | [
10,
13,
14,
16,
17
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
def sumSubarrayMins(self, A: List[int]) ->int:
stack = []
prev = [None] * len(A)
for i in range(len(A)):
while stack and ... | flexible | {
"blob_id": "97029ac9f05037bf9304dacf86c35f5534d887c4",
"index": 8303,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def sumSubarrayMins(self, A: List[int]) ->int:\n stack = []\n prev = [None] * len(A)\n for i in range(len(... | [
0,
1,
2
] |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 29 20:33:32 2013
@author: ste
"""
#Convert input file for graph from adjacency list version, where each line is
#vertex adjacent adjacent adjacent ...
#to edge representation where each line is
#tail head
edges=[]
with open("/Users/ste/Desktop/Ste/Python/AlgorithmsCours... | normal | {
"blob_id": "1b7b94a0331e2462f83f4f77bcfaefbeefdf24f4",
"index": 3754,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('/Users/ste/Desktop/Ste/Python/AlgorithmsCourse/KargerMinCut.txt'\n ) as v_list_file:\n for line in v_list_file:\n node = map(int, line.split())\n for adjace... | [
0,
1,
2,
3
] |
#recapitulare polimorfism
class Caine:
def sunet(self):
print("ham ham")
class Pisica:
def sunet(self):
print("miau")
def asculta_sunet(tipul_animalului):# astapta obiect tipul animalului
tipul_animalului.sunet()#
CaineObj=Caine()#dau obiect
PisicaObj=Pisica()
asculta_sunet(Cain... | normal | {
"blob_id": "594fdec916520014faff80dd06c7a5553320664d",
"index": 4746,
"step-1": "class Caine:\n <mask token>\n\n\nclass Pisica:\n\n def sunet(self):\n print('miau')\n\n\n<mask token>\n",
"step-2": "class Caine:\n\n def sunet(self):\n print('ham ham')\n\n\nclass Pisica:\n\n def sunet(... | [
3,
5,
6,
7,
8
] |
from rest_framework import serializers
from api.models.Phones import Phones
class PhoneSerializer(serializers.ModelSerializer):
class Meta:
model = Phones
fields = (
'id', 'number', 'area_code', 'country_code'
)
| normal | {
"blob_id": "e3ba6395a8d7272fc7e5a8be37e6b0b18c355e14",
"index": 9272,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass PhoneSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = Phones\n fields = 'id', 'number', 'area_code', 'country_code'\n",
"step-3": "from re... | [
0,
1,
2,
3
] |
#! /usr/bin/env python
import ldac
from numpy import *
import shearprofile as sp
import sys
import os, subprocess
import pylab
if len(sys.argv) != 6:
sys.stderr.write("wrong number of arguments!\n")
sys.exit(1)
catfile= sys.argv[1]
clusterz=float(sys.argv[2])
center= map(float,sys.argv[3].split(','))
pixsc... | normal | {
"blob_id": "f19d8aa2104240cc93a0146f1b14c635e7cd3a41",
"index": 268,
"step-1": "#! /usr/bin/env python\n\nimport ldac\nfrom numpy import *\nimport shearprofile as sp\nimport sys\nimport os, subprocess\n\nimport pylab\n\n\nif len(sys.argv) != 6:\n sys.stderr.write(\"wrong number of arguments!\\n\")\n sys.e... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def main():
simulation = Simulation(particle_count=50, dt=0.016, box_width=250)
FluidRenderer(simulation.box_width, 800, simulation)
arcade.run()
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reser... | flexible | {
"blob_id": "83733e707a1be131335c4980cdf4beed365eb530",
"index": 6011,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n simulation = Simulation(particle_count=50, dt=0.016, box_width=250)\n FluidRenderer(simulation.box_width, 800, simulation)\n arcade.run()\n\n\n<mask token>\n",
... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def unit_circle_points(num_samples):
a = 2 * pi / num_samples
return [vec2(cos(a * i), sin(a * i)) for i in range(num_samples)]
def calculate_circle_deviation(spline):
ideal_d = 1.0
center_x = 0.0
center_y = 0.0
deviation = 0.0
for p in spline.control_points:... | flexible | {
"blob_id": "35e61add90b5c12f94d5f8071f00d98316461dd6",
"index": 8497,
"step-1": "<mask token>\n\n\ndef unit_circle_points(num_samples):\n a = 2 * pi / num_samples\n return [vec2(cos(a * i), sin(a * i)) for i in range(num_samples)]\n\n\ndef calculate_circle_deviation(spline):\n ideal_d = 1.0\n center... | [
2,
3,
4,
5,
6
] |
import h5py
import sys
f = h5py.File(sys.argv[1], 'r+')
try:
del f['optimizer_weights']
except:
print "done"
f.close() | normal | {
"blob_id": "3458e1efdc492a08d8272469aa9e3f0ca72c7ba3",
"index": 9146,
"step-1": "import h5py\nimport sys\nf = h5py.File(sys.argv[1], 'r+')\ntry:\n\tdel f['optimizer_weights']\nexcept:\n\tprint \"done\"\nf.close()",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]... | [
0
] |
"""
Read a real number. If it is positive print it's square root, if it's not print the square of it.
"""
import math
print('Insert a number')
num1 = float(input())
if num1 > 0:
print(f'The square root of {num1} is {math.sqrt(num1)}')
else:
print(f'The square of {num1} is {num1**2}')
| normal | {
"blob_id": "a68d682ba6d441b9d7fb69ec1ee318a0ef65ed40",
"index": 3146,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Insert a number')\n<mask token>\nif num1 > 0:\n print(f'The square root of {num1} is {math.sqrt(num1)}')\nelse:\n print(f'The square of {num1} is {num1 ** 2}')\n",
"step-3"... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class GCI:
def banner():
print('[---- OSINT By FajarTheGGman ----]\n')
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class GCI:
def banner():
print('[---- OSINT By FajarTheGGman ----... | flexible | {
"blob_id": "6c8180d24110045348d9c2041c0cca26fa9ea2d2",
"index": 4318,
"step-1": "<mask token>\n\n\nclass GCI:\n\n def banner():\n print('[---- OSINT By FajarTheGGman ----]\\n')\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass GCI:\n\n def banner():\n print('[---- ... | [
2,
4,
5,
6,
7
] |
# -*- coding: utf-8 -*-
"""
@Author: xiezizhe
@Date: 5/7/2020 下午8:52
"""
from typing import List
class KMP:
def partial(self, pattern):
""" Calculate partial match table: String -> [Int]"""
ret = [0]
for i in range(1, len(pattern)):
j = ret[i - 1]
while j > 0 and... | normal | {
"blob_id": "57de9a46dfbf33b117c2dfbb534a5020e019d520",
"index": 8513,
"step-1": "<mask token>\n\n\nclass Trie:\n\n def __init__(self):\n self.dicts = dict()\n\n def add(self, word):\n node = self.dicts\n for w in word:\n if w not in node:\n node[w] = dict()\n... | [
5,
7,
8,
10,
12
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(titanic.head())
<|reserved_special_token_0|>
x['age'].fillna(x['age'].mean(), inplace=True)
x.fillna('UNKNOWN', inplace=True)
<|reserved_special_token_0|>
dtc.fit(x_train, y_train)
print(dtc.score(x_test, y_test))
<|reserved... | flexible | {
"blob_id": "f1475d651c3b52611657a9767ad62796b55d8711",
"index": 3676,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(titanic.head())\n<mask token>\nx['age'].fillna(x['age'].mean(), inplace=True)\nx.fillna('UNKNOWN', inplace=True)\n<mask token>\ndtc.fit(x_train, y_train)\nprint(dtc.score(x_test, y_... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class System(ORMBase):
<|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 add_component(self, component):
for system_componen... | flexible | {
"blob_id": "2fc2fd6631cee5f3737dadaac1a115c045af0986",
"index": 5058,
"step-1": "<mask token>\n\n\nclass System(ORMBase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def add_component(self, component):\n for system_component in self.s... | [
3,
4,
5,
6,
8
] |
import tests.functions as functions
if __name__ == "__main__":
# functions.validate_all_redirects("linked.data.gov.au-vocabularies.json")
conf = open("../conf/linked.data.gov.au-vocabularies.conf")
new = [
"anzsrc-for",
"anzsrc-seo",
"ausplots-cv",
"australian-phone-area... | normal | {
"blob_id": "4a620957b2cd1e5945d98e49a5eae5d5592ef5a2",
"index": 3911,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n conf = open('../conf/linked.data.gov.au-vocabularies.conf')\n new = ['anzsrc-for', 'anzsrc-seo', 'ausplots-cv',\n 'australian-phone-area-codes', ... | [
0,
1,
2,
3
] |
from utils import to_device
from utils import build_dictionary,my_collate
from DataGenerator import DataGenerator
from torch.utils.data import DataLoader
from torch import optim
import torch.nn as nn
from ADSentimentModel import ADSentimentModel
import torch
def train(token2id, train_data, lr, batch_size, epochs,model... | normal | {
"blob_id": "d0364b7cad29c639af9df5c78e810144ffd6ce2e",
"index": 2415,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef train(token2id, train_data, lr, batch_size, epochs, model):\n dataset = DataGenerator(token2id, train_data)\n dataloader = DataLoader(dataset, batch_size=batch_size, collate... | [
0,
1,
2,
3,
4
] |
# Kai Joseph
# Loop Practice
# Since I worked on my own, I did not have to complete all 25 challenges (with Ms. Healey's permission). I completed a total of 14 challenges.
import sys
import random
''' 1.
Write a for loop that will print out all the integers from 0-4 in ascending order.
'''
if sys.argv[1] == '... | normal | {
"blob_id": "eda8bde048f3d4c4af4bd1c296e4cc02b92eaa17",
"index": 4727,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif sys.argv[1] == '1':\n for x in range(5):\n print(str(x))\n<mask token>\nif sys.argv[1] == '2':\n for x in range(5):\n print(str(4 - x))\n<mask token>\nif sys.argv[1... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
dependencies = [(... | flexible | {
"blob_id": "cdaceb2d8804e08f0b35b9b65f2d06695efad002",
"index": 6470,
"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 = [('details', '... | [
0,
1,
2,
3,
4
] |
# Generated by Django 3.1.3 on 2020-11-19 06:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myems', '0004_auto_20201118_1446'),
]
operations = [
migrations.RenameField(
model_name='dg',
old_name='sn',
... | normal | {
"blob_id": "11d96a8a400afb0861b92d8900e003826614c99a",
"index": 7502,
"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 = [('myems', '00... | [
0,
1,
2,
3,
4
] |
zi=["L","Ma","Mi","J","Vi","S","D"]
V=[]
for i in range(0,len(zi)):
x=input("dati salariul de: {} ".format(zi[i]))
V.append(int(x))
print("Salariul in fiecare zi: {}".format(V))
print(sum(V))
print(round(sum(V)/7,2))
print(max(V))
vMax=[]
vMin=[]
for i in range(0,len(zi)):
if V[i]==max(V):
... | normal | {
"blob_id": "6c91114e0c32628b64734000c82354105032b2fd",
"index": 7954,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(0, len(zi)):\n x = input('dati salariul de: {} '.format(zi[i]))\n V.append(int(x))\nprint('Salariul in fiecare zi: {}'.format(V))\nprint(sum(V))\nprint(round(sum(V) /... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in cctv['구분']:
gu_list.append(gu_dict_num[i])
<|reserved_special_token_0|>
cctv.drop(['구분'], axis=1, inplace=True)
<|reserved_special_token_0|>
print(new_data.info())
new_data.to_csv('./dataset/train_add_cctv.csv', heade... | flexible | {
"blob_id": "ea2e9399a8384600d8457a9de3f263db44dc883d",
"index": 752,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in cctv['구분']:\n gu_list.append(gu_dict_num[i])\n<mask token>\ncctv.drop(['구분'], axis=1, inplace=True)\n<mask token>\nprint(new_data.info())\nnew_data.to_csv('./dataset/train_add_... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 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 ... | normal | {
"blob_id": "8dab85622a29bc40f8ad6150f9e6f284853aeaf8",
"index": 4235,
"step-1": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License... | [
0
] |
# -*- coding: utf-8 -*-
import os
from flask import Flask, request,render_template,url_for
from flask_uploads import UploadSet, configure_uploads, IMAGES, patch_request_class
import sys
sys.path.insert(1, 'script')
from backend import model
import io
from PIL import Image
import base64
import numpy as np
app = Fla... | normal | {
"blob_id": "93d0d73d56b04bba505265958fccff229f5eaf49",
"index": 872,
"step-1": "<mask token>\n\n\n@app.route('/', methods=['GET', 'POST'])\ndef upload_file():\n if request.method == 'POST' and 'photo' in request.files:\n filename = photos.save(request.files['photo'])\n file_url = photos.url(fil... | [
1,
2,
3,
4,
5
] |
from RestClient4py.client import RestClient
from API_Wrap import util
import os
import json
kakao_native_app_key, kakao_rest_api_key, kakao_javascript_key, kakao_admin_key = util.kakao_auth()
client = RestClient()
client.set_header("Authorization", "KakaoAK {}".format(kakao_rest_api_key))
client.set_header("Accept", ... | normal | {
"blob_id": "7f58179efecd5a0d691a5c6d83b808f2cd2fcba3",
"index": 5332,
"step-1": "<mask token>\n\n\ndef translation(query, src_lang, target_lang):\n if type(query) != str:\n raise AttributeError('[ERROR] query parameter should be string type')\n elif len(query) > 5000:\n raise AttributeError(... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while True:
_, frame = video_capture.read()
frame = cv2.medianBlur(frame, 3)
frame = cv2.filter2D(frame, -1, MASK)
_, frame = cv2.threshold(frame, 10, 255, cv2.THRESH_BINARY_INV)
streamer.update_frame(frame)
... | flexible | {
"blob_id": "a19b4928c9423dae6c60f39dbc5af0673b433c8e",
"index": 3551,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile True:\n _, frame = video_capture.read()\n frame = cv2.medianBlur(frame, 3)\n frame = cv2.filter2D(frame, -1, MASK)\n _, frame = cv2.threshold(frame, 10, 255, cv2.THRESH_... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for line in ratings_dat:
arr = line.split('::')
new_line = '\t'.join(arr)
ratings_csv.write(new_line)
ratings_dat.close()
ratings_csv.close()
<|reserved_special_token_1|>
ratings_dat = open('../data/movielens-1m/use... | flexible | {
"blob_id": "2dd59681a0dcb5d3f1143385100c09c7783babf4",
"index": 76,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor line in ratings_dat:\n arr = line.split('::')\n new_line = '\\t'.join(arr)\n ratings_csv.write(new_line)\nratings_dat.close()\nratings_csv.close()\n",
"step-3": "ratings_dat ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
dependencies = [(... | flexible | {
"blob_id": "bf3b529f8f06619c94d2dfca283df086466af4ea",
"index": 5027,
"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', '0002... | [
0,
1,
2,
3,
4
] |
import webbrowser
import time
total = 3
count = 0
while count < total:
webbrowser.open('https://www.youtube.com/watch?v=GoSBNNgf_Vc')
time.sleep(5 * 60 * 60)
count += 1
| normal | {
"blob_id": "e11a04cad967ae377449aab8b12bfde23e403335",
"index": 8391,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile count < total:\n webbrowser.open('https://www.youtube.com/watch?v=GoSBNNgf_Vc')\n time.sleep(5 * 60 * 60)\n count += 1\n",
"step-3": "<mask token>\ntotal = 3\ncount = 0\n... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def task5(arr):
for row in arr:
moneyGranted[int(row[1]) - 2015][int(row[3]) - 1] += int(row[4])
moneyRequested[int(row[1]) - 2015][int(row[3]) - 1] += int(row[5])
for i in range(6):
for j in range(5):
if moneyRequested[i][j] == 0:
... | flexible | {
"blob_id": "e7b2e716fbcaf761e119003000bf1b16af57a2b7",
"index": 7009,
"step-1": "<mask token>\n\n\ndef task5(arr):\n for row in arr:\n moneyGranted[int(row[1]) - 2015][int(row[3]) - 1] += int(row[4])\n moneyRequested[int(row[1]) - 2015][int(row[3]) - 1] += int(row[5])\n for i in range(6):\n ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class GameObject(pygame.sprite.Sprite):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class Food(gameobject.GameObject):
def __init__(self, x, y, surface, time=rando... | flexible | {
"blob_id": "c589ce4ba2ae60d14787a8939146f6140fff1f01",
"index": 7914,
"step-1": "<mask token>\n\n\nclass GameObject(pygame.sprite.Sprite):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n\n\nclass Food(gameobject.GameObject):\n\n def __init__(self, x, y, surface, ti... | [
5,
7,
8,
10,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if USE_MEMMAP:
Xmm = np.memmap('X.mmap', dtype=X.dtype, mode='w+', shape=X.shape)
ymm = np.memmap('y.mmap', dtype=y.dtype, mode='w+', shape=y.shape)
np.copyto(Xmm, X)
np.copyto(ymm, y)
del data
del X
de... | flexible | {
"blob_id": "e2682a5cab95914e7567431cb04c3fb542eda3bf",
"index": 4353,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif USE_MEMMAP:\n Xmm = np.memmap('X.mmap', dtype=X.dtype, mode='w+', shape=X.shape)\n ymm = np.memmap('y.mmap', dtype=y.dtype, mode='w+', shape=y.shape)\n np.copyto(Xmm, X)\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def sampling(args):
"""Reparameterization trick by sampling fr an isotropic unit Gaussian.
# Arguments
args (tensor): mean and log of variance of Q(z|X)
# Returns
z (tensor): sampled latent vector
"""
z_mean, z_log_var = args
batch = K.shape(z_mean)... | flexible | {
"blob_id": "88343b9c5cac3510e8cea75ac5b11f517ddc164b",
"index": 5943,
"step-1": "<mask token>\n\n\ndef sampling(args):\n \"\"\"Reparameterization trick by sampling fr an isotropic unit Gaussian.\n # Arguments\n args (tensor): mean and log of variance of Q(z|X)\n # Returns\n z (tensor): sa... | [
2,
3,
4,
5,
6
] |
# Based on https://dev.to/jemaloqiu/design-pattern-in-python-2-observer-j4
class AbstractObservable():
"""
Abstract Observable
"""
def __init__(self):
self.__observers = []
def add_observer(self, observer):
self.__observers.append(observer)
def remove_observer(self, obse... | normal | {
"blob_id": "3b3f423cfb08413a4135646ea4d3d6dcb5d0cc10",
"index": 662,
"step-1": "<mask token>\n\n\nclass MonitorTruck(AbstractObservable):\n \"\"\"\n Concrete Observable class\n \"\"\"\n\n def __init__(self, name):\n super().__init__()\n self.name = name\n self.__physical_pro... | [
13,
21,
23,
25,
26
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def seq(ctn, array, l):
if sorted(check) in array:
return
for i in range(n):
l += 1
check.append(arr[i])
seq(ctn + 1, array, l)
check.pop()
print('l :', l, ' i :', i)
<|reser... | flexible | {
"blob_id": "dc5d56d65417dd8061a018a2f07132b03e2d616e",
"index": 5127,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef seq(ctn, array, l):\n if sorted(check) in array:\n return\n for i in range(n):\n l += 1\n check.append(arr[i])\n seq(ctn + 1, array, l)\n ... | [
0,
1,
2,
3,
4
] |
"""
Example 1:
Input: J = "aA", S = "aAAbbbb"
Output: 3
Example 2:
Input: J = "z", S = "ZZ"
Output: 0
Note:
S and J will consist of letters and have length at most 50.
The characters in J are distinct.
查找J中的每个字符在 S 出现的次数的总和。
改进:
J有可能有重复的数。
测试数据:
https://leetcode.com/problems/jewels-and-stones/description/
"""
c... | normal | {
"blob_id": "8a04447f12a9cb6ba31a21d43629d887a0d1f411",
"index": 3097,
"step-1": "\"\"\"\nExample 1:\n\nInput: J = \"aA\", S = \"aAAbbbb\"\nOutput: 3\nExample 2:\n\nInput: J = \"z\", S = \"ZZ\"\nOutput: 0\nNote:\n\nS and J will consist of letters and have length at most 50.\nThe characters in J are distinct.\n\n... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
np.random.seed(0)
<|reserved_special_token_0|>
z < 3
z[z < 3]
<|reserved_special_token_0|>
a + b
a + 30
<|reserved_special_token_0|>
print(a)
a.shape()
a.ndim()
a[0, 2]
a[0, :]
a[:, 1]
np.min(a)
np.zeros(5)
np.zeros_like([[10, 10]... | flexible | {
"blob_id": "be5147efda879165107378527ebf44890c03be75",
"index": 6679,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nnp.random.seed(0)\n<mask token>\nz < 3\nz[z < 3]\n<mask token>\na + b\na + 30\n<mask token>\nprint(a)\na.shape()\na.ndim()\na[0, 2]\na[0, :]\na[:, 1]\nnp.min(a)\nnp.zeros(5)\nnp.zeros_lik... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class Related(models.Model):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class AbstractModel(models.Model):
bases = ProxyGenericRelation(Base, content_type_field='content_type',
object_id_field='content_id')
class Meta:
abstract = True
c... | flexible | {
"blob_id": "c70df1fab0db6f71d22a23836b11d66879879656",
"index": 6336,
"step-1": "<mask token>\n\n\nclass Related(models.Model):\n <mask token>\n <mask token>\n\n\nclass AbstractModel(models.Model):\n bases = ProxyGenericRelation(Base, content_type_field='content_type',\n object_id_field='content... | [
6,
7,
8,
9,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def parse_args():
"""
Parse command-line arguments to train and evaluate a multimodal network for activity recognition on MM-Fit.
:return: Populated namespace.
"""
parser = argparse.ArgumentParser(description... | flexible | {
"blob_id": "b6527a09f346ee1b7dd446a0ff21995a995481a8",
"index": 6640,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef parse_args():\n \"\"\"\n Parse command-line arguments to train and evaluate a multimodal network for activity recognition on MM-Fit.\n :return: Populated namespace.\n ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
dependencies = [(... | flexible | {
"blob_id": "32c28c7a1e1572744387b509fc6a448554ed565e",
"index": 3445,
"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 = [('user', '000... | [
0,
1,
2,
3,
4
] |
class Solution:
def eventualSafeNodes(self, graph: List[List[int]]) ->List[int]:
res = []
d = {}
def dfs(node):
if graph[node] == []:
return True
if node in d:
return d[node]
if node in visit:
return False
... | normal | {
"blob_id": "b815f72e2cad351fd9411361a0e7cc75d39ae826",
"index": 9270,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def eventualSafeNodes(self, graph: List[List[int]]) ->List[int]:\n res = []\n d = {}\n\n def dfs(node):\n ... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in range(n):
peeps = set(list(map(int, input().split()))[1:])
villagers[i + 1] = villagers.get(i + 1, set())
for p in peeps:
if i + 1 in peeps:
susList.add(i + 1)
break
vil... | flexible | {
"blob_id": "3eca3066a6c6484257ca17164d35654812a87b80",
"index": 6636,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(n):\n peeps = set(list(map(int, input().split()))[1:])\n villagers[i + 1] = villagers.get(i + 1, set())\n for p in peeps:\n if i + 1 in peeps:\n ... | [
0,
1,
2,
3
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.