code stringlengths 13 1.2M | order_type stringclasses 1
value | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
import os
import subprocess
import sys
import time
# print sys.argv
start = time.time()
subprocess.call(sys.argv[1:], shell=True)
stop = time.time()
print "\nTook %.1f seconds" % (stop - start)
| normal | {
"blob_id": "530ec3df27cc4c8f0798566f0c66cfbffe510786",
"index": 8611,
"step-1": "import os\r\nimport subprocess\r\nimport sys\r\nimport time\r\n\r\n# print sys.argv\r\nstart = time.time()\r\nsubprocess.call(sys.argv[1:], shell=True)\r\nstop = time.time()\r\nprint \"\\nTook %.1f seconds\" % (stop - start)\r\n",
... | [
0
] |
from queue import Queue
class Node():
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
self.right = right
def array_to_tree_dfs(array):
n = len(array)
if n>0:
root = Node(array[0])
def dfs(node, index):
# if index >= n:
... | normal | {
"blob_id": "a52762fb13c04ced07a41a752578c4173d1eac42",
"index": 8350,
"step-1": "<mask token>\n\n\nclass Node:\n\n def __init__(self, value, left=None, right=None):\n self.value = value\n self.left = left\n self.right = right\n\n\n<mask token>\n\n\ndef tree_to_array_bfs(root):\n q = Q... | [
4,
5,
6,
7,
8
] |
import sys
import time
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5 import *
class PromptMessage(QWidget):
def __init__(self, parent = None):
super(PromptMessage,self).__init__(parent)
self.m_show_tm = QTimer()
self.m_stay_tm = QTimer()
... | normal | {
"blob_id": "18a49d46b39fe6e00e2ad137984cceab82f1e94b",
"index": 2422,
"step-1": "<mask token>\n\n\nclass PromptMessage(QWidget):\n <mask token>\n <mask token>\n <mask token>\n\n def on_move(self):\n self.m_desktop_height = self.m_desktop_height - 10\n self.move(self.m_point.x(), self.m... | [
2,
4,
6,
7,
10
] |
def densenet(D,DT,F,model):
import scipy.io as sio
import time
import os
import math
import numpy as np
import matplotlib.pyplot as plt
Dataset = D
if DT == 'org':
data_type = 'original'
else:
data_type = 'augmented'
fs = model.fs
fm1 = model.fm1
batch_size = model.ba... | normal | {
"blob_id": "48270f70a9d69d15f808f22ec2d11d337b2c4845",
"index": 7414,
"step-1": "<mask token>\n\n\nclass MyModel:\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\n\n<mask token>\n",
"step-2": "<... | [
1,
2,
3,
5,
6
] |
#!/usr/bin/env python
# encoding: utf8
#from __future__ import unicode_literals
class RefObject(object):
def __init__(self,):
self.pose = []
self.name = []
self.time = None
self.id = None
def set_data(self,pose, name, time, Id):
self.pose = pose
self.... | normal | {
"blob_id": "7611a57705939ce456e34d5ae379d6ca748b13c3",
"index": 1884,
"step-1": "<mask token>\n\n\nclass Datafunction(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n ... | [
3,
11,
12,
16,
18
] |
#!/usr/bin/env python
#coding:utf-8
import jieba.analyse as analyse
from collections import Counter
import time
from os import path
import jieba
import importlib, sys
importlib.reload(sys)
import csv
import pandas as pd
from pandas import DataFrame
jieba.load_userdict("newdict.txt")
d = path.dirname(__fi... | normal | {
"blob_id": "6f3aa4e1309745265bb9d79df5f5a352e54493f9",
"index": 6313,
"step-1": "<mask token>\n\n\ndef removdup():\n train = pd.read_csv('C:\\\\Users\\\\Lenovo\\\\zqrbtest\\\\data.csv')\n train = train['titlec']\n train = set(train)\n data = pd.DataFrame(list(train), columns=['titlec'])\n data.to... | [
1,
2,
3,
4,
5
] |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 4 13:04:32 2018
@author: andrew
"""
import os
import glob
import initialize
import psf
from astropy.io import fits
import filters
import numpy as np
import sys
import MR
from tqdm import tqdm
def sextractor_MR(location, MR_method='swarp', use_con... | normal | {
"blob_id": "6f5eda426daf5db84dc205f36ec31e9076acb8ee",
"index": 8971,
"step-1": "<mask token>\n\n\ndef sextractor(location):\n \"\"\"\n runs SExtractor on all residual images\n \"\"\"\n x = 0\n sources = location + '/sources'\n residuals = location + '/residuals'\n check = os.path.exists(so... | [
8,
9,
10,
11,
12
] |
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import sublime
import sublime_plugin
"""
Copy and Paste selinium module and urllib3 module of Python in
"sublime-text-3/Lib/Python3.3" folder of sublime-text3
"""
def process(string):
# Get active file name
filename = subl... | normal | {
"blob_id": "9767014992981001bd2e8dece67525650c05a2a8",
"index": 4018,
"step-1": "<mask token>\n\n\nclass SolveItCommand(sublime_plugin.TextCommand):\n <mask token>\n\n def run(self, _):\n window = self.view.window()\n window.show_input_panel('Enter ContestID & ProblemID : ', '', self.\n ... | [
4,
6,
7,
8,
9
] |
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0,1"
import logging
import itertools
import torch
from torch import nn, optim
from torch.optim import lr_scheduler
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from tqdm import tqdm
from setproctitle import setproctitle
from ... | normal | {
"blob_id": "4d1900c1a0a8d7639e0ec16fb0128fd8efc2e8a1",
"index": 9913,
"step-1": "<mask token>\n\n\nclass MVAN(object):\n <mask token>\n <mask token>\n <mask token>\n\n def _setup_training(self):\n if self.hparams.save_dirpath == 'checkpoints/':\n self.save_dirpath = os.path.join(se... | [
4,
6,
7,
8,
10
] |
from django.test import TestCase
from student.forms import StudentForm
class ModelTest(TestCase):
def test_expense_form_valid_data(self):
form = StudentForm(data={
'student_id': 500,
'firstName': "Emre",
'lastName': "Tan",
'department': "Panama",
... | normal | {
"blob_id": "6dc7c7de972388f3984a1238a2d62e53c60c622e",
"index": 6252,
"step-1": "<mask token>\n\n\nclass ModelTest(TestCase):\n\n def test_expense_form_valid_data(self):\n form = StudentForm(data={'student_id': 500, 'firstName': 'Emre',\n 'lastName': 'Tan', 'department': 'Panama', 'mathScor... | [
3,
4,
5,
6,
7
] |
import pymysql
def testeSelect(db):
#创建查询游标
cur1 = db.cursor()
# 使用 execute() 方法执行 SQL 查询
cur1.execute("SELECT VERSION()")
# 使用 fetchone() 方法获取单条数据.
data = cur1.fetchone()
print(dir(data))
print ("cur1 : %s " % cur1)
print ("Database version : %s " % data)
def dropTable(db):
#创建查询游标
cur1 = db.curs... | normal | {
"blob_id": "75133dd924f8f3f028075c5d2109bb79ddc7fe87",
"index": 434,
"step-1": "<mask token>\n\n\ndef testeSelect(db):\n cur1 = db.cursor()\n cur1.execute('SELECT VERSION()')\n data = cur1.fetchone()\n print(dir(data))\n print('cur1 : %s ' % cur1)\n print('Database version : %s ' % data)\n\n\n... | [
4,
5,
6,
7,
9
] |
#!/usr/bin/env python
import unittest
from pyspark import SparkConf, SparkContext
from mmtfPyspark.io.mmtfReader import download_mmtf_files
from mmtfPyspark.datasets import secondaryStructureExtractor
from mmtfPyspark.filters import ContainsLProteinChain
from mmtfPyspark.mappers import StructureToPolymerChains
class... | normal | {
"blob_id": "480e6ae9eee70b2da58ca5624a43d8f5dcae1d33",
"index": 1207,
"step-1": "<mask token>\n\n\nclass SecondaryStructureExtractorTest(unittest.TestCase):\n <mask token>\n\n def test1(self):\n pdb = self.pdb.filter(ContainsLProteinChain()).flatMap(\n StructureToPolymerChains()).filter(... | [
3,
4,
5,
6,
7
] |
import math
import numpy as np
import basis.robot_math as rm
import grasping.annotation.utils as gu
from scipy.spatial import cKDTree
def plan_contact_pairs(objcm,
max_samples=100,
min_dist_between_sampled_contact_points=.005,
angle_between_contact_... | normal | {
"blob_id": "738e6d4d608aa977094420a432cbd8a05ea8a1b5",
"index": 4384,
"step-1": "<mask token>\n\n\ndef plan_grasps(hnd_s, objcm, angle_between_contact_normals=math.radians(\n 160), openning_direction='loc_x', rotation_interval=math.radians(22.5),\n max_samples=100, min_dist_between_sampled_contact_points=... | [
3,
4,
5,
6,
7
] |
ANCHO = 600
ALTO = 800
| normal | {
"blob_id": "71ca67948100fb7ad388934740cead1ebe4a2b52",
"index": 8549,
"step-1": "<mask token>\n",
"step-2": "ANCHO = 600\nALTO = 800\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
#coding: utf-8
from django.conf.urls import patterns, url
import views
urlpatterns = patterns('',
url(r'^douban/books$', views.BookList.as_view()),
)
| normal | {
"blob_id": "93418e554893db4eb888396e8d6f60a8364d9ee3",
"index": 8560,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = patterns('', url('^douban/books$', views.BookList.as_view()))\n",
"step-3": "from django.conf.urls import patterns, url\nimport views\nurlpatterns = patterns('', url('^dou... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
# coding: utf-8
import sys
sys.path.insert(0, "/code/huggingface/transformers-fair-wmt/src")
import logging
logging.disable(logging.INFO) # disable INFO and DEBUG logger everywhere
from transformers.tokenization_fsmt import FSMTTokenizer
from transformers.modeling_fsmt import FSMTForConditional... | normal | {
"blob_id": "7864138459caf469a0148420718b2282598141de",
"index": 6674,
"step-1": "<mask token>\n\n\ndef translate(src, tgt, text):\n mname = f'stas/wmt19-{src}-{tgt}'\n tokenizer = FSMTTokenizer.from_pretrained(mname)\n model = FSMTForConditionalGeneration.from_pretrained(mname)\n encoded = tokenizer... | [
1,
3,
4,
5,
6
] |
import re
IS_WITH_SINGLETON_REGEX = re.compile("(!=|==)\s*(True|False|None)")
def check_is_with_singleton(physical_line, line_number):
match_obj = IS_WITH_SINGLETON_REGEX.search(physical_line)
if match_obj is not None:
offset = match_obj.span()[0]
return (0, 12, (line_number, offset), "Use eq... | normal | {
"blob_id": "cf6d3a0fbf2a2daf8432622f780e138784ec505d",
"index": 8300,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef check_is_with_singleton(physical_line, line_number):\n match_obj = IS_WITH_SINGLETON_REGEX.search(physical_line)\n if match_obj is not None:\n offset = match_obj.span... | [
0,
1,
2,
3,
4
] |
ba0563.pngMap = [
'00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
'00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
'0000000000000000000000000000000000000... | normal | {
"blob_id": "dab1adcd185092fc425b5d87150f27e7b67bff6c",
"index": 151,
"step-1": "<mask token>\n",
"step-2": "ba0563.pngMap = [\n '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'\n ,\n '00000000000000000000000000000000000... | [
0,
1,
2
] |
import unittest
import numpy
import pandas as pd
import fixtures.examples_validate as examples
from cellxgene_schema.validate import Validator
from cellxgene_schema.write_labels import AnnDataLabelAppender
# Tests for schema compliance of an AnnData object
class TestValidAnndata(unittest.TestCase):
"""
T... | normal | {
"blob_id": "f4306f80330850415b74d729384f360489644e39",
"index": 354,
"step-1": "<mask token>\n\n\nclass TestObs(unittest.TestCase):\n <mask token>\n\n def setUp(self):\n self.validator = Validator()\n self.validator.adata = examples.adata.copy()\n <mask token>\n <mask token>\n <mask... | [
43,
45,
50,
57,
75
] |
__author__ = 'NikolaiEgorov'
def Lad(a1, a2, b1, b2):
if (a1 == b1) | (a2 == b2):
return 'YES'
else:
return 'NO'
a1 = int(input())
a2 = int(input())
b1 = int(input())
b2 = int(input())
print(Lad(a1, a2, b1, b2))
| normal | {
"blob_id": "0f55b598058b65c9dbf9cd4761d1ff6fc7091b19",
"index": 8791,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef Lad(a1, a2, b1, b2):\n if (a1 == b1) | (a2 == b2):\n return 'YES'\n else:\n return 'NO'\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef Lad(a1, a2, b1... | [
0,
1,
2,
3
] |
#! /usr/bin/python
#
# convert the swig -debug-lsymbols output text file format into
# a simple list of lua module names and classes
#
# Dan Wilcox <danomatika@gmail.com> 2017
#
import sys
import re
if len(sys.argv) < 2:
print("USAGE: lua_syntax.py MODULENAME INFILE")
exit(0)
module = sys.argv[1]
infile = sys... | normal | {
"blob_id": "c712875273f988a3aa6dab61f79e99a077823060",
"index": 807,
"step-1": "<mask token>\n\n\ndef matches(needle, haystack):\n for straw in haystack:\n if needle == straw:\n return True\n return False\n\n\ndef appendSection(section):\n if len(section) < 2:\n return\n if ... | [
2,
3,
4,
5,
6
] |
from CTO import CTO
#from UI import UIManager
from Cidades import Cidades
from Database import Database
from datetime import datetime
class Main:
def __init__(self, cidade_filename="", dados_filename=""):
#cidade_filename, dados_filename = UIManager().get_filenames()
print("cidade: " + cidade_fil... | normal | {
"blob_id": "c5f46be6d7214614892d227c76c75e77433a8fa9",
"index": 9517,
"step-1": "<mask token>\n\n\nclass Main:\n <mask token>\n\n def processaCSV(self, filename):\n with open(filename, 'r', encoding='ISO-8859-1') as input_file:\n self.concessao = {}\n self.expansao = {}\n ... | [
4,
5,
6,
7,
8
] |
#
#
#
##
from __future__ import print_function, unicode_literals
import inspect
import os
import pprint as pp
import time
from time import gmtime, strftime
import subprocess
from local import *
from slurm import *
class Job_status( object ):
""" Enumerate class for job statuses, this is done differently in pyt... | normal | {
"blob_id": "222a02f97df5ded6fea49e9eb201ed784a2a2423",
"index": 5037,
"step-1": "#\n# \n# \n##\n\nfrom __future__ import print_function, unicode_literals\nimport inspect\nimport os\nimport pprint as pp\nimport time\nfrom time import gmtime, strftime\nimport subprocess\n\nfrom local import *\nfrom slurm import *... | [
0
] |
from flask import Flask
from flask_bcrypt import Bcrypt
from flask_jwt_extended import JWTManager
from flask_migrate import Migrate
from flask_restful import Api
from flask_apispec.extension import FlaskApiSpec
from server.admin import add_admin
from server.config import Config
from server.db import db
from server.cli ... | normal | {
"blob_id": "f1d813ccaf49c8941bf594e22d8683c0ab422a22",
"index": 7632,
"step-1": "<mask token>\n\n\n@jwt.user_lookup_loader\ndef user_loader_callback(_jwt_header, jwt_data):\n return user_service.first(id=jwt_data['sub'])\n\n\n@jwt.user_identity_loader\ndef user_identity_lookup(email):\n return user_servic... | [
4,
5,
6,
7
] |
__version__ = '0.2.11'
# This list defines all the modules that will be loaded if a user invokes
# from climLab import *
# totally out of date!
#__all__ = ["constants", "thermo", "orbital_table",
# "long_orbital_table", "insolation", "ebm",
# "column", "convadj"]
#from climlab import radiatio... | normal | {
"blob_id": "8251a9c798b3cdc2f374d0a0406ccfaa11b7c5e3",
"index": 5699,
"step-1": "<mask token>\n",
"step-2": "__version__ = '0.2.11'\n<mask token>\n",
"step-3": "__version__ = '0.2.11'\nfrom climlab.utils import constants\nfrom climlab.utils import thermo, legendre\nfrom climlab.model.column import GreyRadia... | [
0,
1,
2,
3
] |
print("Leer 10 números enteros, almacenarlos en un vector y determinar en qué posiciones se encuentran los números con mas de 3 dígitos")
count=1
lista=[]
while count<11:
numero=int(input('Introduzca su %d numero:' %(count)))
lista.append(numero)
count=count+1
listanueva=[]
s= ','
f... | normal | {
"blob_id": "9dd5db441044c808274493f16a912d1b65a6c28b",
"index": 5911,
"step-1": "<mask token>\n",
"step-2": "print(\n 'Leer 10 números enteros, almacenarlos en un vector y determinar en qué posiciones se encuentran los números con mas de 3 dígitos'\n )\n<mask token>\nwhile count < 11:\n numero = int(... | [
0,
1,
2,
3
] |
from battleship.board import Board
from battleship.game import Game
import string
# Board
row_num = list(string.ascii_lowercase[:10]) # A-J
col_num = 10
board = Board(row_num, col_num)
board.display_board()
# Game
guesses = 25
quit = 'q'
game = Game(guesses, quit)
game.take_shot("\nChoose a spot to fire at in enemy... | normal | {
"blob_id": "dd06847c3eb9af6e84f247f8f0dd03961d83688e",
"index": 9453,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nboard.display_board()\n<mask token>\ngame.take_shot(\"\"\"\nChoose a spot to fire at in enemy seas: \"\"\", board)\n",
"step-3": "<mask token>\nrow_num = list(string.ascii_lowercase[:10... | [
0,
1,
2,
3,
4
] |
import os
import unittest
import json
from flask_sqlalchemy import SQLAlchemy
from flaskr import create_app
from models import setup_db, Question
DB_HOST = os.getenv('DB_HOST', '127.0.0.1:5432')
DB_USER = os.getenv('DB_USER', 'postgres')
DB_PASSWORD = os.getenv('DB_PASSWORD', 'postgres')
DB_NAME = os.getenv('DB_NAME'... | normal | {
"blob_id": "364ac79e0f885c67f2fff57dfe3ddde63f0c269e",
"index": 995,
"step-1": "<mask token>\n\n\nclass TriviaTestCase(unittest.TestCase):\n <mask token>\n\n def setUp(self):\n \"\"\"Define test variables and initialize app.\"\"\"\n self.app = create_app()\n self.client = self.app.tes... | [
15,
16,
18,
19,
23
] |
##
## Originally created by https://www.reddit.com/user/AlekseyP
## Seen at: https://www.reddit.com/r/technology/comments/43fi39/i_set_up_my_raspberry_pi_to_automatically_tweet
##
#!/usr/bin/python
import os
import sys
import csv
import datetime
import time
import twitter
#Configuration
# Twitter
ACCESS_TOKEN=""
ACCE... | normal | {
"blob_id": "6492f1eda79fd3116058f29647dc5f09e903f637",
"index": 7274,
"step-1": "##\n## Originally created by https://www.reddit.com/user/AlekseyP\n## Seen at: https://www.reddit.com/r/technology/comments/43fi39/i_set_up_my_raspberry_pi_to_automatically_tweet\n##\n\n#!/usr/bin/python\nimport os\nimport sys\nimp... | [
0
] |
#Answer to The Ship Teams - https://py.checkio.org/en/mission/the-ship-teams/
def two_teams(sailors):
result = [] #To store the result
temp = [[],[]] #To store the intermediatary values
for i in sailors.items(): #To get the values of dictionary as Tuple
if i[1] > 40 or i[1] < 20: #To get the people... | normal | {
"blob_id": "de634c95fddf4591cb15cd0eb20e798043075798",
"index": 2464,
"step-1": "<mask token>\n",
"step-2": "def two_teams(sailors):\n result = []\n temp = [[], []]\n for i in sailors.items():\n if i[1] > 40 or i[1] < 20:\n temp[0].append(i[0])\n else:\n temp[1].ap... | [
0,
1,
2,
3
] |
# Generated by Django 2.2 on 2020-10-26 15:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('viajes', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='viajes',
options={'verbose_name': 'Movilización... | normal | {
"blob_id": "760a5a168575a0ea12b93cb58c1e81e313704e35",
"index": 6276,
"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 = [('viajes', '0... | [
0,
1,
2,
3,
4
] |
import pandas as pd
import time
from datetime import datetime
from sklearn import metrics
from sklearn import cross_validation
from sklearn.multiclass import OneVsRestClassifier
from sklearn.tree import DecisionTreeClassifier, export_graphviz
from sklearn.naive_bayes import MultinomialNB,BernoulliNB,GaussianNB
... | normal | {
"blob_id": "78615f6b020e2547e5d9a08d8b4c414184106bb3",
"index": 6465,
"step-1": "import pandas as pd\r\nimport time\r\nfrom datetime import datetime\r\nfrom sklearn import metrics\r\nfrom sklearn import cross_validation\r\nfrom sklearn.multiclass import OneVsRestClassifier\r\nfrom sklearn.tree import DecisionTr... | [
0
] |
#! /usr/bin/env python
def get_case(str_arg):
first_life_and_work(str_arg)
print('small_hand')
def first_life_and_work(str_arg):
print(str_arg)
if __name__ == '__main__':
get_case('thing')
| normal | {
"blob_id": "7a2ac3a3a2bbd7349e8cc62b4d357394d9600cc8",
"index": 6326,
"step-1": "<mask token>\n",
"step-2": "def get_case(str_arg):\n first_life_and_work(str_arg)\n print('small_hand')\n\n\n<mask token>\n",
"step-3": "def get_case(str_arg):\n first_life_and_work(str_arg)\n print('small_hand')\n\... | [
0,
1,
2,
3,
4
] |
class Solution:
def levelOrder(self, root):
if root is None:
return []
currentList = [root]
nextList = []
solution = []
while currentList:
thisLevel = [node.val for node in currentList]
solution.append(thisLevel)
for node in cu... | normal | {
"blob_id": "d9f176262dcaf055414fbc43b476117250249b63",
"index": 4696,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def levelOrder(self, root):\n if root is None:\n return []\n currentList = [root]\n nextList = ... | [
0,
1,
2
] |
# -*- coding: iso-8859-15 -*-
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@8:........C@@@
# @@@@@@@@@@@@@@88@@@@@@@@@@@@@@@@@@@@@@88@@@@@@@@@@8... | normal | {
"blob_id": "f105ecb8229020554930bb4f0e00ecf88e83f5ae",
"index": 4288,
"step-1": "# -*- coding: iso-8859-15 -*-\r\n# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\n# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@... | [
0
] |
# -*- coding:utf-8 -*-
import json
from datetime import datetime
from math import ceil, floor
from os.path import abspath, join, pardir
from struct import pack
from .global_settings import (
DEBUG, DEBUG_POLY_STOP, INPUT_JSON_FILE_NAME, INVALID_ZONE_ID, NR_BYTES_H, NR_BYTES_I, NR_SHORTCUTS_PER_LAT,
NR_SHORTCUT... | normal | {
"blob_id": "52e43f795c864340734de2640e3c1a70b05e8ea0",
"index": 7248,
"step-1": "<mask token>\n\n\ndef x_shortcut(lng):\n return floor((lng + 180) * NR_SHORTCUTS_PER_LNG)\n\n\ndef y_shortcut(lat):\n return floor((90 - lat) * NR_SHORTCUTS_PER_LAT)\n\n\ndef big_zone(xmax, xmin, ymax, ymin):\n return (xma... | [
11,
13,
15,
17,
22
] |
import datetime
import operator
import geopy
from django.db import models
from django.db.models import Q
from django.db.models.query import QuerySet
from django.db.models import permalink
from django.contrib.auth.models import User
geocoder = geopy.geocoders.Google()
class City(models.Model):
name = models.C... | normal | {
"blob_id": "89ba805e47a9727573e1e25371a70fb887ee170d",
"index": 9141,
"step-1": "<mask token>\n\n\nclass Area(models.Model):\n <mask token>\n <mask token>\n\n\n class Meta:\n unique_together = 'name', 'city'\n ordering = 'name',\n <mask token>\n\n\nclass ApartmentQuerySet(QuerySet):\n\... | [
15,
19,
20,
21,
23
] |
import pickle
if __name__ == '__main__':
with open('id_generator.bin', 'rb') as f:
print(pickle.load(f))
| normal | {
"blob_id": "080110e404cf5edfe53622a5942b53f9188ddd76",
"index": 1854,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n with open('id_generator.bin', 'rb') as f:\n print(pickle.load(f))\n",
"step-3": "import pickle\nif __name__ == '__main__':\n with open('id_gene... | [
0,
1,
2
] |
#!/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
import sys
def sumInput(text):
f = open(text, 'r')
sum = 0
count = 1
for line in f:
count += 1
line = line.strip()
if (line[0] == '+'):
sum += int(line[1:])
else:
sum -= int(line[1:... | normal | {
"blob_id": "c0d71d970b2632dbf182a5ee8bad27d3e41578f6",
"index": 208,
"step-1": "<mask token>\n\n\ndef sumInput(text):\n f = open(text, 'r')\n sum = 0\n count = 1\n for line in f:\n count += 1\n line = line.strip()\n if line[0] == '+':\n sum += int(line[1:])\n e... | [
1,
2,
3,
4,
5
] |
import html
import logging
import re
import pyarabic.araby as araby
ACCEPTED_MODELS = [
"bert-base-arabertv01",
"bert-base-arabert",
"bert-base-arabertv02",
"bert-base-arabertv2",
"bert-large-arabertv02",
"bert-large-arabertv2",
"araelectra-base",
"araelectra-base-discriminator",
"... | normal | {
"blob_id": "6c3f60f05adbebe521ba08d7a7e9fc10b1cc914f",
"index": 2907,
"step-1": "<mask token>\n\n\nclass ArbertmoPreprocessor:\n <mask token>\n\n def __init__(self, model_name, keep_emojis=False, remove_html_markup=\n True, replace_urls_emails_mentions=True, strip_tashkeel=True,\n strip_tatw... | [
12,
13,
14,
15,
16
] |
from handler.auth import provider_required
from handler.provider import ProviderBaseHandler
from forms.provider import ProviderAddressForm, ProviderVanityURLForm
import logging
from data import db
from util import saved_message
class ProviderEditAddressHandler(ProviderBaseHandler):
@provider_required
def get(s... | normal | {
"blob_id": "454f885e2254295ce6508e70c0348f5cbe855520",
"index": 5071,
"step-1": "<mask token>\n\n\nclass ProviderEditAddressHandler(ProviderBaseHandler):\n <mask token>\n <mask token>\n\n\nclass ProviderChangeURLHandler(ProviderBaseHandler):\n\n @provider_required\n def post(self, vanity_url=None):\... | [
3,
4,
5,
6,
7
] |
import numpy as np
import json
import random
from encapsulate_state import StateEncapsulator
from scalar_to_action import ActionMapper
import pickle
from basis_functions import identity_basis, interactive_basis, actions_only_basis, actions_cubic_basis, BASIS_MAP
import matplotlib.pyplot as plt
STATE_FILENAME = "stat... | normal | {
"blob_id": "e9a6baf10efc5b6bd07af1fe352b0b17ecc172bd",
"index": 1855,
"step-1": "<mask token>\n\n\nclass LinearBot(object):\n\n def __init__(self, player, player_name, weights_file, basis):\n self.reader = StateEncapsulator(player, player_name)\n with open(STATE_FILENAME, 'r') as f:\n ... | [
3,
5,
6,
7,
8
] |
from app import db
from datetime import datetime
from sqlalchemy.orm import validates
class Posts(db.Model):
id = db.Column(db.BigInteger, primary_key=True, autoincrement=True)
title = db.Column(db.String(200))
content = db.Column(db.Text)
category = db.Column(db.String(100))
created_date = db.Column(db.Date... | normal | {
"blob_id": "29298ee7ddb4e524a23000abf86854d72f49954c",
"index": 1850,
"step-1": "<mask token>\n\n\nclass Posts(db.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __repr__(self):\n return '<Posts {}>'.format(s... | [
5,
6,
7,
8,
9
] |
import time
import math
from random import randrange
import multilineMAX7219 as LEDMatrix
from multilineMAX7219_fonts import CP437_FONT, SINCLAIRS_FONT, LCD_FONT, TINY_FONT
from multilineMAX7219 import DIR_L, DIR_R, DIR_U, DIR_D
from multilineMAX7219 import DIR_LU, DIR_RU, DIR_LD, DIR_RD
from multilineMAX7219 import D... | normal | {
"blob_id": "ba486b64b1da3dc1775bee0980d5236516e130d4",
"index": 4033,
"step-1": "import time\nimport math\nfrom random import randrange\n\nimport multilineMAX7219 as LEDMatrix\nfrom multilineMAX7219_fonts import CP437_FONT, SINCLAIRS_FONT, LCD_FONT, TINY_FONT\nfrom multilineMAX7219 import DIR_L, DIR_R, DIR_U, D... | [
0
] |
class SlackEvent:
@property
def client_msg_id(self):
pass
@property
def type(self):
pass
@property
def subtype(self):
pass
@property
def text(self):
pass
@property
def time_stamp(self):
pass
@property
def ... | normal | {
"blob_id": "4a4745f202275e45fd78c12431e355fd59ac964a",
"index": 6722,
"step-1": "class SlackEvent:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @property\n def time_stamp(self):\n pass\n\n @property\n def channel(self):\n pass\n <mask token>\n\n @pr... | [
8,
10,
15,
17,
20
] |
from Cars import Bmw
from Cars import Audi
from Cars import Nissan
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print('In Sample.py........')
# Import classes from your brand new package
# Create an object of Bmw class & call its method
ModBMW = Bmw.Bmw()
... | normal | {
"blob_id": "e15524d7ae87cbf0b10c54ee0bdc613ba589c1a9",
"index": 3812,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n print('In Sample.py........')\n ModBMW = Bmw.Bmw()\n ModBMW.outModels()\n ModAudi = Audi.Audi()\n ModAudi.outModels()\n ModNissan = Nissan.N... | [
0,
1,
2,
3
] |
from sklearn.metrics import roc_auc_score, matthews_corrcoef, f1_score, confusion_matrix
import numpy as np
from scipy.stats import rankdata
def iou_score(target, prediction):
intersection = np.logical_and(target, prediction)
union = np.logical_or(target, prediction)
iou_score = np.sum(intersection) / (np... | normal | {
"blob_id": "c599a75788e3548c52ebb3b29e7a2398ff1b28a2",
"index": 1808,
"step-1": "<mask token>\n\n\ndef iou_score(target, prediction):\n intersection = np.logical_and(target, prediction)\n union = np.logical_or(target, prediction)\n iou_score = np.sum(intersection) / (np.sum(union) + 1e-06)\n return ... | [
3,
5,
6,
7,
8
] |
"""URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/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')
Class-based ... | normal | {
"blob_id": "312a95c9514722157653365104d8cd0ada760ce8",
"index": 8084,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [url('^$', TemplateView.as_view(template_name=\n 'visitor/landing-index.html'), name='landing_index'), url('^about$',\n TemplateView.as_view(template_name='visitor/lan... | [
0,
1,
2,
3
] |
from sqlalchemy import Column, MetaData, Table, BigInteger, String, DateTime, Integer
from migrate import *
meta = MetaData()
table = Table(
'accesses', meta,
Column('id', BigInteger, primary_key=True, nullable=False),
Column('uuid', String(255), nullable=False),
Column('created_at', DateTime),
)
def... | normal | {
"blob_id": "6154979cd2853dd2bd26d1ae5df7365efa0141c2",
"index": 441,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef upgrade(migrate_engine):\n meta.bind = migrate_engine\n table.create()\n\n\ndef downgrade(migrate_engine):\n meta.bind = migrate_engine\n table.drop()\n",
"step-3": "... | [
0,
2,
3,
4,
5
] |
#print pathToConnectionsList(['A','C','B','D','E'])
#['EA','CB','AC','BD', 'DE']
#print independantPathPieces()
#print pathToConnectionsList(pathGenerator())
#print geneFormatToPathSegmentsMini(['CD', 'AB', 'BE', 'EC']) #DA
#print independantPathPieces(['EAC', 'CBD', 'ACB', 'BDE', 'DEA'])
#print greedyCrossover(['EC', ... | normal | {
"blob_id": "b4a96d5df56acd545e9919e202c462ee710a0339",
"index": 5339,
"step-1": "#print pathToConnectionsList(['A','C','B','D','E'])\n#['EA','CB','AC','BD', 'DE']\n#print independantPathPieces()\n#print pathToConnectionsList(pathGenerator())\n#print geneFormatToPathSegmentsMini(['CD', 'AB', 'BE', 'EC']) #DA\n#p... | [
0
] |
#!/usr/bin/python3
'''
generator.py
This program inputs a strings, and outputs the corresponding hex
Creator: Ethan Knight
Email: ethantknight@gmail.com
Published: 20181116
'''
import sys
import time
import binascii
def main():
print("\n", sys.version_info)
try:
while True:
... | normal | {
"blob_id": "a52cbe6dbf4b4fc82d09e5f34e6e135933f3af38",
"index": 1418,
"step-1": "<mask token>\n\n\ndef main():\n print('\\n', sys.version_info)\n try:\n while True:\n print('\\n\\nPress Ctrl+C to exit.')\n usr = test()\n out = binascii.hexlify(bytes(usr, encoding='u... | [
1,
2,
3,
4,
5
] |
import tkinter as tk
from functools import partial
from numpy import random
from base import NinePalaceGame
class SingleMode(NinePalaceGame):
player1 = player = 'O'
player2 = computer = 'X'
def __init__(self):
self.create_choose_one_window()
super().__init__()
self.main_game_wind... | normal | {
"blob_id": "841743d4e9d683827962d83a77a87c6432842add",
"index": 8013,
"step-1": "<mask token>\n\n\nclass SingleMode(NinePalaceGame):\n <mask token>\n <mask token>\n <mask token>\n\n def player_play(self, i, j):\n if not self.game_is_over and not self.box[i][j]:\n self.box[i][j] = 1... | [
6,
7,
9,
11,
13
] |
from random import random
import numpy as np
class TemperatureSensor:
sensor_type = "temperature"
unit="celsius"
instance_id="283h62gsj"
#initialisation
def __init__(self, average_temperature, temperature_variation, min_temperature, max_temperature):
self.a... | normal | {
"blob_id": "bc890f0f40a7e9c916628d491e473b5ecfa9bb9b",
"index": 740,
"step-1": "<mask token>\n\n\nclass TemperatureSensor:\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, average_temperature, temperature_variation,\n min_temperature, max_temperature):\n self.average... | [
5,
7,
8,
9,
10
] |
import os
import base64
from urllib.parse import urlencode
import json
from flask import Blueprint, request, redirect, jsonify, make_response
import requests
spotify = Blueprint('spotify', __name__)
# Client Keys
SPOTIFY_CLIENT_ID = os.environ.get('SPOTIFY_CLIENT_ID')
SPOTIFY_CLIENT_SECRET = os.environ.get('SPOTIFY... | normal | {
"blob_id": "f080191fec4e56adc4013da74c840817e88caf56",
"index": 869,
"step-1": "<mask token>\n\n\n@spotify.route('/callback')\ndef callback():\n auth_code = request.args['code']\n code_payload = {'grant_type': 'authorization_code', 'code': str(\n auth_code), 'redirect_uri': REDIRECT_URI}\n base6... | [
2,
3,
4,
5,
6
] |
import pymongo
myclient = pymongo.MongoClient('mongodb://localhost:27017/') #We create the database object
mydb = myclient['mydatabase'] #Create a database
mycol = mydb['customers'] #Create a collection into my mydatabase
mydict = [{"name": "Eric", "address": "Highway 37"}, {"name": "Albert", "address": "Highway 37... | normal | {
"blob_id": "6c6026a7ff0345c37e62de7c0aac0ee3bcde2c82",
"index": 5879,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(mydoc)\n",
"step-3": "<mask token>\nmyclient = pymongo.MongoClient('mongodb://localhost:27017/')\nmydb = myclient['mydatabase']\nmycol = mydb['customers']\nmydict = [{'name': 'Eri... | [
0,
1,
2,
3,
4
] |
from src.config import Config
mock = {
"entities": {
"foo": [ "bar", "foobar" ]
},
"synonimous": {
"fizz": [ "fizzfuzz", "fuzz"]
},
"templates": [
{
"text": "{synonimous.fizz} and {entities.foo}",
"intention": "fizzfoo"
}
]
}
def test_sho... | normal | {
"blob_id": "987f8ce668f2002b731822fa5f3de143a80aaafe",
"index": 9807,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_should_config_start_correctly():\n c = Config(mock)\n assert c._entities == mock['entities']\n assert c._synonimous == mock['synonimous']\n assert c.templates == ... | [
0,
1,
2,
3,
4
] |
'''
XFA/XDP DOM in Javascript
This file is part of the phoneyPDF Framework
This module provides methods for transforming both PDF objects and XML (xfa/xdp) into a single structure of linked objects
in javascript. The idea is that any *DOM interation will play out in javascript land, where the DOMs are created and
main... | normal | {
"blob_id": "59b2d0ff3296c9d9a76b8b69a784d5a0c46128be",
"index": 8080,
"step-1": "'''\nXFA/XDP DOM in Javascript\nThis file is part of the phoneyPDF Framework\n\nThis module provides methods for transforming both PDF objects and XML (xfa/xdp) into a single structure of linked objects\nin javascript. The idea is ... | [
0
] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : 河北雪域网络科技有限公司 A.Star
# @contact: astar@snowland.ltd
# @site:
# @file: img_to_sketch.py
# @time: 2018/8/6 1:15
# @Software: PyCharm
from skimage.color import rgb2grey
import numpy as np
def sketch(img, threshold=15):
"""
素描画生成
param img: Image实例
... | normal | {
"blob_id": "065354d2a8fd8a75e16bf85f624b12641377029a",
"index": 8568,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef sketch(img, threshold=15):\n \"\"\"\n 素描画生成\n param img: Image实例\n param threshold: 介于0到100\n :return:\n \"\"\"\n if threshold < 0:\n threshold = 0\n ... | [
0,
1,
2,
3
] |
# Generated by Django 3.1.7 on 2021-03-25 00:33
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('restaurante', '0003_auto_20210324_1932'),
]
operations = [
migrations.AlterModelOptions(
name='comprobantemodel',
options={'... | normal | {
"blob_id": "f76a3fac75e7e2b156f4bff5094f11009b65b599",
"index": 8822,
"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 = [('restaurante... | [
0,
1,
2,
3,
4
] |
# Turn off bytecode generation
import sys
from asgiref.sync import sync_to_async
from django.core.wsgi import get_wsgi_application
sys.dont_write_bytecode = True
# Django specific settings
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
import django
django.setup()
from db import models
de... | normal | {
"blob_id": "4afb556ceca89eb90ba800db4f383afad1cd42a5",
"index": 3765,
"step-1": "<mask token>\n\n\ndef print_all_models():\n return models.Sample.objects.all()\n\n\n@sync_to_async\ndef _create_record(name):\n return models.Sample.objects.create(name=name)\n\n\n<mask token>\n",
"step-2": "<mask token>\no... | [
2,
3,
4,
5,
6
] |
"""
@file
@brief One class which visits a syntax tree.
"""
import inspect
import ast
from textwrap import dedent
import numpy
from scipy.spatial.distance import squareform, pdist
from .node_visitor_translator import CodeNodeVisitor
def py_make_float_array(cst, op_version=None):
"""
Creates an array with a sin... | normal | {
"blob_id": "fdf6c28e65b50c52550a95c2d991b1eb3ec53a2f",
"index": 3540,
"step-1": "<mask token>\n\n\ndef py_make_float_array(cst, op_version=None):\n \"\"\"\n Creates an array with a single element\n from a constant.\n\n @param cst constant\n @param op_version unused\n @return... | [
5,
6,
7,
9,
10
] |
s1 = {10, 20, 30, 60, 70, 80, 90}
s2 = set()
print(s2)
s1.add(100)
print(s1.pop())
print(10 in s1)
print(10 not in s1)
| normal | {
"blob_id": "3747e45dcba548060f25bd6d6f0e0e96091ca3df",
"index": 2358,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(s2)\ns1.add(100)\nprint(s1.pop())\nprint(10 in s1)\nprint(10 not in s1)\n",
"step-3": "s1 = {10, 20, 30, 60, 70, 80, 90}\ns2 = set()\nprint(s2)\ns1.add(100)\nprint(s1.pop())\nprin... | [
0,
1,
2
] |
import json
from jsonargparse import ArgumentParser, ActionConfigFile
import yaml
from typing import List, Dict
import glob
import os
import pathlib
import pdb
import subprocess
import copy
from io import StringIO
from collections import defaultdict
import torch
from spacy.tokenizer import Tokenizer
from spacy.... | normal | {
"blob_id": "04aacf9461ade2e229076ffdf85aca913037edad",
"index": 642,
"step-1": "<mask token>\n\n\nclass NavigationTransformerTrainer(TransformerTrainer):\n\n def __init__(self, dataset_reader: NavigationDatasetReader, encoder:\n TransformerEncoder, optimizer: torch.optim.Optimizer, scheduler:\n ... | [
10,
11,
12,
13,
15
] |
import tkinter as tk
import classejogo
class Tabuleiro():
def __init__(self):
self.jogo = classejogo.Jogo()
self.window = tk.Tk()
self.window.title("Jogo da Velha")
self.window.geometry("300x360+100+100")
self.window.rowconfigure(0, minsize=30, weight=1)
self.window... | normal | {
"blob_id": "9cff227eeeaffda777668aa3b90e3839426da811",
"index": 6683,
"step-1": "<mask token>\n\n\nclass Tabuleiro:\n\n def __init__(self):\n self.jogo = classejogo.Jogo()\n self.window = tk.Tk()\n self.window.title('Jogo da Velha')\n self.window.geometry('300x360+100+100')\n ... | [
9,
12,
15,
16,
18
] |
# Copyright (c) 2018, Raul Astudillo
import numpy as np
from copy import deepcopy
class BasicModel(object):
"""
Class for handling a very simple model that only requires saving the evaluated points (along with their corresponding outputs) so far.
"""
analytical_gradient_prediction = True
def __in... | normal | {
"blob_id": "88071df9367804b1c6e2b1c80da178ab7658e7a4",
"index": 3861,
"step-1": "<mask token>\n\n\nclass BasicModel(object):\n <mask token>\n <mask token>\n <mask token>\n\n def updateModel(self, X, Y):\n \"\"\"\n Updates the model with new observations.\n \"\"\"\n self.X... | [
7,
8,
9,
10,
12
] |
import os
from .common import cached_outputs, data_files, test_outputs
import nappy.nc_interface.na_to_nc
import nappy.nc_interface.nc_to_na
def test_convert_nc_2010_to_na_2310():
ffi_in, ffi_out = (2010, 2310)
infile = os.path.join(cached_outputs, f"{ffi_in}.nc")
outfile = os.path.join(test_outputs, f... | normal | {
"blob_id": "0de657ee173b606ad61d614a6168c00fcd571a70",
"index": 74,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_convert_nc_2010_to_na_2310():\n ffi_in, ffi_out = 2010, 2310\n infile = os.path.join(cached_outputs, f'{ffi_in}.nc')\n outfile = os.path.join(test_outputs, f'{ffi_out}... | [
0,
1,
2,
3
] |
def DFS(x):
# 전위순회
if x > 7:
return
else:
DFS((x * 2))
print(x)
DFS((x*2)+1)
if __name__ == "__main__":
DFS(1) | normal | {
"blob_id": "1cc8695aa694359314b6d478fe6abed29fdc6c91",
"index": 3309,
"step-1": "<mask token>\n",
"step-2": "def DFS(x):\n if x > 7:\n return\n else:\n DFS(x * 2)\n print(x)\n DFS(x * 2 + 1)\n\n\n<mask token>\n",
"step-3": "def DFS(x):\n if x > 7:\n return\n el... | [
0,
1,
2,
3
] |
from temp_conversion_script import convert_c_to_f
from temp_conversion_script import fever_detection
def test_convert_c_to_f():
answer = convert_c_to_f(20.0)
expected = 68.0
assert answer == expected
def test2():
answer = convert_c_to_f(-40.0)
expected = -40.0
assert answer == expected
def... | normal | {
"blob_id": "d75187ed435c3d3aeeb31be4a0a4ed1754f8d160",
"index": 4436,
"step-1": "<mask token>\n\n\ndef test2():\n answer = convert_c_to_f(-40.0)\n expected = -40.0\n assert answer == expected\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_convert_c_to_f():\n answer = convert_c_to_f(20... | [
1,
2,
3,
4
] |
#str
owog="Delger"
# len()- urt
# lower()- jijigruuleh
# upper()- tomruulah
# capitalize()- ehnii useg tomruulah
# replace()- temdegt solih
print(owog.find("e"))
print(owog.count("e"))
print(owog[2:10])
a=21
b=21
if a>b:
print("a too ih")
elif a==b:
print("tentsuu")
else:
print("b to... | normal | {
"blob_id": "c4ca4b5c77c3c912b44a4853be30298ec845c4fd",
"index": 243,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(owog.find('e'))\nprint(owog.count('e'))\nprint(owog[2:10])\n<mask token>\nif a > b:\n print('a too ih')\nelif a == b:\n print('tentsuu')\nelse:\n print('b too ih')\n<mask to... | [
0,
1,
2,
3
] |
'''
Various tools for cleaning out nulls and imputing
'''
| normal | {
"blob_id": "bd310ab0bc193410b8f93ad5516b0731d2eba54f",
"index": 6268,
"step-1": "<mask token>\n",
"step-2": "'''\nVarious tools for cleaning out nulls and imputing \n'''\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
from numpy import pi,sqrt,cross,dot,zeros,linalg
from defs import *
##from numba import njit, prange
##
##@njit(parallel=True)
def engparallelb2(MU,NU,b1,b2,x1,x2,y1,y2,eta,a):
#For use in enginteract below
#HL p.154 Eq.(6-45)
b1x=b1[0]
b1y=b1[1]
b1z=b1[2]
b2x=b2[0]
b2y=b2[1]
b2z=b2[2]
... | normal | {
"blob_id": "2611d7dd364f6a027da29c005754ac2465faa8be",
"index": 8667,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef engparallelb2(MU, NU, b1, b2, x1, x2, y1, y2, eta, a):\n b1x = b1[0]\n b1y = b1[1]\n b1z = b1[2]\n b2x = b2[0]\n b2y = b2[1]\n b2z = b2[2]\n Rab = Rp(x2, y2, ... | [
0,
2,
3,
4,
5
] |
#-*- coding: utf-8 -*-
"""
Django settings for HyperKitty + Postorius
Pay attention to settings ALLOWED_HOSTS and DATABASES!
"""
from os.path import abspath, dirname, join as joinpath
from ConfigParser import SafeConfigParser
def read_cfg(path, section=None, option=None):
config = SafeConfigParser()
config.r... | normal | {
"blob_id": "0dd17d8872b251fbc59a322bf3c695bd8079aba4",
"index": 3338,
"step-1": "<mask token>\n\n\ndef read_cfg(path, section=None, option=None):\n config = SafeConfigParser()\n config.read(path)\n\n def get(section, option):\n return config.get(section, option) if config.has_option(section, opt... | [
1,
2,
3,
4,
5
] |
import random
s = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_+=-/.,;'[]{}:<>?"
i = 0
fin = ""
while i == 0:
num = int(input("What length do you want? "))
password = "".join(random.sample(s, num))
print(password)
j = 0
while(j ==0):
want = input("Do you this ... | normal | {
"blob_id": "3089dba0956151bd43e443b679ec0b24da644d08",
"index": 3701,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile i == 0:\n num = int(input('What length do you want? '))\n password = ''.join(random.sample(s, num))\n print(password)\n j = 0\n while j == 0:\n want = input('D... | [
0,
1,
2,
3,
4
] |
# -*- mode: python; coding: utf-8 -*-
# Copyright 2019-2021 the AAS WorldWide Telescope project
# Licensed under the MIT License.
from __future__ import absolute_import, division, print_function
import numpy as np
import numpy.testing as nt
import os.path
import pytest
import sys
from xml.etree import ElementTree as ... | normal | {
"blob_id": "618b6c74133e181ce5cbaf4e969d9fc3aa44ce98",
"index": 1261,
"step-1": "<mask token>\n\n\nclass TestMultiTan(object):\n <mask token>\n if sys.platform == 'darwin':\n WTML = WTML.replace('Dec=\"0.7438249862258411\"',\n 'Dec=\"0.743824986225841\"')\n <mask token>\n\n def tea... | [
5,
6,
9,
10,
13
] |
from conans import ConanFile, CMake, tools
import os
class Demo(ConanFile):
name = "Demo"
version = "0.1"
license = "<Put the package license here>"
url = "<Package recipe repository url here, for issues about the package>"
description = "<Description of Testlib here>"
settings = "os", "compile... | normal | {
"blob_id": "c9bc331f4805a956146619c59d183fc3bcbe47cb",
"index": 9728,
"step-1": "<mask token>\n\n\nclass Demo(ConanFile):\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 <mask... | [
3,
4,
5,
6,
8
] |
import json
import time
from pytest_influxdb.data_manager import DataManager
class SuiteResultDTO:
__run = 'UNDEFINED'
__project = 'UNDEFINED'
__version = 'UNDEFINED'
__passed = None
__failed = None
__skipped = None
__error = None
__duration_sec = 0
__disabled = 0
__retries = ... | normal | {
"blob_id": "84c3427a994bd6c57d9fa8449e4fc7a3de801170",
"index": 9271,
"step-1": "<mask token>\n\n\nclass SuiteResultDTO:\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 <mask ... | [
13,
14,
15,
16,
21
] |
n = 0.3
c = 2
def func(x):
return x**c
def der_func(x):
return c * x**(c - 1)
def na_value(x):
return x - n*der_func(x)
def main():
x = 100
v_min = func(x)
for i in range(10):
cur_v = func(x)
x = na_value(x)
if cur_v < v_min:
v_min = cur_v
print... | normal | {
"blob_id": "fa7246a4e7595393ca9aaec777fa85d782bb816e",
"index": 4815,
"step-1": "<mask token>\n\n\ndef func(x):\n return x ** c\n\n\ndef der_func(x):\n return c * x ** (c - 1)\n\n\n<mask token>\n\n\ndef main():\n x = 100\n v_min = func(x)\n for i in range(10):\n cur_v = func(x)\n x ... | [
3,
4,
5,
6,
7
] |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index_view, name='accounts.index'),
url(r'^login/$', views.login_view, name='accounts.login'),
url(r'^logout/$', views.logout_view, name='accounts.logout'),
url(r'^registro/$', views.registro_usuario_view, name='accou... | normal | {
"blob_id": "b4d09b6d8ad5f0584f74adc0fd8116265bb6649b",
"index": 4641,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [url('^$', views.index_view, name='accounts.index'), url(\n '^login/$', views.login_view, name='accounts.login'), url('^logout/$',\n views.logout_view, name='accounts.... | [
0,
1,
2,
3
] |
from xai.brain.wordbase.adjectives._corporal import _CORPORAL
#calss header
class _CORPORALS(_CORPORAL, ):
def __init__(self,):
_CORPORAL.__init__(self)
self.name = "CORPORALS"
self.specie = 'adjectives'
self.basic = "corporal"
self.jsondata = {}
| normal | {
"blob_id": "d2787f17a46cf0db9aeea82f1b97ee8d630fd28a",
"index": 8932,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass _CORPORALS(_CORPORAL):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass _CORPORALS(_CORPORAL):\n\n def __init__(self):\n _CORPORAL.__init__(self)\n se... | [
0,
1,
2,
3,
4
] |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import numpy as np
import pandas as pd
import lightgbm as lgb
from typing import List, Text, Tuple, Union
from ...model.base import ModelFT
from ...data.dataset import DatasetH
from ...data.dataset.handler import DataHandlerLP
from ...model.inter... | normal | {
"blob_id": "d37187f067ddff94015e639a1759dddced817945",
"index": 6205,
"step-1": "<mask token>\n\n\nclass LGBModel(ModelFT, LightGBMFInt):\n <mask token>\n\n def __init__(self, loss='mse', early_stopping_rounds=50,\n num_boost_round=1000, **kwargs):\n if loss not in {'mse', 'binary'}:\n ... | [
5,
6,
7,
8,
9
] |
import os
from datetime import datetime, timedelta
from django.shortcuts import render
from django.utils.decorators import method_decorator
from rest_framework.viewsets import GenericViewSet, mixins
from common.jwt_util import generate_jwt
from .serializers import ApiUser, ApiUserSerializer, UserSerializer
f... | normal | {
"blob_id": "0457ac2ecd0a951b0088c887539ab696797d68bc",
"index": 4557,
"step-1": "<mask token>\n\n\nclass UserLoginView(GenericAPIView):\n\n def _generate_tokens(self, user_id, with_refresh_token=True):\n \"\"\"\n 生成token 和refresh_token\n :param user_id: 用户id\n :return: token, refr... | [
7,
8,
10,
11,
13
] |
from docutils import nodes
from docutils.parsers.rst import directives, Directive
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.lexers.special import TextLexer
from pygments.formatters.html import HtmlFormatter
class Pygments(Directive):
""" Source code syntax hightli... | normal | {
"blob_id": "d3dcef6a1a6bcfc1161c4de46081703b8fe7016d",
"index": 9606,
"step-1": "<mask token>\n\n\nclass Pygments(Directive):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def run(self):\n self.assert_has_content()\n try:\n ... | [
2,
4,
5,
6,
7
] |
IEX_CLOUD_API_TOKEN = 'Tpk_5d9dc536610243cda2c8ef4787d729b6'
| normal | {
"blob_id": "86849d0e63cdb93a16497ca56ff9c64c15a60fa7",
"index": 4891,
"step-1": "<mask token>\n",
"step-2": "IEX_CLOUD_API_TOKEN = 'Tpk_5d9dc536610243cda2c8ef4787d729b6'\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
#!/usr/bin/env python
# coding: utf-8
# In[2]:
print(" sum of n numbers with help of for loop. ")
n = 10
sum = 0
for num in range(0, n+1, 1):
sum = sum+num
print("Output: SUM of first ", n, "numbers is: ", sum )
# In[3]:
print(" sum of n numbers with help of while loop. ")
num = int(input("Enter the value of... | normal | {
"blob_id": "d3c36ad36c50cd97f2101bc8df99d1961b0ad7ea",
"index": 4078,
"step-1": "<mask token>\n",
"step-2": "print(' sum of n numbers with help of for loop. ')\n<mask token>\nfor num in range(0, n + 1, 1):\n sum = sum + num\nprint('Output: SUM of first ', n, 'numbers is: ', sum)\nprint(' sum of n numbers w... | [
0,
1,
2,
3
] |
# Generated by Django 2.2.1 on 2019-05-23 14:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('presentes', '0015_caso_lugar_del_hecho'),
]
operations = [
migrations.AddField(
model_name='organizacion',
name='des... | normal | {
"blob_id": "5cd767564e8a261561e141abeebb5221cb3ef2c2",
"index": 6919,
"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 = [('presentes',... | [
0,
1,
2,
3,
4
] |
class MinHeap:
__heap = [-0]
def __init__(self):
pass
def insert(self, value):
self.__heap.append(value)
self.__sift_up()
def pop(self):
if len(self.__heap) == 1:
return None
minimum = self.__heap[1]
if len(self.__heap) == 2:
sel... | normal | {
"blob_id": "d412e5768b23b8bbb8f72e2ae204650bbc1f0550",
"index": 8979,
"step-1": "class MinHeap:\n <mask token>\n\n def __init__(self):\n pass\n\n def insert(self, value):\n self.__heap.append(value)\n self.__sift_up()\n\n def pop(self):\n if len(self.__heap) == 1:\n ... | [
4,
5,
6,
7
] |
# BotSetup.py
from websockets.exceptions import InvalidStatusCode
from dokbot.DokBotCog import DokBotCog
from events.EventCog import EventCog
from dotenv import load_dotenv
from datetime import datetime
from .DokBot import DokBot
import utils.Logger as Log
import logging
import os
import sys
import traceback
import di... | normal | {
"blob_id": "a7123fa221555b15162dbab0d93a86965190b805",
"index": 4141,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef run() ->None:\n os.environ['TZ'] = 'Europe/Brussels'\n if sys.platform != 'win32':\n from time import tzset\n tzset()\n print(datetime.now())\n load_dote... | [
0,
1,
2,
3
] |
from text_to_word_cloud import *
from collections import Counter
from preprocess import *
if __name__ == '__main__':
data = load_data('train.json')
words = text_to_words(get_all_text(data), as_set=False)
cnt = Counter(words)
save_il_to_word_cloud_file("cloudofw.txt",cnt,len(words),call_R=True... | normal | {
"blob_id": "b3bba1119bfaf0c1e684e8835259ec6fa8c42cf7",
"index": 1838,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n data = load_data('train.json')\n words = text_to_words(get_all_text(data), as_set=False)\n cnt = Counter(words)\n save_il_to_word_cloud_file('clou... | [
0,
1,
2,
3
] |
import pandas as pd
import random
import string
import names
def generatetest(n=100, filename="test_data"):
ids = []
names_list = []
for _ in range(n):
ids.append(''.join(random.choices(
string.ascii_letters + string.digits, k=9)))
names_list.append(names.get_full_name())
... | normal | {
"blob_id": "aa913fd40a710cfd7288fd59c4039c4b6a5745cc",
"index": 4569,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef generatetest(n=100, filename='test_data'):\n ids = []\n names_list = []\n for _ in range(n):\n ids.append(''.join(random.choices(string.ascii_letters + string.\n ... | [
0,
1,
2,
3,
4
] |
l, w, h = map(int, input().split())
TSA = 2 * (l * w + w * h + h * l)
V = l * w * h
print(TSA, V)
| normal | {
"blob_id": "d3382ead1d98ba2fb15fe3ea277430f1bb07131c",
"index": 2544,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(TSA, V)\n",
"step-3": "l, w, h = map(int, input().split())\nTSA = 2 * (l * w + w * h + h * l)\nV = l * w * h\nprint(TSA, V)\n",
"step-4": null,
"step-5": null,
"step-ids": [... | [
0,
1,
2
] |
import os
import shutil
import json
from django.shortcuts import render, HttpResponse
from django.utils.encoding import escape_uri_path
from django.db import transaction
from web_pan.settings import files_folder
from disk import models
# Create your views here.
def logined(func):
def wrapper(request, *args, **k... | normal | {
"blob_id": "eeb87891d1a02484a61537745ec6f13387017929",
"index": 705,
"step-1": "<mask token>\n\n\ndef logined(func):\n\n def wrapper(request, *args, **kwargs):\n session = request.session.get('user')\n if not session:\n return render(request, 'login.html')\n else:\n ... | [
9,
10,
12,
13,
14
] |
import matplotlib
matplotlib.use('Agg')
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1 import make_axes_locatable
def plot_overscan(overscan, img, TITLE, OUT_DIR):
""" plot overscan in 9x2 plots with 16 channels """
fig = plt.figure(figs... | normal | {
"blob_id": "736861f18936c7a87ecf3deb134f589b9d7eed92",
"index": 3934,
"step-1": "\nimport matplotlib\nmatplotlib.use('Agg')\nimport matplotlib.gridspec as gridspec\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom mpl_toolkits.axes_grid1 import make_axes_locatable\n\n\ndef plot_overscan(overscan, img, ... | [
0
] |
# Author: Lijing Wang (lijing52@stanford.edu), 2021
import numpy as np
import pandas as pd
import gstools as gs
import matplotlib.pyplot as plt
from matplotlib import patches
import seaborn as sns
plt.rcParams.update({'font.size': 15})
import os
path = os.path.dirname(os.getcwd())
subpath = '/examples/case2_nonline... | normal | {
"blob_id": "09fb99a15c2727da2ef96028aca5513337449f62",
"index": 3772,
"step-1": "<mask token>\n\n\ndef print_theta(theta, name='theta'):\n theta_pd = pd.DataFrame(theta.reshape(1, -1), index=[name], columns=[\n 'mean', 'variance', 'max_range', 'min_range', 'anisotropy',\n 'head_west'])\n pri... | [
11,
13,
17,
19,
20
] |
import turtle
from turtle import color
import random
screen = turtle.Screen()
screen.setup(width=500, height=400)
colours = ["red", "pink", "blue", "purple", "black", "green"]
y_pos = [100, 60, 20, -20, -60, -100]
user_bet = screen.textinput(title="Make your bet",
prompt="Which turtle will ... | normal | {
"blob_id": "f3aaa6ae7a9a57946bdb035a4d52e84541c1a292",
"index": 5934,
"step-1": "<mask token>\n\n\nclass Racer(turtle.Turtle):\n\n def __init__(self, color, x, y):\n super().__init__(shape='turtle')\n self.color(color)\n self.penup()\n self.goto(x=x, y=y)\n\n def race(self):\n ... | [
3,
4,
5,
6,
7
] |
Easy = [["4 + 12 = ?", 16],
["45 -34 = ?", 11],
["27 + 12 -18 = ?", 21],
['25 - 5 * 4 = ?', 5],
["18 + 45 / 5 - 3 * 2 = ?", 21],
["5! = ?", 120],
["3! + 2! = ?", 8],
["7 + 5! / 4! - 6 / 3 = ?", 10],
["(25 + 5) / 6 * 4 = ?", 20],
["4(3+c)... | normal | {
"blob_id": "66edf0d2f7e25e166563bdb1063a1ed45ecda0e6",
"index": 541,
"step-1": "<mask token>\n",
"step-2": "Easy = [['4 + 12 = ?', 16], ['45 -34 = ?', 11], ['27 + 12 -18 = ?', 21], [\n '25 - 5 * 4 = ?', 5], ['18 + 45 / 5 - 3 * 2 = ?', 21], ['5! = ?', 120],\n ['3! + 2! = ?', 8], ['7 + 5! / 4! - 6 / 3 = ?... | [
0,
1,
2
] |
import pytest
import sys
sys.path.insert(0, '..')
from task_05 import task5
def test_mults():
assert task5.mults(3, 5, 10) == 23
assert task5.mults(5, 3, 10) == 23
assert task5.mults(3, 2, 10) == 32
assert task5.mults(7, 8, 50) == 364
| normal | {
"blob_id": "1c8622167240243da05a241e3630f79cdf36d7a8",
"index": 4776,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_mults():\n assert task5.mults(3, 5, 10) == 23\n assert task5.mults(5, 3, 10) == 23\n assert task5.mults(3, 2, 10) == 32\n assert task5.mults(7, 8, 50) == 364\n",
... | [
0,
1,
2,
3
] |
from __future__ import annotations
from typing import TYPE_CHECKING
from datetime import datetime
from sqlalchemy import Column, ForeignKey, String, DateTime, Float, Integer
from sqlalchemy.orm import relationship
from app.db.base_class import Base
if TYPE_CHECKING:
from .account import Account # noqa: F401
... | normal | {
"blob_id": "60d8276a5715899823b12ffdf132925c6f2693bd",
"index": 8675,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Voucher(Base):\n __tablename__ = 't_juju_voucher'\n code = Column(String(100), index=True, unique=True)\n serial_no = Column(String(120), index=True, unique=True)\n ... | [
0,
2,
3,
4,
5
] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import base64
import json
import os
import re
import subprocess
import time
import traceback
import zipfile
from datetime import datetime
import requests
from flask import request, current_app
from library.oss import oss_upload_monkey_package_picture
from public_config import... | normal | {
"blob_id": "bf45349a9fdfcef7392c477e089c5e3916cb4c8e",
"index": 8502,
"step-1": "<mask token>\n\n\nclass ToolBusiness(object):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass ToolBusiness(object):\n\n @classmethod\n def get_tool_ip(cls):\n ip = request.args.get('ip')\n ... | [
1,
2,
3,
4,
5
] |
#!/usr/bin/python
import sys
import itertools as it
pop_list = []
#with open("/Users/dashazhernakova/Documents/Doby/GenomeRussia/ancientDNA/GR+Lazaridis.ind") as f:
with open(sys.argv[1]) as f:
[pop_list.append(l.strip().split("\t")[2]) for l in f if l.strip().split("\t")[2] not in pop_list]
triplets = it.combinati... | normal | {
"blob_id": "de7cd231aceb2700acb3ecafe36d1ba1f5c1643b",
"index": 6191,
"step-1": "#!/usr/bin/python\nimport sys\nimport itertools as it\n\npop_list = []\n\n#with open(\"/Users/dashazhernakova/Documents/Doby/GenomeRussia/ancientDNA/GR+Lazaridis.ind\") as f:\nwith open(sys.argv[1]) as f:\n\t[pop_list.append(l.stri... | [
0
] |
from datareader import *
import matplotlib.pyplot as plt
from plotting import *
from misc import *
import leastSquares as lsModel
import masim as mAvgSim
import numpy as np
import pandas as pd
import statistics as stat
from datetime import datetime as dt
from time import mktime
def main():
# scrape_data(pd.read_csv('... | normal | {
"blob_id": "8d5e652fda3fb172e6faab4153bca8f78c114cd1",
"index": 7973,
"step-1": "<mask token>\n\n\ndef main():\n daily_signal_checker('china_stocks.csv', location='chineseStocks/')\n\n\n<mask token>\n\n\ndef daily_signal_checker(stocks, location):\n ndays = 6\n stock_list = pd.read_csv(stocks)\n for... | [
3,
4,
6,
7,
8
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.