code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
import os
from enum import Enum
STAFF_CODE = os.getenv('STAFF_CODE', '20190607')
ADMIN_CODE = os.getenv('ADMIN_CODE', 'nerd-bear')
TEAM_NAMES = (
'밍크고래팀',
'혹등고래팀',
'대왕고래팀',
'향유고래팀',
)
TEAM_COUNT = 3
MAX_TEAM_MEMBER_COUNT = 10
class TIME_CHECK(Enum):
BEFORE_START = 0
DURING_TIME = 1
AFTER... | normal | {
"blob_id": "967984444d9e26452226b13f33c5afbc96b5fe2b",
"index": 3176,
"step-1": "<mask token>\n\n\nclass TIME_CHECK(Enum):\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass TIME_CHECK(Enum):\n BEFORE_START = 0\n DURING_TIME = 1\n AFTER_END = 2\n",
"step-3"... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(version)
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
API_URL = 'https://meta.decidim.org/api'
decidim_connector = DecidimConnector(API_URL)
version_reader = VersionReader(decidim... | flexible | {
"blob_id": "88a469eba61fb6968db8cc5e1f93f12093b7f128",
"index": 6973,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(version)\n<mask token>\n",
"step-3": "<mask token>\nAPI_URL = 'https://meta.decidim.org/api'\ndecidim_connector = DecidimConnector(API_URL)\nversion_reader = VersionReader(decidim... | [
0,
1,
2,
3,
4
] |
""" Tests for challenge116 """
import pytest
from robber import expect
from pemjh.challenge116 import main
@pytest.mark.parametrize('input, expected',
[
pytest.param(5, 12, marks=pytest.mark.example),
pytest.param(50, 20492570... | normal | {
"blob_id": "c9279434736d4e94564170fe98163ad3be9470b1",
"index": 4844,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@pytest.mark.parametrize('input, expected', [pytest.param(5, 12, marks=\n pytest.mark.example), pytest.param(50, 20492570929, marks=pytest.mark.\n regression)])\ndef test_challe... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class VGGNet(object):
def __init__(self, checkpoint_name='VGGNet'):
self.config = {'image_shape': [256, 256, 3], 'input_shape': [224,
224, 3], 'output_shape': [17], 'batch_size': 60, 'trn_steps':
680, 'trn_nb_epochs': 200, 'trn_transform': True,
... | flexible | {
"blob_id": "c6a4d566460a06504abf7e2c54be4f2ea36e01fb",
"index": 7735,
"step-1": "<mask token>\n\n\nclass VGGNet(object):\n\n def __init__(self, checkpoint_name='VGGNet'):\n self.config = {'image_shape': [256, 256, 3], 'input_shape': [224, \n 224, 3], 'output_shape': [17], 'batch_size': 60, ... | [
7,
8,
9,
10,
11
] |
<|reserved_special_token_0|>
def double_factorial(n):
k = 1
for i in range(n, 1, -2):
k *= i
return k
<|reserved_special_token_0|>
def gaussian_integral(alpha, m):
if int(m / 2) * 2 == m:
n = int(m / 2)
value = double_factorial(2 * n - 1) * sqrt(pi) / pow(2, n + 1) / pow(
... | flexible | {
"blob_id": "005650e2747c61b730960a29891b6ba6c8bd381b",
"index": 1334,
"step-1": "<mask token>\n\n\ndef double_factorial(n):\n k = 1\n for i in range(n, 1, -2):\n k *= i\n return k\n\n\n<mask token>\n\n\ndef gaussian_integral(alpha, m):\n if int(m / 2) * 2 == m:\n n = int(m / 2)\n ... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
def boyhook(dic):
print('test')
if dic['name']:
return dic['name'], dic['age']
return dic
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def boyhook(dic):
print('test')
if dic['name']:
return dic['name'], d... | flexible | {
"blob_id": "2bc5711839ccbe525551b60211d8cd79ddb7775a",
"index": 7019,
"step-1": "<mask token>\n\n\ndef boyhook(dic):\n print('test')\n if dic['name']:\n return dic['name'], dic['age']\n return dic\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef boyhook(dic):\n print('test')\n if d... | [
1,
2,
3,
4,
5
] |
import pandas as pd
file = pd.read_csv("KDDTest+.csv")
with open("test_9feats.csv", "w") as f:
df = pd.DataFrame(file,
columns=[
"dst_host_srv_serror_rate", "dst_host_serror_rate",
"serror_rate", "srv_serror_rate", "count", "flag",
... | normal | {
"blob_id": "ce28330db66dcdfad63bdac698ce9d285964d288",
"index": 5124,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('test_9feats.csv', 'w') as f:\n df = pd.DataFrame(file, columns=['dst_host_srv_serror_rate',\n 'dst_host_serror_rate', 'serror_rate', 'srv_serror_rate', 'count',\n ... | [
0,
1,
2,
3,
4
] |
class RankedHand(object):
def __init__(self, remaining_cards):
self._remaining_cards = remaining_cards
self.rank = None
def remaining_cards(self):
return self._remaining_cards
# Returns 1 if self is higher, 0 if equal, -1 if self is lower
def compare_high_cards(self, other):
s_cards = reversed... | normal | {
"blob_id": "a0d1ef11d00e2ddd65b648a87f493b7adcda5115",
"index": 9412,
"step-1": "<mask token>\n\n\nclass TwoPair(RankedHand):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass ThreeKind(RankedHand):\n\n def __init__(self, three_kind_rank):\n self.rank... | [
25,
28,
42,
43,
45
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
@pytest.fixture(scope='module')
def base_app(tmp_shared_volume_path):
"""Flask application fixture."""
config_mapping = {'SERVER_NAME': 'localhost:5000', 'SECRET_KEY':
'SECRET_KEY', 'TESTING': True, 'SHARED_VOLUM... | flexible | {
"blob_id": "502e92d3e5d059d73016702ce0b2591a123810d3",
"index": 6892,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@pytest.fixture(scope='module')\ndef base_app(tmp_shared_volume_path):\n \"\"\"Flask application fixture.\"\"\"\n config_mapping = {'SERVER_NAME': 'localhost:5000', 'SECRET_KEY'... | [
0,
1,
2,
3
] |
#14681
#점의 좌표를 입력받아 그 점이 어느 사분면에 속하는지 알아내는 프로그램을 작성하시오. 단, x좌표와 y좌표는 모두 양수나 음수라고 가정한다.
x = int(input())
y = int(input())
if(x>0 and y>0):
print("1")
elif(x>0 and y<0):
print("4")
elif(x<0 and y>0):
print("2")
else:
print("3")
| normal | {
"blob_id": "e9908e32204da8973f06d98430fc660c90b5e303",
"index": 3987,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif x > 0 and y > 0:\n print('1')\nelif x > 0 and y < 0:\n print('4')\nelif x < 0 and y > 0:\n print('2')\nelse:\n print('3')\n",
"step-3": "x = int(input())\ny = int(input()... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class SubBatchNorm3d(nn.Module):
<|reserved_special_token_0|>
def __init__(self, num_splits, **args):
"""
Args:
num_splits (int): number of splits.
args (list): other arguments.
"""
super(SubBatchNorm3d, self).__init__()
... | flexible | {
"blob_id": "4e5e1be289b32655736d8c6c02d354a85d4268b7",
"index": 3027,
"step-1": "<mask token>\n\n\nclass SubBatchNorm3d(nn.Module):\n <mask token>\n\n def __init__(self, num_splits, **args):\n \"\"\"\n Args:\n num_splits (int): number of splits.\n args (list): other arg... | [
5,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def two_sum(nums, target):
dct = {}
for i, num1 in enumerate(nums):
num2 = target - num1
if num2 in dct:
return [dct[num2], i]
dct[num1] = i
<|reserved_special_token_0|>
<|reserved... | flexible | {
"blob_id": "dac8dbb0eba78d4f8dfbe3284325735324a87dc2",
"index": 8674,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef two_sum(nums, target):\n dct = {}\n for i, num1 in enumerate(nums):\n num2 = target - num1\n if num2 in dct:\n return [dct[num2], i]\n dct[nu... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class Table(Base):
<|reserved_special_token_0|>
def __init__(self, dataset_id, table_id, **kwargs):
super().__init__(**kwargs)
self.table_id = table_id.replace('-', '_')
self.dataset_id = dataset_id.replace('-', '_')
self.dataset_folder = Path(self... | flexible | {
"blob_id": "da218e6d9ee311eefb8e9ae4dac5053793eb5514",
"index": 9369,
"step-1": "<mask token>\n\n\nclass Table(Base):\n <mask token>\n\n def __init__(self, dataset_id, table_id, **kwargs):\n super().__init__(**kwargs)\n self.table_id = table_id.replace('-', '_')\n self.dataset_id = da... | [
8,
12,
15,
16,
20
] |
import datetime
with open('D:\Documents\PythonDocs\ehmatthes-pcc-f555082\chapter_10\programming.txt') as f_obj:
lines = f_obj.readlines()
m_lines = []
for line in lines:
m_line = line.replace('python', 'C#')
m_lines.append(m_line)
with open('D:\Documents\PythonDocs\ehmatthes-pcc-f555082\chapter_10\prog... | normal | {
"blob_id": "03da813650d56e7ab92885b698d4af3a51176903",
"index": 3878,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open(\n 'D:\\\\Documents\\\\PythonDocs\\\\ehmatthes-pcc-f555082\\\\chapter_10\\\\programming.txt'\n ) as f_obj:\n lines = f_obj.readlines()\n<mask token>\nfor line in lines:... | [
0,
1,
2,
3,
4
] |
"""empty message
Revision ID: 42cf7f6532dd
Revises: e6d4ac8564fb
Create Date: 2019-04-01 16:13:37.207305
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '42cf7f6532dd'
down_revision = 'e6d4ac8564fb'
branch_labels = None
depends_on = None
def upgrade():
# ... | normal | {
"blob_id": "42d9f40dd50056b1c258508a6cb3f9875680276a",
"index": 3393,
"step-1": "<mask token>\n\n\ndef downgrade():\n op.drop_column('stakeholder', 'archived')\n",
"step-2": "<mask token>\n\n\ndef upgrade():\n op.add_column('stakeholder', sa.Column('archived', sa.Boolean(),\n nullable=False, defa... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def forward_selected(data, response):
"""Linear model designed by forward selection.
Parameters:
-----------
data : pandas DataFrame with all possible predictors and response
response: string, name of respo... | flexible | {
"blob_id": "a903f9c5cae1c2eb2f40dc8ba29f0625a3d34224",
"index": 9690,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef forward_selected(data, response):\n \"\"\"Linear model designed by forward selection.\n\n Parameters:\n -----------\n data : pandas DataFrame with all possible predict... | [
0,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def single_gpu_inference(sample, gpu):
raw_path = (
'/groups/saalfeld/home/papec/Work/neurodata_hdd/cremi_warped/sample%s_inference.n5'
% sample)
model_path = (
'/groups/saalfeld/home/papec/Work/... | flexible | {
"blob_id": "5ca990bdcbe9378747e438015beb46760b1e987b",
"index": 7212,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef single_gpu_inference(sample, gpu):\n raw_path = (\n '/groups/saalfeld/home/papec/Work/neurodata_hdd/cremi_warped/sample%s_inference.n5'\n % sample)\n model_pa... | [
0,
1,
2,
3,
4
] |
import unittest
import achemkit.properties_wnx
class TestDummy(unittest.TestCase):
pass
| normal | {
"blob_id": "5f0e6f6dc645996b486f1292fe05229a7fae9b17",
"index": 2342,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass TestDummy(unittest.TestCase):\n pass\n",
"step-3": "import unittest\nimport achemkit.properties_wnx\n\n\nclass TestDummy(unittest.TestCase):\n pass\n",
"step-4": null,... | [
0,
1,
2
] |
<|reserved_special_token_0|>
def rest_api(mode=None):
""""""
values = config.read()
wt_url = Text(value=values['api']['url'], placeholder='Add URL',
description='API URL:', disabled=False)
wt_user = Text(value=values['api']['user'], placeholder='Username',
description='API User:', disa... | flexible | {
"blob_id": "22afc6b9df87ef1eba284da20a807366278c24d4",
"index": 1343,
"step-1": "<mask token>\n\n\ndef rest_api(mode=None):\n \"\"\"\"\"\"\n values = config.read()\n wt_url = Text(value=values['api']['url'], placeholder='Add URL',\n description='API URL:', disabled=False)\n wt_user = Text(val... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
log = logging.getLogger(__name__)
dir_path = os.path.dirname(os.path.realpath(__file__))
TEST_FILE = os.path.join(dir_path, 'test_gene_map_table.tsv.gz')
<|reserved_special_token_1|>
<|reserved_special_token_0|>
import logging
... | flexible | {
"blob_id": "bad719d968b4e358f863b7ef13bc12127f726806",
"index": 682,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nlog = logging.getLogger(__name__)\ndir_path = os.path.dirname(os.path.realpath(__file__))\nTEST_FILE = os.path.join(dir_path, 'test_gene_map_table.tsv.gz')\n",
"step-3": "<mask token>\ni... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def some_func():
CFG.start_clock_module = datetime.datetime.now()
LOG.write_me('\tSTART - CLEAN.py (' + datetime.datetime.now().strftime(
'%y-%m-%d | %H:%M') + ')')
my_root_dir = os.getcwd()
list_output_d... | flexible | {
"blob_id": "58667da8898c2277ecc3d9d738d6553dd3416436",
"index": 7323,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef some_func():\n CFG.start_clock_module = datetime.datetime.now()\n LOG.write_me('\\tSTART - CLEAN.py (' + datetime.datetime.now().strftime(\n '%y-%m-%d | %H:%M') + ')'... | [
0,
1,
2,
3,
4
] |
from flask import Flask, render_template, request
import matplotlib.pyplot as plt
import numpy as np
import sympy
from DerivTest import diff, diff2, trapz
from sympy.parsing.sympy_parser import parse_expr
from sympy import Symbol
#from ParsingClass import Parser
#from scitools.StringFunction import StringFunction
#from... | normal | {
"blob_id": "9dc8449bcc0c6c6ffb5ced5724ca632b6578bf1b",
"index": 9170,
"step-1": "<mask token>\n\n\ndef functionGraph(function, dVal1, dVal2, dVal3, dVal4, ftcVal1, ftcVal2):\n print('printing user input from functionGraph - ' + function)\n print(dVal1, dVal2, dVal3, dVal4)\n x1 = -5\n x2 = 5\n pr... | [
10,
13,
15,
16,
18
] |
# SPDX-License-Identifier: Apache-2.0
# Licensed to the Ed-Fi Alliance under one or more agreements.
# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
# See the LICENSE and NOTICES files in the project root for more information.
import json
from typing import Dict
from pandas import... | normal | {
"blob_id": "d6a760774b45454c959c2932d7b28deee7f81872",
"index": 318,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef submissions_to_user_submission_activities_dfs(submissions_df: DataFrame\n ) ->Dict[str, DataFrame]:\n \"\"\"\n Convert a Submission API DataFrame to a Dict of UserActivity... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class NVCComparator:
""" NVC response comparator. Performs the evaluation based on NVC and non-NVC classes.
"""
@staticmethod
def compare(obj_a, obj_b):
""" Compares two response objects based on their NVCness. Only returns true if both
responses are in a... | flexible | {
"blob_id": "9c935e9ef298484d565256a420b867e800c3df55",
"index": 3243,
"step-1": "<mask token>\n\n\nclass NVCComparator:\n \"\"\" NVC response comparator. Performs the evaluation based on NVC and non-NVC classes.\n\n \"\"\"\n\n @staticmethod\n def compare(obj_a, obj_b):\n \"\"\" Compares two r... | [
3,
6,
7,
10,
12
] |
import math
import random
import pygame
pygame.init()
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
clock = pygame.time.Clock()
pygame.display.set_caption('space invaders')
background = pygame.image.load('background.png')
score = 0
previous_score = 0
score... | normal | {
"blob_id": "f5dffa3c22bb35ed07cb5ca28f2ba02ea3c07dda",
"index": 1083,
"step-1": "<mask token>\n\n\ndef player(x, y):\n screen.blit(player_image, (x, y))\n\n\ndef fire_bullet(x, y, n):\n global bullet_fired\n bullet_fired[n] = True\n screen.blit(bullet_image, (x + 16, y + 10))\n\n\ndef add_bullet():\... | [
15,
16,
18,
19,
20
] |
from collections import Counter
N = int(input())
lst = list(map(int, input().split()))
ans = []
for i in range(N):
ans.append(abs(i + 1 - lst[i]))
s = Counter(ans)
rst = []
for i in s:
rst.append([i, s[i]])
rst.sort(key=lambda x: x[0], reverse=True)
for i in rst:
if i[1] > 1:
print(i[0], i[1])
| normal | {
"blob_id": "decd5d50025fc3b639be2f803d917ff313cf7219",
"index": 8838,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(N):\n ans.append(abs(i + 1 - lst[i]))\n<mask token>\nfor i in s:\n rst.append([i, s[i]])\nrst.sort(key=lambda x: x[0], reverse=True)\nfor i in rst:\n if i[1] > 1:\... | [
0,
1,
2,
3
] |
RANGES = {
# Intervalles de la gamme majeure
0: [1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1],
# Intervalles de la gamme mineure naturelle
1: [1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0],
# Intervalles de la gamme mineure harmonique
2: [1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1]
}
RANGES_NAMES = {
'fr': ['Maje... | normal | {
"blob_id": "18bad56ff6d230e63e83174672b8aa8625c1ebb4",
"index": 994,
"step-1": "\nRANGES = {\n # Intervalles de la gamme majeure\n 0: [1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1], \n # Intervalles de la gamme mineure naturelle\n 1: [1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0],\n # Intervalles de la gamme mineure... | [
0
] |
#!/usr/bin/python
"""
demo_mininet_topo.py
Sample topology class with Mininet.
G = {V, E}
V = {h1, h2, h3, h4, h51, h52, s0, s1, s4, s5}
# of hosts = 6
# of switches = 4
E = {
(h1, s1), (h2, s1), (h3, s1),
(h4, s4),
(h51, s5), (h52, s5),
(s0, s1), (s0, s4), (s5, s4)
}
"""
from mininet.topo import Top... | normal | {
"blob_id": "8c69813bc576a56c25c828fe24e2707e65ac0d0d",
"index": 5628,
"step-1": "<mask token>\n\n\nclass DemoTopology(Topo):\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass DemoTopology(Topo):\n\n def __init__(self):\n Topo.__init__(self)\n h1 = self.h1 = self.addHo... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class ChatRoomScreen(Screen):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def schedule_update_display_info(self, *args):
Clock.schedule_interval(self.update_display_info, 1)
<|reserved_special_token_0|>
<|reserved... | flexible | {
"blob_id": "327e9dcba49419b8a8c320940e333765c1d9b980",
"index": 5997,
"step-1": "<mask token>\n\n\nclass ChatRoomScreen(Screen):\n <mask token>\n <mask token>\n <mask token>\n\n def schedule_update_display_info(self, *args):\n Clock.schedule_interval(self.update_display_info, 1)\n <mask to... | [
7,
12,
17,
20,
22
] |
import face_recognition
from glob import glob
import os.path as osp
class FaceRecognitionLib(object):
"""
face_recognition library を利用した顔認証検証
"""
# クラス変数設定
__data_set_dir = './../../dataset/japanese' # データ・セットディレクトリ
__known_image_idx = (1,) # 既存画像のインデックス
... | normal | {
"blob_id": "2d69a39be3931aa4c62cadff4cdfad76f6b32c59",
"index": 6473,
"step-1": "<mask token>\n\n\nclass FaceRecognitionLib(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self):\n sub_dirs = glob(FaceRecognitionLib.__data_set_dir + '... | [
3,
4,
5,
8,
9
] |
from keras.preprocessing.text import text_to_word_sequence
import os
# keras NLP tools filter out certain tokens by default
# this function replaces the default with a smaller set of things to filter out
def filter_not_punctuation():
return '"#$%&()*+-/:;<=>@[\\]^_`{|}~\t\n'
def get_first_n_words(text, n):
... | normal | {
"blob_id": "365e2059d5ed3d7f8d9dbb4e44f563b79d68b087",
"index": 1856,
"step-1": "<mask token>\n\n\ndef get_labelled_data_from_directories(data_dir, maxlen=None):\n texts = []\n labels_index = {}\n labels = []\n for name in sorted(os.listdir(data_dir)):\n path = os.path.join(data_dir, name)\n ... | [
1,
2,
3,
4,
5
] |
import datetime
import time
import rfc822
from django.conf import settings
from urllib2 import Request, urlopen, URLError, HTTPError
from urllib import urlencode
import re
import string
try:
import django.utils.simplejson as json
except:
import json
from django.core.cache import cache
from tagging.models import T... | normal | {
"blob_id": "f720eaf1ea96ccc70730e8ba1513e1a2bb95d29d",
"index": 4842,
"step-1": "import datetime\nimport time\nimport rfc822\nfrom django.conf import settings\nfrom urllib2 import Request, urlopen, URLError, HTTPError\nfrom urllib import urlencode\nimport re \nimport string\ntry:\n import django.utils.simplejs... | [
0
] |
#!/usr/bin/env python
# Copyright (c) 2019, University of Stuttgart
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright
# notice and this permission notice appear in all copies.
#
# THE ... | normal | {
"blob_id": "007cce815f3ad4e47593ff00ff2e73d5d9961d9e",
"index": 3211,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(2):\n renderer.set_drawing_axis(i)\n renderer.draw_ws_obstacles()\n renderer.draw_ws_point(source, color='k', shape='o')\n renderer.background_matrix_eval = Fal... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def get_all_words():
words = []
with open('poem.txt') as poem:
for line in poem:
line = line.strip().split(' ')
for word in line:
if len(word) < 6:
words.append(word)
return words
def game(words):
while ... | flexible | {
"blob_id": "881d0c0808d8c0e656cdbf49450367553c100630",
"index": 2100,
"step-1": "<mask token>\n\n\ndef get_all_words():\n words = []\n with open('poem.txt') as poem:\n for line in poem:\n line = line.strip().split(' ')\n for word in line:\n if len(word) < 6:\n ... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
def lambda_handler(event, context):
if event['function'] == 'tasklist':
msg = tasklist(name)
if event['function'] == 'activity':
msg = activity(name)
return
<|reserved_special_token_0|>
def tasklist(name):
pjts = TDIAPI.state['projects']
items = TDI... | flexible | {
"blob_id": "3c3d45f0844496b8d623286b36a4935a154f410a",
"index": 4133,
"step-1": "<mask token>\n\n\ndef lambda_handler(event, context):\n if event['function'] == 'tasklist':\n msg = tasklist(name)\n if event['function'] == 'activity':\n msg = activity(name)\n return\n\n\n<mask token>\n\n\n... | [
3,
5,
6,
7,
8
] |
import pandas as pd
import numpy as np
import math
from sklearn.datasets import load_digits, load_iris, load_boston, load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.metrics import pairwise_distances
class KMeans():
def __init__(self, k = 5, max_iters = 100, random_seed = 42):... | normal | {
"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
] |
from Smooth import smoothing
def n_grams(unigramsFile, bigramsFile, parameterization, sentences):
words = []
param = []
unigrams = []
bigrams = []
with open(parameterization) as p: #Parametrization file
data = p.read().split()
word = data[0]
param.append(data[1])
pa... | normal | {
"blob_id": "87c200796e1fac508a43e899c0ed53878b8c1d88",
"index": 5244,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef n_grams(unigramsFile, bigramsFile, parameterization, sentences):\n words = []\n param = []\n unigrams = []\n bigrams = []\n with open(parameterization) as p:\n ... | [
0,
1,
2,
3
] |
# Goal: Let's Review
# Enter your code here. Read input from STDIN. Print output to STDOUT
T = int(input())
# Iterate through each inputted string
for i in range(T):
even = ''
odd = ''
s = str(input())
for i in range(len(s)):
if (i % 2 == 0):
even = even + s[i]
else:
... | normal | {
"blob_id": "f45313e4e8f3ecba0c7dc0288d9d5ec4e26f0ba6",
"index": 5284,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(T):\n even = ''\n odd = ''\n s = str(input())\n for i in range(len(s)):\n if i % 2 == 0:\n even = even + s[i]\n else:\n odd ... | [
0,
1,
2,
3
] |
from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
from django.dispatch import Signal
from djangochannelsrestframework.observer.base_observer import BaseObserver
class Observer(BaseObserver):
def __init__(self, func, signal: Signal = None, kwargs=None):
super().__init__(... | normal | {
"blob_id": "66e93295d2797ca9e08100a0a1f28619acb72aa4",
"index": 3397,
"step-1": "<mask token>\n\n\nclass Observer(BaseObserver):\n <mask token>\n\n def handle(self, signal, *args, **kwargs):\n message = self.serialize(signal, *args, **kwargs)\n channel_layer = get_channel_layer()\n fo... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def play_file(name, loop=0, time=0.0):
try:
file = 'data/audio/' + name
pygame.mixer.music.load(file)
pygame.mixer.music.play(loop, time)
except ZeroDivisionError:
print('AudioLoading: fai... | flexible | {
"blob_id": "98940c898d58917e652fe1514ea758768b048dbc",
"index": 9601,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef play_file(name, loop=0, time=0.0):\n try:\n file = 'data/audio/' + name\n pygame.mixer.music.load(file)\n pygame.mixer.music.play(loop, time)\n except Z... | [
0,
1,
2,
3
] |
import sys
import vector
import matrix
def convert_arg_to_list(arg):
try:
return [float(elem) for elem in arg]
except:
sys.exit("Invalid content inside {}".format(arg))
if __name__ == "__main__":
try:
vector1 = sys.argv[1].split(' ')
vector2 = sys.argv[2].split(' ')
exc... | normal | {
"blob_id": "347bfb2d8809b55046f698620a690099cc83fb56",
"index": 6433,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef convert_arg_to_list(arg):\n try:\n return [float(elem) for elem in arg]\n except:\n sys.exit('Invalid content inside {}'.format(arg))\n\n\n<mask token>\n",
"... | [
0,
1,
2,
3,
4
] |
"""API - Files endpoints."""
import os
import click
import cloudsmith_api
import requests
from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor
from .. import ratelimits
from ..rest import create_requests_session
from ..utils import calculate_file_md5
from .exceptions import ApiException, catch_rai... | normal | {
"blob_id": "ee03263d92372899ec1feaf3a8ea48677b053676",
"index": 6281,
"step-1": "<mask token>\n\n\ndef get_files_api():\n \"\"\"Get the files API client.\"\"\"\n return get_api_client(cloudsmith_api.FilesApi)\n\n\ndef validate_request_file_upload(owner, repo, filepath, md5_checksum=None):\n \"\"\"Valid... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
def fromTen():
global fin
fin = num
nnum = num
base = base2
if count == 1:
nnum = sum(milst) + sum(mdlst)
Ipart = int(nnum)
Dpart = Decimal(nnum - Ipart)
strDpart = str(Dpart)
Ilist = []
Dlist = []
print('digits before . (dot) is {} '.fo... | flexible | {
"blob_id": "9cf32e127664cb4c3290e665e35245acc936e064",
"index": 4090,
"step-1": "<mask token>\n\n\ndef fromTen():\n global fin\n fin = num\n nnum = num\n base = base2\n if count == 1:\n nnum = sum(milst) + sum(mdlst)\n Ipart = int(nnum)\n Dpart = Decimal(nnum - Ipart)\n strDpart =... | [
3,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
@app.task
def generate_static_index_html():
"""产生首页静态页面"""
types = GoodsType.objects.all()
goods_banners = IndexGoodsBanner.objects.all().order_by('index')
promotion_banners = IndexPromotionBanner.objects.all().order_by('index')
for type in types:
image_banners... | flexible | {
"blob_id": "7f7d087b7001cd7df01d4f22e056809be5a35568",
"index": 9584,
"step-1": "<mask token>\n\n\n@app.task\ndef generate_static_index_html():\n \"\"\"产生首页静态页面\"\"\"\n types = GoodsType.objects.all()\n goods_banners = IndexGoodsBanner.objects.all().order_by('index')\n promotion_banners = IndexPromo... | [
1,
2,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class QuoteListPagination(PageNumberPagination):
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class QuoteListPagination(PageNumberPagination):
page_size = 30
<|reserved_sp... | flexible | {
"blob_id": "4245da12eb7f9dd08c863e368efbd0bcf0b8fa04",
"index": 6816,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass QuoteListPagination(PageNumberPagination):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass QuoteListPagination(PageNumberPagination):\n page_size = 30\n",
"step-... | [
0,
1,
2,
3
] |
import itertools
def odds(upper_limit):
return [i for i in range(1,upper_limit,2)]
def evens(upper_limit):
return [i for i in range(0,upper_limit,2)]
nested = [i**j for i in range(1,10) for j in range(1,4)]
vowels = ['a', 'e', 'i', 'o', 'u']
consonants = [chr(i) for i in range(97,123) if chr(i) not in vowe... | normal | {
"blob_id": "a2e4e4a0c49c319df2adb073b11107d3f520aa6e",
"index": 1883,
"step-1": "<mask token>\n\n\ndef evens(upper_limit):\n return [i for i in range(0, upper_limit, 2)]\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef odds(upper_limit):\n return [i for i in range(1, upper_limit, 2)]\n\n\ndef even... | [
1,
3,
4,
5,
6
] |
#!/usr/bin/env python3
"""
Main chat API module
"""
import json
import os
import signal
import traceback
import tornado.escape
import tornado.gen
import tornado.httpserver
import tornado.ioloop
import tornado.locks
import tornado.web
from jsonschema.exceptions import ValidationError
from db import DB, DatabaseError
... | normal | {
"blob_id": "9f8d79d141d414c1256e39f58e59f97711acfee4",
"index": 4915,
"step-1": "<mask token>\n\n\nclass MainHandler(BaseHandler):\n <mask token>\n\n def get(self):\n \"\"\"Returns the root endpoint of the API.\"\"\"\n self.write(\n '{\"error\": \"cryptochat-server main page, plea... | [
17,
19,
22,
25,
31
] |
#!/usr/bin/python
import socket, os, datetime, time, re, sys
import numpy as np
import matplotlib.pyplot as plt
from baseband import vdif
import astropy.units as u
from scipy.signal import resample_poly
import matplotlib.patches as patches
def fbcmd(message):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM... | normal | {
"blob_id": "8eb08fa497ccf3ddc8f4d2b886c9e5a9bdb2e052",
"index": 8006,
"step-1": "<mask token>\n\n\ndef fbcmd(message):\n sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n sock.connect((ip, int(port)))\n sock.send(message.encode())\n if DEBUG:\n print('INFO: sent to ' + ip + ':' + por... | [
4,
5,
6,
7,
8
] |
# Generated by Django 3.0.8 on 2020-08-28 17:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shop', '0003_auto_20200828_1836'),
]
operations = [
migrations.AddField(
model_name='order',
name='total',
... | normal | {
"blob_id": "1f7d770106ea8e7d1c0bb90e1fc576b7ee2f0220",
"index": 381,
"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', '0003... | [
0,
1,
2,
3,
4
] |
import math as m
def calcula_elongacao(A, ϕ, ω, t):
x = A * m.cos(ϕ + ϕ * t )
return x | normal | {
"blob_id": "225687729b64f455bcc841e83105c7444efdfad3",
"index": 5545,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef calcula_elongacao(A, φ, ω, t):\n x = A * m.cos(φ + φ * t)\n return x\n",
"step-3": "import math as m\n\n\ndef calcula_elongacao(A, φ, ω, t):\n x = A * m.cos(φ + φ * t)\... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def load_files(training, testing):
tr_feat = np.genfromtxt(training, usecols=range(256), delimiter=',')
tr_feat /= 255.0
tr_feat = np.insert(tr_feat, 0, 0, axis=1)
tr_exp = np.genfromtxt(training, usecols=range(-1), delimiter=',')
tr_exp = tr_exp[:, -1]
te_feat = n... | flexible | {
"blob_id": "4af05a13264c249be69071447101d684ff97063e",
"index": 6725,
"step-1": "<mask token>\n\n\ndef load_files(training, testing):\n tr_feat = np.genfromtxt(training, usecols=range(256), delimiter=',')\n tr_feat /= 255.0\n tr_feat = np.insert(tr_feat, 0, 0, axis=1)\n tr_exp = np.genfromtxt(traini... | [
4,
5,
6,
7,
8
] |
import sys
max = sys.maxsize
print(" sys.maxsize -> ", max)
| normal | {
"blob_id": "c1c79e5adc620690e4e386f7f1cd9f781eeec0ce",
"index": 6843,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(' sys.maxsize -> ', max)\n",
"step-3": "<mask token>\nmax = sys.maxsize\nprint(' sys.maxsize -> ', max)\n",
"step-4": "import sys\nmax = sys.maxsize\nprint(' sys.maxsize -> ', m... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def return_major(Y):
label_count = {}
for i in Y:
label_count[i] = label_count.get(i, 0) + 1
sorted_class = sorted(label_count.items(), key=operator.itemgetter(1),
reverse=True)
return sorted_class[0][0]
def splitDataSet(X, fea, value):
y = []
tem... | flexible | {
"blob_id": "ff66b33a133b627ba2329434d6c1649c94b6ec78",
"index": 8188,
"step-1": "<mask token>\n\n\ndef return_major(Y):\n label_count = {}\n for i in Y:\n label_count[i] = label_count.get(i, 0) + 1\n sorted_class = sorted(label_count.items(), key=operator.itemgetter(1),\n reverse=True)\n ... | [
3,
4,
5,
6,
7
] |
import sys
def ler (t):
i =0
for s in sys.stdin:
l=s.split(" ")
t.append(l)
def melhor (t):
i=1
x=int(t[0][0].strip("\n"))
n=len(t)
while(i<n):
u=int((t[i][2]).strip())
if(u<x)
i+=1
def vendedor():
t=[]
ler(t)
melhor(t)
vendedor() | normal | {
"blob_id": "76664114382bdeb0bffb996e4dd4448b6c87520d",
"index": 9719,
"step-1": "import sys \n\ndef ler (t):\n\ti =0\n\tfor s in sys.stdin:\n\t\tl=s.split(\" \")\n\t\tt.append(l)\n\ndef melhor (t):\n\ti=1\n\tx=int(t[0][0].strip(\"\\n\"))\n\tn=len(t)\n\twhile(i<n):\n\t\tu=int((t[i][2]).strip())\n\t\tif(u<x)\n\t\... | [
0
] |
<|reserved_special_token_0|>
class TestNonMiscView:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def test_get_term_of_user(self, rf, db):
mommy.make('Use_Term', term='EULA Test', final_date=datetime.now(
pytz.UTC) + timedelta(days=1))
request = rf.get('/')
... | flexible | {
"blob_id": "8d6e4d06e390b4a45e576239189745c2e37217c5",
"index": 2699,
"step-1": "<mask token>\n\n\nclass TestNonMiscView:\n <mask token>\n <mask token>\n\n def test_get_term_of_user(self, rf, db):\n mommy.make('Use_Term', term='EULA Test', final_date=datetime.now(\n pytz.UTC) + timede... | [
5,
6,
7,
9,
10
] |
from .tacotron_v2_synthesizer import Tacotron2Synthesizer
| normal | {
"blob_id": "cf2fcd013c3e9992da36806ca93aacb4b5399396",
"index": 3172,
"step-1": "<mask token>\n",
"step-2": "from .tacotron_v2_synthesizer import Tacotron2Synthesizer\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
<|reserved_special_token_0|>
class OperationLog(MethodView):
decorators = [login_required, admin_required]
def get(self, page):
per_page = 10
count = UserOperation.query.count()
query = UserOperation.query.order_by(UserOperation.id.desc()).paginate(
page=page, per_page=per... | flexible | {
"blob_id": "1a561ca0268d084c8fdde5de65ce0c7e68154eec",
"index": 4993,
"step-1": "<mask token>\n\n\nclass OperationLog(MethodView):\n decorators = [login_required, admin_required]\n\n def get(self, page):\n per_page = 10\n count = UserOperation.query.count()\n query = UserOperation.que... | [
17,
24,
27,
37,
47
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
cv2.namedWindow('Measure Angle with centerline')
<|reserved_special_token_0|>
while True:
ret, frame = vidCapture.read()
if ret == True:
out.write(frame)
cv2.imshow('frame', frame)
if cv2.waitKey(1)... | flexible | {
"blob_id": "500d6f473f07b35bf2d075d3061ac2e54eab702a",
"index": 4156,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ncv2.namedWindow('Measure Angle with centerline')\n<mask token>\nwhile True:\n ret, frame = vidCapture.read()\n if ret == True:\n out.write(frame)\n cv2.imshow('frame',... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def get_prob_age(uids, prob_age) ->List[int]:
res = [0] * len(uids)
for i, uid in enumerate(uids):
res[i] = prob_age.setdefault(uid, 0)
return res
def get_grads_count(uids, grads_count) ->List[int]:
res = [0] * len(uids)
for i, uid in enumerate(uids):
... | flexible | {
"blob_id": "ee0ed255b6851696dc57c01100cd67f5f959cf01",
"index": 7437,
"step-1": "<mask token>\n\n\ndef get_prob_age(uids, prob_age) ->List[int]:\n res = [0] * len(uids)\n for i, uid in enumerate(uids):\n res[i] = prob_age.setdefault(uid, 0)\n return res\n\n\ndef get_grads_count(uids, grads_count... | [
5,
6,
7,
9,
10
] |
# i change it for change1
# change 1.py in master
i = 1
# fix bug for boss
| normal | {
"blob_id": "92f4f1c8a4e04b07ed7c05d5bb733c0b9c28bd05",
"index": 5325,
"step-1": "<mask token>\n",
"step-2": "i = 1\n",
"step-3": "# i change it for change1\n# change 1.py in master\ni = 1\n# fix bug for boss\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
#anand python problem 2:29
#Write a function array to create an 2-dimensional array. The function should take both dimensions as arguments. Value of each element can be initialized to None:
#
def array_imp(row,col):
res=[[None]*col for i in range(row) ]
return res
if __name__=='__main__':
outs=array_imp(2,3)
p... | normal | {
"blob_id": "b5835b676eb8ac814086f7482f172f48e2ad5a0a",
"index": 8189,
"step-1": "#anand python problem 2:29\n#Write a function array to create an 2-dimensional array. The function should take both dimensions as arguments. Value of each element can be initialized to None:\n#\n\ndef array_imp(row,col):\n\tres=[[N... | [
0
] |
import pandas as pd
import math
import json
import html
import bs4
import re
import dateparser
from bs4 import BeautifulSoup
from dataclasses import dataclass, field
from datetime import datetime
from typing import Any, List, Dict, ClassVar, Union
from urllib.parse import urlparse
from .markdown import MarkdownData, Ma... | normal | {
"blob_id": "4d0f612c74dc175766f489580fc4a492e1bfd085",
"index": 4345,
"step-1": "<mask token>\n\n\n@dataclass\nclass Actions:\n \"\"\" The class for a set of actions.\n\n This class is a collection of actions. It is used to for the four primary\n usecases:\n - to serialize the list of actions in... | [
10,
13,
19,
23,
25
] |
<|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": "fc9742ceb3c38a5f8c1ad1f030d76103ba0a7a81",
"index": 3857,
"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 = [('sms_consume... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class ItemEffect(AbstractItemEffect):
<|reserved_special_token_0|>
class BuffedByHealingWand(StatModifyingBuffEffect):
def __init__(self):
super().__init__(BUFF_TYPE, {HeroStat.HEALTH_REGEN: HEALTH_REGEN_BONUS}
)
<|reserved_special_token_0|>
<|reserved_s... | flexible | {
"blob_id": "61454a3d6b5b17bff871ededc6ddfe8384043884",
"index": 59,
"step-1": "<mask token>\n\n\nclass ItemEffect(AbstractItemEffect):\n <mask token>\n\n\nclass BuffedByHealingWand(StatModifyingBuffEffect):\n\n def __init__(self):\n super().__init__(BUFF_TYPE, {HeroStat.HEALTH_REGEN: HEALTH_REGEN_B... | [
3,
4,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
admin.site.register(Category, MPTTModelAdmin)
admin.site.register(Item)
admin.site.register(Product)
<|reserved_special_token_1|>
from django.contrib import admin
from mptt.admin import MPTTModelAdmin
from product.models import... | flexible | {
"blob_id": "fcd3e4c0d42649833e6c5ff6414c993654691d16",
"index": 188,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nadmin.site.register(Category, MPTTModelAdmin)\nadmin.site.register(Item)\nadmin.site.register(Product)\n",
"step-3": "from django.contrib import admin\nfrom mptt.admin import MPTTModelAd... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
path.append('D:/Github/astrophy-research/mylib')
path.append('D:/Github/astrophy-research/multi_shear_detect')
path.append('%s/work/mylib' % my_home)
<|reserved_special_token_0|>
if rank == 0:
nbytes = 2 * signal_num * itemsiz... | flexible | {
"blob_id": "1ffdc2845bc503c0a30407de444a152f8cc68d57",
"index": 1370,
"step-1": "<mask token>\n",
"step-2": "<mask token>\npath.append('D:/Github/astrophy-research/mylib')\npath.append('D:/Github/astrophy-research/multi_shear_detect')\npath.append('%s/work/mylib' % my_home)\n<mask token>\nif rank == 0:\n n... | [
0,
1,
2,
3,
4
] |
from datetime import datetime
import httplib2
from apiclient.discovery import build
from flask_login import UserMixin
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from oauth2client.client import OAuth2Credentials
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.types import... | normal | {
"blob_id": "866ec11f6fe13fb2283709128376080afc7493bf",
"index": 5040,
"step-1": "<mask token>\n\n\nclass User(db.Model, UserMixin):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __repr__(self):\n return '<User {}>'.format(self.email... | [
8,
10,
11,
13,
14
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(model.summary())
<|reserved_special_token_0|>
plt.plot(history.history['loss'])
plt.plot(history.history['val_loss'])
plt.title('MSE')
plt.legend(['Train', 'Test'], loc='upper right')
plt.show()
plt.plot(history.history['mea... | flexible | {
"blob_id": "011dd579bb076ec094e9e3085aa321883c484f1c",
"index": 5296,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(model.summary())\n<mask token>\nplt.plot(history.history['loss'])\nplt.plot(history.history['val_loss'])\nplt.title('MSE')\nplt.legend(['Train', 'Test'], loc='upper right')\nplt.sho... | [
0,
1,
2,
3,
4
] |
import json
import os
import uuid
from django.core.files.uploadedfile import SimpleUploadedFile
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from nautobot.dcim.models import Site
from nautobot.extras.choices import JobResultStatusChoices
from nautobot.extras.jobs import ... | normal | {
"blob_id": "d2298ad1e4737b983ba6d1f2fff59750137510b5",
"index": 904,
"step-1": "<mask token>\n\n\nclass JobTest(TestCase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def test_field_order(self):\n \"\"\"\n Job test with field order.\n \"\... | [
10,
15,
16,
17,
20
] |
# © MNELAB developers
#
# License: BSD (3-clause)
from .dependencies import have
from .syntax import PythonHighlighter
from .utils import count_locations, image_path, interface_style, natural_sort
| normal | {
"blob_id": "837534ebc953dae966154921709398ab2b2e0b33",
"index": 578,
"step-1": "<mask token>\n",
"step-2": "from .dependencies import have\nfrom .syntax import PythonHighlighter\nfrom .utils import count_locations, image_path, interface_style, natural_sort\n",
"step-3": "# © MNELAB developers\n#\n# License:... | [
0,
1,
2
] |
tej="votary"
for i in range(5):
print(tej[i])
| normal | {
"blob_id": "1f385fda1bdc0008ff91b935998c95c8ffcbd297",
"index": 2797,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(5):\n print(tej[i])\n",
"step-3": "tej = 'votary'\nfor i in range(5):\n print(tej[i])\n",
"step-4": "tej=\"votary\"\nfor i in range(5):\n\tprint(tej[i])\n",
"st... | [
0,
1,
2,
3
] |
from django import forms
class ListingForm(forms.Form):
text = forms.CharField(
max_length=50,
widget=forms.TextInput(
attrs={"class": "form-control", "placeholder": "Things to Buy"}
),
)
| normal | {
"blob_id": "3f23a50f44ba17c9b0241a4e3b0e939afeb1f5f0",
"index": 3092,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass ListingForm(forms.Form):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass ListingForm(forms.Form):\n text = forms.CharField(max_length=50, widget=forms.TextInput(at... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for x in data:
if x < min:
min = x
print(min)
<|reserved_special_token_1|>
data = [5, 6, 2, 8, 9, 1]
min = 10
for x in data:
if x < min:
min = x
print(min)
<|reserved_special_token_1|>
#딕셔너리로 데이터 표현
#... | flexible | {
"blob_id": "38bd18e9c1d17f25c10321ab561372eed58e8abc",
"index": 4243,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor x in data:\n if x < min:\n min = x\nprint(min)\n",
"step-3": "data = [5, 6, 2, 8, 9, 1]\nmin = 10\nfor x in data:\n if x < min:\n min = x\nprint(min)\n",
"step... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def parse_cave_details(details):
aliquotQuadrantID = Literal('NE') | Literal('SE') | Literal('SW'
) | Literal('NW')
aliquotQuadrantString = aliquotQuadrantID + Suppress('1/4')
aliquotHalfString = oneOf('N E S... | flexible | {
"blob_id": "1fc1d2e1a7d18b1ef8ee6396210afe47a63ab09f",
"index": 3267,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef parse_cave_details(details):\n aliquotQuadrantID = Literal('NE') | Literal('SE') | Literal('SW'\n ) | Literal('NW')\n aliquotQuadrantString = aliquotQuadrantID + Supp... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class LRU_Cache(object):
def __init__(self, capacity):
self.size = capacity
self.jar = OrderedDict()
pass
def get(self, key):
if key not in self.jar:
return -1
else:
rtn = self.jar.get(key)
self.jar.move... | flexible | {
"blob_id": "3c88e13e8796c5f39180a9a514f0528a074460a6",
"index": 2198,
"step-1": "<mask token>\n\n\nclass LRU_Cache(object):\n\n def __init__(self, capacity):\n self.size = capacity\n self.jar = OrderedDict()\n pass\n\n def get(self, key):\n if key not in self.jar:\n ... | [
6,
8,
10,
11,
12
] |
<|reserved_special_token_0|>
class ListContact(ListView):
model = Contact
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class AddContact(CreateView):
model = Contact
success_url = reverse_lazy('home')
class ListContact(ListView):
model = Contact
<|reserved_special_token_1|>
<|res... | flexible | {
"blob_id": "8a3694f96203ae8d1e306e1c9a5a47bfe26abeb1",
"index": 5178,
"step-1": "<mask token>\n\n\nclass ListContact(ListView):\n model = Contact\n",
"step-2": "<mask token>\n\n\nclass AddContact(CreateView):\n model = Contact\n success_url = reverse_lazy('home')\n\n\nclass ListContact(ListView):\n ... | [
2,
4,
5,
6,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
from .start_node import StartNode
from .character_appearance import CharacterAppearance
from .character_disappearance import CharacterDisappearance
from .replica import Replica
from .end_node import EndNode
from .choice import Choice
from .set_landscape impor... | flexible | {
"blob_id": "cd6e15daa2360ead47f0bac95843b1c030164996",
"index": 6879,
"step-1": "<mask token>\n",
"step-2": "from .start_node import StartNode\nfrom .character_appearance import CharacterAppearance\nfrom .character_disappearance import CharacterDisappearance\nfrom .replica import Replica\nfrom .end_node impor... | [
0,
1
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
driver.get('http://192.168.1.248:9079/#/')
<|reserved_special_token_0|>
print(type(lanuage))
print(lanuage.text)
try:
driver.find_element_by_class_name('el-dropdown-trigger-text').text == '中文'
print('符合要求')
except EOFError... | flexible | {
"blob_id": "6a1f58af26bbc4d584ffd699c512ef433ffb80d8",
"index": 7206,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ndriver.get('http://192.168.1.248:9079/#/')\n<mask token>\nprint(type(lanuage))\nprint(lanuage.text)\ntry:\n driver.find_element_by_class_name('el-dropdown-trigger-text').text == '中文'\n... | [
0,
1,
2,
3,
4
] |
print(10-10)
print(1000-80)
print(10/5)
print(10/6)
print(10//6) # remoção das casas decimais
print(10*800)
print(55*5)
| normal | {
"blob_id": "e488761c15ee8cddbb7577d5340ee9001193c1a4",
"index": 4767,
"step-1": "<mask token>\n",
"step-2": "print(10 - 10)\nprint(1000 - 80)\nprint(10 / 5)\nprint(10 / 6)\nprint(10 // 6)\nprint(10 * 800)\nprint(55 * 5)\n",
"step-3": "print(10-10)\r\nprint(1000-80)\r\nprint(10/5)\r\nprint(10/6)\r\nprint(10/... | [
0,
1,
2
] |
#Copyright (c) 2020 Ocado. All Rights Reserved.
import vptree, itertools
import numpy as np
class _ExtendedVPTree(vptree.VPTree):
"""
VPTree class extended to include the list of points within the tree
"""
def __init__(self, points, dist_fn):
"""
:param points: List of points to add t... | normal | {
"blob_id": "22e6616fb98ecfb256587c3767c7c289decc6bf6",
"index": 3049,
"step-1": "<mask token>\n\n\nclass DynamicVPTree:\n <mask token>\n\n def __init__(self, dist_fn, min_tree_size=4):\n \"\"\"\n :param dist_fn: Metric distance function used for vp-trees\n :param min_tree_size: Minimu... | [
4,
6,
9,
11,
12
] |
<|reserved_special_token_0|>
class VideoClassSerializer(serializers.ModelSerializer):
<|reserved_special_token_0|>
class Meta:
model = VideoClass
fields = 'title', 'video_set'
def get_video_set(self, instance):
videos = instance.video_set.all()
return VideoSerializer(vid... | flexible | {
"blob_id": "b20a8160ba455a39e990b8b37c5017645530ced3",
"index": 1545,
"step-1": "<mask token>\n\n\nclass VideoClassSerializer(serializers.ModelSerializer):\n <mask token>\n\n\n class Meta:\n model = VideoClass\n fields = 'title', 'video_set'\n\n def get_video_set(self, instance):\n ... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
@app.route('/search_general', methods=['POST'])
def query():
message = None
searchQuery = request.json['searchQuery']
result = qp.generateQuery(searchQuery)
response = jsonify(result)
response.headers.add('Access-Control-Allow-Origin', '*')
return response
@app.r... | flexible | {
"blob_id": "e582787a912f479830ed99575b2c6adb8088b4e5",
"index": 257,
"step-1": "<mask token>\n\n\n@app.route('/search_general', methods=['POST'])\ndef query():\n message = None\n searchQuery = request.json['searchQuery']\n result = qp.generateQuery(searchQuery)\n response = jsonify(result)\n resp... | [
2,
3,
4,
5,
6
] |
from .dataset_readers import *
from .models import *
| normal | {
"blob_id": "bc8bf06f1adedeb7b364308591bff09ac42d6c29",
"index": 3702,
"step-1": "<mask token>\n",
"step-2": "from .dataset_readers import *\nfrom .models import *\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
<|reserved_special_token_0|>
def main():
if len(sys.argv) < 2:
print(
'Usage: pyspark q2.py <file>\n e.g. pyspark q2.py file:///home/cloudera/test_file'
)
exit(-1)
sc = SparkContext(appName='HW4_Q2_LC')
try:
n = sc.textFile(sys.argv[1]).filter(lambda x: l... | flexible | {
"blob_id": "deff4eb3ae933a99036f39213ceaf2144b682904",
"index": 5025,
"step-1": "<mask token>\n\n\ndef main():\n if len(sys.argv) < 2:\n print(\n 'Usage: pyspark q2.py <file>\\n e.g. pyspark q2.py file:///home/cloudera/test_file'\n )\n exit(-1)\n sc = SparkContext(ap... | [
1,
2,
3,
4,
5
] |
from mcpi.minecraft import Minecraft
import random, time
while True:
x, y, z = mc.player.getTilePos()
color = random.randrange(0, 9)
mc.setBlock(x, y, z - 1, 38, color)
time.sleep(0.01)
| normal | {
"blob_id": "a2e00af84f743e949b53840ae6d5509e08935486",
"index": 7978,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile True:\n x, y, z = mc.player.getTilePos()\n color = random.randrange(0, 9)\n mc.setBlock(x, y, z - 1, 38, color)\n time.sleep(0.01)\n",
"step-3": "from mcpi.minecraft i... | [
0,
1,
2
] |
# -*- coding: utf-8 -*-
import requests
import json
import boto3
from lxml.html import parse
CardTitlePrefix = "Greeting"
def build_speechlet_response(title, output, reprompt_text, should_end_session):
"""
Build a speechlet JSON representation of the title, output text,
reprompt text & end of session
... | normal | {
"blob_id": "237277e132c8223c6048be9b754516635ab720e2",
"index": 8964,
"step-1": "<mask token>\n\n\ndef build_response(session_attributes, speechlet_response):\n \"\"\"\n Build the full response JSON from the speechlet response\n \"\"\"\n return {'version': '1.0', 'sessionAttributes': session_attribu... | [
8,
11,
13,
14,
15
] |
from sand_game.Environment import Environment
from sand_game.behaviours.Behaviour import Behaviour
class EphemeralBehaviour(Behaviour):
"""Removes the particle after one frame
"""
def behave(env: Environment, loc: tuple[int, int]) ->tuple[int, int]:
env.set(loc[0], loc[1], None)
| normal | {
"blob_id": "2728c3ab26fbdbaac9c47054eafe1c114341f6f2",
"index": 7736,
"step-1": "<mask token>\n\n\nclass EphemeralBehaviour(Behaviour):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass EphemeralBehaviour(Behaviour):\n <mask token>\n\n def behave(env: Environment, loc: tuple[int... | [
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def unescape(text):
return text.replace(''', "'").replace('<', '<').replace('>', '>')
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def unescape(text):
return text.replace(''', "'").replace('<', '<').replace('>', ... | flexible | {
"blob_id": "1ab69874a89311b22220dda541dfe03462a98a55",
"index": 2243,
"step-1": "<mask token>\n\n\ndef unescape(text):\n return text.replace(''', \"'\").replace('<', '<').replace('>', '>')\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef unescape(text):\n return text.replace(''', \"'... | [
1,
2,
3,
4,
5
] |
from IPython import embed
from selenium import webdriver
b = webdriver.Firefox()
embed()
| normal | {
"blob_id": "9aa54f1259aceb052cfba74cedcfadfe68778ebd",
"index": 1020,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nembed()\n",
"step-3": "<mask token>\nb = webdriver.Firefox()\nembed()\n",
"step-4": "from IPython import embed\nfrom selenium import webdriver\nb = webdriver.Firefox()\nembed()\n",
... | [
0,
1,
2,
3
] |
# this is just to test with ilp_polytope
import polytope
polytope.ilp_polytope.test2()
| normal | {
"blob_id": "d2fce15636e43ca618c39c5c963bbf0c3a6a3886",
"index": 4444,
"step-1": "<mask token>\n",
"step-2": "<mask token>\npolytope.ilp_polytope.test2()\n",
"step-3": "import polytope\npolytope.ilp_polytope.test2()\n",
"step-4": "# this is just to test with ilp_polytope\nimport polytope\n\npolytope.ilp_po... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def check_ok(boat, taken_positions):
boat.sort()
for i in range(len(boat)):
if boat[i] in taken_positions:
boat = [-1]
break
elif boat[i] > 99 or boat[i] < 0:
boat = [-1]
break
elif boat[i] % 10 == 9 and i < l... | flexible | {
"blob_id": "95584dfdb232be7f507dc9d29ed2f1d95fa2b653",
"index": 9642,
"step-1": "<mask token>\n\n\ndef check_ok(boat, taken_positions):\n boat.sort()\n for i in range(len(boat)):\n if boat[i] in taken_positions:\n boat = [-1]\n break\n elif boat[i] > 99 or boat[i] < 0:\... | [
7,
10,
11,
12,
16
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def firstMissingPositive(nums):
if len(nums) == 0:
return 1
if len(nums) == 1:
if nums[0] == 1:
return 2
else:
return 1
nums.sort()
current = 1
nums = [ele for ele in nums if ele > 0]
if ... | flexible | {
"blob_id": "89addbf2c49d568250cd5a48d3fdb73914ce50c4",
"index": 2899,
"step-1": "<mask token>\n",
"step-2": "def firstMissingPositive(nums):\n if len(nums) == 0:\n return 1\n if len(nums) == 1:\n if nums[0] == 1:\n return 2\n else:\n return 1\n nums.sort()\n... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
websocket_urlpatterns = [url('^account/home', consumers.
NotificationConsumer), url('^fund/(?P<fund>[\\w-]+)', consumers.
NotificationConsumer), url('^websockets', consumers.StreamConsumer)]
<|reserved_special_token_1|>
... | flexible | {
"blob_id": "7ab9c530035185ee2250f3f6ce8cde87bdfd9803",
"index": 5295,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwebsocket_urlpatterns = [url('^account/home', consumers.\n NotificationConsumer), url('^fund/(?P<fund>[\\\\w-]+)', consumers.\n NotificationConsumer), url('^websockets', consumers.S... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def digit_sum(x):
sum = 0
while x != 0:
sum = sum + x % 10
x = x // 10
return sum
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def digit_sum(x):
su... | flexible | {
"blob_id": "0d37b6f0ea8854f9d4d4cd2ff235fa39bab7cc12",
"index": 6549,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef digit_sum(x):\n sum = 0\n while x != 0:\n sum = sum + x % 10\n x = x // 10\n return sum\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef digit_sum(x... | [
0,
1,
2,
3
] |
#!/usr/bin/env python3
# Rhino Motor Driver (RMCS 2303) - Basic Modbus Communication
# -----------------------------------------------------------
"""
BSD 3-Clause License
Copyright (c) 2021, Rajesh Subramanian
All rights reserved.
Redistribution and use in source and binary forms, with or without
... | normal | {
"blob_id": "df3dcbf3c8d621f5db2a07765a0a28e7626387d9",
"index": 3485,
"step-1": "<mask token>\n\n\nclass Controller:\n\n def __init__(self, port_name, slave_address):\n self.__instrument = modbus.Instrument(port_name, slave_address,\n modbus.MODE_ASCII)\n self.__instrument.serial.bau... | [
16,
19,
24,
27,
29
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(' O dobro de {} é {}'.format(n, n * 2))
print(' O triplo de {} é {}'.format(n, n * 3))
print(' A Raiz quadrada de {} é {}'.format(n, n * n))
<|reserved_special_token_1|>
n = int(input('Digite um número inteiro: '))
print(... | flexible | {
"blob_id": "c0ad3d642f28cb11a8225d4d011dbb241bd88432",
"index": 1661,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(' O dobro de {} é {}'.format(n, n * 2))\nprint(' O triplo de {} é {}'.format(n, n * 3))\nprint(' A Raiz quadrada de {} é {}'.format(n, n * n))\n",
"step-3": "n = int(input('Digite... | [
0,
1,
2
] |
import json
from django.core.management import call_command
from django.http import JsonResponse
from django.test import TestCase
from django.urls import reverse
URLS = ['api_v1:categories', 'api_v1:main_categories', 'api_v1:articles']
class GetJsonData(TestCase):
def test_post_not_login_no_pk(self):
f... | normal | {
"blob_id": "676caabb103f67c631bc191b11ab0d2d8ab25d1e",
"index": 5803,
"step-1": "<mask token>\n\n\nclass UnLoginGetArticleJsonTestCase(TestCase):\n\n @classmethod\n def setUpClass(cls):\n super().setUpClass()\n call_command('loaddata', 'fixtures/auth.json', verbosity=0)\n call_command... | [
5,
7,
8,
9,
11
] |
<|reserved_special_token_0|>
class RoughLightGame:
def __init__(self, game_map, width, height, **kwargs):
self.map = game_map
self.width = width
self.height = height
self.objects = kwargs.get('objects', list())
self.start = kwargs.get('start', utils.Vector(0, 0))
s... | flexible | {
"blob_id": "5f089c3e67452fe6d14f96a70d792bc0d056b375",
"index": 9227,
"step-1": "<mask token>\n\n\nclass RoughLightGame:\n\n def __init__(self, game_map, width, height, **kwargs):\n self.map = game_map\n self.width = width\n self.height = height\n self.objects = kwargs.get('object... | [
4,
5,
6,
8,
10
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(list(result))
<|reserved_special_token_0|>
print(list(result))
<|reserved_special_token_1|>
<|reserved_special_token_0|>
even_integers = lambda a: a % 2 == 0
input = [11, 4, 5, 8, 9, 2, 12]
result = filter(even_integers, ... | flexible | {
"blob_id": "7d9032b2426dbf3c285b99efa78be38d8f76ec24",
"index": 1933,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(list(result))\n<mask token>\nprint(list(result))\n",
"step-3": "<mask token>\neven_integers = lambda a: a % 2 == 0\ninput = [11, 4, 5, 8, 9, 2, 12]\nresult = filter(even_integers,... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class _TimeIT(object):
<|reserved_special_token_0|>
def __init__(self, func, args_list, kwargs_dict, setup_line_list,
check_too_fast, run_sec, name, perf_counter_reference_time):
""" Constructor. See class doc string.
"""
self.func = func
se... | flexible | {
"blob_id": "b2d3ebe4b1ce8f6f0fde8495fb90542080b810ce",
"index": 1390,
"step-1": "<mask token>\n\n\nclass _TimeIT(object):\n <mask token>\n\n def __init__(self, func, args_list, kwargs_dict, setup_line_list,\n check_too_fast, run_sec, name, perf_counter_reference_time):\n \"\"\" Constructor. ... | [
4,
6,
7,
8,
9
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.