code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> def qInitResources(): QtCore.qRegisterResourceData(1, qt_resource_struct, qt_resource_name, qt_resource_data) def qCleanupResources(): QtCore.qUnregisterResourceData(1, qt_resource_struct, qt_resource_name, qt_resource_data) <|reserved_special_token_0|> <|res...
flexible
{ "blob_id": "2a6b373c443a1bbafe644cb770bc163536dd5573", "index": 3348, "step-1": "<mask token>\n\n\ndef qInitResources():\n QtCore.qRegisterResourceData(1, qt_resource_struct, qt_resource_name,\n qt_resource_data)\n\n\ndef qCleanupResources():\n QtCore.qUnregisterResourceData(1, qt_resource_struct, ...
[ 2, 3, 4, 5, 6 ]
# # PySNMP MIB module AN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AN-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:22:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) ...
normal
{ "blob_id": "b16e64edd0ff55a424ce3d4589321ee4576e930c", "index": 3965, "step-1": "<mask token>\n\n\nclass DisplayString(OctetString):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass DisplayString(OctetString):\n subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 255)\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(list(numbers)) <|reserved_special_token_1|> <|reserved_special_token_0|> numbers = array('i', [1, 2, 3]) numbers[0] = 0 print(list(numbers)) <|reserved_special_token_1|> from array import array numbers = array('i', [1,...
flexible
{ "blob_id": "ae5f87f1c383478ea5f370af1c85d63a472a7788", "index": 455, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(list(numbers))\n", "step-3": "<mask token>\nnumbers = array('i', [1, 2, 3])\nnumbers[0] = 0\nprint(list(numbers))\n", "step-4": "from array import array\nnumbers = array('i', [1,...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Role(db.Model, RoleMixin): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __repr__(self): return f'<Role {self.name}' class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) username...
flexible
{ "blob_id": "f561846c943013629e417d16f4dae77df43b25c4", "index": 3806, "step-1": "<mask token>\n\n\nclass Role(db.Model, RoleMixin):\n <mask token>\n <mask token>\n <mask token>\n\n def __repr__(self):\n return f'<Role {self.name}'\n\n\nclass User(db.Model, UserMixin):\n id = db.Column(db.I...
[ 10, 11, 12, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def move_files(src_folder, to_folder, list_file): with open(list_file) as f: for line in f.readlines(): line = line.rstrip() dirname = os.path.dirname(line) dest = os.path.join(to_...
flexible
{ "blob_id": "6b2fc94d9a53b8f669cab5e1fb625dd01e20ba98", "index": 664, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef move_files(src_folder, to_folder, list_file):\n with open(list_file) as f:\n for line in f.readlines():\n line = line.rstrip()\n dirname = os.path.d...
[ 0, 1, 2, 3, 4 ]
""" Copyright 2020 Google LLC 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 https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
normal
{ "blob_id": "cce40ff190f7790ac4eca7d6cb3c032955bb4849", "index": 8288, "step-1": "<mask token>\n\n\nclass SA360Validator(object):\n <mask token>\n\n def __init__(self, sa360_service: Resource=None, agency: int=None,\n advertiser: int=None) ->None:\n self.sa360_service = sa360_service\n ...
[ 7, 8, 9, 11, 12 ]
from django.shortcuts import render from django.views.generic import ListView from auth_person.models import Post_news, User # Create your views here. def blog(request, foo): inf = {'login': foo} return render(request, 'blog/blog.html', context=inf) class feed(ListView): template_name = 'blog/feed.html'...
normal
{ "blob_id": "b216c0f92bcf91fd538eabf0239cf149342ef2eb", "index": 4493, "step-1": "from django.shortcuts import render\nfrom django.views.generic import ListView\nfrom auth_person.models import Post_news, User\n\n# Create your views here.\n\n\ndef blog(request, foo):\n inf = {'login': foo}\n return render(r...
[ 0 ]
# Generated by Django 2.1 on 2018-12-09 21:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='replays', name='id', ), mi...
normal
{ "blob_id": "2c1ea45d3c7ee822ec58c2fadaf7fc182acc4422", "index": 9264, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('api', '0001...
[ 0, 1, 2, 3, 4 ]
import sys, os sys.path.append(os.pardir) import numpy as np from dataset.mnist import load_mnist from two_layer_net import TwoLayerNet (x_train, t_train), (x_test, t_test) = load_mnist(normalize=True, one_hot_label = True) train_loss_list = [] #hiper param iters_num = 1000 train_size = x_train.shape[0] batch_size =...
normal
{ "blob_id": "dbe3aa107de8e62822803d1740773a4b22f41edf", "index": 971, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append(os.pardir)\n<mask token>\nfor i in range(iters_num):\n print(i)\n batch_mask = np.random.choice(train_size, batch_size)\n x_batch = x_train[batch_mask]\n t_batc...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> le.fit(labels) <|reserved_special_token_0|> print('[info] compile model...') <|reserved_special_token_0|> model.compile(loss='categorical_crossentropy', optimizer=opt, metrics=[ 'accuracy']) <|reserved_special_token_0|> print(...
flexible
{ "blob_id": "28cdb59e97f3052dd80f8437574f9ffe09fc1e84", "index": 6690, "step-1": "<mask token>\n", "step-2": "<mask token>\nle.fit(labels)\n<mask token>\nprint('[info] compile model...')\n<mask token>\nmodel.compile(loss='categorical_crossentropy', optimizer=opt, metrics=[\n 'accuracy'])\n<mask token>\nprin...
[ 0, 1, 2, 3, 4 ]
import pytz import datetime def apply_timezone_datetime(_local_tz: str, _time: datetime.time): """ set time zone + merge now().date() with time() :param _local_tz: :param _time: :return: """ return pytz.timezone(_local_tz).localize(datetime.datetime.combine( datetime.datetime.now()...
normal
{ "blob_id": "347627df4b08eca6e2137161472b4d31534cf81b", "index": 1238, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef apply_timezone_datetime(_local_tz: str, _time: datetime.time):\n \"\"\"\n set time zone + merge now().date() with time()\n :param _local_tz:\n :param _time:\n :retu...
[ 0, 1, 2 ]
# Generated by Django 2.2.6 on 2019-12-23 16:38 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('Pages', '0014_auto_20191223_2032'), ] operations = [ migrations.AlterField( model_name='dept', ...
normal
{ "blob_id": "d09984c6e6a0ce82389dbbbade63507e9687355d", "index": 771, "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 = [('Pages', '001...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Lexer: def __init__(self, items): self.items = split(items) self.index = 0 self.item = '' self.stringOn = False self.stringList = '' self.intOn = False <|reserved_special_token_0|> def advance(self): self.item = s...
flexible
{ "blob_id": "8d5b75dc945844d48f52159be08fc1e6aa51fdf5", "index": 497, "step-1": "<mask token>\n\n\nclass Lexer:\n\n def __init__(self, items):\n self.items = split(items)\n self.index = 0\n self.item = ''\n self.stringOn = False\n self.stringList = ''\n self.intOn = F...
[ 8, 10, 14, 18, 19 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('model:', module) <|reserved_special_token_0|> print('model:', module) <|reserved_special_token_1|> thisdict = {'brand': 'ford', 'model': 'Mustang', 'year': 1964} module = thisdict['modal'] print('model:', module) thisdic...
flexible
{ "blob_id": "3d854c83488eeafa035ccf5d333eeeae63505255", "index": 6908, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('model:', module)\n<mask token>\nprint('model:', module)\n", "step-3": "thisdict = {'brand': 'ford', 'model': 'Mustang', 'year': 1964}\nmodule = thisdict['modal']\nprint('model:',...
[ 0, 1, 2, 3 ]
''' Copyright (C) 2014 mdm marco[dot]masciola[at]gmail Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file d...
normal
{ "blob_id": "4daf029c4bc9f0726080bd67f37b1e77c9697d1c", "index": 3669, "step-1": "'''\n Copyright (C) 2014 mdm \n marco[dot]masciola[at]gmail \n \nLicensed to the Apache Software Fo...
[ 0 ]
<|reserved_special_token_0|> class MainWindow(Frame): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class MainWindow(Frame): def __init__(self, root): Frame.__init__(self, root) self.root = root self.root.tit...
flexible
{ "blob_id": "63e5ead200fb2884d93f19e7d9b8dc76c7f4f0e3", "index": 4611, "step-1": "<mask token>\n\n\nclass MainWindow(Frame):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass MainWindow(Frame):\n\n def __init__(self, root):\n Frame.__init__(self, root)\n self.root = ro...
[ 1, 2, 3, 4, 5 ]
from setuptools import find_packages, setup NAME = 'compoelem' VERSION = "0.1.1" setup( name=NAME, packages=['compoelem', 'compoelem.generate', 'compoelem.compare', 'compoelem.visualize', 'compoelem.detect', 'compoelem.detect.openpose', 'compoelem.detect.openpose.lib'], include_package_data=True, versio...
normal
{ "blob_id": "4f81eb7218fa1341bd7f025a34ec0677d46151b0", "index": 6542, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name=NAME, packages=['compoelem', 'compoelem.generate',\n 'compoelem.compare', 'compoelem.visualize', 'compoelem.detect',\n 'compoelem.detect.openpose', 'compoelem.detect.open...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> try: from setuptools import setup, find_packages except ImportError: from distutils.core import setup def find_packages(): return ['sqlpython'] <|reserved_special_token_0|> setup(name='sqlpython', version='1.7.3', description= 'Comman...
flexible
{ "blob_id": "f960c95afe1f7a161e0144bb523bfaca117ae61e", "index": 2260, "step-1": "<mask token>\n", "step-2": "try:\n from setuptools import setup, find_packages\nexcept ImportError:\n from distutils.core import setup\n\n def find_packages():\n return ['sqlpython']\n<mask token>\nsetup(name='sql...
[ 0, 1, 2, 3 ]
from io import StringIO from pathlib import Path from unittest import TestCase from doculabs.samon import constants from doculabs.samon.elements import BaseElement, AnonymusElement from doculabs.samon.expressions import Condition, ForLoop, Bind class BaseElementTest(TestCase): def assertXmlEqual(self, generated_...
normal
{ "blob_id": "c6b98cf309e2f1a0d279ec8dc728ffd3fe45dfdb", "index": 4792, "step-1": "<mask token>\n\n\nclass BaseElementTest(TestCase):\n <mask token>\n <mask token>\n\n def test_parse_expressions(self):\n xml_attrs = {(constants.XML_NAMESPACE_FLOW_CONTROL, 'if'):\n 'val == 7', (constants...
[ 5, 7, 8, 9, 11 ]
<|reserved_special_token_0|> class DepartmentAdmin(admin.ModelAdmin): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def save_model(self, request, obj, form, change): if obj.code == '': obj.code = obj.name.re...
flexible
{ "blob_id": "77e4bbe625251254cdadaeeb23dddf51e729e747", "index": 832, "step-1": "<mask token>\n\n\nclass DepartmentAdmin(admin.ModelAdmin):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def save_model(self, request, obj, form, change):\n if obj.code == '':\n obj...
[ 17, 23, 24, 27, 29 ]
import csv import boto3 import pytz import time from datetime import datetime, timedelta # current_time = int(datetime.now()) from boto3.dynamodb.conditions import Key, Attr def lambda_handler(event, context): current_date = datetime.now(pytz.timezone('US/Central')) yesterday_date = current_date - timedleta(...
normal
{ "blob_id": "64d955d568a6bfec50aad36c9c4f1e36998e4d74", "index": 7467, "step-1": "<mask token>\n\n\ndef lambda_handler(event, context):\n current_date = datetime.now(pytz.timezone('US/Central'))\n yesterday_date = current_date - timedleta(days=1)\n yesterday_date_string = yesterday_date.strftime('%Y-%m-...
[ 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": "a6cc0078fb37f9c63e119046193f521290c9fb21", "index": 4634, "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 = [('app', '0006...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class EchoHandler(StreamRequestHandler): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class EchoHandler(StreamRequestHandler): def __init__(self, *args, ack, **kwargs): ...
flexible
{ "blob_id": "7819e41d567daabe64bd6eba62461d9e553566b3", "index": 5393, "step-1": "<mask token>\n\n\nclass EchoHandler(StreamRequestHandler):\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass EchoHandler(StreamRequestHandler):\n\n def __init__(self, *args, ack, **kw...
[ 1, 3, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def findWord(word): return re.compile('\\b({0})\\b'.format(word), flags=re.IGNORECASE).search async def managePunishment(ctx, punishment, reason): await ctx.message.delete() user: discord.Member = ctx.author ms...
flexible
{ "blob_id": "10c9566503c43e806ca89e03955312c510092859", "index": 5346, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef findWord(word):\n return re.compile('\\\\b({0})\\\\b'.format(word), flags=re.IGNORECASE).search\n\n\nasync def managePunishment(ctx, punishment, reason):\n await ctx.message...
[ 0, 2, 3, 4, 5 ]
from collections import Counter, defaultdict import pandas as pd from glob import glob import subsamplex files = glob('outputs.txt/*.unique.txt.gz') files.sort() biome = pd.read_table('cold/biome.txt', squeeze=True, index_col=0) duplicates = set(line.strip() for line in open('cold/duplicates.txt')) counts = defaultdi...
normal
{ "blob_id": "74eea67b8640a03e616bebdadba49891017b921d", "index": 8914, "step-1": "<mask token>\n", "step-2": "<mask token>\nfiles.sort()\n<mask token>\nfor i, fname in enumerate(files):\n sample = fname.split('/')[1].split('.')[0]\n if sample in duplicates:\n skipped += 1\n if skipped % 100...
[ 0, 1, 2, 3, 4 ]
import math # 计算像素点属于哪个中心点 from utils.util import distance def attenuation(color, last_mean): return 1 - math.exp(((distance(color, last_mean) / 80) ** 2) * -1) def get_Count_By_distance(centers, pixel_use,d): # d_min设置过低会产生多的中心点,许多很相似但是没有归到一类中 # d_min设置过高产生少的中心点,不相似的归到一类中 d_min = 1; d_b = d; ...
normal
{ "blob_id": "918db455fc50b49ca2b40dd78cecdec4ba08dcb8", "index": 6013, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_Count_By_distance(centers, pixel_use, d):\n d_min = 1\n d_b = d\n count_use = 0\n for i in range(len(centers)):\n d = attenuation(centers[i], pixel_use)\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(vector) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> vector = np.zeros((8, 8)) vector[1::2, ::2] = 1 vector[::2, 1::2] = 1 print(vector) <|reserved_special_token_0|> <|reserved_...
flexible
{ "blob_id": "10d3ee459a296c26429659a202833a9570cf9454", "index": 9639, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(vector)\n<mask token>\n", "step-3": "<mask token>\nvector = np.zeros((8, 8))\nvector[1::2, ::2] = 1\nvector[::2, 1::2] = 1\nprint(vector)\n<mask token>\n", "step-4": "import num...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def preprocess_data(train, test): global train_features, test_features, train_target, categorical, numerical train_features = train.drop(['Sales', 'Customers'], axis=1) train_target = train[['Sales']] test_features = test.drop(['Id'], axis=1) try: train_feature...
flexible
{ "blob_id": "dc51ca86a49dbec6f714753782494f21d4b1591d", "index": 9091, "step-1": "<mask token>\n\n\ndef preprocess_data(train, test):\n global train_features, test_features, train_target, categorical, numerical\n train_features = train.drop(['Sales', 'Customers'], axis=1)\n train_target = train[['Sales'...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> driver.get('F:\\BaiduYunDownload\\webdriverspace\\sources\\注册实例.html') driver.maximize_window() sleep(2) driver.find_element_by_link_text('注册A网页').click() <|reserved_special_token_0|> print('当前敞口句柄:', current_handle) <|reserved_sp...
flexible
{ "blob_id": "f73a316b6020908472e35a7b78959a9bda6e8e56", "index": 7810, "step-1": "<mask token>\n", "step-2": "<mask token>\ndriver.get('F:\\\\BaiduYunDownload\\\\webdriverspace\\\\sources\\\\注册实例.html')\ndriver.maximize_window()\nsleep(2)\ndriver.find_element_by_link_text('注册A网页').click()\n<mask token>\nprint(...
[ 0, 1, 2, 3, 4 ]
import logging from common.loghdl import getLogHandler from datastore.dbutil import DBSQLLite, getDSConnStr #from utils.generator import random_password #from datastore.dbadmin import DBAdmin #from datastore.initevaldb import * ############################ TESTING TO BE REMOVED # md = cfg #def test_spetest(c...
normal
{ "blob_id": "c3970ad8bddb1ca136724f589ff9088024157662", "index": 7942, "step-1": "\nimport logging\n\nfrom common.loghdl import getLogHandler\nfrom datastore.dbutil import DBSQLLite, getDSConnStr\n\n\n#from utils.generator import random_password\n#from datastore.dbadmin import DBAdmin\n#from datastore.initeva...
[ 0 ]
""" Python shell for Diofant. This is just a normal Python shell (IPython shell if you have the IPython package installed), that adds default imports and run some initialization code. """ import argparse import ast import atexit import code import os import readline import rlcompleter from diofant.interactive.sessio...
normal
{ "blob_id": "80e395715d3ae216beb17e7caed1d8d03c5c56de", "index": 9943, "step-1": "<mask token>\n\n\ndef main():\n args, ipython_args = parser.parse_known_args()\n lines = ['from diofant import *', 'init_printing()',\n \"a, b, c, d, t, x, y, z = symbols('a:d t x:z')\",\n \"k, m, n = symbols('k...
[ 1, 2, 3, 4, 5 ]
class Solution: """ https://leetcode.com/problems/game-of-life/ 289. Game of Life Medium -------------------- According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970." Given a ...
normal
{ "blob_id": "5b6ed75279b39a1dad1bf92535c4b129bb599350", "index": 3612, "step-1": "class Solution:\n <mask token>\n\n def gameOfLife(self, board):\n \"\"\"\n Do not return anything, modify board in-place instead.\n \"\"\"\n self.gameOfLife_2(board)\n\n def gameOfLife_1(self, b...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(slicedString) <|reserved_special_token_1|> str = 'mama' stringlength = len(str) slicedString = str[stringlength::-1] print(slicedString) <|reserved_special_token_1|> str="mama" stringlength=len(str) slicedString=str[...
flexible
{ "blob_id": "5c80561a3344c0240e59500e5dadc1f1ef7f380e", "index": 7687, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(slicedString)\n", "step-3": "str = 'mama'\nstringlength = len(str)\nslicedString = str[stringlength::-1]\nprint(slicedString)\n", "step-4": "str=\"mama\"\r\nstringlength=len(str...
[ 0, 1, 2, 3 ]
# this is for the 12/30/2015 experiments # varied over 1, 10, 25, 50, 100 repeat particles per particle # 10000 particles total per filter # bias is at 0.8 in both the "real" world (realWorld.cpp) files = ['data0Tue_Dec_30_20_37_34_2014.txt', 'data0Tue_Dec_30_20_37_49_2014.txt', 'data0Tue_Dec_30_20_38_04_2014.txt', 'd...
normal
{ "blob_id": "b63221af86748241fdce34052819569a06d37afe", "index": 6965, "step-1": "<mask token>\n", "step-2": "files = ['data0Tue_Dec_30_20_37_34_2014.txt',\n 'data0Tue_Dec_30_20_37_49_2014.txt',\n 'data0Tue_Dec_30_20_38_04_2014.txt',\n 'data0Tue_Dec_30_20_38_19_2014.txt',\n 'data0Tue_Dec_30_20_38_3...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def partition(pred: Callable[[T], bool], it: Iterable[T]) ->Tuple[List[T], List[T]]: ... <|reserved_special_token_1|> <|reserved_special_token_0|> T = TypeVar('T') def partition(pred: Callable[[T], bool], it: Iterab...
flexible
{ "blob_id": "8e443d136a4e9fcdd18a106192f9c097928b8c99", "index": 7340, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef partition(pred: Callable[[T], bool], it: Iterable[T]) ->Tuple[List[T],\n List[T]]:\n ...\n", "step-3": "<mask token>\nT = TypeVar('T')\n\n\ndef partition(pred: Callable[[T...
[ 0, 1, 2, 3, 4 ]
from gamesim import GameSim from network import Network from player import RemotePlayer from mutator import Mutator from random import * import copy game = GameSim() game.make_players(10) base = "networks/" dir = "" name = "203964_85377" gens = 2000 game.players[0].import_player(base + dir + name + ".network") game...
normal
{ "blob_id": "1aace7b9385aefdc503ce0e43e0f7f0996fe112a", "index": 4284, "step-1": "<mask token>\n", "step-2": "<mask token>\ngame.make_players(10)\n<mask token>\ngame.players[0].import_player(base + dir + name + '.network')\ngame.train(gens)\nif gens % 500 != 0:\n game.players[0].export_player()\n", "step-...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging lgr = logging.getLogger(__name__) lgr.log("hello") import database import csv import codecs class Stop(object): """docstring for Stop""" def __init__(self, arg): self.fields = [ 'stop_id', 'stop_name', 'stop...
normal
{ "blob_id": "39ecbf914b0b2b25ce4290eac4198199b90f95e0", "index": 5384, "step-1": "<mask token>\n\n\nclass Stop(object):\n \"\"\"docstring for Stop\"\"\"\n\n def __init__(self, arg):\n self.fields = ['stop_id', 'stop_name', 'stop_lat', 'stop_lon',\n 'stop_calle', 'stop_numero', 'stop_entre...
[ 9, 10, 12, 13, 14 ]
<|reserved_special_token_0|> def balanco(img, ar, ag, ab): nova = Imagem((img.altura, img.largura)) for y in range(img.altura): for x in range(img.largura): r, g, b = img[y][x] R = int(ar * r) G = int(ar * g) B = int(ar * b) nova[y][x] = R, G...
flexible
{ "blob_id": "1f7007fcea490a8b28bd72163f99b32e81308878", "index": 4834, "step-1": "<mask token>\n\n\ndef balanco(img, ar, ag, ab):\n nova = Imagem((img.altura, img.largura))\n for y in range(img.altura):\n for x in range(img.largura):\n r, g, b = img[y][x]\n R = int(ar * r)\n ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def max_heapity(arr, start, end): root = start while True: child = 2 * root + 1 if child > end: break if child + 1 <= end and arr[child] < arr[child + 1]: child += 1 if arr[root] < arr[child]: arr[root], arr[child...
flexible
{ "blob_id": "2ffe4b0eb7af9b3a4d5724442b5409d27bfa92a1", "index": 6130, "step-1": "<mask token>\n\n\ndef max_heapity(arr, start, end):\n root = start\n while True:\n child = 2 * root + 1\n if child > end:\n break\n if child + 1 <= end and arr[child] < arr[child + 1]:\n ...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python import os from distutils.core import setup, Extension import distutils.util setup (name = 'pybanery', version= '1.0', description='Python interface for Kanbanery', author = 'Pablo Lluch', author_email = 'pablo.lluch@gmail.com', py_modules = ['pybanery'], ...
normal
{ "blob_id": "60c862accbb9cda40ed4c45491f643f065e2868a", "index": 6467, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='pybanery', version='1.0', description=\n 'Python interface for Kanbanery', author='Pablo Lluch', author_email=\n 'pablo.lluch@gmail.com', py_modules=['pybanery'], script...
[ 0, 1, 2, 3 ]
#!/usr/bin/python # Original code found at: # https://github.com/zzeromin/raspberrypi/tree/master/i2c_lcd # requires I2C_LCD_driver.py import I2C_LCD_driver from time import * import os mylcd = I2C_LCD_driver.lcd() mylcd.lcd_clear() mylcd.lcd_display_string("RAS Hi-Pi shutdown", 1) mylcd.lcd_display_string(" See yo...
normal
{ "blob_id": "df60d3b829c5702385f59fdefaea04f569fb7db2", "index": 9058, "step-1": "<mask token>\n", "step-2": "<mask token>\nmylcd.lcd_clear()\nmylcd.lcd_display_string('RAS Hi-Pi shutdown', 1)\nmylcd.lcd_display_string(' See you again ~', 2)\nmylcd.lcd_display_string('http://rasplay.org', 3)\nmylcd.lcd_displa...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings. STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT ) <|reserved_special_token_1|...
flexible
{ "blob_id": "a35e86e474883d892a6ce8eb191a3a5f8a9558c8", "index": 1105, "step-1": "<mask token>\n", "step-2": "<mask token>\nif settings.DEBUG:\n urlpatterns += static(settings.STATIC_URL, document_root=settings.\n STATIC_ROOT)\n urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDI...
[ 0, 1, 2, 3, 4 ]
'''Mock classes that imitate idlelib modules or classes. Attributes and methods will be added as needed for tests. ''' from idlelib.idle_test.mock_tk import Text class Editor: '''Minimally imitate EditorWindow.EditorWindow class. ''' def __init__(self, flist=None, filename=None, key=None, root=None): ...
normal
{ "blob_id": "3b7c30718838a164eaf3aa12cd7b6a68930346f8", "index": 8604, "step-1": "<mask token>\n\n\nclass UndoDelegator:\n <mask token>\n\n def undo_block_start(*args):\n pass\n\n def undo_block_stop(*args):\n pass\n", "step-2": "<mask token>\n\n\nclass Editor:\n <mask token>\n\n d...
[ 3, 7, 8, 9, 10 ]
with open('dwarfs.txt') as fh: i = 1 for line in fh: print("[%d] %s" % (i, line)) i += 1
normal
{ "blob_id": "18c4c1e1ee0df835895397488b270a47b1620c30", "index": 8032, "step-1": "<mask token>\n", "step-2": "with open('dwarfs.txt') as fh:\n i = 1\n for line in fh:\n print('[%d] %s' % (i, line))\n i += 1\n", "step-3": "with open('dwarfs.txt') as fh:\n i = 1\n for line in fh:\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> @serious12.route('/') def home(): return 'HOME' @serious12.route('/user/<username>') def user(username): user = {'trung': {'name': 'Trung', 'age': 19, 'birthplace': 'Hanoi'}, 'nguyenvana': {'name': 'A', 'age': 69, 'birthplace': 'Trai Dat'}} return render_template('us...
flexible
{ "blob_id": "db1b6c545555116a334061440614e83e62994838", "index": 4440, "step-1": "<mask token>\n\n\n@serious12.route('/')\ndef home():\n return 'HOME'\n\n\n@serious12.route('/user/<username>')\ndef user(username):\n user = {'trung': {'name': 'Trung', 'age': 19, 'birthplace': 'Hanoi'},\n 'nguyenvana'...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python3 import warnings import config import numpy as np from latplan.model import ActionAE, default_networks from latplan.util import curry from latplan.util.tuning import grid_search, nn_task import keras.backend as K import tensorflow as tf float_formatter = lambda x: "%.3f" % x np.set_printo...
normal
{ "blob_id": "f1c6340880b52ba86856913f74c7d589d9b49f49", "index": 5179, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.set_printoptions(formatter={'float_kind': float_formatter})\n<mask token>\nif __name__ == '__main__':\n import numpy.random as random\n import sys\n if len(sys.argv) == 1:\n ...
[ 0, 1, 2, 3, 4 ]
from flask import jsonify from flask_restful import Resource from flask_apispec.views import MethodResource import pandas as pd import jellyfish df = pd.read_csv('data/trancotop1m.csv') df_dict = df.to_dict('records') class StrComparison(MethodResource,Resource): # @requires_auth def get(self, domain): ...
normal
{ "blob_id": "6d974580ff546bda17caa1e61e2621b4bc705f3f", "index": 2952, "step-1": "<mask token>\n\n\nclass StrComparison(MethodResource, Resource):\n <mask token>\n", "step-2": "<mask token>\n\n\nclass StrComparison(MethodResource, Resource):\n\n def get(self, domain):\n domain_found = ''\n ...
[ 1, 2, 3, 4, 5 ]
h = 160 xorg = 0 yoff = 400 xcount = 0 xvel = 2 def setup(): size(800, 800) colorMode(HSB, 360, 1, 1, 1) background(140, 0.49, 0.75) frameRate(30) noStroke() def draw(): global h, xorg, yoff, xcount, xvel if frameCount % 10 == 0: fill(140, 0.49, 0.75, 0.2) square(0,0,width)...
normal
{ "blob_id": "2257494dec9fccc4e8bd4acf0aff31a73c252a61", "index": 616, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef draw():\n global h, xorg, yoff, xcount, xvel\n if frameCount % 10 == 0:\n fill(140, 0.49, 0.75, 0.2)\n square(0, 0, width)\n pushMatrix()\n translate(xorg...
[ 0, 1, 2, 3, 4 ]
"""insta URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/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 v...
normal
{ "blob_id": "63c0786d277c5576822d6e521f65850762ab5eb0", "index": 9198, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n", "step-3": "<mask token>\nurlpatterns = [path('admin/', admin.site.urls), path('post/', post_views.\n ...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- from django.apps import AppConfig class AcademyConfig(AppConfig): name = 'academy' verbose_name = u"Академия"
normal
{ "blob_id": "619d2df45d0823930484f030a9a78e71ec718cb7", "index": 6661, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AcademyConfig(AppConfig):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass AcademyConfig(AppConfig):\n name = 'academy'\n verbose_name = u'Акад...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): N = int(input()) A = tuple(map(int, input().split())) c = Counter(A).most_common() if c[0][0] == 0 and c[0][1] == N: print('Yes') elif len(c) == 2 and c[0][1] == 2 * N // 3 and c[1][0] == ...
flexible
{ "blob_id": "7c6ada250770e04b395dda774a78042da69e2854", "index": 8681, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n N = int(input())\n A = tuple(map(int, input().split()))\n c = Counter(A).most_common()\n if c[0][0] == 0 and c[0][1] == N:\n print('Yes')\n elif le...
[ 0, 1, 2, 3, 4 ]
# -*- python -*- # ex: set syntax=python: # vim: set syntax=python: import os import re from collections import defaultdict, namedtuple from enum import Enum from pathlib import Path import buildbot.www.authz.endpointmatchers as ems from buildbot.changes.filter import ChangeFilter from buildbot.changes.gitpoller impo...
normal
{ "blob_id": "4abcca52095a169b71d2527ce52b8367534c42a4", "index": 5989, "step-1": "<mask token>\n\n\nclass Purpose(Enum):\n halide_nightly = 1\n halide_testbranch = 2\n llvm_nightly = 3\n\n\nclass BuildSystem(Enum):\n make = 0\n cmake = 1\n\n\nclass BuilderType:\n \"\"\"A class to encapsulate th...
[ 45, 55, 62, 69, 80 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- from operation import * import math class InsertWord(Operation): @classmethod def getValue(cls, t, h, w, b, arg=None): return math.log(arg["prob"]) * w[cls] @classmethod def getKBest(cls, t, h , args, w, b, k): valueList = [] for ...
normal
{ "blob_id": "355e3932c8bd9105e0c1ce9259e3b7416997523c", "index": 3668, "step-1": "<mask token>\n\n\nclass InsertWord(Operation):\n\n @classmethod\n def getValue(cls, t, h, w, b, arg=None):\n return math.log(arg['prob']) * w[cls]\n <mask token>\n <mask token>\n\n @classmethod\n def transF...
[ 3, 4, 5, 6, 7 ]
a = float(input('Digite um valor: ')) b = float(input('Digite outro valor: ')) c = float(input('Digite mais um valor: ')) if a == b or b == c: print('Com os números digitados, formam um triângulo EQUILATERO.') elif a <> b and b <> c and c == a and b == c: print('Com os números digitados, formam um triângulo ISO...
normal
{ "blob_id": "81233eb12b8447d017b31f200ab7902dcce45496", "index": 1649, "step-1": "a = float(input('Digite um valor: '))\nb = float(input('Digite outro valor: '))\nc = float(input('Digite mais um valor: '))\nif a == b or b == c:\n print('Com os números digitados, formam um triângulo EQUILATERO.')\nelif a <> b ...
[ 0 ]
''' Applies the mish function element-wise: .. math:: mish(x) = x * tanh(softplus(x)) = x * tanh(ln(1 + e^{x})) ''' # import pytorch import torch from torch import nn # import activation functions import echoAI.Activation.Torch.functional as Func class Mish(nn.Module): ''' Applies the mish function ele...
normal
{ "blob_id": "2deb73c7d2588ea1a5b16eb1ed617583d41f0130", "index": 2846, "step-1": "<mask token>\n\n\nclass Mish(nn.Module):\n <mask token>\n <mask token>\n\n def forward(self, input):\n \"\"\"\n Forward pass of the function.\n \"\"\"\n return Func.mish(input, inplace=self.inpl...
[ 2, 3, 4, 5, 6 ]
from __future__ import print_function import tensorflow as tf # from keras.callbacks import ModelCheckpoint from data import load_train_data from utils import * import os create_paths() log_file = open(global_path + "logs/log_file.txt", 'a') X_train, y_train = load_train_data() labeled_index = np.arange(0, nb_labeled...
normal
{ "blob_id": "d36552cc589b03008dc9edab8d7e4a003e26bd21", "index": 5046, "step-1": "<mask token>\n", "step-2": "<mask token>\ncreate_paths()\n<mask token>\nif os.path.exists(initial_weights_path):\n model.load_weights(initial_weights_path)\nif initial_train:\n model_checkpoint = tf.keras.callbacks.ModelChe...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class States: INIT = -1 GET_READY = 1 FIND_BAR = 2 WALK_2_BAR = 3 WALK_SIDEWAYS = 4 PICK_BAR = 5 WALK_WITH_BAR = 6 LIFT_BAR = 7 WALK_2_FINISH = 8 END = 99 <|reserved_special_token_0|> def init(): robot.setGeneralControlModule('action_module'...
flexible
{ "blob_id": "b3a2db38e2074b02c8837bfce85d06598a7b194d", "index": 5701, "step-1": "<mask token>\n\n\nclass States:\n INIT = -1\n GET_READY = 1\n FIND_BAR = 2\n WALK_2_BAR = 3\n WALK_SIDEWAYS = 4\n PICK_BAR = 5\n WALK_WITH_BAR = 6\n LIFT_BAR = 7\n WALK_2_FINISH = 8\n END = 99\n\n\n<ma...
[ 3, 4, 5, 6, 7 ]
import re import sys import zipfile import pathlib from typing import IO, Any from collections.abc import Mapping import numpy.typing as npt import numpy as np from numpy.lib._npyio_impl import BagObj if sys.version_info >= (3, 11): from typing import assert_type else: from typing_extensions import assert_typ...
normal
{ "blob_id": "e2f134f5ff00405396b8bbf4edc263b70ef5d972", "index": 2435, "step-1": "<mask token>\n\n\nclass BytesWriter:\n <mask token>\n\n\nclass BytesReader:\n\n def read(self, n: int=...) ->bytes:\n ...\n\n def seek(self, offset: int, whence: int=...) ->int:\n ...\n\n\n<mask token>\n", ...
[ 4, 5, 6, 7, 8 ]
from django.conf.urls import url, include from . import views explore_patterns = [ url(r'^$', views.explore), url(r'^(?P<model_type>\w+)/$', views.get_by_model_type), url(r'^(?P<model_type>\w+)/(?P<id>\w+)/$', views.get_by_model_id), url(r'^(?P<model_type>\w+)/(?P<id>\w+)/download$', views.download_me...
normal
{ "blob_id": "89078ddd7dad3a2727b66566457b9ac173abe607", "index": 8506, "step-1": "<mask token>\n", "step-2": "<mask token>\nexplore_patterns = [url('^$', views.explore), url('^(?P<model_type>\\\\w+)/$',\n views.get_by_model_type), url('^(?P<model_type>\\\\w+)/(?P<id>\\\\w+)/$',\n views.get_by_model_id), ...
[ 0, 1, 2, 3 ]
import time import numpy as np import matplotlib.pyplot as plt #tutorial: http://pybonacci.org/2012/05/19/manual-de-introduccion-a-matplotlib-pyplot-ii-creando-y-manejando-ventanas-y-configurando-la-sesion/ import threading from random import shuffle T = 1 eps = 0.000000001 agilityMin = 1/T '''------------GOVERMENT'...
normal
{ "blob_id": "ab0c3cf3e43f34874dd94629b746ca1237c3349a", "index": 7494, "step-1": "<mask token>\n\n\nclass Map:\n <mask token>\n\n def __init__(self, size, num_feeds):\n self.size = size\n self.map_cells = np.zeros((self.size, self.size))\n <mask token>\n <mask token>\n\n def createCe...
[ 21, 26, 27, 32, 34 ]
<|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": "b308d81fb8eab9f52aa0ad4f88e25d6757ef703a", "index": 1761, "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 ]
""" Copyright (c) 2017 - Philip Paquette 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, modify, merge, publish, distribu...
normal
{ "blob_id": "9a183b1f81681b3dec1132a27b17e389438ab725", "index": 6045, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef set_seed(n):\n global seed, py_rng, np_rng, t_rng\n seed = n\n py_rng = Random(seed)\n np_rng = np.random.RandomState(seed)\n\n\n<mask token>\n", "step-3": "<mask to...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def upgrade(): op.add_column('Gifs', sa.Column('personal_collections', sa.Integer(), nullable=True)) op.create_foreign_key(None, 'Gifs', 'PersonalGifCollections', [ 'personal_collections'], ['id']) <|reserved_special_token_0|> <|reserved_special_token_1|> <|re...
flexible
{ "blob_id": "21bdf315c98a4cf69482cc7db41bc30d44781596", "index": 816, "step-1": "<mask token>\n\n\ndef upgrade():\n op.add_column('Gifs', sa.Column('personal_collections', sa.Integer(),\n nullable=True))\n op.create_foreign_key(None, 'Gifs', 'PersonalGifCollections', [\n 'personal_collections...
[ 1, 2, 3, 4, 5 ]
# coding: utf-8 ## ROC for CLEF-IP2010 patents ####### ROC for clef-ip2010 patents # In[ ]: def vectorize_corpus(corpus,tokenizer,vocabulary,max_ngram_size): # tokenize text from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from...
normal
{ "blob_id": "08e5e8515528eae400a59bfc0c58b8d7b4affd7e", "index": 5921, "step-1": "\n# coding: utf-8\n\n## ROC for CLEF-IP2010 patents\n\n####### ROC for clef-ip2010 patents\n\n# In[ ]:\n\ndef vectorize_corpus(corpus,tokenizer,vocabulary,max_ngram_size):\n # tokenize text\n from sklearn.feature_extraction.t...
[ 0 ]
<|reserved_special_token_0|> def handle_request(user, data): results = [] resultsByTag = {} api = Api(user, data.get('createdIds', None)) for capability in data['using']: CAPABILITIES[capability].register_methods(api) for cmd, kwargs, tag in data['methodCalls']: t0 = monotonic() ...
flexible
{ "blob_id": "aac3b2478980d3a5453451cb848afcfd6aca1743", "index": 1680, "step-1": "<mask token>\n\n\ndef handle_request(user, data):\n results = []\n resultsByTag = {}\n api = Api(user, data.get('createdIds', None))\n for capability in data['using']:\n CAPABILITIES[capability].register_methods(...
[ 6, 7, 8, 9, 10 ]
import numpy as np import matplotlib.pyplot as plt from scipy import stats def fit(x, iters=1000, eps=1e-6): """ Fits a 2-parameter Weibull distribution to the given data using maximum-likelihood estimation. :param x: 1d-ndarray of samples from an (unknown) distribution. Each value must satisfy x ...
normal
{ "blob_id": "b10d3d8d0ded0d2055c1abdaf40a97abd4cb2cb8", "index": 1631, "step-1": "<mask token>\n\n\ndef fit(x, iters=1000, eps=1e-06):\n \"\"\"\n Fits a 2-parameter Weibull distribution to the given data using maximum-likelihood estimation.\n :param x: 1d-ndarray of samples from an (unknown) distributio...
[ 1, 2, 3, 4, 5 ]
""" First run in samples: mogrify -format png -density 150 input.pdf -quality 90 -- *.pdf """ import cv2 import os import numpy as np from matplotlib import pylab def peakdetect(v, delta, x=None): """ Converted from MATLAB script at http://billauer.co.il/peakdet.html Returns two arrays fun...
normal
{ "blob_id": "9887e001f13ed491331c79c08450299afcc0d7cd", "index": 4279, "step-1": "\"\"\"\nFirst run in samples: \nmogrify -format png -density 150 input.pdf -quality 90 -- *.pdf\n\"\"\"\n\nimport cv2\nimport os\nimport numpy as np\nfrom matplotlib import pylab\n\ndef peakdetect(v, delta, x=None):\n \"\"\"\n ...
[ 0 ]
<|reserved_special_token_0|> class ConditionWrapper: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class MonitorBase(object, metaclass=MonitorMeta): _monitor_counter = 0 _variable_counter = 0 _condition_counter = 0 def __new__(cls, *args, **kwarg...
flexible
{ "blob_id": "80d49b24a2233569a340cee918393b1663c3d55d", "index": 4598, "step-1": "<mask token>\n\n\nclass ConditionWrapper:\n <mask token>\n <mask token>\n <mask token>\n\n\nclass MonitorBase(object, metaclass=MonitorMeta):\n _monitor_counter = 0\n _variable_counter = 0\n _condition_counter = 0...
[ 16, 17, 18, 23, 26 ]
#!/usr/bin/python __author__ = "morganlnance" ''' Analysis functions using PyRosetta4 ''' def get_sequence(pose, res_nums=None): # type: (Pose, list) -> str """ Return the sequence of the <pose>, or, return the sequence listed in <res_nums> :param pose: Pose :param res_nums: list() of Pose residu...
normal
{ "blob_id": "876e9f03c908338a247b6bf1f23011e609bbc2a5", "index": 8739, "step-1": "<mask token>\n\n\ndef write_fasta_file(pdb_names, pdb_sequences, filename, dump_dir=''):\n \"\"\"\n Use a list of <pdb_names> and their corresponding <pdb_sequences> to write out a FASTA formatted file\n Need a <filename> ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app_name = 'produce' urlpatterns = [url('^sms/$', views.sms, name='sms'), url('^list/', views. SeasonalView.as_view(), name='list'), url('^(?P<pk>[0-9]+)/$', views. ProduceDetailView.as_view(), name='produce_detail'), url(...
flexible
{ "blob_id": "f7d0d7dda955acd07b6da010d21dc5f02254e1ed", "index": 5821, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'produce'\nurlpatterns = [url('^sms/$', views.sms, name='sms'), url('^list/', views.\n SeasonalView.as_view(), name='list'), url('^(?P<pk>[0-9]+)/$', views.\n ProduceDeta...
[ 0, 1, 2, 3 ]
''' tag名だけで変えてもいいよね?? ただし,置換するときは,「代表参照表現(参照表現)」のように,元の参照表現が分かるように配慮せよ.→何を言いたい!? もしかして: <mention> -> <mention representative="false"> 欲しい??「元の参照表現が分かる」とは <mention representative="true"> と区割りできればいいよね? ''' from bs4 import BeautifulSoup, element soup = BeautifulSoup(open("nlp.txt.xml"),"lxml") mentions = soup.find_all('me...
normal
{ "blob_id": "04938e14f22c44437188469b53dfb05d2ecd4a5c", "index": 4481, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor m in mentions:\n if m.has_attr('representative') == False:\n print('before: =>\\n{}'.format(m))\n m['representative'] = 'false'\n print('after: =>\\n{}'.format...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> __all__ = ['AddonsRepository', 'Addon', 'Addons', 'Utils'] <|reserved_special_token_1|> __all__ = ["AddonsRepository", "Addon", "Addons", "Utils"]
flexible
{ "blob_id": "054d7e4bd51110e752a18a5c0af4432a818ef3b8", "index": 7974, "step-1": "<mask token>\n", "step-2": "__all__ = ['AddonsRepository', 'Addon', 'Addons', 'Utils']\n", "step-3": "__all__ = [\"AddonsRepository\", \"Addon\", \"Addons\", \"Utils\"]", "step-4": null, "step-5": null, "step-ids": [ ...
[ 0, 1, 2 ]
class Queue(object): def __init__(self, val_list=None): self.stack_one = [] self.stack_two = [] if val_list: for item in val_list: self.stack_one.append(item) def push(self, val=None): if val: self.stack_one.append(val) def pop(self)...
normal
{ "blob_id": "d4d8d800b81a50f2c520f0394412935738d1a8ee", "index": 2986, "step-1": "class Queue(object):\n\n def __init__(self, val_list=None):\n self.stack_one = []\n self.stack_two = []\n if val_list:\n for item in val_list:\n self.stack_one.append(item)\n\n d...
[ 3, 4, 5, 6 ]
import optparse from camera import apogee_U2000 if __name__ == "__main__": parser = optparse.OptionParser() group1 = optparse.OptionGroup(parser, "General") group1.add_option('--s', action='store', default=1, dest='mode', help='set cooler on/off') args = parser.parse_args() options, args = parser.par...
normal
{ "blob_id": "60c849d213f6266aeb0660fde06254dfa635f10f", "index": 3383, "step-1": "import optparse\n\nfrom camera import apogee_U2000\t\t\t\n\nif __name__ == \"__main__\":\n parser = optparse.OptionParser()\n group1 = optparse.OptionGroup(parser, \"General\") \n group1.add_option('--s', action='store', defau...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution(object): def longestSubsequence(self, arr, difference): dp = dict() mx =...
flexible
{ "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 ]
print(180 / 4)
normal
{ "blob_id": "509129052f97bb32b4ba0e71ecd7b1061d5f8da2", "index": 38, "step-1": "<mask token>\n", "step-2": "print(180 / 4)\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from django.shortcuts import render, redirect from .models import League, Team, Player from django.db.models import Count from . import team_maker def index(request): baseball = League.objects.filter(name__contains='Baseball') women_league = League.objects.filter(name__contains='women') hockey_league = ...
normal
{ "blob_id": "49703775da87e8cbbe78a69c91a68128c3fd78e1", "index": 3363, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef index(request):\n baseball = League.objects.filter(name__contains='Baseball')\n women_league = League.objects.filter(name__contains='women')\n hockey_league = League.obje...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class AlipayInsSceneEcommerceInsureCheckModel(object): def __init__(self): self._insure_admit_dto_list = None self._partner_org_id = None self._product_code = None self._scene_code = None self._user_client = None @property def insure_a...
flexible
{ "blob_id": "e616d14827beaa08ab08219421cbf7990cf163fd", "index": 242, "step-1": "<mask token>\n\n\nclass AlipayInsSceneEcommerceInsureCheckModel(object):\n\n def __init__(self):\n self._insure_admit_dto_list = None\n self._partner_org_id = None\n self._product_code = None\n self._s...
[ 8, 10, 11, 12, 16 ]
# Copyright (c) 2016, Xilinx, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of ...
normal
{ "blob_id": "15514d5636471b1a311641a40b6a00b81703cd2b", "index": 6488, "step-1": "<mask token>\n\n\nclass Grove_PIR(Pmod_IO):\n <mask token>\n\n def __init__(self, mb_info, gr_pin):\n \"\"\"Return a new instance of a PIR object. \n \n Parameters\n ----------\n mb_info : d...
[ 3, 4, 5, 6, 7 ]
''' Created on Mar 19, 2019 @author: malte ''' import gc import pickle from hyperopt import tpe, hp from hyperopt.base import Trials from hyperopt.fmin import fmin from config.globals import BASE_PATH from domain.features import FEATURES from evaluate import evaluate from featuregen.create_set import create_set fro...
normal
{ "blob_id": "daf070291bbf59a7a06b129bbde5fd79b5cd46ad", "index": 6715, "step-1": "<mask token>\n\n\ndef objective(params):\n train = create_set(base_path=BASE_PATH + SET, conf=CONF, key=DSKEY,\n redo=False)\n test = train.query('train == 0')\n train.query('train == 1', inplace=True)\n X = trai...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python """ .. module:: convert :synopsis: used to create info.txt and the <txname>.txt files. """ import sys import os import argparse argparser = argparse.ArgumentParser(description = 'create info.txt, txname.txt, twiki.txt and sms.py') argparser.add_argument ('-utilsPath', '--utilsPath', help ...
normal
{ "blob_id": "c80b31bc154d5c1c8f9fc0ac226295160f2f9473", "index": 4249, "step-1": "<mask token>\n", "step-2": "<mask token>\nargparser.add_argument('-utilsPath', '--utilsPath', help=\n 'path to the package smodels_utils', type=str)\nargparser.add_argument('-smodelsPath', '--smodelsPath', help=\n 'path to ...
[ 0, 1, 2, 3, 4 ]
import os import subprocess import discord import asyncio import traceback import sys import ast from discord.ext import commands # Import Cogs from cogs.misc import Miscellaneous from cogs.serversettings import ServerSettings from cogs.mod import Moderator from cogs.automod import AutoMod from cogs.google import Goo...
normal
{ "blob_id": "4f9729e396e01cb3d6c9011f79a1ebe618a8e762", "index": 7787, "step-1": "<mask token>\n\n\ndef insert_returns(body):\n if isinstance(body[-1], ast.Expr):\n body[-1] = ast.Return(body[-1].value)\n ast.fix_missing_locations(body[-1])\n if isinstance(body[-1], ast.If):\n insert_r...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def findSubset(s0, s, t): mys0 = s0.copy() mys = s.copy() if t == 0 and mys0: return mys0 elif t == 0: return True elif len(mys) > 0: p = mys.pop() mys1 = mys0.copy() mys1.add(p) if t - p < 0...
flexible
{ "blob_id": "079610f2aaebec8c6e46ccf21a9d5728df1be8de", "index": 4155, "step-1": "<mask token>\n", "step-2": "def findSubset(s0, s, t):\n mys0 = s0.copy()\n mys = s.copy()\n if t == 0 and mys0:\n return mys0\n elif t == 0:\n return True\n elif len(mys) > 0:\n p = mys.pop()\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @unittest.skipIf(not _HAS_SKLEARN, 'Missing sklearn. Skipping tests.') class ImputerTestCase(unittest.TestCase): <|reserved_special_token_0|> @classmethod def setUpClass(self): """ Set up the unit test by loading the dataset and training a model. """ ...
flexible
{ "blob_id": "d3d90b8ccd0ec449c84ac0316c429b33353f4518", "index": 8900, "step-1": "<mask token>\n\n\n@unittest.skipIf(not _HAS_SKLEARN, 'Missing sklearn. Skipping tests.')\nclass ImputerTestCase(unittest.TestCase):\n <mask token>\n\n @classmethod\n def setUpClass(self):\n \"\"\"\n Set up th...
[ 4, 5, 6, 7, 8 ]
import FWCore.ParameterSet.Config as cms class StageOneCustomize(): """ Customizaton class for STXS stage 1 analysis """ def __init__(self, process, customize, metaConditions): self.process = process self.customize = customize self.metaConditions = metaConditions se...
normal
{ "blob_id": "ce12ede15f4ca4a085e38e455515d8a028da8fd2", "index": 2115, "step-1": "<mask token>\n\n\nclass StageOneCustomize:\n <mask token>\n\n def __init__(self, process, customize, metaConditions):\n self.process = process\n self.customize = customize\n self.metaConditions = metaCond...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> class Optimizer(object): <|reserved_special_token_0|> <|reserved_special_token_0|> @staticmethod def fromXml(xmlDoc, plant, orderList, simulator, evaluator): """ Loads the optimizer configuration and parameters from an XML tree. """ optimizer = Optimiz...
flexible
{ "blob_id": "8ce2e9cd9ceed6c79a85682b8bc03a3ffb5131c4", "index": 3817, "step-1": "<mask token>\n\n\nclass Optimizer(object):\n <mask token>\n <mask token>\n\n @staticmethod\n def fromXml(xmlDoc, plant, orderList, simulator, evaluator):\n \"\"\"\n\t\tLoads the optimizer configuration and parame...
[ 10, 11, 12, 13, 16 ]
#!/usr/bin/env python3 import os import fileinput project = input("Enter short project name: ") if os.path.isdir(project): print("ERROR: Project exists") exit() os.mkdir(project) os.chdir(project) cmd = "virtualenv env -p `which python3` --prompt=[django-" + project + "]" os.system(cmd) # Install django wi...
normal
{ "blob_id": "c700af6d44cd036212c9e4ae4932bc60630f961e", "index": 6930, "step-1": "<mask token>\n", "step-2": "<mask token>\nif os.path.isdir(project):\n print('ERROR: Project exists')\n exit()\nos.mkdir(project)\nos.chdir(project)\n<mask token>\nos.system(cmd)\n<mask token>\nwith open('requirements.txt',...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python """ haxor Unofficial Python wrapper for official Hacker News API @author avinash sajjanshetty @email hi@avi.im """ from __future__ import absolute_import from __future__ import unicode_literals import datetime import json import sys import requests from .settings import supported_api_versions...
normal
{ "blob_id": "e14c7eb11c06d6de5c2f9f8adfb8b742fcb432e1", "index": 8073, "step-1": "<mask token>\n\n\nclass HackerNews(object):\n <mask token>\n\n def _get(self, url):\n \"\"\"Internal method used for GET requests\n\n Args:\n url (string): URL to send GET.\n\n Returns:\n ...
[ 11, 16, 17, 20, 29 ]
import os import base64 from binascii import hexlify from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.primitives import hashes, hmac from cryptography.hazmat.backends import default_backend backend = default_backend() # Llave falsa key = key = b"vcOqXPg==lz3M0IH4s...
normal
{ "blob_id": "c33aedbd5aaa853131c297a9382b72c3c646a319", "index": 4006, "step-1": "<mask token>\n\n\ndef decrypt(message):\n message = base64.urlsafe_b64decode(message)\n iv = message[:16]\n signed_data = message[16:36]\n encrypted_data = message[36:]\n cipher = Cipher(algorithms.AES(key), modes.CB...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print( 'Έχουμε ένα τριώνυμο ax²+bx+c. Δώστε μία θετική ή αρνητική τιμή σε κάθε σταθερά!' ) <|reserved_special_token_0|> print('Η Διακρίνουσα ειναι: ' + str(D)) if D > 0: x1 = (-b + math.sqrt(D)) / (2 * a) print('Η ...
flexible
{ "blob_id": "b80deec4d3d3ab4568f37cc59e098f1d4af5504c", "index": 6503, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\n 'Έχουμε ένα τριώνυμο ax²+bx+c. Δώστε μία θετική ή αρνητική τιμή σε κάθε σταθερά!'\n )\n<mask token>\nprint('Η Διακρίνουσα ειναι: ' + str(D))\nif D > 0:\n x1 = (-b + math...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import json import requests BASE_URL = 'http://www.omdbapi.com/' def rating_msg(rating): if rating > 80: return 'You should watch this movie right now!\n' elif rating < 50: return 'Avoid this movie at all cost!\n' else: re...
normal
{ "blob_id": "7f33effa86fc3a80fce0e5e1ecf97ab4ca80402d", "index": 1833, "step-1": "<mask token>\n\n\ndef rating_msg(rating):\n if rating > 80:\n return 'You should watch this movie right now!\\n'\n elif rating < 50:\n return 'Avoid this movie at all cost!\\n'\n else:\n return ''\n\n\...
[ 1, 2, 3, 4, 5 ]
from flask import current_app def get_logger(): return current_app.logger def debug(msg, *args, **kwargs): get_logger().debug(msg, *args, **kwargs) def info(msg, *args, **kwargs): get_logger().info(msg, *args, **kwargs) def warn(msg, *args, **kwargs): get_logger().warning(msg, *args, **kwargs) ...
normal
{ "blob_id": "355e2799e89dfea4f775480ea7d829a075f92473", "index": 4241, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_logger():\n return current_app.logger\n\n\n<mask token>\n\n\ndef info(msg, *args, **kwargs):\n get_logger().info(msg, *args, **kwargs)\n\n\n<mask token>\n", "step-3": ...
[ 0, 2, 3, 4, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('Grainger_Library.csv', newline='') as f: reader = csv.reader(f) data = list(reader) del data[0] <|reserved_special_token_0|> data.sort(key=lambda x: x[1]) for i in range(0, len(data)): gld.append((data[i][1]...
flexible
{ "blob_id": "79ff164c36cc5f0a2382a571ec183952a03e66cc", "index": 9570, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('Grainger_Library.csv', newline='') as f:\n reader = csv.reader(f)\n data = list(reader)\ndel data[0]\n<mask token>\ndata.sort(key=lambda x: x[1])\nfor i in range(0, len(d...
[ 0, 1, 2, 3, 4 ]
if __name__ == '__main__': print('--------------------------------------') query = 'user=pilgrim&database=master&password=PapayaWhip' a_list = query.split('&') print(a_list) print('--------------------------------------') a_list_of_lists = [v.split('=', 1) for v in a_list if '=' in v] print(...
normal
{ "blob_id": "5c3bf49f88dec429ec85cceb8130cccf2691363b", "index": 1538, "step-1": "<mask token>\n", "step-2": "if __name__ == '__main__':\n print('--------------------------------------')\n query = 'user=pilgrim&database=master&password=PapayaWhip'\n a_list = query.split('&')\n print(a_list)\n pr...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(0, n): reg = int(input('Enter RegNo: ')) student_reg.append(reg) marks = int(input('Enter marks: ')) student_marks.append(marks) <|reserved_special_token_0|> gplt.title('RegNo. V/S Marks') gplt.xlabe...
flexible
{ "blob_id": "dcbbc7098410d771a7151af7c43ac4d0e4d46f18", "index": 9135, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, n):\n reg = int(input('Enter RegNo: '))\n student_reg.append(reg)\n marks = int(input('Enter marks: '))\n student_marks.append(marks)\n<mask token>\ngplt.tit...
[ 0, 1, 2, 3, 4 ]
""" Django settings for hauki project. """ import logging import os import subprocess import environ import sentry_sdk from django.conf.global_settings import LANGUAGES as GLOBAL_LANGUAGES from django.core.exceptions import ImproperlyConfigured from sentry_sdk.integrations.django import DjangoIntegration CONFIG_FILE...
normal
{ "blob_id": "5ed34ada35dfb2f783af4485bf9d31aa42712b9a", "index": 4480, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_git_revision_hash() ->str:\n \"\"\"\n Retrieve the git hash for the underlying git repository or die trying\n\n We need a way to retrieve git revision hash for sentry...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> for i in range(-10, 0): print(i, end=' ') <|reserved_special_token_1|> for i in range(-10,0): print(i,end=" ")
flexible
{ "blob_id": "8d0fcf0bf5effec9aa04e7cd56b4b7098c6713cb", "index": 70, "step-1": "<mask token>\n", "step-2": "for i in range(-10, 0):\n print(i, end=' ')\n", "step-3": "for i in range(-10,0):\n print(i,end=\" \")", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
## PURPOSE: get reads for certain motifs across certain tumors ## INPUT: manifest data all-tumor-manifest.csv ## collapsed fastq files sample.converted.unpaired.fastq.collapsed ## OUTPUT: table containing reads for specific motif across samples motif.tumor.common.reads.fastq.collapsed.summary.tsv import...
normal
{ "blob_id": "ddabceb223f4e457a0f69af5abf793ae72e5f432", "index": 1465, "step-1": "<mask token>\n\n\ndef getCollapsedFastqDataframe(file):\n df = pd.read_table(file, header=None, delim_whitespace=True)\n df = df.dropna(axis=1, how='all')\n sample = file.split('/')\n sample = sample[len(sample) - 1]\n ...
[ 2, 3, 4, 5, 6 ]
import io from PIL import Image def bytes_from_file(path, size, quality=15): img = Image.open(path) img = img.resize(size) img_byte_arr = io.BytesIO() img.save(img_byte_arr, format="JPEG", quality=quality) return img_byte_arr.getvalue()
normal
{ "blob_id": "3344eb5b3e5b5eaee7b08d0991be732dae62c7fc", "index": 7137, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef bytes_from_file(path, size, quality=15):\n img = Image.open(path)\n img = img.resize(size)\n img_byte_arr = io.BytesIO()\n img.save(img_byte_arr, format='JPEG', qualit...
[ 0, 1, 2, 3 ]
from django.contrib import admin from orders.models import OrderModel @admin.register(OrderModel) class OrderAdmin(admin.ModelAdmin): list_display = ['first_name', 'phone']
normal
{ "blob_id": "a238175c94764137bfc8fac1ce67436016b1591a", "index": 1519, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@admin.register(OrderModel)\nclass OrderAdmin(admin.ModelAdmin):\n <mask token>\n", "step-3": "<mask token>\n\n\n@admin.register(OrderModel)\nclass OrderAdmin(admin.ModelAdmin):\...
[ 0, 1, 2, 3 ]