code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
#!/usr/bin/python2.7 # # Assignment2 Interface # import psycopg2 import os import sys import Assignment1 as a # Donot close the connection inside this file i.e. do not perform openconnection.close() #range__metadata = RangeRatingsMetadata #roundR_metadata = RoundRobinRatingsMetadata #rangetablepartition = rangeratings...
normal
{ "blob_id": "0c736bb5c88a8d7ee359e05fe12f0b77d83146c8", "index": 3439, "step-1": "#!/usr/bin/python2.7\n#\n# Assignment2 Interface\n#\n\nimport psycopg2\nimport os\nimport sys\nimport Assignment1 as a\n# Donot close the connection inside this file i.e. do not perform openconnection.close()\n#range__metadata = Ra...
[ 0 ]
def get_partial_matched(n): pi = [0] * len(n) begin = 1 matched = 0 while begin + matched < len(n): if n[begin + matched] == n[matched]: matched += 1 pi[begin + matched - 1] = matched else: if matched == 0: begin += 1 else: ...
normal
{ "blob_id": "16a77c45a58e31c575511146dfceeaef0a2bc3a7", "index": 3640, "step-1": "<mask token>\n\n\ndef get_common(h, n):\n pi = get_partial_matched(n)\n begin = 0\n matched = 0\n while begin + matched < len(h):\n if matched < len(n) and h[begin + matched] == n[matched]:\n matched +...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def read_contact(): contacts = Contact.select() for contact in contacts: print(contact) print(contact.firstname + ' ' + contact.lastname + ' ' + contact. phone + ' ' + contact.email + ' ' + contact.address) def create_contact(): contact_firstname ...
flexible
{ "blob_id": "07544d1eb039da0081716aa489fc1a0a5a200145", "index": 1072, "step-1": "<mask token>\n\n\ndef read_contact():\n contacts = Contact.select()\n for contact in contacts:\n print(contact)\n print(contact.firstname + ' ' + contact.lastname + ' ' + contact.\n phone + ' ' + cont...
[ 7, 9, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> _sym_db.RegisterFileDescriptor(DESCRIPTOR) <|reserved_special_token_0|> _sym_db.RegisterMessage(GetUserInterestRequest) <|reserved_special_token_0|> _sym_db.RegisterServiceDescriptor(_USERINTERESTSERVICE) <|reserved_special_token_...
flexible
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def run() ->None: os.environ['TZ'] = 'Europe/Brussels' if sys.platform != 'win32': from time import tzset tzset() print(datetime.now()) load_dotenv() Log.setup() token = os.getenv('DISCORD...
flexible
{ "blob_id": "a7123fa221555b15162dbab0d93a86965190b805", "index": 4141, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run() ->None:\n os.environ['TZ'] = 'Europe/Brussels'\n if sys.platform != 'win32':\n from time import tzset\n tzset()\n print(datetime.now())\n load_dote...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> filenames.sort() <|reserved_special_token_0|> for filename in filenames: infile = open('data/SENTIMENT_test/' + filename, errors='ignore') infiletext = infile.read() infiletext = infiletext.replace('\n', ' ') infil...
flexible
{ "blob_id": "6434e427c9015544985a38104cffeaa10866b9ea", "index": 4585, "step-1": "<mask token>\n", "step-2": "<mask token>\nfilenames.sort()\n<mask token>\nfor filename in filenames:\n infile = open('data/SENTIMENT_test/' + filename, errors='ignore')\n infiletext = infile.read()\n infiletext = infilet...
[ 0, 1, 2, 3 ]
from django import forms from django.forms import widgets from tsuru_dashboard import settings import requests class ChangePasswordForm(forms.Form): old = forms.CharField(widget=forms.PasswordInput()) new = forms.CharField(widget=forms.PasswordInput()) confirm = forms.CharField(widget=forms.PasswordInput...
normal
{ "blob_id": "27fc11ae68531c7dbafdcf134f0eef019210e2de", "index": 8347, "step-1": "<mask token>\n\n\nclass PasswordRecoveryForm(forms.Form):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TokenRequestForm(forms.Form):\n email = forms.EmailField()\n\n def send(self):\n url = '{0}/use...
[ 14, 15, 18, 19, 20 ]
from setuptools import setup, find_packages setup(name='qn', version='0.2.2', description='Handy functions I use everyday.', url='https://github.com/frlender/qn', author='Qiaonan Duan', author_email='geonann@gmail.com', license='MIT', packages=find_packages(), # install_...
normal
{ "blob_id": "3b307ae7f8b8b25c93eb2dc54b2603b1291b6232", "index": 1789, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='qn', version='0.2.2', description=\n 'Handy functions I use everyday.', url='https://github.com/frlender/qn',\n author='Qiaonan Duan', author_email='geonann@gmail.com', ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TestCRMcreateCustomer(TestCRM): <|reserved_special_token_0|> def test_weiChat(self): self.login() self.createCustomer() self.logout() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestCRMcreateCus...
flexible
{ "blob_id": "74bc530d53cd86c52c44ba8e98d4d8f502032340", "index": 2423, "step-1": "<mask token>\n\n\nclass TestCRMcreateCustomer(TestCRM):\n <mask token>\n\n def test_weiChat(self):\n self.login()\n self.createCustomer()\n self.logout()\n\n\n<mask token>\n", "step-2": "<mask token>\n\...
[ 2, 3, 4, 5, 6 ]
import datetime from ..core.indicator import Indicator, IndicatorState from ..core.toolwindow import ToolWindow class HaakePhoenix(ToolWindow): required_devices = ['haakephoenix'] def __init__(self, *args, **wargs): self.indicators = {} super().__init__(*args, **wargs) def init_gui(self...
normal
{ "blob_id": "25aa0766505b22588107d44e15c3596e9383d4e9", "index": 486, "step-1": "<mask token>\n\n\nclass HaakePhoenix(ToolWindow):\n <mask token>\n\n def __init__(self, *args, **wargs):\n self.indicators = {}\n super().__init__(*args, **wargs)\n\n def init_gui(self, *args, **kwargs):\n ...
[ 8, 10, 13, 14, 15 ]
### ### Copyright 2009 The Chicago Independent Radio Project ### All Rights Reserved. ### ### Licensed under the Apache License, Version 2.0 (the "License"); ### you may not use this file except in compliance with the License. ### You may obtain a copy of the License at ### ### http://www.apache.org/licenses/LICENS...
normal
{ "blob_id": "d077f32061b87a4bfd6a0ac226730957a4000804", "index": 5859, "step-1": "<mask token>\n\n\nclass UserNotAllowedError(Exception):\n \"\"\"Raised when the user is recognized but forbidden from entering.\"\"\"\n\n\nclass _Credentials(object):\n email = None\n security_token_is_stale = False\n\n\n<...
[ 10, 11, 12, 13, 16 ]
import numpy as np import pandas as pd import plotly.graph_objects as go from matplotlib import pyplot as plt def plot_feature_VS_Observed(feature, df, linecolor): """ This function plots the 1880-2004 time series plots for the selected feature and observed earth :param Input: df -- > The dataframe...
normal
{ "blob_id": "8348d353e6fdea77c9c994d541db1420ef57a797", "index": 4399, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef plot_feature_VS_Observed(feature, df, linecolor):\n \"\"\"\n This function plots the 1880-2004 time series plots for the selected feature and observed earth\n :param\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(12): if 'r' in input(): c += 1 print(c) <|reserved_special_token_1|> c = 0 for i in range(12): if 'r' in input(): c += 1 print(c) <|reserved_special_token_1|> # ????? c=0 for i in r...
flexible
{ "blob_id": "294b0dc7587ecd37887591da5a1afe96a4349f6b", "index": 8711, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(12):\n if 'r' in input():\n c += 1\nprint(c)\n", "step-3": "c = 0\nfor i in range(12):\n if 'r' in input():\n c += 1\nprint(c)\n", "step-4": "# ????...
[ 0, 1, 2, 3 ]
import matplotlib.pyplot as plt import pandas as pd import numpy as np data=pd.read_excel("data_SHA.xls") fig,ax=plt.subplots() ax.plot(data["Date"],data["HCHFI"],label="HCHFI") ax.plot(data["Date"],data["SHA"]/2.67547,label="SSE Composite Index") ax.plot(data["Date"],data["Hushen300 Index"]/3.20393,label="Hushen300 In...
normal
{ "blob_id": "91df15d6d89d070677704572d35218558317a6ec", "index": 117, "step-1": "<mask token>\n", "step-2": "<mask token>\nax.plot(data['Date'], data['HCHFI'], label='HCHFI')\nax.plot(data['Date'], data['SHA'] / 2.67547, label='SSE Composite Index')\nax.plot(data['Date'], data['Hushen300 Index'] / 3.20393, lab...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def isChar(c): return c > 'a' and c < 'z' or c > 'A' and c < 'Z' def isOperator(c): return c in operators def isDefun(line): return '(' in line and ')' in line and sum([(i in line) for i in toDelete]) def isDefStruct(line): return 'struct ' in line and len(line.split...
flexible
{ "blob_id": "082e3350c5827ff2ca909084f2d6a206ae21a7e6", "index": 3240, "step-1": "<mask token>\n\n\ndef isChar(c):\n return c > 'a' and c < 'z' or c > 'A' and c < 'Z'\n\n\ndef isOperator(c):\n return c in operators\n\n\ndef isDefun(line):\n return '(' in line and ')' in line and sum([(i in line) for i i...
[ 10, 12, 15, 16, 17 ]
# Generated by Django 3.2.3 on 2021-05-23 19:41 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('main_app', '0002_notebook_smathphone'), ] operations = [ migrations.RenameModel( old_name='Smathphone', new_name='Smartphone...
normal
{ "blob_id": "7e11a33d82926ed544640a0192e905d373f575da", "index": 2766, "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 = [('main_app', ...
[ 0, 1, 2, 3, 4 ]
from django.contrib import admin from apap.models import * # Register your models here. admin.site.register(Doggo) admin.site.register(Profile)
normal
{ "blob_id": "22504b466cdeb380b976e23e2708e94131722e11", "index": 8147, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Doggo)\nadmin.site.register(Profile)\n", "step-3": "from django.contrib import admin\nfrom apap.models import *\nadmin.site.register(Doggo)\nadmin.site.register(Prof...
[ 0, 1, 2, 3 ]
import os import attr import click import guitarpro import psutil ALL = object() @attr.s class GPTools: input_file = attr.ib() output_file = attr.ib() selected_track_numbers = attr.ib(default=None) selected_measure_numbers = attr.ib(default=None) selected_beat_numbers = attr.ib(default=None) ...
normal
{ "blob_id": "c6821cb8dd6f8d74ca20c03f87dae321eb869c32", "index": 2454, "step-1": "<mask token>\n\n\n@attr.s\nclass GPTools:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def parse(self):\n if self.input_file is None:\n self.in...
[ 7, 8, 9, 11, 12 ]
from layout import UIDump import Tkinter from Tkinter import * from ScriptGenerator import ScriptGen class Divide_and_Conquer(): def __init__(self, XY): self.XY = XY self.user_val = 'None' self.flag = 'green' print self.XY def bounds_Compare(self, bounds, filename): """ Compares the bounds with Master...
normal
{ "blob_id": "7a65a5522db97a7a113a412883b640feede5bcee", "index": 909, "step-1": "from layout import UIDump\nimport Tkinter \nfrom Tkinter import *\nfrom ScriptGenerator import ScriptGen\n\nclass Divide_and_Conquer():\n\n\tdef __init__(self, XY):\n\t\tself.XY = XY\n\t\tself.user_val = 'None'\n\t\tself.flag = 'gre...
[ 0 ]
<|reserved_special_token_0|> class SensorDataFrame: def __init__(self, data): self.speed, self.steering, self.throttle, self.temp = data self.timestamp = datetime.now() def __str__(self): return SENSOR_DATA_FORMAT.format(self.speed, self.steering, self. throttle, self.tem...
flexible
{ "blob_id": "cf4170760fe6210d8b06f179484258f4ae3f8796", "index": 7284, "step-1": "<mask token>\n\n\nclass SensorDataFrame:\n\n def __init__(self, data):\n self.speed, self.steering, self.throttle, self.temp = data\n self.timestamp = datetime.now()\n\n def __str__(self):\n return SENSOR...
[ 4, 6, 7, 8, 9 ]
#!/usr/bin/python import time from daemon import runner import graphitesend from pywatts import get_data class App(): def __init__(self): self.stdin_path = '/dev/null' self.stdout_path = '/dev/tty' self.stderr_path = '/dev/tty' self.pidfile_path = '/tmp/currentcost_daemon.pid' self.pidfile_timeout = 5 ...
normal
{ "blob_id": "1aa49bc9a3ea12dffff907d17bd40b4425f28e13", "index": 9829, "step-1": "#!/usr/bin/python\nimport time\nfrom daemon import runner\nimport graphitesend\nfrom pywatts import get_data\n\nclass App():\n\tdef __init__(self):\n\t\tself.stdin_path = '/dev/null'\n\t\tself.stdout_path = '/dev/tty'\n\t\tself.std...
[ 0 ]
N = int(input()) l = [] for n in range(N): x = int(input()) l.append(x) l.sort() print(*l, sep='\n')
normal
{ "blob_id": "a699b43c57c315967a6d1881d7012fee4a93607b", "index": 6347, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor n in range(N):\n x = int(input())\n l.append(x)\nl.sort()\nprint(*l, sep='\\n')\n", "step-3": "N = int(input())\nl = []\nfor n in range(N):\n x = int(input())\n l.append...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Markdown: <|reserved_special_token_0|> <|reserved_special_token_0|> def __processSingleLine(self, line): if self.__isHeading(line): self.__process('p') self.__analyzing.append(re.sub('(#{1,6})', '', line).strip()) self.__proce...
flexible
{ "blob_id": "13e3337cf9e573b8906fe914a830a8e895af20ba", "index": 3983, "step-1": "<mask token>\n\n\nclass Markdown:\n <mask token>\n <mask token>\n\n def __processSingleLine(self, line):\n if self.__isHeading(line):\n self.__process('p')\n self.__analyzing.append(re.sub('(#{...
[ 9, 10, 11, 12, 13 ]
# -*- coding: utf-8 -*- # @Author: huerke # @Date: 2016-09-03 10:55:54 # @Last Modified by: huerke # @Last Modified time: 2016-09-03 15:54:50 from flask import render_template from . import main @main.app_errorhandler(404) def page_not_found(e): return render_template('404.html'), 404 @main.app_errorhandler...
normal
{ "blob_id": "021cbd1bd22f9ec48db2e52b2a98be169bbfdbbd", "index": 5979, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@main.app_errorhandler(404)\ndef page_not_found(e):\n return render_template('404.html'), 404\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\n@main.app_errorhandler(404)\ndef ...
[ 0, 1, 2, 3, 4 ]
# -*-coding:utf-8-*- # Author: Scott Larter import pygame import pygame.draw import numpy as np from agent import * from tools import * SCREENSIZE = [1200, 400] # walls.csv #SCREENSIZE = [1200, 650] # walls2.csv RESOLUTION = 180 AGENTSNUM = 12 GROUPSNUM = 2 MAXGROUPSIZE = 6 MAXSUBGROUPSIZE = 3 BACKGROUNDCOLOR = [255...
normal
{ "blob_id": "00051a4087bfcf2e6826e9afa898830dc59aa5ab", "index": 5451, "step-1": "<mask token>\n", "step-2": "<mask token>\npygame.init()\n<mask token>\npygame.display.set_caption('Social Force Model - Crosswalk')\n<mask token>\nfor line in open(WALLSFILE, newline='', encoding='utf-8-sig'):\n coords = line....
[ 0, 1, 2, 3, 4 ]
from datetime import datetime class Location: def __init__(self, location_dict): self.x = location_dict['x'] self.y = location_dict['y'] self.id = location_dict['id'] self.events = [] self.latest_average_value = 0 self.latest_event_count = 0 self.average_...
normal
{ "blob_id": "efbfe95acbe0b97e863c8788bca4a71633da36b3", "index": 1906, "step-1": "<mask token>\n\n\nclass Location:\n <mask token>\n <mask token>\n\n def update_overall_average_value(self):\n value_sum = 0\n for event in self.events:\n value_sum += event.value\n value_cou...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def generate_mutation(base): """ Taking into account the current base, base, return a mutation. """ if base in ['A', 'C', 'G', 'T']: bases = ['A', 'C', 'G', 'T'] bases.remove(base) return np.random.choice(bases) else: raise Exception('base i...
flexible
{ "blob_id": "d3f80deb72ca2bd91fc09b49ad644f54d339f962", "index": 5819, "step-1": "<mask token>\n\n\ndef generate_mutation(base):\n \"\"\"\n\tTaking into account the current base, base, return a mutation.\n\t\n\t\"\"\"\n if base in ['A', 'C', 'G', 'T']:\n bases = ['A', 'C', 'G', 'T']\n bases.r...
[ 5, 6, 7, 9, 10 ]
# -*- coding:utf-8 -*- __author__ = 'leandro' from datetime import * from PyQt4 import QtGui, QtCore from baseDatos.ventas.venta import NotaCredito from gui import CRUDWidget,MdiWidget from ventanas import Ui_vtnDevolucionDeCliente, Ui_vtnReintegroCliente, Ui_vtnVentaContado from baseDatos.obraSocial import ObraSoc...
normal
{ "blob_id": "59233cd45000cd6d6ad0876eb3812599392d7c05", "index": 9357, "step-1": "# -*- coding:utf-8 -*-\n__author__ = 'leandro'\n\n\nfrom datetime import *\n\nfrom PyQt4 import QtGui, QtCore\n\nfrom baseDatos.ventas.venta import NotaCredito\nfrom gui import CRUDWidget,MdiWidget\nfrom ventanas import Ui_vtnDevol...
[ 0 ]
<|reserved_special_token_0|> class Ui_aboutDialog(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Ui_aboutDialog(object): def setupUi(self, aboutDialog): aboutDialog.setObjectName('aboutDialog') aboutD...
flexible
{ "blob_id": "25b3defc8410c72c7c6f25288af91bd0c826f2ed", "index": 6051, "step-1": "<mask token>\n\n\nclass Ui_aboutDialog(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_aboutDialog(object):\n\n def setupUi(self, aboutDialog):\n aboutDialog.setObjectName('aboutDi...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @periodic_task(run_every=crontab(minute='*/10'), name='scrape_espn_feed', ignore_result=True) def scrape_espn_feed(): """ Saves latest image from Flickr """ thescores = doScoresScrape() fixScores(thescore...
flexible
{ "blob_id": "a9a067ee3b176d2f2ca558b69ce2bc598bb31d22", "index": 4501, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@periodic_task(run_every=crontab(minute='*/10'), name='scrape_espn_feed',\n ignore_result=True)\ndef scrape_espn_feed():\n \"\"\"\n Saves latest image from Flickr\n \"\"\"...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def solution(input): k = 1 for v in sorted(input): if v >= k: k += 1 return k - 1 <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def solution(input): k = 1 for v in sorted(input): if v >= k: ...
flexible
{ "blob_id": "a89724be31b4ccc1a3d83305509d9624da364a0c", "index": 6004, "step-1": "<mask token>\n\n\ndef solution(input):\n k = 1\n for v in sorted(input):\n if v >= k:\n k += 1\n return k - 1\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef solution(input):\n k = 1\n for ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def create_app(): app = Flask(__name__) app.config['SECRET_KEY'] = 'KARNISINGHSHEKHAWAT' app.config['SQLALCHEMY_DATABASE_URL'] = f'sqlite:///{DBNAME}' db.init_app(app) from .views import views from .auth ...
flexible
{ "blob_id": "c6fdb9c405427a3583a59065f77c75c4aa781405", "index": 5417, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef create_app():\n app = Flask(__name__)\n app.config['SECRET_KEY'] = 'KARNISINGHSHEKHAWAT'\n app.config['SQLALCHEMY_DATABASE_URL'] = f'sqlite:///{DBNAME}'\n db.init_app(...
[ 0, 1, 2, 3 ]
import json import unittest from music_focus.workflows.weibo_online import WeiboOnline class Test(unittest.TestCase): def setUp(self): pass def test(self): workflow_input = {'result_type': 'posts'} wf = WeiboOnline() r = wf.run(workflow_input) print(json.dumps(r, ensu...
normal
{ "blob_id": "7088f7233b67dcb855482a76d304aacc1a26abad", "index": 3790, "step-1": "<mask token>\n\n\nclass Test(unittest.TestCase):\n <mask token>\n\n def test(self):\n workflow_input = {'result_type': 'posts'}\n wf = WeiboOnline()\n r = wf.run(workflow_input)\n print(json.dumps(...
[ 3, 4, 5, 6 ]
<|reserved_special_token_0|> class DailyCacheMiddleware(CacheMiddleware): <|reserved_special_token_0|> @property def key_prefix(self): return date.today().isoformat() + '/' + (self.__key_prefix or '') @key_prefix.setter def key_prefix(self, value): self.__key_prefix = value <|r...
flexible
{ "blob_id": "5b440484c5d7f066c54837c2812967a0ff360399", "index": 9905, "step-1": "<mask token>\n\n\nclass DailyCacheMiddleware(CacheMiddleware):\n <mask token>\n\n @property\n def key_prefix(self):\n return date.today().isoformat() + '/' + (self.__key_prefix or '')\n\n @key_prefix.setter\n ...
[ 3, 4, 5, 6 ]
from django.db import models from datetime import datetime # Message model for testing purposes class Message(models.Model): type = models.CharField(max_length=10) body = models.CharField(max_length=50) def __str__(self): return self.type + ":" + self.body # Company model class Co...
normal
{ "blob_id": "47f6c4b3c279a065b8f21dab2faa71271db8d6ab", "index": 6680, "step-1": "<mask token>\n\n\nclass Company(models.Model):\n <mask token>\n\n @classmethod\n def create(cls, name):\n company = cls(name=name)\n return company\n\n def __str__(self):\n return self.name\n\n\ncla...
[ 7, 8, 11, 12, 13 ]
# -*- coding: utf-8 -*- # # This file is part of REANA. # Copyright (C) 2017, 2018 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Pytest configuration for REANA-Workflow-Controller.""" from __future__ import absolu...
normal
{ "blob_id": "502e92d3e5d059d73016702ce0b2591a123810d3", "index": 6892, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.fixture(scope='module')\ndef base_app(tmp_shared_volume_path):\n \"\"\"Flask application fixture.\"\"\"\n config_mapping = {'SERVER_NAME': 'localhost:5000', 'SECRET_KEY'...
[ 0, 1, 2, 3 ]
import numpy as np import pandas as pd from pathlib import Path import matplotlib as mpl from matplotlib import pyplot as plt plt.style.use('seaborn-muted') #from IPython import get_ipython from IPython.display import HTML, Markdown import air_cargo_problems as acp problems = ['Air Cargo Problem 1', '...
normal
{ "blob_id": "cd49230be3c418853aa2986ed727204e51a6b6ae", "index": 3794, "step-1": "<mask token>\n\n\ndef get_results_df(fname, problem):\n \"\"\"Process csv into dataframe.\n \"\"\"\n t = '\\t'\n val_cols = ['Actions', 'Expansions', 'GoalTests', 'NewNodes',\n 'PlanLength', 'ElapsedSeconds']\n ...
[ 6, 12, 14, 16, 17 ]
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2011-Today Serpent Consulting Services Pvt.Ltd. (<http://www.serpentcs.com>). # Copyright (C) 2004 OpenERP SA (<http://www.openerp.com>) # # Thi...
normal
{ "blob_id": "ac99c19294661657d383b036c9ab83e7b610cb7d", "index": 6896, "step-1": "<mask token>\n\n\nclass location_accommodation(models.AbstractModel):\n <mask token>\n <mask token>\n\n @api.multi\n def render_html(self, docids, data=None):\n report = self.env['report']._get_report_from_name(\...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for string in inputList: hasDoubleDupes = False hasTripleDupes = False for char in string: numRepeatsChar = string.count(char) if numRepeatsChar == 2 and not hasDoubleDupes: doubleDupes += 1...
flexible
{ "blob_id": "9620479e9ac27c1c7833c9a31b9cb18408b8d361", "index": 4019, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor string in inputList:\n hasDoubleDupes = False\n hasTripleDupes = False\n for char in string:\n numRepeatsChar = string.count(char)\n if numRepeatsChar == 2 and ...
[ 0, 1, 2, 3, 4 ]
def fibonacci(quantidade): resultado = [1, 2] # while True: # substituir o while pelo for, em um range do 2° valor da lista, correr até # o valor definido na função "Quantidade" for _ in range(2, quantidade): # desta forma ele irá realizar a função do 2° da lista até atingir # o valor ...
normal
{ "blob_id": "83c7bb2e109f8affd9e2a12e8c5370b0f5a34048", "index": 653, "step-1": "<mask token>\n", "step-2": "def fibonacci(quantidade):\n resultado = [1, 2]\n for _ in range(2, quantidade):\n resultado.append(sum(resultado[-2:]))\n return resultado\n\n\n<mask token>\n", "step-3": "def fibonac...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class User_Game(CPU_Game): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class User_Game(CPU_Game): def get_user_phrase(self): correct_form = False while not...
flexible
{ "blob_id": "d0dbf5a13b8e718ed426a254546ba13da12b2c3e", "index": 4149, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass User_Game(CPU_Game):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass User_Game(CPU_Game):\n\n def get_user_phrase(self):\n correct_form = False\n whi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @PublicAPI class ParameterNoise(Exploration): <|reserved_special_token_0|> def __init__(self, action_space, *, framework: str, policy_config: dict, model: ModelV2, initial_stddev: float=1.0, random_timesteps: int= 10000, sub_exploration: Optional[dict]=None, **kwa...
flexible
{ "blob_id": "b2b47b394eadebda5c51e89abd27832f9dbd4c8c", "index": 4193, "step-1": "<mask token>\n\n\n@PublicAPI\nclass ParameterNoise(Exploration):\n <mask token>\n\n def __init__(self, action_space, *, framework: str, policy_config: dict,\n model: ModelV2, initial_stddev: float=1.0, random_timesteps...
[ 16, 17, 20, 21, 22 ]
<|reserved_special_token_0|> def generate_str(): print(','.join(str(d) for d in data)) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def generate_str(): print(','.join(str(d) for d in data)) def sample(): yield 'Is' yield 'Chicago' yield 'Not' ...
flexible
{ "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 ]
# Generated by Django 3.0.1 on 2020-01-11 19:59 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0004_auto_20191230_2037'), ] operations = [ migrations.AddField( model_name='user', name='cir...
normal
{ "blob_id": "6aa762165dba891a3638d13862019dd342a7e05a", "index": 7644, "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 = [('users', '00...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class GoldpriceSpider(scrapy.Spider): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self): self.browser = webdriver.PhantomJS() self.price = None def parse(self, response): self.browser.get...
flexible
{ "blob_id": "e59404149c739a40316ca16ab767cbc48aa9b685", "index": 3526, "step-1": "<mask token>\n\n\nclass GoldpriceSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self):\n self.browser = webdriver.PhantomJS()\n self.price = None\n\n def parse(self...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: a = int(input('masukkan nilai = ')) if a > 60: status = 'LULUS' elif a <= 60: status = 'TIDAK LULUS' print(status) ulang = input('apakah anda ingin mengulang? y/n = ') <|reserved_s...
flexible
{ "blob_id": "759b440bf436afbfb081cf55eeb4a0f075ed3e6d", "index": 9577, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n a = int(input('masukkan nilai = '))\n if a > 60:\n status = 'LULUS'\n elif a <= 60:\n status = 'TIDAK LULUS'\n print(status)\n ulang = input('ap...
[ 0, 1, 2, 3 ]
def fun1(fun): return "Hai!!!! "+fun def message(): return "How are you" res = fun1(message()) print(res)
normal
{ "blob_id": "e9fff1fb0a79493d4d7f3417c7d554eb10a978a0", "index": 6616, "step-1": "<mask token>\n", "step-2": "def fun1(fun):\n return 'Hai!!!! ' + fun\n\n\ndef message():\n return 'How are you'\n\n\n<mask token>\n", "step-3": "def fun1(fun):\n return 'Hai!!!! ' + fun\n\n\ndef message():\n return ...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def byGuide(data, val=None, test=None): val_guides = val if val == None: val_guides = ['GGGTGGGGGGAGTTTGCTCCTGG', 'GACCCCCTCCACCCCGCCTCCGG', 'GGCCTCCCCAAAGCCTGGCCAGG', 'GAACACAAAGCATAGACTGCGGG'] test_guides = test if test == None: test_guides = ...
flexible
{ "blob_id": "a0059563b2eed4ca185a8e0971e8e0c80f5fb8f8", "index": 6668, "step-1": "<mask token>\n\n\ndef byGuide(data, val=None, test=None):\n val_guides = val\n if val == None:\n val_guides = ['GGGTGGGGGGAGTTTGCTCCTGG', 'GACCCCCTCCACCCCGCCTCCGG',\n 'GGCCTCCCCAAAGCCTGGCCAGG', 'GAACACAAAGCA...
[ 15, 16, 19, 21, 24 ]
# In the 20×20 grid below, four numbers along a diagonal line have been marked in red. # The product of these numbers is 26 × 63 × 78 × 14 = 1788696. # What is the greatest product of four adjacent numbers in the same direction # (up, down, left, right, or diagonally) in the 20×20 grid? import numpy as np data = np.ge...
normal
{ "blob_id": "bacaaf5c91232d85f451c2c17a42cd2ec6966684", "index": 1499, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, len(data[0, :]) - 3):\n for j in range(0, len(data[0, :]) - 3):\n product_hor = data[j, i] * data[j, i + 1] * data[j, i + 2] * data[j,\n i + 3]\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @application.route('/results', methods=['GET', 'POST']) def get_results(): _logger_getting.warning('retrieving all student results') data = Student.query.all() _logger_getting.warning('the students results have been collected for {}' .format(data)) return render_te...
flexible
{ "blob_id": "18f9e55b62b30ce8c9d4a57cd9c159543a738770", "index": 4709, "step-1": "<mask token>\n\n\n@application.route('/results', methods=['GET', 'POST'])\ndef get_results():\n _logger_getting.warning('retrieving all student results')\n data = Student.query.all()\n _logger_getting.warning('the students...
[ 4, 6, 7, 8, 9 ]
from Song import Song class FroggyWoogie(Song): def __init__(self): super(FroggyWoogie, self).__init__() self.file = 'Music/5-Sleepy_Koala_-_Froggy_Woogie.mp3' self.plan = [[0.0, 32, 'W', 16.271], [16.271, 16, 'S', 8.135], [ 24.406, 44, 'S', 22.373], [46.779, 16, 'S', 8.136], ...
normal
{ "blob_id": "1df1081308ead28c023774a8671df8a0671a1bba", "index": 4177, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass FroggyWoogie(Song):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass FroggyWoogie(Song):\n\n def __init__(self):\n super(FroggyWoogie, self).__init__()\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @dataclass class Node: age: int num: int label: str alignment: [] def __init__(self, child1=None, child2=None): self.child1 = child1 self.child2 = child2 <|reserved_special_token_0|> def initializeClusters(t): numNodes = len(t) numLeaves = ...
flexible
{ "blob_id": "53cf2dfe3319c39ca6f1dc890eea578fae654b5b", "index": 8847, "step-1": "<mask token>\n\n\n@dataclass\nclass Node:\n age: int\n num: int\n label: str\n alignment: []\n\n def __init__(self, child1=None, child2=None):\n self.child1 = child1\n self.child2 = child2\n\n\n<mask to...
[ 9, 12, 16, 17, 21 ]
class Animal: def eat(self): print('吃') def bark(self): print('喝') <|reserved_special_token_0|> <|reserved_special_token_0|> class Dog(Animal): def bark(self): print('汪汪叫') class XiaoTianQuan(Dog): def bark(self): print('像神一样的叫唤...') Dog.bark(self)...
flexible
{ "blob_id": "d7aa85c2458ee12a8de0f75419945fbe2acdf95d", "index": 3946, "step-1": "class Animal:\n\n def eat(self):\n print('吃')\n\n def bark(self):\n print('喝')\n <mask token>\n <mask token>\n\n\nclass Dog(Animal):\n\n def bark(self):\n print('汪汪叫')\n\n\nclass XiaoTianQuan(Dog...
[ 8, 9, 11, 12, 13 ]
# coding=utf-8 class Movie: def __init__(self,movieid,moviename,score,poster): self.movieid=movieid self.moviename=moviename self.score=score self.poster=poster for i in range(1,32): print("<option value =\""+str(i)+"\">"+str(i)+"</option>")
normal
{ "blob_id": "856e62cf4cd443c7b3397e926f8fc4fece145f5b", "index": 3447, "step-1": "<mask token>\n", "step-2": "class Movie:\n <mask token>\n\n\n<mask token>\n", "step-3": "class Movie:\n\n def __init__(self, movieid, moviename, score, poster):\n self.movieid = movieid\n self.moviename = mo...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> config.read('config.ini') <|reserved_special_token_0|> logging.getLogger('transformers.tokenization_utils').setLevel(logLevel + oneLevelUp) logging.getLogger('transformers.modeling_utils').setLevel(logLevel + oneLevelUp ) ...
flexible
{ "blob_id": "e4fb932c476ca0222a077a43499bf9164e1f27d0", "index": 8896, "step-1": "<mask token>\n", "step-2": "<mask token>\nconfig.read('config.ini')\n<mask token>\nlogging.getLogger('transformers.tokenization_utils').setLevel(logLevel +\n oneLevelUp)\nlogging.getLogger('transformers.modeling_utils').setLev...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # script :: creating a datamodel that fits mahout from ratings.dat ratings_dat = open('../data/movielens-1m/users.dat', 'r') ratings_csv = open('../data/movielens-1m/users.txt', 'w') for line in ratings_dat: arr = line.split('::') new_line = '\t'.join(arr) ratings_csv.write(new_line) rati...
normal
{ "blob_id": "2dd59681a0dcb5d3f1143385100c09c7783babf4", "index": 76, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in ratings_dat:\n arr = line.split('::')\n new_line = '\\t'.join(arr)\n ratings_csv.write(new_line)\nratings_dat.close()\nratings_csv.close()\n", "step-3": "ratings_dat ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class AuthenticationCustom(admin.ModelAdmin): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AuthenticationCustom(admin.ModelAdmin): list_display = 'email', 'id' ...
flexible
{ "blob_id": "4957e62deec6192aabdf7144f02b28c7ce60ed4b", "index": 4250, "step-1": "<mask token>\n\n\nclass AuthenticationCustom(admin.ModelAdmin):\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass AuthenticationCustom(admin.ModelAdmin):\n list_display = 'email', 'id...
[ 1, 2, 3, 4, 5 ]
def helloWorld(): print "We are in DEMO land!" for i in range(10): helloWorld() print listBuilder() def listBuilder(): b = [] for x in range(5): b.append(10 * x) return b print "[done, for real]"
normal
{ "blob_id": "57516a17c1f3ee208076852369999d74dbb2b3ba", "index": 98, "step-1": "def helloWorld():\n print \"We are in DEMO land!\"\n\nfor i in range(10):\n helloWorld()\nprint listBuilder()\n\ndef listBuilder():\n b = []\n for x in range(5):\n b.append(10 * x)\n return b\n\nprint \"[done, for real]\"\n",...
[ 0 ]
<|reserved_special_token_0|> def get_load(pkt): ack = str(pkt[TCP].ack) seq = str(pkt[TCP].seq) src_ip_port = str(pkt[IP].src) + ':' + str(pkt[TCP].sport) dst_ip_port = str(pkt[IP].dst) + ':' + str(pkt[TCP].dport) load = pkt[Raw].load pkt_frag_loads = frag_remover(ack, load) pkt_frag_loads...
flexible
{ "blob_id": "3e0bc91b81d0f503b78c9ac685b05b7ecb754e28", "index": 3460, "step-1": "<mask token>\n\n\ndef get_load(pkt):\n ack = str(pkt[TCP].ack)\n seq = str(pkt[TCP].seq)\n src_ip_port = str(pkt[IP].src) + ':' + str(pkt[TCP].sport)\n dst_ip_port = str(pkt[IP].dst) + ':' + str(pkt[TCP].dport)\n loa...
[ 3, 4, 5, 6, 7 ]
from django.contrib.auth import get_user_model from django.test import TestCase from .models import Order from markets.models import Market from tickers.models import Ticker from trades.models import Trade USER_MODEL = get_user_model() class Matching: @staticmethod def get_bid_ask( market : Market): ...
normal
{ "blob_id": "866ee2c4fa52bf9bda4730c7a9d46bb4798adcd4", "index": 1775, "step-1": "<mask token>\n\n\nclass Matching:\n <mask token>\n <mask token>\n\n @staticmethod\n def process_order(self, order: Order):\n if order.status == Order.STATUS_WAITING_NEW:\n order.status = Order.STATUS_N...
[ 7, 8, 9, 11, 12 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Author: André Pacheco E-mail: pacheco.comp@gmail.com This file implements the methods and functions to load the image as a PyTorch dataset If you find any bug or have some suggestion, please, email me. """ from PIL import Image from torch.utils import data import t...
normal
{ "blob_id": "4e31c2a80bec77a1f5aafc8a91617fb4b2941788", "index": 432, "step-1": "<mask token>\n\n\nclass BuildDataset(data.Dataset):\n <mask token>\n\n def __init__(self, imgs_path, labels, extra_info=None, transform=None):\n \"\"\"\n The constructor gets the images path and their respectivel...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> inputDataSet.addSample((-1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1), ( 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) inputDataSet...
flexible
{ "blob_id": "a2569ccd509fa755f4cad026f483bcf891c6fb41", "index": 8120, "step-1": "<mask token>\n", "step-2": "<mask token>\ninputDataSet.addSample((-1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1,\n 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1), (\n 1, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> win.show() app.exec_() <|reserved_special_token_1|> <|reserved_special_token_0|> app = qt.QApplication([]) win = mainWindow.RIXSMainWindow() win.show() app.exec_() <|reserved_special_token_1|> from PyMca5.PyMcaGui import PyM...
flexible
{ "blob_id": "34c8541e640596f51a5232cba06172df5814db14", "index": 7734, "step-1": "<mask token>\n", "step-2": "<mask token>\nwin.show()\napp.exec_()\n", "step-3": "<mask token>\napp = qt.QApplication([])\nwin = mainWindow.RIXSMainWindow()\nwin.show()\napp.exec_()\n", "step-4": "from PyMca5.PyMcaGui import P...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import random class Role: """ 角色类 卧底 平民 """ def __init__(self,key_word="",role_id = 0): self.key_word = key_word self.role_id = role_id #平民-0;卧底-1; class User(Role): """ 用户类 玩家 """ def __init__(self,id,role_i...
normal
{ "blob_id": "3b5141a86948df6632612f6c9d7fc0089acc60aa", "index": 5981, "step-1": "<mask token>\n\n\nclass Role:\n <mask token>\n <mask token>\n\n\nclass User(Role):\n \"\"\"\n 用户类\n 玩家\n \"\"\"\n\n def __init__(self, id, role_id):\n self.id = id\n self.role_id = role_id\n", "...
[ 4, 5, 6, 7, 8 ]
class TrieNode: def __init__(self): self.children: Dict[str, TrieNode] = collections.defaultdict(TrieNode) self.word: Optional[str] = None class Solution: def findWords(self, board: List[List[str]], words: List[str]) ->List[str]: m = len(board) n = len(board[0]) ans =...
normal
{ "blob_id": "f996dffcb9650663278ec1e31d9f88d50142f4ea", "index": 4491, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n\n def findWords(self, board: List[List[str]], words: List[str]) ->List[str]:\n m = len(board)\n n = len(board...
[ 1, 2, 3, 4 ]
# coding: utf-8 import numpy as np def sparse(n, k): u""" return k sparse vector, the value of non-zero entries are normal distributed N(0,1). [args] n: size of vector k: number of nonzero entries [return] k-sparse vector """ z = np.zeros(n) for i in np.r...
normal
{ "blob_id": "f0e4cd13571728d61566c4093586c91323629e0b", "index": 7624, "step-1": "# coding: utf-8\nimport numpy as np\n\n\n\ndef sparse(n, k):\n u\"\"\"\n return k sparse vector, \n the value of non-zero entries are \n normal distributed N(0,1).\n [args]\n n: size of vector\n k: numb...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class tenDParameters: <|reserved_special_token_0|> <|reserved_special_token_1|> class tenDParameters: def __init__(self, b: float, DM: float, pm_l: float, pm_b: float, vrad: float, sb: float, spml: float, spmb: float, sdm: float, vc: float...
flexible
{ "blob_id": "82e7e22293551e061dcb295c52714c22df0ed0ce", "index": 5678, "step-1": "<mask token>\n", "step-2": "class tenDParameters:\n <mask token>\n", "step-3": "class tenDParameters:\n\n def __init__(self, b: float, DM: float, pm_l: float, pm_b: float, vrad:\n float, sb: float, spml: float, spm...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def limitZ(Z, limit=10): for i in range(len(Z)): for j in range(len(Z[i])): if Z[i][j] > limit: Z[i][j] = np.inf if Z[i][j] < -limit: Z[i][j] = -np.inf def plotPontos3D(X, Y, Z): fig = plt.figure() ax = fig.add_...
flexible
{ "blob_id": "ff20b65f35614415ad786602c0fc2cabd08124fb", "index": 4065, "step-1": "<mask token>\n\n\ndef limitZ(Z, limit=10):\n for i in range(len(Z)):\n for j in range(len(Z[i])):\n if Z[i][j] > limit:\n Z[i][j] = np.inf\n if Z[i][j] < -limit:\n Z[i][...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def test_injection(fc): from pykern import pkcompat, pkunit from pykern.pkdebug import pkdc, pkdp, pkdlog from pykern.pkunit import pkeq, pkok, pkre import re r = fc.get('myapp') pkok(not re.search('googletag', pkcompat.from_bytes(r.data)), 'Unexpected inje...
flexible
{ "blob_id": "65b5db0bc6f23c342138060b7a006ff61e2dcf45", "index": 3761, "step-1": "<mask token>\n\n\ndef test_injection(fc):\n from pykern import pkcompat, pkunit\n from pykern.pkdebug import pkdc, pkdp, pkdlog\n from pykern.pkunit import pkeq, pkok, pkre\n import re\n r = fc.get('myapp')\n pkok...
[ 1, 2, 3, 4, 5 ]
""" This module contains the logic to resolve the head-tail orientation of a predicted video time series. """ import logging import numpy as np import numpy.ma as ma from wormpose.pose.distance_metrics import angle_distance, skeleton_distance from wormpose.pose.results_datatypes import ( BaseResults, Shuffle...
normal
{ "blob_id": "b8fcd8e6dce8d210576bc4166dd258e5fd51278d", "index": 517, "step-1": "<mask token>\n\n\nclass _PartitionedResults(BaseResults):\n <mask token>\n\n def mask(self, indices):\n self.theta.mask[indices] = True\n self.skeletons.mask[indices] = True\n self.scores.mask[indices] = T...
[ 10, 19, 20, 24, 26 ]
<|reserved_special_token_0|> class xspecView(object): <|reserved_special_token_0|> def LoadSwiftPHAs(self, phaFiles): """ Load The Swift PHAs in time order """ for pha in phaFiles: s = xs.Spectrum(pha) s.ignore('**-15. 150.-**') cnts = sum(...
flexible
{ "blob_id": "ba34bae7849ad97f939c1a7cb91461269cd58b64", "index": 8994, "step-1": "<mask token>\n\n\nclass xspecView(object):\n <mask token>\n\n def LoadSwiftPHAs(self, phaFiles):\n \"\"\"\n Load The Swift PHAs in time order\n\n \"\"\"\n for pha in phaFiles:\n s = xs.S...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('http://www.pythonchallenge.com/pc/def/ocr.html') <|reserved_special_token_1|> <|reserved_special_token_0|> INPUT_TEXT = string.ascii_lowercase OUTPUT_TEXT = INPUT_TEXT[2:] + INPUT_TEXT[:2] TRANSLATION_TABLE = str.maketra...
flexible
{ "blob_id": "3c03f71ef9de8825ecd7c89208c79f43c9fb7a56", "index": 9594, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('http://www.pythonchallenge.com/pc/def/ocr.html')\n", "step-3": "<mask token>\nINPUT_TEXT = string.ascii_lowercase\nOUTPUT_TEXT = INPUT_TEXT[2:] + INPUT_TEXT[:2]\nTRANSLATION_TABL...
[ 0, 1, 2, 3, 4 ]
import sqlite3 import hashlib users = [] class UserModel: id = 0 def __init__(self, name, password, birth, sex, phone, email, id=0): if(id == 0): self.id = self.id + 1 else: self.id = id self.name = name self.email = email #處理密碼 s = has...
normal
{ "blob_id": "e675283f14a3d29fba878e7f6d9592130611c2be", "index": 1469, "step-1": "<mask token>\n\n\nclass UserModel:\n <mask token>\n\n def __init__(self, name, password, birth, sex, phone, email, id=0):\n if id == 0:\n self.id = self.id + 1\n else:\n self.id = id\n ...
[ 6, 7, 8, 9, 12 ]
import subprocess class BaseExecution: def __init__(self, flag, parser): self.flag = flag self.parser = parser def execute(self): process = subprocess.Popen(f'df {self.flag}', shell=True, stdout= subprocess.PIPE, stderr=subprocess.PIPE) output, err = process.commu...
normal
{ "blob_id": "d8af43d24a2f2b99bc8b5098f251e017852d6d86", "index": 1085, "step-1": "<mask token>\n\n\nclass BaseExecution:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass BaseExecution:\n\n def __init__(self, flag, parser):\n self.flag = flag\n self.parser = parser\n ...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class PageDetector: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class PageDetector: def __init__(self, driver): self.selenium = SeleniumWrapper(driver) <|reserved_special_token_0|> <|re...
flexible
{ "blob_id": "603d7df0639def2b620cca2299077674e35a74b2", "index": 5980, "step-1": "<mask token>\n\n\nclass PageDetector:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass PageDetector:\n\n def __init__(self, driver):\n self.selenium = SeleniumWrapper(driver)\n <mask token>\...
[ 1, 2, 3, 4, 5 ]
import sqlite3 forth = sqlite3.connect('databaserupin.db') sql = "SELECT * from rupin;" curforth = forth.cursor() curforth.execute(sql) result = curforth.fetchall() for record in result: print(record)
normal
{ "blob_id": "a7f082737bf476a4bc6a40c962764c05bed9ee14", "index": 9247, "step-1": "<mask token>\n", "step-2": "<mask token>\ncurforth.execute(sql)\n<mask token>\nfor record in result:\n print(record)\n", "step-3": "<mask token>\nforth = sqlite3.connect('databaserupin.db')\nsql = 'SELECT * from rupin;'\ncur...
[ 0, 1, 2, 3, 4 ]
''' -Medium- *BFS* You are given a 0-indexed integer array nums containing distinct numbers, an integer start, and an integer goal. There is an integer x that is initially set to start, and you want to perform operations on x such that it is converted to goal. You can perform the following operation repeatedly on the ...
normal
{ "blob_id": "50b2b9d1edc8eaa44050e2b3b2375e966f16e10c", "index": 6997, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n\n def minimumOperations(self, nums: List[int], start: int, goal: int) ->int:\n que = deque([(start...
[ 1, 2, 3, 4, 5 ]
#-*- coding: utf-8 -*- import re import sys import os import pandas as pd import jieba import logging import argparse from sklearn.externals import joblib from sklearn.svm import SVC from sklearn.naive_bayes import MultinomialNB from sklearn.metrics import f1_score,accuracy_score from sklearn.feature_extraction.text im...
normal
{ "blob_id": "c879230efe12bde9042159da221a2b9b4c1d8349", "index": 198, "step-1": "<mask token>\n\n\ndef load_data_from_csv(file_name, header=0, encoding='utf-8'):\n data_df = pd.read_csv(file_name, header=header, encoding=encoding)\n return data_df\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef lo...
[ 1, 2, 3, 4, 5 ]
from SpritesClass import Sprite from JogadorClass import Jogador from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * class Tela: def __init__(self,j,t0): self.telas = ["jogo","game over"] #telas existentes self.estagio = "jogo" self.j = j #sprites se...
normal
{ "blob_id": "d1f0baa1ff87ece50aaded5e60908269e81b6734", "index": 1952, "step-1": "<mask token>\n\n\nclass Tela:\n <mask token>\n <mask token>\n\n def setEstagio(self, temp):\n if temp in self.telas:\n self.estagio = temp\n else:\n print('Tela não existe, erro de digit...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in list(raw.keys()): if len(i) > 8: del raw[i] print(raw) print(len(list(raw.keys()))) np.save('shorten_raw_with_freq.npy', raw) <|reserved_special_token_1|> <|reserved_special_token_0|> raw = np.load('raw_wit...
flexible
{ "blob_id": "ffb17b370c892696b341f6d37a2cfe106a5670a5", "index": 4265, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in list(raw.keys()):\n if len(i) > 8:\n del raw[i]\nprint(raw)\nprint(len(list(raw.keys())))\nnp.save('shorten_raw_with_freq.npy', raw)\n", "step-3": "<mask token>\nraw ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> pub_socket.bind('tcp://*:%s' % port) while True: topic = 'test' thisX = np.random.rand() thisY = np.random.rand() testDict = {'gaze': (thisX, thisY)} pub_socket.send_string(topic, zmq.SNDMORE) pub_socket.se...
flexible
{ "blob_id": "cb469b69bf974d39609f79c4f3be686d8106f971", "index": 1431, "step-1": "<mask token>\n", "step-2": "<mask token>\npub_socket.bind('tcp://*:%s' % port)\nwhile True:\n topic = 'test'\n thisX = np.random.rand()\n thisY = np.random.rand()\n testDict = {'gaze': (thisX, thisY)}\n pub_socket....
[ 0, 1, 2, 3, 4 ]
from datetime import datetime class Guest: def __init__(self, Name, FamilyName, Car, controlboard, CarRotationManager, ID=0, linkedplatform=None,Start=0): # --Initializing Guest credentials/info--- self.Name = Name self.FamilyName = FamilyName self.Car = Car ...
normal
{ "blob_id": "3553fa72cb831f82a1030b9eadc9594eee1d1422", "index": 2152, "step-1": "<mask token>\n\n\nclass Guest:\n <mask token>\n\n def parked_and_linkedplatform_value(self):\n boolean, linkedplatform = (self.CarRotationManager.\n check_if_guest_parked(self))\n if boolean == True:\...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python """ Calculate trigger efficiency error """ __author__ = "XIAO Suyu<xiaosuyu@ihep.ac.cn>" __copyright__ = "Copyright (c) XIAO Suyu" __created__ = "[2018-02-06 Tue 15:25]" import math n1 = 4212.0 n2 = 4237.0 N = 5000.0 eff = n1 / n2 err = math.sqrt(eff*(1-eff)/N) print 'trig_eff = %.4f +- %f' ...
normal
{ "blob_id": "bac3f78b8eb9c4595bc9e8b85587819f92329729", "index": 2295, "step-1": "#!/usr/bin/env python\n\"\"\"\nCalculate trigger efficiency error\n\"\"\"\n\n__author__ = \"XIAO Suyu<xiaosuyu@ihep.ac.cn>\"\n__copyright__ = \"Copyright (c) XIAO Suyu\"\n__created__ = \"[2018-02-06 Tue 15:25]\"\n\nimport math\n\nn...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def user(request): context = {'users': User.objects.all(), 'user_level': User.objects.get( id=request.session['user_id'])} return render(request, 'dashboard/user.html', context) <|reserved_special_token_0|> <...
flexible
{ "blob_id": "3d737d0ee9c3af1f8ebe4c6998ad30fa34f42856", "index": 570, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef user(request):\n context = {'users': User.objects.all(), 'user_level': User.objects.get(\n id=request.session['user_id'])}\n return render(request, 'dashboard/user.htm...
[ 0, 1, 2, 3, 4 ]
import yet import pickle sources = pickle.load(open("./db/source_list")) addr_list = sources.keys() ''' for i in range(len(addr_list)): print addr_list[i], try: a = yet.tree(None, sources[addr_list[i]]) print ' Owner :', for i in a.owner.keys(): print i+ '() ' + a.owner[...
normal
{ "blob_id": "1c55cfa03cd9210b7cf9e728732afe19930e9a41", "index": 9786, "step-1": "import yet\nimport pickle\n\nsources = pickle.load(open(\"./db/source_list\"))\naddr_list = sources.keys()\n\n'''\nfor i in range(len(addr_list)):\n print addr_list[i], \n try:\n a = yet.tree(None, sources[addr_list[i]...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def dist(counts): n = abs(counts['n'] - counts['s']) nw = abs(counts['nw'] - counts['se']) ne = abs(counts['ne'] - counts['sw']) return n + max(ne, nw) <|reserved_special_token_0|> <|reserved_special_token_1|...
flexible
{ "blob_id": "ac2e9145e3345e5448683d684b69d2356e3214ce", "index": 9999, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef dist(counts):\n n = abs(counts['n'] - counts['s'])\n nw = abs(counts['nw'] - counts['se'])\n ne = abs(counts['ne'] - counts['sw'])\n return n + max(ne, nw)\n\n\n<mask ...
[ 0, 1, 2, 3, 4 ]
<|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": "f3b466dc5b6149be82b096791ca8445faf169380", "index": 5216, "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 = [('orders', '0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.subplot(1, 2, 1) for ls in mls: plt.plot(*ls.xy) plt.plot(*p.boundary.xy, '-.k') plt.xlim([0, 5]) plt.ylim([0, 2]) plt.subplot(1, 2, 2) for ls in results: plt.plot(*ls.xy) plt.xlim([0, 5]) plt.ylim([0, 2]) plt.show() ...
flexible
{ "blob_id": "9096ed4b68d2bef92df7db98589e744ddf3efad0", "index": 350, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.subplot(1, 2, 1)\nfor ls in mls:\n plt.plot(*ls.xy)\nplt.plot(*p.boundary.xy, '-.k')\nplt.xlim([0, 5])\nplt.ylim([0, 2])\nplt.subplot(1, 2, 2)\nfor ls in results:\n plt.plot(*ls....
[ 0, 1, 2, 3, 4 ]
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import numpy as np def weight_init(layers): for layer in layers: if isinstance(layer, nn.BatchNorm1d): layer.weight.data.fill_(1) layer.bias.data.zero_() elif isinstance(layer, nn.Lin...
normal
{ "blob_id": "2c2b075f9ea9e8d6559e44ad09d3e7767c48205e", "index": 6772, "step-1": "<mask token>\n\n\nclass LR(nn.Module):\n <mask token>\n <mask token>\n\n\nclass RNN(nn.Module):\n\n def __init__(self, feature_nums, hidden_dims, bi_lstm, out_dims=1):\n super(RNN, self).__init__()\n self.fea...
[ 7, 9, 10, 11, 12 ]
num1 = input("첫 번째 실수 : ") num2 = input("두 번째 실수 : ") print(float(num1) + float(num2)) num1 = float(input("첫 번째 실수 : ")) num2 = float(input("두 번째 실수 : ")) print(num1 + num2)
normal
{ "blob_id": "ee8bf681adcb07c4f79245c8f118131bbcabd2fa", "index": 7920, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(float(num1) + float(num2))\n<mask token>\nprint(num1 + num2)\n", "step-3": "num1 = input('첫 번째 실수 : ')\nnum2 = input('두 번째 실수 : ')\nprint(float(num1) + float(num2))\nnum1 = float(...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class FashionbertEvaluator(transformers.BertPreTrainedModel): def __init__(self, config): super().__init__(config) self.bert = BertModel(config) self.im_to_embedding = torch.nn.Linear(2048, 768) self.im_to_embedding_norm = torch.nn.LayerNorm(config.hid...
flexible
{ "blob_id": "7a01bffa5d7f0d5ecff57c97478f2cf5e9a27538", "index": 1210, "step-1": "<mask token>\n\n\nclass FashionbertEvaluator(transformers.BertPreTrainedModel):\n\n def __init__(self, config):\n super().__init__(config)\n self.bert = BertModel(config)\n self.im_to_embedding = torch.nn.Li...
[ 8, 10, 12, 13, 14 ]
############################################################################### ## ## Copyright (C) 2011-2014, NYU-Poly. ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## "Redistribution and use in source and binary for...
normal
{ "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 ]
tn=int(input()) for ti in range(tn): #ans = work() rn,cn = [int(x) for x in input().split()] evenRow='-'.join(['+']*(cn+1)) oddRow='.'.join(['|']*(cn+1)) artrn = rn*2+1 print(f'Case #{ti+1}:') for ri in range(artrn): defaultRow = evenRow if ri%2==0 else oddRow if ri//2==0: ...
normal
{ "blob_id": "1972e3733918da654cd156a500432a35a239aed4", "index": 1841, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor ti in range(tn):\n rn, cn = [int(x) for x in input().split()]\n evenRow = '-'.join(['+'] * (cn + 1))\n oddRow = '.'.join(['|'] * (cn + 1))\n artrn = rn * 2 + 1\n print(...
[ 0, 1, 2, 3 ]
import requests import datetime from yahoo_finance import Share def getYahooStock(ticker, date1, date2): companyData = Share(ticker) dataList = companyData.get_historical(date1, date2) endData = dataList[0]; startData = dataList[len(dataList) - 1]; print ticker, float(startData['Open']), float(endD...
normal
{ "blob_id": "07854dc9e0a863834b8e671d29d5f407cdd1c13e", "index": 9599, "step-1": "import requests\nimport datetime\nfrom yahoo_finance import Share\n\ndef getYahooStock(ticker, date1, date2):\n companyData = Share(ticker)\n dataList = companyData.get_historical(date1, date2)\n endData = dataList[0];\n ...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for char in word: if count == 0: print(char.upper(), end='') count = 1 else: print(char.lower(), end='') count = 0 <|reserved_special_token_1|> <|reserved_special_token_0|> word = str(inp...
flexible
{ "blob_id": "bc837d95ef22bd376f8b095e7aeb1f7d15c0e22e", "index": 941, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor char in word:\n if count == 0:\n print(char.upper(), end='')\n count = 1\n else:\n print(char.lower(), end='')\n count = 0\n", "step-3": "<mask toke...
[ 0, 1, 2, 3 ]
import pickle if __name__ == '__main__': with open('id_generator.bin', 'rb') as f: print(pickle.load(f))
normal
{ "blob_id": "080110e404cf5edfe53622a5942b53f9188ddd76", "index": 1854, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n with open('id_generator.bin', 'rb') as f:\n print(pickle.load(f))\n", "step-3": "import pickle\nif __name__ == '__main__':\n with open('id_gene...
[ 0, 1, 2 ]
h = int(input()) a = int(input()) b = int(input()) c = (h - b + a - b - 1) // (a - b) print(int(c))
normal
{ "blob_id": "eea962d6c519bee802c346fcf8d0c7410e00c30b", "index": 9587, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(int(c))\n", "step-3": "h = int(input())\na = int(input())\nb = int(input())\nc = (h - b + a - b - 1) // (a - b)\nprint(int(c))\n", "step-4": null, "step-5": null, "step-ids"...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class gramWishbone(Peripheral, Elaboratable): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class gramWishbone(Peripheral, Elaboratable): def __init__(self, core, data_width=32, granularity=8): ...
flexible
{ "blob_id": "3775ba538d6fab13e35e2f0761a1cacbe087f339", "index": 4723, "step-1": "<mask token>\n\n\nclass gramWishbone(Peripheral, Elaboratable):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass gramWishbone(Peripheral, Elaboratable):\n\n def __init__(self, core, data_width=32, gra...
[ 1, 2, 3, 4, 5 ]
from flask import Flask from flask import request, redirect, render_template from flask_bootstrap import Bootstrap import urllib.request import urllib.parse import json import uuid import yaml import hashlib from Crypto import Random from Crypto.Cipher import AES import base64 app = Flask(__name__) Bootstrap(app) ...
normal
{ "blob_id": "e55115a65ebee5d41dcd01a5cbabc328acf152da", "index": 6079, "step-1": "<mask token>\n\n\ndef encrypt(message, passphrase):\n passphrase = trans(passphrase)\n IV = Random.new().read(BLOCK_SIZE)\n aes = AES.new(passphrase, AES.MODE_CFB, IV)\n return base64.b32encode(IV + aes.encrypt(message)...
[ 7, 9, 10, 12, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> GERRIT_PORT = 29418 GERRIT_USERNAME = 'dci-ci-bot' GERRIT_HOSTNAME = 'softwarefactory-project.io' GERRIT_SSH_KEY_FILENAME = os.getenv('GERRIT_SSH_KEY_FILENAME', '/home/dci/dci-ci-bot.id_rsa') RHEL_AGENT_DIR = os.getenv('RHEL_A...
flexible
{ "blob_id": "8410ff0806766a09d346e930123a2696bebb4b60", "index": 2821, "step-1": "<mask token>\n", "step-2": "<mask token>\nGERRIT_PORT = 29418\nGERRIT_USERNAME = 'dci-ci-bot'\nGERRIT_HOSTNAME = 'softwarefactory-project.io'\nGERRIT_SSH_KEY_FILENAME = os.getenv('GERRIT_SSH_KEY_FILENAME',\n '/home/dci/dci-ci-...
[ 0, 1, 2, 3 ]