code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.... | flexible | {
"blob_id": "d13589979ba7b6facd8339111323270c9920a9bf",
"index": 8127,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T... | [
0,
1,
2,
3,
4
] |
"""
Data pre-processing
"""
import os
import corenlp
import numpy as np
import ujson as json
from tqdm import tqdm
from collections import Counter
from bilm import dump_token_embeddings
import sys
sys.path.append('../..')
from LIB.utils import save
def process(json_file, outpur_dir, exclude_titles=None, include_titl... | normal | {
"blob_id": "0c37806f0a7c0976711edd685fd64d2616147cb6",
"index": 4623,
"step-1": "<mask token>\n\n\ndef process(json_file, outpur_dir, exclude_titles=None, include_titles=None):\n \"\"\"\n :param json_file: original data in json format\n :param outpur_dir: the output directory of pre-processed data\n ... | [
5,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
def statstr(vec):
m = np.mean(vec)
s = np.std(vec)
return '{0:.4f} +/- {1:.4f}'.format(m, s)
def plotinst(inst, shift=0.12):
for xyc, quad in zip(inst.detector.center, inst.detector.quadrant):
if quad < 4:
plot(xyc[0], xyc[1], 'ro')
else:
... | flexible | {
"blob_id": "bcb028bd25732e17ed1478e122ac3b2d1abf2520",
"index": 7931,
"step-1": "<mask token>\n\n\ndef statstr(vec):\n m = np.mean(vec)\n s = np.std(vec)\n return '{0:.4f} +/- {1:.4f}'.format(m, s)\n\n\ndef plotinst(inst, shift=0.12):\n for xyc, quad in zip(inst.detector.center, inst.detector.quadra... | [
4,
5,
6,
7,
8
] |
# class Mob:
# def __init__(self, name, health=10):
# self.name = name
# self.health = health
# def get_hit(self, power):
# self.health -= power
# print(
# f"I, {self.name} was hit for {power} points. {self.health} pts remaining")
# hero = Mob("Sir Barks-alot", 30)... | normal | {
"blob_id": "b1573f80395d31017ceacbb998e421daf20ab75f",
"index": 6961,
"step-1": "class Vehicle:\n\n def __init__(self, category, top_speed, acceleration, position=0, speed\n =0, wheels=4):\n self.category = category\n self.speed = speed\n self.top_speed = top_speed\n self.p... | [
3,
4,
5,
6,
7
] |
import urllib.request
import http.cookiejar
import requests
import re
import sys
import time
import json
from bs4 import BeautifulSoup
head = {
"Host": "www.pkuhelper.com",
"Accept": "*/*",
"Accept-Language": "zh-Hans-CN;q=1",
"Connection": "keep-alive",
"Accept-Encoding": "gzip, deflate",
"User-Agent": "PKU Hel... | normal | {
"blob_id": "a74653f01b62445c74c8121739bd9185ce21c85a",
"index": 2764,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef crawler(pid):\n print('hole reply start!')\n cids = []\n texts = []\n names = []\n try:\n para = {'action': 'getcomment', 'pid': pid, 'token':\n '... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
"""
python3
description :Fingerprint image enhancement by using gabor
"""
import os
import cv2
import math
import scipy
import numpy as np
from scipy import signal
def normalise(img):
normed = (img - np.mean(img)) / (np.std(img))
return normed
def ridge_segment(im, blksze, thresh):
... | normal | {
"blob_id": "9447d0d0481df3d0ee4273256d02977bc8044e4e",
"index": 8603,
"step-1": "<mask token>\n\n\ndef ridge_orient(im, gradientsigma, blocksigma, orientsmoothsigma):\n sze = np.fix(6 * gradientsigma)\n if np.remainder(sze, 2) == 0:\n sze = sze + 1\n gauss = cv2.getGaussianKernel(np.int(sze), gr... | [
5,
7,
8,
9,
10
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class LocationNotSet(Exception):
pass
<|reserved_special_token_1|>
def clear_firefox_driver_session(firefox_driver):
firefox_driver.delete_all_cookies()
firefox_driver.execute_script('window.localStorage.clear();'... | flexible | {
"blob_id": "6d0b9523668bd0b302fdbc196d3d7ff25be10b23",
"index": 5045,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass LocationNotSet(Exception):\n pass\n",
"step-3": "def clear_firefox_driver_session(firefox_driver):\n firefox_driver.delete_all_cookies()\n firefox_driver.execute_scri... | [
0,
1,
2,
3
] |
import re
def molecule_to_list(molecule: str) -> list:
"""Splits up a molucule into elements and amount in order of appearance
Args:
molecule (str): The molecule to split up
Raises:
ValueError: If molecule starts with a lower case letter
ValueError: If molecule contains a non-alp... | normal | {
"blob_id": "a14a1803a0bae755803c471b12035398de262dbc",
"index": 9138,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef molecule_to_list(molecule: str) ->list:\n \"\"\"Splits up a molucule into elements and amount in order of appearance\n\n Args:\n molecule (str): The molecule to split... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if media >= 6:
print('Parabéns!! Você foi aprovado.')
else:
print('Que pena!! Você foi reprovado.')
<|reserved_special_token_1|>
<|reserved_special_token_0|>
nota1 = float(input('Digite sua primeira nota: '))
nota2 = fl... | flexible | {
"blob_id": "033d1b39dd3ebaa81c8c6c52386909acf076ef47",
"index": 2011,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif media >= 6:\n print('Parabéns!! Você foi aprovado.')\nelse:\n print('Que pena!! Você foi reprovado.')\n",
"step-3": "<mask token>\nnota1 = float(input('Digite sua primeira nota... | [
0,
1,
2,
3
] |
#!/usr/bin/env python3
import re
import datetime
import math
import pathlib
import os
import io
import argparse
import subprocess
import xml.sax.saxutils
from typing import (Optional, List, Iterable)
import sys
_DEFAULT_TRACK_TYPE = 'Dashcam track'
class Arguments(object):
def __init__(self):
parser = ... | normal | {
"blob_id": "fbb1254c7166fa2aa9cd8a0b9c6525dbe5b652a0",
"index": 2625,
"step-1": "<mask token>\n\n\nclass GpsDataBlockIndex(object):\n\n def __init__(self, position: int, size: int):\n if position <= 0:\n raise ValueError(f\"An invalid position: `{position}'.\")\n if size <= 0:\n ... | [
47,
55,
64,
81,
82
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def main(args):
if not args.quiet:
print('Uploading.....')
resp = postimg.Imgur(args.img_path).upload()
if not resp['success']:
if not args.quiet:
print(json.dumps(resp, sort_keys=True, in... | flexible | {
"blob_id": "705755340eef72470fc982ebd0004456469d23e4",
"index": 4859,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main(args):\n if not args.quiet:\n print('Uploading.....')\n resp = postimg.Imgur(args.img_path).upload()\n if not resp['success']:\n if not args.quiet:\n ... | [
0,
1,
2,
3,
4
] |
import urllib3
import json
def download(url):
print('Downloading ', url)
userAgent = 'Mozilla/5.0 (Linux; U; Android 10; zh-cn; MI 9 Build/QKQ1.190825.002) AppleWebKit/533.1 (KHTML, like Gecko) Version/5.0 Mobile Safari/533.1'
userAgent = 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/5... | normal | {
"blob_id": "9d302ff2de8280bd8786794cdd533107d2a458bc",
"index": 5611,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef download(url):\n print('Downloading ', url)\n userAgent = (\n 'Mozilla/5.0 (Linux; U; Android 10; zh-cn; MI 9 Build/QKQ1.190825.002) AppleWebKit/533.1 (KHTML, like Ge... | [
0,
1,
2,
3,
4
] |
umur = raw_input("Berapakah umurmu?")
tinggi = raw_input("Berapakah tinggimu?")
berat = raw_input("Berapa beratmu?")
print "Jadi, umurmu adalah %r, tinggumu %r, dan beratmu %r." % (umur, tinggi, berat)
| normal | {
"blob_id": "7d2335c956776fc5890a727d22540eabf2ea4b94",
"index": 5862,
"step-1": "umur = raw_input(\"Berapakah umurmu?\")\ntinggi = raw_input(\"Berapakah tinggimu?\")\nberat = raw_input(\"Berapa beratmu?\")\n\nprint \"Jadi, umurmu adalah %r, tinggumu %r, dan beratmu %r.\" % (umur, tinggi, berat)\n",
"step-2": ... | [
0
] |
<|reserved_special_token_0|>
def held_karp_bottomup(distance_matrix):
"""
In the bottom up implementation, we compute all possible solutions for the
values `i` and `visited` as in the implementations above, and then
simply look up the value for f(0,0).
With this approach, we use the dp table, the... | flexible | {
"blob_id": "3e8fa71c4e23348c6f00fe97729b5717bb6245a1",
"index": 8070,
"step-1": "<mask token>\n\n\ndef held_karp_bottomup(distance_matrix):\n \"\"\"\n In the bottom up implementation, we compute all possible solutions for the\n values `i` and `visited` as in the implementations above, and then\n sim... | [
5,
8,
9,
10,
12
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
setup(name='dragonfab', version='1.3.0', description='Fabric support',
author='Joel Pitt', author_email='joel@joelpitt.com', url=
'https://github.com/ferrouswheel/dragonfab', install_requires=['fabric',
'pip>=1.4', 'wh... | flexible | {
"blob_id": "61135a10adefd6ba8ffd63e997fa91ce9c78de06",
"index": 6444,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsetup(name='dragonfab', version='1.3.0', description='Fabric support',\n author='Joel Pitt', author_email='joel@joelpitt.com', url=\n 'https://github.com/ferrouswheel/dragonfab', in... | [
0,
1,
2,
3
] |
import Individual
import Grupal
import matplotlib.pyplot as plt
import pandas as pd
plt.show()
| normal | {
"blob_id": "bb1caf4d04c8a42279afa0ac586ced991e0dff84",
"index": 4574,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nplt.show()\n",
"step-3": "import Individual\nimport Grupal\nimport matplotlib.pyplot as plt\nimport pandas as pd\nplt.show()\n",
"step-4": null,
"step-5": null,
"step-ids": [
... | [
0,
1,
2
] |
class Process:
def __init__(self, id, at, bt):
self.id = id
self.at = at
self.bt = bt
self.wt = 0
self.ct = 0
self.st = 0
self.tat = 0
def fill(self, st):
print('Current process:', self.id)
self.st = st
self.ct = self.st + self.bt
... | normal | {
"blob_id": "be58a2e0dcdbcb3a3df0da87be29ce7ebcee7fe9",
"index": 6185,
"step-1": "class Process:\n\n def __init__(self, id, at, bt):\n self.id = id\n self.at = at\n self.bt = bt\n self.wt = 0\n self.ct = 0\n self.st = 0\n self.tat = 0\n <mask token>\n <ma... | [
2,
4,
5,
6,
7
] |
# Jython/Walk_comprehension.py
import os
restFiles = [os.path.join(d[0], f) for d in os.walk(".")
for f in d[2] if f.endswith(".java") and
"PythonInterpreter" in open(os.path.join(d[0], f)).read()]
for r in restFiles:
print(r)
| normal | {
"blob_id": "61085eecc8fd0b70bc11e5a85c3958ba3b905eaf",
"index": 3118,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor r in restFiles:\n print(r)\n",
"step-3": "<mask token>\nrestFiles = [os.path.join(d[0], f) for d in os.walk('.') for f in d[2] if f\n .endswith('.java') and 'PythonInterpreter... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class TblBlogForm(forms.ModelForm):
class Meta:
model = TblBlog
fields = ['blog_title', 'blog_description', 'blog_keyword',
'blog_content', 'blog_pics', 'blog_publish', 'blog_datetime',
'blog_summary', 'blog_like', 'blog_added_by']
<|reser... | flexible | {
"blob_id": "9e02b1a90d61de6d794dd350b50417a2f7260df6",
"index": 5947,
"step-1": "<mask token>\n\n\nclass TblBlogForm(forms.ModelForm):\n\n\n class Meta:\n model = TblBlog\n fields = ['blog_title', 'blog_description', 'blog_keyword',\n 'blog_content', 'blog_pics', 'blog_publish', 'blo... | [
19,
20,
22,
26,
32
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
Ylist = ['yes', 'Yes', 'Y', 'y']
Nlist = ['no', 'No', 'N', 'n']
America = ['America', 'america', 'amer', 'rica']
TRW = ['1775', 'The Revolutionary war', 'the Revolutionary war',
'the revolutionary war', 'The Revolutionary War', 'trw', 'Trw', 'TRW']
TCW = ... | flexible | {
"blob_id": "6e07dcc3f3b8c7fbf8ce8d481b9612e7496967bd",
"index": 8316,
"step-1": "<mask token>\n",
"step-2": "Ylist = ['yes', 'Yes', 'Y', 'y']\nNlist = ['no', 'No', 'N', 'n']\nAmerica = ['America', 'america', 'amer', 'rica']\nTRW = ['1775', 'The Revolutionary war', 'the Revolutionary war',\n 'the revolution... | [
0,
1,
2
] |
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
class Solution:
"""
@param l1: the first list
@param l2: the second list
@return: the sum list of l1 and l2
"""
def addLists(self, l1, l2):
res = ListNode(0)
p = re... | normal | {
"blob_id": "8909ee9c54a234222a41249e1f3005fd86e21cf0",
"index": 1782,
"step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n def addLists(self, l1, l2):\n res = ListNode(0)\n p = res\n carry = 0\n while l1 or l2 or carry:\n num = 0\n if l1:\n ... | [
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def differences(a, b):
""""""
c = a[a != b]
d = b[a != b]
nums = nonzero(a != b)[0]
return concatenate((mat(nums), c, d)).T
<|reserved_special_token_1|>
from numpy import *
def differences(a, b):
"""... | flexible | {
"blob_id": "67a76f1f1dad4b7e73359f04ca8f599c8d32dc92",
"index": 2900,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef differences(a, b):\n \"\"\"\"\"\"\n c = a[a != b]\n d = b[a != b]\n nums = nonzero(a != b)[0]\n return concatenate((mat(nums), c, d)).T\n",
"step-3": "from numpy ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
dependencies = [(... | flexible | {
"blob_id": "99c27d13349eba391866cfed25cc052b40910ea5",
"index": 2837,
"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 = [('sepomex', '... | [
0,
1,
2,
3,
4
] |
'''
Created on Sep 4, 2014
@author: Jay <smile665@gmail.com>
'''
import socket
def ip_validation(ip):
'''
check if the ip address is in a valid format.
'''
try:
socket.inet_aton(ip)
return True
except socket.error:
return False
def connection_validation(ip, port):
'... | normal | {
"blob_id": "2bc9c0711831d9ed9009d0f9600153709bbcd6da",
"index": 9178,
"step-1": "'''\nCreated on Sep 4, 2014\n\n@author: Jay <smile665@gmail.com>\n'''\n\nimport socket\n\n\ndef ip_validation(ip):\n '''\n check if the ip address is in a valid format.\n '''\n try:\n socket.inet_aton(ip)\n ... | [
0
] |
<|reserved_special_token_0|>
def generate_kriging():
nsample = 20
nvar = 2
nobj = 2
lb = -1 * np.ones(shape=[nvar])
ub = 1 * np.ones(shape=[nvar])
sampoption = 'halton'
samplenorm, sample = sampling(sampoption, nvar, nsample, result='real',
upbound=ub, lobound=lb)
X = sample
... | flexible | {
"blob_id": "ba289bcdc0aa7c2ad70dba7fac541900d0b55387",
"index": 7585,
"step-1": "<mask token>\n\n\ndef generate_kriging():\n nsample = 20\n nvar = 2\n nobj = 2\n lb = -1 * np.ones(shape=[nvar])\n ub = 1 * np.ones(shape=[nvar])\n sampoption = 'halton'\n samplenorm, sample = sampling(sampopti... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
def save_cp_csvdata(reward, err, filename):
with open(filename, mode='w') as data_file:
data_writer = csv.writer(data_file, delimiter=',', quotechar='"',
quoting=csv.QUOTE_MINIMAL)
data_writer.writerow(['epoch', 'reward', 'error'])
for i in range(re... | flexible | {
"blob_id": "a91d2f32afdc20516e56036c352cc267c728e886",
"index": 3051,
"step-1": "<mask token>\n\n\ndef save_cp_csvdata(reward, err, filename):\n with open(filename, mode='w') as data_file:\n data_writer = csv.writer(data_file, delimiter=',', quotechar='\"',\n quoting=csv.QUOTE_MINIMAL)\n ... | [
6,
8,
9,
10,
11
] |
<|reserved_special_token_0|>
class TestModificationOpLDIF(unittest.TestCase):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def testReplaceAll(self):
m = delta.Replace('thud')
self.assertEqual(m.asLDIF(), b'repl... | flexible | {
"blob_id": "8054ccb07d0130b75927a4bb9b712ce3d564b8fe",
"index": 4702,
"step-1": "<mask token>\n\n\nclass TestModificationOpLDIF(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def testReplaceAll(self):\n m = delta.Replace('thud')\n self.assertEqua... | [
43,
46,
52,
54,
63
] |
# Copyright 2018 dhtech
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file
import lib
import urlparse
import yaml
MANIFEST_PATH = '/etc/manifest'
HTTP_BASIC_AUTH = None
def blackbox(name, backend, targets, params,
target='target', path='/probe', label... | normal | {
"blob_id": "f489058c922d405754ad32a737f67bc03c08772b",
"index": 701,
"step-1": "<mask token>\n\n\ndef blackbox(name, backend, targets, params, target='target', path='/probe',\n labels=None):\n labels = {} if labels is None else labels\n banned_oses = ['debian']\n filtered_targets = [x for x in targe... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
def main(screen, file_path):
setUpEnv()
text = readFileIfExist(file_path)
while 1:
try:
text = startEditing(screen, text)
printQuitOptions(screen)
char = screen.getch()
if char == KEY_ENTER_CODE:
writeToFi... | flexible | {
"blob_id": "7a6d45ef87d93af9a15bd352b893164d3a36c399",
"index": 7545,
"step-1": "<mask token>\n\n\ndef main(screen, file_path):\n setUpEnv()\n text = readFileIfExist(file_path)\n while 1:\n try:\n text = startEditing(screen, text)\n printQuitOptions(screen)\n cha... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for classf in classes:
PWD = os.getcwd() + '/' + classf + '/'
currentdname = os.path.basename(os.getcwd())
csvfiles = glob.glob(PWD + '/*.csv')
df = pd.DataFrame(columns=['image', 'x', 'y', 'num'])
if os.path.e... | flexible | {
"blob_id": "3ebd455056f168f8f69b9005c643c519e5d0b436",
"index": 8286,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor classf in classes:\n PWD = os.getcwd() + '/' + classf + '/'\n currentdname = os.path.basename(os.getcwd())\n csvfiles = glob.glob(PWD + '/*.csv')\n df = pd.DataFrame(colum... | [
0,
1,
2,
3,
4
] |
from xai.brain.wordbase.verbs._hinder import _HINDER
#calss header
class _HINDERED(_HINDER, ):
def __init__(self,):
_HINDER.__init__(self)
self.name = "HINDERED"
self.specie = 'verbs'
self.basic = "hinder"
self.jsondata = {}
| normal | {
"blob_id": "420beba5b6fd575ab9be0c907ae0698ba7be5220",
"index": 4622,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass _HINDERED(_HINDER):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass _HINDERED(_HINDER):\n\n def __init__(self):\n _HINDER.__init__(self)\n self.name ... | [
0,
1,
2,
3,
4
] |
import rasterio as rio
from affine import Affine
colour_data = []
def generate_colour_data(width, height, imagiry_data, pixel2coord):
"""Extract color data from the .tiff file """
for i in range(1, height):
for j in range(1, width):
colour_data.append(
[
... | normal | {
"blob_id": "7e8b192e77e857f1907d5272d03c1138a10c61f4",
"index": 4803,
"step-1": "<mask token>\n\n\ndef generate_colour_data(width, height, imagiry_data, pixel2coord):\n \"\"\"Extract color data from the .tiff file \"\"\"\n for i in range(1, height):\n for j in range(1, width):\n colour_d... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class OfferRequirement(models.Model):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class OfferRequirement(models.Model):
skill = models.Fore... | flexible | {
"blob_id": "3640f1df412b43b42fb4e856604508f698a208ad",
"index": 6385,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass OfferRequirement(models.Model):\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass OfferRequirement(models.Model):\n skill = models.ForeignKey(skill... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
@bp.route('/login')
def login():
"""
: Create session and login user
: PARAMS None
: RETURN <view>
"""
try:
session.clear()
return redirect(SP_OAUTH.get_authorize_url())
except ConnectionError as e:
flash('Connection error')
@bp.route(... | flexible | {
"blob_id": "8f7ecbe03e9a7a1d9df8cbe4596456e21b84653b",
"index": 9114,
"step-1": "<mask token>\n\n\n@bp.route('/login')\ndef login():\n \"\"\"\n : Create session and login user\n : PARAMS None\n : RETURN <view>\n \"\"\"\n try:\n session.clear()\n return redirect(SP_OAUTH.get_autho... | [
4,
5,
6,
7,
8
] |
"""Access IP Camera in Python OpenCV"""
import cv2
#stream = cv2.VideoCapture('protocol://IP:port/1')
# Use the next line if your camera has a username and password
stream = cv2.VideoCapture('rtsp://SeniorDesign:1Hwe2Dxy@10.9.27.28:554/video')
while True:
r, f = stream.read()
cv2.imshow('IP C... | normal | {
"blob_id": "f9db3c96bc3fd4911640d0428672c87072564b0d",
"index": 710,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile True:\n r, f = stream.read()\n cv2.imshow('IP Camera stream', f)\n if cv2.waitKey(1) & 255 == ord('q'):\n break\ncv2.destroyAllWindows()\n",
"step-3": "<mask token>... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
@app.route('/visualisation/confirmed/<string:country>')
@cross_origin()
def confirmedCases(country):
array = dataEx.getData('Confirmed', country).tolist()
return jsonify({'confirmed': array})
@app.route('/visualisation/recovered/<string:country>')
@cross_origin()
def recoveredCa... | flexible | {
"blob_id": "17505f5c14190df3311c04c19f687937481b920b",
"index": 1168,
"step-1": "<mask token>\n\n\n@app.route('/visualisation/confirmed/<string:country>')\n@cross_origin()\ndef confirmedCases(country):\n array = dataEx.getData('Confirmed', country).tolist()\n return jsonify({'confirmed': array})\n\n\n@app... | [
17,
18,
19,
21,
22
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution(object):
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution(object):
def maxSubArrayLen(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
sum... | flexible | {
"blob_id": "1ccaedb6e79101764db1907634ba627a0f9f2bb2",
"index": 5500,
"step-1": "<mask token>\n",
"step-2": "class Solution(object):\n <mask token>\n",
"step-3": "class Solution(object):\n\n def maxSubArrayLen(self, nums, k):\n \"\"\"\n :type nums: List[int]\n :type k: int\n ... | [
0,
1,
2
] |
<|reserved_special_token_0|>
class Solution:
def lcaDeepestLeaves(self, root: TreeNode) ->TreeNode:
_, lca = self.get_lca(root, 0)
return lca
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class TreeNode:
<|reserved_special_token_0|>
class So... | flexible | {
"blob_id": "0a528fb7fe4a318af8bd3111e8d67f6af6bd7416",
"index": 304,
"step-1": "<mask token>\n\n\nclass Solution:\n\n def lcaDeepestLeaves(self, root: TreeNode) ->TreeNode:\n _, lca = self.get_lca(root, 0)\n return lca\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass TreeNode:\n <m... | [
2,
4,
5,
6
] |
<|reserved_special_token_0|>
class SharpieSet:
<|reserved_special_token_0|>
def add_sharpie(self, sharpie: Sharpie):
self.sharpies.append(sharpie)
<|reserved_special_token_0|>
def remove_unusable(self):
for i in self.sharpies:
if i.ink_amount <= 0:
self.sh... | flexible | {
"blob_id": "4524dd5f5cddd475ca39fea7ec94fa3c1df6bd2e",
"index": 3268,
"step-1": "<mask token>\n\n\nclass SharpieSet:\n <mask token>\n\n def add_sharpie(self, sharpie: Sharpie):\n self.sharpies.append(sharpie)\n <mask token>\n\n def remove_unusable(self):\n for i in self.sharpies:\n ... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
FONTS_PATH = 'media/battle_font.ttf'
LEVELS_PATH = 'media/levels'
GAME_MUSIC_PATH = 'media/sounds/DOOM.ogg'
MENU_MUSIC_PATH = 'media/sounds/ANewMorning.ogg'
FONT_SIZE = 30
CELL_WIDTH = 13 * 2
CELL_HEIGHT = 13 * 2
CELL_SIZE = CELL_WIDTH, CELL_HEIGHT
FPS = 30
D... | flexible | {
"blob_id": "513d7e3c34cc9da030e2e018ad2db6972cf440dc",
"index": 5100,
"step-1": "<mask token>\n",
"step-2": "FONTS_PATH = 'media/battle_font.ttf'\nLEVELS_PATH = 'media/levels'\nGAME_MUSIC_PATH = 'media/sounds/DOOM.ogg'\nMENU_MUSIC_PATH = 'media/sounds/ANewMorning.ogg'\nFONT_SIZE = 30\nCELL_WIDTH = 13 * 2\nCEL... | [
0,
1,
2
] |
from neodroidagent.entry_points.agent_tests import sac_gym_test
if __name__ == "__main__":
sac_gym_test()
| normal | {
"blob_id": "e9890fcf9ad2a78b3400f6e4eeb75deac8edcd6a",
"index": 1609,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n sac_gym_test()\n",
"step-3": "from neodroidagent.entry_points.agent_tests import sac_gym_test\nif __name__ == '__main__':\n sac_gym_test()\n",
"step... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
'''
@author : Mitchell Van Braeckel
@id : 1002297
@date : 10/10/2020
@version : python 3.8-32 / python 3.8.5
@course : CIS*4010 Cloud Computing
@brief : A1 Part 2 - AWS DynamoDB ; Q2 - Query OECD
@note :
Description: There are many CSV files containing info from the OECD about agricultural p... | normal | {
"blob_id": "05186093820dffd047b0e7b5a69eb33f94f78b80",
"index": 6787,
"step-1": "<mask token>\n\n\ndef main():\n global dynamodb_client\n global dynamodb_resource\n global na_table\n global canada_table\n global usa_table\n global mexico_table\n global total_can_usa\n global total_can_us... | [
5,
6,
7,
9,
10
] |
<|reserved_special_token_0|>
class LimitedRetriesPolicy(BaseRetryPolicy):
<|reserved_special_token_0|>
def __init__(self, consumer, retry_delays, retry_queue_suffix='retry',
**kwargs):
"""
:param Consumer consumer: message consumer instance
:param Iterable[int] retry_delays: ... | flexible | {
"blob_id": "848934680253ff2950db7723b1fe82b2ae799900",
"index": 801,
"step-1": "<mask token>\n\n\nclass LimitedRetriesPolicy(BaseRetryPolicy):\n <mask token>\n\n def __init__(self, consumer, retry_delays, retry_queue_suffix='retry',\n **kwargs):\n \"\"\"\n :param Consumer consumer: me... | [
9,
13,
15,
23,
27
] |
import requests
from bs4 import BeautifulSoup
import sys
import re
if len(sys.argv)<2:
print("Syntax : python %s <port>")%(str(sys.argv[0]))
else:
print('-'*55)
print("HTB WEB-CHALLENGE coded by ZyperX [Freelance]")
print('-'*55)
r=requests.session()
port=str(sys.argv[1])
url="http://docker.hackthebox.eu:"
url=... | normal | {
"blob_id": "88ec9484e934ce27b13734ca26f79df71b7677e6",
"index": 82,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif len(sys.argv) < 2:\n print('Syntax : python %s <port>') % str(sys.argv[0])\nelse:\n print('-' * 55)\n print('HTB WEB-CHALLENGE coded by ZyperX [Freelance]')\n print('-' * 55)... | [
0,
1,
2,
3,
4
] |
{
"module_spec": {
"module_name": "Spec1"
}
}
| normal | {
"blob_id": "1cfb0690ebe1d7c6ab93fa6a4bc959b90b991bc8",
"index": 7016,
"step-1": "<mask token>\n",
"step-2": "{'module_spec': {'module_name': 'Spec1'}}\n",
"step-3": "{\n \"module_spec\": {\n \"module_name\": \"Spec1\"\n }\n}\n\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def get_organizations_by_address_border(city: str, nodes: list[tuple[float,
float]]) ->list[dict[str, Any]]:
result = []
radius = 0.0025
with sqlite3.connect(os.path.join('db', f'{city}.db')) as connection:
... | flexible | {
"blob_id": "79f945694f853e5886b590020bb661ecd418510d",
"index": 4567,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_organizations_by_address_border(city: str, nodes: list[tuple[float,\n float]]) ->list[dict[str, Any]]:\n result = []\n radius = 0.0025\n with sqlite3.connect(os.pa... | [
0,
1,
2,
3
] |
from django.shortcuts import render
from django.views.generic.list import ListView
from .models import Student
# Create your views here.
class StudentListView(ListView):
model = Student
# Custom has a HIGH priority than default in any field
template_name = 'staff/student_list.html'
# template_name_su... | normal | {
"blob_id": "bcad9869e6bc9b17eee490897b4b706171381366",
"index": 2093,
"step-1": "<mask token>\n\n\nclass StudentListView(ListView):\n <mask token>\n <mask token>\n <mask token>\n\n def get_queryset(self):\n return Student.objects.filter(course='Python')\n <mask token>\n <mask token>\n",... | [
2,
4,
5,
6,
7
] |
import json
import os
import ssl
from ldap3 import Server, Connection, Tls, SUBTREE, ALL
# Include root CA certificate path if you use a self signed AD certificate
SSL_CERT_PATH = "path/to/cert.pem"
# Include the FQDN of your Domain Controller here
FQDN = "ad.example.com"
# Search base is the CN of the container w... | normal | {
"blob_id": "9ca5c052db43c1d8b0cafa18038b3ebcd80067f7",
"index": 4710,
"step-1": "<mask token>\n\n\ndef __main__():\n email = input(\"Please input the departing user's email address: \")\n ad_result = deprovision_AD(email)\n print(ad_result)\n",
"step-2": "<mask token>\n\n\ndef deprovision_AD(email):\... | [
1,
2,
3,
4,
5
] |
#------------------------------------------------------------
# Copyright 2016 Congduc Pham, University of Pau, France.
#
# Congduc.Pham@univ-pau.fr
#
# This file is part of the low-cost LoRa gateway developped at University of Pau
#
# This program is free software: you can redistribute it and/or modify
# it under the... | normal | {
"blob_id": "475cb57ce5fda0d0389bfa1b9b227a2147e1abde",
"index": 9389,
"step-1": "#------------------------------------------------------------\n# Copyright 2016 Congduc Pham, University of Pau, France.\n# \n# Congduc.Pham@univ-pau.fr\n#\n# This file is part of the low-cost LoRa gateway developped at University ... | [
0
] |
def play_43():
n=int(input('Enter n :'))
l=[]
for i in range(n):
l.append(int(input()))
for i in range(n-1):
for j in range(i+1,n):
if l[i]<l[j]:
continue
return "no"
return "Yes"
play_43()
| normal | {
"blob_id": "1605396a6edb31dd6fe9238a0506f8cfeb794d07",
"index": 5568,
"step-1": "<mask token>\n",
"step-2": "def play_43():\n n = int(input('Enter n :'))\n l = []\n for i in range(n):\n l.append(int(input()))\n for i in range(n - 1):\n for j in range(i + 1, n):\n if l[i] <... | [
0,
1,
2,
3
] |
import server_pb2
import atexit
from grpc.beta import implementations
from random import randint
from grpc._adapter._types import ConnectivityState
global _pool
_pool = dict()
class ChannelPool(object):
def __init__(self, host, port, pool_size):
self.host = host
self.port = port
self.p... | normal | {
"blob_id": "aec45936bb07277360ea1a66b062edc4c282b45a",
"index": 4097,
"step-1": "import server_pb2\n\nimport atexit\n\nfrom grpc.beta import implementations\nfrom random import randint\nfrom grpc._adapter._types import ConnectivityState\n\nglobal _pool\n_pool = dict()\n\n\nclass ChannelPool(object):\n\n def ... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def domain_sort_key(domain):
"""Key to sort hosts / domains alphabetically, by domain name."""
import re
domain_expr = '(.*\\.)?(.*\\.)(.*)'
domain_search = re.search(domain_expr, domain)
if domain_search and domain_search.group(1):
... | flexible | {
"blob_id": "c581d9714681e22c75b1eeb866ea300e87b883f1",
"index": 2972,
"step-1": "<mask token>\n",
"step-2": "def domain_sort_key(domain):\n \"\"\"Key to sort hosts / domains alphabetically, by domain name.\"\"\"\n import re\n domain_expr = '(.*\\\\.)?(.*\\\\.)(.*)'\n domain_search = re.search(doma... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
@MySQLFlexibleServer.filter_registry.register('server-parameter')
class ServerParametersFilter(ValueFilter):
<|reserved_special_token_0|>
schema = type_schema('server-parameter', required=['type', 'name'],
rinherit=ValueFilter.schema, name={'type': 'string',
'allow... | flexible | {
"blob_id": "b9bc6a9dbb3dbe51fbae45078bd499fb97fa003f",
"index": 3950,
"step-1": "<mask token>\n\n\n@MySQLFlexibleServer.filter_registry.register('server-parameter')\nclass ServerParametersFilter(ValueFilter):\n <mask token>\n schema = type_schema('server-parameter', required=['type', 'name'],\n rin... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
class TestQuestionInteractor:
def test_question_create(self, questiondto):
user_id = 1
short_title = 'hello'
content_type = 'HTML'
content = 'hi'
storage = create_autospec(StorageInterface)
presenter = create_autospec(PresenterInterface... | flexible | {
"blob_id": "1c66ccb80383feeee96b3fb492ff63be1a67a796",
"index": 5496,
"step-1": "<mask token>\n\n\nclass TestQuestionInteractor:\n\n def test_question_create(self, questiondto):\n user_id = 1\n short_title = 'hello'\n content_type = 'HTML'\n content = 'hi'\n storage = creat... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def draw():
global h, xorg, yoff, xcount, xvel
if frameCount % 10 == 0:
fill(140, 0.49, 0.75, 0.2)
square(0, 0, width)
pushMatrix()
translate(xorg, yoff)
y = sin(frameCount % 20 / 20.0 * PI + ... | flexible | {
"blob_id": "2257494dec9fccc4e8bd4acf0aff31a73c252a61",
"index": 616,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef draw():\n global h, xorg, yoff, xcount, xvel\n if frameCount % 10 == 0:\n fill(140, 0.49, 0.75, 0.2)\n square(0, 0, width)\n pushMatrix()\n translate(xorg... | [
0,
1,
2,
3,
4
] |
"""
Iterations over :term:`hosts<host>`, :term:`roles<role>`,
:term:`components<component>` and config files.
"""
from contextlib import contextmanager
from fabric.api import env, settings, abort
from os.path import join
from pkg_resources import iter_entry_points
from warnings import warn
from fabric.network import s... | normal | {
"blob_id": "cc019c732003ed72db80a7893096a0bef0f12e47",
"index": 4168,
"step-1": "<mask token>\n\n\ndef _get_environmentdef():\n \"\"\"\n Retreive the EnvironmentDefinition from the fabric env.\n \"\"\"\n if 'environmentdef' not in env:\n abort('Environment needs to be configured')\n enviro... | [
5,
6,
7,
8,
9
] |
import numpy as np
from scipy import stats
a = np.random.normal(25.0, 5.0, 10000)
b = np.random.normal(26.0, 5.0, 10000)
print(stats.ttest_ind(a, b)) # bad change, with a ery low chance of randomness
b = np.random.normal(25.0, 5.0, 10000)
print(stats.ttest_ind(a, b)) # no change, outcome is likely random
| normal | {
"blob_id": "ba85f3c8a9e40f30076c13487a97567f7bc646dc",
"index": 8041,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(stats.ttest_ind(a, b))\n<mask token>\nprint(stats.ttest_ind(a, b))\n",
"step-3": "<mask token>\na = np.random.normal(25.0, 5.0, 10000)\nb = np.random.normal(26.0, 5.0, 10000)\npri... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class Stratagem:
<|reserved_special_token_0|>
def __init__(self, dll_path=None, display_error=True):
"""
:arg dll_path: complete path to the location of ``stratadllogger.dll``
(optional). If ``None``, the path is found in the Windows registry
... | flexible | {
"blob_id": "6914656a2f78fa1fe74a67bf09b017585b3eac88",
"index": 2770,
"step-1": "<mask token>\n\n\nclass Stratagem:\n <mask token>\n\n def __init__(self, dll_path=None, display_error=True):\n \"\"\"\n :arg dll_path: complete path to the location of ``stratadllogger.dll``\n (option... | [
21,
23,
38,
39,
40
] |
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.contrib.auth.models import User
from ..models import Todo
class MyTestCase(TestCase):
def test_mark_done(self):
user = User.objects.create_user(email='user@…', username='user', password='somepasswd')
todo = Todo(title='SomeTitl... | normal | {
"blob_id": "5c81ddbc8f5a162949a100dbef1c69551d9e267a",
"index": 37,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass MyTestCase(TestCase):\n\n def test_mark_done(self):\n user = User.objects.create_user(email='user@…', username='user',\n password='somepasswd')\n todo ... | [
0,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
parser.add_argument('-b', '--browser', type=str, required=True, help=
'Browser to use in the test. Can be: firefox, chrome, chromium')
parser.add_argument('-H', '--host', type=str, default='localhost', help=
'Host or IP ad... | flexible | {
"blob_id": "874668d5f3ea61b6aabde7b784078b431961a9c9",
"index": 9096,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nparser.add_argument('-b', '--browser', type=str, required=True, help=\n 'Browser to use in the test. Can be: firefox, chrome, chromium')\nparser.add_argument('-H', '--host', type=str, ... | [
0,
1,
2,
3,
4
] |
import loops
class Card():
#to make a card you must type Card("Name of Card")
def check_cat(self,string):
if "Cat" in string:
return True
return False
def __init__(self,string):
self.type = string
self.cat = self.check_cat(self.type)
# self.ima... | normal | {
"blob_id": "3b71ef6c3681b8c5e6aadf2d125c35cbf3a12661",
"index": 6248,
"step-1": "<mask token>\n\n\nclass Card:\n\n def check_cat(self, string):\n if 'Cat' in string:\n return True\n return False\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def steal(... | [
4,
6,
8,
10,
12
] |
# Advent of Code: Day 4
"""A new system policy has been put in place that requires all accounts to
use a passphrase instead of simply a password. A passphrase consists of a
series of words (lowercase letters) separated by spaces.
To ensure security, a valid passphrase must contain no duplicate words.
"""
def valid... | normal | {
"blob_id": "7dce240a891e807b1f5251a09a69368f4e513973",
"index": 4472,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef valid_anagram(filename):\n f = open(filename, 'r')\n lines = f.readlines()\n f.close()\n result = len(lines)\n for line in lines:\n split = line.rstrip().spl... | [
0,
1,
2,
3,
4
] |
# Generated by Django 2.0.7 on 2018-09-27 13:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('education', '0005_auto_20180927_1041'),
]
operations = [
migrations.RemoveField(
model_name='educationgroup',
name='... | normal | {
"blob_id": "8ff7ace102b781b35fff0671e2c606bf662e2767",
"index": 9851,
"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 = [('education',... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class MachopWatchCommand(MachopProcess):
class MachopHandler(PatternMatchingEventHandler):
""" watcher for a file system event """
def on_modified(self, event):
if event.is_directory:
return
source = event.src_path
... | flexible | {
"blob_id": "4e30f0a9b420123c28858aad2a71040dcc952829",
"index": 1391,
"step-1": "<mask token>\n\n\nclass MachopWatchCommand(MachopProcess):\n\n\n class MachopHandler(PatternMatchingEventHandler):\n \"\"\" watcher for a file system event \"\"\"\n\n def on_modified(self, event):\n if e... | [
4,
5,
7,
8,
9
] |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-08-04 13:16
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0007_alter_validators_add_error_... | normal | {
"blob_id": "71662ff8c68559bf08e1da7f1a1504bfe842c950",
"index": 7430,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T... | [
0,
1,
2,
3,
4
] |
# Time: O(|V| + |E|)
# Space: O(|V|)
class Solution(object):
def eventualSafeNodes(self, graph):
"""
:type graph: List[List[int]]
:rtype: List[int]
"""
WHITE, GRAY, BLACK = range(3)
def dfs(graph, node, lookup):
if lookup[node] != WHITE:
... | normal | {
"blob_id": "5c5cfcd240c8b05970dc8dff57bfbbdc98f1d100",
"index": 9838,
"step-1": "<mask token>\n",
"step-2": "class Solution(object):\n <mask token>\n",
"step-3": "class Solution(object):\n\n def eventualSafeNodes(self, graph):\n \"\"\"\n :type graph: List[List[int]]\n :rtype: List... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class ChartType:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class ChartType:
Vanilla = 'Vanilla'
Neopolitan = 'Neopolitan'
<|reserved_special_token_1|>
class ChartType:
Vanilla = "Vanilla"
... | flexible | {
"blob_id": "451a36eb205a269a05e3b3d89541278633d12aaa",
"index": 9781,
"step-1": "<mask token>\n",
"step-2": "class ChartType:\n <mask token>\n <mask token>\n",
"step-3": "class ChartType:\n Vanilla = 'Vanilla'\n Neopolitan = 'Neopolitan'\n",
"step-4": "\n\nclass ChartType:\n Vanilla = \"Vanil... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
import rospy
from racecar_control.msg import drive_param
import curses
forward = 0;
left = 0;
stdscr = curses.initscr()
curses.cbreak()
stdscr.keypad(1)
rospy.init_node('keyop', anonymous=True)
pub = rospy.Publisher('drive_parameters', drive_param, queue_size=10)
stdscr.refresh()
key = ''
... | normal | {
"blob_id": "fb332808890e369d1439d1dba61244a0f7b89301",
"index": 4524,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ncurses.cbreak()\nstdscr.keypad(1)\nrospy.init_node('keyop', anonymous=True)\n<mask token>\nstdscr.refresh()\n<mask token>\nwhile key != ord('q'):\n key = stdscr.getch()\n stdscr.ref... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class Experiment:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
@hplc.setter
def hplc(self, df):
if isinstance(df, pd.DataFrame) or df is None:
try:
self._hplc = df.sort_values(by=['Normalization', 'Channel',
... | flexible | {
"blob_id": "754b34028780231c7eccb98cdf3e83bd615d843f",
"index": 5276,
"step-1": "<mask token>\n\n\nclass Experiment:\n <mask token>\n <mask token>\n\n @hplc.setter\n def hplc(self, df):\n if isinstance(df, pd.DataFrame) or df is None:\n try:\n self._hplc = df.sort_va... | [
11,
14,
19,
20,
21
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
plt.scatter(df['left_rel_angle'], df['right_rel_angle'])
plt.xlabel('Left servo angle(deg)')
plt.ylabel('Right servo angle(deg)')
plt.title('Plot of left and right servo values')
plt.show()
plt.scatter(df['roll'], df['pitch'])
plt... | flexible | {
"blob_id": "fd7961d3a94b53ae791da696bb2024165db8b8fc",
"index": 5354,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nplt.scatter(df['left_rel_angle'], df['right_rel_angle'])\nplt.xlabel('Left servo angle(deg)')\nplt.ylabel('Right servo angle(deg)')\nplt.title('Plot of left and right servo values')\nplt.... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class EulerianPath:
<|reserved_special_token_0|>
class EEdge(Edge):
def __init__(self, v=0, w=0, is_used=False):
super().__init__(v, w)
self._is_used = is_used
def get_is_used(self):
return self._is_used
def __repr__... | flexible | {
"blob_id": "73e6930c6866d3ccdbccec925bfc5e7e4702feb9",
"index": 8348,
"step-1": "<mask token>\n\n\nclass EulerianPath:\n <mask token>\n\n\n class EEdge(Edge):\n\n def __init__(self, v=0, w=0, is_used=False):\n super().__init__(v, w)\n self._is_used = is_used\n\n def get... | [
7,
8,
10,
11,
12
] |
#!/usr/bin/python3
"""
program of the command interpreter
"""
import cmd
import models
import re
from models.base_model import BaseModel
from models import storage
from models.user import User
from models.state import State
from models.city import City
from models.amenity import Amenity
from models.place import Place
... | normal | {
"blob_id": "7cbf2082d530c315fdcfdb94f5c6ac4755ea2081",
"index": 1267,
"step-1": "<mask token>\n\n\nclass HBNBCommand(cmd.Cmd):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def emptyline(self):\n \"\"\"Do nothing\"\"\"\n pass\n\n def do_create(... | [
9,
11,
12,
16,
17
] |
<|reserved_special_token_0|>
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--src_path', default='', type=str)
parser.add_argument('--save_path', default='', type=str)
parser.add_argument('--interpolation', default='bicubic', type=str,
metavar='NAME', help=
'Image ... | flexible | {
"blob_id": "443ed24ab396e83dbf12558207376258124bca8b",
"index": 4094,
"step-1": "<mask token>\n\n\ndef main():\n parser = argparse.ArgumentParser()\n parser.add_argument('--src_path', default='', type=str)\n parser.add_argument('--save_path', default='', type=str)\n parser.add_argument('--interpolat... | [
1,
2,
3,
4,
5
] |
from room import Room
from player import Player
from item import Item
# Declare all the rooms
items = {
'scimitar': Item('Scimitar', '+7 Attack'),
'mace': Item('Mace', '+13 Attack'),
'tower_shield': Item('Tower Shield', '+8 Block'),
'heraldic_shield': Item('Heraldic Shield', '+12 Block'),
'chainmail... | normal | {
"blob_id": "07a172c28057dc803efdbdc10a9e2e11df4e527b",
"index": 3134,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile True:\n if suppressRoomPrint:\n suppressRoomPrint = False\n else:\n print(player.location)\n print(\n f\"\"\"\n{player.location.name}\n {player.locatio... | [
0,
1,
2,
3,
4
] |
"""
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.
Example:
Input:
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Output: 4
"""
# 196ms. 98 percentile
class Solution:
def maximalSquare(self, matrix: List[List[str]]) -> int:
if not matrix:
... | normal | {
"blob_id": "e5d31a2ea4a8615d24626be2414f5ae49b9cd6a1",
"index": 184,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\nclass Solution:\n\n def maximalSquare(self, matrix: List[List[str]]) ->int:\n if not ma... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def train():
batch_size = 4
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
trainGene = trainGenerator(batch_size, data_path='/data', folder=
'train', aug_dict=aug_args, seed=1, interaction='RECIST')
devGene = trainGenerator(batch_size, data_path='/data', folder='dev',
... | flexible | {
"blob_id": "8c17f2c770c24bbf8c73628c6740c0b866e6b1c0",
"index": 9047,
"step-1": "<mask token>\n\n\ndef train():\n batch_size = 4\n os.environ['CUDA_VISIBLE_DEVICES'] = '0'\n trainGene = trainGenerator(batch_size, data_path='/data', folder=\n 'train', aug_dict=aug_args, seed=1, interaction='RECIS... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
__version__ = '3.13.7'
| flexible | {
"blob_id": "01852f6dbeb78df3098b14d2f0538ad9193ea511",
"index": 9873,
"step-1": "<mask token>\n",
"step-2": "__version__ = '3.13.7'\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
<|reserved_special_token_0|>
class OrderInfoAdmin(admin.ModelAdmin):
list_display = 'ordernum', 'total', 'state'
search_fields = 'total',
list_filter = 'bpub_date',
actions = [make_published]
class address_infoAdmin(admin.ModelAdmin):
exclude = 'isDelete',
<|reserved_special_token_0|>
<|rese... | flexible | {
"blob_id": "74a0282495bf4bbd34b397e0922074659a66d6ff",
"index": 4809,
"step-1": "<mask token>\n\n\nclass OrderInfoAdmin(admin.ModelAdmin):\n list_display = 'ordernum', 'total', 'state'\n search_fields = 'total',\n list_filter = 'bpub_date',\n actions = [make_published]\n\n\nclass address_infoAdmin(a... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if __name__ == '__main__':
app.run(debug=app.config['DEBUG'])
<|reserved_special_token_1|>
<|reserved_special_token_0|>
__author__ = '七月'
app = create_app()
if __name__ == '__main__':
app.run(debug=app.config['DEBUG'])
... | flexible | {
"blob_id": "9a6d6637cd4ecf2f6e9c8eb8e702be06e83beea4",
"index": 998,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n app.run(debug=app.config['DEBUG'])\n",
"step-3": "<mask token>\n__author__ = '七月'\napp = create_app()\nif __name__ == '__main__':\n app.run(debug=app.c... | [
0,
1,
2,
3
] |
from zipline.api import (
# add_history,
history,
order_target_percent,
order,
record,
symbol,
get_datetime,
schedule_function,
)
from zipline.algorithm import TradingAlgorithm
from zipline.utils.factory import load_from_yahoo
import numpy as np
import pandas as pd
from datetime import datetime ... | normal | {
"blob_id": "2e8737a48bd04ef5c158afb23dc94476ea790e18",
"index": 2074,
"step-1": "from zipline.api import (\r\n\t# add_history,\r\n\thistory,\r\n\torder_target_percent,\r\n\torder,\r\n\trecord,\r\n\tsymbol,\r\n\tget_datetime,\r\n\tschedule_function,\r\n)\r\nfrom zipline.algorithm import TradingAlgorithm\r\nfrom ... | [
0
] |
import collections
import itertools
from . import stats
__all__ = [
'Party',
'HoR',
'Coalition'
]
Party = collections.namedtuple('Party', 'name,votes,seats')
class HoR(object):
"""House of Representatives"""
def __init__(self, parties, name='HoR'):
self.name = name
self._parties... | normal | {
"blob_id": "4c927f14065d0557dbe7b371002e133c351d3478",
"index": 6933,
"step-1": "<mask token>\n\n\nclass HoR(object):\n <mask token>\n\n def __init__(self, parties, name='HoR'):\n self.name = name\n self._parties = tuple(sorted(parties, key=lambda p: (p.seats, p.\n votes), reverse... | [
31,
32,
34,
36,
39
] |
from random import randint
from Ball import Ball
from Util import Vector, Rectangle
class Player:
RADIUS = 10
COLOR1 = "#80d6ff"
COLOR2 = "#ff867c"
OUTLINE = "#000000"
@property
def right(self):
return self.pos.sub(Vector(Player.RADIUS, 0))
@property
def left(self):
... | normal | {
"blob_id": "04b02931b749ad06a512b78ca5661ae1f5cb8a9c",
"index": 5534,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Player:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @property\n def right(self):\n return self.pos.sub(Vector(Player.RADIUS, 0))\n\n... | [
0,
8,
9,
14,
15
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(ord(s))
<|reserved_special_token_1|>
<|reserved_special_token_0|>
s = input()
print(ord(s))
<|reserved_special_token_1|>
import sys, string, math
s = input()
print(ord(s))
| flexible | {
"blob_id": "ade300f2921ca860bbe92aa351df2c88238b7996",
"index": 6039,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(ord(s))\n",
"step-3": "<mask token>\ns = input()\nprint(ord(s))\n",
"step-4": "import sys, string, math\ns = input()\nprint(ord(s))\n",
"step-5": null,
"step-ids": [
0,
... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
@app.after_request
def after_request(response):
response.headers.add('Access-Control-Allow-Headers',
'Content-Type, Authorization, true')
response.headers.add('Access-Control-Allow-Methods',
'GET, PATCH,PUT,POST, DELETE, OPTIONS')
return response
<|reserved_s... | flexible | {
"blob_id": "b84a2093a51e57c448ee7b4f5a89d69dfb14b1b6",
"index": 4876,
"step-1": "<mask token>\n\n\n@app.after_request\ndef after_request(response):\n response.headers.add('Access-Control-Allow-Headers',\n 'Content-Type, Authorization, true')\n response.headers.add('Access-Control-Allow-Methods',\n ... | [
8,
10,
12,
14,
17
] |
<|reserved_special_token_0|>
class logout_view(View):
def get(self, request):
logout(request)
return redirect('adminbiobses:login')
@method_decorator(login_required, name='dispatch')
class index(View):
template_name = 'adminbiobses/index.html'
def get(self, request):
return ren... | flexible | {
"blob_id": "e4e2e8ca65d109805b267f148e8d255d81d4ee83",
"index": 1801,
"step-1": "<mask token>\n\n\nclass logout_view(View):\n\n def get(self, request):\n logout(request)\n return redirect('adminbiobses:login')\n\n\n@method_decorator(login_required, name='dispatch')\nclass index(View):\n temp... | [
5,
6,
7,
8,
11
] |
def parse(filename):
t1, t2 = open(filename).read().strip().split("\n\n")
return tuple(map(lambda x: list(map(int, x.split("\n")[1:])), [t1, t2]))
def score(deck):
res = 0
for i in range(len(deck)):
res += deck[i] * (len(deck)-i)
return res
def solution1(deck1, deck2):
while len(deck1) > 0 and len(deck2) > 0:... | normal | {
"blob_id": "508d016161131481ace41f3d3bda005423125fe5",
"index": 5635,
"step-1": "def parse(filename):\n t1, t2 = open(filename).read().strip().split('\\n\\n')\n return tuple(map(lambda x: list(map(int, x.split('\\n')[1:])), [t1, t2]))\n\n\ndef score(deck):\n res = 0\n for i in range(len(deck)):\n ... | [
4,
5,
6,
8,
9
] |
<|reserved_special_token_0|>
def Plot_Audio(audio):
s = audio.shape[0]
time = np.arange(s)
plt.plot(time, audio)
plt.show()
def Add_Noise(audio, mu=0, sigma=1):
"""
Adding Gaussian Noise
"""
gaussian_noise = np.random.normal(0, 1, audio.shape[0])
audio = audio + gaussian_noise
retu... | flexible | {
"blob_id": "844b8e2d4f05a51282b356c995f2733d6935a5d6",
"index": 5552,
"step-1": "<mask token>\n\n\ndef Plot_Audio(audio):\n s = audio.shape[0]\n time = np.arange(s)\n plt.plot(time, audio)\n plt.show()\n\n\ndef Add_Noise(audio, mu=0, sigma=1):\n \"\"\"\n\tAdding Gaussian Noise\n\t\"\"\"\n gaus... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
go.write('package main\n\n')
go.write('import (\n ')
go.write(""""github.com/jmoiron/sqlx"
)
""")
go.write('type {0} struct {1}\n'.format(dictiony['dbname'], '{'))
go.write(' ID {}\n'.format(dictiony['uuid']))
go.wri... | flexible | {
"blob_id": "e99e558ebf5938a90f00df6593c9f75a18affcb8",
"index": 9127,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ngo.write('package main\\n\\n')\ngo.write('import (\\n ')\ngo.write(\"\"\"\"github.com/jmoiron/sqlx\"\n)\n\n\"\"\")\ngo.write('type {0} struct {1}\\n'.format(dictiony['dbname'], '{'))\n... | [
0,
1,
2,
3,
4
] |
"""
Counted List
Create a class for an list like object based on UserList wrapper
https://docs.python.org/3/library/collections.html#collections.UserList
That object should have a method to return a Counter
https://docs.python.org/3/library/collections.html#collections.Counter
for all objects in the list
Counter should... | normal | {
"blob_id": "1cf4fc37e030a895cb36f537ce9e92df34acfb8b",
"index": 7659,
"step-1": "<mask token>\n\n\nclass CountedList(UserList):\n\n def Count(self):\n self.cnt = Counter(self.data)\n return self.cnt\n\n def append(self, item):\n super(CountedList, self).append(item)\n global y\... | [
3,
4,
5,
6,
7
] |
name = 'valentina '
print(name * 1000)
| normal | {
"blob_id": "aff1a9263e183610f403a4d6a7f27b45eacb7ff2",
"index": 0,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(name * 1000)\n",
"step-3": "name = 'valentina '\nprint(name * 1000)\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
"""
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
] |
<|reserved_special_token_0|>
class court:
<|reserved_special_token_0|>
def __init__(self):
"""
Initialisiert ein court-Objekt.
Hierzu zählen Spielfeld, Spieler sowie die Startposition des Balles.
:return void
"""
self.x_max = 16.0
self.y_max = 9.0
... | flexible | {
"blob_id": "5485a1210a0c0361dbb000546ee74df725fad913",
"index": 5647,
"step-1": "<mask token>\n\n\nclass court:\n <mask token>\n\n def __init__(self):\n \"\"\"\n Initialisiert ein court-Objekt.\n Hierzu zählen Spielfeld, Spieler sowie die Startposition des Balles.\n\n :return v... | [
20,
21,
23,
26,
29
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
s.login(ip, username, password)
print('SSH session login successful')
s.sendline('application stop')
s.prompt()
print('Stopping the app')
print("""
Starting the app""")
s.sendline('application start')
s.prompt()
print('\nLogout')
... | flexible | {
"blob_id": "dd9574ea08beb9bc5f1413afd63c751fd42cba67",
"index": 6406,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ns.login(ip, username, password)\nprint('SSH session login successful')\ns.sendline('application stop')\ns.prompt()\nprint('Stopping the app')\nprint(\"\"\"\nStarting the app\"\"\")\ns.sen... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python
"""
Checker of generated packages.
- [x] import generated package
- [x] flake8
- [x] pyright
- [x] mypy
"""
import argparse
import json
import logging
import subprocess
import sys
import tempfile
from dataclasses import dataclass
from pathlib import Path
from typing import List, Optional
ROOT_PA... | normal | {
"blob_id": "f3466fd38ecf472a4342aad4d10410d6f2a67d47",
"index": 1779,
"step-1": "<mask token>\n\n\nclass SnapshotMismatchError(Exception):\n \"\"\"\n Main snapshot mismatch exception.\n \"\"\"\n\n\ndef setup_logging(level: int) ->logging.Logger:\n \"\"\"\n Get Logger instance.\n\n Arguments:\n... | [
13,
14,
16,
17,
19
] |
<|reserved_special_token_0|>
class FContactRegulatoryInfoBase(object):
def __init__(self, contact=None):
"""class that maintains all data related to the regulatory on the FContact"""
try:
self.__contact = contact
if not self.__contact:
FRegulatoryLogger.ERR... | flexible | {
"blob_id": "d4e62950f10efeb27d19c3d9c672969342ef8c7c",
"index": 3095,
"step-1": "<mask token>\n\n\nclass FContactRegulatoryInfoBase(object):\n\n def __init__(self, contact=None):\n \"\"\"class that maintains all data related to the regulatory on the FContact\"\"\"\n try:\n self.__con... | [
13,
15,
18,
20,
23
] |
<|reserved_special_token_0|>
class Scraping:
def __init__(self, clues, answers, gridIndex):
self.clues = clues
self.domains = {'across': {}, 'down': {}}
self.answers = answers
self.gridIndex = gridIndex
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserv... | flexible | {
"blob_id": "138abb40fda0f19b4a74a294d5cd0dd326dc59ce",
"index": 7722,
"step-1": "<mask token>\n\n\nclass Scraping:\n\n def __init__(self, clues, answers, gridIndex):\n self.clues = clues\n self.domains = {'across': {}, 'down': {}}\n self.answers = answers\n self.gridIndex = gridIn... | [
4,
6,
9,
11,
12
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
MainStack(app, app, 'main')
app.synth()
<|reserved_special_token_1|>
<|reserved_special_token_0|>
APP_NAME = 'etl-pm-pipeline-be'
app = PMIApp(APP_NAME)
MainStack(app, app, 'main')
app.synth()
<|reserved_special_token_1|>
<|... | flexible | {
"blob_id": "dfbbbaf6b5f02c60ca48f7864068d59349c547d1",
"index": 5484,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nMainStack(app, app, 'main')\napp.synth()\n",
"step-3": "<mask token>\nAPP_NAME = 'etl-pm-pipeline-be'\napp = PMIApp(APP_NAME)\nMainStack(app, app, 'main')\napp.synth()\n",
"step-4": "... | [
0,
1,
2,
3,
4
] |
import sys
pdb = open(sys.argv[1])
name = sys.argv[2]
res = []
resid = None
for l in pdb:
if not l.startswith("ATOM"):
continue
if int(l[22:26]) != resid:
res.append([])
resid = int(l[22:26])
res[-1].append(l)
for i in range(len(res)-2):
outp = open("%s%d-%dr.pdb"%(name,i+1,i+... | normal | {
"blob_id": "d867d17b2873de7c63d0ff29eb585cce1a68dda6",
"index": 6081,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor l in pdb:\n if not l.startswith('ATOM'):\n continue\n if int(l[22:26]) != resid:\n res.append([])\n resid = int(l[22:26])\n res[-1].append(l)\nfor i in r... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class FieldValidator:
def __init__(self, validationData={}, *args, **kwargs):
self.data = validationData
self.validationPipeline = []
self.statusCode = 200
self.errors = {}
self.invalidFields = []
def flush(self):
self = FieldValid... | flexible | {
"blob_id": "e8daf03f987c7512ff245bfbe16c447acd6b5986",
"index": 7574,
"step-1": "<mask token>\n\n\nclass FieldValidator:\n\n def __init__(self, validationData={}, *args, **kwargs):\n self.data = validationData\n self.validationPipeline = []\n self.statusCode = 200\n self.errors = ... | [
40,
58,
62,
63,
65
] |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""""""""""""""""""""""""""""""""""""""""""""""
" Filename: time.py
"
" Author: xss - callmexss@126.com
" Description: Show local time
" Create: 2018-07-02 20:20:17
"""""""""""""""""""""""""""""""""""""""""""""""
from datetime import datetime
print('''\... | normal | {
"blob_id": "e8eac1e4433eee769d317de9ba81d5181168fdca",
"index": 6293,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(\n \"\"\" <html>\n <body>\n <p>Generated {0}</p>\n </body>\n </html>\"\"\"\n .format(datetime.now()))\n",
"step-3": "<mask token>\nfrom da... | [
0,
1,
2,
3
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.