code stringlengths 13 1.2M | order_type stringclasses 1
value | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
myDict = {'Friends': ['AP', 'Soham', 'Baba'], 'Likes': ['Math',
'Programming'], 'languages': ['C++', 'Python', 'Java']}
myInt = 123
myFloat = 12.3333
myName = 'Somesh Thakur'
| normal | {
"blob_id": "345967e2aeafda6ce30cbbbbacf976c97b17def7",
"index": 515,
"step-1": "<mask token>\n",
"step-2": "myDict = {'Friends': ['AP', 'Soham', 'Baba'], 'Likes': ['Math',\n 'Programming'], 'languages': ['C++', 'Python', 'Java']}\nmyInt = 123\nmyFloat = 12.3333\nmyName = 'Somesh Thakur'\n",
"step-3": nul... | [
0,
1
] |
#!/usr/bin/env python3
import os
import requests
# This is the main url of the BSE API
# THIS WILL CHANGE TO HTTPS IN THE FUTURE
# HTTPS IS RECOMMENDED
main_bse_url = "http://basissetexchange.org"
# This allows for overriding the URL via an environment variable
# Feel free to just use the base_url below
base_url = o... | normal | {
"blob_id": "168a76fd3bb43afe26a6a217e90f48704b4f2042",
"index": 6738,
"step-1": "<mask token>\n\n\ndef print_results(r):\n \"\"\"Checks for errors and prints the results of a request\"\"\"\n print(r.text)\n if r.status_code != 200:\n raise RuntimeError(\n 'Could not obtain data from t... | [
1,
2,
3,
4,
5
] |
from pymongo import MongoClient, GEOSPHERE, GEO2D
import os, sys, json, pprint
sys.path.insert(0, '../utils')
import path_functions
client = MongoClient( 'localhost', 27017 )
db = client[ 'nfcdata' ]
json_files_path_list = path_functions.get_json_files('../../ftp-data/geojson-files/quikscat-l2b12')
for json_fil... | normal | {
"blob_id": "cceda9a8a0188499ae0aa588701bb8104b5ed313",
"index": 1041,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsys.path.insert(0, '../utils')\n<mask token>\nfor json_file in json_files_path_list:\n current_collection = ('GeoJSON-quikscat-l2b12-' + path_functions.\n get_file_name(json_fil... | [
0,
1,
2,
3,
4
] |
import json
from django.db import models
from django.conf import settings
from django.core.serializers import serialize
# Create your models here.
def upload_updated_image(instance,filename):
return '/MyApi/{user}/{filename}'.format(user=instance.user,filename=filename)
class UpdateQueryset(models.QuerySet):
... | normal | {
"blob_id": "5749f30d1a1efd5404654d755bca4515adcf4bca",
"index": 1810,
"step-1": "<mask token>\n\n\nclass CRUD(models.Model):\n user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE\n )\n name = models.TextField(blank=True, null=True)\n content = models.TextField(blank=True,... | [
4,
8,
9,
10,
11
] |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-08-24 22:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0026_auto_20160712_1541'),
]
operations = [
migrations.CreateModel(... | normal | {
"blob_id": "04c1765e6c2302098be2a7f3242dfd536683f742",
"index": 6138,
"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
] |
# coding: utf-8
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
driver.get("https://www.baidu.com")
elem = driver.find_element_by_xpath('//*[@id="kw"]')
elem.send_keys("python selenium", Keys.ENTER)
print(driver.page_source)
| normal | {
"blob_id": "3c8352ff2fc92ada1b58603df2a1a402e57842be",
"index": 8606,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ndriver.get('https://www.baidu.com')\n<mask token>\nelem.send_keys('python selenium', Keys.ENTER)\nprint(driver.page_source)\n",
"step-3": "<mask token>\ndriver = webdriver.Chrome()\ndri... | [
0,
1,
2,
3,
4
] |
import uuid
from cqlengine import columns
from cqlengine.models import Model
from datetime import datetime as dt
class MBase(Model):
__abstract__ = True
#__keyspace__ = model_keyspace
class Post(MBase):
id = columns.BigInt(index=True, primary_key=True)
user_id = columns.Integer(required=True, index=... | normal | {
"blob_id": "9cb734f67d5149b052ff1d412d446aea1654fa69",
"index": 9543,
"step-1": "<mask token>\n\n\nclass User(MBase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass UserTimeLine(MBase):\n \"\"\"\n POSTs that user will see in their timeline\n \"\"\"\... | [
30,
32,
35,
37,
41
] |
# -*- coding: utf-8 -*-
"""overview.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/lite/g3doc/examples/style_transfer/overview.ipynb
##### Copyright 2019 The TensorFlow Authors.
"""
#@tit... | normal | {
"blob_id": "36ce0de4cb760632959392a9f982532436bd37b0",
"index": 7272,
"step-1": "<mask token>\n\n\ndef load_img(path_to_img):\n img = tf.io.read_file(path_to_img)\n img = tf.io.decode_image(img, channels=3)\n img = tf.image.convert_image_dtype(img, tf.float32)\n img = img[tf.newaxis, :]\n return ... | [
4,
5,
7,
8,
9
] |
from __future__ import annotations
import pytest
from pytest import param
import ibis
import ibis.expr.datatypes as dt
from ibis.backends.base.sql.alchemy.geospatial import geospatial_supported
DB_TYPES = [
# Exact numbers
("BIGINT", dt.int64),
("BIT", dt.boolean),
("DECIMAL", dt.Decimal(precision=18... | normal | {
"blob_id": "00e9872136e5753364117adbf60793e660c8bef0",
"index": 485,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@pytest.mark.parametrize(('server_type', 'expected_type'), DB_TYPES + [\n param('GEOMETRY', dt.geometry, marks=[skipif_no_geospatial_deps]),\n param('GEOGRAPHY', dt.geography, ma... | [
0,
1,
2,
3,
4
] |
"""
======================
@author:小谢学测试
@time:2021/9/8:8:34
@email:xie7791@qq.com
======================
"""
import pytest
# @pytest.fixture()
# def login():
# print("登录方法")
# def pytest_conftest(config):
# marker_list = ["search","login"]
# for markers in marker_list:
# config.addinivalue_line("m... | normal | {
"blob_id": "b52429f936013ac60659950492b67078fabf3a13",
"index": 4042,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nimport pytest\n",
"step-3": "\"\"\"\n======================\n@author:小谢学测试\n@time:2021/9/8:8:34\n@email:xie7791@qq.com\n======================\n\"\"\"\nimport pytest\n# @pytest.fixture(... | [
0,
1,
2
] |
import os
from distutils.core import Extension
REPROJECT_ROOT = os.path.relpath(os.path.dirname(__file__))
def get_extensions():
libraries = []
sources = []
sources.append(os.path.join(REPROJECT_ROOT, "_overlap.c"))
sources.append(os.path.join(REPROJECT_ROOT, "overlapArea.c"))
sources.append(os... | normal | {
"blob_id": "ad079876476f6f291ad52aece8d0d5afdd5a8bcf",
"index": 9892,
"step-1": "<mask token>\n\n\ndef get_extensions():\n libraries = []\n sources = []\n sources.append(os.path.join(REPROJECT_ROOT, '_overlap.c'))\n sources.append(os.path.join(REPROJECT_ROOT, 'overlapArea.c'))\n sources.append(os... | [
1,
2,
3,
4,
5
] |
HORIZONTAL_TABLE = b'\x09'
class ReagentInfoItem():
'''
This class if defined for a single reagent info unit, from the table's view, its a cell of the table.
'''
def __init__(self, reagent_name, reagent_count):
self.reagent_name = reagent_name
self.reagent_count = reagent_count
de... | normal | {
"blob_id": "994210b3de82af02ec7b1b7bee75ceb88ffb2bd5",
"index": 2491,
"step-1": "\nHORIZONTAL_TABLE = b'\\x09'\n\nclass ReagentInfoItem():\n '''\n This class if defined for a single reagent info unit, from the table's view, its a cell of the table.\n '''\n def __init__(self, reagent_name, reagent_co... | [
0
] |
# TODO - let user input file name on command line
level_file = 'level.txt'
# read characters in level.txt into
# terrain map
# which is array of columns
f = open(level_file)
terrain_map = []
for row in f:
col_index = 0
row_index = 0
for tile in row.rstrip():
if col_index == len(terrain_map):
terrain_map.appen... | normal | {
"blob_id": "fe1cc7660396071172c1ec65ba685e677e497646",
"index": 6354,
"step-1": "# TODO - let user input file name on command line\n\nlevel_file = 'level.txt'\n\n# read characters in level.txt into\n# terrain map\n# which is array of columns\nf = open(level_file)\nterrain_map = []\nfor row in f:\n\tcol_index = ... | [
0
] |
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
from scipy.misc import imread
import os
import numpy as np
files = [ "oracle.PNG",
"SQL.jpg" ]
def plotImage(f):
folder = "C:/temp/"
im = imread(os.path.join(folder, f)).astype(np.float32) / 255
plt.im... | normal | {
"blob_id": "146db68fb84569b914fa741457c595108088dc63",
"index": 7199,
"step-1": "<mask token>\n\n\ndef plotImage(f):\n folder = 'C:/temp/'\n im = imread(os.path.join(folder, f)).astype(np.float32) / 255\n plt.imshow(im)\n a = plt.gca()\n a.get_xaxis().set_visible(False)\n a.get_yaxis().set_vis... | [
1,
2,
3,
4,
5
] |
# coding=utf8
# encoding: utf-8
import os
import platform
import re
import signal
import sys
import traceback
from subprocess import Popen, PIPE
from threading import Thread, current_thread
from Queue import Queue
from util.log import get_logger, log
from video.models import Video, KeywordVideoId
from django.db.mode... | normal | {
"blob_id": "fbd5400823a8148adf358a2acc58fde146a25313",
"index": 2275,
"step-1": "<mask token>\n\n\ndef register_int_signal_handler():\n\n def stop_thread_handler(signum, frame):\n log.info('Received signal {0}. Will stop all task threads'.format(\n signum))\n for _ in range(len(THREA... | [
13,
16,
19,
20,
24
] |
# Generated by Django 3.0.5 on 2020-05-18 12:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cart', '0010_auto_20200518_1718'),
]
operations = [
migrations.AlterField(
model_name='order',
name='fianl_code',
... | normal | {
"blob_id": "da783355c5f888a66f623fa7eeeaf0e4e9fcfa48",
"index": 4982,
"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 = [('cart', '001... | [
0,
1,
2,
3,
4
] |
from flask_socketio import SocketIO
socket = SocketIO()
@socket.on('test')
def on_test(msg):
print 'got message'
| normal | {
"blob_id": "7435aa6cd4eec5582be9f4a1dd75b0dfcadc4409",
"index": 5137,
"step-1": "from flask_socketio import SocketIO\n\nsocket = SocketIO()\n\n@socket.on('test')\ndef on_test(msg):\n print 'got message'\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.core.urlresolvers import reverse
import datetime
class Document(models.Model):
document = models.FileField(upload_to='documents/')
uploaded_at = models.DateTimeField(auto_now_add... | normal | {
"blob_id": "01b14da7d081a67bab6f9921bb1a6a4c3d5ac216",
"index": 3003,
"step-1": "<mask token>\n\n\nclass Assignment(models.Model):\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.name + '-' + self.technology\n\n\nclass Assestment(models.Model):\n name = mo... | [
7,
8,
11,
14,
15
] |
"""
Copyright (c) 2017 - Philip Paquette
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribu... | normal | {
"blob_id": "9a183b1f81681b3dec1132a27b17e389438ab725",
"index": 6045,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef set_seed(n):\n global seed, py_rng, np_rng, t_rng\n seed = n\n py_rng = Random(seed)\n np_rng = np.random.RandomState(seed)\n\n\n<mask token>\n",
"step-3": "<mask to... | [
0,
1,
2,
3,
4
] |
###############################################################################
# Copyright (c) 2017-2020 Koren Lev (Cisco Systems), #
# Yaron Yogev (Cisco Systems), Ilia Abashin (Cisco Systems) and others #
# #
... | normal | {
"blob_id": "d60810ea0b19cc9163ce526e6a5a54da9c8b3f68",
"index": 3595,
"step-1": "<mask token>\n\n\nclass TestKubeFetchContainers(KubeTestBase):\n\n\n class DummyConfig(object):\n\n def __init__(self, _environment):\n self.environment = _environment\n <mask token>\n <mask token>\n\n ... | [
5,
6,
7,
8,
10
] |
import os
import xml.etree.ElementTree as Et
import copy
from .common import CommonRouteExchangeService
class DataRoutes(CommonRouteExchangeService):
"""Класс для работы с данными аршрутов"""
def get_route_from_file(self, path_route):
"""Считывание маршрута из файла
:param path_route: Путь до... | normal | {
"blob_id": "63069f03d17862b8ea6aa74d0acd1370bbea0dcb",
"index": 836,
"step-1": "<mask token>\n\n\nclass DataRoutes(CommonRouteExchangeService):\n <mask token>\n <mask token>\n <mask token>\n\n def change_status_in_route(self, tree_route, status):\n \"\"\"Замена статуса маршрута в маршруте\n ... | [
3,
5,
7,
8
] |
import bz2
import json
import os
from pyspark.context import SparkContext
from pyspark.accumulators import AccumulatorParam
import numpy as np
from scipy import spatial
import pandas as pd
import re
import operator
import csv
CACHE_DIR = "D:\TwitterDatastream\PYTHONCACHE_SMALL"
EDU_DATA = 'merged.csv'
TRAIN_FEAT_CSV =... | normal | {
"blob_id": "ee58ed68d2f3c43f9611f6c6e4cd2b99adcb43d2",
"index": 2616,
"step-1": "<mask token>\n\n\nclass WordsSetAccumulatorParam(AccumulatorParam):\n\n def zero(self, v):\n return set()\n\n def addInPlace(self, acc1, acc2):\n return acc1.union(acc2)\n\n\nclass WordsDictAccumulatorParam(Accu... | [
10,
14,
15,
18,
20
] |
# Copyright 2016-2021 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Meta-class for creating regression tests.
#
import reframe.core.namespaces as namespaces
import reframe.core.parameters ... | normal | {
"blob_id": "e754a24fc9c965c50f7fa12036c884a1a54cc29d",
"index": 6853,
"step-1": "<mask token>\n\n\nclass RegressionTestMeta(type):\n\n\n class MetaNamespace(namespaces.LocalNamespace):\n \"\"\"Custom namespace to control the cls attribute assignment.\n\n Regular Python class attributes can be o... | [
2,
4,
6,
8,
10
] |
from Modules.Pitch.Factory import MainFactory
from Modules.ToJson import Oto
from audiolazy.lazy_midi import midi2str
import utaupy
import string
import random
import math
import os, subprocess, shutil
def RandomString(Length):
Letters = string.ascii_lowercase
return ''.join(random.choice(Letters) for i ... | normal | {
"blob_id": "ce11a5c2fbd6e0ea0f8ab293dc53afd07a18c25c",
"index": 6160,
"step-1": "<mask token>\n\n\ndef RandomString(Length):\n Letters = string.ascii_lowercase\n return ''.join(random.choice(Letters) for i in range(Length))\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef RandomString(Length):\n ... | [
1,
2,
3,
4,
5
] |
#
# @lc app=leetcode.cn id=784 lang=python3
#
# [784] 字母大小写全排列
#
# @lc code=start
# 回溯法 --> 通过 64 ms 13.5 MB
class Solution:
def __init__(self):
self.result = []
def letterCasePermutation(self, S: str) -> List[str]:
arr = list(S)
self.backtracing(arr, 0)
return self.result
... | normal | {
"blob_id": "632c690261b31c7ac0e1d90c814e3b9a7a0dcb29",
"index": 7663,
"step-1": "class Solution:\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "class Solution:\n <mask token>\n <mask token>\n\n def backtracing(self, arr, start):\n if start == len(arr):\n self.r... | [
1,
2,
3,
4,
5
] |
# coding=utf-8
from smallinvoice.commons import BaseJsonEncodableObject, BaseService
class Catalog(BaseJsonEncodableObject):
def __init__(self, catalog_type, unit, name, cost_per_unit, vat=0):
self.type = catalog_type
self.unit = unit
self.name = name
self.cost_per_unit = cost_per_... | normal | {
"blob_id": "37feeba8ff682e5998fde4bcba8c37043cb593f2",
"index": 5195,
"step-1": "<mask token>\n\n\nclass CatalogService(BaseService):\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass CatalogService(BaseService):\n name = 'catalog'\n",
"step-3": "<mask token>\n\n\nclass Catalog(BaseJsonEncodableOb... | [
1,
2,
3,
5,
6
] |
#ABC114 A - クイズ
print("ABC" if input()=="1" else "chokudai")
| normal | {
"blob_id": "14d31a4b7491a7f7a64cd151e79c23546e4a3cd2",
"index": 7683,
"step-1": "<mask token>\n",
"step-2": "print('ABC' if input() == '1' else 'chokudai')\n",
"step-3": "#ABC114 A - クイズ\nprint(\"ABC\" if input()==\"1\" else \"chokudai\")\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,... | [
0,
1,
2
] |
# 1
def transform_data(fn):
print(fn(10))
# 2
transform_data(lambda data: data / 5)
# 3
def transform_data2(fn, *args):
for arg in args:
print(fn(arg))
transform_data2(lambda data: data / 5, 10, 15, 22, 30)
# 4
def transform_data2(fn, *args):
for arg in args:
print('Resu... | normal | {
"blob_id": "c87e6f8780bf8d9097f200c7f2f0faf55beb480c",
"index": 52,
"step-1": "<mask token>\n\n\ndef transform_data2(fn, *args):\n for arg in args:\n print(fn(arg))\n\n\n<mask token>\n",
"step-2": "def transform_data(fn):\n print(fn(10))\n\n\n<mask token>\n\n\ndef transform_data2(fn, *args):\n ... | [
1,
2,
3,
4,
5
] |
#Importacion de Dependencias Flask
from flask import Blueprint,Flask, render_template, request,redirect,url_for,flash
#modelado de basedato.
from App import db
# Importacion de modulo de ModeloCliente
from App.Modulos.Proveedor.model import Proveedor
#Inportacion de modulo de formularioCliente
from App.Modulos.Proveedo... | normal | {
"blob_id": "99ecb927e22bc303dd9dffd2793887e7398dbb83",
"index": 3649,
"step-1": "<mask token>\n\n\n@_Proveedor.route('/Proveedor', methods=['GET', 'POST'])\ndef proveedor():\n frm = form.Fr_Proveedor(request.form)\n if request.method == 'POST':\n pr = Proveedor.query.filter_by(CI=frm.CI.data).first... | [
3,
5,
6,
7,
8
] |
from cpp_service.SubService import SubService
import config
if __name__ == "__main__":
gateway = config.gateway["trading_system_gateway"]
host = gateway["host"]
port = gateway["port"]
server_id = gateway["server_id"]
licences = gateway["licences"]
service = SubService(host, port, server_id, li... | normal | {
"blob_id": "f72cdf8d91c31760335b96052a34615307f48727",
"index": 9774,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n gateway = config.gateway['trading_system_gateway']\n host = gateway['host']\n port = gateway['port']\n server_id = gateway['server_id']\n licen... | [
0,
1,
2,
3
] |
import time
import serial
ser = serial.Serial(
port='/dev/ttyUSB0',
baudrate=9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=None
)
ser.close()
ser.open()
if ser.isOpen():
print "Serial is open"
ser.flushInput()
ser.flushOutput()
while True:
mimic = ''
byt... | normal | {
"blob_id": "b112ca3dc603035f340444fa74a7941b1b95f5e5",
"index": 6877,
"step-1": "import time\nimport serial\n\nser = serial.Serial(\n\tport='/dev/ttyUSB0',\n\tbaudrate=9600,\n\tparity=serial.PARITY_NONE,\n\tstopbits=serial.STOPBITS_ONE,\n\tbytesize=serial.EIGHTBITS,\n\ttimeout=None\n)\nser.close()\nser.open()\n... | [
0
] |
from datetime import timedelta
import pandas as pd
__all__ = ["FixWindowCutoffStrategy"]
class CutoffStrategy:
"""
Class that holds a CutoffStrategy. This is a measure to prevent leakage
Parameters
----------
generate_fn: a function that generates a cutoff time for a given entity.
input... | normal | {
"blob_id": "30f030d48368e1b103f926ee7a15b4b75c4459c7",
"index": 7030,
"step-1": "<mask token>\n\n\nclass CutoffStrategy:\n <mask token>\n\n def __init__(self, generate_fn, description='undescribed cutoff strategy'):\n self.generate_fn = generate_fn\n self.description = description\n\n\nclass... | [
5,
6,
7,
8,
9
] |
import os
import datetime
from classifier import Classification
class PersistableClassificationModel(Classification):
"""
Classification classifier with ability to persist trained classifier on the disk.
"""
def __init__(self, output_dir, origin):
self.originModel = origin
if not os... | normal | {
"blob_id": "a4697f0a0d0cc264b28a58bcc28528c221b4cb49",
"index": 3807,
"step-1": "<mask token>\n\n\nclass PersistableClassificationModel(Classification):\n <mask token>\n\n def __init__(self, output_dir, origin):\n self.originModel = origin\n if not os.path.isdir(output_dir):\n os.... | [
3,
6,
7,
8,
9
] |
# Print list of files and directories
import os
def file_list(dir):
subdir_list = []
for item in os.listdir(dir):
fullpath = os.path.join(dir,item)
if os.path.isdir(fullpath):
subdir_list.append(fullpath)
else:
print(fullpath)
for d in subdir_list:
f... | normal | {
"blob_id": "051544f41cc3c7d78210076cb9720866924ea2a1",
"index": 2942,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef file_list(dir):\n subdir_list = []\n for item in os.listdir(dir):\n fullpath = os.path.join(dir, item)\n if os.path.isdir(fullpath):\n subdir_list.a... | [
0,
1,
2,
3,
4
] |
class Rectangulo():
def __init__(self, base, altura):
self.base = base
self.altura = altura
def calcular_area(self):
return self.base * self.altura
base = float(input("Ingrese la base del rectangulo: \n"))
altura = float(input("Ingrese la altura del rectangulo: \n"))
#Primera instan... | normal | {
"blob_id": "2e60781da004fb86d3a33deae970c1faf2a5037d",
"index": 5793,
"step-1": "class Rectangulo:\n <mask token>\n\n def calcular_area(self):\n return self.base * self.altura\n\n\n<mask token>\n",
"step-2": "class Rectangulo:\n\n def __init__(self, base, altura):\n self.base = base\n ... | [
2,
3,
4,
5,
6
] |
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.model import TeaModel
class CreateCertificateRequest(TeaModel):
def __init__(self, domain=None, certificate=None, private_key=None, certificate_name=None, instance_id=None):
self.domain = domain # type: str
sel... | normal | {
"blob_id": "addf92a3d4060fa9464a802a4a4378cf9eeadde4",
"index": 2545,
"step-1": "<mask token>\n\n\nclass DescribeDomainResponseBodyDomainCloudNativeInstancesProtocolPortConfigs(\n TeaModel):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass DescribeDomainResponseBodyDomainClo... | [
426,
429,
443,
447,
577
] |
import datetime
import numpy as np
import tensorflow as tf
from alphai_time_series.performance_trials.performance import Metrics
import alphai_cromulon_oracle.cromulon.evaluate as crocubot_eval
import alphai_cromulon_oracle.cromulon.train as crocubot_train
from alphai_cromulon_oracle.cromulon.helpers import Tensorfl... | normal | {
"blob_id": "bef16443f77b2c1e09db9950a4617703085d9f71",
"index": 7807,
"step-1": "<mask token>\n\n\ndef run_timed_benchmark_time_series(series_name, tf_flags, do_training=True):\n topology = load_default_topology(series_name, tf_flags)\n n_train_samples = np.minimum(tf_flags.n_training_samples_benchmark, 1... | [
1,
2,
3,
4,
5
] |
import Pyro4
from Pyro4 import Daemon, Proxy
from threading import Thread
import thread
import pickle
import socket
Pyro4.config.REQUIRE_EXPOSE = False
def register(obj):
''' Register an object with daemon '''
daemon = Pyro4.Daemon(host="localhost")
uri = daemon.register(obj) # Scheduler
serve_daemon(... | normal | {
"blob_id": "02cd99f0a265fe01835a6adc211e750a58d993fd",
"index": 6610,
"step-1": "import Pyro4\nfrom Pyro4 import Daemon, Proxy\nfrom threading import Thread\nimport thread\nimport pickle\nimport socket\n\nPyro4.config.REQUIRE_EXPOSE = False\n\ndef register(obj):\n ''' Register an object with daemon '''\n ... | [
0
] |
from django.test import TestCase
from django.core.files import File
from ResearchManage.forms import ResearchFormMKI
from django.test import Client
from unittest import TestCase, mock
from datetime import date, timedelta
from django.core.files.uploadedfile import SimpleUploadedFile
import os
# Create your tests here.
... | normal | {
"blob_id": "c5d0b23396e084ad6ffade15b3aa3c59b6be3cc0",
"index": 2706,
"step-1": "<mask token>\n\n\nclass TestForms(TestCase):\n <mask token>\n\n def test_wrong_data_ResearchFormMKI_form(self):\n with open(os.path.abspath(os.curdir) + 'Test.txt', 'wb') as f:\n f.write(b'ABOBA')\n w... | [
5,
6,
7,
8,
9
] |
"""component URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')... | normal | {
"blob_id": "0de735647cf87f64ab64af081da6e11b0ed8a7a7",
"index": 1173,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [url('^login/$', login_page, name='login'), url('^logout/$',\n logout_page, name='logout'), url('^register/$', register_page, name=\n 'register'), url('^product/$', pr... | [
0,
1,
2,
3
] |
import pytest
from feast.pyspark.launchers.gcloud import DataprocClusterLauncher
@pytest.fixture
def dataproc_launcher(pytestconfig) -> DataprocClusterLauncher:
cluster_name = pytestconfig.getoption("--dataproc-cluster-name")
region = pytestconfig.getoption("--dataproc-region")
project_id = pytestconfig.... | normal | {
"blob_id": "ff13ac0ee401471fe5446e8149f019d9da7f3ddf",
"index": 5147,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@pytest.fixture\ndef dataproc_launcher(pytestconfig) ->DataprocClusterLauncher:\n cluster_name = pytestconfig.getoption('--dataproc-cluster-name')\n region = pytestconfig.getopt... | [
0,
1,
2,
3
] |
#!/bin/python3
import sys
# import numpy as np
def _get_change_making_matrix(set_of_coins, r):
matrix = [[0 for _ in range(r + 1)] for _ in range(len(set_of_coins) + 1)]
# matrix = np.array(matrix)
for i in range(1,len(set_of_coins) + 1):
matrix[i][0] = i
return matrix
def change_making(co... | normal | {
"blob_id": "f15bc62fad2c47fed2e9e5d269284ebe7487b789",
"index": 2297,
"step-1": "<mask token>\n\n\ndef _get_change_making_matrix(set_of_coins, r):\n matrix = [[(0) for _ in range(r + 1)] for _ in range(len(set_of_coins) + 1)\n ]\n for i in range(1, len(set_of_coins) + 1):\n matrix[i][0] = i\... | [
2,
3,
4,
5,
6
] |
from typing import Union, Tuple
import numpy as np
from UQpy.utilities.kernels.baseclass.GrassmannianKernel import GrassmannianKernel
class ProjectionKernel(GrassmannianKernel):
def __init__(self, kernel_parameter: Union[int, float] = None):
"""
:param kernel_parameter: Number of independent p-... | normal | {
"blob_id": "14ce803e3deb529b489c150c7ecc702118448acb",
"index": 9022,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass ProjectionKernel(GrassmannianKernel):\n <mask token>\n\n def element_wise_operation(self, xi_j: Tuple) ->float:\n \"\"\"\n Compute the Projection kernel entr... | [
0,
2,
3,
4,
5
] |
from launch import LaunchDescription
from launch_ros.actions import Node
import os
params = os.path.join('INSERT_PATH/src/beckhoff_ros', 'config', 'params.yaml')
def generate_launch_description():
return LaunchDescription([Node(package='beckhoff_ros', executable=
'beckhoff_ros_node', name='beckhoff_ros_no... | normal | {
"blob_id": "ae4f8eb71939ff212d05d12f65edeaecf66f2205",
"index": 4874,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef generate_launch_description():\n return LaunchDescription([Node(package='beckhoff_ros', executable=\n 'beckhoff_ros_node', name='beckhoff_ros_node', parameters=[params],... | [
0,
1,
2,
3
] |
import math
import os
import pathfinder as pf
from constants import X_ROBOT_LENGTH, Y_ROBOT_WIDTH, Y_WALL_TO_EXCHANGE_FAR, \
X_WALL_TO_SWITCH_NEAR
from utilities.functions import GeneratePath
class settings():
order = pf.FIT_HERMITE_QUINTIC
samples = 1000000
period = 0.02
maxVelocity =... | normal | {
"blob_id": "5e06dfb7aac64b5b98b4c0d88a86f038baf44feb",
"index": 5412,
"step-1": "<mask token>\n\n\nclass settings:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass settings:\n order = pf.FIT_... | [
1,
3,
4,
5,
6
] |
data = [
"........#.............#........",
"...#....#...#....#.............",
".#..#...#............#.....#..#",
"..#......#..##............###..",
"..........#......#..#..#.......",
".#..#.......#.........#.#......",
".........#..#....##..#.##....#.",
"..#....##...#..................",... | normal | {
"blob_id": "c22651437094723b711a959e031f1c7f928f735a",
"index": 7645,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef treeCounter(moveRight, moveDown):\n row = 0\n index = 0\n trees = 0\n finished = False\n while not finished:\n row += moveDown\n if len(data) > row:\n... | [
0,
1,
2,
3,
4
] |
import turtle
def draw_square():
conrad = turtle.Turtle()
conrad.shape("turtle")
conrad.color("red")
conrad.speed(3)
i = 0
while(i < 4):
conrad.forward(200)
conrad.right(90)
i += 1
def draw_circle():
niki = turtle.Turtle()
niki.circle(50)
def draw_triangle():
tri = turtle.Turtle()
tri.shape("t... | normal | {
"blob_id": "9a982e0ab7fff882767a98ed01f5ed68bd710888",
"index": 7433,
"step-1": "<mask token>\n\n\ndef draw_circle():\n niki = turtle.Turtle()\n niki.circle(50)\n\n\ndef draw_triangle():\n tri = turtle.Turtle()\n tri.shape('turtle')\n i = 0\n while i < 3:\n tri.forward(135)\n tri... | [
2,
4,
5,
6,
7
] |
from board.ttt import TTT
from mctsai.mcts import MCTS
import unittest
# skip = [0, 1]
skip = [0]
class TestTTT(unittest.TestCase):
def test_mcts(self):
if 0 in skip:
print("Skipping ai self-play")
return
ttt = TTT()
for i in range(1000):
mcts = MCTS(tt... | normal | {
"blob_id": "d0a3f332e04627eb275168972bd92cd1ea9b9447",
"index": 227,
"step-1": "<mask token>\n\n\nclass TestTTT(unittest.TestCase):\n\n def test_mcts(self):\n if 0 in skip:\n print('Skipping ai self-play')\n return\n ttt = TTT()\n for i in range(1000):\n ... | [
4,
6,
7,
8,
10
] |
import os
import shutil
import argparse
ap = argparse.ArgumentParser()
ap.add_argument('-D', '--dir', required=False, help='Directory to sort')
args = vars(ap.parse_args())
if args['dir'] == None:
DIR = os.getcwd()
elif os.path.exists(args['dir']):
DIR = args['dir']
for file in os.listdir(DIR):
if not os.pa... | normal | {
"blob_id": "93737e4c409d0efb1ae2263cb60d4b03d9aad0d8",
"index": 247,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nap.add_argument('-D', '--dir', required=False, help='Directory to sort')\n<mask token>\nif args['dir'] == None:\n DIR = os.getcwd()\nelif os.path.exists(args['dir']):\n DIR = args['d... | [
0,
1,
2,
3
] |
from __future__ import unicode_literals
from django.db import models
from django.db.models.signals import post_save
from django.contrib.auth.models import User
from django.dispatch import receiver
PROFILE_PIC_PATH = 'users/profile_pic'
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=model... | normal | {
"blob_id": "3e7df9a733c94b89d22d10883844c438444d5e2c",
"index": 8010,
"step-1": "<mask token>\n\n\nclass Profile(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Profile(models.Model):\n user = models.OneToOneField(User, on_delete... | [
1,
2,
3,
4
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
try:
from espeak import espeak
except ImportError:
class espeak():
@classmethod
def synth(*args):
print('Cannot generate speech. Please, install python3-espeak module.')
return 1
def run(*args, **kwargs):
text = ' '.jo... | normal | {
"blob_id": "cd5929496b13dd0d5f5ca97500c5bb3572907cc5",
"index": 2769,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef run(*args, **kwargs):\n text = ' '.join(map(str, args))\n espeak.synth(text)\n",
"step-3": "try:\n from espeak import espeak\nexcept ImportError:\n\n\n class espeak:... | [
0,
1,
2,
3
] |
# -*- coding: utf8 -*-
from django.db import models
import custom_fields
import datetime
#import mptt
# Create your models here.
class Message(models.Model):
user = models.ForeignKey('User')
time = models.DateTimeField(auto_now=True,auto_now_add=True)
text = models.TextField()
#true если это ответ подд... | normal | {
"blob_id": "64fd597918fe8133d53d1df741512cd2e49a111d",
"index": 1252,
"step-1": "<mask token>\n\n\nclass Ticket(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n ... | [
20,
22,
27,
29,
32
] |
import sys, getopt
import sys, locale
import httplib
import json
#sys.argv = [sys.argv[0], '--id=275', '--ofile=275.json']
def getRouteId(routeName, out_filename):
conn = httplib.HTTPConnection("data.ntpc.gov.tw")
qryString = "/od/data/api/67BB3C2B-E7D1-43A7-B872-61B2F082E11B?$format=json&$filter=nameZh%20eq%... | normal | {
"blob_id": "87c413051ed38b52fbcc0b0cf84ecd75cd1e3f0c",
"index": 3139,
"step-1": "import sys, getopt\nimport sys, locale\nimport httplib\nimport json\n\n#sys.argv = [sys.argv[0], '--id=275', '--ofile=275.json']\n\ndef getRouteId(routeName, out_filename):\n conn = httplib.HTTPConnection(\"data.ntpc.gov.tw\")\n... | [
0
] |
y_true = [7, 3, 3, 4, 9, 9, 2, 5, 0, 0, 6, 3, 1, 6, 8, 7, 9, 7, 4, 2, 0, 1,
4, 1, 7, 7, 5, 0, 8, 0, 1, 7, 4, 2, 2, 4, 9, 3, 1, 7, 1, 2, 1, 7, 5, 9,
9, 4, 8, 5, 7, 2, 7, 5, 5, 6, 6, 1, 2, 6, 6, 5, 3, 2, 3, 8, 8, 8, 8, 5,
3, 4, 3, 2, 8, 1, 9, 0, 6, 8, 6, 1, 1, 1, 5, 4, 8, 8, 5, 5, 8, 6, 4, 4,
6, 9, 8, 1, ... | normal | {
"blob_id": "593d3221e34c0eef51228082d767d8516ec93ca2",
"index": 8002,
"step-1": "<mask token>\n",
"step-2": "y_true = [7, 3, 3, 4, 9, 9, 2, 5, 0, 0, 6, 3, 1, 6, 8, 7, 9, 7, 4, 2, 0, 1,\n 4, 1, 7, 7, 5, 0, 8, 0, 1, 7, 4, 2, 2, 4, 9, 3, 1, 7, 1, 2, 1, 7, 5, 9,\n 9, 4, 8, 5, 7, 2, 7, 5, 5, 6, 6, 1, 2, 6, 6... | [
0,
1
] |
import requests
from pyrogram import Client as Bot
from samantha.config import API_HASH, API_ID, BG_IMAGE, BOT_TOKEN
from samantha.services.callsmusic import run
response = requests.get(BG_IMAGE)
file = open("./etc/tg_vc_bot.jpg", "wb")
file.write(response.content)
file.close()
bot = Bot(
":memory:",
API_ID,... | normal | {
"blob_id": "c5ac37ce09f7cd76ccd9b93c64e602209a04c55c",
"index": 1824,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfile.write(response.content)\nfile.close()\n<mask token>\nbot.start()\nrun()\n",
"step-3": "<mask token>\nresponse = requests.get(BG_IMAGE)\nfile = open('./etc/tg_vc_bot.jpg', 'wb')\nfi... | [
0,
1,
2,
3,
4
] |
import mysql.connector
from getpass import getpass
tables_schema = {
"Country": "SELECT 'Id','Name','Code' " +
"UNION ALL " +
"SELECT Id, Name, Code ",
"Indicator": "SELECT 'Id','Name','Code' " +
"UNION ALL " +
"SELECT Id, Name, Code ",
"Year": "SELECT 'Id','FiveYearPe... | normal | {
"blob_id": "fd76a7dd90bac7c7ba9201b6db62e6cb3eedeced",
"index": 4390,
"step-1": "<mask token>\n\n\ndef backup_db(cursor):\n for table in tables_schema:\n backup_table(cursor, table)\n\n\ndef backup_table(cursor, table):\n cursor.execute(f'{tables_schema[table]}' +\n f\"INTO OUTFILE '/tmp/{ta... | [
4,
5,
6,
7,
9
] |
def main():
s1 = 'mabaabm'
s2 = 'moktko!'
s3 = ex7(s1, s2)
print(s3)
def ex7(in1, in2):
out1 = in1[0] + in1[int(len(in1) / 2)] + in1[int(len(in1) - 1)] + in2[0
] + in2[int(len(in2) / 2)] + in2[int(len(in2) - 1)]
return out1
if __name__ == '__main__':
main()
| normal | {
"blob_id": "f45cae397aa3b7bdba6e3f36e20b926487cb160d",
"index": 9238,
"step-1": "<mask token>\n",
"step-2": "def main():\n s1 = 'mabaabm'\n s2 = 'moktko!'\n s3 = ex7(s1, s2)\n print(s3)\n\n\n<mask token>\n",
"step-3": "def main():\n s1 = 'mabaabm'\n s2 = 'moktko!'\n s3 = ex7(s1, s2)\n ... | [
0,
1,
2,
3
] |
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name = 'index'),
path('about/', views.about, name='about'),
path('contact/', views.contact, name= 'contact'),
path('category/', views.category, name='category'),
path('product/<str:id>/<slug:slug>',views.product... | normal | {
"blob_id": "0588aad1536a81d047a2a2b91f83fdde4d1be974",
"index": 3869,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [path('', views.index, name='index'), path('about/', views.\n about, name='about'), path('contact/', views.contact, name='contact'),\n path('category/', views.category... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_visual_coding_2p_analysis
----------------------------------
Tests for `visual_coding_2p_analysis` module.
"""
import pytest
@pytest.fixture
def decorated_example():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
... | normal | {
"blob_id": "ae3198e68d9479605327b729c01fb15eae87ab98",
"index": 3282,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@pytest.fixture\ndef decorated_example():\n \"\"\"Sample pytest fixture.\n See more at: http://doc.pytest.org/en/latest/fixture.html\n \"\"\"\n\n\n<mask token>\n",
"step-3"... | [
0,
1,
2,
3,
4
] |
from .ctoybox import Game, State as FrameState, Input
import numpy as np
from PIL import Image
import json
from typing import Dict, Any, List, Tuple, Union, Optional
def json_str(js: Union[Dict[str, Any], Input, str]) -> str:
"""
Turn an object into a JSON string -- handles dictionaries, the Input class, and... | normal | {
"blob_id": "c77e320cee90e8210e4c13d854649b15f6e24180",
"index": 2798,
"step-1": "<mask token>\n\n\nclass Toybox(object):\n <mask token>\n\n def __init__(self, game_name: str, grayscale: bool=True, frameskip: int\n =0, seed: Optional[int]=None, withstate: Optional[dict]=None):\n \"\"\"\n ... | [
27,
30,
39,
59,
65
] |
import os
import sys
import random
import string
trainingData = open('./Data.txt').readlines()
# Used for storing the Markov states
table = {}
# Stores all the words
words = []
# The size of the tuple that represents the Markov State
ChainLength = 2
# Length of hte output chain
Size = int(sys.argv[1])
if(len(sys.... | normal | {
"blob_id": "379ab72f5cc74cf6ed4319fff76437ce84aaca23",
"index": 4185,
"step-1": "import os\nimport sys\nimport random\nimport string\n\n\ntrainingData = open('./Data.txt').readlines()\n\n# Used for storing the Markov states\ntable = {} \n\n# Stores all the words\nwords = []\n\n# The size of the tuple that repre... | [
0
] |
from django.shortcuts import render, render_to_response, get_object_or_404, redirect
from .models import Club
from .forms import InputForm
# Create your views here.
def base(request):
return render(request, 'VICHealth_app/base.html')
def index(request):
return render(request, 'VICHealth_app/index.html')
def ... | normal | {
"blob_id": "b0818b545ab47c27c705f2ccfa3b9edb741602f7",
"index": 4757,
"step-1": "<mask token>\n\n\ndef base(request):\n return render(request, 'VICHealth_app/base.html')\n\n\n<mask token>\n\n\ndef check_activity_level(request):\n return render(request, 'VICHealth_app/check_activity_level.html')\n\n\n<mask... | [
2,
3,
5,
6,
7
] |
import math
class Point:
def __init__(self, x: int, y: int):
self.x = x
self.y = y
def create_point(self):
point = [self.x, self.y]
return point
@staticmethod
def calculate_distance(point_1: [], point_2: []):
side_a = abs(point_1.x - point_2.x)
side_b... | normal | {
"blob_id": "cda7595e46528739cad49a5d62a80bc7b2087157",
"index": 1911,
"step-1": "<mask token>\n\n\nclass Point:\n\n def __init__(self, x: int, y: int):\n self.x = x\n self.y = y\n\n def create_point(self):\n point = [self.x, self.y]\n return point\n\n @staticmethod\n def ... | [
4,
5,
6,
7
] |
__author__ = 'dongdaqing'
import threading,time
class MyThread(threading.Thread):
def __init__(self, name=None):
threading.Thread.__init__(self)
self.name = name
def run(self):
print time.strftime('%Y-%m-%d %H-%M-%S',time.localtime())
print self.name
def test():
for i in r... | normal | {
"blob_id": "9c277030ef384d60e62c2c48e38a1271a43826d6",
"index": 3557,
"step-1": "__author__ = 'dongdaqing'\n\nimport threading,time\nclass MyThread(threading.Thread):\n def __init__(self, name=None):\n threading.Thread.__init__(self)\n self.name = name\n\n def run(self):\n print time.... | [
0
] |
#!/usr/bin/python3
# encoding: utf-8
"""
@author: ShuoChang
@license: (C) MIT.
@contact: changshuo@bupt.edu.cn
@software: CRNN_STN_SEQ
@file: decoder_base.py
@time: 2019/7/22 17:21
@blog: https://www.zhihu.com/people/chang-shuo-59/activities
"""
from abc import ABCMeta
from abc import abstractmethod
class DecoderBas... | normal | {
"blob_id": "0d8a26ef4077b40e8255d5bb2ce9217b51118780",
"index": 7364,
"step-1": "<mask token>\n\n\nclass DecoderBase(object):\n <mask token>\n <mask token>\n\n def __init__(self):\n self._predictor = 'decoder'\n self._label = None\n pass\n\n @abstractmethod\n def set_label(se... | [
4,
5,
7,
8,
10
] |
from selenium import webdriver;
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.keys import Keys
import time
driver = webdriver.Chrome(Chr... | normal | {
"blob_id": "1a1a217b382f3c58c6c4cd3c1c3f556ae945f5a7",
"index": 7850,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ndriver.implicitly_wait(10)\ndriver.maximize_window()\ndriver.get('http://demo.automationtesting.in/Register.html')\n<mask token>\nactions.move_to_element(interactions).move_to_element(dra... | [
0,
1,
2,
3,
4
] |
# Generated by Django 3.1.4 on 2020-12-11 17:50
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0016_auto_20201211_2158'),
]
operations = [
migrations.CreateModel(
name='Question',
... | normal | {
"blob_id": "e8011e98da342e501070febf421e9f8d0b74d64e",
"index": 6813,
"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 = [('core', '001... | [
0,
1,
2,
3,
4
] |
# 把函数视作对象
def factorial(n):
"""returns n!"""
return 1 if n < 2 else n * factorial(n - 1)
fact = factorial
print(list(map(fact, range(6)))) # 构建 0! 和 5! 的一个阶乘列表。
print([fact(n) for n in range(6)]) # 使用列表推导执行相同的操作。
# filter() 函数用于过滤序列,过滤掉不符合条件的元素,返回一个迭代器对象,如果要转换为列表,可以使用 list() 来转换。
# 该接收两个参数,第... | normal | {
"blob_id": "4411c81351ac76d72512faaa6b498cd577815691",
"index": 2572,
"step-1": "<mask token>\n",
"step-2": "def factorial(n):\n \"\"\"returns n!\"\"\"\n return 1 if n < 2 else n * factorial(n - 1)\n\n\n<mask token>\n",
"step-3": "def factorial(n):\n \"\"\"returns n!\"\"\"\n return 1 if n < 2 el... | [
0,
1,
2,
3,
4
] |
from selenium import webdriver
from bs4 import BeautifulSoup
from selenium.webdriver.common.action_chains import ActionChains
import time
import json
import re
import os
import datetime
###########################################################################
driver_path = "/home/arnab/Codes/00_Libs/chromedriver_lin... | normal | {
"blob_id": "43b9d308bb8d2b38c5f539e8700f5c2d8fe2287d",
"index": 2157,
"step-1": "<mask token>\n\n\ndef simplify_string(inp):\n inp = inp.lower().strip()\n inp = re.sub('[^A-Za-z0-9]', '_', inp)\n return inp\n\n\ndef makeDirectory(path):\n print('creating directory ' + path)\n try:\n os.mkd... | [
7,
9,
10,
12,
16
] |
../PyFoam/bin/pyFoamPlotWatcher.py | normal | {
"blob_id": "ec2d3bbfce06c498790afd491931df3f391dafbe",
"index": 8686,
"step-1": "../PyFoam/bin/pyFoamPlotWatcher.py",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
from django.http import response
from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.response import Response
from .models import User
from .serializers import UserSerializer,UserCreationSerialier,UserEditionSerializer
from rest_framework import status
from rest_framework.pe... | normal | {
"blob_id": "dff454cbde985a08b34377b80dd8e3b22f1cc13a",
"index": 3948,
"step-1": "<mask token>\n\n\nclass CreateUser(APIView):\n <mask token>\n\n\nclass EditUser(APIView):\n\n def put(self, request, pk):\n user = User.objects.filter(pk=pk, is_removed=False).first()\n if user is None:\n ... | [
8,
10,
11,
13,
15
] |
'''
'''
import numpy as np
from scipy.spatial import distance
def synonym_filter(WordVectors_npArray, WordLabels_npArray):
'''
'''
pass
def synonym_alternatives_range(WordVectors_npArray,
AlternativesVectorOne_npArray,
Alternati... | normal | {
"blob_id": "ea0a59953f2571f36e65f8f958774074b39a9ae5",
"index": 6996,
"step-1": "<mask token>\n\n\ndef synonym_alternatives_range(WordVectors_npArray,\n AlternativesVectorOne_npArray, AlternativesVectorTwo_npArray,\n AlternativesVectorThree_npArray, AlternativesVectorFour_npArray):\n \"\"\"\n \"\"\"... | [
1,
3,
4,
5,
6
] |
N=int(input())
S=input()
ans=0
for i in range(1000):
l=str(i).zfill(3);k=0
for j in range(N):
if S[j]==l[k]:
k+=1
if k==3:ans+=1;break
print(ans)
| normal | {
"blob_id": "dabd835ff02f2adb01773fb7dd7099206cbae162",
"index": 9903,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(1000):\n l = str(i).zfill(3)\n k = 0\n for j in range(N):\n if S[j] == l[k]:\n k += 1\n if k == 3:\n ans += 1\n ... | [
0,
1,
2,
3
] |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 30 22:01:06 2016
@author: George
"""
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 24 23:22:16 2016
@author: George
"""
import os
import clr
import numpy as np
clr.AddReference(os.getcwd() + "\\libs\\MyMediaLite\\MyMediaLite.dll")
from MyMediaLite import IO, RatingP... | normal | {
"blob_id": "1292b894b75676abec3f97a8854fe406787baf1d",
"index": 7909,
"step-1": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Fri Dec 30 22:01:06 2016\n\n@author: George\n\"\"\"\n\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sat Dec 24 23:22:16 2016\n\n@author: George\n\"\"\"\n\nimport os\nimport clr\nimport num... | [
0
] |
'''
A empresa Tchau de telefonia cobra:
-Abaixo de 200 minutos, R$ 0,20 por minuto
-Entre 200 e 400 minutos, R$ 0,18 por minuto
-Acima de 400 minutos, R$ 0,15 por minuto
- Bonus: - Acima de 800 minutos, R$ 0,08
Calcule a conta de telefone
'''
minutos = int(input('Minutos utilizados: '))
if minutos > 800:
total ... | normal | {
"blob_id": "1b3e64be988495454535ca96c7a1b6c20aa27076",
"index": 2648,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif minutos > 800:\n total = minutos * 0.08\nelif minutos > 400 and minutos <= 800:\n total = minutos * 0.15\nelif minutos < 200:\n total = minutos * 0.2\nelse:\n total = minut... | [
0,
1,
2,
3
] |
a = float(input('Digite um valor: '))
b = float(input('Digite outro valor: '))
c = float(input('Digite mais um valor: '))
if a == b or b == c:
print('Com os números digitados, formam um triângulo EQUILATERO.')
elif a <> b and b <> c and c == a and b == c:
print('Com os números digitados, formam um triângulo ISO... | normal | {
"blob_id": "81233eb12b8447d017b31f200ab7902dcce45496",
"index": 1649,
"step-1": "a = float(input('Digite um valor: '))\nb = float(input('Digite outro valor: '))\nc = float(input('Digite mais um valor: '))\nif a == b or b == c:\n print('Com os números digitados, formam um triângulo EQUILATERO.')\nelif a <> b ... | [
0
] |
from .exec_generator import *
| normal | {
"blob_id": "b6ee3c980357ab22a7969c21207b34546c87092d",
"index": 7305,
"step-1": "<mask token>\n",
"step-2": "from .exec_generator import *\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
from .lasot import Lasot
from .got10k import Got10k
from .tracking_net import TrackingNet
from .imagenetvid import ImagenetVID
from .imagenetdet import ImagenetDET
from .coco_seq import MSCOCOSeq
from .vot import VOT
from .youtube_vos import YoutubeVOS
from .youtube_bb import YoutubeBB
| normal | {
"blob_id": "e12ca2c4592a629ce78cae7211fedaf02352a603",
"index": 4700,
"step-1": "<mask token>\n",
"step-2": "from .lasot import Lasot\nfrom .got10k import Got10k\nfrom .tracking_net import TrackingNet\nfrom .imagenetvid import ImagenetVID\nfrom .imagenetdet import ImagenetDET\nfrom .coco_seq import MSCOCOSeq\... | [
0,
1
] |
from application.routes import pad_num, tracking_gen
from flask import url_for
from flask_testing import TestCase
from application import app, db
from application.models import Users, Orders
from os import getenv
class TestCase(TestCase):
def create_app(self):
app.config.update(
SQLALCHEMY_DA... | normal | {
"blob_id": "eeece3bf423f85f05ef11db47909215578e64aec",
"index": 4912,
"step-1": "<mask token>\n\n\nclass TestViews(TestCase):\n <mask token>\n\n def test_add_order_get(self):\n response = self.client.get(url_for('add_order'))\n self.assertEqual(response.status_code, 200)\n\n def test_view... | [
20,
27,
32,
33,
34
] |
'''Finding Perfect Numbers
3/2/17
@author: Annalane Miller (asm9) and Ivanna Rodriguez (imr6)'''
num_perfect = 0
for value in range(2, 10000):
#set initial values
high= value
low = 1
divisors = []
#finding divisors
while low < high:
if value % low ==0:
high = value// low
... | normal | {
"blob_id": "1f0349edd9220b663f7469b287f796e4a54df88d",
"index": 6502,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor value in range(2, 10000):\n high = value\n low = 1\n divisors = []\n while low < high:\n if value % low == 0:\n high = value // low\n divisors... | [
0,
1,
2,
3
] |
"""
Package:
pgnumpy
Description
A class and a set of functions for interacting with a PostgreSql database.
A C++ extension module allows returning results as a NumPy array. Numpy
arrays can also be written to tables.
The workhorse class is called PgNumpy
This class has limited functio... | normal | {
"blob_id": "7e5cf782692d9cfb2718b2efcc83efa2ecb815cd",
"index": 1371,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntry:\n from psycopg2 import connect\nexcept:\n pass\n",
"step-3": "<mask token>\nimport pgnumpy\nimport cpgnumpy\nfrom pgnumpy import connect\nfrom pgnumpy import PgNumpy\nfrom pg... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, pickle, json, ast
import pandas as pd
from scipy import spatial
import numpy as np
from scipy import stats
from sklearn.model_selection import train_test_split
from sklearn import preprocessing
from sklearn.svm import LinearSVC
from sklearn.metrics import preci... | normal | {
"blob_id": "c23bd136991bfb41f153321420c2fcfba0c843f4",
"index": 1513,
"step-1": "<mask token>\n\n\nclass TaskSolver:\n <mask token>\n <mask token>\n <mask token>\n\n def task_calculate_cosin_similarity(self, word1, word2, print_to_screen\n =True):\n sim = 0\n if word1 in self.W2... | [
7,
11,
12,
15,
16
] |
from django.shortcuts import render, redirect
from .models import *
from django.contrib.auth import authenticate ,login,logout
from django.contrib.auth.models import User
from datetime import date
# Create your views here.
def home(request):
if request.method=='GET':
daily_users = User.objects.f... | normal | {
"blob_id": "4cb601d7fc4023e145c6d510d27507214ddbd2d3",
"index": 809,
"step-1": "<mask token>\n\n\ndef register(request):\n if request.method == 'GET':\n return render(request, 'home/home.html')\n else:\n name = request.POST['name']\n username = request.POST['uname']\n email = r... | [
5,
6,
7,
8,
9
] |
#!/usr/bin/env python
import utils
def revcomp(s):
comp = {'A':'T', 'T':'A', 'G':'C', 'C':'G'}
return ''.join([comp[c] for c in reversed(s)])
def reverse_palindromes(s):
results = []
l = len(s)
for i in range(l):
for j in range(4, 13):
if i + j > l:
continue
... | normal | {
"blob_id": "1f40c0ed8e449354a5a87ef18bb07978a9fb8a1c",
"index": 3368,
"step-1": "#!/usr/bin/env python\n\nimport utils\n\ndef revcomp(s):\n comp = {'A':'T', 'T':'A', 'G':'C', 'C':'G'}\n return ''.join([comp[c] for c in reversed(s)])\n\ndef reverse_palindromes(s):\n results = []\n l = len(s)\n for... | [
0
] |
incremental_factors_file = '../2019_2020_IncrementalFactorsList.csv'
tax_pickle_for_apns = 'kmes_taxes.p'
tax_history_pickle = '../cusd_1percent_tax_history.p'
distribution_pickle_out = 'kmes_distribution.p'
cabrillo_key = 50200
def read_incremental_factors():
import csv
inc_file = open(incremental_factors_fil... | normal | {
"blob_id": "18dae039f6455f944cbaa97bcb9c36ed29ac9a21",
"index": 867,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef read_incremental_factors():\n import csv\n inc_file = open(incremental_factors_file, 'r')\n reader = csv.reader(inc_file)\n increment_map = dict()\n funding_code_map... | [
0,
2,
3,
4,
5
] |
#!/usr/bin/env python
"""
Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:
22=4, 23=8, 24=16, 25=32
32=9, 33=27, 34=81, 35=243
42=16, 43=64, 44=256, 45=1024
52=25, 53=125, 54=625, 55=3125
If they are then placed in numerical order, with any repeats removed, we get the following seq... | normal | {
"blob_id": "c93bd042340a6e1d0124d8f6176bdf17ab56e405",
"index": 2229,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef euler_29(max_a, max_b):\n gen = (a ** b for a, b in itertools.product(range(2, max_a + 1), range(\n 2, max_b + 1)))\n return len(set(gen))\n\n\n<mask token>\n",
"st... | [
0,
1,
2,
3,
4
] |
import configparser
# CONFIG
config = configparser.ConfigParser()
config.read('dwh.cfg')
# DROP TABLES
drop_schema="DROP SCHEMA IF EXISTS sparkifydb;"
set_search_path="SET SEARCH_PATH to sparkifydb;"
staging_events_table_drop = "DROP TABLE IF EXISTS staging_events;"
staging_songs_table_drop = "DROP TABLE IF EXISTS s... | normal | {
"blob_id": "652918e09a3506869c939be39b71a06467459f8a",
"index": 5992,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nconfig.read('dwh.cfg')\n<mask token>\n",
"step-3": "<mask token>\nconfig = configparser.ConfigParser()\nconfig.read('dwh.cfg')\ndrop_schema = 'DROP SCHEMA IF EXISTS sparkifydb;'\nset_se... | [
0,
1,
2,
3,
4
] |
import os
import numpy as np
import networkx as nx
from matplotlib import colors, cm
from matplotlib import pyplot as plt
from matplotlib.collections import LineCollection
from mpl_toolkits.mplot3d import Axes3D, art3d
from typing import Union, Sequence, List, Tuple, Optional
import wknml
from wkskel.types import Nod... | normal | {
"blob_id": "365d031a31f3596df6fb71e620c293382d6ead1f",
"index": 2635,
"step-1": "<mask token>\n\n\nclass Skeleton:\n <mask token>\n <mask token>\n\n def __init__(self, nml_path: str=None, parameters: Parameters=None,\n strict=True):\n \"\"\" The Skeleton constructor expects either a path ... | [
25,
43,
44,
46,
50
] |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
# pylint: disable=dangerous-default-value,wrong-import-position,unused-import, import-outside-toplevel
def create_app(settings_override={}):
app = Flask(__name__)
app.config.from_object('zezin.settings.Configuration')
app.c... | normal | {
"blob_id": "6affc182f5d3353d46f6e9a21344bc85bf894165",
"index": 948,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef create_app(settings_override={}):\n app = Flask(__name__)\n app.config.from_object('zezin.settings.Configuration')\n app.config.update(settings_override)\n db.init_app(... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 13 11:43:58 2020
@author: Dr. Tang
"""
import tensorflow as tf
# 需要你编程:将下面转换成tensorflow
#x = 10
#y = 2
#u=x/y
#z = u- 1
x=tf.placeholder(tf.int32)
y=tf.placeholder(tf.int32)
u=tf.divide(x,y)
z=tf.subtract(u,tf.constant(1.0,dtype=tf.float64))
# 需要你编程:从session中打印 z
with t... | normal | {
"blob_id": "ca91052072d7b2da5729cf55f7f4ba4b54608017",
"index": 3477,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith tf.Session() as sess:\n output = sess.run(z, feed_dict={x: 10, y: 2})\n print(output)\n",
"step-3": "<mask token>\nx = tf.placeholder(tf.int32)\ny = tf.placeholder(tf.int32)\... | [
0,
1,
2,
3,
4
] |
import tensorflow as tf
from model import CabbageModel
import numpy as np
from krx import KrxCrawler
from naver_stock import StockModel as sm
from scattertest import scattertest as st
class CabbageController:
def __init__(self):
#def __init__(self, avg_temp, min_temp, max_temp, rain_fall):
#self._a... | normal | {
"blob_id": "90a220775efcc8ff9e83f1a1f011f424ddc3476d",
"index": 4487,
"step-1": "<mask token>\n\n\nclass CabbageController:\n <mask token>\n\n def service(self):\n X = tf.placeholder(tf.float32, shape=[None, 4])\n W = tf.Variable(tf.random_normal([4, 1]), name='weight')\n b = tf.Varia... | [
2,
3,
4,
5,
6
] |
import os
timeslices = ['0_' + str(x) + '_' + str(y) for x in range(30,100) for y in range(0,6)]
#print timeslices
def make_Folders(names):
for n in names:
if not os.path.exists(n):
os.makedirs(n)
make_Folders(timeslices)
| normal | {
"blob_id": "426396c981fe56230e39b81e156e7c6877e39055",
"index": 2213,
"step-1": "<mask token>\n\n\ndef make_Folders(names):\n for n in names:\n if not os.path.exists(n):\n os.makedirs(n)\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef make_Folders(names):\n for n in names:\n ... | [
1,
2,
3,
4,
5
] |
import math
class Rank:
class Stats(object):
'''Holds info used to calculate amount of xp a player gets'''
post_likes = 0
post_dislikes = 0
comment_likes = 0
comment_dislikes = 0
usage = 0
class Interval(object):
'''A class representing an interval. It ... | normal | {
"blob_id": "cd0b55e163851344273ad020d434cc8662083d19",
"index": 6593,
"step-1": "<mask token>\n\n\nclass Rank:\n\n\n class Stats(object):\n \"\"\"Holds info used to calculate amount of xp a player gets\"\"\"\n post_likes = 0\n post_dislikes = 0\n comment_likes = 0\n comment... | [
5,
6,
7,
9,
11
] |
# Compute grid scores using the new dataset format
import matplotlib
import os
# allow code to work on machines without a display or in a screen session
display = os.environ.get('DISPLAY')
if display is None or 'localhost' in display:
matplotlib.use('agg')
import argparse
import numpy as np
import torch
import to... | normal | {
"blob_id": "f4bc5663ab2b2a6dbb41a2fc3d7ca67100b455a4",
"index": 838,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif display is None or 'localhost' in display:\n matplotlib.use('agg')\n<mask token>\nparser.add_argument('--n-samples', type=int, default=5000)\nparser.add_argument('--use-localization'... | [
0,
1,
2,
3,
4
] |
import os
from flask import Flask,request
from flask_restful import Resource,Api,reqparse
from flask_jwt import JWT,jwt_required
from resources.Users import UserRegister
from security import authenticate,identity
from resources.items import Item, ItemList
from resources.stores import Store, StoreList
app = Flask(__nam... | normal | {
"blob_id": "bf8f7b51b685f0e9131cb4d8a0bfc16ee5ad1263",
"index": 3281,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napi.add_resource(StoreList, '/stores')\napi.add_resource(Store, '/store/<string:name>')\napi.add_resource(ItemList, '/items')\napi.add_resource(Item, '/item/<string:name>')\napi.add_resou... | [
0,
1,
2,
3,
4
] |
# coding: utf-8
num = int(input())
str = input().split()
table = [int(i) for i in str]
list.sort(table)
print(table[num-1] - table[0]) | normal | {
"blob_id": "d853964d424e628d6331b27123ad045f8d945dc0",
"index": 4026,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nlist.sort(table)\nprint(table[num - 1] - table[0])\n",
"step-3": "num = int(input())\nstr = input().split()\ntable = [int(i) for i in str]\nlist.sort(table)\nprint(table[num - 1] - tabl... | [
0,
1,
2,
3
] |
#
#
#
# ------------------------------------------------------------------------------------------------------------------------------
#
# This program have been developed by Hamed Noori and with citiation of the related publicaitons
# can be used without permission.
# This program is for a novel architecture f... | normal | {
"blob_id": "4775bef3623497e9bbe79ca2d4e9e9da0422c450",
"index": 401,
"step-1": "<mask token>\n",
"step-2": "def start_simulation(sumo, scenario, network, begin, end, interval, output):\n logging.debug('Finding unused port')\n unused_port_lock = UnusedPortLock()\n unused_port_lock.__enter__()\n rem... | [
0,
1,
2
] |
import math
from os.path import join, relpath, dirname
from typing import List, Tuple
from common import read_input
convert_output = List[str]
class GridWalker:
def __init__(self):
self._current_pos = [0, 0]
self._heading = math.pi / 2
@property
def position(self):
return self.... | normal | {
"blob_id": "907f0564d574f197c25b05a79569a8b6f260a8cd",
"index": 7817,
"step-1": "<mask token>\n\n\nclass GridWalker:\n\n def __init__(self):\n self._current_pos = [0, 0]\n self._heading = math.pi / 2\n\n @property\n def position(self):\n return self._current_pos\n\n @property\n ... | [
8,
9,
11,
13,
14
] |
from django.shortcuts import render, redirect
from .models import Game, Player, CardsInHand, Feedback
from django.db.models import Q
from .forms import GameForm, JoinForm, FeedbackForm
from django.shortcuts import get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
from django.vie... | normal | {
"blob_id": "d650f578ea30772489625ee26f3e4bf04131964b",
"index": 6140,
"step-1": "<mask token>\n\n\ndef join_game(request):\n if request.method != 'POST':\n return HttpResponseRedirect('/game')\n form_data = json.loads(request.body.decode('utf-8'))\n form = JoinForm(form_data)\n if form.is_val... | [
3,
5,
6,
7,
8
] |
import imp
from django.shortcuts import render
# ***************** API ****************
from django.views.decorators.csrf import csrf_exempt
from rest_framework.parsers import JSONParser,FileUploadParser,MultiPartParser,FormParser
from .models import *
from django.http import Http404
from .serializers import *
from re... | normal | {
"blob_id": "aec5280869a780bbd93ef24b659d9959f7b81426",
"index": 3545,
"step-1": "<mask token>\n\n\nclass AddBlogs(generics.CreateAPIView):\n permission_classes = IsSuperUser,\n serializer_class = BlogSerializer\n queryset = BlogModel.objects.all()\n\n\nclass ViewBlog(generics.ListAPIView):\n permiss... | [
182,
186,
190,
206,
212
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.