code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
import nltk import spacy import textacy from keras.layers import Embedding, Bidirectional, Dense, Dropout, BatchNormalization from keras_preprocessing.sequence import pad_sequences from keras_preprocessing.text import Tokenizer from nltk import word_tokenize, re from rasa import model import pandas as pd from spacy imp...
normal
{ "blob_id": "707855a4e07b68d9ae97c2e1dc8bfd52f11c314c", "index": 1812, "step-1": "<mask token>\n\n\ndef load_dataset(filename):\n df = pd.read_csv(filename, encoding='latin1', names=['Sentence', 'Intent'])\n intent = df['Intent']\n unique_intent = list(set(intent))\n sentences = list(df['Sentence'])\...
[ 7, 9, 10, 11, 12 ]
import datetime from app.api.v2.models.db import Database now = datetime.datetime.now() db = Database() cur = db.cur class Meetup(): #meetup constructor def __init__(self, topic, location, tags, happening_on): self.topic = topic self.location = location self.tags = tags self.h...
normal
{ "blob_id": "275f8b6ac31792a9e4bb823b61366f868e45ef4e", "index": 6521, "step-1": "<mask token>\n\n\nclass Meetup:\n <mask token>\n\n def check_if_meetup_exists(self, topic):\n query = 'SELECT topic from meetups WHERE topic=%s;'\n cur.execute(query, (topic,))\n meetup = cur.fetchone()\n...
[ 4, 7, 8, 9, 10 ]
from services.BureauActif.libbureauactif.db.Base import db, BaseModel class BureauActifCalendarDataType(db.Model, BaseModel): __tablename__ = "ba_calendar_data_type" id_calendar_data_type = db.Column(db.Integer, db.Sequence('id_calendar_data_type_sequence'), primary_key=True, ...
normal
{ "blob_id": "83117000f5f34490cb14580a9867b1e871ccc2ae", "index": 526, "step-1": "<mask token>\n\n\nclass BureauActifCalendarDataType(db.Model, BaseModel):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass BureauActifCalendarDataType...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print( """Welcome to my Quiz: If you go wrong once you lose but if you give all the answers correct then you win but no CHEATING.""" ) print('Q1:-Who is the president of India?') <|reserved_special_token_0|> if seat in win...
flexible
{ "blob_id": "351421ef6a40e3a4bd4549a1851fbf4bed9ddf30", "index": 5024, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\n \"\"\"Welcome to my Quiz:\nIf you go wrong once you lose but if you give all the answers correct then you win but no CHEATING.\"\"\"\n )\nprint('Q1:-Who is the president of...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # On CI, you can pass the logging and the password of dockerhub through # the environment variables DOCKER_USERNAME and DOCKER_PASSWORD import getpass import os import subprocess import sys from builtins import input SCRIPT_DIR = os.path.realpath(os.path.join(__file__, '..')) ROOT_DIR = os.path...
normal
{ "blob_id": "1ad40ef3aa7c81b6eee4fe0b98bcdd2f1110ef8d", "index": 5990, "step-1": "<mask token>\n\n\ndef main(arguments):\n docker = [('Dockerfile.ubuntu1804', 'ubuntu1804_ansible_testinfra'), (\n 'Dockerfile.ubuntu1604', 'ubuntu1604_ansible_testinfra')]\n docker_username = os.environ.get('DOCKER_USE...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for c in range(1, 11): tree = DecisionTreeClassifier(max_depth=4, random_state=c) model.append(tree.fit(X_train, y_train)) <|reserved_special_token_0|> for a in model: in_sample_accuracy.append(a.score(X_train, y_train...
flexible
{ "blob_id": "cc46485a3b5c68e4f77a2f9a033fd2ee2859b52b", "index": 978, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor c in range(1, 11):\n tree = DecisionTreeClassifier(max_depth=4, random_state=c)\n model.append(tree.fit(X_train, y_train))\n<mask token>\nfor a in model:\n in_sample_accuracy....
[ 0, 1, 2, 3, 4 ]
import os TEMP_DIR = os.path.expanduser('~/Documents/MFA') def make_safe(value): if isinstance(value, bool): return str(value).lower() return str(value) class MonophoneConfig(object): ''' Configuration class for monophone training Scale options defaults to:: ['--transition-sca...
normal
{ "blob_id": "7cfca56907f0bca7fd62e506414641f942527d1a", "index": 9624, "step-1": "<mask token>\n\n\nclass iVectorExtractorConfig(object):\n \"\"\"\n Configuration class for i-vector extractor training\n\n Attributes\n ----------\n ivector_dim : int\n Dimension of the extracted i-vector\n ...
[ 13, 24, 27, 29, 36 ]
#! /usr/bin/env python # -*- coding: utf-8 -*- # auther : xiaojinsong(61627515@qq.com) parts = ['Is', 'Chicago', 'Not', 'Chicago?'] data = ['ACME', 50, 91.1] print(' '.join(parts)) def generate_str(): print(','.join(str(d) for d in data)) def sample(): yield 'Is' yield 'Chicago' yield 'Not' yi...
normal
{ "blob_id": "4ce1e802831f09e503d18fd287cb35400986e3c8", "index": 8095, "step-1": "<mask token>\n\n\ndef generate_str():\n print(','.join(str(d) for d in data))\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef generate_str():\n print(','.join(str(d) for d in data))\n\n\ndef sample():\n yield 'Is'...
[ 1, 2, 4, 5, 6 ]
<|reserved_special_token_0|> def read_file_all(file_name): filename = os.path.join(fileDir, str(file_name)) with open(filename, 'r') as f: read_data = f.readlines() return read_data <|reserved_special_token_0|> def select_file(): Tk().withdraw() filename = askopenfilename() ret...
flexible
{ "blob_id": "da696961fea72e1482beae73c19b042b94d93886", "index": 1660, "step-1": "<mask token>\n\n\ndef read_file_all(file_name):\n filename = os.path.join(fileDir, str(file_name))\n with open(filename, 'r') as f:\n read_data = f.readlines()\n return read_data\n\n\n<mask token>\n\n\ndef selec...
[ 3, 9, 10, 11, 12 ]
# -*- coding: utf-8 -*- """ /*************************************************************************** TileMapScalePlugin A QGIS plugin Let you add tiled datasets (GDAL WMS) and shows them in the correct scale. ------------------- begin ...
normal
{ "blob_id": "f2e2ebd5b848cf3a01b7304e5e194beb3eec1c10", "index": 1214, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef classFactory(iface):\n from .tilemapscaleplugin import TileMapScalePlugin\n return TileMapScalePlugin(iface)\n", "step-3": "# -*- coding: utf-8 -*-\n\"\"\"\n/*************...
[ 0, 1, 2 ]
import math #variables for current GPS Lat / Lon Readings currentLat = 41.391240 currentLon = -73.956217 destLat = 41.393035 destLon = -73.953398 #variables for current UTM coordinates currentX = 587262 currentY = 4582716 destX = 587499 destY = 4582919 #declination angle based on geographic location #see #https://ww...
normal
{ "blob_id": "180d28ac77b6ff4488b3fd9c17a9ee4571e33631", "index": 2694, "step-1": "import math\n\n#variables for current GPS Lat / Lon Readings\ncurrentLat = 41.391240\ncurrentLon = -73.956217\ndestLat = 41.393035\ndestLon = -73.953398\n\n#variables for current UTM coordinates\ncurrentX = 587262\ncurrentY = 45827...
[ 0 ]
from django.urls import reverse_lazy from django.views.generic import CreateView, edit, ListView from django.shortcuts import render from django.contrib.auth import authenticate, login from users.forms import CustomUserCreationForm, LoginForm from users.models import CustomUser as Users class SignUpView(CreateView): ...
normal
{ "blob_id": "6bd9c8e38373e696193c146b88ebf6601170cf0e", "index": 9549, "step-1": "<mask token>\n\n\nclass IndexView(edit.FormView):\n success_url = '/facilities'\n form_class = LoginForm\n template_name = 'users/index.html'\n\n def form_valid(self, form):\n username = form.cleaned_data['userna...
[ 3, 4, 5, 6 ]
version https://git-lfs.github.com/spec/v1 oid sha256:26be7fc8be181fad8e821179cce6be14e37a5f303e532e6fb00f848d5f33fe41 size 752
normal
{ "blob_id": "0f37baf3b08ecf7bd8db43ecc2f29c3ca6e00af0", "index": 3089, "step-1": "version https://git-lfs.github.com/spec/v1\noid sha256:26be7fc8be181fad8e821179cce6be14e37a5f303e532e6fb00f848d5f33fe41\nsize 752\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ]...
[ 0 ]
''' Autor: Jazielinho ''' import keyboard from PIL import ImageGrab import os import tqdm import random from training import config_tr class DataSet(object): ''' clase que crea dataset de entrenamiento ''' saltar = 'saltar' nada = 'nada' reglas = [saltar, nada] formato = 'PNG' train = 'trai...
normal
{ "blob_id": "c931d1ac5c2d003a8eaac3c6d777ce408df57117", "index": 8534, "step-1": "<mask token>\n\n\nclass DataSet(object):\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 genera_datos(self) ->None:\n ...
[ 3, 4, 6, 8, 9 ]
from collections import deque class Queue: def __init__(self): self.container = deque() def enqueue(self, data): self.container.appendleft(data) def dequeue(self): return self.container.pop() def is_empty(self): return len(self.container) == 0 def size(self): ...
normal
{ "blob_id": "2898506b9fd5b112f93a1ff6b010848244c398bd", "index": 7197, "step-1": "<mask token>\n\n\nclass Queue:\n\n def __init__(self):\n self.container = deque()\n\n def enqueue(self, data):\n self.container.appendleft(data)\n\n def dequeue(self):\n return self.container.pop()\n\n...
[ 6, 7, 8, 9, 11 ]
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/ads/googleads_v1/proto/services/user_interest_service.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobu...
normal
{ "blob_id": "654586443e96f84aae70b3ce3263b0458a27334b", "index": 473, "step-1": "<mask token>\n", "step-2": "<mask token>\n_sym_db.RegisterFileDescriptor(DESCRIPTOR)\n<mask token>\n_sym_db.RegisterMessage(GetUserInterestRequest)\n<mask token>\n_sym_db.RegisterServiceDescriptor(_USERINTERESTSERVICE)\n<mask toke...
[ 0, 1, 2, 3, 4 ]
class TreeNode: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class TreeNode: def __init__(self, val): self.val = val self.left = None self.right = None def find(root, val): if not root: return None if val < root.val: ...
flexible
{ "blob_id": "9e525eccbf10a710d6f37c903370cc10f7d2c62b", "index": 8475, "step-1": "class TreeNode:\n <mask token>\n\n\n<mask token>\n", "step-2": "class TreeNode:\n\n def __init__(self, val):\n self.val = val\n self.left = None\n self.right = None\n\n\ndef find(root, val):\n if not...
[ 1, 6, 7, 9, 10 ]
<|reserved_special_token_0|> def preprocess(passengers, columns_to_delete): for column_to_delete in sorted(columns_to_delete, reverse=True): [passenger.pop(column_to_delete) for passenger in passengers] for i in range(len(passengers)): passengers[i][1] = 1.0 if passengers[i][1] == 'female' els...
flexible
{ "blob_id": "87e9c1d264523d02b287dedb44472fc08b488908", "index": 9630, "step-1": "<mask token>\n\n\ndef preprocess(passengers, columns_to_delete):\n for column_to_delete in sorted(columns_to_delete, reverse=True):\n [passenger.pop(column_to_delete) for passenger in passengers]\n for i in range(len(p...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Airplane(Base): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, icao_code, a...
flexible
{ "blob_id": "98dac1ea372f16ecdb818fbe3287ab7e51a0d67c", "index": 7916, "step-1": "<mask token>\n\n\nclass Airplane(Base):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, icao_code, airline, manufacturer=None, ...
[ 3, 4, 5, 7, 8 ]
<|reserved_special_token_0|> class ParGrid: <|reserved_special_token_0|> def __init__(self): self.dims = [] def add_dimension(self, name, i_arg, value_strs, companions=None): self.dims.append(ParGridDimension(name, i_arg, value_strs, companions)) def get_n_dimensions(self): ...
flexible
{ "blob_id": "efe2d6f5da36679b77de32d631cca50c2c1dd29e", "index": 5170, "step-1": "<mask token>\n\n\nclass ParGrid:\n <mask token>\n\n def __init__(self):\n self.dims = []\n\n def add_dimension(self, name, i_arg, value_strs, companions=None):\n self.dims.append(ParGridDimension(name, i_arg,...
[ 11, 14, 16, 18, 19 ]
numbers = [3, 7, 5] maxNumber = 0 for number in numbers: if maxNumber < number: maxNumber = number print maxNumber
normal
{ "blob_id": "2d9d66ea8a95285744b797570bfbeaa17fdc922a", "index": 4036, "step-1": "numbers = [3, 7, 5]\nmaxNumber = 0\nfor number in numbers:\n if maxNumber < number:\n maxNumber = number\n\nprint maxNumber", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ...
[ 0 ]
import pandas as pd from sqlalchemy import create_engine # file = 'testfile.csv' # print(pd.read_csv(file, nrows=5)) with open('testfile_short1.csv', 'r') as original: data = original.read() for i in range(2): with open('testfile_short3.csv', 'a') as modified: modified.write(data)
normal
{ "blob_id": "d7b45e76f150107cd62be160e8938f17dad90623", "index": 58, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('testfile_short1.csv', 'r') as original:\n data = original.read()\nfor i in range(2):\n with open('testfile_short3.csv', 'a') as modified:\n modified.write(data)\n", ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> regr.fit(X_train, y_train) print(regr.score(X_test, y_test)) <|reserved_special_token_0|> print('Mean Absolute Error:', metrics.mean_absolute_error(y_test, y_pred)) print('Mean Squared Error:', metrics.mean_squared_error(y_test, y...
flexible
{ "blob_id": "422491852b80c2fc4a2e73c01fd01acaad4cf9c8", "index": 7573, "step-1": "<mask token>\n", "step-2": "<mask token>\nregr.fit(X_train, y_train)\nprint(regr.score(X_test, y_test))\n<mask token>\nprint('Mean Absolute Error:', metrics.mean_absolute_error(y_test, y_pred))\nprint('Mean Squared Error:', metri...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def diff_in_date(first, second): value = str(second - first) if value.__contains__(','): generated_sum = value.split(',') return generated_sum[0] else: return value <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_...
flexible
{ "blob_id": "9b6d30a40bafa0e9e4760843d6a2f750f0f88a57", "index": 6106, "step-1": "<mask token>\n\n\ndef diff_in_date(first, second):\n value = str(second - first)\n if value.__contains__(','):\n generated_sum = value.split(',')\n return generated_sum[0]\n else:\n return value\n\n\n<...
[ 1, 2, 3, 4 ]
# # Author:: Noah Kantrowitz <noah@coderanger.net> # # Copyright 2014, Noah Kantrowitz # # 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 # # Unles...
normal
{ "blob_id": "a1e563f94044ff7cd7e0e55542bc4ca2db81df28", "index": 9749, "step-1": "<mask token>\n\n\nclass TestUnwrap(object):\n\n @pytest.fixture\n def fn(self):\n\n def fn():\n pass\n return fn\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask toke...
[ 14, 15, 20, 25, 26 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def download(request): if request.method == 'GET': session = request.GET['session'] title = request.GET['download_title'] download_quality = request.GET['download_quality'] file_url = download...
flexible
{ "blob_id": "339506777f5471ec99b39c67c28df8ec3d06ce19", "index": 3084, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef download(request):\n if request.method == 'GET':\n session = request.GET['session']\n title = request.GET['download_title']\n download_quality = request.GE...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> SECRET_KEY = env('DJANGO_SECRET_KEY') ALLOWED_HOSTS = [x.split(':') for x in env.list('DJANGO_ALLOWED_HOSTS')] ADMINS = [x.split(':') for x in env.list('DJANGO_ADMINS')] DATABASES['default'] = env.db('DATABASE_URL') DATABASES['def...
flexible
{ "blob_id": "836df02495ee581f138050be6b7a7a076ea899eb", "index": 4966, "step-1": "<mask token>\n", "step-2": "<mask token>\nSECRET_KEY = env('DJANGO_SECRET_KEY')\nALLOWED_HOSTS = [x.split(':') for x in env.list('DJANGO_ALLOWED_HOSTS')]\nADMINS = [x.split(':') for x in env.list('DJANGO_ADMINS')]\nDATABASES['def...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_blogs_common_data(request, blogs_all_list): page_num = request.GET.get('page', 1) paginator = Paginator(blogs_all_list, settings.BLOGS_PER_PAGE) page_of_blogs = paginator.get_page(page_num) current_page_num = page_of_blogs.number page_range = list(range(max(1, ...
flexible
{ "blob_id": "9731f45b19d40a031216f8a430c09764fd34e984", "index": 2594, "step-1": "<mask token>\n\n\ndef get_blogs_common_data(request, blogs_all_list):\n page_num = request.GET.get('page', 1)\n paginator = Paginator(blogs_all_list, settings.BLOGS_PER_PAGE)\n page_of_blogs = paginator.get_page(page_num)\...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class UserProfile(UserenaBaseProfile): user = models.OneToOneField(User) facebook_id = models.CharField(max_length=128, blank=True, null=True) class Meta: permissions = ('change_profile', 'Change profile'), ('view_profile', 'View profile'), ('delete_profi...
flexible
{ "blob_id": "6e6f153857879da625f57f0382f1997fcae4f6c8", "index": 6041, "step-1": "<mask token>\n\n\nclass UserProfile(UserenaBaseProfile):\n user = models.OneToOneField(User)\n facebook_id = models.CharField(max_length=128, blank=True, null=True)\n\n\n class Meta:\n permissions = ('change_profile...
[ 2, 3, 4, 5, 6 ]
"""main.py""" import tkinter as tk from tkinter import ttk from ttkthemes import ThemedStyle import wikipedia as wk from newsapi import NewsApiClient as nac import datetime import random class MainWindow: """Application controller object.""" def __init__(self): self.p = None self...
normal
{ "blob_id": "874fa927a1c0f1beeb31ca7b0de7fd2b16218ea4", "index": 2756, "step-1": "<mask token>\n\n\nclass MainWindow:\n <mask token>\n <mask token>\n\n def search_wikipedia(self):\n \"\"\"Safely browse wikipedia articles.\"\"\"\n self.summary.delete('1.0', tk.END)\n possibilities = ...
[ 8, 9, 11, 12, 13 ]
import code2 print ("Main en code1: %s\n" % __name__)
normal
{ "blob_id": "ecbc1da3efb39300b60aeb47897fb01b6bd7af31", "index": 6028, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Main en code1: %s\\n' % __name__)\n", "step-3": "import code2\nprint('Main en code1: %s\\n' % __name__)\n", "step-4": "\nimport code2\nprint (\"Main en code1: %s\\n\" % __name_...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def handler(event: Dict, context: Dict): """AWS Lambda handler.""" granule = event.get('granule') prefix = granule[0:-6] print(prefix) response = s3.list_objects_v2(Bucket=bucket, Prefix=prefix) print(response) granules = [] contents = response['Contents'] ...
flexible
{ "blob_id": "d2b05c5653ca6c6b7219f6c0393e81c9425b5977", "index": 279, "step-1": "<mask token>\n\n\ndef handler(event: Dict, context: Dict):\n \"\"\"AWS Lambda handler.\"\"\"\n granule = event.get('granule')\n prefix = granule[0:-6]\n print(prefix)\n response = s3.list_objects_v2(Bucket=bucket, Pre...
[ 1, 2, 3, 4, 5 ]
class Caine: <|reserved_special_token_0|> class Pisica: def sunet(self): print('miau') <|reserved_special_token_0|> <|reserved_special_token_1|> class Caine: def sunet(self): print('ham ham') class Pisica: def sunet(self): print('miau') def asculta_sunet(tipul_anima...
flexible
{ "blob_id": "594fdec916520014faff80dd06c7a5553320664d", "index": 4746, "step-1": "class Caine:\n <mask token>\n\n\nclass Pisica:\n\n def sunet(self):\n print('miau')\n\n\n<mask token>\n", "step-2": "class Caine:\n\n def sunet(self):\n print('ham ham')\n\n\nclass Pisica:\n\n def sunet(...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def bwd(world): if world.state >= states.Config: return left(world) world.shouldRedraw = True world.state = states.Intro def draw(world): if not world.shouldRedraw: return r = world.worldsurf_rect world.worldsurf.fill(world.bg_color) perfdata ...
flexible
{ "blob_id": "8650e0f1e7f2ac42c3c78191f79810f5befc9f41", "index": 3298, "step-1": "<mask token>\n\n\ndef bwd(world):\n if world.state >= states.Config:\n return left(world)\n world.shouldRedraw = True\n world.state = states.Intro\n\n\ndef draw(world):\n if not world.shouldRedraw:\n retur...
[ 2, 3, 4, 5, 6 ]
# ------------------------------------------ # # Project: VEXcode VR Maze Solver # Author: Hyunwoo Choi # Created: January 12 2021 # Description: Solves a VEXcode VR maze using the right hand rule # # ------------------------------------------ # Library imports from vexcode import * #main def main...
normal
{ "blob_id": "e560f2f202e477822729d1361b8d7ef7831a00e6", "index": 8339, "step-1": "<mask token>\n\n\ndef checkSides():\n rightC, frontC, leftC = True, True, True\n drivetrain.turn_for(RIGHT, 90, DEGREES)\n if front_eye.near_object() and distance.get_distance(MM) < 3000:\n rightC = False\n drive...
[ 2, 3, 4, 5, 6 ]
""" Various utilities for neural networks implemented by Paddle. This code is rewritten based on: https://github.com/openai/guided-diffusion/blob/main/guided_diffusion/nn.py """ import math import paddle import paddle.nn as nn class SiLU(nn.Layer): def forward(self, x): return x * nn.functional.sigmoid(...
normal
{ "blob_id": "364d70fab02291bafadebea68fee94c0210e2de9", "index": 4365, "step-1": "<mask token>\n\n\nclass SiLU(nn.Layer):\n\n def forward(self, x):\n return x * nn.functional.sigmoid(x)\n\n\nclass GroupNorm32(nn.GroupNorm):\n\n def forward(self, x):\n return super().forward(x)\n\n\n<mask toke...
[ 9, 11, 12, 14, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ap.add_argument('-m', '--model', required=True, help= 'path to trained model model') ap.add_argument('-l', '--categorybin', required=True, help= 'path to output category label binarizer') ap.add_argument('-c', '--colorbin'...
flexible
{ "blob_id": "8ff9961c1415c04899bbc15ba64811a1b3ade262", "index": 3082, "step-1": "<mask token>\n", "step-2": "<mask token>\nap.add_argument('-m', '--model', required=True, help=\n 'path to trained model model')\nap.add_argument('-l', '--categorybin', required=True, help=\n 'path to output category label ...
[ 0, 1, 2, 3, 4 ]
import requests import time import csv import os import pandas as pd col_list1 = ["cardtype","username_opensea", "address", "username_game"] df1 = pd.read_csv("profiles.csv", usecols=col_list1) # for j in range(0,len(df1) ): #usernames in opensea print(j) user=[] proto=[] purity=[] ...
normal
{ "blob_id": "93909ab98f1141940e64e079e09834ae5ad3995f", "index": 6537, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor j in range(0, len(df1)):\n print(j)\n user = []\n proto = []\n purity = []\n card_name = []\n card_effect = []\n god = []\n rarity = []\n mana = []\n typ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class DbManager: def __init__(self, fname=None, tname=None): if fname: self.FILE_NAME = fname else: self.FILE_NAME = 'resources/static/LOG_Temp.db' if tname: self.TABLE_NAME = tname else: self.TABLE_NAME ...
flexible
{ "blob_id": "38bd9e5b2147838b6061925d72b989c83343f1c2", "index": 9800, "step-1": "<mask token>\n\n\nclass DbManager:\n\n def __init__(self, fname=None, tname=None):\n if fname:\n self.FILE_NAME = fname\n else:\n self.FILE_NAME = 'resources/static/LOG_Temp.db'\n if tn...
[ 31, 37, 39, 44, 50 ]
n = int(input('Informe um numero: ')) print('----------------') print('{} x {:2} = {:2}'.format(n, 1, 1 * n)) print('{} x {:2} = {:2}'.format(n, 2, 2 * n)) print('{} x {:2} = {:2}'.format(n, 3, 3 * n)) print('{} x {:2} = {:2}'.format(n, 4, 4 * n)) print('{} x {:2} = {:2}'.format(n, 5, 5 * n)) print('{} x {:2} = {:2}'.f...
normal
{ "blob_id": "9e814e3f1162e248c5d778c2df9960b199854a27", "index": 9306, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('----------------')\nprint('{} x {:2} = {:2}'.format(n, 1, 1 * n))\nprint('{} x {:2} = {:2}'.format(n, 2, 2 * n))\nprint('{} x {:2} = {:2}'.format(n, 3, 3 * n))\nprint('{} x {:2} = ...
[ 0, 1, 2 ]
import re import requests def download_image(url: str) -> bool: img_tag_regex = r"""<img.*?src="(.*?)"[^\>]+>""" response = requests.get(url) if response.status_code != 200: return False text = response.text image_links = re.findall(img_tag_regex, text) for link in image_links: ...
normal
{ "blob_id": "268c36f6fb99383ea02b7ee406189ffb467d246c", "index": 6554, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef download_image(url: str) ->bool:\n img_tag_regex = '<img.*?src=\"(.*?)\"[^\\\\>]+>'\n response = requests.get(url)\n if response.status_code != 200:\n return False...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_outputs(): cmd = ['swaymsg', '-t', 'get_outputs'] proc_result = subprocess.run(cmd, capture_output=True).stdout.decode() proc_json = json.loads(proc_result) return [output['name'] for output in proc_json] <|reserved_special_token_0|> <|reserved_special_token_1|...
flexible
{ "blob_id": "46b1991bba83968466390d306a4415b362b6a868", "index": 3140, "step-1": "<mask token>\n\n\ndef get_outputs():\n cmd = ['swaymsg', '-t', 'get_outputs']\n proc_result = subprocess.run(cmd, capture_output=True).stdout.decode()\n proc_json = json.loads(proc_result)\n return [output['name'] for o...
[ 1, 2, 3, 5, 6 ]
from eval_lib.classification_results import analyze_one_classification_result from eval_lib.classification_results import ClassificationBatches from eval_lib.cloud_client import CompetitionDatastoreClient from eval_lib.cloud_client import CompetitionStorageClient from eval_lib.dataset_helper import DatasetMetadata from...
normal
{ "blob_id": "64935ae910d5f330722b637dcc5794e7e07ab52d", "index": 8375, "step-1": "<mask token>\n", "step-2": "from eval_lib.classification_results import analyze_one_classification_result\nfrom eval_lib.classification_results import ClassificationBatches\nfrom eval_lib.cloud_client import CompetitionDatastoreC...
[ 0, 1 ]
#!/usr/bin/env python #--coding: utf8-- import time if __name__ == '__main__': date = time.strftime('%m-%d') if date == '03-08': print '女神节' elif date == '02-14': print '情人节' else: print '发红包' print '这是一个测试题'
normal
{ "blob_id": "23375760c0943ca177b7009031d9d17a91165c5c", "index": 230, "step-1": "#!/usr/bin/env python\n#--coding: utf8--\nimport time\n\nif __name__ == '__main__':\n date = time.strftime('%m-%d')\n if date == '03-08':\n print '女神节'\n elif date == '02-14':\n print '情人节'\n else:\n ...
[ 0 ]
import graphics import ply.lex as lex import ply.yacc as yacc import jstokens import jsgrammar def interpret(trees): # Hello, friend for tree in trees: # Hello, # ("word-element","Hello") nodetype=tree[0] # "word-element" if nodetype == "word-element": graphics.word(tree[1]) ...
normal
{ "blob_id": "f3b3bee494493263f8b00827e6f3ff3a1dcd8c37", "index": 6144, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef interpret(trees):\n for tree in trees:\n nodetype = tree[0]\n if nodetype == 'word-element':\n graphics.word(tree[1])\n elif nodetype == 'tag-el...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "56157aaf3f98abc58572b45111becb91cb93f328", "index": 2926, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python # The program was written by YU Ho Yung and LEUNG Kin Tung in group 24. # The program is written with stubs for the phase 3 # import pymongo from scrapy.selector import Selector import pandas as pd # import numpy as np import datetime import re import pprint import subprocess import scrapy from pym...
normal
{ "blob_id": "b3a07107ef64bb50f4768954cbb579d8e66bd003", "index": 6612, "step-1": "<mask token>\n\n\ndef isCourseCode(corseCode):\n try:\n matchObj = re.match('[A-Z]?[A-Z]?[A-Z]?[A-Z]?\\\\d?\\\\d?\\\\d?\\\\d?([A-Z]?)',\n str(corseCode))\n if matchObj != None:\n return True\n...
[ 6, 13, 14, 18, 19 ]
<|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_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "6239cb08509b8e84a88db95479af05845876d9b6", "index": 1502, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(str1 and str2) <|reserved_special_token_0|> for c in str1: if c in str2: nPos = str1.index(c) break print(nPos) <|reserved_special_token_1|> str1 = '12345678' str2 = '456' print(str1 and str2) str1 = '...
flexible
{ "blob_id": "5c30b0e952ddf2e05a7ad5f8d9bbd4f5e22f887d", "index": 62, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(str1 and str2)\n<mask token>\nfor c in str1:\n if c in str2:\n nPos = str1.index(c)\n break\nprint(nPos)\n", "step-3": "str1 = '12345678'\nstr2 = '456'\nprint(str1 ...
[ 0, 1, 2, 3 ]
from django.contrib import admin from basic_app.models import UserProfileInfo admin.site.register(UserProfileInfo) # we do not need to register User() default form since it comes # with the default admin site in Django itself.
normal
{ "blob_id": "624212a1d73ff3a3b3092ffa27912a6ae25a2484", "index": 6826, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(UserProfileInfo)\n", "step-3": "from django.contrib import admin\nfrom basic_app.models import UserProfileInfo\nadmin.site.register(UserProfileInfo)\n", "step-4": ...
[ 0, 1, 2, 3 ]
""" Read all the images from a directory, resize, rescale and rename them. """
normal
{ "blob_id": "670efbd9879099b24a87e19a531c4e3bbce094c6", "index": 1666, "step-1": "<mask token>\n", "step-2": "\n\n\"\"\"\nRead all the images from a directory,\nresize, rescale and rename them.\n\"\"\"\n\n\n\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print( 'Leer 10 números enteros, almacenarlos en un vector y determinar en qué posiciones se encuentran los números con mas de 3 dígitos' ) <|reserved_special_token_0|> while count < 11: numero = int(input('Introduzca su %d numero:' % count)) ...
flexible
{ "blob_id": "9dd5db441044c808274493f16a912d1b65a6c28b", "index": 5911, "step-1": "<mask token>\n", "step-2": "print(\n 'Leer 10 números enteros, almacenarlos en un vector y determinar en qué posiciones se encuentran los números con mas de 3 dígitos'\n )\n<mask token>\nwhile count < 11:\n numero = int(...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> routeList = ('payment', PaymentViewSet), <|reserved_special_token_1|> <|reserved_special_token_0|> from rolca.payment.api.views import PaymentViewSet routeList = ('payment', PaymentViewSet), <|reserved_special_token_1|> """....
flexible
{ "blob_id": "2bfdc259bcd5ff058ee8661a14afd8a915b8372b", "index": 7020, "step-1": "<mask token>\n", "step-2": "<mask token>\nrouteList = ('payment', PaymentViewSet),\n", "step-3": "<mask token>\nfrom rolca.payment.api.views import PaymentViewSet\nrouteList = ('payment', PaymentViewSet),\n", "step-4": "\"\"\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @admin.register(ImageAd) class AdminImageAd(admin.ModelAdmin): pass <|reserved_special_token_1|> <|reserved_special_token_0|> @admin.register(Advert) class AdminAdvert(admin.ModelAdmin): <|reserved_special_token_0|> @admin.register(Category) class AdminCategory(admin.ModelA...
flexible
{ "blob_id": "fdcee5b3f6b3ec170c9ef3017e0cc6c4b28cf22d", "index": 454, "step-1": "<mask token>\n\n\n@admin.register(ImageAd)\nclass AdminImageAd(admin.ModelAdmin):\n pass\n", "step-2": "<mask token>\n\n\n@admin.register(Advert)\nclass AdminAdvert(admin.ModelAdmin):\n <mask token>\n\n\n@admin.register(Cate...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class GpuThread(threading.Thread): <|reserved_special_token_0|> def run(self): i = 0 while True: result_dict = self.que_det.get(block=True) try: print(time.ctime(), ' ', result_dict['json_id'], ' Using GP...
flexible
{ "blob_id": "8035f195cd01dc50691cd93ea91a6377b1d83f24", "index": 1166, "step-1": "<mask token>\n\n\nclass GpuThread(threading.Thread):\n <mask token>\n\n def run(self):\n i = 0\n while True:\n result_dict = self.que_det.get(block=True)\n try:\n print(time....
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class fwrapper: def __init__(self, function, childcount, name): self.function = function self.childcount = childcount self.name = name <|reserved_special_token_0|> class node: def __init__(self, fw, children): self.function = fw.function ...
flexible
{ "blob_id": "89881f3cc6703b3f43f5d2dae87fa943d8a21513", "index": 5485, "step-1": "<mask token>\n\n\nclass fwrapper:\n\n def __init__(self, function, childcount, name):\n self.function = function\n self.childcount = childcount\n self.name = name\n\n\n<mask token>\n\n\nclass node:\n\n de...
[ 23, 25, 28, 31, 34 ]
""" This is a post login API and hence would have APIDetails and SessionDetails in the request object ------------------------------------------------------------------------------------------------- Step 1: find if user's ip address is provided in the request object, if yes then got to step 2 else goto step 4 Step 2: ...
normal
{ "blob_id": "d7daf9b26f0b9f66b15b8533df032d17719e548b", "index": 3343, "step-1": "<mask token>\n", "step-2": "\"\"\"\nThis is a post login API and hence would have APIDetails and SessionDetails in the request object\n----------------------------------------------------------------------------------------------...
[ 0, 1 ]
<|reserved_special_token_0|> class ImageData: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, image): self.image = image self._contour_interval_dist = None ...
flexible
{ "blob_id": "d3be26d56b3597a5d9e3a870b735a30d90d1e501", "index": 8165, "step-1": "<mask token>\n\n\nclass ImageData:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, image):\n self.image = image\n self._contour_interval_dist = None\...
[ 6, 10, 11, 12, 17 ]
import ast import datetime import json from base64 import b64encode import requests IMGUR_BASE = "https://api.imgur.com" class Task: """ A class used to represent a job ... Attributes ---------- queue : list the list of all urls pending : list the name of all pending urls...
normal
{ "blob_id": "63ee99012089dcb0e5b41860c95e13fff52c6731", "index": 1546, "step-1": "<mask token>\n\n\nclass Task:\n <mask token>\n\n def __init__(self):\n \"\"\"\n Create the object\n :rtype: object\n \"\"\"\n self.queue = list()\n self.pending = []\n self.com...
[ 8, 9, 12, 13, 14 ]
<|reserved_special_token_0|> class AppendTrailingSlashHandler(webapp2.RequestHandler): def get(self, uri): self.response.set_status(301) redirect_uri = uri + '/' self.response.headers['Location'] = redirect_uri self.response.headers['Content-Type'] = 'text/plain' self.resp...
flexible
{ "blob_id": "064792a6aba96a679bec606a85b19d4925861f7d", "index": 2493, "step-1": "<mask token>\n\n\nclass AppendTrailingSlashHandler(webapp2.RequestHandler):\n\n def get(self, uri):\n self.response.set_status(301)\n redirect_uri = uri + '/'\n self.response.headers['Location'] = redirect_u...
[ 2, 3, 4, 6, 7 ]
import os import numpy as np import scipy as sp import sys from sure import that from itertools import combinations, permutations input_file = open('input1.txt', 'r') output_file = open('output1.txt', 'w') T = int(input_file.readline().rstrip('\n')) case_num = 1 while case_num - 1 < T: # Parse data data = ma...
normal
{ "blob_id": "10c8316aee2107dc84ce7c1427dd62f52a2ce697", "index": 4549, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile case_num - 1 < T:\n data = map(int, input_file.readline().rstrip('\\n').split(' '))\n typed = data[0]\n length = data[1]\n probs = map(float, input_file.readline().rstri...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Sun Nov 8 22:11:53 2020 @author: Rick """ sum= 0; with open('workRecord.txt') as fp: for line in fp.readlines(): idx= line.rfind('x',len(line)-8,len(line)) if idx>=0: sum+= float(line.rstrip()[idx+1:len(line)]) else: sum+= 1 pr...
normal
{ "blob_id": "b838d2230cb3f3270e86807e875df4d3d55438cd", "index": 8891, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('workRecord.txt') as fp:\n for line in fp.readlines():\n idx = line.rfind('x', len(line) - 8, len(line))\n if idx >= 0:\n sum += float(line.rstrip()[...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def process_image(image): draw_image = np.copy(image) window_list_32 = slide_window(image, y_start_stop=y_start_stop_32, xy_window=(32, 32), xy_overlap=xy_overlap_32) window_list_64 = slide_window(image, y_st...
flexible
{ "blob_id": "89db4431a252d024381713eb7ad86346814fcbe4", "index": 7955, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef process_image(image):\n draw_image = np.copy(image)\n window_list_32 = slide_window(image, y_start_stop=y_start_stop_32,\n xy_window=(32, 32), xy_overlap=xy_overlap_3...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while i < len(questions): user_answers = input('{}...'.format(questions[i])) if user_answers.capitalize() == answers[i]: count_answers = count_answers + 1 i += 1 print('Было задано {i} вопросов. Правильных отве...
flexible
{ "blob_id": "dd936839d71b97b3a21115498092d8984de0e3f1", "index": 7445, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile i < len(questions):\n user_answers = input('{}...'.format(questions[i]))\n if user_answers.capitalize() == answers[i]:\n count_answers = count_answers + 1\n i += 1\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(s2) s1.add(100) print(s1.pop()) print(10 in s1) print(10 not in s1) <|reserved_special_token_1|> s1 = {10, 20, 30, 60, 70, 80, 90} s2 = set() print(s2) s1.add(100) print(s1.pop()) print(10 in s1) print(10 not in s1)
flexible
{ "blob_id": "3747e45dcba548060f25bd6d6f0e0e96091ca3df", "index": 2358, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(s2)\ns1.add(100)\nprint(s1.pop())\nprint(10 in s1)\nprint(10 not in s1)\n", "step-3": "s1 = {10, 20, 30, 60, 70, 80, 90}\ns2 = set()\nprint(s2)\ns1.add(100)\nprint(s1.pop())\nprin...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def parse_text(request): if request.method == 'POST': text = request.POST.get('the_text') phone_number_list = [] matches = re.findall( '\\(?(\\d{3})\\)?[\\.\\-]?\\s*(\\d{3})\\s*[\\.\\-]?\\...
flexible
{ "blob_id": "d27a7ca04e12d50aca5a9f9db199102dbeb4e9f1", "index": 7678, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef parse_text(request):\n if request.method == 'POST':\n text = request.POST.get('the_text')\n phone_number_list = []\n matches = re.findall(\n '\\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Retriever(base): def _retrieveResultsFor(self, computation): director = self.director db = director.clerk.db orm = director.clerk.orm analysisObj = orm.record2object(computation) self.declareProgress(0.1, 'look up job') job = comp...
flexible
{ "blob_id": "721e014bc5bf53a39556e31f281b77b90508cf12", "index": 7138, "step-1": "<mask token>\n\n\nclass Retriever(base):\n\n def _retrieveResultsFor(self, computation):\n director = self.director\n db = director.clerk.db\n orm = director.clerk.orm\n analysisObj = orm.record2objec...
[ 2, 3, 4, 5, 6 ]
import os import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') def test_configuration(host): sshd = host.file('/etc/ssh/sshd_config') assert sshd.contains(r'^PermitRootLogin no$') assert sshd.co...
normal
{ "blob_id": "2345d1f72fb695ccec5af0ed157c0606f197009c", "index": 3398, "step-1": "<mask token>\n\n\ndef test_configuration(host):\n sshd = host.file('/etc/ssh/sshd_config')\n assert sshd.contains('^PermitRootLogin no$')\n assert sshd.contains('^X11Forwarding no$')\n assert sshd.contains('^UsePAM yes$...
[ 1, 2, 3, 4, 5 ]
# Generated by Django 3.0.7 on 2020-07-03 11:08 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('descriptor', '0007_auto_20200702_1653'), ] operations = [ migrations.CreateModel( name='Paramet...
normal
{ "blob_id": "3a5d55ea5a2f4f6cf7aaf55055593db9f8bb3562", "index": 6308, "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 = [('descriptor'...
[ 0, 1, 2, 3, 4 ]
myDict = {'Friends': ['AP', 'Soham', 'Baba'], 'Likes': ['Math', 'Programming'], 'languages': ['C++', 'Python', 'Java']} myInt = 123 myFloat = 12.3333 myName = 'Somesh Thakur'
normal
{ "blob_id": "345967e2aeafda6ce30cbbbbacf976c97b17def7", "index": 515, "step-1": "<mask token>\n", "step-2": "myDict = {'Friends': ['AP', 'Soham', 'Baba'], 'Likes': ['Math',\n 'Programming'], 'languages': ['C++', 'Python', 'Java']}\nmyInt = 123\nmyFloat = 12.3333\nmyName = 'Somesh Thakur'\n", "step-3": nul...
[ 0, 1 ]
""" The MIT License (MIT) Copyright (c) 2021-present Pycord Development Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, ...
normal
{ "blob_id": "a73dcfc21c31d4e984db39c072d11cb9a9c3d5e5", "index": 2470, "step-1": "<mask token>\n\n\nclass ScheduledEventSubscriber(TypedDict):\n guild_scheduled_event_id: Snowflake\n user: User\n member: Member | None\n", "step-2": "<mask token>\n\n\nclass ScheduledEvent(TypedDict):\n id: Snowflake...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class User(object): def __init__(self, meta): meta.update({'groups': meta.get('groups', []) + [meta['username']]}) self.meta = meta @property def username(self): return self.meta['username'] <|reserved_special_token_0|> <|reserved_special_toke...
flexible
{ "blob_id": "aa47b7c74b9b6b8a7f014de4bd58236edeba485d", "index": 5971, "step-1": "<mask token>\n\n\nclass User(object):\n\n def __init__(self, meta):\n meta.update({'groups': meta.get('groups', []) + [meta['username']]})\n self.meta = meta\n\n @property\n def username(self):\n retur...
[ 9, 11, 12, 13, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def small_enough(array, limit): counter = '' for arr in array: if arr <= limit: counter += 'True,' else: counter += 'False,' if 'False' in counter: return False else: return True <|rese...
flexible
{ "blob_id": "117b340b13b9b1c53d3df1646cd5924f0118ab5d", "index": 5512, "step-1": "<mask token>\n", "step-2": "def small_enough(array, limit):\n counter = ''\n for arr in array:\n if arr <= limit:\n counter += 'True,'\n else:\n counter += 'False,'\n if 'False' in cou...
[ 0, 1, 2 ]
class Solution(object): def minimumTotal(self, triangle): """ :type triangle: List[List[int]] :rtype: int """ t = triangle if len(t) == 1: return t[0][0] ret = [0] * len(t) ret[0] = t[0][0] for i in range(1, len(t)): fo...
normal
{ "blob_id": "84515ef6879b54b333f9afd48c6c4b7c43ff6957", "index": 1068, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n", "step-3": "class Solution(object):\n\n def minimumTotal(self, triangle):\n \"\"\"\n :type triangle: List[List[int]]\n :rtype: int...
[ 0, 1, 2 ]
class Solution: def search(self, nums: List[int], target: int) -> int: n = len(nums) left, right = 0, n-1 found = False res = None while left <= right: mid = left + (right - left) // 2 if nums[mid] == target: found = True ...
normal
{ "blob_id": "1fe6fab717a77f13ddf7059ef0a5aaef217f0fb0", "index": 5525, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "class Solution:\n\n def search(self, nums: List[int], target: int) ->int:\n n = len(nums)\n left, right = 0, n - 1\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @app.route('/', methods=['GET']) def index(): """ Renders Index.html """ try: return render_template('index.html') except Exception as e: print('Exception Occurred', e) return jsonify({'status': 'failed', 'message': 'Something Went Wrong !!'...
flexible
{ "blob_id": "860f77b031c815df40a16669dae8d32af4afa5bf", "index": 868, "step-1": "<mask token>\n\n\n@app.route('/', methods=['GET'])\ndef index():\n \"\"\" Renders Index.html \"\"\"\n try:\n return render_template('index.html')\n except Exception as e:\n print('Exception Occurred', e)\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class LoginAPI(generics.GenericAPIView): <|reserved_special_token_0|> <|reserved_special_token_0|> class ChangePasswordAPI(generics.UpdateAPIView): permission_classes = [permissions.IsAuthenticated] serializer_class = ChangePasswordSerializer def update(self, reques...
flexible
{ "blob_id": "5d6ec1b23dcbc935fe80dd09a2e967eb7e37a363", "index": 5645, "step-1": "<mask token>\n\n\nclass LoginAPI(generics.GenericAPIView):\n <mask token>\n <mask token>\n\n\nclass ChangePasswordAPI(generics.UpdateAPIView):\n permission_classes = [permissions.IsAuthenticated]\n serializer_class = Ch...
[ 8, 9, 10, 14, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('./csvs/users.csv', encoding='utf-8', newline='') as users_csv: reader = csv.reader(users_csv) d = {} for row in reader: userId, profileName = row if profileName == 'A Customer': c...
flexible
{ "blob_id": "3b77f7ea5137174e6723368502659390ea064c5a", "index": 8968, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('./csvs/users.csv', encoding='utf-8', newline='') as users_csv:\n reader = csv.reader(users_csv)\n d = {}\n for row in reader:\n userId, profileName = row\n ...
[ 0, 1, 2, 3 ]
from django.shortcuts import render, get_object_or_404, redirect #from emailupdate.forms import emailupdate_form from forms import EmailForm from django.utils import timezone def index(request): if request.method == "POST": form = EmailForm(request.POST) if form.is_valid(): post = form.save(commit=False) po...
normal
{ "blob_id": "f2cdee7e5eebaeeb784cb901c3ac6301e90ac7b9", "index": 866, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef index(request):\n if request.method == 'POST':\n form = EmailForm(request.POST)\n if form.is_valid():\n post = form.save(commit=False)\n post...
[ 0, 1, 2, 3, 4 ]
##Extras def permissao(): editor = False for row in session.auth.user_groups: grupo = session.auth.user_groups[row] if (grupo == "gerenciador") or (grupo == "administrador"): editor = True return editor
normal
{ "blob_id": "70de2bed00aabe3805c3a19da004713d4109568a", "index": 9036, "step-1": "<mask token>\n", "step-2": "def permissao():\n editor = False\n for row in session.auth.user_groups:\n grupo = session.auth.user_groups[row]\n if grupo == 'gerenciador' or grupo == 'administrador':\n ...
[ 0, 1, 2 ]
import numpy as np from scipy import stats from scipy import interpolate from math import factorial from scipy import signal """ A continuous wavelet transform based peak finder. Tested exclusively on Raman spectra, however, it should work for most datasets. Parameters ---------- lowerBound: The lowest value of the...
normal
{ "blob_id": "8f5d9918260e2f50fb229a7067f820a186101b99", "index": 1080, "step-1": "<mask token>\n\n\nclass _spectra:\n\n def __init__(self, x, y):\n self.x = x\n self.y = y\n <mask token>\n\n def y(self):\n return intensities\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass...
[ 3, 5, 6, 8, 11 ]
<|reserved_special_token_0|> @app.route('/') def signin(): return render_template('index.html') <|reserved_special_token_0|> @app.route('/login', methods=['POST']) def login(): mysql = connectToMySQL(DATABASE) query = 'SELECT * FROM users WHERE email = %(em)s;' data = {'em': request.form['email']}...
flexible
{ "blob_id": "e732fa0e2b377a87b8b088303b277cc08cb695b3", "index": 5279, "step-1": "<mask token>\n\n\n@app.route('/')\ndef signin():\n return render_template('index.html')\n\n\n<mask token>\n\n\n@app.route('/login', methods=['POST'])\ndef login():\n mysql = connectToMySQL(DATABASE)\n query = 'SELECT * FRO...
[ 9, 10, 12, 13, 15 ]
""" Creates a ResNeXt Model as defined in: Xie, S., Girshick, R., Dollar, P., Tu, Z., & He, K. (2016). Aggregated residual transformations for deep neural networks. arXiv preprint arXiv:1611.05431. import from https://github.com/prlz77/ResNeXt.pytorch/blob/master/models/model.py """ import torch import torch.nn as nn ...
normal
{ "blob_id": "50ed1512b0e6ff8e01f5d4aa034406fa78850176", "index": 2293, "step-1": "<mask token>\n\n\nclass CifarResNeXt(nn.Module):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass ResNeXtBottleneck(nn.Module):\n <mask token>\n\n...
[ 1, 8, 10, 11, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print( 'Give the length of each side in order to compute the area of a triangle.') <|reserved_special_token_0|> print('The triangle area is:', triangleArea) <|reserved_special_token_1|> <|reserved_special_token_0|> print( ...
flexible
{ "blob_id": "398cb05218a9772a0b62fdfbacc465b26427827d", "index": 2854, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\n 'Give the length of each side in order to compute the area of a triangle.')\n<mask token>\nprint('The triangle area is:', triangleArea)\n", "step-3": "<mask token>\nprint(\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def my_add(a, b): return a + b <|reserved_special_token_1|> import sys import os def my_add(a, b): return a + b
flexible
{ "blob_id": "cc81e13bba0ea0186966bce7f5aac05bb106e971", "index": 5935, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef my_add(a, b):\n return a + b\n", "step-3": "import sys\nimport os\n\n\ndef my_add(a, b):\n return a + b\n", "step-4": null, "step-5": null, "step-ids": [ 0, ...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function from abc import ABCMeta, abstractmethod from six import with_metaclass from .utils import parse_query_parameters class CollectionMixin(with_metaclass(ABCMeta, object)): @abstractmethod def list(self, size=100, offset=None, **fil...
normal
{ "blob_id": "b63ed9e09b9e8c539aff765d719f3610283663fe", "index": 4496, "step-1": "<mask token>\n\n\nclass CollectionMixin(with_metaclass(ABCMeta, object)):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass CollectionMixin(with_metaclass(ABCMeta, object)):\n <mask token>\n\n def i...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> _basedir = os.path.abspath(os.path.dirname(__file__)) DEBUG = True SECRET_KEY = '06A52C5B30EC2960310B45E4E0FF21C5D6C86C47D91FE19FA5934EFF445276A0' SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(_basedir, 'app.db') SQLALCHEM...
flexible
{ "blob_id": "6ee71cf61ae6a79ec0cd06f1ddc7dc614a76c7b9", "index": 6547, "step-1": "<mask token>\n", "step-2": "<mask token>\n_basedir = os.path.abspath(os.path.dirname(__file__))\nDEBUG = True\nSECRET_KEY = '06A52C5B30EC2960310B45E4E0FF21C5D6C86C47D91FE19FA5934EFF445276A0'\nSQLALCHEMY_DATABASE_URI = 'sqlite:///...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def select_histograms(wrp): use_this = True if use_cuts and all('NoGenSel-' + c not in wrp.in_file_path for c in current_cuts): use_this = False if wrp.name.startswith('cf_'): use_this = False if use_histos and all(c not in wrp.in_file_path for c in...
flexible
{ "blob_id": "05ced056bf2f59f85bef82e53803e7df7ff8c8df", "index": 1156, "step-1": "<mask token>\n\n\ndef select_histograms(wrp):\n use_this = True\n if use_cuts and all('NoGenSel-' + c not in wrp.in_file_path for c in\n current_cuts):\n use_this = False\n if wrp.name.startswith('cf_'):\n ...
[ 10, 13, 14, 18, 20 ]
from search import SearchEngine import tkinter as tk if __name__ == "__main__": ghettoGoogle = SearchEngine() def searchButtonEvent(): search_query = searchQueryWidget.get() search_results = ghettoGoogle.search(search_query) resultsCanvas = tk.Tk() if search_results == None: ...
normal
{ "blob_id": "0cf90cd7704db9f7467e458b402fadb01c701148", "index": 7307, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n ghettoGoogle = SearchEngine()\n\n def searchButtonEvent():\n search_query = searchQueryWidget.get()\n search_results = ghettoGoogle.search...
[ 0, 1, 2, 3 ]
from layers import TrueSkillFactorGraph from math import e, sqrt from numerics import atLeast, _Vector, _DiagonalMatrix, Matrix from objects import SkillCalculator, SupportedOptions, argumentNotNone, \ getPartialPlayPercentage, sortByRank class FactorGraphTrueSkillCalculator(SkillCalculator): def __init__(self): s...
normal
{ "blob_id": "009be282e45d191eb8f4d7d2986a2f182d64c1dd", "index": 2935, "step-1": "<mask token>\n\n\nclass FactorGraphTrueSkillCalculator(SkillCalculator):\n\n def __init__(self):\n super(FactorGraphTrueSkillCalculator, self).__init__(\n SupportedOptions.PARTIAL_PLAY | SupportedOptions.PARTIA...
[ 6, 7, 8, 9, 10 ]
#!/usr/bin/env python import rospy import rosnode import csv import datetime import rosbag import sys import os import matplotlib.pyplot as plt import argparse import math from math import hypot import numpy as np from sensor_msgs.msg import LaserScan from std_msgs.msg import String import yaml as yaml start_time = Non...
normal
{ "blob_id": "c00a8bfec46ed829e413257bf97c44add564080d", "index": 8349, "step-1": "#!/usr/bin/env python\nimport rospy\nimport rosnode\nimport csv\nimport datetime\nimport rosbag\nimport sys\nimport os\nimport matplotlib.pyplot as plt\nimport argparse\nimport math\nfrom math import hypot\nimport numpy as np\nfrom...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def fight_use(user, reply, room): return 200 <|reserved_special_token_1|> name = 'Ледяная скорбь' description = ( 'Тот кто держит этот клинок, должен обладать бесконечной силой. Подобно тому, как он разрывает плоть, о...
flexible
{ "blob_id": "7254e74ff3f562613cc610e4816a2d92b6b1cd4c", "index": 6074, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fight_use(user, reply, room):\n return 200\n", "step-3": "name = 'Ледяная скорбь'\ndescription = (\n 'Тот кто держит этот клинок, должен обладать бесконечной силой. Подобн...
[ 0, 1, 2, 3 ]
array = [1, 7, 3, 8, 9, 2, 4] index = 0 while (index < len(array)): count = 0 while(count <= len(array)-2): if(count == len(array)-1): break if (array[count] > array[count+1]): sift = array[count] array[count] = array[count+1] array[count+1] = sift...
normal
{ "blob_id": "fc8976141a19afd099f92cbbdb578e9c620cb745", "index": 5075, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile index < len(array):\n count = 0\n while count <= len(array) - 2:\n if count == len(array) - 1:\n break\n if array[count] > array[count + 1]:\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @contextmanager def captured_templates(app): """ Records which templates are used """ recorded = [] def record(app, template, context, **extra): recorded.append((template, context)) template_rendered.connect(record) yield recorded template_rendered.disconn...
flexible
{ "blob_id": "bd00644b9cf019fe8c86d52494389b7f0f03d3c3", "index": 1276, "step-1": "<mask token>\n\n\n@contextmanager\ndef captured_templates(app):\n \"\"\" Records which templates are used \"\"\"\n recorded = []\n\n def record(app, template, context, **extra):\n recorded.append((template, context)...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def edit_user_stats(server_id: str, user_id: str, stat: str, datas): create_user(server_id, user_id) if os.path.isfile('Server/{}/user.json'.format(server_id)): with open('Server/{}/user.json'.format(server_id), 'r') as fp: data = json.load(fp) data[use...
flexible
{ "blob_id": "e6d506dd45e72ee7f0162a884981ee1156153d3d", "index": 8661, "step-1": "<mask token>\n\n\ndef edit_user_stats(server_id: str, user_id: str, stat: str, datas):\n create_user(server_id, user_id)\n if os.path.isfile('Server/{}/user.json'.format(server_id)):\n with open('Server/{}/user.json'.f...
[ 5, 6, 7, 8, 9 ]
#Alexis Langlois ''' Fichier de test pour l'algorithme Adaboost avec arbres de décision (@nbTrees). ''' import numpy as np from sklearn.utils import shuffle from sklearn.metrics import classification_report from sklearn.metrics import accuracy_score from adaboost_trees import AdaboostTrees #Trees nbTrees = 20 #Tr...
normal
{ "blob_id": "b750673829873c136826ae539900451559c042c8", "index": 5398, "step-1": "#Alexis Langlois\n'''\nFichier de test pour l'algorithme Adaboost avec arbres de décision (@nbTrees).\n'''\n\nimport numpy as np\n\nfrom sklearn.utils import shuffle\nfrom sklearn.metrics import classification_report\nfrom sklearn....
[ 0 ]
<|reserved_special_token_0|> class InvitationSerializer(ModelSerializer): <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: model = Invitation fields = 'id', 'team', 'email', 'role', 'invited_by', 'is_accepted' class TeamSerializer(ModelSerializer): slug = SlugF...
flexible
{ "blob_id": "c005ae9dc8b50e24d72dbc99329bb5585d617081", "index": 5590, "step-1": "<mask token>\n\n\nclass InvitationSerializer(ModelSerializer):\n <mask token>\n <mask token>\n\n\n class Meta:\n model = Invitation\n fields = 'id', 'team', 'email', 'role', 'invited_by', 'is_accepted'\n\n\nc...
[ 4, 6, 8, 9, 10 ]
class Order: """ Initiated a new order for the store """ def __init__(self, order_number, product_id, item_type, name, product_details, factory, quantity, holiday): """ Construct a new order :param order_number: str :param product_id: str :param item_type: str ...
normal
{ "blob_id": "0dce4ea8ef21f2535194330b82ce5706ae694247", "index": 4676, "step-1": "class Order:\n <mask token>\n <mask token>\n <mask token>\n\n @property\n def order_num(self):\n \"\"\"\n Return order num of the order.\n :return: str\n \"\"\"\n return self._order...
[ 7, 10, 11, 15, 17 ]
"""Given an integer array arr and an integer difference, return the length of the longest subsequence in arr which is an arithmetic sequence such that the difference between adjacent elements in the subsequence equals difference.""" class Solution(object): def longestSubsequence(self, arr, difference): ...
normal
{ "blob_id": "fa4ab3ed5c653633879b5ba2c078c896aa3eb0c6", "index": 2838, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution(object):\n\n def longestSubsequence(self, arr, difference):\n dp = dict()\n ...
[ 0, 1, 2, 3 ]
# 数组的每个索引作为一个阶梯,第 i个阶梯对应着一个非负数的体力花费值 cost[i](索引从0开始)。 # # 每当你爬上一个阶梯你都要花费对应的体力花费值,然后你可以选择继续爬一个阶梯或者爬两个阶梯。 # # 您需要找到达到楼层顶部的最低花费。在开始时,你可以选择从索引为 0 或 1 的元素作为初始阶梯。 # # 示例 1: # # 输入: cost = [10, 15, 20] # 输出: 15 # 解释: 最低花费是从cost[1]开始,然后走两步即可到阶梯顶,一共花费15。 # # # 示例 2: # # 输入: cost = [1, 100, 1, 1, 1, 100, 1, 1, 100, 1] # 输出...
normal
{ "blob_id": "38363316cc9a8419a528bb78b9ad03682e24172d", "index": 9823, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n\n\n<mask token>\n", "step-3": "class Solution(object):\n\n def minCostClimbingStairs(self, cost):\n \"\"\"\n :type cost: List[int]\n ...
[ 0, 1, 2, 3, 4 ]