code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
# GERALDO AMELIO DE LIMA JUNIOR
# UNIFIP - Patos
# 05 de março de 2020
# Questão 08 - Escreva um programa que leia um valor inteiro e calcule o seu cubo.
n = int(input('Digite um numero:'))
t = n*3
print('O triplo de {} vale {}.'.format(n, t))
| normal | {
"blob_id": "8f311e15c15fe3309218dfaed5eefa4a8fc3f453",
"index": 3234,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('O triplo de {} vale {}.'.format(n, t))\n",
"step-3": "n = int(input('Digite um numero:'))\nt = n * 3\nprint('O triplo de {} vale {}.'.format(n, t))\n",
"step-4": "# GERALDO AME... | [
0,
1,
2,
3
] |
"""
Package with a facade to the several expansion strategies.
"""
from acres.resolution import resolver
__all__ = ['resolver']
| normal | {
"blob_id": "e31267871453d87aee409f1c751c36908f7f151a",
"index": 804,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n__all__ = ['resolver']\n",
"step-3": "<mask token>\nfrom acres.resolution import resolver\n__all__ = ['resolver']\n",
"step-4": "\"\"\"\nPackage with a facade to the several expansion ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def funky():
spam = 302
print(spam)
<|reserved_special_token_0|>
def sayHello(name):
print('Hello, ' + name)
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def funky():
spam = 302
print(spam)
<|reserved_special_token... | flexible | {
"blob_id": "6af5faaaa9d894dd2b882cfe1bb8b8225780743c",
"index": 630,
"step-1": "<mask token>\n\n\ndef funky():\n spam = 302\n print(spam)\n\n\n<mask token>\n\n\ndef sayHello(name):\n print('Hello, ' + name)\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef funky():\n spam = 302\n print(spa... | [
2,
3,
4,
5,
6
] |
import os, tempfile, shutil
from flask import Flask, flash, request, redirect, url_for, send_from_directory, send_file
from werkzeug.utils import secure_filename
from contextlib import contextmanager
"""
Flask stores uploaded FileStorage objects in memory if they are small. Otherwise, it internally uses tempfile.gett... | normal | {
"blob_id": "9f6cfeff9e00079715827a2887263c14a1bb51ff",
"index": 7679,
"step-1": "<mask token>\n\n\n@contextmanager\ndef TemporaryDirectory():\n name = tempfile.mkdtemp()\n try:\n yield name\n finally:\n shutil.rmtree(name)\n\n\n@app.route('/safe', methods=['POST'])\ndef safe():\n f = r... | [
5,
6,
8,
9,
10
] |
<|reserved_special_token_0|>
class Disengage(smach.State):
def __init__(self, flare_task):
smach.State.__init__(self, outcomes=['start_complete',
'complete_outcome', 'aborted'])
self.flare = flare_task
<|reserved_special_token_0|>
class Search(smach.State):
timeout = 10000
... | flexible | {
"blob_id": "0bb2a6ebbf75fae3466c34a435a531fabdc07f62",
"index": 2984,
"step-1": "<mask token>\n\n\nclass Disengage(smach.State):\n\n def __init__(self, flare_task):\n smach.State.__init__(self, outcomes=['start_complete',\n 'complete_outcome', 'aborted'])\n self.flare = flare_task\n ... | [
12,
13,
15,
16,
20
] |
from common import *
import serial
CMD_BAUD = chr(129)
BAUD_RATES = [300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200]
class Communication(Module):
def __init__(self, parent, port_name, baud_rate):
self.parent = parent
if not isinstance(port_name, str):
ra... | normal | {
"blob_id": "eab5bf4776582349615ad56ee1ed93bc8f868565",
"index": 768,
"step-1": "<mask token>\n\n\nclass Communication(Module):\n <mask token>\n <mask token>\n\n def receive(self, length):\n if not isinstance(length, int):\n raise Exception('Receive length must be an integer.')\n ... | [
3,
6,
7,
9,
10
] |
<|reserved_special_token_0|>
def process(trace_dir, out_dir):
trace_files = os.listdir(trace_dir)
trace_files = sorted(trace_files)
if trace_files[0] == 'error.log':
print('Rotating to properly order logs.')
trace_files = collections.deque(trace_files)
trace_files.rotate(-1)
fu... | flexible | {
"blob_id": "4b83887e8d8e5c5dc7065354d24044d3c3a48714",
"index": 3387,
"step-1": "<mask token>\n\n\ndef process(trace_dir, out_dir):\n trace_files = os.listdir(trace_dir)\n trace_files = sorted(trace_files)\n if trace_files[0] == 'error.log':\n print('Rotating to properly order logs.')\n t... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class RunViewSet(ModelViewSet):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_tok... | flexible | {
"blob_id": "11a0c3307994a90d1d4de67d442ffa355e11e13b",
"index": 6836,
"step-1": "<mask token>\n\n\nclass RunViewSet(ModelViewSet):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @property\n def template_na... | [
11,
13,
17,
18,
22
] |
<|reserved_special_token_0|>
class SummarizationTest(ArkoudaTest):
def setUp(self):
ArkoudaTest.setUp(self)
self.na = np.linspace(1, 10, 10)
self.pda = ak.array(self.na)
<|reserved_special_token_0|>
def testMin(self):
self.assertEqual(self.na.min(), self.pda.min())
<|... | flexible | {
"blob_id": "88109909d0c80f25373f917426c3c3634bfc8114",
"index": 6267,
"step-1": "<mask token>\n\n\nclass SummarizationTest(ArkoudaTest):\n\n def setUp(self):\n ArkoudaTest.setUp(self)\n self.na = np.linspace(1, 10, 10)\n self.pda = ak.array(self.na)\n <mask token>\n\n def testMin(s... | [
6,
7,
8,
9,
11
] |
j= float(input("juros"))
Q0= 1500
t= 36
Qf=Q0*(1+j)**t
print(round(Qf,2)) | normal | {
"blob_id": "700d6e0c7dab58ed0157265ff78021923c17e397",
"index": 5619,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(round(Qf, 2))\n",
"step-3": "j = float(input('juros'))\nQ0 = 1500\nt = 36\nQf = Q0 * (1 + j) ** t\nprint(round(Qf, 2))\n",
"step-4": "j= float(input(\"juros\"))\nQ0= 1500\nt= 36... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class Lsoda(sim.SimulatorMG):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def _compile(self, step_code):
self._beta = 1
fc = open(os.path.join(os.path.split(os.path.realpath(__file... | flexible | {
"blob_id": "e9754530bef7614c16cdba0e818c1fa188e2d9a2",
"index": 9940,
"step-1": "<mask token>\n\n\nclass Lsoda(sim.SimulatorMG):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def _compile(self, step_code):\n self._beta = 1\n fc = open(os.path.join(os.path.split(os.... | [
2,
3,
4,
5,
6
] |
# import random module from Python standard library
# define a dictionary with image urls and number of flucks
# set the served img variable to be a random element from imgs
# hints:
# to put dict keys in a list: list(dict.keys())
# to choose a random item from a list: random.choice(lst)
# keep asking user if they ... | normal | {
"blob_id": "4ae611ee8c019c76bb5d7c1d733ffb4bd06e2e8d",
"index": 5508,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nrandom.choice(imgs)\n<mask token>\nprint(served_img)\n<mask token>\nif input == 'yes':\n print('YOU FLUCKED IT')\nelif input == 'no':\n print('WHAT ARE YOU???..')\n",
"step-3": "<... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
print('Different Code!!!')
<|reserved_special_token_1|>
#Sample Python Code
print("Different Code!!!")
#print("Hello World!")
| flexible | {
"blob_id": "1e24952006afebb7bf10a83077fc4effd5cc9c58",
"index": 1301,
"step-1": "<mask token>\n",
"step-2": "print('Different Code!!!')\n",
"step-3": "#Sample Python Code\nprint(\"Different Code!!!\")\n#print(\"Hello World!\")\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
from FluidStream import *
# List of chemicals and their constant properties
CHEMICALS_KEY_GUIDE = ['MW' , 'Density']
CHEMICALS = {
'Bacteria' : ['NA' , 1.05 ],
'Calcium Carbonate' : [100.087 , 2.71 ],
'Calcium Lactate' : [218.22 , 1.494 ],
'Corn Steep Liquor' : ['NA' , 1.2326],
'Glucose' : [180.156 ,... | normal | {
"blob_id": "3471f02f507104202c1e49440172f120ba17730f",
"index": 9263,
"step-1": "<mask token>\n\n\ndef convert_mass_to_concentration(fluidStream, component):\n total_mass = fluidStream.TotalMass\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef convert_mass_to_concentration(fluidStream, component):\n ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class PrimerForm(forms.Form):
<|reserved_special_token_0|>
fasta = forms.CharField(initial='')
primer_min = forms.IntegerField(initial=18, max_value=35)
primer_max = forms.IntegerField(initial=27, max_value=35)
primer_optimum = forms.IntegerField(initial=20, max_value=... | flexible | {
"blob_id": "6291375738db7914d551f9a1c6d2897b7d236b87",
"index": 1742,
"step-1": "<mask token>\n\n\nclass PrimerForm(forms.Form):\n <mask token>\n fasta = forms.CharField(initial='')\n primer_min = forms.IntegerField(initial=18, max_value=35)\n primer_max = forms.IntegerField(initial=27, max_value=35... | [
3,
4,
5,
6,
7
] |
import os, pickle, logging, numpy as np
from .. import utils as U
class CMU_Generator():
def __init__(self, args, dataset_args):
self.in_path = dataset_args['cmu_data_path']
self.out_path = '{}/{}'.format(dataset_args['path'], args.dataset)
self.actions = ['walking', 'running', '... | normal | {
"blob_id": "2c58a9e83f80d437160b87ec64c7631e7a35bf90",
"index": 6315,
"step-1": "<mask token>\n\n\nclass CMU_Generator:\n <mask token>\n <mask token>\n\n def read_data(self, phase):\n all_data, even_data = [], {}\n for action_idx, action in enumerate(self.actions):\n action_pat... | [
3,
5,
6,
7,
8
] |
import os
import requests
def download(url: str, dest_folder: str):
#https://stackoverflow.com/a/56951135/8761164
if not os.path.exists(dest_folder):
os.makedirs(dest_folder) # create folder if it does not exist
filename = url.split('/')[-1].replace(" ", "_") # be careful with file names
fil... | normal | {
"blob_id": "0726a4fa3af196e2ba1592019f09afb0e7bb47d7",
"index": 9731,
"step-1": "<mask token>\n\n\ndef parse_lat(lat: int):\n lat_str = 'N' if lat >= 0 else 'S'\n if 10 > lat > -10:\n lat_str += '0'\n lat_str += str(abs(lat))\n return lat_str\n\n\n<mask token>\n",
"step-2": "<mask token>\n\... | [
1,
3,
4,
5,
6
] |
#Create Pandas dataframe from the DarkSage output G['']
import pandas as pd
import numpy as np
# This is a way to converte multi dimensional data into pd.Series and then load these into the pandas dataframe
Pos = []
for p in G['Pos']:
Pos.append(p)
Pos_df = pd.Series(Pos, dtype=np.dtype("object"))
Vel = []
for ... | normal | {
"blob_id": "0d565c9f92a60d25f28c903c0a27e7b93d547a4f",
"index": 2971,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor p in G['Pos']:\n Pos.append(p)\n<mask token>\nfor v in G['Vel']:\n Vel.append(v)\n<mask token>\nfor s in G['Spin']:\n Spin.append(s)\n<mask token>\nfor d in G['DiscRadii']:\n... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def print_duplicates(arr):
uniques = set()
for elem in arr:
if elem in uniques:
print(elem, end=' ')
else:
uniques.add(elem)
| flexible | {
"blob_id": "420c3944de0a5436a9824604fd6caf27706eb99c",
"index": 4102,
"step-1": "<mask token>\n",
"step-2": "def print_duplicates(arr):\n uniques = set()\n for elem in arr:\n if elem in uniques:\n print(elem, end=' ')\n else:\n uniques.add(elem)\n",
"step-3": null,
... | [
0,
1
] |
# importing libraries
import cv2
import numpy as np
import argparse
aq = argparse.ArgumentParser()
aq.add_argument('-i', '--input', required=True, help="input image path")
aq.add_argument('-o', '--output', help="path where you want to download the image")
args = vars(aq.parse_args())
# reading image
img = cv2.... | normal | {
"blob_id": "10cefb1cf2392fdcd368f11d0d69774a9ffa73ec",
"index": 2816,
"step-1": "<mask token>\n",
"step-2": "<mask token>\naq.add_argument('-i', '--input', required=True, help='input image path')\naq.add_argument('-o', '--output', help=\n 'path where you want to download the image')\n<mask token>\nif args[... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def mkdir_p(mypath):
"""Creates a directory. equivalent to using mkdir -p on the command line"""
from errno import EEXIST
from os import makedirs, path
try:
makedirs(mypath)
except OSError as exc:
if exc.errno == EEXIST and path.isdir(mypath):
... | flexible | {
"blob_id": "8771f71a69f3afdc5de4d38db6efe61b553ae880",
"index": 9396,
"step-1": "<mask token>\n\n\ndef mkdir_p(mypath):\n \"\"\"Creates a directory. equivalent to using mkdir -p on the command line\"\"\"\n from errno import EEXIST\n from os import makedirs, path\n try:\n makedirs(mypath)\n ... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Orders(models.Model):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
... | flexible | {
"blob_id": "bc7a7b9ba4b3277c862aadb57b56661c24efc6e5",
"index": 5577,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Orders(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if a < 97:
print('A')
else:
print('a')
<|reserved_special_token_0|>
<|reserved_special_token_1|>
a = ord(input().rstrip())
if a < 97:
print('A')
else:
print('a')
<|reserved_special_token_0|>
<|reserved_special... | flexible | {
"blob_id": "e7c454b2bf6cf324e1e318e374e07a83812c978b",
"index": 2381,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif a < 97:\n print('A')\nelse:\n print('a')\n<mask token>\n",
"step-3": "a = ord(input().rstrip())\nif a < 97:\n print('A')\nelse:\n print('a')\n<mask token>\n",
"step-4":... | [
0,
1,
2,
3
] |
from rest_framework import serializers
from issue.models import Issue
class IssueSerializer(serializers.ModelSerializer):
"""DRF Serializer For Listing Published Issue"""
class Meta:
model = Issue
fields = ['issueName', 'website', 'issueBody', 'impact', 'published_on'
]
class I... | normal | {
"blob_id": "e4422010337eade12226d84c79532cdbcae68d67",
"index": 1495,
"step-1": "<mask token>\n\n\nclass IssueCreateSerializer(serializers.ModelSerializer):\n <mask token>\n\n\n class Meta:\n model = Issue\n fields = ['issueName', 'website', 'issueBody', 'impact', 'project',\n 'em... | [
3,
5,
6,
7
] |
# -*- coding: utf-8 -*-
# Copyright 2017 Objectif Libre
#
# 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 ... | normal | {
"blob_id": "0ea67ac97ec8e7f287a2430c67f8f7d841d8b646",
"index": 813,
"step-1": "<mask token>\n\n\nclass TestSummary(base.BaseTestCase):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass TestSummary(base.BaseTestCase):\n\n def setUp(self):\n super(TestSummary, self).setUp()\n... | [
1,
2,
3,
4,
5
] |
#代码整体框架
#引用库
#创建窗口
def GameStart():
#游戏背景对象
Background = pygame.image.load()
#挡板背景对象
Baddle = pygame.image.load()
#球对象
Ball = pygame.image.load()
#挡板位置信息
BaffleX
BaffleY
#球位置信息
BallX
ballY
BallSpeed
#帧率控制Clock对象
#显示时间Clock对象
#... | normal | {
"blob_id": "9aeaab445ae9df5c27cc4375a8b6bf320d5ab873",
"index": 6378,
"step-1": "#代码整体框架\n\n#引用库\n\n#创建窗口\n\n\ndef GameStart():\n\n\n #游戏背景对象\n \n Background = pygame.image.load()\n \n #挡板背景对象\n\n Baddle = pygame.image.load()\n\n #球对象 \n\n Ball = pygame.image.load()\n\n #挡板位置信息\n\n... | [
0
] |
<|reserved_special_token_0|>
class Location:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def update_overall_average_value(self):
value_sum = 0
for event in self.events:
value_sum += event.value
value_count = len(self.events)
if value_count > 0:
... | flexible | {
"blob_id": "efbfe95acbe0b97e863c8788bca4a71633da36b3",
"index": 1906,
"step-1": "<mask token>\n\n\nclass Location:\n <mask token>\n <mask token>\n\n def update_overall_average_value(self):\n value_sum = 0\n for event in self.events:\n value_sum += event.value\n value_cou... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class ExecutionMetrics:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class ExecutionMetrics:
def __init__(self, duration, succeeded: bool, timed_out: bool, lines:
... | flexible | {
"blob_id": "f870c776a62f3b743356c5515cd25e588dbfca15",
"index": 8183,
"step-1": "<mask token>\n\n\nclass ExecutionMetrics:\n <mask token>\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass ExecutionMetrics:\n\n def __init__(self, duration, succeeded: bool, timed_out: bool, lines:... | [
1,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class lfwdata:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class lfwdata:
def __init__(self):
self._pairs = []
pairs = open(os.path.join(cfg.LFW_IMAGEPATH, '../pairs.txt'))
pair... | flexible | {
"blob_id": "ccdd7a5e0a1de75762530a7cadd919a2ee753d18",
"index": 1758,
"step-1": "<mask token>\n\n\nclass lfwdata:\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass lfwdata:\n\n def __init__(self):\n self._pairs = []\n pairs = open(os.path.join(cfg.LFW_IMAGEPATH, '../p... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
dependencies = [(... | flexible | {
"blob_id": "37f610457e51599a29168accd95eaa6699c6f777",
"index": 677,
"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 = [('accounts', '... | [
0,
1,
2,
3,
4
] |
# code below
#taking filename as pyscript.py
from distutils.core import setup
import py2exe
setup(console=['pyscript.py'])
# command to run
# python setup.py pytoexe
| normal | {
"blob_id": "9fbf994cb99369ba0c20383007ce52c99248bacf",
"index": 8820,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsetup(console=['pyscript.py'])\n",
"step-3": "from distutils.core import setup\nimport py2exe\nsetup(console=['pyscript.py'])\n",
"step-4": "\n# code below \n#taking filename as pyscr... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def gn_helper(planes):
return nn.GroupNorm(args.group_norm, planes)
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
parser.add_argument('--dataroot', default='data/CIFAR-10-C/')
parser.add_argument('--shared', default=None)
parser.add_argume... | flexible | {
"blob_id": "1f345a20343eb859cb37bf406623c0fc10722357",
"index": 4826,
"step-1": "<mask token>\n\n\ndef gn_helper(planes):\n return nn.GroupNorm(args.group_norm, planes)\n\n\n<mask token>\n",
"step-2": "<mask token>\nparser.add_argument('--dataroot', default='data/CIFAR-10-C/')\nparser.add_argument('--share... | [
1,
2,
3,
4,
5
] |
from __future__ import absolute_import
from . import utils
from . import bert_model
from . import transformer
from .utils import *
from .bert_model import *
from .transformer import *
| normal | {
"blob_id": "6415b08795975698e8e2019cafb82561b35f8e71",
"index": 2037,
"step-1": "<mask token>\n",
"step-2": "from __future__ import absolute_import\nfrom . import utils\nfrom . import bert_model\nfrom . import transformer\nfrom .utils import *\nfrom .bert_model import *\nfrom .transformer import *\n",
"step... | [
0,
1
] |
from .standup import *
from .auth_register import *
from .channels_create import *
import pytest
# If channel does not exist
def test_notExisting_channel():
db.reset_DB()
auth_register('testmail@gmail.com', 'pas123456', 'Bob', 'Smith')
realtoken = Token.generateToken('testmail@gmail.com')
fake_channel = ... | normal | {
"blob_id": "b6715ad42d59720eb021973394a0b7bfd540181b",
"index": 4338,
"step-1": "<mask token>\n\n\ndef test_notExisting_channel():\n db.reset_DB()\n auth_register('testmail@gmail.com', 'pas123456', 'Bob', 'Smith')\n realtoken = Token.generateToken('testmail@gmail.com')\n fake_channel = 70\n with ... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def eq(df1, df2, precision=0.5) ->bool:
"""Compare two dataframes by element with precision margin."""
return ((df1 - df2).abs() < precision).all()
<|reserved_special_token_0|>
doc.add_image('res_use.png', 'png', width... | flexible | {
"blob_id": "2d4187ab5d178efa4920110ccef61c608fdb14c0",
"index": 8780,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef eq(df1, df2, precision=0.5) ->bool:\n \"\"\"Compare two dataframes by element with precision margin.\"\"\"\n return ((df1 - df2).abs() < precision).all()\n\n\n<mask token>\n... | [
0,
2,
3,
4,
5
] |
# -*- coding: utf-8 -*-
def testeum():
a = 10
print(id(a))
def testedois():
a = 10
print(id(a)) | normal | {
"blob_id": "a2e2528f560f6117d4ceeb9cd20d3f6f6b2a30a7",
"index": 213,
"step-1": "<mask token>\n",
"step-2": "def testeum():\n a = 10\n print(id(a))\n\n\n<mask token>\n",
"step-3": "def testeum():\n a = 10\n print(id(a))\n\n\ndef testedois():\n a = 10\n print(id(a))\n",
"step-4": "# -*- co... | [
0,
1,
2,
3
] |
"""
Author : Gülşah Büyük
Date : 17.04.2021
"""
import numpy as np
A = np.array([[22, -41, 2], [61, 17, -18], [-9, 74, -13]])
# For a square matrix A the QR Decomposition converts into the product of an orthogonal matrix Q
# (Q.T)Q= I and an upper triangular matrix R.
def householder_reflection(A):
# A H... | normal | {
"blob_id": "0d1fda864edc73cc6a9853727228c6fa3dfb19a1",
"index": 3039,
"step-1": "<mask token>\n\n\ndef householder_reflection(A):\n size = len(A)\n Q = np.identity(size)\n R = np.copy(A)\n for i in range(size - 1):\n x = R[i:, i]\n e = np.zeros_like(x)\n e[0] = np.linalg.norm(x)... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if len(sys.argv) > 2:
n_hidden = tuple([int(x) for x in sys.argv[2:]])
<|reserved_special_token_0|>
if os.environ.has_key('nz'):
nz = int(os.environ['nz'])
if os.environ.has_key('stepsize'):
alpha = float(os.environ['s... | flexible | {
"blob_id": "40158bbfd9c95a8344f34431d0b0e98c4a1bf6ed",
"index": 476,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif len(sys.argv) > 2:\n n_hidden = tuple([int(x) for x in sys.argv[2:]])\n<mask token>\nif os.environ.has_key('nz'):\n nz = int(os.environ['nz'])\nif os.environ.has_key('stepsize'):\... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class SensorValueSerializer(serializers.ModelSerializer):
<|reserved_special_token_0|>
class Meta:
model = SensorValue
fields = 'id', 'timestamp', 'sensor_type', 'value'
<|reserved_special_token_1|>
... | flexible | {
"blob_id": "39312ec60c9ef1c9c95cf4206b6d0bbdb0aedf94",
"index": 9042,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass SensorValueSerializer(serializers.ModelSerializer):\n <mask token>\n\n\n class Meta:\n model = SensorValue\n fields = 'id', 'timestamp', 'sensor_type', 'valu... | [
0,
1,
2,
3,
4
] |
import math
def calcula_distancia_do_projetil(v, O, y0):
g = 9.8
return ((v ** 2) / 2 * g) * (1 + math.sqrt(1 + ( 2 * g * y0 / (v ** 2) * (math.sin(O) ** 2)))) * math.sin(2 * O) | normal | {
"blob_id": "0a459b4aeb2a16c06c1d89dafb656028b235a31e",
"index": 9415,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef calcula_distancia_do_projetil(v, O, y0):\n g = 9.8\n return v ** 2 / 2 * g * (1 + math.sqrt(1 + 2 * g * y0 / v ** 2 * math.\n sin(O) ** 2)) * math.sin(2 * O)\n",
"s... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
np.random.seed(1)
<|reserved_special_token_0|>
encoder.fit(Y)
<|reserved_special_token_0|>
model.add(Dense(5, input_dim=len(X[0])))
model.add(Dense(32, activation='relu'))
model.add(Dense(len(onehot_Y[0]), activation='softmax'))
m... | flexible | {
"blob_id": "7282af4186a976296ac50840e9169b78a66e118b",
"index": 1683,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nnp.random.seed(1)\n<mask token>\nencoder.fit(Y)\n<mask token>\nmodel.add(Dense(5, input_dim=len(X[0])))\nmodel.add(Dense(32, activation='relu'))\nmodel.add(Dense(len(onehot_Y[0]), activat... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
@rule({'@context': _context, '@type': 'WebSite', '@id': {}, 'url': {}})
def html_resolver(ld):
return dict(ld, **{'html': str(resolve_html(ld['url']))})
<|reserved_special_token_1|>
<|reserved_special_token_0|>
@promise
def resolve_html(url):
from urllib.request import urlope... | flexible | {
"blob_id": "3272296bca0d6343540597baebef8d882a1267c0",
"index": 3111,
"step-1": "<mask token>\n\n\n@rule({'@context': _context, '@type': 'WebSite', '@id': {}, 'url': {}})\ndef html_resolver(ld):\n return dict(ld, **{'html': str(resolve_html(ld['url']))})\n",
"step-2": "<mask token>\n\n\n@promise\ndef resol... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if hasattr(sys, '__interactivehook__'):
del sys.__interactivehook__
print('Python3 startup file loaded from ~/.config/pystartup.py')
<|reserved_special_token_1|>
import sys
import os
import math
import random
if hasattr(sys... | flexible | {
"blob_id": "5ddde3aa6eaa30b70743272a532874663067eed6",
"index": 3157,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif hasattr(sys, '__interactivehook__'):\n del sys.__interactivehook__\nprint('Python3 startup file loaded from ~/.config/pystartup.py')\n",
"step-3": "import sys\nimport os\nimport m... | [
0,
1,
2,
3
] |
from django.core.paginator import Paginator, EmptyPage
from django.shortcuts import render
from django.views import View
from django.contrib.auth.mixins import LoginRequiredMixin
from logging import getLogger
from django_redis import get_redis_connection
from decimal import Decimal
import json
from django import http
f... | normal | {
"blob_id": "0402096f215ae600318d17bc70e5e3067b0a176b",
"index": 3864,
"step-1": "<mask token>\n\n\nclass OrderSuccessView(LoginRequiredMixin, View):\n \"\"\"订单成功页面\"\"\"\n\n def get(self, request):\n \"\"\"提供订单成功页面\"\"\"\n order_id = request.GET.get('order_id')\n payment_amount = requ... | [
9,
16,
17,
19,
22
] |
<|reserved_special_token_0|>
class InflationView(TemplateView):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class InflationView(TemplateView):
<|reserved_special_token_0|>
def get(self, request, *args, **kwargs):
con... | flexible | {
"blob_id": "6645887b25d75f4657fb231b80d8ebdec2bac7c9",
"index": 8718,
"step-1": "<mask token>\n\n\nclass InflationView(TemplateView):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass InflationView(TemplateView):\n <mask token>\n\n def get(self, request, *args, **kwargs):\n ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
print('Introduce un valor par:')
<|reserved_special_token_0|>
print('Introduce un valor impar:')
<|reserved_special_token_0|>
if numpar == numimp * 2:
print(numpar, ' es el doble que ', numimp, '.')
else:
print(numpar, ' no es el doble que ', numimp, ... | flexible | {
"blob_id": "8ad5f3e5f73eae191a3fe9bc20f73b4bfcfedc8c",
"index": 4884,
"step-1": "<mask token>\n",
"step-2": "print('Introduce un valor par:')\n<mask token>\nprint('Introduce un valor impar:')\n<mask token>\nif numpar == numimp * 2:\n print(numpar, ' es el doble que ', numimp, '.')\nelse:\n print(numpar,... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def visualize_data(filename, width=72, height=48, depth=3, cnn_model=None):
"""
When cnn_model is specified it'll show what the cnn_model predicts (red)
as opposed to what inputs it actually received (green)
"""
data = pd.DataFrame.from_csv(filename)
for i in range... | flexible | {
"blob_id": "bf8ffe603b7c1e90deed6a69500ea5b7671e7270",
"index": 879,
"step-1": "<mask token>\n\n\ndef visualize_data(filename, width=72, height=48, depth=3, cnn_model=None):\n \"\"\"\n When cnn_model is specified it'll show what the cnn_model predicts (red)\n as opposed to what inputs it actually recei... | [
1,
2,
3,
4,
5
] |
# coding: gb18030
from setuptools import setup
setup(
name="qlquery",
version="1.0",
license="MIT",
packages=['qlquery'],
install_requires=[
'my-fake-useragent',
'requests',
'beautifulsoup4'
],
zip_safe=False
) | normal | {
"blob_id": "f11ede752df7d9aff672eee4e230b109fcbf987b",
"index": 8555,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsetup(name='qlquery', version='1.0', license='MIT', packages=['qlquery'],\n install_requires=['my-fake-useragent', 'requests', 'beautifulsoup4'],\n zip_safe=False)\n",
"step-3": "... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class QueuedSpace(models.Model):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_to... | flexible | {
"blob_id": "ff09993a4f8fed65fa00c065eb5cfa41e7f9dcc1",
"index": 4411,
"step-1": "<mask token>\n\n\nclass QueuedSpace(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __unicode__(self):\n ... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class Member(models.Model):
name = models.CharField(max_length=200, db_index=True)
age = models.CharField(max_length=200)
phone = models.CharField(max_length=200)
address1 = models.CharField(max_length=200)
address2 = models.CharField(max_length=200)
phone = models... | flexible | {
"blob_id": "0c8b58acf33bdfa95984d29a75ae01e49d0da149",
"index": 9202,
"step-1": "<mask token>\n\n\nclass Member(models.Model):\n name = models.CharField(max_length=200, db_index=True)\n age = models.CharField(max_length=200)\n phone = models.CharField(max_length=200)\n address1 = models.CharField(ma... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if __name__ == '__main__':
running.go()
<|reserved_special_token_1|>
import running
if __name__ == '__main__':
running.go()
<|reserved_special_token_1|>
#!/usr/bin/python
# coding=utf8
# author: Sun yang
import ... | flexible | {
"blob_id": "12442e4debc7fbf102ab88b42464f4ca8eb91351",
"index": 8454,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n running.go()\n",
"step-3": "import running\nif __name__ == '__main__':\n running.go()\n",
"step-4": "#!/usr/bin/python\r\n# coding=utf8\r\n# author:... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def login_homework():
res = requests.get('http://www.yphs.tp.edu.tw/tea/tu2.aspx')
soup = BeautifulSoup(res.text, 'lxml')
VIEWSTATE = soup.find(id='__VIEWSTATE')
VIEWSTATEGENERATOR = soup.find(id='__VIEWSTATEGENERATOR')
EVENTVALIDATION = soup.find(id='__EVENTVALIDATION... | flexible | {
"blob_id": "77f37a80d160e42bb74017a55aa9d06b4c8d4fee",
"index": 4320,
"step-1": "<mask token>\n\n\ndef login_homework():\n res = requests.get('http://www.yphs.tp.edu.tw/tea/tu2.aspx')\n soup = BeautifulSoup(res.text, 'lxml')\n VIEWSTATE = soup.find(id='__VIEWSTATE')\n VIEWSTATEGENERATOR = soup.find(... | [
5,
8,
10,
11,
12
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def trapezoid_integral(**kwargs):
a = kwargs.get('a', None)
b = kwargs.get('b', None)
n = kwargs.get('n', 2)
y_generator = kwargs.get('y_generator', None)
x = kwargs.get('x', None)
y = kwargs.get('y', Non... | flexible | {
"blob_id": "8ce468460a81c7869f3abb69035a033c58e0f699",
"index": 8828,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef trapezoid_integral(**kwargs):\n a = kwargs.get('a', None)\n b = kwargs.get('b', None)\n n = kwargs.get('n', 2)\n y_generator = kwargs.get('y_generator', None)\n x =... | [
0,
1,
2,
3
] |
from sklearn.cluster import MeanShift
from sklearn.datasets.samples_generator import make_blobs
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import style
style.use('ggplot')
# Create random data points whose centers are the following
centers = [[20, 0, 0], [0, 20, 0], [0, 0... | normal | {
"blob_id": "c0216dbd52be134eb417c20ed80b398b22e5d844",
"index": 6967,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nstyle.use('ggplot')\n<mask token>\nclf.fit(X)\n<mask token>\nprint(cluster_centers)\n<mask token>\nprint('Number of clusters found:', n_clusters)\n<mask token>\nfor i in range(len(X)):\n ... | [
0,
1,
2,
3,
4
] |
num=int(input("enter no"))
def factorial(no):
fact=1
if no <0:
print("-ve no factorial not exist")
else:
for i in range(1,no+1):
fact=fact*i
return fact
print(factorial(num)) | normal | {
"blob_id": "2d3ab575b18144f714f06167f54cd069af4e5895",
"index": 7506,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef factorial(no):\n fact = 1\n if no < 0:\n print('-ve no factorial not exist')\n else:\n for i in range(1, no + 1):\n fact = fact * i\n retu... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def get_encoder(conf):
if conf.encoder == 'linear':
model = tf.keras.Sequential([tf.keras.layers.Dense(conf.d_model * 2
), tf.keras.layers.ReLU(), tf.keras.layers.Dense(conf.d_model)])
return model
if conf.encoder == 'rand_linear':
model = get_s... | flexible | {
"blob_id": "548eebb9628374df320021c714454e05d2c606c0",
"index": 5336,
"step-1": "<mask token>\n\n\ndef get_encoder(conf):\n if conf.encoder == 'linear':\n model = tf.keras.Sequential([tf.keras.layers.Dense(conf.d_model * 2\n ), tf.keras.layers.ReLU(), tf.keras.layers.Dense(conf.d_model)])\n... | [
9,
10,
12,
13,
14
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
reload(sys)
sys.setdefaultencoding('utf-8')
<|reserved_special_token_0|>
write_schedule(cut(get_son(schedule[0], List)))
<|reserved_special_token_1|>
<|reserved_special_token_0|>
reload(sys)
sys.setdefaultencoding('utf-8')
<|re... | flexible | {
"blob_id": "3c7280bbd23bd3472915da0760efbfd03bfe995d",
"index": 9314,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nreload(sys)\nsys.setdefaultencoding('utf-8')\n<mask token>\nwrite_schedule(cut(get_son(schedule[0], List)))\n",
"step-3": "<mask token>\nreload(sys)\nsys.setdefaultencoding('utf-8')\n<m... | [
0,
1,
2,
3,
4
] |
# For better usage on ddp
import torch
from pytorch_lightning.metrics import Metric
import cv2
import numpy as np
import skimage
import torch.tensor as Tensor
class SegMetric(Metric):
def __init__(self, iou_thr, prob_thr, img_size, dist_sync_on_step=False):
super().__init__(dist_sync_on_step=dist_sync_on... | normal | {
"blob_id": "8d3f8872a3d5c4351551dc2d46839763d28ebd70",
"index": 3586,
"step-1": "<mask token>\n\n\nclass SegMetric(Metric):\n\n def __init__(self, iou_thr, prob_thr, img_size, dist_sync_on_step=False):\n super().__init__(dist_sync_on_step=dist_sync_on_step)\n self.iou_thr = iou_thr\n sel... | [
5,
6,
7,
8,
10
] |
"""config URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... | normal | {
"blob_id": "786bc5d44115b46bd246e85e85c8f8c1f20737b9",
"index": 7921,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nrouter.register('species', views.SpeciesViewSet)\nrouter.register('com_names', views.Com_NamesViewSet)\nrouter.register('photos', views.PhotosViewSet)\n<mask token>\nif settings.DEBUG:\n ... | [
0,
1,
2,
3,
4
] |
import sys
sys.path.append("./")
from torchtext.datasets import Multi30k
from torchtext.data import Field
from torchtext import data
import pickle
import models.transformer as h
import torch
from datasets import load_dataset
from torch.utils.data import DataLoader
from metrics.metrics import bleu
import numpy as np
fro... | normal | {
"blob_id": "57bc34c6a23c98fd031ea6634441d4d135c06590",
"index": 8694,
"step-1": "<mask token>\n\n\nclass Batch:\n <mask token>\n <mask token>\n <mask token>\n\n\nclass MyIterator(data.Iterator):\n\n def create_batches(self):\n if self.train:\n\n def pool(d, random_shuffler):\n ... | [
7,
14,
17,
18,
21
] |
#!python
import pdb
import argparse
import os
import re
import sys
import string
from utilpack import path
from subprocess import Popen
from subprocess import PIPE
def popen(cmd):
spl = cmd.split()
return Popen(spl, stdout=PIPE).communicate()[0]
def debug (s):
s
dists = 0
def get_setup_ini (setup_in... | normal | {
"blob_id": "e3b8bec0cc7df217052a3182f9a862f0e3622afd",
"index": 5318,
"step-1": "#!python\nimport pdb\nimport argparse\nimport os\nimport re\nimport sys\nimport string\nfrom utilpack import path\nfrom subprocess import Popen\nfrom subprocess import PIPE\n\n\ndef popen(cmd):\n spl = cmd.split()\n return Po... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if __name__ == '__main__':
create_data_lists(ICDAR_path=
'../ICDAR_Dataset/0325updated.task1train(626p)', output_folder=
'../ICDAR_Dataset/0325updated.task1train(626p)')
<|reserved_special_token_1|>
from uti... | flexible | {
"blob_id": "6334a8a052d72b0f13395b301bd5a766acf4399b",
"index": 3437,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n create_data_lists(ICDAR_path=\n '../ICDAR_Dataset/0325updated.task1train(626p)', output_folder=\n '../ICDAR_Dataset/0325updated.task1train(62... | [
0,
1,
2
] |
import numpy as np
import cv2
import time
from itertools import chain, compress
from collections import defaultdict, namedtuple
class FeatureMetaData(object):
"""
Contain necessary information of a feature for easy access.
"""
def __init__(self):
self.id = None # int
... | normal | {
"blob_id": "02f196623907703255bf149db0435104d086da97",
"index": 8292,
"step-1": "<mask token>\n\n\nclass ImageProcessor(object):\n <mask token>\n\n def __init__(self, config):\n self.config = config\n self.is_first_img = True\n self.next_feature_id = 0\n self.detector = cv2.Fas... | [
18,
20,
23,
25,
31
] |
# from django.test import TestCase ,LiveServerTestCase,Client
# from MeetUps.models import*
# from django.shortcuts import reverse
# from .forms import RegistrationForm
# class MeetUpViewTest(TestCase):
# @classmethod
# def setupTestDat(cls):
# #create or get all meetups
# d... | normal | {
"blob_id": "9156ee034ceb8a39fc1eb3a18c1597c737814c72",
"index": 692,
"step-1": "# from django.test import TestCase ,LiveServerTestCase,Client\n\n# from MeetUps.models import*\n# from django.shortcuts import reverse\n# from .forms import RegistrationForm\n\n# class MeetUpViewTest(TestCase):\n\n# @classmetho... | [
1
] |
<|reserved_special_token_0|>
def replchars(word: str, reptable: List[aff.RepPattern]) ->Iterator[Union[
str, List[str]]]:
"""
Uses :attr:`aff.REP <spylls.hunspell.data.aff.Aff.REP>` table (typical misspellings) to replace
in the word provided. If the pattern's replacement contains "_", it means replac... | flexible | {
"blob_id": "cfba55505f3290a14b98d594bc871a74812c7c57",
"index": 5594,
"step-1": "<mask token>\n\n\ndef replchars(word: str, reptable: List[aff.RepPattern]) ->Iterator[Union[\n str, List[str]]]:\n \"\"\"\n Uses :attr:`aff.REP <spylls.hunspell.data.aff.Aff.REP>` table (typical misspellings) to replace\n ... | [
6,
9,
12,
13,
14
] |
import sys
import pygame
import os
import random
import subprocess
FPS, NEWENEMYSPAWN, fst_spawn, not_paused, coins, enemies_count, killed, score = 50, 30, 2000, True, 0, 0, 0, 0
MiniG_rate, EnemyG_rate, MetalM_rate = 1, 5, 15
WEAPONS_LIST = ['Green laser gun', 'Purple laser gun', 'Plasma gun']
def load_i... | normal | {
"blob_id": "244191087fcab2a6f03bf024708484b9838731ed",
"index": 9301,
"step-1": "<mask token>\n\n\nclass Player(pygame.sprite.Sprite):\n\n def __init__(self, group):\n super().__init__(group)\n self.weapon = Weapon(self, 'Green laser gun')\n self.image = load_image('player.jpg', -1)\n ... | [
7,
13,
16,
22,
30
] |
<|reserved_special_token_0|>
class Version(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __init__(self, soft):
"""
Constructor that takes software name
"""
self.soft = soft
self.app_dir = os.environ.get('APP... | flexible | {
"blob_id": "93e8e9fc4f0503dfc3243bef5ab8261a4cdfc296",
"index": 1009,
"step-1": "<mask token>\n\n\nclass Version(object):\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, soft):\n \"\"\"\n Constructor that takes software name\n \"\"\"\n self.soft = soft... | [
5,
6,
7,
8,
10
] |
#encoding:utf-8
class Employee():
def __int__(self,name,sex,salary):
self.name = name
self.sex = sex
self.salary = salary
def give_raise(self):
222 | normal | {
"blob_id": "014509170b98a38838859d3ca48c74ca6be0bd46",
"index": 7190,
"step-1": "#encoding:utf-8\nclass Employee():\n def __int__(self,name,sex,salary):\n self.name = name\n self.sex = sex\n self.salary = salary\n def give_raise(self):\n 222",
"step-2": null,
"step-3": null,
... | [
0
] |
# dates.py
"""Date/time parsing and manipulation functions
"""
# Some people, when confronted with a problem, think
# "I know, I'll use regular expressions."
# Now they have two problems.
# -- Jamie Zawinski
import datetime as dt
import time
import re
_months = [
'january',
'... | normal | {
"blob_id": "458bc2b5f843e4c5bb3f9180ab2cbec7409b8d3e",
"index": 4946,
"step-1": "# dates.py\n\n\"\"\"Date/time parsing and manipulation functions\n\"\"\"\n\n# Some people, when confronted with a problem, think\n# \"I know, I'll use regular expressions.\"\n# Now they have two problems.\n# ... | [
0
] |
# file with function to randomly select user from all of the data, all of the games
import ast
import csv
import numpy as np
import pandas as pd
import sys
from nba_api.stats.static import players
# some fun little work to get a random player
def get_random_player(file_name):
def need_s(num):
return 's' i... | normal | {
"blob_id": "ac178d4e009a40bde5d76e854edc6f6ae8422610",
"index": 1106,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_random_player(file_name):\n\n def need_s(num):\n return 's' if num != 1 else ''\n csv.field_size_limit(sys.maxsize)\n res = pd.read_csv(file_name, header=None)... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class TestCommands(commands.Cog, description='Unstable test commands',
command_attrs=dict(hidden=True, description='Can only be used by an Owner')
):
<|reserved_special_token_0|>
async def cog_check(self, ctx):
return await self.bot.is_owner(ctx.author)
<|reserv... | flexible | {
"blob_id": "d5a5c6f9d483b2998cd0d9e47b37ab4499fa1c2a",
"index": 6279,
"step-1": "<mask token>\n\n\nclass TestCommands(commands.Cog, description='Unstable test commands',\n command_attrs=dict(hidden=True, description='Can only be used by an Owner')\n ):\n <mask token>\n\n async def cog_check(self, ct... | [
1,
2,
3,
4,
5
] |
'''
Classes
'''
class Person:
alive = True
'''
Possible Attributes for a Person:
1. Name
2. Age
3. Gender
'''
def __init__(self, name, age, gender):
self.name = name
self.age = age
self.gender = gender
self.salary = 0
def greet(self):
... | normal | {
"blob_id": "11feb13f38f2484c867a8b3fa525ffecf419dfe5",
"index": 9957,
"step-1": "<mask token>\n\n\nclass Person:\n alive = True\n <mask token>\n\n def __init__(self, name, age, gender):\n self.name = name\n self.age = age\n self.gender = gender\n self.salary = 0\n\n def g... | [
5,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
try:
number = int(input('Enter number: '))
if number < 31:
for num in range(1, number + 1):
print('2 ^', num, '=', 2 ** num)
else:
print('Enter number in valid range')
except Exception:
... | flexible | {
"blob_id": "b0f0bcfb5739d46de54cbe46614e82bf5a2d13fb",
"index": 9038,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntry:\n number = int(input('Enter number: '))\n if number < 31:\n for num in range(1, number + 1):\n print('2 ^', num, '=', 2 ** num)\n else:\n print('Ent... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def ex7(*siruri, x=1, flag=True):
res = ()
for sir in siruri:
chars = []
for char in sir:
if ord(char) % x == (not flag):
chars.append(char)
res += chars,
return res
<|reserved_special_token_0|... | flexible | {
"blob_id": "90a402cccf383ed6a12b70ecdc3de623e6e223f9",
"index": 8365,
"step-1": "<mask token>\n",
"step-2": "def ex7(*siruri, x=1, flag=True):\n res = ()\n for sir in siruri:\n chars = []\n for char in sir:\n if ord(char) % x == (not flag):\n chars.append(char)\n ... | [
0,
1,
2,
3
] |
import datetime
import json
from dateutil import parser
import mock
from python_http_client.exceptions import ForbiddenError
from rdr_service import clock, config
from rdr_service.api_util import open_cloud_file
from rdr_service.clock import FakeClock
from rdr_service.dao.database_utils import format_datetime
from rd... | normal | {
"blob_id": "bd179fda18551d4f3d8a4d695a9da38ee607ef1d",
"index": 2168,
"step-1": "<mask token>\n\n\nclass GenomicJobControllerTest(BaseTestCase):\n\n def setUp(self):\n super(GenomicJobControllerTest, self).setUp()\n self.data_file_dao = GenomicGcDataFileDao()\n self.event_data_dao = Mess... | [
9,
13,
17,
22,
25
] |
n = 1
ip = []
ma = []
l = [0, 0, 0, 0, 0, 0, 0] # a, b, c, d, e, wpm, pr
while n != 0:
a = input().strip().split("~")
n = len(a)
if n == 1:
break
ip.append(a[0])
ma.append(a[1])
for i in ip:
ipn = i.split(".")
try:
if 1 <= int(ipn[0]) <= 126:
p = 0
elif 1... | normal | {
"blob_id": "4a13f05fbbe598242f5663d27d578d2eb977e103",
"index": 6137,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile n != 0:\n a = input().strip().split('~')\n n = len(a)\n if n == 1:\n break\n ip.append(a[0])\n ma.append(a[1])\nfor i in ip:\n ipn = i.split('.')\n try:\... | [
0,
1,
2,
3
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 14 09:53:10 2021
@author: kaouther
"""
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import pandas as pd
#path = '/home/kaouther/Documents/Internship/pre_process/input_files/heart_forKaouther.xlsx'
#path = '/home/k... | normal | {
"blob_id": "a3588a521a87765d215fd2048407e5e54fb87e94",
"index": 4276,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_rep_name(string):\n return string[-1:]\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef get_rep_name(string):\n return string[-1:]\n\n\n<mask token>\nfor name in... | [
0,
1,
2,
3,
5
] |
from inotifier import Notifier
from IPython.display import display, Audio, HTML
import pkg_resources
import time
class AudioPopupNotifier(Notifier):
"""Play Sound and show Popup upon cell completion"""
def __init__(self, message="Cell Completed", audio_file="pad_confirm.wav"):
super(AudioPopupNotifi... | normal | {
"blob_id": "94a3a74260fac58b4cad7422608f91ae3a1a0272",
"index": 6247,
"step-1": "<mask token>\n\n\nclass AudioPopupNotifier(Notifier):\n <mask token>\n <mask token>\n\n def notify(self):\n display(Audio(self.audio, autoplay=True))\n time.sleep(3)\n display(HTML(self.template.format... | [
2,
3,
4,
5,
6
] |
import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
from datetime import datetime
import statsmodels.api as sm
from quant.stock.stock import Stock
from quant.stock.date import Date
from quant.utility_fun.factor_preprocess import FactorPreProcess
from quant.utility_fun.write_excel import Wri... | normal | {
"blob_id": "1d0730e8fd120e1c4bc5b89cbd766234e1fa3bca",
"index": 2197,
"step-1": "<mask token>\n\n\ndef cal_factor_alpha_return(factor_name, beg_date, end_date, cal_period):\n group_number = 8\n year_trade_days = 242\n min_stock_number = 100\n out_path = 'E:\\\\3_Data\\\\5_stock_data\\\\3_alpha_model... | [
1,
2,
3,
4,
5
] |
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors import LinkExtractor
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from mp_data_scrapper.items import MpDataScrapperItem
class MininovaSpider(CrawlSpider):
name = 'mp'
allowed_domains = ['india.gov.in']
... | normal | {
"blob_id": "94e9d67095dde4d3bf7ddb207ac17a4c250a2bfc",
"index": 1986,
"step-1": "from scrapy.contrib.spiders import CrawlSpider, Rule\nfrom scrapy.contrib.linkextractors import LinkExtractor\nfrom scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor\nfrom mp_data_scrapper.items import MpDataScrapperItem\... | [
0
] |
#!/usr/bin/env python
#
# Copyright (C) University College London, 2007-2012, all rights reserved.
#
# This file is part of HemeLB and is CONFIDENTIAL. You may not work
# with, install, use, duplicate, modify, redistribute or share this
# file, or any part thereof, other than as allowed by any agreement
# specifical... | normal | {
"blob_id": "7700e3c4061f0e81a1dea8fa8b27a0380fc26e71",
"index": 7171,
"step-1": "<mask token>\n\n\nclass TestFabric(unittest.TestCase):\n\n def setUp(self):\n env.test_home = os.path.join(env.localroot, 'deploy', 'test')\n user_config = yaml.load(open(os.path.join(env.localroot, 'deploy',\n ... | [
12,
14,
16,
19,
20
] |
class SurveyRepository:
def __init__(self):
self._surveys = {}
def get_survey(self, survey_id):
if survey_id in self._surveys:
return self._surveys[survey_id]
def save(self, survey):
self._surveys[survey.id] = survey
| normal | {
"blob_id": "961643e93582bd92e148d00efebbfe38f99100fc",
"index": 2866,
"step-1": "class SurveyRepository:\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "class SurveyRepository:\n\n def __init__(self):\n self._surveys = {}\n <mask token>\n <mask token>\n",
"step-3": "clas... | [
1,
2,
3,
4
] |
class Node:
def __init__(self, char=None):
self.char = char
self.children = []
self.end = False
<|reserved_special_token_0|>
def search(sequence):
tmp_node = root
found = False
for letter in sequence:
common = False
for child in tmp_node.children:
... | flexible | {
"blob_id": "37c42a5e52832c81660e88f45d93e6a9f0300de0",
"index": 7654,
"step-1": "class Node:\n\n def __init__(self, char=None):\n self.char = char\n self.children = []\n self.end = False\n\n\n<mask token>\n\n\ndef search(sequence):\n tmp_node = root\n found = False\n for letter ... | [
3,
4,
5,
6,
7
] |
# Generated by Django 3.1.6 on 2021-02-27 23:29
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('RMS', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='inventorytable',
old_name='Restaurant_ID',
... | normal | {
"blob_id": "ba336094d38a47457198919ce60969144a8fdedb",
"index": 5374,
"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 = [('RMS', '0001... | [
0,
1,
2,
3,
4
] |
import requests
import os
from dotenv import load_dotenv
from datetime import datetime
load_dotenv(".env") # loads the environment file
USERNAME = os.getenv("USER")
TOKEN = os.getenv("TOKEN")
pixela_endpoint = "https://pixe.la/v1/users"
# MAKING AN ACCOUNT
user_params = {
"token": TOKEN,
... | normal | {
"blob_id": "ba34dfcad0cb9bac9c462bdf60e55dee6ba9d58d",
"index": 9255,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nload_dotenv('.env')\n<mask token>\nprint(response.text)\n<mask token>\n",
"step-3": "<mask token>\nload_dotenv('.env')\nUSERNAME = os.getenv('USER')\nTOKEN = os.getenv('TOKEN')\npixela_... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print('yourname is: ', age, 'and your are', 'years old')
<|reserved_special_token_1|>
<|reserved_special_token_0|>
myName = 'Christian D. Goyes'
myDate = 1998
year = 2020
age = year - myDate
print('yourname is: ', age, 'and you... | flexible | {
"blob_id": "f5331b56abea41873bd3936028471d0da1c58236",
"index": 4986,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('yourname is: ', age, 'and your are', 'years old')\n",
"step-3": "<mask token>\nmyName = 'Christian D. Goyes'\nmyDate = 1998\nyear = 2020\nage = year - myDate\nprint('yourname is:... | [
0,
1,
2,
3
] |
from sqlalchemy.orm import sessionmaker
from IMDB.spiders.models import IMDB_DATABASE, db_connect, create_table
class ScrapySpiderPipeline(object):
# Bu Fonksiyon Veritabanı bağlantısını ve oturum oluşturucuyu başlatır ve bir İlişkisel Veritabanı tablosu oluşturur.
def __init__(self):
en... | normal | {
"blob_id": "16074fc1824a99b6fd1c4bf113d5b752308e8803",
"index": 5198,
"step-1": "<mask token>\n\n\nclass ScrapySpiderPipeline(object):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass ScrapySpiderPipeline(object):\n\n def __init__(self):\n engine = db_connect()\n cre... | [
1,
2,
3,
4,
5
] |
# -*- coding: utf-8 -*-
from rest_framework.views import APIView
from ..Models.ConnectToDBModel import *
from ..Models.RegionInfoModel import *
from .CommonView import *
def get_one_spot(region):
comments_data = get_comment_data();
data = {};
data['id'] = region.id;
data['name'] = r... | normal | {
"blob_id": "0b0b22043dda94ea57344fb3bf47255ad85c7f5b",
"index": 1408,
"step-1": "<mask token>\n\n\nclass SpotListView(APIView):\n <mask token>\n",
"step-2": "<mask token>\n\n\ndef get_one_spot(region):\n comments_data = get_comment_data()\n data = {}\n data['id'] = region.id\n data['name'] = re... | [
1,
3,
4,
5,
6
] |
# -*- coding: utf-8 -*-
# Scrapy settings for reddit_scraper project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'reddit_scraper'
SPIDER_MODULES = ['reddit_s... | normal | {
"blob_id": "a352768c2928cb7a33b9f1a31a0b3d8e56a8376a",
"index": 5588,
"step-1": "<mask token>\n",
"step-2": "BOT_NAME = 'reddit_scraper'\nSPIDER_MODULES = ['reddit_scraper.spiders']\nNEWSPIDER_MODULE = 'reddit_scraper.spiders'\n",
"step-3": "# -*- coding: utf-8 -*-\n\n# Scrapy settings for reddit_scraper pr... | [
0,
1,
2
] |
<|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 = [m... | flexible | {
"blob_id": "8c05259ce577e6b6a6efdf778832e9bb817e47fd",
"index": 1414,
"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 = [migrations.sw... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python
# made for comparing unfiltered and filtered scorefiles for Rosetta enzdes post analysis
import argparse
import collections
import re
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
def data_from_sc_file(axes, f, uf, true_max):
... | normal | {
"blob_id": "17b0baef5e366d70ea393259df1965e75b7d12e1",
"index": 5789,
"step-1": "#!/usr/bin/env python\n\n# made for comparing unfiltered and filtered scorefiles for Rosetta enzdes post analysis\n\nimport argparse\nimport collections\nimport re\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotl... | [
0
] |
<|reserved_special_token_0|>
class ClassEnumerationHandler(RelativeHandlerInterface):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def process(self, target: Class):
"""
Process class receiver.
Steps:
1. Filter attrs not derived from xs:enumeration
... | flexible | {
"blob_id": "4d9064add28302fe173a8b0a81ee7d187db8aead",
"index": 6029,
"step-1": "<mask token>\n\n\nclass ClassEnumerationHandler(RelativeHandlerInterface):\n <mask token>\n <mask token>\n\n def process(self, target: Class):\n \"\"\"\n Process class receiver.\n\n Steps:\n ... | [
6,
7,
9,
10,
11
] |
class MiniMaxSearch(object):
def __init__(self):
self.count = 0
self.explored = set()
def max_value(self, state, a, b):
self.count += 1
value = float('-inf')
if state in self.explored:
return state.evaluate()
if state.terminal():
self.... | normal | {
"blob_id": "15c61dbf51d676b4c339dd4ef86a76696adfc998",
"index": 4707,
"step-1": "\n\nclass MiniMaxSearch(object):\n def __init__(self):\n self.count = 0\n self.explored = set()\n\n def max_value(self, state, a, b):\n self.count += 1\n value = float('-inf')\n\n if state i... | [
0
] |
# -*- coding: iso-8859-15 -*-
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@8:........C@@@
# @@@@@@@@@@@@@@88@@@@@@@@@@@@@@@@@@@@@@88@@@@@@@@@@8... | normal | {
"blob_id": "f105ecb8229020554930bb4f0e00ecf88e83f5ae",
"index": 4288,
"step-1": "# -*- coding: iso-8859-15 -*-\r\n# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\n# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@... | [
0
] |
def
a = 10
b = 2
c = 3
cal(a,b,c) | normal | {
"blob_id": "1be5de71615eae6c9074e67b0dcaabbac4d82e2b",
"index": 9909,
"step-1": "def\n\na = 10\nb = 2\nc = 3\n\ncal(a,b,c)",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
<|reserved_special_token_0|>
class CharacterDropHeaderView(APIView):
"""
Set of AJAX views for a Characters
This handles different API calls for character actions.
"""
authentication_classes = [SessionAuthentication]
permission_classes = [OwnsCharacter]
def post(self, request, format=Non... | flexible | {
"blob_id": "55ea522b096b189ff67b0da0058af777b0a910e3",
"index": 4970,
"step-1": "<mask token>\n\n\nclass CharacterDropHeaderView(APIView):\n \"\"\"\n Set of AJAX views for a Characters\n\n This handles different API calls for character actions.\n \"\"\"\n authentication_classes = [SessionAuthenti... | [
33,
48,
59,
68,
81
] |
from chalicelib.utilities import *
def Error(app):
@app.route('/errors', cors=True, methods=['POST'])
@printError
def errors():
request = app.current_request
data = request.json_body
print(data)
return data
| normal | {
"blob_id": "f100757fcb1bef334f9f8eacae83af551d2bac5b",
"index": 3239,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef Error(app):\n\n @app.route('/errors', cors=True, methods=['POST'])\n @printError\n def errors():\n request = app.current_request\n data = request.json_body\... | [
0,
1,
2
] |
<|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": "c8406db010a506b782030c5d3f84c319851e89d6",
"index": 3662,
"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 = [('twitter', '... | [
0,
1,
2,
3,
4
] |
# Generated by Django 3.1.7 on 2021-05-05 23:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('travels', '0011_auto_20210505_2230'),
]
operations = [
migrations.RenameField(
model_name='trip',
old_name='hotel_de... | normal | {
"blob_id": "1e853d58c2066f3fbd381d0d603cd2fcece0cf15",
"index": 7933,
"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 = [('travels', '... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
@project= Life_is_short_you_need_python
@file= judgement
@author= wubingyu
@create_time= 2017/12/21 下午2:58
"""
#a if condition else b
#(falseValue,trueValue)[test]
#(falseValue,trueValue)[test==True]
#(falseValue,trueValue)[bool(<expression>)]
| normal | {
"blob_id": "73e23b3560294ca24428e7dd4cc995b97767335c",
"index": 4202,
"step-1": "<mask token>\n",
"step-2": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\"\"\"\n@project= Life_is_short_you_need_python\n@file= judgement\n@author= wubingyu\n@create_time= 2017/12/21 下午2:58\n\"\"\"\n\n#a if condition else b\n#(fa... | [
0,
1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.