code stringlengths 13 1.2M | order_type stringclasses 1
value | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
from xai.brain.wordbase.nouns._teleconference import _TELECONFERENCE
#calss header
class _TELECONFERENCES(_TELECONFERENCE, ):
def __init__(self,):
_TELECONFERENCE.__init__(self)
self.name = "TELECONFERENCES"
self.specie = 'nouns'
self.basic = "teleconference"
self.jsondata = {}
| normal | {
"blob_id": "9021fa440561461ee179f333aa04a155d06c6e86",
"index": 7255,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass _TELECONFERENCES(_TELECONFERENCE):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass _TELECONFERENCES(_TELECONFERENCE):\n\n def __init__(self):\n _TELECONFERE... | [
0,
1,
2,
3,
4
] |
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
POWER_PIN = 21
SPICLK = 18
SPIMISO = 23
SPIMOSI = 24
SPICS = 25
PAUSE = 0.1
# read SPI data from MCP3008 chip, 8 possible adc's (0 thru 7)
def readadc(adcnum, clockpin, mosipin, misopin, cspin):
if ((adcnum > 7) or (adcnum < 0)):
ret... | normal | {
"blob_id": "fcdb43e36a4610ca0201a27d82b1a583f1482878",
"index": 8924,
"step-1": "<mask token>\n\n\ndef readadc(adcnum, clockpin, mosipin, misopin, cspin):\n if adcnum > 7 or adcnum < 0:\n return -1\n GPIO.output(cspin, True)\n GPIO.output(clockpin, False)\n GPIO.output(cspin, False)\n comm... | [
4,
5,
6,
7,
10
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This program is run at regular intervals to check the battery charge status of the uninterruptible power supply.
In our case, it is a LiPo battery with a nominal voltage of 3.7 volts. By setting the voltage for the
Raspberry PI shutdown procedure at 3.7 V,we ensure th... | normal | {
"blob_id": "67b967b688aeac1270eee836e0f6e6b3555b933e",
"index": 5,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif u_avg < u_bat_min:\n print('proper shut down of the machine due to low battery')\nelse:\n print('tout va bien dormez braves gens')\n",
"step-3": "<mask token>\npidcmes = Pidcmes()... | [
0,
1,
2,
3,
4
] |
"""
This module provides a script to extract data from all JSON files stored in a specific directory and create a HTML
table for an better overview of the data.
.. moduleauthor:: Maximilian Springenberg <mspringenberg@gmail.com>
|
"""
from collections import defaultdict
from argparse import ArgumentParser
import os... | normal | {
"blob_id": "d6e836140b1f9c955711402111dc07e74b4a23b1",
"index": 1621,
"step-1": "<mask token>\n\n\ndef jsons_to_table(dir_jsons, dir_out, name, format='html'):\n \"\"\"\n Extracts the informations stored in the JSON files and stores creates an HTML-table for them.\n\n :param dir_jsons: directory of JS... | [
3,
4,
5,
6,
7
] |
from django.utils import timezone
from factory import DjangoModelFactory
from djtriggers.tests.models import DummyTrigger
class DummyTriggerFactory(DjangoModelFactory):
class Meta:
model = DummyTrigger
trigger_type = 'dummy_trigger_test'
source = 'tests'
date_received = timezone.now()
da... | normal | {
"blob_id": "813354c9c294c0323c1b54cda7074fbffa49cdb3",
"index": 442,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass DummyTriggerFactory(DjangoModelFactory):\n\n\n class Meta:\n model = DummyTrigger\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask tok... | [
0,
1,
2,
3
] |
#----------- writing our for loop
""" number = [1,2,3,4,5]
friends = ['ahmet', 'mehmet','ayşe']
# for n in number:
# print(n)
# for n in friends:
# print(n)
def my_for_loop(my_iterable):
my_iterator = iter(my_iterable)
while True:
try:
print(next(my_iterator))
except StopI... | normal | {
"blob_id": "70325d0e5eb9dcd7a065f83eaf14647bc30bd7f3",
"index": 9053,
"step-1": "<mask token>\n",
"step-2": "\n#----------- writing our for loop\n\"\"\" number = [1,2,3,4,5]\nfriends = ['ahmet', 'mehmet','ayşe']\n\n# for n in number:\n# print(n)\n# for n in friends:\n# print(n)\n\ndef my_for_loop(my_i... | [
0,
1
] |
from flask import Flask, request, jsonify
from flask_restful import Api
import json
import eth_account
import algosdk
app = Flask(__name__)
api = Api(app)
app.url_map.strict_slashes = False
@app.route('/verify', methods=['GET','POST'])
def verify():
content = request.get_json(silent=True, force=True)
#Check i... | normal | {
"blob_id": "8bae45de54535e7b0788aa12717645ae9f193664",
"index": 8113,
"step-1": "<mask token>\n\n\n@app.route('/verify', methods=['GET', 'POST'])\ndef verify():\n content = request.get_json(silent=True, force=True)\n print(content)\n if content == None:\n return jsonify('No json data is sent.')\... | [
1,
2,
3,
4,
5
] |
n=int(0)
import random
def doubleEven(n):
if n % 2 == 0:
n = n*2
return (n)
else:
return "-1"
print(doubleEven(n = int(input("put in a number"))))
g=int(0)
def grade(g):
if g < 50:
return "F"
if g < 66:
return "C"
if g > 92:
return "A+"
else:
... | normal | {
"blob_id": "5251724656e1d971900fff3d8fa0210c6cfc27bb",
"index": 5505,
"step-1": "n=int(0)\nimport random\ndef doubleEven(n):\n if n % 2 == 0:\n n = n*2\n return (n)\n else:\n return \"-1\"\n\n\nprint(doubleEven(n = int(input(\"put in a number\"))))\n\ng=int(0)\n\ndef grade(g):\n if... | [
0
] |
#!/usr/bin/env python3
#
# main.py - By Steven Chen Hao Nyeo
# Graphical interface for Socionics Engine
# Created: August 8, 2019
import wx
from cognitive_function import *
from entity import Entity
from function_to_type import Translator
from function_analysis import *
class TypeFrame(wx.Frame):
def __init__(s... | normal | {
"blob_id": "519dbe97ce9de30e616d660ef168e686c52b01b5",
"index": 5452,
"step-1": "<mask token>\n\n\nclass TypeFrame(wx.Frame):\n <mask token>\n\n def createCogButtons(self, row):\n cogButtons = self.domButtons if row == 0 else self.auxButtons\n labels = ['N', 'S', 'T', 'F']\n for i in ... | [
4,
5,
6,
7,
8
] |
# _*_ coding:utf-8 _*_
import csv
c=open(r"e:/test.csv","r+")
#read=csv.reader(c)
#for line in read:
# print line
read=c.readlines()
print read
c.close() | normal | {
"blob_id": "c65e14de297cc785b804e68f29bd5766ca7a8cf7",
"index": 7958,
"step-1": "# _*_ coding:utf-8 _*_\nimport csv\n\nc=open(r\"e:/test.csv\",\"r+\")\n#read=csv.reader(c)\n#for line in read:\n# print line\nread=c.readlines()\nprint read\nc.close()",
"step-2": null,
"step-3": null,
"step-4": null,
"s... | [
0
] |
class Solution(object):
def findPaths(self, m, n, N, i, j):
"""
:type m: int
:type n: int
:type N: int
:type i: int
:type j: int
:rtype: int
"""
MOD = 10 ** 9 + 7
dz = zip((1,0,-1,0),(0,1,0,-1))
dp = [[0]* n for x in range(m)]
... | normal | {
"blob_id": "ebbc79d6582f7d6139e0dcec6333b679bb86c63c",
"index": 1383,
"step-1": "<mask token>\n",
"step-2": "class Solution(object):\n <mask token>\n",
"step-3": "class Solution(object):\n\n def findPaths(self, m, n, N, i, j):\n \"\"\"\n :type m: int\n :type n: int\n :type ... | [
0,
1,
2,
3
] |
# Generated by Django 3.2.5 on 2021-08-28 12:34
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('userProfile', '0022_auto_20210823_1858'),
]
operations = [
migrations.RemoveField(
model_name='... | normal | {
"blob_id": "96bb865b66e5d9ba62bab210705338f1799cc490",
"index": 7022,
"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 = [('userProfile... | [
0,
1,
2,
3,
4
] |
from __future__ import annotations
from typing import Generator, Optional
from collections import Counter
from itertools import zip_longest
from re import finditer
codon_table = """UUU F CUU L AUU I GUU V
UUC F CUC L AUC I GUC V
UUA L CUA L AUA I GUA V
UUG L CUG L ... | normal | {
"blob_id": "3d742505d480493fbc729e7a0febdcab3a7dc041",
"index": 9386,
"step-1": "<mask token>\n\n\nclass Seq:\n <mask token>\n\n def __init__(self, sequence: str, id: str=None, codons: dict=codons):\n self.sequence = sequence\n self.id = id\n self.codons = codons\n\n def __repr__(s... | [
20,
24,
31,
33,
35
] |
# 체크는 오른쪽+아래로만 체크합니다.
def check22(y, x, board) :
dirs = [[0,1], [1,0], [1,1]]
ret = [(y,x)]
for d in dirs :
dy, dx = y+d[0], x+d[1]
if not ( (0<=dy<len(board)) and (0<=dx<len(board[0])) and board[dy][dx]!='0' and board[y][x]==board[dy][dx] ) :
return False
else... | normal | {
"blob_id": "938c4325480608b904bfbe0b11c081166aad694b",
"index": 7291,
"step-1": "def check22(y, x, board):\n dirs = [[0, 1], [1, 0], [1, 1]]\n ret = [(y, x)]\n for d in dirs:\n dy, dx = y + d[0], x + d[1]\n if not (0 <= dy < len(board) and 0 <= dx < len(board[0]) and board[\n d... | [
1,
2,
3,
4,
5
] |
from Monument import Monument, Dataset
import importer_utils as utils
import importer as importer
class RoRo(Monument):
def set_adm_location(self):
counties = self.data_files["counties"]
self.set_from_dict_match(counties, "iso_code",
"judetul_iso", "located_adm")
... | normal | {
"blob_id": "5f8a9d82a3245671b438475d1fac7be4db769fbe",
"index": 8493,
"step-1": "<mask token>\n\n\nclass RoRo(Monument):\n\n def set_adm_location(self):\n counties = self.data_files['counties']\n self.set_from_dict_match(counties, 'iso_code', 'judetul_iso',\n 'located_adm')\n <mas... | [
4,
5,
8,
9,
11
] |
"""
Simulator contains the tools needed to set up a multilayer antireflection
coating simulation.
Based on transfer matrix method outlined in Hou, H.S. 1974.
"""
# Author: Andrew Nadolski (with lots of help from previous work by Colin Merkel,
# Steve Byrnes, and Aritoki Suzuki)
# Filename: simulator.py
impo... | normal | {
"blob_id": "a2292bc9cee57c5d4a7d36c66510ce4b4f3e20da",
"index": 3687,
"step-1": "<mask token>\n\n\nclass SubstrateLayer(Layer):\n <mask token>\n <mask token>\n\n def __repr__(self):\n return '{} (substrate)'.format(self.name)\n\n\nclass TerminatorLayer(Layer):\n \"\"\"A special case of ``Laye... | [
45,
51,
53,
54,
60
] |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 10 17:48:19 2021
@author: LESLY
"""
from PICO_PLACA_class import PICO_PLACA
""" Main program of "Pico y Placa" predictor"""
def main():
print("Predictor")
placa = input("Enter the license of your vehicle in the following format AAA-###... | normal | {
"blob_id": "c7e5851a41e1cdb33cd0daa103fbf702da6e5ff7",
"index": 9818,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n print('Predictor')\n placa = input(\n 'Enter the license of your vehicle in the following format AAA-####: '\n )\n fecha = input('Enter the date ... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
from flask import Blueprint, render_template, flash, redirect, url_for
from flask_login import login_required, current_user
from ..extensions import db
from .forms import MyTaskForm
from .models import MyTaskModel
tasks = Blueprint('tasks', __name__, url_prefix='/tasks')
@tasks.route('/my... | normal | {
"blob_id": "7882504f08e871f2610ff633608eb3d380179041",
"index": 1735,
"step-1": "<mask token>\n\n\n@tasks.route('/my_tasks', methods=['GET', 'POST'])\n@login_required\ndef my_tasks():\n _all_tasks = MyTaskModel.query.filter_by(users_id=current_user.id).all()\n return render_template('tasks/my_tasks.html',... | [
4,
5,
6,
7,
8
] |
from csv import writer
with open("movies.csv","w") as file:
csv_writer=writer(file)
csv_writer.writerow(['Name','Year'])
csv_writer.writerow(['Ratchasan',2018])
csv_writer.writerow(['Vadachennai',2018])
csv_writer.writerow(['Naran',2007])
| normal | {
"blob_id": "83e231480c618d290089340c642313bbba4f1070",
"index": 2035,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('movies.csv', 'w') as file:\n csv_writer = writer(file)\n csv_writer.writerow(['Name', 'Year'])\n csv_writer.writerow(['Ratchasan', 2018])\n csv_writer.writerow(['Va... | [
0,
1,
2,
3
] |
###############################################################################
# Copyright (c), Forschungszentrum Jülich GmbH, IAS-1/PGI-1, Germany. #
# All rights reserved. #
# This file is part of the AiiDA-FLEUR package. #
... | normal | {
"blob_id": "1d4a51cfbd5df9ac9074c816a140309e04fff021",
"index": 4159,
"step-1": "<mask token>\n\n\nclass FleurBaseWorkChain(BaseRestartWorkChain):\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def define(cls, spec):\n super().define(spec)\n spec.expose_inputs(Fleur... | [
4,
7,
9,
14,
15
] |
import numpy as np
N, M = (int(x) for x in input().split())
x, y, z = np.zeros(N, dtype=int), np.zeros(N, dtype=int), np.zeros(N, dtype=int
)
for i in range(N):
x[i], y[i], z[i] = (int(x) for x in input().split())
temp = []
for sx in (-1, 1):
for sy in (-1, 1):
for sz in (-1, 1):
_x, _y,... | normal | {
"blob_id": "af40239551709eff02b8a1f034583ab80845d1d7",
"index": 1532,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(N):\n x[i], y[i], z[i] = (int(x) for x in input().split())\n<mask token>\nfor sx in (-1, 1):\n for sy in (-1, 1):\n for sz in (-1, 1):\n _x, _y, _z ... | [
0,
1,
2,
3
] |
from django.contrib import admin
from . import models
admin.site.register(models.Comentario)
# Register your models here.
| normal | {
"blob_id": "d7d94cfed0b819297069c3434c70359a327403cd",
"index": 718,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nadmin.site.register(models.Comentario)\n",
"step-3": "from django.contrib import admin\nfrom . import models\nadmin.site.register(models.Comentario)\n",
"step-4": "from django.contrib ... | [
0,
1,
2,
3
] |
import numpy as np
import tensorflow as tf
from arg_parser import args
from model_object import UnetModel
def main(args):
np.random.seed(args.random_seed)
tf.random.set_seed(args.random_seed)
unet_model = UnetModel(args)
unet_model.prepare_data(args)
unet_model.create_model(args)
une... | normal | {
"blob_id": "588f6f78908e47e0b3f1bc42fffabad34766eede",
"index": 9815,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main(args):\n np.random.seed(args.random_seed)\n tf.random.set_seed(args.random_seed)\n unet_model = UnetModel(args)\n unet_model.prepare_data(args)\n unet_model.cr... | [
0,
1,
2,
3,
4
] |
from app import create_app
__author__ = '七月'
app = create_app()
if __name__ == '__main__':
app.run(debug=app.config['DEBUG'])
| normal | {
"blob_id": "9a6d6637cd4ecf2f6e9c8eb8e702be06e83beea4",
"index": 998,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n app.run(debug=app.config['DEBUG'])\n",
"step-3": "<mask token>\n__author__ = '七月'\napp = create_app()\nif __name__ == '__main__':\n app.run(debug=app.c... | [
0,
1,
2,
3
] |
#program, ktory zisti, ci zadany rok je prestupny
rok=input("Zadaj rok: ")
rok_int= int(rok)
if rok_int% 4==0:
if rok_int % 100 != 0:
if rok_int % 400:
print(f'Rok {rok_int} je priestupny')
else:
print("rok je neprestupny")
else:
print("rok je prestupny")
else:
... | normal | {
"blob_id": "c9b1956d66f0b8ae8a7ce7e509259747c8b7709e",
"index": 6088,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif rok_int % 4 == 0:\n if rok_int % 100 != 0:\n if rok_int % 400:\n print(f'Rok {rok_int} je priestupny')\n else:\n print('rok je neprestupny')\n ... | [
0,
1,
2,
3
] |
# Imports
import numpy as np
from ctf.functions2d.function2d import Function2D
# Problem
class StyblinskiTang(Function2D):
""" Styblinski-Tang Function. """
def __init__(self):
""" Constructor. """
# Information
self.min = np.array([-2.903534, -2.903534])
self.value = -39.16... | normal | {
"blob_id": "5d8715dd02feff4e13919858051abeb5b6828011",
"index": 6798,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass StyblinskiTang(Function2D):\n <mask token>\n <mask token>\n <mask token>\n\n def grad(self, x):\n \"\"\" Grad function. \"\"\"\n g = np.zeros(x.shape)\... | [
0,
3,
6,
7,
8
] |
# 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
] |
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.transforms import Bbox
from matplotlib.path import Path
import json
def cLineGraph(j_file):
data = []
with open(j_file) as f:
for line in f:
data.append(json.loads(line))
data = data[0]
in_other = 0
in_picture =... | normal | {
"blob_id": "319af5232c043d77a9d63ab1efa62d857da6db23",
"index": 1508,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef cLineGraph(j_file):\n data = []\n with open(j_file) as f:\n for line in f:\n data.append(json.loads(line))\n data = data[0]\n in_other = 0\n in_pi... | [
0,
1,
2,
3
] |
"""
HLS: Check if Twin Granule Exists
"""
from typing import Dict
import os
import re
import boto3
from botocore.errorfactory import ClientError
from datetime import date
s3 = boto3.client("s3")
bucket = os.getenv("SENTINEL_INPUT_BUCKET", None)
print(bucket)
if bucket is None:
raise Exception("No Input Bucket set"... | normal | {
"blob_id": "d2b05c5653ca6c6b7219f6c0393e81c9425b5977",
"index": 279,
"step-1": "<mask token>\n\n\ndef handler(event: Dict, context: Dict):\n \"\"\"AWS Lambda handler.\"\"\"\n granule = event.get('granule')\n prefix = granule[0:-6]\n print(prefix)\n response = s3.list_objects_v2(Bucket=bucket, Pre... | [
1,
2,
3,
4,
5
] |
# drop data to file filter
import tarr.compiler_base
def format_data(data):
return '{0.id}: {0.payload}'.format(data)
class WRITE_TO_FILE(tarr.compiler_base.Instruction):
@property
def __name__(self):
return 'POINT OF INTEREST - WRITE("{}")'.format(self.filename)
def __init__(self, filenam... | normal | {
"blob_id": "75393d39b147097a7ac1d82938ac102491ea9441",
"index": 8469,
"step-1": "<mask token>\n\n\nclass WRITE_TO_FILE(tarr.compiler_base.Instruction):\n\n @property\n def __name__(self):\n return 'POINT OF INTEREST - WRITE(\"{}\")'.format(self.filename)\n\n def __init__(self, filename, formatte... | [
4,
5,
6,
7,
8
] |
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior
# * Remove `managed =... | normal | {
"blob_id": "5ce5fbfa33c241fc316d5e414df01a39bfc9be18",
"index": 7063,
"step-1": "<mask token>\n\n\nclass AnnouncedPuResults(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n managed = False\n... | [
15,
17,
19,
21,
22
] |
'''
给定两个整数,被除数 dividend 和除数 divisor。将两数相除,要求不使用乘法、除法和 mod 运算符。
返回被除数 dividend 除以除数 divisor 得到的商
链接:https://leetcode-cn.com/problems/divide-two-integers
'''
# 该题看起来也不难,但是其中坑很多,想要写出健壮的代码并不容易
# 我个人思考可以考虑使用上下界,不断缩小范围来确定
def division(dividend, divisor):
temp = 0
for i in range(dividend + 1):
temp += abs(... | normal | {
"blob_id": "edb80652de641a1a6cbb37a60cc236cd7828a96e",
"index": 8151,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef division_v2(dividend, divisor):\n\n def get_add_num(num, times):\n sum = 0\n for i in range(times):\n sum += num\n return sum\n low = 0\n ... | [
0,
1,
2,
3,
4
] |
# The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangle numbers are:
# 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
# By converting each letter in a word to a number corresponding to its alphabetical position and adding these values we form a word value. For example, the word... | normal | {
"blob_id": "61019a5439a6f0c1aee51db9b048a26fb9b5bf5d",
"index": 8257,
"step-1": "<mask token>\n\n\ndef is_triangle_number(n):\n root = (-1 + math.sqrt(1 + 8.0 * n)) / 2\n if root.is_integer():\n return True\n return False\n\n\ndef calculation():\n count = 0\n for word in string_list:\n ... | [
2,
3,
4,
5,
6
] |
def check_integer(a):
if type(a) != int:
print("please input an integer")
exit()
def is_even(a):
check_integer(a)
if a % 2 == 0:
print("true")
return True
else:
print("false")
return False
is_even(2)
is_even(3)
is_even("cat")
| normal | {
"blob_id": "92391f17380b2e09cc9b3913f15ce35189d9893d",
"index": 8241,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef is_even(a):\n check_integer(a)\n if a % 2 == 0:\n print('true')\n return True\n else:\n print('false')\n return False\n\n\n<mask token>\n",
... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
import scrapy
import re
class LeedsAcUkSpider(scrapy.Spider):
name = 'leeds_ac_uk'
allowed_domains = ['webprod3.leeds.ac.uk']
start_urls = ['http://webprod3.leeds.ac.uk/catalogue/dynmodules.asp?Y=201920&M=ANAT-3105']
def parse(self, response):
item = {}
item['Su... | normal | {
"blob_id": "fb4a95197882cc6fe72a5f3c2420a474d9cd97aa",
"index": 7751,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass LeedsAcUkSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n\n def parse(self, response):\n item = {}\n item['Subject'] = response.cs... | [
0,
2,
3,
4,
5
] |
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class SearchConfig(AppConfig):
name = 'search'
verbose_name = _("Search")
| normal | {
"blob_id": "f47e4d6ff079b6ac2320467d87b34ae82face032",
"index": 4506,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass SearchConfig(AppConfig):\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass SearchConfig(AppConfig):\n name = 'search'\n verbose_name = _('Search... | [
0,
1,
2,
3,
4
] |
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Dense, Flatten, Conv2D, BatchNormalization, LeakyReLU, Reshape, Conv2DTranspose
import tensorflow_hub as hub
from collections import Counter
import numpy as np
import sys
sys.path.append('../data')
from imageio import imwri... | normal | {
"blob_id": "919239391c6f74d0d8627d3b851beb374eb11d25",
"index": 4785,
"step-1": "<mask token>\n\n\nclass DeepFont(tf.keras.Model):\n\n def __init__(self):\n super(DeepFont, self).__init__()\n self.batch_size = 128\n self.model = tf.keras.Sequential()\n self.model.add(tf.keras.laye... | [
10,
11,
12,
13,
14
] |
n = int(input('Digite um número inteiro: '))
print(' O dobro de {} é {}'.format(n, n * 2))
print(' O triplo de {} é {}'.format(n, n * 3))
print(' A Raiz quadrada de {} é {}'.format(n, n * n))
| normal | {
"blob_id": "c0ad3d642f28cb11a8225d4d011dbb241bd88432",
"index": 1661,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(' O dobro de {} é {}'.format(n, n * 2))\nprint(' O triplo de {} é {}'.format(n, n * 3))\nprint(' A Raiz quadrada de {} é {}'.format(n, n * n))\n",
"step-3": "n = int(input('Digite... | [
0,
1,
2
] |
import weakref
from Qt import QtCore
from Qt import QtGui
from Qt.QtWidgets import QDoubleSpinBox
from Qt.QtWidgets import QSpinBox
from Qt.QtWidgets import QWidget
from Qt.QtWidgets import QSpacerItem
from Qt.QtWidgets import QPushButton
from Qt.QtWidgets import QComboBox
from Qt.QtWidgets import QLineEdit
from Qt.QtW... | normal | {
"blob_id": "023dc23a5e649c2fbbb45ff577dffa3b5d2aac64",
"index": 7904,
"step-1": "<mask token>\n\n\nclass FloatVector3InputWidget(InputWidgetRaw, FloatVector3InputWidget_ui.\n Ui_Form):\n <mask token>\n\n def __init__(self, **kwds):\n super(FloatVector3InputWidget, self).__init__(**kwds)\n ... | [
59,
60,
62,
81,
103
] |
import mysql.connector
# config = {
# "user":"root",
# "password":"Sm13481353",
# "host":"3"
# }
mydb = mysql.connector.connect(
user="seyed",
password="Sm13481353",
host="localhost",
database="telegram_bot",
auth_plugin="mysql_native_password"
)
mycursor = mydb.cursor()
query = "i... | normal | {
"blob_id": "a29a904290cb733ac7b526a75e0c218b952e2266",
"index": 4630,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nmycursor.execute('select * from question')\n<mask token>\nfor user in users:\n print(user)\n",
"step-3": "<mask token>\nmydb = mysql.connector.connect(user='seyed', password='Sm13481... | [
0,
1,
2,
3,
4
] |
import pandas as pd
import tensorflow as tf
import autokeras as ak
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import tensorflow as tf
from numpy import concatenate
from pandas import read_csv, DataFrame, concat
from sklearn.preprocessing import MinMaxScaler
np.set_printoptions(... | normal | {
"blob_id": "013189cd67cc44efd539c75ed235a0753d95f54e",
"index": 2165,
"step-1": "<mask token>\n\n\ndef getData():\n power_file = './data/power_20210129_20210429_preprocess_1hour'\n power_df = read_csv(power_file + '.csv', encoding='CP949', converters={\n 'date': int})\n print(power_df.shape)\n ... | [
1,
2,
3,
4,
5
] |
#!/usr/bin/python3
"""
list = list(range(97, 123)
for (i in list):
if (i % 2 == 0):
i = (i - 32)
"""
for letter in "zYxWvUtSrQpOnMlKjIhGfEdCbA":
print('{:s}'.format(letter), end = "")
| normal | {
"blob_id": "55a061a1c0cd20e5ab7413c671bc03573de1bbdf",
"index": 7754,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor letter in 'zYxWvUtSrQpOnMlKjIhGfEdCbA':\n print('{:s}'.format(letter), end='')\n",
"step-3": "#!/usr/bin/python3\n\"\"\"\nlist = list(range(97, 123)\nfor (i in list):\n if (i ... | [
0,
1,
2
] |
import numpy as np
import matplotlib.pyplot as plt
from math import *
from scipy.integrate import *
from pylab import *
from scipy.integrate import quad
MHD = np.zeros((80, 90, 5), dtype=float)
BGI = np.zeros((80, 90, 5), dtype=float)
Fp = np.zeros((80), dtype=float)
AngMHD = np.zeros((90,2), dtype=floa... | normal | {
"blob_id": "660334be611c30397c2f33890e1bca1fc43bd01f",
"index": 2420,
"step-1": "<mask token>\n\n\ndef PMHD(p, chi, b):\n return b ** 2 / p * (1 + sin(chi) ** 2)\n\n\ndef xMHD(p, chi, b):\n return -b ** 2 / p ** 2 * sin(chi) * cos(chi)\n\n\n<mask token>\n\n\ndef xBGI(p, chi, b):\n Q = 0.7 * p / b ** 0.... | [
3,
5,
6,
7,
8
] |
from core import Postgresdb
db = Postgresdb()
print(db)
| normal | {
"blob_id": "962a9781e4f2ad787dd695896b6455c9b336603a",
"index": 7178,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(db)\n",
"step-3": "<mask token>\ndb = Postgresdb()\nprint(db)\n",
"step-4": "from core import Postgresdb\ndb = Postgresdb()\nprint(db)\n",
"step-5": null,
"step-ids": [
... | [
0,
1,
2,
3
] |
from typing import Any, Dict, List, Optional, Tuple, Union
import numpy as np
import torch
from datasets import concatenate_datasets
from datasets.arrow_dataset import Dataset
from transfer_classifier.dataset_preprocessor.classification_dataset_preprocessor import (
ClassificationDatasetPreprocessor,
)
from transf... | normal | {
"blob_id": "4a88ce640b6680df925288b44232cf43d585c11c",
"index": 669,
"step-1": "<mask token>\n\n\nclass Augmentor:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Augmentor:\n\n def __init__(self) ->None:\n self.__AUGME... | [
1,
5,
6,
7,
8
] |
#!flask/bin/python
import os, json
import requests
SENDGRID_API_KEY = os.environ.get('SENDGRID_API_KEY', default=None)
FROM_EMAIL = os.environ.get('FROM_EMAIL', default=None)
TO_EMAIL = os.environ.get('TO_EMAIL', default=None)
if not SENDGRID_API_KEY:
raise ValueError("Need to set Sendgrid API Key (SENDGRID_API_K... | normal | {
"blob_id": "cb29ee8687b469923896ceb7d5a6cd7f54b2c34e",
"index": 6207,
"step-1": "<mask token>\n\n\ndef build_request_body(email):\n from_email = email['email']\n name = email['name']\n subject = email['subject']\n body = email['body']\n if not from_email:\n from_email = FROM_EMAIL\n if ... | [
2,
3,
4,
5,
6
] |
from PIL import Image, ImageFilter
import numpy as np
import glob
from numpy import array
import matplotlib.pyplot as plt
from skimage import morphology
import scipy.ndimage
def sample_stack(stack, rows=2, cols=2, start_with=0, show_every=1, display1 = True):
if (display1):
new_list = []
new_list.a... | normal | {
"blob_id": "371c1c9e3ccf7dae35d435bdb013e0462f3add5d",
"index": 4831,
"step-1": "<mask token>\n\n\ndef sample_stack(stack, rows=2, cols=2, start_with=0, show_every=1,\n display1=True):\n if display1:\n new_list = []\n new_list.append(stack)\n new_list.append(stack)\n new_list.a... | [
1,
2,
3,
4,
5
] |
"""This module contains a class supporting composition of AugraphyPipelines"""
class ComposePipelines:
"""The composition of multiple AugraphyPipelines.
Define AugraphyPipelines elsewhere, then use this to compose them.
ComposePipelines objects are callable on images (as numpy.ndarrays).
:param pipel... | normal | {
"blob_id": "13c55c313c740edce48fc979e8956fdd018e8aab",
"index": 9716,
"step-1": "<mask token>\n\n\nclass ComposePipelines:\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass ComposePipelines:\n <mask token>\n <mask token>\n\n def __call__(self, image):\n ... | [
1,
2,
3,
4,
5
] |
#! /usr/bin/python3
from scapy.all import *
import sys
ip=IP(src=sys.argv[1], dst=sys.argv[2])
syn_packet = TCP(sport=52255, dport=1237, flags="S", seq=100, options=[('MSS',689),('WScale',1)])
synack_packet = sr1(ip/syn_packet)
my_ack = synack_packet.seq+1
ack_packet = TCP(sport=52255, dport=1237, flags="A", seq=101,... | normal | {
"blob_id": "acd6197e60cf59ffcaa33bb50a60a03592bb3559",
"index": 7169,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsend(ip / ack_packet)\n",
"step-3": "<mask token>\nip = IP(src=sys.argv[1], dst=sys.argv[2])\nsyn_packet = TCP(sport=52255, dport=1237, flags='S', seq=100, options=[(\n 'MSS', 689), ... | [
0,
1,
2,
3,
4
] |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | normal | {
"blob_id": "f4b704a1416bfd6524340a68a20981957abf4340",
"index": 9850,
"step-1": "<mask token>\n\n\nclass KibbleESWrapper(object):\n <mask token>\n\n def __init__(self, ES):\n self.ES = ES\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def scroll(sel... | [
17,
19,
23,
25,
28
] |
cijferICOR = float(input('Wat is je cijfer voor ICOR?: '))
x = 30
beloningICOR = cijferICOR * x
beloning = 'beloning €'
print(beloning, beloningICOR)
cijferPROG = float(input('Wat is je cijfer voor PROG: '))
beloningPROG = cijferPROG * x
print(beloning, beloningPROG)
cijferCSN = float(input('Wat is je cijfer voor CSN?:... | normal | {
"blob_id": "74bca94cbcba0851e13d855c02fbc13fb0b09e6a",
"index": 4263,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(beloning, beloningICOR)\n<mask token>\nprint(beloning, beloningPROG)\n<mask token>\nprint(beloning, beloningCSN)\n<mask token>\nprint('de gemiddelde beloning is:€ ', gemiddelde / 3)... | [
0,
1,
2
] |
def has23(nums):
this = nums[0] == 2 or nums[0] == 3
that = nums[1] == 2 or nums[1] == 3
return this or that
| normal | {
"blob_id": "174c4c1ed7f2197e012644999cf23f5e82f4b7c3",
"index": 3148,
"step-1": "<mask token>\n",
"step-2": "def has23(nums):\n this = nums[0] == 2 or nums[0] == 3\n that = nums[1] == 2 or nums[1] == 3\n return this or that\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
... | [
0,
1
] |
n,k = map(int,raw_input().split())
nums = list(map(int,raw_input().split()))
if k==1:
print min(nums)
elif k==2:
print max(nums[0],nums[-1])
else:
print max(nums)
| normal | {
"blob_id": "041a5bf205c1b3b3029623aa93835e99104464b2",
"index": 2361,
"step-1": "n,k = map(int,raw_input().split())\nnums = list(map(int,raw_input().split()))\nif k==1:\n print min(nums)\nelif k==2:\n print max(nums[0],nums[-1])\nelse:\n print max(nums)\n",
"step-2": null,
"step-3": null,
"step-4": nul... | [
0
] |
# Представлен список чисел.
# Необходимо вывести элементы исходного списка,
# значения которых больше предыдущего элемента.
from random import randint
list = []
y = int(input("Введите количество элементов в списке>>> "))
for i in range(0, y):
list.append(randint(1, 10))
new = [el for num, el in enumerate(list) if... | normal | {
"blob_id": "bfc4f5e90b7c22a29d33ae9b4a5edfb6086d79f4",
"index": 2344,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(0, y):\n list.append(randint(1, 10))\n<mask token>\nprint(f'Исходный список: {list}')\nprint(f'Новый список список: {new}')\n",
"step-3": "<mask token>\nlist = []\ny =... | [
0,
1,
2,
3,
4
] |
"""
Process pair-end reads of barcode-guide-donor Step 1 cassette to generate a library reference table mapping barcodes to features.
Create dictionaries mapping barcodes to forward and reverse reads, split into sub-segments.
R1_dict: map barcodes to corresponding R1 sequences.
R2_dict: map barcodes to corresponding R... | normal | {
"blob_id": "9206e4c4eff8ca64266ce53705e88069912b80d8",
"index": 1526,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nparser.add_argument('-f', '-forward', required=True, help=\n 'forward sequencing files', nargs='+', action='store', dest='forward_files'\n )\nparser.add_argument('-r', '-reverse', r... | [
0,
1,
2,
3,
4
] |
import datetime
import logging
import random
import transform
import timelapse
# merge two iterators producing sorted values
def merge(s1, s2):
try:
x1 = next(s1)
except StopIteration:
yield from s2
return
try:
x2 = next(s2)
except StopIteration:
yield from s1
... | normal | {
"blob_id": "c651d49c98a4cf457c8252c94c6785dea8e9af60",
"index": 3909,
"step-1": "<mask token>\n\n\nclass Sliders(timelapse.TimeLapse):\n\n def __init__(self, server_list, nick='Sliders', channel='#sliders',\n realname='Sliders', sliding_window=60, **params):\n super().__init__(server_list, nick... | [
3,
4,
5,
6,
7
] |
class ListNode:
def __init__(self,listt,node,g,h):
self.node_list = []
for element in listt:
self.node_list.append(element)
self.node_list.append(node)
self.g=g
self.f = int(g)+int(h);
self.ID = node
def is_Goal(self,complete_nodes):
... | normal | {
"blob_id": "2b796fb99e4607d310a533e8d9897100c4df087d",
"index": 2665,
"step-1": "<mask token>\n",
"step-2": "class ListNode:\n <mask token>\n <mask token>\n",
"step-3": "class ListNode:\n\n def __init__(self, listt, node, g, h):\n self.node_list = []\n for element in listt:\n ... | [
0,
1,
2,
3,
4
] |
from django.db.models import Q
from django.contrib import messages
from django.views.generic import ListView, DetailView
from django.shortcuts import get_object_or_404, redirect, render
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.views.decorators.http im... | normal | {
"blob_id": "3c193decc4a1f284de953003fbba434d6e798b24",
"index": 2827,
"step-1": "<mask token>\n\n\nclass PillListView(ListView):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n\n\nclass PillDetailView(DetailView):\n model = Pills\n template_nam... | [
3,
6,
8,
9,
11
] |
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
def find_packages():
return ['sqlpython']
classifiers = """Development Status :: 4 - Beta
Intended Audience :: Information Technology
License :: OSI Approved :: MIT License
Programming Language... | normal | {
"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
] |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""BatchNorm (BN) utility functions and custom batch-size BN implementations"""
from functools import partial
import torch
import torch.nn as nn
from pytorchvideo.layers.batch_norm import (
NaiveSyncBatchNorm1d,
Na... | normal | {
"blob_id": "4e5e1be289b32655736d8c6c02d354a85d4268b7",
"index": 3027,
"step-1": "<mask token>\n\n\nclass SubBatchNorm3d(nn.Module):\n <mask token>\n\n def __init__(self, num_splits, **args):\n \"\"\"\n Args:\n num_splits (int): number of splits.\n args (list): other arg... | [
5,
6,
7,
8,
9
] |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
# Copyright © YXC
# CreateTime: 2016-03-09 10:06:02
"""
Example of functions with arbitrary number arguments
"""
def optional_argument_func(arg1='', arg2=''):
"""
Function with two optional arguments
"""
print("arg1:{0}".format(arg1))
... | normal | {
"blob_id": "061a78650e2abf6a9d1e4796dd349174a8df5cb8",
"index": 8747,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef optional_argument_func(arg1='', arg2=''):\n \"\"\"\n Function with two optional arguments\n \"\"\"\n print('arg1:{0}'.format(arg1))\n print('arg2:{0}'.format(arg2))... | [
0,
1,
2,
3,
4
] |
import unittest
from nldata.corpora import Telegram
import os
class TestTelegram(unittest.TestCase):
def test_export_iter(self):
pass
# telegram = Telegram(data_dir)
# it = telegram.split("train", n=20)
# samples = [s for s in it]
# self.assertEqual(len(samples), 20)
... | normal | {
"blob_id": "5c1d81c973487f1b091e58a6ccf5947c3f2a7e6d",
"index": 1058,
"step-1": "<mask token>\n\n\nclass TestTelegram(unittest.TestCase):\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass TestTelegram(unittest.TestCase):\n\n def test_export_iter(self):\n pass\n\n\n<mask toke... | [
1,
2,
3,
4,
5
] |
"""
Tests of neo.io.exampleio
"""
import pathlib
import unittest
from neo.io.exampleio import ExampleIO # , HAVE_SCIPY
from neo.test.iotest.common_io_test import BaseTestIO
from neo.test.iotest.tools import get_test_file_full_path
from neo.io.proxyobjects import (AnalogSignalProxy,
SpikeTrainProxy, E... | normal | {
"blob_id": "e51c0d8c6430603d989d55a64fdf77f9e1a2397b",
"index": 1081,
"step-1": "<mask token>\n\n\nclass TestExampleIO(BaseTestIO, unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def tearDown(self) ->None:\n super().tearDown()\n for entity in self... | [
6,
7,
8,
10,
11
] |
t_dim_2 = [[1, 2], [3, 4]]
def z(i, j, dim):
t = dim ** 2
if dim == 2:
return t_dim_2[i-1][j-1]
d = dim//2
if i <= d: # I or II
if j <= d:
return z(i, j, d) #I
else:
j -= d
return t//4 + z(i, j, d) # II
else: # III or IV
if j <=d... | normal | {
"blob_id": "07ed8c12e8e5c568c897b6b632c48831267eba51",
"index": 1815,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef z(i, j, dim):\n t = dim ** 2\n if dim == 2:\n return t_dim_2[i - 1][j - 1]\n d = dim // 2\n if i <= d:\n if j <= d:\n return z(i, j, d)\n ... | [
0,
1,
2,
3,
4
] |
import FWCore.ParameterSet.Config as cms
process = cms.Process("GeometryInfo")
# minimum of logs
process.MessageLogger = cms.Service("MessageLogger",
cerr = cms.untracked.PSet(
enable = cms.untracked.bool(False)
),
cout = cms.untracked.PSet(
enable = cms.untracked.bool(True),
thresh... | normal | {
"blob_id": "ac0e301e58ea64465ccd4b2b9aa4ae69283d6d0c",
"index": 6052,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprocess.load('Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi')\n<mask token>\nprocess.load('CondCore.CondDB.CondDB_cfi')\n<mask token>\n",
"step-3": "<mask token>\nprocess = cms... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/python
# coding: utf-8
from os.path import dirname, abspath
PICKITEMSP = True
RAREP = True
REPAIRP = False
ITEMS = {
"legendary": ["#02CE01", # set
"#BF642F"], # legndary
"rare": ["#BBBB00"]
}
current_abpath = abspath(dirname(__file__)) + "/"
# Wi... | normal | {
"blob_id": "927b42326ad62f5e484fd7016c42a44b93609f83",
"index": 1296,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif current_abpath[-12:] == 'library.zip/':\n current_abpath = current_abpath[:-12]\n<mask token>\n\n\ndef get_item_colors():\n \"\"\"\n >>> get_item_colors()\n \"\"\"\n res... | [
0,
2,
3,
4,
5
] |
import collections
import inspect
import struct
from pygments.token import *
import decompil.builder
import decompil.disassemblers
import decompil.ir
class Context(decompil.ir.Context):
def __init__(self):
super(Context, self).__init__(16)
self.pointer_type = self.create_pointer_type(self.half_... | normal | {
"blob_id": "865d7c606b287dbce158f721c6cf768cd078eb48",
"index": 9231,
"step-1": "<mask token>\n\n\nclass Register(decompil.ir.Register):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass BaseDecoder:\n name = None\n opcode = None\n op... | [
18,
24,
25,
29,
33
] |
# -*- coding: utf-8 -*-
from __future__ import print_function
"""phy main CLI tool.
Usage:
phy --help
"""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import sys
import os.path as op
im... | normal | {
"blob_id": "539523f177e2c3c0e1fb0226d1fcd65463b68a0e",
"index": 6576,
"step-1": "<mask token>\n\n\nclass Parser(argparse.ArgumentParser):\n\n def error(self, message):\n sys.stderr.write(message + '\\n\\n')\n self.print_help()\n sys.exit(2)\n\n\n<mask token>\n\n\nclass ParserCreator(obje... | [
17,
18,
29,
30,
32
] |
variable_1 = 100
variable_2 = 500
variable_3 = 222.5
variable_4 = 'Hello'
variable_5 = 'world'
print(variable_1, variable_2, variable_3, sep=', ')
print(variable_4, variable_5, sep=', ', end='!\n')
user_age = input('Введите ваш возраст: ')
user_name = input('Введите ваше имя: ')
print(variable_4 + ', ' + user_name + '!... | normal | {
"blob_id": "12ca9a81574d34d1004ac9ebcb2ee4b31d7171e2",
"index": 5623,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(variable_1, variable_2, variable_3, sep=', ')\nprint(variable_4, variable_5, sep=', ', end='!\\n')\n<mask token>\nprint(variable_4 + ', ' + user_name + '! ' + 'Ваш возраст: ' + user... | [
0,
1,
2
] |
# -*- coding: utf-8 -*-
#
# Akamatsu CMS
# https://github.com/rmed/akamatsu
#
# MIT License
#
# Copyright (c) 2020 Rafael Medina García <rafamedgar@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
... | normal | {
"blob_id": "cde62c5032109bb22aa81d813e30097dad80a9c3",
"index": 4924,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@bp_admin.route('/profile', methods=['GET', 'POST'])\n@login_required\ndef profile_edit():\n \"\"\"Show user profile edition form.\"\"\"\n form = ProfileForm(obj=current_user)\n... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python3
'''Глава 9. Распутываем Всемирную паутину'''
'''1. Если вы еще не установили Flask, сделайте это сейчас.
Это также установит werkzeug, jinja2 и, возможно, другие пакеты.'''
# pip3 install flask
print('\n================================ RESTART ================================\n')
'''2. Созда... | normal | {
"blob_id": "664f9d5aa981c3590043fae1d0c80441bda4fbb1",
"index": 2499,
"step-1": "<mask token>\n\n\n@app.route('/')\ndef home():\n thing = request.args.get('thing')\n height = request.args.get('height')\n color = request.args.get('color')\n return render_template('home1.html', thing=thing, height=hei... | [
1,
2,
3,
4,
5
] |
import numpy as np
import imutils
import cv2
image = cv2.imread("D:\\Github\\python-opencv\\images\\trex.png")
cv2.imshow("Original", image)
cv2.waitKey(0)
(h, w) = image.shape[:2] # get height and width of the image
center = (w/2, h/2) # which point to rotate around
M = cv2.getRotationMatrix2D(center, 45, 1.0) # ro... | normal | {
"blob_id": "4462fec6e0edc25530c93ffeeae2372c86fef2cc",
"index": 528,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ncv2.imshow('Original', image)\ncv2.waitKey(0)\n<mask token>\ncv2.imshow('Rotated by 45 degrees', rotated)\ncv2.waitKey(0)\n<mask token>\ncv2.imshow('Rotated by -90 degrees', rotated)\ncv2.... | [
0,
1,
2,
3,
4
] |
from . import by_trips
from . import by_slope
| normal | {
"blob_id": "74fae3636b1c1b0b79d0c6bec8698581b063eb9c",
"index": 8944,
"step-1": "<mask token>\n",
"step-2": "from . import by_trips\nfrom . import by_slope\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
'''
Write the necessary code to display the area and perimeter of a rectangle that has a width of 2.4 and a height of 6.4.
'''
x, y = 2.4, 6.4
perimeter = (x*2)+(y*2)
area = x*y
print("Perimeter is "+str(perimeter) + ", Area is " + str(area)) | normal | {
"blob_id": "a7de079866d7ac80260b438043cf0403f598cebc",
"index": 5091,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Perimeter is ' + str(perimeter) + ', Area is ' + str(area))\n",
"step-3": "<mask token>\nx, y = 2.4, 6.4\nperimeter = x * 2 + y * 2\narea = x * y\nprint('Perimeter is ' + str(per... | [
0,
1,
2,
3
] |
import pyximport
pyximport.install(build_in_temp=False,inplace=True)
import Cython.Compiler.Options
Cython.Compiler.Options.annotate = True
import numpy as np
from test1 import c_test,c_test_result_workaround
a = np.ascontiguousarray(np.array([ [1,2,3],[1,2,3],[1,2,3] ], dtype=np.long), dtype=np.long)
print '\nStar... | normal | {
"blob_id": "0276181055f2c70562c1f557a16d00ba7107d003",
"index": 1219,
"step-1": "\n\nimport pyximport\npyximport.install(build_in_temp=False,inplace=True)\nimport Cython.Compiler.Options\nCython.Compiler.Options.annotate = True\nimport numpy as np\nfrom test1 import c_test,c_test_result_workaround\n\na = np.as... | [
0
] |
import torch.nn as nn
import torch
from torch.distributions.categorical import Categorical
import torch.nn.functional as F
from torch.optim import Adam
import gym
import numpy as np
Device = torch.device("cuda:0")
class ActorCriticNet(nn.Module):
def __init__(self, observation_space, action_space,
... | normal | {
"blob_id": "e1ab4b034c949b8158c6ccc1e8e3f4a960a38c72",
"index": 4382,
"step-1": "<mask token>\n\n\nclass Agent(object):\n\n def __init__(self, model=None, lr=0.01, gamma=0.99):\n self.gamma = gamma\n self.AC = model\n self.optimizer = Adam(AC.parameters(), lr=lr)\n self.logp_as = ... | [
4,
7,
8,
10,
11
] |
import os
import json
from threading import Thread
import time
from time import sleep
from flask import Flask, json, render_template, request
import redis
from collections import OrderedDict
import requests
from Queue import Queue
REGISTRAR_URL = 'http://cuteparty-registrar1.cfapps.io/update'
app = Flask(__name__)
p... | normal | {
"blob_id": "b976dab3c621bb929eb488fa7f4394666efec2ed",
"index": 4410,
"step-1": "import os\nimport json\nfrom threading import Thread\nimport time\nfrom time import sleep\nfrom flask import Flask, json, render_template, request\nimport redis\nfrom collections import OrderedDict\nimport requests\n\nfrom Queue im... | [
0
] |
#颜色选择对话框
import tkinter
import tkinter.colorchooser
root = tkinter.Tk()
root.minsize(300,300)
#添加颜色选择按钮
def select():
#打开颜色选择器
result = tkinter.colorchooser.askcolor(title = '内裤颜色种类',initialcolor = 'purple')
print(result)
#改变按钮颜色
btn1['bg'] = result[1]
btn1 = tkinter.Button(root,text = '请选择你的内裤颜色... | normal | {
"blob_id": "dc261b29c1c11bb8449ff20a7f2fd120bef9efca",
"index": 6090,
"step-1": "<mask token>\n\n\ndef select():\n result = tkinter.colorchooser.askcolor(title='内裤颜色种类', initialcolor=\n 'purple')\n print(result)\n btn1['bg'] = result[1]\n\n\n<mask token>\n",
"step-2": "<mask token>\nroot.minsi... | [
1,
2,
3,
4,
5
] |
from __future__ import print_function, division
import os
from os.path import exists, join, basename, dirname
from os import makedirs
import numpy as np
import datetime
import time
import argparse
import torch
import torch.nn as nn
import torch.optim as optim
from lib.dataloader import DataLoader
from lib.im_pair_dat... | normal | {
"blob_id": "0c97569c77fb3598d83eba607960328bb2134dd2",
"index": 333,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntorch.manual_seed(1)\nif use_cuda:\n torch.cuda.manual_seed(1)\nnp.random.seed(1)\n<mask token>\nprint('DCCNet training script')\n<mask token>\nparser.add_argument('--checkpoint', type=... | [
0,
2,
3,
4,
5
] |
# -*- coding: utf-8 -*-
from ..general.utils import log_errors
from googleapiclient import discovery
from oauth2client.client import SignedJwtAssertionCredentials
from django.conf import settings
from celery import shared_task
from logging import getLogger
import httplib2
_logger = getLogger(__name__)
def create_ev... | normal | {
"blob_id": "36fb0d936be5c5d305c4076fd1c497664c9b770a",
"index": 8374,
"step-1": "<mask token>\n\n\ndef create_events_calendar():\n \"\"\" Create an events calendar if none already exists. This function mostly exists for\n creating calendars for dev environments, not used in prod.\n \"\"\"\n service ... | [
4,
6,
7,
8,
9
] |
import math
import random
from PILL import Image, ImageDraw
for i in range(1,1025):
pass
for j in range(1,1025):
pass
epipedo[i][j]
for i in range(1,21):
pass
im = Image.new("RGB", (512, 512), "white")
x=random.choice(1,1025)
y=random.choice(1,1025)
r=random.choi... | normal | {
"blob_id": "a2d2ffe5ed6a844341f7ad731357bb837cee4787",
"index": 6193,
"step-1": "import math\r\nimport random\r\nfrom PILL import Image, ImageDraw\r\nfor i in range(1,1025):\r\n pass\r\n for j in range(1,1025):\r\n pass\r\n epipedo[i][j]\r\nfor i in range(1,21):\r\n pass\r\n im = Image... | [
0
] |
# Enunciado: faça um programa que leia um ano qualquer e mostre se ele é BISEXTO.
ano = int(input('\nInforme o ano: '))
ano1 = ano % 4
ano2 = ano % 100
if ano1 == 0 and ano2 != 0:
print('\nO ano de {} é Bissexto !!'.format(ano))
else:
print('\nO ano de {} não foi Bissexto !!'.format(ano))
| normal | {
"blob_id": "daeb11000978d14a05ea62113dcf6e30d6a98b15",
"index": 3590,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif ano1 == 0 and ano2 != 0:\n print('\\nO ano de {} é Bissexto !!'.format(ano))\nelse:\n print('\\nO ano de {} não foi Bissexto !!'.format(ano))\n",
"step-3": "ano = int(input('\\... | [
0,
1,
2,
3
] |
#!/usr/bin/python3
"""
Test of Rectangle class
"""
from contextlib import redirect_stdout
import io
import unittest
from random import randrange
from models.base import Base
from models.rectangle import Rectangle
from models.square import Square
class TestRectangle(unittest.TestCase):
""" Test Rectangle methods "... | normal | {
"blob_id": "ca00091b7ebcb9ee45b77c919c458c75e3db5b1e",
"index": 4783,
"step-1": "<mask token>\n\n\nclass TestRectangle(unittest.TestCase):\n <mask token>\n\n def setUp(self):\n \"\"\" setUp \"\"\"\n Base._Base__nb_objects = 0\n\n def tearDown(self):\n \"\"\" tearDown destroys any e... | [
23,
25,
26,
28,
31
] |
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QGraphicsOpacityEffect, \
QPushButton
from PyQt5.QtCore import Qt
class ToolBar(QWidget):
"""
Window for entering parameters
"""
def __init__(self, parent):
super().__init__(parent)
self._main_wnd = parent
self.setAttribut... | normal | {
"blob_id": "772e2e0a442c1b63330e9b526b76d767646b0c7c",
"index": 7819,
"step-1": "<mask token>\n\n\nclass ToolBar(QWidget):\n <mask token>\n\n def __init__(self, parent):\n super().__init__(parent)\n self._main_wnd = parent\n self.setAttribute(Qt.WA_StyledBackground, True)\n sel... | [
3,
5,
6,
9,
10
] |
# -*- encoding: utf-8 -*-
#----------------------------------------------------------------------------
#
# Copyright (C) 2014 .
# Coded by: Borni DHIFI (dhifi.borni@gmail.com)
#
#----------------------------------------------------------------------------
import models
import wizard
import parser
# vim:expa... | normal | {
"blob_id": "a3216aa41cd28b91653b99017e21a03e43372e9b",
"index": 4137,
"step-1": "<mask token>\n",
"step-2": "import models\nimport wizard\nimport parser\n",
"step-3": "# -*- encoding: utf-8 -*-\n#----------------------------------------------------------------------------\n#\n# Copyright (C) 2014 .\n# ... | [
0,
1,
2
] |
# Copyright 2014 Charles Noneman
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | normal | {
"blob_id": "9a7908212bf13565109cd4d9ab6de65909bc6910",
"index": 3606,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef run():\n \"\"\"Runs all of the tests\"\"\"\n subsuite_list = []\n for _, modname, _ in pkgutil.iter_modules(test.__path__):\n if modname.startswith('test_'):\n ... | [
0,
1,
2,
3,
4
] |
"""Sorting components: peak waveform features."""
import numpy as np
from spikeinterface.core.job_tools import fix_job_kwargs
from spikeinterface.core import get_channel_distances
from spikeinterface.sortingcomponents.peak_localization import LocalizeCenterOfMass, LocalizeMonopolarTriangulation
from spikeinterface.sor... | normal | {
"blob_id": "6fe22b3f98bff1a9b775fce631ae94a4ee22b04c",
"index": 4371,
"step-1": "<mask token>\n\n\nclass RandomProjectionsFeature(PipelineNode):\n <mask token>\n\n def get_dtype(self):\n return self._dtype\n <mask token>\n\n\nclass RandomProjectionsEnergyFeature(PipelineNode):\n\n def __init_... | [
22,
24,
28,
31,
40
] |
# Generated by Django 2.2.7 on 2019-11-15 23:43
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('quizzapp', '0005_auto_20191115_2339'),
]
operations = [
migrations.RemoveField(
model_name='question',
name='titre',
... | normal | {
"blob_id": "b2fa6104f03dc76522a51f352101cef199ddc665",
"index": 675,
"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 = [('quizzapp', '... | [
0,
1,
2,
3,
4
] |
# block-comments.py
'''
Block comments generally apply to some (or all) code that follows them, and are
indented to the same level as that code. Each line of a block comment starts
with a # and a single space (unless it is indented text inside the comment).
Paragraphs inside a block comment are separated by a line con... | normal | {
"blob_id": "83bac8176caafc5551089c4bef5c1f38e1e8d4da",
"index": 5952,
"step-1": "<mask token>\n",
"step-2": "# block-comments.py\n'''\nBlock comments generally apply to some (or all) code that follows them, and are\nindented to the same level as that code. Each line of a block comment starts\nwith a # and a s... | [
0,
1
] |
def first_repeat(chars):
for x in chars:
if chars.count(x) > 1:
return x
return '-1'
| normal | {
"blob_id": "bf683f8e7fb5ad5f7cd915a8a01d9adf7d13e739",
"index": 3375,
"step-1": "<mask token>\n",
"step-2": "def first_repeat(chars):\n for x in chars:\n if chars.count(x) > 1:\n return x\n return '-1'\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
... | [
0,
1
] |
"""
Common, pure functions used by the D-BAS.
.. codeauthor:: Tobias Krauthoff <krauthoff@cs.uni-duesseldorf.de
"""
import hashlib
import locale
import os
import re
import warnings
from collections import defaultdict
from datetime import datetime
from enum import Enum, auto
from html import escape, unescape
from typi... | normal | {
"blob_id": "10a9437453371bd7472e93af1026c778b7983cf8",
"index": 1137,
"step-1": "<mask token>\n\n\nclass BubbleTypes(Enum):\n USER = auto()\n SYSTEM = auto()\n STATUS = auto()\n INFO = auto()\n\n def __str__(self):\n return str(self.value)\n\n\nclass Relations(Enum):\n UNDERMINE = 'unde... | [
29,
31,
47,
55,
60
] |
from math import exp
from math import e
import numpy as np
import decimal
import pandas as pd
pop = []
x = 0
for a in range(1,10001):
pop.append((1.2)*e**(-1.2*x))
x =+0.0001
for k in range(100,10100,100):
exec(f'S{k} =pop[1:k]')
################################################... | normal | {
"blob_id": "adfdd988b7e208229f195308df8d63fd2799046f",
"index": 8941,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor a in range(1, 10001):\n pop.append(1.2 * e ** (-1.2 * x))\n x = +0.0001\nfor k in range(100, 10100, 100):\n exec(f'S{k} =pop[1:k]')\n<mask token>\nfor size in np.arange(100, ... | [
0,
1,
2,
3,
4
] |
# Kipland Melton
import psutil
import math
def convert_size(size_bytes):
if size_bytes == 0:
return "0B"
size_name = ("%", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
i = int(math.floor(math.log(size_bytes, 1024)))
p = math.pow(1024, i)
s = round(size_bytes / p, 2)
return "%s %s" % (s, siz... | normal | {
"blob_id": "d960d3d1680f825f0f68fc6d66f491bbbba805ce",
"index": 5004,
"step-1": "<mask token>\n\n\ndef RetrieveMemory():\n ram_info = psutil.virtual_memory()\n typePresented = 'Total : ', 'Used : ', 'Free : ', 'Usage : '\n counter = 0\n print()\n for info in ram_info:\n try:\n ... | [
1,
2,
3,
4,
5
] |
import re
import os
import base64
os.popen("tshark -r log.pcap -d 'tcp.port==57000,http' -d 'tcp.port==44322,http' -d 'tcp.port==44818,http' -Y 'data-text-lines' -Tfields -e http.file_data > request")
def evals(text):
template = "{}\['__doc__'\]\[\d+\]"
keys = map(str, range(10))
keys += ['\[\]','\(\)',"'... | normal | {
"blob_id": "c26bdc3f47aa9ac0cda0334e97bdaf3f9d56eb6c",
"index": 437,
"step-1": "import re\nimport os\nimport base64\n\nos.popen(\"tshark -r log.pcap -d 'tcp.port==57000,http' -d 'tcp.port==44322,http' -d 'tcp.port==44818,http' -Y 'data-text-lines' -Tfields -e http.file_data > request\")\n\ndef evals(text):\n ... | [
0
] |
from django.contrib import admin
from main_app.models import sites, statuses, redirects
# Register your models here.
admin.site.register(statuses)
admin.site.register(sites)
admin.site.register(redirects) | normal | {
"blob_id": "2b8ca0c8c7878536da4f31652976988cdba62d89",
"index": 491,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nadmin.site.register(statuses)\nadmin.site.register(sites)\nadmin.site.register(redirects)\n",
"step-3": "from django.contrib import admin\nfrom main_app.models import sites, statuses, re... | [
0,
1,
2,
3
] |
from glob import glob
from PIL import Image
import numpy as np
from tqdm import tqdm
import cv2
import os
import matplotlib.pyplot as plt
np.set_printoptions(precision=3, suppress=True)
def get_index(path):
"""
get the length of index for voc2012 dataset.
path: the index of train,val or test path
"""... | normal | {
"blob_id": "b1b478965ad939a98478b19b4a94f3250167e25a",
"index": 2189,
"step-1": "<mask token>\n\n\ndef show_examples(images_base, labels_base, index_list, output_path):\n results = []\n for index in tqdm(index_list):\n img = cv2.imread(os.path.join(images_base, index + '.jpg'))\n lab = np.ar... | [
2,
3,
4,
5,
6
] |
import daemon
import time
import sys
#out = open("~/tmp/stdout", "a+")
#err = open("~/tmp/stderr", "a+")
# 如果设定为标准输出,那么关闭终端窗口,退出守护进程。
# Ctrl+c 不会退出进程
# 关闭终端窗口,退出守护进程
def do_main_program():
print("start the main program...")
while True:
time.sleep(1)
print('another second passed')
context = d... | normal | {
"blob_id": "3cb96607aaf58a7de3fa0a9cd61b7f4e3c6b061a",
"index": 4802,
"step-1": "<mask token>\n\n\ndef do_main_program():\n print('start the main program...')\n while True:\n time.sleep(1)\n print('another second passed')\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef do_main_progr... | [
1,
2,
3,
4,
5
] |
import cpt_tools
from gui_helpers.gui_config import *
chisqr_str = '\u03c72'
mu_str = '\u03bc'
sigma_str = '\u03c3'
class FitWidget( object ) :
def __init__( self, plotter_widget, analyzer = None ) :
self.plotter_widget = plotter_widget
self.plotter = plotter_widget.plotter
s... | normal | {
"blob_id": "aa51b2d4bfe4051f3302d14cf2123a3881a8a2e3",
"index": 5668,
"step-1": "<mask token>\n\n\nclass FitWidget(object):\n\n def __init__(self, plotter_widget, analyzer=None):\n self.plotter_widget = plotter_widget\n self.plotter = plotter_widget.plotter\n self.hists = self.plotter.al... | [
2,
5,
6,
7,
8
] |
# coding: utf-8
"""
Adobe Experience Manager OSGI config (AEM) API
Swagger AEM OSGI is an OpenAPI specification for Adobe Experience Manager (AEM) OSGI Configurations API # noqa: E501
OpenAPI spec version: 1.0.0-pre.0
Contact: opensource@shinesolutions.com
Generated by: https://openapi-generator... | normal | {
"blob_id": "0ddac0aac5bd001504ed37d31b74c6442304e350",
"index": 5729,
"step-1": "<mask token>\n\n\nclass OrgApacheJackrabbitOakSecurityAuthenticationTokenTokenConfiguraProperties(\n object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask... | [
12,
18,
19,
22,
25
] |
# coding=utf-8
# pylint: disable=too-many-lines
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRe... | normal | {
"blob_id": "fb258521fdfded0062cbe30651268bf5410d3384",
"index": 9864,
"step-1": "<mask token>\n\n\nclass KnowledgeBaseAnswer(_serialization.Model):\n \"\"\"Represents knowledge base answer.\n\n :ivar questions: List of questions associated with the answer.\n :vartype questions: list[str]\n :ivar ans... | [
36,
37,
51,
56,
72
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.