code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
# -*- coding: utf-8 -*-
import csv
import datetime
from django.conf import settings
from django.contrib import admin
from django.http import HttpResponse
from django.utils.encoding import smart_str
from djforms.scholars.models import *
def export_scholars(modeladmin, request, queryset):
"""Export t... | normal | {
"blob_id": "1ae69eaaa08a0045faad13281a6a3de8f7529c7a",
"index": 9761,
"step-1": "<mask token>\n\n\nclass PresentationAdmin(admin.ModelAdmin):\n <mask token>\n model = Presentation\n actions = [export_scholars]\n raw_id_fields = 'user', 'updated_by', 'leader'\n list_max_show_all = 500\n list_pe... | [
7,
9,
11,
12,
13
] |
# Improting Image class from PIL module
from PIL import Image
# Opens a image in RGB mode
im = Image.open("data/frame1.jpg")
# Setting the points for cropped image
left = 155
top = 65
right = 360
bottom = 270
# Cropped image of above dimension
# (It will not change orginal image)
im1 = im.crop((left, top, right, bot... | normal | {
"blob_id": "9fd73e0a1dacc46c177f11ce4cf2351b3d622c0d",
"index": 7594,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nim1.show()\nim.show()\n",
"step-3": "<mask token>\nim = Image.open('data/frame1.jpg')\nleft = 155\ntop = 65\nright = 360\nbottom = 270\nim1 = im.crop((left, top, right, bottom))\nim1.sh... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(save_result.text)
<|reserved_special_token_0|>
print(read_result.text)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
save_result = requests.post('http://localhost:5000/save', json={'value':
'witam'})
print... | flexible | {
"blob_id": "43362c564be0dfbc8f246a0589bcebde245ab7b5",
"index": 7015,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(save_result.text)\n<mask token>\nprint(read_result.text)\n",
"step-3": "<mask token>\nsave_result = requests.post('http://localhost:5000/save', json={'value':\n 'witam'})\nprin... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class ProviderEditAddressHandler(ProviderBaseHandler):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class ProviderChangeURLHandler(ProviderBaseHandler):
@provider_required
def post(self, vanity_url=None):
form = ProviderVanityURLForm().get_form(self... | flexible | {
"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
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
def divide(self, dividend: int, divisor: int) ->int:
if dividend == -2 ** 31 and divisor == -1:
return 2 ** 31 - 1
if dividend ==... | flexible | {
"blob_id": "d1864f454b1909196fd9a6e2279b23f4c4148917",
"index": 7232,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def divide(self, dividend: int, divisor: int) ->int:\n if dividend == -2 ** 31 and divisor == -1:\n return 2 ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def build_embed(_video_url: str, _video_image_url: Optional[str],
_video_title: Optional[str], _author_name: Optional[str], _author_url:
Optional[str]) ->discord.Embed:
embed = discord.Embed(type='video', colour=discord.Colour.from_rgb(255,
0, 0))
if _video_image_u... | flexible | {
"blob_id": "d73832d3f0adf22085a207ab223854e11fffa2e8",
"index": 6948,
"step-1": "<mask token>\n\n\ndef build_embed(_video_url: str, _video_image_url: Optional[str],\n _video_title: Optional[str], _author_name: Optional[str], _author_url:\n Optional[str]) ->discord.Embed:\n embed = discord.Embed(type='v... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def main(dir_train, C, gamma, number_partitions, do_subsampling, write_labels):
hlp.setup_logging()
if number_partitions is None or number_partitions == 0:
do_concat = False
partitions_from_files = True
... | flexible | {
"blob_id": "4a63431aa71ca3f4b75fcd89a50bf599e7717645",
"index": 2442,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main(dir_train, C, gamma, number_partitions, do_subsampling, write_labels):\n hlp.setup_logging()\n if number_partitions is None or number_partitions == 0:\n do_conca... | [
0,
1,
2,
3,
4
] |
import time
from sqlalchemy import Column, Unicode, UnicodeText, Integer
from models.base_model import SQLMixin, db, SQLBase
class Messages(SQLMixin, SQLBase):
__tablename__ = 'Messages'
title = Column(Unicode(50), nullable=False)
content = Column(UnicodeText, nullable=False)
sender_id = Column(Intege... | normal | {
"blob_id": "6fbf64e2dc2836a54e54ee009be1d0d8d7c7037a",
"index": 1688,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Messages(SQLMixin, SQLBase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Messages(SQLMixin... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for num in nums:
count = array.count(num)
occ.append((int(num), int(count)))
<|reserved_special_token_0|>
print(occ)
occ.sort(key=lambda x: x[1], reverse=True)
print(occ)
for number, count in occ:
for i in range(count)... | flexible | {
"blob_id": "acbe4afee81cb6b9c0b8404d470c3f7f5685477c",
"index": 1700,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor num in nums:\n count = array.count(num)\n occ.append((int(num), int(count)))\n<mask token>\nprint(occ)\nocc.sort(key=lambda x: x[1], reverse=True)\nprint(occ)\nfor number, count... | [
0,
1,
2,
3
] |
a = 'Hello, World!'
print
| normal | {
"blob_id": "b779cfc6d6456a370092bf1cfa5904c869b7466a",
"index": 9219,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint\n",
"step-3": "a = 'Hello, World!'\nprint\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 19 17:24:25 2015
@author: Damien
"""
import numpy as np
from operator import itemgetter
import itertools
def writeOBJ(vertlist,trilist,filename):
print "number of triangles: " + str(len(trilist))
print "number of vertices: " + str(len(vertlist))
OBJ = open(f... | normal | {
"blob_id": "471d4cc95d6cb8d02f1c96e940c2a2235affbc52",
"index": 4127,
"step-1": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Thu Mar 19 17:24:25 2015\n\n@author: Damien\n\"\"\"\nimport numpy as np\nfrom operator import itemgetter\nimport itertools\n\n\ndef writeOBJ(vertlist,trilist,filename):\n print \"numbe... | [
0
] |
<|reserved_special_token_0|>
class FirewallFacts(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class FirewallFacts(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
... | flexible | {
"blob_id": "62bc8fec6833c5e8bc1598941eaad141ab6c9d5a",
"index": 3758,
"step-1": "<mask token>\n\n\nclass FirewallFacts(object):\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass FirewallFacts(object):\n <mask token>\n <mask token>\n\n def populate_facts(self... | [
1,
2,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def make_wave(freq, time=1, amp=1, phase=0, samplerate=44100, bitspersample=16
):
bytelist = []
TwoPiDivSamplerate = 2 * math.pi / samplerate
increment = TwoPiDivSamplerate * freq
incadd = phase * increment
... | flexible | {
"blob_id": "2ad1b44027b72499c1961f2d2b1c12c356c63d2b",
"index": 5350,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef make_wave(freq, time=1, amp=1, phase=0, samplerate=44100, bitspersample=16\n ):\n bytelist = []\n TwoPiDivSamplerate = 2 * math.pi / samplerate\n increment = TwoPiDivS... | [
0,
2,
3,
4,
5
] |
'''
quarter = 0.25
dime = 0.10
nickel = 0.05
penny = 0.01
'''
#def poschg(dollar_amount,number):
| normal | {
"blob_id": "0deec9058c6f7b77ba4fa3bfc0269c8596ce9612",
"index": 1215,
"step-1": "<mask token>\n",
"step-2": "'''\nquarter = 0.25\ndime = 0.10\nnickel = 0.05\npenny = 0.01\n'''\n\n#def poschg(dollar_amount,number):\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with open('config.yml') as f:
content = yaml.load(f)
<|reserved_special_token_0|>
for k, v in response.items():
if k == 'jobDefinitions':
new_dict = v[0]['containerProperties']
print(content.items())
print(new_dict... | flexible | {
"blob_id": "3ba9ff00b0d6a2006c714a9818c8b561d884e252",
"index": 2302,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('config.yml') as f:\n content = yaml.load(f)\n<mask token>\nfor k, v in response.items():\n if k == 'jobDefinitions':\n new_dict = v[0]['containerProperties']\nprin... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.... | flexible | {
"blob_id": "87e17eb6fa91be09ac9afa43c4e58054faa77477",
"index": 5944,
"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
] |
"""
Faça um algoritmo que solicita ao usuário as notas de três provas. Calcule a média aritmética e
informe se o aluno foi Aprovado ou Reprovado (o aluno é considerado aprovado com a média igual ou superior a 6).
"""
nota1 = float(input("Digite sua primeira nota: "))
nota2 = float(input("Digite sua segunda nota:... | normal | {
"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
] |
import numpy as np
import matplotlib.pyplot as plt
import csv
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'])
... | normal | {
"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|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with open('Civ VI Modding Companion - Events.csv', newline='') as csvfile:
reader = csv.reader(csvfile, delimiter=',', quotechar='|')
for row in reader:
if i < 4:
i += 1
continue
eve... | flexible | {
"blob_id": "5ce98ae241c0982eeb1027ffcff5b770f94ff1a3",
"index": 77,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('Civ VI Modding Companion - Events.csv', newline='') as csvfile:\n reader = csv.reader(csvfile, delimiter=',', quotechar='|')\n for row in reader:\n if i < 4:\n ... | [
0,
1,
2,
3,
4
] |
"""
File: ex17_map_reduce.py
Author: TonyDeep
Date: 2020-07-21
"""
from functools import reduce
print('#1 map')
a_list = [2, 18, 9, 22, 17, 24, 8, 12, 27]
map_data = map(lambda x: x * 2 + 1, a_list)
new_list = list(map_data)
print(new_list)
print('\n#2 reduce')
b_list = [1, 2, 3, 4, 5]
reduce_data = reduce(lambda x,... | normal | {
"blob_id": "8e3b26826752b6b3482e8a29b9b58f5025c7ef58",
"index": 4758,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('#1 map')\n<mask token>\nprint(new_list)\nprint('\\n#2 reduce')\n<mask token>\nprint(reduce_data)\n",
"step-3": "<mask token>\nprint('#1 map')\na_list = [2, 18, 9, 22, 17, 24, 8, ... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python
#coding:utf-8
import os
def listDir(path):
allFile = []
subFile = os.listdir(path) #列出当前路径下的目录或者文件,返回列表
for fileName in subFile:
fullFile = os.path.join(path, fileName) #os提供方法连接路径与文件名形成完整路径名,作用同:字符串+“/”+字符串
if os.path.isdir(fullFile): #判断是否为目录或者文件,有isfil... | normal | {
"blob_id": "a4f446d6fd2a34c0ef591d7cbda59dccc0a36611",
"index": 2069,
"step-1": "#!/usr/bin/env python\n#coding:utf-8\n\nimport os\n\ndef listDir(path):\n allFile = []\n subFile = os.listdir(path) #列出当前路径下的目录或者文件,返回列表\n for fileName in subFile:\n fullFile = os.path.join(path, fileName) ... | [
0
] |
<|reserved_special_token_0|>
def patientSelect(CONN, staff):
c = CONN.cursor()
print('Search for Patient')
select = input("Enter patient name(type 'exit' to leave): ")
if select == 'exit':
os.system('clear')
return
c.execute('SELECT hcno, name FROM patients WHERE name LIKE ?', ('%'... | flexible | {
"blob_id": "b3b4d27b60c71cbd979ad4887fa80408665ea1ac",
"index": 2853,
"step-1": "<mask token>\n\n\ndef patientSelect(CONN, staff):\n c = CONN.cursor()\n print('Search for Patient')\n select = input(\"Enter patient name(type 'exit' to leave): \")\n if select == 'exit':\n os.system('clear')\n ... | [
7,
9,
11,
12,
13
] |
import random
import HardMode
import EasyMode
#Intro function, gets user input of game start, instructions, and game mode
def introduction():
like_to_play = int(input ("Welcome to Rock Paper Scissors, would you like to play? (1 = yes, 2 = no) "))
#like_to_play = int(like_to_play)
#need to set y/n variables... | normal | {
"blob_id": "31246a2e022f3c5b0ce68bb06422307439cbd9b6",
"index": 4272,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef introduction():\n like_to_play = int(input(\n 'Welcome to Rock Paper Scissors, would you like to play? (1 = yes, 2 = no) '\n ))\n if like_to_play == 1:\n ... | [
0,
1,
2,
3,
4
] |
import sqlparse
f = open("parse.sql")
go = open("struct.go", "w+")
dictiony = {
"uuid": "string",
"varchar": "string",
"timestamp": "time.Time",
"int": "int",
"text": "string",
"dbname": "IndividualContrAgent",
"interface": "IndividualContrAgentI",
"ica":"ica"
}
#package
go.write("packa... | normal | {
"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
] |
<|reserved_special_token_0|>
class Planet:
def __init__(self, x, y, radius):
self.radius = radius
self.x = x
self.y = y
canvas = Screen()
canvas.setup(800, 800)
self.turtle = Turtle()
<|reserved_special_token_0|>
def scaleSize(self, scale):
self.ra... | flexible | {
"blob_id": "668b63d1f1bd035226e3e12bc6816abc897affc3",
"index": 9975,
"step-1": "<mask token>\n\n\nclass Planet:\n\n def __init__(self, x, y, radius):\n self.radius = radius\n self.x = x\n self.y = y\n canvas = Screen()\n canvas.setup(800, 800)\n self.turtle = Turtle... | [
4,
6,
7,
8,
9
] |
from slistener import SListener
from slistener import track
import datetime
import time, tweepy, sys
import json
import re
#def tweet_collector():
consumer_key='qpUR91PwjvChszV0VFgrc4Hje'
consumer_secret='q9mPUZE2OsFbaqKUF32ZsY1ry4anZ1k8pNSne56wc3HInmERFu'
access_token='2845943577-R0g6YRlrdEqSFb2mKy5HXuByQPdpq4TLGrPkm... | normal | {
"blob_id": "606e40dd073c3efc95ef01a08466fd536a28f140",
"index": 324,
"step-1": "from slistener import SListener\nfrom slistener import track\nimport datetime\nimport time, tweepy, sys\nimport json\nimport re\n\n#def tweet_collector():\nconsumer_key='qpUR91PwjvChszV0VFgrc4Hje'\nconsumer_secret='q9mPUZE2OsFbaqKUF... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if os.environ.get('DISPLAY', '') == '':
print('no display found. Using non-interactive Agg backend')
mpl.use('Agg')
<|reserved_special_token_0|>
sys.path.append(path_to_utils)
<|reserved_special_token_0|>
print('using the ... | flexible | {
"blob_id": "b4454d92ab8380e0eded2f7aed737378e1710c72",
"index": 9413,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif os.environ.get('DISPLAY', '') == '':\n print('no display found. Using non-interactive Agg backend')\n mpl.use('Agg')\n<mask token>\nsys.path.append(path_to_utils)\n<mask token>\n... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class MoveDigState(State):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class MoveDigState(State):
def __init__(self):
super().__init__('MoveDig', 'ScanDig')
... | flexible | {
"blob_id": "ce4ecff2012cfda4a458912713b0330a218fa186",
"index": 873,
"step-1": "<mask token>\n\n\nclass MoveDigState(State):\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass MoveDigState(State):\n\n def __init__(self):\n super().__init__('MoveDig', 'ScanDi... | [
1,
2,
4,
5,
6
] |
from collections import defaultdict
def solve(n, seq):
flag = True
# slot = [0] * (n + 10)
freq = defaultdict()
# refer to next free slot
i = 1
p = len(seq)
j = 0
while j < p:
c = seq[j]
if i > n:
flag = False
break
if c in freq.keys():
... | normal | {
"blob_id": "89b03bb5ca86e426459e23866f86f8770e4a1613",
"index": 3420,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef solve(n, seq):\n flag = True\n freq = defaultdict()\n i = 1\n p = len(seq)\n j = 0\n while j < p:\n c = seq[j]\n if i > n:\n flag = Fals... | [
0,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class build_ext_and_proto(build_ext):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if not CUDA_HOME:
path_to_cuda_gdb = shutil.which('cuda-gdb')
if path_to_cuda_gdb is None:
raise OSError(
... | flexible | {
"blob_id": "b3095f181032727544ce3ee6f1ad3a70976c0061",
"index": 7892,
"step-1": "<mask token>\n\n\nclass build_ext_and_proto(build_ext):\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\nif not CUDA_HOME:\n path_to_cuda_gdb = shutil.which('cuda-gdb')\n if path_to_cuda_gdb is None:\n ... | [
1,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class DatabaseConnection:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def connect(self):
self.conn = MySQLdb.connect(host=self.address, port=3306, user=self
.user, passwd=self.password, db=self.database)
c = self.conn.cursor()
... | flexible | {
"blob_id": "c6502d6b589fa75dfbd5946a1097e77fc0b472c4",
"index": 1126,
"step-1": "<mask token>\n\n\nclass DatabaseConnection:\n <mask token>\n <mask token>\n\n def connect(self):\n self.conn = MySQLdb.connect(host=self.address, port=3306, user=self\n .user, passwd=self.password, db=sel... | [
5,
6,
7,
8,
11
] |
inp = int(input())
print(bytes(inp))
| normal | {
"blob_id": "63a2c8b0c2eba2d5f9f82352196ef2b67d4d63b5",
"index": 3838,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(bytes(inp))\n",
"step-3": "inp = int(input())\nprint(bytes(inp))\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
<|reserved_special_token_0|>
class RtlConverter(object):
def __init__(self, filelist, topmodule='userlogic', include=None,
define=None, single_clock=False):
self.filelist = filelist
self.topmodule = topmodule
self.include = include
self.define = define
self.single_... | flexible | {
"blob_id": "55ffcf5e6120cc07da461e30979dd8a36a599bee",
"index": 8353,
"step-1": "<mask token>\n\n\nclass RtlConverter(object):\n\n def __init__(self, filelist, topmodule='userlogic', include=None,\n define=None, single_clock=False):\n self.filelist = filelist\n self.topmodule = topmodule... | [
7,
8,
9,
10,
11
] |
from django.shortcuts import render, redirect
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.contrib.admin.views.decorators import staff_member_required
from lessons.models import Lesson, Question, Response
from usermanage.models import SchoolClass
import json... | normal | {
"blob_id": "ee417c5fff858d26ca60a78dffe4cff503a6f2b5",
"index": 6824,
"step-1": "<mask token>\n\n\n@login_required\ndef lessons_overview(request):\n if request.method == 'POST':\n if request.user.is_staff:\n school_class = SchoolClass.objects.get(id=request.POST['class_id'])\n sc... | [
7,
8,
9,
10,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def train_test_split(X, y, test_ratio=0.2, seed=None):
"""将数据X和y按照test_ratio分割成X_train,X_test,y_train,y_test"""
assert X.shape[0] == y.shape[0
], 'the size of X must be equal to the size of y'
assert 0.0 <= t... | flexible | {
"blob_id": "beda3d13e3dc12f7527f5c5ba8a0eb05c2734fd9",
"index": 6133,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef train_test_split(X, y, test_ratio=0.2, seed=None):\n \"\"\"将数据X和y按照test_ratio分割成X_train,X_test,y_train,y_test\"\"\"\n assert X.shape[0] == y.shape[0\n ], 'the size of... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class BaseResource(Resource):
<|reserved_special_token_0|>
def __init__(self, *args, **kwargs):
super(BaseResource, self).__init__(*args, **kwargs)
self._user = None
<|reserved_special_token_0|>
@property
def current_user(self):
return current... | flexible | {
"blob_id": "71cdddfdd7c1327a8a77808dbdd0ff98d827231f",
"index": 945,
"step-1": "<mask token>\n\n\nclass BaseResource(Resource):\n <mask token>\n\n def __init__(self, *args, **kwargs):\n super(BaseResource, self).__init__(*args, **kwargs)\n self._user = None\n <mask token>\n\n @property... | [
5,
6,
7,
8,
11
] |
from django.contrib import admin
# Register your models here.
from blog.models import Post,Category,Profile
admin.site.register(Profile)
admin.site.register(Category)
admin.site.register(Post) | normal | {
"blob_id": "20f0de097fdd8f2a435c06a73c6a90cc7ebc69ad",
"index": 4014,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nadmin.site.register(Profile)\nadmin.site.register(Category)\nadmin.site.register(Post)\n",
"step-3": "from django.contrib import admin\nfrom blog.models import Post, Category, Profile\n... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def create_app(settings_override={}):
app = Flask(__name__)
app.config.from_object('zezin.settings.Configuration')
app.config.update(settings_override)
db.init_app(app)
from zezin.views import partners_routes... | flexible | {
"blob_id": "6affc182f5d3353d46f6e9a21344bc85bf894165",
"index": 948,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef create_app(settings_override={}):\n app = Flask(__name__)\n app.config.from_object('zezin.settings.Configuration')\n app.config.update(settings_override)\n db.init_app(... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python
import numpy as np
import time, random
import sys, os, struct, socket
import psycopg2
import test_coords
import alex_random
import new_sim_utils
import sdr_kml_writer
from geo_utils import geo_utils
from beacon import beacon
from sim_data import data_utils
ENABLE_JITTER = False
ENABLE_DROPPED_... | normal | {
"blob_id": "530c2c185e57ffd3ac64628fc9f7f7985b0480fe",
"index": 5529,
"step-1": "#!/usr/bin/env python\n\nimport numpy as np\nimport time, random\nimport sys, os, struct, socket\nimport psycopg2\n\nimport test_coords\nimport alex_random\nimport new_sim_utils\nimport sdr_kml_writer\n\nfrom geo_utils import geo_u... | [
0
] |
<|reserved_special_token_0|>
def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument('--data_dir', type=str, required=True, help=
'dir holding sequences as separate files')
parser.add_argument('--maxlen', type=int, default=500, help=
'maximum length of sequence')
... | flexible | {
"blob_id": "da55d9a6534525e58b6c1d2db997e90a1c9b0f36",
"index": 1427,
"step-1": "<mask token>\n\n\ndef parse_arguments():\n parser = argparse.ArgumentParser()\n parser.add_argument('--data_dir', type=str, required=True, help=\n 'dir holding sequences as separate files')\n parser.add_argument('--... | [
2,
3,
4,
5,
6
] |
a, b = map(int, input().split())
def mult(a, b):
if a > 9 or b > 9 or a < 1 or b < 1:
print(-1)
else:
print(a * b)
mult(a, b)
| normal | {
"blob_id": "991fa5f9c83a1821e62f7baacbc56a4d31982312",
"index": 3681,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef mult(a, b):\n if a > 9 or b > 9 or a < 1 or b < 1:\n print(-1)\n else:\n print(a * b)\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef mult(a, b):\n ... | [
0,
1,
2,
3
] |
"""
Make sure overwriting read-only files works as expected (via win-tool).
"""
import TestGyp
import filecmp
import os
import stat
import sys
if sys.platform == 'win32':
test = TestGyp.TestGyp(formats=['ninja'])
os.makedirs('subdir')
read_only_files = ['read-only-file', 'subdir/A', 'subdir/B', 'subd... | normal | {
"blob_id": "efe5921afb160b7b5a953cdd0c2f90f64b5f34c9",
"index": 5975,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif sys.platform == 'win32':\n test = TestGyp.TestGyp(formats=['ninja'])\n os.makedirs('subdir')\n read_only_files = ['read-only-file', 'subdir/A', 'subdir/B', 'subdir/C']\n fo... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class ReleaseFile:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __repr__(self):
return repr(self.name)
class SourceFile:
"""! Class represeting a source file
`name`: str
File name,
`url`: str
FTP URL,
`group`
... | flexible | {
"blob_id": "612b1851ba5a07a277982ed5be334392182c66ef",
"index": 4064,
"step-1": "<mask token>\n\n\nclass ReleaseFile:\n <mask token>\n <mask token>\n\n def __repr__(self):\n return repr(self.name)\n\n\nclass SourceFile:\n \"\"\"! Class represeting a source file\n\n `name`: str\n Fil... | [
8,
10,
11,
12,
14
] |
<|reserved_special_token_0|>
class Account:
def __init__(self, name, balance):
self.name = name
self.balance = balance
def deposit(self, money):
self.balance += money
return 'Deposit accepted'
def withdraw(self, moneytaken):
if self.balance < moneytaken:
... | flexible | {
"blob_id": "f91e997b305348485698d180b97138b040285b60",
"index": 9440,
"step-1": "<mask token>\n\n\nclass Account:\n\n def __init__(self, name, balance):\n self.name = name\n self.balance = balance\n\n def deposit(self, money):\n self.balance += money\n return 'Deposit accepted'... | [
5,
15,
16,
19,
20
] |
# from models import dist_model
# model = dist_model.DistModel()
from os.path import join
import models
import util.util as util
import matplotlib.pylab as plt
use_gpu = True
fig_outdir = r"C:\Users\ponce\OneDrive - Washington University in St. Louis\ImageDiffMetric"
#%%
net_name = 'squeeze'
SpatialDist = models.Percep... | normal | {
"blob_id": "8fcbaf2663c22015a0c47f00c2d4fb8db6a5c308",
"index": 6209,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif use_gpu:\n img0 = img0.cuda()\n<mask token>\nif use_gpu:\n img1 = img1.cuda()\n<mask token>\nplt.figure(figsize=[9, 3.5])\nplt.subplot(131)\nplt.imshow(img0_)\nplt.subplot(132)\n... | [
0,
1,
2,
3,
4
] |
from locations.storefinders.storelocatorwidgets import StoreLocatorWidgetsSpider
class Pharmacy4LessAUSpider(StoreLocatorWidgetsSpider):
name = "pharmacy_4_less_au"
item_attributes = {"brand": "Pharmacy 4 Less", "brand_wikidata": "Q63367608"}
key = "6c0hBJeL5yk8cmaKJGNjTu0JhWNaMQpX"
| normal | {
"blob_id": "aad3c104432a1a028d96263236133e495536ee69",
"index": 6644,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Pharmacy4LessAUSpider(StoreLocatorWidgetsSpider):\n <mask token>\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Pharmacy4LessAUSpider(StoreLocat... | [
0,
1,
2,
3,
4
] |
def get_perms(string):
toRtn = []
freq_table = count_letters(string)
get_perms_helper(freq_table, "", len(string), toRtn)
return toRtn
def count_letters(string):
freq = {}
for letter in string:
if letter not in freq:
freq[letter] = 0
freq[letter] += 1
return freq... | normal | {
"blob_id": "719a993e1f5c5d1e803b04a5561373f2b9a5a5c2",
"index": 8524,
"step-1": "def get_perms(string):\n toRtn = []\n freq_table = count_letters(string)\n get_perms_helper(freq_table, \"\", len(string), toRtn)\n return toRtn\n\ndef count_letters(string):\n freq = {}\n for letter in string:\n ... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while True:
xp, yp = set(), set()
veneer = []
W, H = map(int, input().split())
if not W:
break
N = int(input())
for i in range(N):
x1, y1, x2, y2 = map(int, input().split())
veneer.a... | flexible | {
"blob_id": "e0fbb5ad6d822230865e34c1216b355f700e5cec",
"index": 7822,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile True:\n xp, yp = set(), set()\n veneer = []\n W, H = map(int, input().split())\n if not W:\n break\n N = int(input())\n for i in range(N):\n x1, y1, ... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
import os
import tempfile
import shutil
import math
import sys
import subprocess
from irank.config import IrankOptionParser, IrankApp
from irank import db as irank_db
STATUS = 0
def main():
p = IrankOptionParser('%prog -d DEST playlist_name [playlist_name ...]')
p.add_option('-d', '--dest', he... | normal | {
"blob_id": "df64d769ffba8cddac34282a526122e3c941249d",
"index": 245,
"step-1": "#!/usr/bin/env python\nimport os\nimport tempfile\nimport shutil\nimport math\nimport sys\nimport subprocess\n\nfrom irank.config import IrankOptionParser, IrankApp\nfrom irank import db as irank_db\nSTATUS = 0\n\ndef main():\n\tp =... | [
0
] |
<|reserved_special_token_0|>
class Map:
<|reserved_special_token_0|>
def __init__(self, size, num_feeds):
self.size = size
self.map_cells = np.zeros((self.size, self.size))
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def createCell(self, pos):
if self.map_ce... | flexible | {
"blob_id": "ab0c3cf3e43f34874dd94629b746ca1237c3349a",
"index": 7494,
"step-1": "<mask token>\n\n\nclass Map:\n <mask token>\n\n def __init__(self, size, num_feeds):\n self.size = size\n self.map_cells = np.zeros((self.size, self.size))\n <mask token>\n <mask token>\n\n def createCe... | [
21,
26,
27,
32,
34
] |
<|reserved_special_token_0|>
def query_doc(cursor, lang, title):
cursor.execute(index_db.select_lang_title, (lang, title))
result = cursor.fetchone()
if not result:
return None
return {'lang': result[0], 'doc_id': result[1], 'doc_path': result[2],
'title': result[4], 'begin': result[5]... | flexible | {
"blob_id": "95e7e025660e71cbdf6a6a0812964fc26d4beec0",
"index": 9657,
"step-1": "<mask token>\n\n\ndef query_doc(cursor, lang, title):\n cursor.execute(index_db.select_lang_title, (lang, title))\n result = cursor.fetchone()\n if not result:\n return None\n return {'lang': result[0], 'doc_id':... | [
2,
3,
4,
5,
6
] |
import torch
import torchvision.transforms.functional as F
import numpy as np
import yaml
from pathlib import Path
IGNORE_LABEL = 255
STATS = {
"vit": {"mean": (0.5, 0.5, 0.5), "std": (0.5, 0.5, 0.5)},
"deit": {"mean": (0.485, 0.456, 0.406), "std": (0.229, 0.224, 0.225)},
}
def seg_to_rgb(seg, colors):
i... | normal | {
"blob_id": "6c641ace8f1e5e8c42fa776bd7604daf243f9a41",
"index": 2113,
"step-1": "<mask token>\n\n\ndef dataset_cat_description(path, cmap=None):\n desc = yaml.load(open(path, 'r'), Loader=yaml.FullLoader)\n colors = {}\n names = []\n for i, cat in enumerate(desc):\n names.append(cat['name'])\... | [
2,
4,
5,
6,
7
] |
import argparse
from flower_classifier import FlowerClassifier
from util import *
parser = argparse.ArgumentParser()
parser.add_argument("data_dir", help="path to training images")
parser.add_argument("--save_dir", default=".", help="path where checkpoint is saved")
parser.add_argument("--arch", default="vgg11", help=... | normal | {
"blob_id": "0c3947a1699c78080661a55bbaa9215774b4a18e",
"index": 4751,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nparser.add_argument('data_dir', help='path to training images')\nparser.add_argument('--save_dir', default='.', help=\n 'path where checkpoint is saved')\nparser.add_argument('--arch',... | [
0,
2,
3,
4,
5
] |
valor1=input("Ingrese Primera Cantidad ")
valor2=input("Ingrese Segunda Cantidad ")
Total = valor1 + valor2
print "El total es: " + str(Total)
| normal | {
"blob_id": "5c179752f4c4e1d693346c6edddd79211a895735",
"index": 8685,
"step-1": "valor1=input(\"Ingrese Primera Cantidad \")\nvalor2=input(\"Ingrese Segunda Cantidad \")\nTotal = valor1 + valor2\nprint \"El total es: \" + str(Total)\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"... | [
0
] |
<|reserved_special_token_0|>
class Items(db.Model):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
... | flexible | {
"blob_id": "ad622ff2e1d9286246b2175694a9ae796f8d2557",
"index": 7535,
"step-1": "<mask token>\n\n\nclass Items(db.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, email, item, descrip... | [
2,
5,
6,
7,
8
] |
import pickle
import time
start = time.time()
f = open('my_classifier.pickle', 'rb')
cl = pickle.load(f)
f.close()
print(cl.classify("Where to travel in bangalore ?"))
print(cl.classify("Name a golf course in Myrtle beach ."))
print(cl.classify("What body of water does the Danube River flow into ?"))
#print("Accuracy... | normal | {
"blob_id": "82a3fca0261b4bde43f7bf258bb22e5b2ea8c28d",
"index": 5370,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nf.close()\nprint(cl.classify('Where to travel in bangalore ?'))\nprint(cl.classify('Name a golf course in Myrtle beach .'))\nprint(cl.classify('What body of water does the Danube River fl... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
lc_headers = {'User-Agent':
'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15'
, 'authority': 'leetcode.com'}
lc_all = 'https://leetcode.com/api/problems/all/'
lc_submissions = (
'h... | flexible | {
"blob_id": "f715628da2f1b950b8fbf8aa5b033e5299d3e224",
"index": 7857,
"step-1": "<mask token>\n",
"step-2": "lc_headers = {'User-Agent':\n 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15'\n , 'authority': 'leetcode.com'}\nlc_all = 'http... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if len(inspect_tables) == 0:
for k, t in enumerate(tickers):
ticker_data = pd.DataFrame()
try:
ticker_data = wb.DataReader(t, data_source='yahoo', start=start_1)
ticker_data.to_sql(table... | flexible | {
"blob_id": "cee77a97503cca517d03ce7cce189974da282a03",
"index": 2500,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif len(inspect_tables) == 0:\n for k, t in enumerate(tickers):\n ticker_data = pd.DataFrame()\n try:\n ticker_data = wb.DataReader(t, data_source='yahoo', star... | [
0,
1,
2,
3,
4
] |
#
# PySNMP MIB module SYSLOG-TC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SYSLOG-TC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:31:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | normal | {
"blob_id": "46cdea08cab620ea099ad7fa200782717249b91b",
"index": 6741,
"step-1": "<mask token>\n\n\nclass SyslogSeverity(TextualConvention, Integer32):\n reference = 'The Syslog Protocol (RFC5424): Table 2'\n status = 'current'\n subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(\n SingleVal... | [
2,
4,
5,
6,
7
] |
<|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": "9555ed63b3906ec23c31839691a089aad9d96c63",
"index": 9917,
"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 = [('training_ar... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
from .. import dataclass
<|reserved_special_token_1|>
from .. import dataclass # trigger the register in the dataclass package
| flexible | {
"blob_id": "681750dbf489a6a32e9ef1d6f64d493cc252b272",
"index": 6386,
"step-1": "<mask token>\n",
"step-2": "from .. import dataclass\n",
"step-3": "from .. import dataclass # trigger the register in the dataclass package\r\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
# -*- coding: utf-8 -*-
import hashlib
import time
from datetime import datetime, timedelta
# 像访问对象一样, 访问字典
class ObjectLikeDict(dict):
def __getattr__(self, name):
try:
return self[name]
except:
return ''
# 合并字典
def merge_dict(dict1, dict2):
return (lambda a, b: (lam... | normal | {
"blob_id": "f1c32fe7a29cddf4f881b46f4feab06390a76a44",
"index": 7516,
"step-1": "# -*- coding: utf-8 -*-\nimport hashlib\nimport time\nfrom datetime import datetime, timedelta\n\n# 像访问对象一样, 访问字典\nclass ObjectLikeDict(dict):\n def __getattr__(self, name):\n try:\n return self[name]\n ... | [
0
] |
import sys
from PyQt5 import uic
from PyQt5.QtWidgets import QWidget
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPixmap
class Instruction(QWidget):
def __init__(self):
super().__init__()
# Set UI file
uic.loadUi('../ui/instruction.ui', self)
# Connect handlers of buttons... | normal | {
"blob_id": "da30cea4cfb1ffccabe708fe15e5a633b06d299f",
"index": 2265,
"step-1": "<mask token>\n\n\nclass Instruction(QWidget):\n <mask token>\n\n def set_background_instruction(self):\n img = QPixmap('../images/background_instruction.jpg')\n self.background_instruction.setPixmap(img)\n <m... | [
2,
3,
4,
5,
6
] |
import pandas as pd
from sklearn.pipeline import Pipeline
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.svm import LinearSVC
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
if __name__ == "__main__":
dataset = pd.read_csv('./dataset.... | normal | {
"blob_id": "f82c961fc1accd362b34a685bac4cc35d98f44ef",
"index": 6371,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n dataset = pd.read_csv('./dataset.csv')\n X_train, X_test, y_train, y_test = train_test_split(dataset['text'],\n dataset['label'], test_size=0.2, ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class Pessoa:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def compara(self, outro_agente):
if self.distancia > outro_agente.distancia:
return True
else:
return False
def adiciona_sorte(self):
self.adiciona_dis... | flexible | {
"blob_id": "d18bfdb606e4ba8a67acbb07cd9a3a6d2a0855e3",
"index": 6880,
"step-1": "<mask token>\n\n\nclass Pessoa:\n <mask token>\n <mask token>\n\n def compara(self, outro_agente):\n if self.distancia > outro_agente.distancia:\n return True\n else:\n return False\n\n ... | [
4,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with open(sys.argv[1], 'r') as test_cases:
for test in test_cases:
stringe = test.strip()
list1 = stringe.split(' | ')
list2 = list1[0].split(' ')
kha = 0
for item in list2:
... | flexible | {
"blob_id": "def2721cd89501b1004d5d3f4f58df300616c1be",
"index": 2747,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open(sys.argv[1], 'r') as test_cases:\n for test in test_cases:\n stringe = test.strip()\n list1 = stringe.split(' | ')\n list2 = list1[0].split(' ')\n ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class DimerGridSearch(BaseDriver_):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class DimerGridSearch(BaseDriver_):
<|reserved_special_token_0|>
def __init__(self, folder='', min_sr=0.75, max_sr=... | flexible | {
"blob_id": "9db4bca3e907d70d9696f98506efb6d6042b5723",
"index": 6710,
"step-1": "<mask token>\n\n\nclass DimerGridSearch(BaseDriver_):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass DimerGridSearch(BaseDriver_):\n <mask token>\n\n def __init__(self, folder='', min_sr=0.75, ma... | [
1,
2,
3,
4,
5
] |
import json
startTime = ""
endTime = ""
controller = 0
for files in range(30):
file = open("NewResults" + str(files+1) + ".data")
for line in file:
if line != "\n":
j = json.loads(line)
if controller == 0:
startTime = j['metrics'][0]['startTime']
helper = startTime.split(" ")
hour = helper[1].sp... | normal | {
"blob_id": "03284f20e614a5f8f5c21939acf49490d6ffd3a3",
"index": 7812,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor files in range(30):\n file = open('NewResults' + str(files + 1) + '.data')\n for line in file:\n if line != '\\n':\n j = json.loads(line)\n if contr... | [
0,
1,
2,
3,
4
] |
import pygame
class MenuManager():
def __init__(self, manager):
print "Menu manager created. Continue? [y/n]"
self.manager = manager
self.paused = False
self.intro_done = False
self.menus = []
self.menus.append(Pause_menu(self))
self.menus.append(St... | normal | {
"blob_id": "f0ac2e66cc7fe9730c77a8feb77a74e26986a3f8",
"index": 1380,
"step-1": "import pygame\r\n\r\nclass MenuManager():\r\n def __init__(self, manager):\r\n print \"Menu manager created. Continue? [y/n]\"\r\n self.manager = manager\r\n self.paused = False\r\n self.intro_done = ... | [
0
] |
""" Utility functions and classes for SRP
Context : SRP
Module : Statsistics
Version : 1.0.0
Author : Stefano Covino
Date : 04/04/2013
E-mail : stefano.covino@brera.inaf.it
URL: : http://www.merate.mi.astro.it/utenti/covino
Usage : to be imported
Remarks : inputs are a 1D vectors to be cross-correlated. O... | normal | {
"blob_id": "c62ffcaa9095d772e51be086be349d200346bc22",
"index": 9662,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef XCorr_1D(data, refdata, xdata=None):\n if data.ndim == 1 and refdata.ndim == 1:\n ycorr = numpy.correlate(data, refdata, mode='full')\n xcorr = numpy.arange(ycorr... | [
0,
1,
2,
3
] |
'''
syntax of if-elif-else
if <condition> :
code to be
executed in
this condition
elif <new condition> :
cdode tbd
some code
else :
code runs in the else condigtion
this can all be multiline code
'''
a = 3
b = 2
if a == b :
print "Values are equal"
elif a < b :
print "a is less than b"
else:
print "b... | normal | {
"blob_id": "d7ce6efa72c9b65d3dd3ce90f9d1f2dd8a889d26",
"index": 444,
"step-1": "\n'''\nsyntax of if-elif-else\n\nif <condition> :\n\tcode to be\n\texecuted in\n\tthis condition\nelif <new condition> :\n\tcdode tbd\n\tsome code\nelse :\n\tcode runs in the else condigtion\n\tthis can all be multiline code\n\n'''\... | [
0
] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-12-19 15:17
from __future__ import absolute_import
from __future__ import unicode_literals
from django.db import migrations, models
from django.db.models import Count
from tqdm import tqdm
def remove_duplicate_legal_reasons(apps, purpose_slug, source_obje... | normal | {
"blob_id": "6c86b4823756853bb502b34492ac8ad0a75daf7e",
"index": 7036,
"step-1": "<mask token>\n\n\ndef remove_duplicate_legal_reasons(apps, purpose_slug,\n source_object_content_type, source_object_id):\n LegalReason = apps.get_model(u'gdpr', u'LegalReason')\n duplicate_legal_reason_qs = LegalReason.ob... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in range(B):
p1 = 0.0
for j in range(N1):
if rnd.uniform(0, 1) < p1mle:
p1 += 1
p1 /= N1
p2 = 0.0
for j in range(N2):
if rnd.uniform(0, 1) < p2mle:
p2 += 1
p2 /... | flexible | {
"blob_id": "0db0daf9bea254cffaec1280cd13b2d70368cd94",
"index": 289,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(B):\n p1 = 0.0\n for j in range(N1):\n if rnd.uniform(0, 1) < p1mle:\n p1 += 1\n p1 /= N1\n p2 = 0.0\n for j in range(N2):\n if rnd.u... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if subject == '电子信息工程' and age > 25 or subject == '电子信息工程' and college == '是' or age < 28 and subject == '计算机':
print('恭喜您被录取!')
else:
print('抱歉,您未达到面试要求')
<|reserved_special_token_1|>
age = int(input('请输入您的年龄:'))
subje... | flexible | {
"blob_id": "4282303e3e6ee122f1379bea73c619870f983f61",
"index": 8580,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif subject == '电子信息工程' and age > 25 or subject == '电子信息工程' and college == '是' or age < 28 and subject == '计算机':\n print('恭喜您被录取!')\nelse:\n print('抱歉,您未达到面试要求')\n",
"step-3": "age... | [
0,
1,
2,
3
] |
from manim import *
class SlidingDoorIllustration(Scene):
def construct(self):
waiting_room = Rectangle(color=BLUE, stroke_width=8)
waiting_room.shift(LEFT + DOWN)
workspace = Rectangle(color=BLUE, stroke_width=8)
workspace.next_to(waiting_room, RIGHT + UP, buff=0)
workspac... | normal | {
"blob_id": "e93d5461a2604d3b8015489397c68e16d1cb222e",
"index": 3695,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass SlidingDoorIllustration(Scene):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass SlidingDoorIllustration(Scene):\n\n def construct(self):\n waiting_room = Re... | [
0,
1,
2,
3,
4
] |
from selenium import webdriver
from time import sleep
from bs4 import BeautifulSoup
"""
With selenium we need web driver for our browser.
If you use google chrome, you can download chrome driver from here:
http://chromedriver.chromium.org/downloads
In linux (my OS) I extracted downloaded zip file and pla... | normal | {
"blob_id": "03b2b722832eb46f3f81618f70fd0475f1f08c94",
"index": 2997,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ndriver.get('https://www.facebook.com')\n<mask token>\nprint(soup.prettify())\ndriver.close()\n",
"step-3": "<mask token>\ndriver = webdriver.Chrome('/Users/UserName/Downloads/chromedriv... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def XCorr_1D(data, refdata, xdata=None):
if data.ndim == 1 and refdata.ndim == 1:
ycorr = numpy.correlate(data, refdata, mode='full')
xcorr = numpy.arange(ycorr.size)
lags = xcorr - (data.size - 1)
... | flexible | {
"blob_id": "c62ffcaa9095d772e51be086be349d200346bc22",
"index": 9662,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef XCorr_1D(data, refdata, xdata=None):\n if data.ndim == 1 and refdata.ndim == 1:\n ycorr = numpy.correlate(data, refdata, mode='full')\n xcorr = numpy.arange(ycorr... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class EdgeListError(ValueError):
pass
<|reserved_special_token_0|>
class AdjacencyMatrixError(ValueError):
pass
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class EdgeListError(ValueError):
pass
<|reserved_special_token_0|... | flexible | {
"blob_id": "cdbc7d703da69adaef593e6a505be25d78beb7ce",
"index": 7815,
"step-1": "<mask token>\n\n\nclass EdgeListError(ValueError):\n pass\n\n\n<mask token>\n\n\nclass AdjacencyMatrixError(ValueError):\n pass\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass EdgeListError(ValueError):\n pass\n... | [
2,
4,
5,
6,
8
] |
import os
import json
import codecs
import markdown
from flask import current_app
def get_json_file(filename, lang='en'):
"""
Get the contents of a JSON file.
"""
filepath = os.path.join(current_app.config['APP_PATH'], 'data', filename)
with open(filepath, 'r') as f:
return json.loads(... | normal | {
"blob_id": "213ab22a269abc8180524462a8966e5d929ef7d1",
"index": 322,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_markdown_file(name, lang='en'):\n \"\"\"\n Get the contents of a markdown file.\n \"\"\"\n filename_temp = '{0}_{1}.markdown'\n md_dir = os.path.join(current_app... | [
0,
1,
2,
3,
4
] |
from api import url, key, opposite
import requests
import json
import time
import os
from miner import mine
from cpu import *
class Player:
def __init__(self):
data = self._get_status()
time.sleep(data['cooldown'])
self.name = data['name']
self.cooldown = data['cooldown']
s... | normal | {
"blob_id": "edd70f55e76418911d304d6eb41a6d2a93005a58",
"index": 890,
"step-1": "<mask token>\n\n\nclass Player:\n\n def __init__(self):\n data = self._get_status()\n time.sleep(data['cooldown'])\n self.name = data['name']\n self.cooldown = data['cooldown']\n self.encumbranc... | [
11,
15,
17,
19,
21
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class NodoLista:
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class NodoLista:
def __init__(self, cancion, s, a):
self.elemento = cancion
self.siguiente = s... | flexible | {
"blob_id": "1fb3904d48905ade8f83b6e052057e80302ec5a7",
"index": 4253,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass NodoLista:\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass NodoLista:\n\n def __init__(self, cancion, s, a):\n self.elemento = cancion\n self.siguien... | [
0,
1,
2,
3
] |
import os
import numpy as np
from argparse import ArgumentParser
from tqdm import tqdm
from models.networks import Perceptron
from data.perceptron_dataset import Dataset, batchify
from utils.utils import L1Loss, plot_line
from modules.perceptron_trainer import Trainer
if __name__ == '__main__':
parser = Argumen... | normal | {
"blob_id": "726aaa0ef129f950e6da6701bb20e893d2f7373b",
"index": 3823,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n parser = ArgumentParser()\n parser.add_argument('--name', type=str, default='test')\n parser.add_argument('--input_dim', type=int, default=2)\n pa... | [
0,
1,
2,
3
] |
import time
class Solution(object):
def __init__(self):
self.n = None
self.memory = dict()
def dfs(self, bottom, energy):
# optimize for memory, save search time for duplicate results
if (bottom,energy) in self.memory:
return self.memory[(bottom,energy)]
... | normal | {
"blob_id": "d52b6dda7111aefb7f9a7b10ad606cda615389d9",
"index": 7123,
"step-1": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n\n def dfs(self, bottom, energy):\n if (bottom, energy) in self.memory:\n return self.memory[bottom, energy]\n if energy == 1:\n re... | [
3,
5,
7,
8,
10
] |
# ----------------------
#
# *** WELCOME TO "HANGMAN" GAME ***
# Let's start programming
#
# ----------------------
def displayBoard(missedLetters, correctLetters, secretWord, alfabet_board, theme):
print(hangnam_pics[len(missedLetters)])
print("Тема:", theme)
# Показываем состояние угадываемого сло... | normal | {
"blob_id": "720ab0c0fcb40a50d73770e4ada6a78465e9ff96",
"index": 2755,
"step-1": "def displayBoard(missedLetters, correctLetters, secretWord, alfabet_board,\n theme):\n print(hangnam_pics[len(missedLetters)])\n print('Тема:', theme)\n for index in range(len(secretWord)):\n dashed_word = ''\n ... | [
4,
6,
8,
9,
10
] |
<|reserved_special_token_0|>
class Table(DashComponent):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Table(DashComponent):
def __init__(self, plot_factory, ... | flexible | {
"blob_id": "485f85ec5e3f38148978453ea5e7f9a54eb310e1",
"index": 160,
"step-1": "<mask token>\n\n\nclass Table(DashComponent):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Table(DashComponent):\n\n def __init__(self, plot_factory, df, title='... | [
1,
3,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for var in var_list:
grid_files = glob.glob(data_root + 'gridded/*%s*%s.nc' % (eke, var))
for f in grid_files:
output.append(analize_member(f, var, diagnostic_functions))
print('processing %s' % os.path.bas... | flexible | {
"blob_id": "6b727cdfc684db4ba919cd5390fe45de43a806fe",
"index": 309,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor var in var_list:\n grid_files = glob.glob(data_root + 'gridded/*%s*%s.nc' % (eke, var))\n for f in grid_files:\n output.append(analize_member(f, var, diagnostic_functions)... | [
0,
1,
2,
3,
4
] |
# !/usr/bin/python
# coding:utf-8
import requests
from bs4 import BeautifulSoup
import re
from datetime import datetime
#紀錄檔PATH(建議絕對位置)
log_path='./log.txt'
#登入聯絡簿的個資
sid=''#學號(Ex. 10731187)
cid=''#生份證號(Ex. A123456789)
bir=''#生日(Ex. 2000/1/1)
#line or telegram module
#platform='telegram'
platform='line'
if plat... | normal | {
"blob_id": "77f37a80d160e42bb74017a55aa9d06b4c8d4fee",
"index": 4320,
"step-1": "<mask token>\n\n\ndef login_homework():\n res = requests.get('http://www.yphs.tp.edu.tw/tea/tu2.aspx')\n soup = BeautifulSoup(res.text, 'lxml')\n VIEWSTATE = soup.find(id='__VIEWSTATE')\n VIEWSTATEGENERATOR = soup.find(... | [
5,
8,
10,
11,
12
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
_BASE_REPRESENTATIONS = ["Primitive(field='f1', op='eq', value='value')",
"Primitive(field='f1', op='eq', value=42)",
"Primitive(field='f1', op='eq', value=3.14)",
"Primitive(field='f1', op='eq', value=True)",
"Condition(op=Operator.OR, values... | flexible | {
"blob_id": "137842d50355563b2df6c2fc48864c01a22afa80",
"index": 5567,
"step-1": "<mask token>\n",
"step-2": "_BASE_REPRESENTATIONS = [\"Primitive(field='f1', op='eq', value='value')\",\n \"Primitive(field='f1', op='eq', value=42)\",\n \"Primitive(field='f1', op='eq', value=3.14)\",\n \"Primitive(fiel... | [
0,
1,
2
] |
import json
import glob
import argparse
from model.NewModel import runModel
from collections import namedtuple
import csv
OutputFile = "./HealthSimOutputSheet.csv"
parser = argparse.ArgumentParser(description='Select policy file')
parser.add_argument('-p', type=str, default='default', help='name of a a policy file')
... | normal | {
"blob_id": "894ce07c6443208483be2d3ef1409f12f24d99f3",
"index": 2852,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nparser.add_argument('-p', type=str, default='default', help=\n 'name of a a policy file')\nparser.add_argument('-n', type=int, default=100000, help='number of patients')\n<mask token>\... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/python
import pprint
import requests
import string
import subprocess
#Create three files
f_arptable = open( 'arptable', 'w+' )
f_maclist = open( 'maclist', 'w+' )
f_maclookup = open( 'maclookup', 'w+' )
#Give write permissions the three files
subprocess.call([ 'chmod','+w','maclist' ])
subprocess.call([ ... | normal | {
"blob_id": "d566104b00ffd5f08c564ed554e0d71279a93047",
"index": 6394,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsubprocess.call(['chmod', '+w', 'maclist'])\nsubprocess.call(['chmod', '+w', 'arptable'])\nsubprocess.call(['chmod', '+w', 'maclookup'])\nsubprocess.Popen(['arp', '-a'], stdout=f_arptable... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class KernelNC:
<|reserved_special_token_0|>
def __init__(self, classes):
self.classes = classes
def compute_dist(self, X, Y):
K_x = np.dot(X, X.T).toarray()
K_y = np.dot(Y, Y.T).toarray()
K_xy = np.dot(X, Y.T).toarray()
return np.diag... | flexible | {
"blob_id": "6f35c29f6f2dcc6c1dae3e9c1ddf595225748041",
"index": 3018,
"step-1": "<mask token>\n\n\nclass KernelNC:\n <mask token>\n\n def __init__(self, classes):\n self.classes = classes\n\n def compute_dist(self, X, Y):\n K_x = np.dot(X, X.T).toarray()\n K_y = np.dot(Y, Y.T).toar... | [
16,
17,
19,
20,
21
] |
<|reserved_special_token_0|>
class FRSHTTHolder:
frshtt_code = ''
star_count_lst = [0, 0, 0, 0, 0, 0]
counter = 0
def __init__(self, in_frshtt_code):
self.frshtt_code = in_frshtt_code
self.counter = 0
self.star_count_lst = [0, 0, 0, 0, 0, 0]
def is_in_code(self, in_frshtt... | flexible | {
"blob_id": "330b843501e0fdaff21cc4eff1ef930d54ab6e8d",
"index": 747,
"step-1": "<mask token>\n\n\nclass FRSHTTHolder:\n frshtt_code = ''\n star_count_lst = [0, 0, 0, 0, 0, 0]\n counter = 0\n\n def __init__(self, in_frshtt_code):\n self.frshtt_code = in_frshtt_code\n self.counter = 0\n ... | [
11,
13,
15,
19,
23
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def a():
lines = 0
words = 0
letters = 0
for line in open(f'{text}.txt', 'r'):
lines += 1
letters += len(line.strip('.,:-()!?;)"\'\n}'))
words += len(line.split())
return f'Lines = {li... | flexible | {
"blob_id": "2a65287588fe1337ba1a6f7c2e15e0505611d739",
"index": 2228,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef a():\n lines = 0\n words = 0\n letters = 0\n for line in open(f'{text}.txt', 'r'):\n lines += 1\n letters += len(line.strip('.,:-()!?;)\"\\'\\n}'))\n ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in range(2, n + 1):
c = a + b
list.append(c)
a, b = b, c
print(n, 'th fibonacci number is ', list[n])
<|reserved_special_token_1|>
n = int(input('Enter a number: '))
c = 0
a, b = 0, 1
list = [a, b]
for i in ra... | flexible | {
"blob_id": "255cdbce1f9f7709165b1a29362026ad92ba4712",
"index": 2303,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(2, n + 1):\n c = a + b\n list.append(c)\n a, b = b, c\nprint(n, 'th fibonacci number is ', list[n])\n",
"step-3": "n = int(input('Enter a number: '))\nc = 0\na, ... | [
0,
1,
2,
3
] |
from pyplasm import *
doorY = [.2,.18,.08,.18,.08,.18,.4,.18,.08,.18,.08,.18,.2]
doorX = [.2,.5,.2,1.8,.08,.18,.08,.18,.2]
doorOccurrency = [[True]*13,
[True, False, True, False, True, False, True, False, True, False, True, False, True],
[True]*13,
[True, False, True, False, True, False, True, False, T... | normal | {
"blob_id": "9bc955def6250908050a1f3046dd78480f25e0a1",
"index": 1898,
"step-1": "<mask token>\n\n\ndef resizeXY(X, Y, occurrency, dx, dz):\n \"\"\"This function takes in input X,Y,occurrency, two dimensions dx, dz and scales the values\n\tcontained in X and Y, in such a way that only empty spaces are scaled ... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for demo in demoModules:
pid = os.fork()
filepath = './' + demo + '.py'
if pid == 0:
os.execvp('python3.5', (filepath,))
<|reserved_special_token_0|>
root.title('Progress')
Label(root, text='Multiple program de... | flexible | {
"blob_id": "d91dc850c293cf085e1be04b6e13e0a62cb0bcb1",
"index": 9812,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor demo in demoModules:\n pid = os.fork()\n filepath = './' + demo + '.py'\n if pid == 0:\n os.execvp('python3.5', (filepath,))\n<mask token>\nroot.title('Progress')\nLab... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
schema_view = get_swagger_view(title='Pastebin API')
urlpatterns = [url('^admin/', admin.site.urls), url('^doc_u/', schema_view),
url('^', include('o.urls')), url('^api/', include('restapi.urls',
namespace='res'))]
<|res... | flexible | {
"blob_id": "891588327046e26acb9a691fa8bb9a99420712d6",
"index": 913,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nschema_view = get_swagger_view(title='Pastebin API')\nurlpatterns = [url('^admin/', admin.site.urls), url('^doc_u/', schema_view),\n url('^', include('o.urls')), url('^api/', include('r... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class Book(models.Model):
ISBN = models.CharField(primary_key=True, max_length=100)
Title = models.CharField(max_length=200)
AuthorID = models.IntegerField(max_length=100)
Publisher = models.CharField(max_length=200)
PublishDate = models.CharField(max_length=200)
P... | flexible | {
"blob_id": "817d7259b3607f3a94d2f363c9684f733ee87d37",
"index": 2124,
"step-1": "<mask token>\n\n\nclass Book(models.Model):\n ISBN = models.CharField(primary_key=True, max_length=100)\n Title = models.CharField(max_length=200)\n AuthorID = models.IntegerField(max_length=100)\n Publisher = models.Ch... | [
2,
3,
4,
5,
6
] |
"""
Download the full CHIRPS 2.0 data for a specific type (dekads, pentads, daily ...)
with the possibility to automatically recut the data over Argentina.
"""
import os
import requests
import urllib.request
import time
from bs4 import BeautifulSoup
import subprocess
##############
# PARAMETERS to define
# Set a pre... | normal | {
"blob_id": "ff0495ee1f4aa1f243c82b709a974d3d7c37e8bd",
"index": 2425,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif download_dir != '':\n os.chdir(download_dir)\n response = requests.get(url)\n soup = BeautifulSoup(response.text, 'html.parser')\n soup.findAll('a')\n one_a_tag = soup.f... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class AppendSlashMiddleware(MiddlewareMixin):
<|reserved_special_token_0|>
def process_request(self, request):
redirect_url = ''
if self.should_redirect_with_slash(request):
path = self.get_full_path_with_slash(request)
else:
path =... | flexible | {
"blob_id": "ec70fb9119b430dcd36549f2fac8e5e0a0e1bb00",
"index": 2696,
"step-1": "<mask token>\n\n\nclass AppendSlashMiddleware(MiddlewareMixin):\n <mask token>\n\n def process_request(self, request):\n redirect_url = ''\n if self.should_redirect_with_slash(request):\n path = self.... | [
4,
5,
6,
7,
8
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.