code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
<|reserved_special_token_0|>
class RHELTargetRepository(TargetRepositoryBase):
pass
class CustomTargetRepository(TargetRepositoryBase):
name = fields.Nullable(fields.String())
baseurl = fields.Nullable(fields.String())
enabled = fields.Boolean(default=True)
class TargetRepositories(Model):
top... | flexible | {
"blob_id": "47dc9212a1059cbca8ec6732deaa835fa9967fd8",
"index": 2990,
"step-1": "<mask token>\n\n\nclass RHELTargetRepository(TargetRepositoryBase):\n pass\n\n\nclass CustomTargetRepository(TargetRepositoryBase):\n name = fields.Nullable(fields.String())\n baseurl = fields.Nullable(fields.String())\n ... | [
9,
10,
11,
12,
14
] |
#!/usr/bin/env python3
from ev3dev2.sensor import INPUT_1, INPUT_2, INPUT_3, INPUT_4
from ev3dev2.sensor.lego import ColorSensor, UltrasonicSensor
from ev3dev2.power import PowerSupply
# initiate color sensors
# the colour sensor needs to be between 1-2 cm away from the surface you are trying to measure. (color mode)
... | normal | {
"blob_id": "84a13e3dea885d6c4a5f195dfac51c7110102fc2",
"index": 6729,
"step-1": "<mask token>\n\n\ndef getColorString(color_reading):\n if color_reading == 1:\n return 'black'\n elif color_reading == 2:\n return 'white'\n elif color_reading == 3:\n return 'green'\n elif color_re... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def modify(sql, args):
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd
='chen0918', db='web')
cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)
cursor.execute(sql, args)
conn.commit()
cursor.close()
conn.close()
<|reserved_sp... | flexible | {
"blob_id": "80819ec83572737c89044936fc269154b190751a",
"index": 2372,
"step-1": "<mask token>\n\n\ndef modify(sql, args):\n conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd\n ='chen0918', db='web')\n cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)\n cursor.execute(... | [
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class NLPARM(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __init__(self):
pass
def add(self, card=None, comment=''):
if comment:
self._comment = comment
self.nlparm_id = integer(card, 1, 'nlparm_id')
s... | flexible | {
"blob_id": "7701a98d836dc9551a4e2eb4b7d9c10307b3f665",
"index": 1411,
"step-1": "<mask token>\n\n\nclass NLPARM(object):\n <mask token>\n <mask token>\n\n def __init__(self):\n pass\n\n def add(self, card=None, comment=''):\n if comment:\n self._comment = comment\n se... | [
6,
7,
8,
9,
10
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def bill_count(amount_user, list_of_money_bills):
n = len(list_of_money_bills)
ans = []
i = n - 1
while i >= 0:
while amount_user >= list_of_money_bills[i]:
amount_user -= list_of_money_bills[i]
ans.append(list_... | flexible | {
"blob_id": "53c5f298dbfb21d7688fef8f0312858e2fd73d79",
"index": 4423,
"step-1": "<mask token>\n",
"step-2": "def bill_count(amount_user, list_of_money_bills):\n n = len(list_of_money_bills)\n ans = []\n i = n - 1\n while i >= 0:\n while amount_user >= list_of_money_bills[i]:\n am... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
import psycopg2
DBNAME = "news"
query1 = """
select title, count(*) as numOfViews from articles,log
where concat('/article/', articles.slug) = log.path
group by title order by numOfViews desc limit 3;
"""
query2 = """
select authors.name, count(*) as numOfViews
from articles, authors, log
where... | normal | {
"blob_id": "612a3d168a09fc26530b95d258cbb4de6728419d",
"index": 3721,
"step-1": "<mask token>\n\n\ndef fileWrite(content):\n \"\"\" write result to result.txt \"\"\"\n file = open('./result.txt', 'w')\n file.write(content)\n file.close()\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_d... | [
1,
2,
5,
6,
7
] |
<|reserved_special_token_0|>
def upgrade():
with op.batch_alter_table('trail', schema=None) as batch_op:
batch_op.add_column(sa.Column('geom', geoalchemy2.types.Geometry(
geometry_type='MULTILINESTRING'), nullable=True))
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved... | flexible | {
"blob_id": "d724b4f57cf7683d6b6385bf991ed23a5dd8208f",
"index": 3881,
"step-1": "<mask token>\n\n\ndef upgrade():\n with op.batch_alter_table('trail', schema=None) as batch_op:\n batch_op.add_column(sa.Column('geom', geoalchemy2.types.Geometry(\n geometry_type='MULTILINESTRING'), nullable=T... | [
1,
2,
3,
4,
5
] |
n, k = [int(input()) for _ in range(2)]
ans = 1
for _ in range(n):
ans = min(ans * 2, ans + k)
print(ans)
| normal | {
"blob_id": "bb730606c7357eeb605292d5b9c05e8e8a797ea2",
"index": 5461,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor _ in range(n):\n ans = min(ans * 2, ans + k)\nprint(ans)\n",
"step-3": "n, k = [int(input()) for _ in range(2)]\nans = 1\nfor _ in range(n):\n ans = min(ans * 2, ans + k)\npri... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def __return_modal__(id):
lecturer = board.Lecturer.query.get(id)
print('esdasd' + lecturer.description)
return render_template('board/modal.html', lecturer=lecturer)
<|reserved_special_token_1|>
<|reserved_specia... | flexible | {
"blob_id": "f87c036c1eb5026e088bed62fbc330cfd2ea1952",
"index": 7500,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef __return_modal__(id):\n lecturer = board.Lecturer.query.get(id)\n print('esdasd' + lecturer.description)\n return render_template('board/modal.html', lecturer=lecturer)\n... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def checkhost(ip):
conf.verb = 0
try:
ping = sr1(IP(dst=ip) / ICMP())
print('\n[*] Target is up, beginning scan...')
except Exception:
print("\n[!] Couldn't resolve target")
sys.exit('Exiting...')
<|reserved_special_token_0|>
def scanport(po... | flexible | {
"blob_id": "7e0eefb1d913787f675adc2ba0dccb16007464e4",
"index": 1764,
"step-1": "<mask token>\n\n\ndef checkhost(ip):\n conf.verb = 0\n try:\n ping = sr1(IP(dst=ip) / ICMP())\n print('\\n[*] Target is up, beginning scan...')\n except Exception:\n print(\"\\n[!] Couldn't resolve tar... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
def get_objectives(data):
"""Get a list of all first chromosomes' objective values."""
objectives = [math.log(population[0]['objective']) for population in data]
return objectives
def get_new_values(values):
"""Record any changes higher. Its size is the same as its argum... | flexible | {
"blob_id": "f4f08015b7638f4d6ea793350d5d19a3485978cd",
"index": 53,
"step-1": "<mask token>\n\n\ndef get_objectives(data):\n \"\"\"Get a list of all first chromosomes' objective values.\"\"\"\n objectives = [math.log(population[0]['objective']) for population in data]\n return objectives\n\n\ndef get_n... | [
2,
4,
5,
6,
7
] |
# This Python file uses the following encoding: utf-8
import json
import os
import logging
from .utility_helper import (
check_path,
)
from .formats import (
OUTPUT_FORMATS,
FORMATS
)
class OptionsManager(object):
"""
This clas is responsible for storing & retrieving the options.
Args:
... | normal | {
"blob_id": "92529c4d4c33a7473773f081f730e64bae4d7f54",
"index": 5742,
"step-1": "<mask token>\n\n\nclass OptionsManager(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n logging.basicConfig(format=format, level=logging.INFO, datefmt='%H:%M:%S')\n logging.getLogger().setLev... | [
4,
6,
7,
9,
11
] |
N, M = map(int, input().split()) # Nはスイッチの数、Mは電球の数
lights = [[0] * N for _ in range(M)]
for i in range(M):
temp = list(map(int, input().split())) # 0番目はスイッチの個数、1番目以降はスイッチを示す
k = temp[0]
switches = temp[1:]
for j in range(k):
lights[i][switches[j]-1] = 1
P = list(map(int, input().split())) # 個数を... | normal | {
"blob_id": "c4ac7ff5d45af9d325f65b4d454a48ca0d8f86df",
"index": 8808,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(M):\n temp = list(map(int, input().split()))\n k = temp[0]\n switches = temp[1:]\n for j in range(k):\n lights[i][switches[j] - 1] = 1\n<mask token>\nfor... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def main():
print('Predictor')
placa = input(
'Enter the license of your vehicle in the following format AAA-####: '
)
fecha = input('Enter the date in the following format AA/MM/DD: ')
hora = i... | flexible | {
"blob_id": "c7e5851a41e1cdb33cd0daa103fbf702da6e5ff7",
"index": 9818,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n print('Predictor')\n placa = input(\n 'Enter the license of your vehicle in the following format AAA-####: '\n )\n fecha = input('Enter the date ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class UrlfetchFetcher(fetchers.HTTPFetcher):
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class UrlfetchFetcher(fetchers.HTTPFetcher):
def fetch(self, url, body=None, heade... | flexible | {
"blob_id": "14e247b7b586242bfc17507fece3c60b7b8a3025",
"index": 9604,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass UrlfetchFetcher(fetchers.HTTPFetcher):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass UrlfetchFetcher(fetchers.HTTPFetcher):\n\n def fetch(self, url, body=None, h... | [
0,
1,
2,
3,
4
] |
#######################
# PYMERGE V.1.1 #
#######################
# Samuel Farrens 2014 #
#######################
"""@file pycatcut.v.1.1
@brief Code that merges cluster catalogues into a single catalogue.
@author Samuel Farrens
"""
import math, optparse, numpy as np
import errors
from classes.cluster import Cl... | normal | {
"blob_id": "e81294c984497dbba9fa345b61abb8d781f136bf",
"index": 9506,
"step-1": "#######################\n# PYMERGE V.1.1 #\n#######################\n# Samuel Farrens 2014 #\n#######################\n\n\"\"\"@file pycatcut.v.1.1\n@brief Code that merges cluster catalogues into a single catalogue.\n@author... | [
0
] |
#!/usr/bin/env python3
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ... | normal | {
"blob_id": "923a433a3a04a8538b43d162d17d379daab4698a",
"index": 7753,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nasync def sound(cube):\n sound = bytearray()\n sound.append(2)\n sound.append(9)\n sound.append(255)\n await cube.write_gatt_char(TOIO_SOUND_UUID, sound)\n\n\nasync def... | [
0,
1,
2,
3,
4
] |
# SSURGO_ExportMuRaster.py
#
# Convert MUPOLYGON featureclass to raster for the specified SSURGO geodatabase.
# By default any small NoData areas (< 5000 sq meters) will be filled using
# the Majority value.
#
# Input mupolygon featureclass must have a projected coordinate system or it will skip.
# Input databas... | normal | {
"blob_id": "d9a871fb6c889bcff455732007718af734859c72",
"index": 1325,
"step-1": "# SSURGO_ExportMuRaster.py\r\n#\r\n# Convert MUPOLYGON featureclass to raster for the specified SSURGO geodatabase.\r\n# By default any small NoData areas (< 5000 sq meters) will be filled using\r\n# the Majority value.\r\n#\r\n# I... | [
0
] |
# Generated by Django 3.1.2 on 2020-10-29 06:04
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | normal | {
"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
] |
def intersection(nums1, nums2):
return list(set(nums1)&set(nums2))
if __name__=="__main__":
print intersection([1, 2, 2, 1],[2, 2]) | normal | {
"blob_id": "0081ffc2a1de7fb71515fd0070aaebfef806f6ef",
"index": 4230,
"step-1": "def intersection(nums1, nums2):\n return list(set(nums1)&set(nums2))\n \n \nif __name__==\"__main__\":\n print intersection([1, 2, 2, 1],[2, 2])",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
... | [
0
] |
# cor = input('Escolha uma cor: ')
# print(f"Cor escolhida {cor:=^10}\n"
# f"Cor escolhida {cor:>10}\n"
# f"Cor escolhida {cor:<10}\n")
n1 = 7
n2 = 3
#print(f'Soma {n1+n2}')
s = n1 + n2
m = n1 * n2
d = n1 / n2
di = n1 // n2
e = n1 ** n2
print(f's = {s}\n m = {m}\n d = {d:.2f}\n di = {di}\n e = {e}', end=... | normal | {
"blob_id": "34b23e80b3c4aaf62f31c19fee0b47ace1561a8c",
"index": 560,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(f\"\"\"s = {s}\n m = {m}\n d = {d:.2f}\n di = {di}\n e = {e}\"\"\", end='')\n",
"step-3": "n1 = 7\nn2 = 3\ns = n1 + n2\nm = n1 * n2\nd = n1 / n2\ndi = n1 // n2\ne = n1 ** n2\nprint... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def sigint_handler(signum, frame):
print('\n Disconnecting from server')
sys.exit()
<|reserved_special_token_0|>
def sendUsernameToServer(username_entry):
username = username_entry.encode('utf-8')
username_header = f'{len(username):<{HEADER_LENGTH}}'.encode('utf-8')
... | flexible | {
"blob_id": "5e17299e6a409e433e384935a815bab6ce178ff5",
"index": 3031,
"step-1": "<mask token>\n\n\ndef sigint_handler(signum, frame):\n print('\\n Disconnecting from server')\n sys.exit()\n\n\n<mask token>\n\n\ndef sendUsernameToServer(username_entry):\n username = username_entry.encode('utf-8')\n u... | [
4,
5,
6,
7,
9
] |
<|reserved_special_token_0|>
class Agent:
<|reserved_special_token_0|>
def record(self, obs_tuple):
index = self.buffer_counter % self.buffer_capacity
self.state_buffer[index] = obs_tuple[0]
self.action_buffer[index] = obs_tuple[1]
self.reward_buffer[index] = obs_tuple[2]
... | flexible | {
"blob_id": "8a9ed10bf25f3aa13fde43079303194fc6db26c0",
"index": 4248,
"step-1": "<mask token>\n\n\nclass Agent:\n <mask token>\n\n def record(self, obs_tuple):\n index = self.buffer_counter % self.buffer_capacity\n self.state_buffer[index] = obs_tuple[0]\n self.action_buffer[index] = ... | [
8,
9,
10,
12,
13
] |
from tkinter import ttk
import tkinter as tk
import pyodbc
#ConnectingDatabase#
from tkinter import messagebox
conn = pyodbc.connect('Driver={SQL Server};'
'Server=MUTHUCOMPUTER;'
'Database=Class4c v1;'
'Trusted_Connection=yes;')
cursor = ... | normal | {
"blob_id": "8058ff209af03b7365ffad2a9ce2e2805b548f53",
"index": 9927,
"step-1": "<mask token>\n\n\ndef save():\n Names = Name.get()\n Ages = Age.get()\n Genders = Gender.get()\n Heights = height.get()\n weights = weight.get()\n rollnos = StudentId.get()\n Sports = Sport.get()\n cursor.ex... | [
4,
5,
6,
7,
8
] |
#Script to retrieve relevant files and paths, supply to cx_Freeze to compile into executeable
import os
# import cx_Freeze
files_list = []
dir_path = os.path.dirname(os.path.realpath(__file__))+str('/')
print(dir_path)
for root, directories, filenames in os.walk(str(dir_path)):
for file in filenames:
pat... | normal | {
"blob_id": "430dccf1001af43c2a713b08dc05d8f04818aa1f",
"index": 5597,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(dir_path)\nfor root, directories, filenames in os.walk(str(dir_path)):\n for file in filenames:\n path = os.path.join(root, file)\n if path.find('/.') == -1 and pat... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class L2OSMConverter:
<|reserved_special_token_0|>
def __init__(self, proj_string):
if proj_string:
self.proj = Proj(proj_string)
else:
self.proj = Proj(DEFAULT_PROJ_STRING)
self.osm = None
self._id_count = -1
self.f... | flexible | {
"blob_id": "472c8b0649e29c31b144607080938793e5f1293e",
"index": 6834,
"step-1": "<mask token>\n\n\nclass L2OSMConverter:\n <mask token>\n\n def __init__(self, proj_string):\n if proj_string:\n self.proj = Proj(proj_string)\n else:\n self.proj = Proj(DEFAULT_PROJ_STRING)... | [
7,
8,
10,
16,
17
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
user_schema = {'id': {'type': 'string', 'required': True, 'coerce': (str,
lambda x: x.lower())}, 'latitude': {'type': 'float', 'required': True,
'min': -60.0, 'max': 10, 'coerce': (float, lambda x: round(x, 5))},
'longitude': {'type': 'float', 'r... | flexible | {
"blob_id": "bf41ab20b9fae9f19efdc58852e48d9b735f34c3",
"index": 1645,
"step-1": "<mask token>\n",
"step-2": "user_schema = {'id': {'type': 'string', 'required': True, 'coerce': (str, \n lambda x: x.lower())}, 'latitude': {'type': 'float', 'required': True,\n 'min': -60.0, 'max': 10, 'coerce': (float, la... | [
0,
1,
2
] |
# Generated by Django 3.0.2 on 2020-08-27 16:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('info', '0010_auto_20200808_2117'),
]
operations = [
migrations.AddField(
model_name='profile',
name='annual_income',... | normal | {
"blob_id": "45b2b611a80b93c9a7d8ec8a09e5838147e1ea76",
"index": 8626,
"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 = [('info', '001... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from django.db.models import Q
from django.contrib.auth import get_user_model
from rest_framework.response import Response
from rest_framework.status import HTTP_200_OK, HTTP_400_BAD_REQUEST
from rest_framework.views imp... | normal | {
"blob_id": "18f355041a9982de56ad2eb51b665dd39a156f0a",
"index": 9638,
"step-1": "<mask token>\n\n\nclass UserUpdateAPIView(UpdateAPIView):\n <mask token>\n <mask token>\n\n def post(self, request, format=None):\n data = request\n queryset = User.objects.get()\n\n\nclass UserTokenVerifyAPI... | [
11,
12,
14,
16,
18
] |
<|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": "0a5570ef17efa26ef6317930df616c8326f83314",
"index": 2936,
"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 = [('shopUser', ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
from . import utilities
from . import stats
from . import signal
from . import plot
from . import docopt
<|reserved_special_token_1|>
"""
The epitome package is a set of command-line tools for analyzing MRI data, and a
set of ... | flexible | {
"blob_id": "4d58926e812789768fdf5be59bd54f9b66850e57",
"index": 2554,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfrom . import utilities\nfrom . import stats\nfrom . import signal\nfrom . import plot\nfrom . import docopt\n",
"step-3": "\"\"\"\nThe epitome package is a set of command-line tools fo... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
<|reserved_special_token_0|>
def helper(self, nums, n):
if n == 1:
return nums[0]
dp = [0] * n
dp[0] = nums[0]
dp[1] = max(nums[0], nums[1])
for i in range(2, n):
dp[i] =... | flexible | {
"blob_id": "59b2c9d279168a806e59fb7529ab12d7b86107bc",
"index": 5340,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n\n def helper(self, nums, n):\n if n == 1:\n return nums[0]\n dp = [0] * n\n dp[0] = nums[0]\n dp[1] = max(nums[0], nums[1])... | [
0,
2,
3,
4,
5
] |
# Problem statement here: https://code.google.com/codejam/contest/975485/dashboard#s=p0
# set state of both bots
# for instruction i
# look at this instruction to see who needs to press their button now
# add walk time + 1 to total time
# decriment walk time of other bot by walk time +1 of current bot (rectif... | normal | {
"blob_id": "d1944493b7f3e74462ca0163a8c0907e4976da06",
"index": 4806,
"step-1": "<mask token>\n\n\ndef other_bot(bot_name):\n if bot_name == 'O':\n return 'B'\n else:\n return 'O'\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef solve_sequence(seq):\n O_init_walk_time = 0\n B_i... | [
1,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class StravaAuthConfig(AppConfig):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def ready(self):
pass
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class StravaAuthConfig(AppCon... | flexible | {
"blob_id": "9e43eb3c3ab3be4e695dbc80aa005332b8d8a4ec",
"index": 9515,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass StravaAuthConfig(AppConfig):\n <mask token>\n <mask token>\n\n def ready(self):\n pass\n",
"step-3": "<mask token>\n\n\nclass StravaAuthConfig(AppConfig):\n ... | [
0,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def to_bitmask(n, bits):
mask = [int(digit) for digit in bin(n)[2:]]
return [0] * (bits - len(mask)) + mask
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def to_bitmask(n, bits):
mask = [int(digit) for digit in bin(n)[2:]]
ret... | flexible | {
"blob_id": "98f36b216e718fc4fe42d1717ff9ba82cc24c2ff",
"index": 7752,
"step-1": "<mask token>\n",
"step-2": "def to_bitmask(n, bits):\n mask = [int(digit) for digit in bin(n)[2:]]\n return [0] * (bits - len(mask)) + mask\n\n\n<mask token>\n",
"step-3": "def to_bitmask(n, bits):\n mask = [int(digit)... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for num in numbers_ascii:
numbers_total += num
<|reserved_special_token_0|>
for i in numbers_total:
i = int(i)
cool_threshold *= i
print(f'Cool threshold: {cool_threshold}')
<|reserved_special_token_0|>
for j in valid_... | flexible | {
"blob_id": "c2201a281ccd0833b0d7d2219d97ce3175fb012b",
"index": 2042,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor num in numbers_ascii:\n numbers_total += num\n<mask token>\nfor i in numbers_total:\n i = int(i)\n cool_threshold *= i\nprint(f'Cool threshold: {cool_threshold}')\n<mask toke... | [
0,
1,
2,
3,
4
] |
from typing import Sequence, Union, Tuple
import kdtree
from colour import Color
AnsiCodeType = Union[str, int, Tuple[int, int, int]]
class ColorPoint(object):
def __init__(self, source: Color, target: Color,
ansi: AnsiCodeType) -> None:
"""
Map source color to target color, st... | normal | {
"blob_id": "e239c2089fc6d4ab646c490b6e3de8953cec5634",
"index": 8093,
"step-1": "<mask token>\n\n\nclass ColorPoint(object):\n <mask token>\n <mask token>\n\n def __getitem__(self, item) ->float:\n \"\"\"\n >>> cp = ColorPoint(Color('#880073'), Color('white'), '')\n >>> cp[0] # hu... | [
7,
8,
9,
10,
12
] |
from collections import OrderedDict
class LRU_Cache(object):
def __init__(self, capacity):
# Initialize class variables
self.size = capacity
self.jar = OrderedDict()
pass
def get(self, key):
# Retrieve item from provided key. Return -1 if nonexistent.
if key not ... | normal | {
"blob_id": "3c88e13e8796c5f39180a9a514f0528a074460a6",
"index": 2198,
"step-1": "<mask token>\n\n\nclass LRU_Cache(object):\n\n def __init__(self, capacity):\n self.size = capacity\n self.jar = OrderedDict()\n pass\n\n def get(self, key):\n if key not in self.jar:\n ... | [
6,
8,
10,
11,
12
] |
# import libraries
import sys
import pandas as pd
import numpy as n
from sqlalchemy import create_engine
def load_data(messages_filepath, categories_filepath):
"""
This function loads the message and categories files and
merge them and return the new dataframe for the project
"""
# Read messages an... | normal | {
"blob_id": "4642537f8af1f060f5ee43cc9e98bd07be6a558c",
"index": 124,
"step-1": "# import libraries\nimport sys\nimport pandas as pd\nimport numpy as n\nfrom sqlalchemy import create_engine\n\ndef load_data(messages_filepath, categories_filepath):\n \"\"\"\n This function loads the message and categories f... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with open(record_file, 'r') as f:
all_line = f.readlines()
for line in all_line:
record_time = line[line.index('[') + 1:line.index(']')]
record_order = json.loads(line[line.index('{'):])
for item in... | flexible | {
"blob_id": "fbbadb5cbd2b324686fc5faa0b1bc6236fc8d87b",
"index": 9218,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open(record_file, 'r') as f:\n all_line = f.readlines()\n for line in all_line:\n record_time = line[line.index('[') + 1:line.index(']')]\n record_order = json.lo... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class SSH:
<|reserved_special_token_0|>
def exec_cmd(self, cmd):
stdin, stdout, stderr = self.client.exec_command(cmd)
res, err = stdout.read(), stderr.read()
result = res if res else err
print('##' + result.decode(encoding='utf-8').replace('\n', '... | flexible | {
"blob_id": "2342a651ec45623b887c4bc1168adb0731ba5ff6",
"index": 8443,
"step-1": "<mask token>\n\n\nclass SSH:\n <mask token>\n\n def exec_cmd(self, cmd):\n stdin, stdout, stderr = self.client.exec_command(cmd)\n res, err = stdout.read(), stderr.read()\n result = res if res else err\n ... | [
5,
6,
8,
11,
12
] |
import subprocess as sp
from .dummy_qsub import dummy_qsub
from os.path import exists
from os import makedirs
from os import remove
from os.path import dirname
QUEUE_NAME = 'fact_medium'
def qsub(job, exe_path, queue=QUEUE_NAME):
o_path = job['o_path'] if job['o_path'] is not None else '/dev/null'
e_path = jo... | normal | {
"blob_id": "427d3d386d4b8a998a0b61b8c59984c6003f5d7b",
"index": 6975,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef qsub(job, exe_path, queue=QUEUE_NAME):\n o_path = job['o_path'] if job['o_path'] is not None else '/dev/null'\n e_path = job['e_path'] if job['e_path'] is not None else '/de... | [
0,
1,
2,
3
] |
def solution(a, b):
answer = 0;
for i in range(0,len(a)):
answer+=a[i]*b[i];
print(answer);
return answer
solution([1,2,3,4],[-3,-1,0,2]); | normal | {
"blob_id": "5fd34c698c2060d5399ba43f6746527961aa574b",
"index": 9239,
"step-1": "<mask token>\n",
"step-2": "def solution(a, b):\n answer = 0\n for i in range(0, len(a)):\n answer += a[i] * b[i]\n print(answer)\n return answer\n\n\n<mask token>\n",
"step-3": "def solution(a, b):\n answ... | [
0,
1,
2,
3
] |
import matplotlib.pyplot as plt
from shapely.geometry import MultiLineString, Polygon
mls = MultiLineString([[(0, 1), (5, 1)], [(1, 2), (1, 0)]])
p = Polygon([(0.5, 0.5), (0.5, 1.5), (2, 1.5), (2, 0.5)])
results = mls.intersection(p)
plt.subplot(1, 2, 1)
for ls in mls:
plt.plot(*ls.xy)
plt.plot(*p.boundary.xy, "-... | normal | {
"blob_id": "9096ed4b68d2bef92df7db98589e744ddf3efad0",
"index": 350,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nplt.subplot(1, 2, 1)\nfor ls in mls:\n plt.plot(*ls.xy)\nplt.plot(*p.boundary.xy, '-.k')\nplt.xlim([0, 5])\nplt.ylim([0, 2])\nplt.subplot(1, 2, 2)\nfor ls in results:\n plt.plot(*ls.... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 4 15:21:29 2021
@author: diego
"""
import subprocess
import os
import numpy as np
if __name__ == "__main__":
path_clusters = snakemake.input[0]
path_clusters = "/".join(path_clusters.split("/")[:-1]) + "/"
merge_vc... | normal | {
"blob_id": "f6d81387f61ac4150cd6279121780b7113517b1e",
"index": 2860,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n path_clusters = snakemake.input[0]\n path_clusters = '/'.join(path_clusters.split('/')[:-1]) + '/'\n merge_vcf = snakemake.output[0]\n ref_genome ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def filter_pos_rec(lst):
"""
@type lst: LinkedListRec
>>> lst = LinkedListRec([3, -10, 4, 0])
>>> pos = filter_pos_rec(lst)
>>> str(pos)
'3 -> 4'
"""
if lst.is_empty():
return lst
els... | flexible | {
"blob_id": "efcbe296ea72a94be967124a8ba8c84a524e2eb1",
"index": 66,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef filter_pos_rec(lst):\n \"\"\"\n @type lst: LinkedListRec\n >>> lst = LinkedListRec([3, -10, 4, 0])\n >>> pos = filter_pos_rec(lst)\n >>> str(pos)\n '3 -> 4'\n\n ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class MainWindowMock(QObject):
sig_editor_focus_changed = Signal(str)
def __init__(self):
super(MainWindowMock, self).__init__(None)
self.editor = Mock()
self.editor.sig_editor_focus_changed = self.sig_editor_focus_changed
self.projects = MagicMock... | flexible | {
"blob_id": "22792937415a8ee4cecff2a9683c435abe54bdab",
"index": 5516,
"step-1": "<mask token>\n\n\nclass MainWindowMock(QObject):\n sig_editor_focus_changed = Signal(str)\n\n def __init__(self):\n super(MainWindowMock, self).__init__(None)\n self.editor = Mock()\n self.editor.sig_edit... | [
10,
11,
12,
14,
15
] |
from django.db import models
# Create your models here.
class Tutorial(models.Model):
web_title = models.CharField(max_length=200)
web_content = models.TextField()
web_published = models.DateTimeField("date published")
def __str__(self):
return self.web_title
| normal | {
"blob_id": "32499688db51f701173ec0ea212c483bf902c109",
"index": 3048,
"step-1": "<mask token>\n\n\nclass Tutorial(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Tutorial(models.Model):\n <mask token>\n <mask token>\n <mask... | [
1,
2,
3,
4,
5
] |
# find the 12-digit number formed by concatenating a series of 3 4-digit
# numbers who are permutations of each other and are all prime
from itertools import permutations, dropwhile
from pe_utils import prime_sieve
prime_set = set(prime_sieve(10000))
def perm(n, inc):
perm_set = set(map(lambda x: int("".join(x))... | normal | {
"blob_id": "e03290746d6520fde63836e917f6af0c76596704",
"index": 3816,
"step-1": "<mask token>\n\n\ndef perm(n, inc):\n perm_set = set(map(lambda x: int(''.join(x)), permutations(str(n))))\n perms = n, n + inc, n + inc * 2\n if any(map(lambda x: x not in prime_set or x not in perm_set, perms)):\n ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def draw_area(dna, room):
area_center, area = DNA_Object.get_room_area(room)
plt.plot(area['x'], area['y'], linewidth='0.5', color='k')
plt.xlim((-15000, 20000))
plt.ylim((-15000, 20000))
title = 'Id' + str(dna['solutionId'])
plt.title(title)
def draw_bounds(minx... | flexible | {
"blob_id": "089bdd6d68a69aff6f3c11f7f5ffb75aed73cd24",
"index": 131,
"step-1": "<mask token>\n\n\ndef draw_area(dna, room):\n area_center, area = DNA_Object.get_room_area(room)\n plt.plot(area['x'], area['y'], linewidth='0.5', color='k')\n plt.xlim((-15000, 20000))\n plt.ylim((-15000, 20000))\n t... | [
7,
9,
11,
12,
13
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(pilha)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
pilha = list()
print(pilha)
<|reserved_special_token_1|>
from typing import Dict, List
pilha = list()
print(pilha)
| flexible | {
"blob_id": "f3f3bbb715f16dc84221f3349aa5f26e9a6dc7c8",
"index": 2726,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(pilha)\n",
"step-3": "<mask token>\npilha = list()\nprint(pilha)\n",
"step-4": "from typing import Dict, List\npilha = list()\nprint(pilha)\n",
"step-5": null,
"step-ids": [... | [
0,
1,
2,
3
] |
class Model:
<|reserved_special_token_0|>
def derivedVariablesDependsOn(self, models):
return []
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def computeSimplifiedDerivedVariables(self, args, time):
return []
def initializeState(self):
return []
<|rese... | flexible | {
"blob_id": "b27e89ff799f26b87a61254e1c4a5f782fcbe605",
"index": 2540,
"step-1": "class Model:\n <mask token>\n\n def derivedVariablesDependsOn(self, models):\n return []\n <mask token>\n <mask token>\n\n def computeSimplifiedDerivedVariables(self, args, time):\n return []\n\n def... | [
4,
5,
7,
8,
10
] |
<|reserved_special_token_0|>
class ElectronicDie:
def __init__(self, mode):
self.game_mode = mode
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|res... | flexible | {
"blob_id": "edfad88c837ddd3bf7cceeb2f0b1b7a5356c1cf7",
"index": 8998,
"step-1": "<mask token>\n\n\nclass ElectronicDie:\n\n def __init__(self, mode):\n self.game_mode = mode\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n ... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class PhotoForm(forms.Form):
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class PhotoForm(forms.Form):
image = forms.ImageField()
<|reserved_special_token_1|>
from django... | flexible | {
"blob_id": "3983f8dfb9c7b7e664af05857a0f6fe380154424",
"index": 3684,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass PhotoForm(forms.Form):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass PhotoForm(forms.Form):\n image = forms.ImageField()\n",
"step-4": "from django import form... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def write_spd(write1, write2):
ser1.write('sd' + str(write1) + '\n')
ser2.write('sd' + str(-write2) + '\n')
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
ser1.write('?\n')
time.sleep(0.5)
if ser1.readline()[4] == 0:
ser2 = serial.S... | flexible | {
"blob_id": "e6d4d12d47391927364fdc9765c68690d42c5d8d",
"index": 8950,
"step-1": "<mask token>\n\n\ndef write_spd(write1, write2):\n ser1.write('sd' + str(write1) + '\\n')\n ser2.write('sd' + str(-write2) + '\\n')\n\n\n<mask token>\n",
"step-2": "<mask token>\nser1.write('?\\n')\ntime.sleep(0.5)\nif ser1... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def get_channel_urls(url):
wb_data = requests.get(url)
wb_data.encoding = 'utf-8'
soup = BeautifulSoup(wb_data.text, 'lxml')
links = soup.select('body > div.navWrap.clearfix > div > ul > li > a')
for link in links:
page_url = url_host + link.get('href')
... | flexible | {
"blob_id": "4791b210f328dff5d48ff5afc381a98a5a1a2b7b",
"index": 1969,
"step-1": "<mask token>\n\n\ndef get_channel_urls(url):\n wb_data = requests.get(url)\n wb_data.encoding = 'utf-8'\n soup = BeautifulSoup(wb_data.text, 'lxml')\n links = soup.select('body > div.navWrap.clearfix > div > ul > li > a... | [
1,
2,
3,
4,
5
] |
"""
HLS: Check if Twin Granule Exists
"""
from typing import Dict
import os
import re
import boto3
from botocore.errorfactory import ClientError
from datetime import date
s3 = boto3.client("s3")
bucket = os.getenv("SENTINEL_INPUT_BUCKET", None)
print(bucket)
if bucket is None:
raise Exception("No Input Bucket set"... | normal | {
"blob_id": "d2b05c5653ca6c6b7219f6c0393e81c9425b5977",
"index": 279,
"step-1": "<mask token>\n\n\ndef handler(event: Dict, context: Dict):\n \"\"\"AWS Lambda handler.\"\"\"\n granule = event.get('granule')\n prefix = granule[0:-6]\n print(prefix)\n response = s3.list_objects_v2(Bucket=bucket, Pre... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
gp.drop('index', axis=1, inplace=True)
gp.drop('level_0', axis=1, inplace=True)
for n in range(index + 1):
Count = []
Visit = []
Visit2 = []
for i in range(11):
Count.append(0)
for m in range(n):
... | flexible | {
"blob_id": "719f7b7b2d8df037583263588e93d884ab3820fe",
"index": 5963,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ngp.drop('index', axis=1, inplace=True)\ngp.drop('level_0', axis=1, inplace=True)\nfor n in range(index + 1):\n Count = []\n Visit = []\n Visit2 = []\n for i in range(11):\n ... | [
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_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
dependencies = [(... | flexible | {
"blob_id": "e8011e98da342e501070febf421e9f8d0b74d64e",
"index": 6813,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('core', '001... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class v2exapi(unittest.TestCase):
def test_node_api(self):
url = 'https://www.v2ex.com/api/nodes/show.json'
a = read_excel('xx.xlsx', 0, 0)
for node_name in a:
response = requests.request('GET', url, params={'name': node_name}
).jso... | flexible | {
"blob_id": "5cd573f2b7f91a8b20e96deb1004c0ef7fc62398",
"index": 8072,
"step-1": "<mask token>\n\n\nclass v2exapi(unittest.TestCase):\n\n def test_node_api(self):\n url = 'https://www.v2ex.com/api/nodes/show.json'\n a = read_excel('xx.xlsx', 0, 0)\n for node_name in a:\n respon... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
@router.get('/getIsPID', response_model=List[m.GetIsPID])
async def show_data(request: Request, ispid):
"""
no params
:return
[
{
id: int = None
name: str = None
... | flexible | {
"blob_id": "349581774cded59ece6a5e8178d116c166a4a6b3",
"index": 6841,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@router.get('/getIsPID', response_model=List[m.GetIsPID])\nasync def show_data(request: Request, ispid):\n \"\"\"\n no params\n\n :return\n\n [\n\n {\n\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def distance(x1, y1, x2, y2):
return ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) ** 0.5
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def distance(x1, y1, x2, y2):
return ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) ** 0.5
<... | flexible | {
"blob_id": "9f8065dfdfe07985244e18d92b59e1c045388a72",
"index": 2557,
"step-1": "<mask token>\n\n\ndef distance(x1, y1, x2, y2):\n return ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) ** 0.5\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef distance(x1, y1, x2, y2):\n return ((x1 - x2) * (x1 - x2... | [
1,
2,
3,
4,
5
] |
import requests
import json
from concurrent import futures
from tqdm import trange
def main():
ex=futures.ThreadPoolExecutor(max_workers=50)
for i in trange(1,152):
url="https://api.bilibili.com/pgc/season/index/result?season_version=-1&" \
"area=-1&is_finish=-1©right=-1&season... | normal | {
"blob_id": "ff8b6bc607dac889da05b9f7e9b3595151153614",
"index": 7358,
"step-1": "<mask token>\n\n\ndef index_page(url):\n res = requests.get(url)\n res.encoding = res.apparent_encoding\n next_page(res.text)\n\n\ndef next_page(html):\n data = json.loads(html)\n for i in data['data']['list']:\n ... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
class TestAVAssetSegmentReport(TestCase):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class TestAVAssetSegmentReport(TestCase):
def test_enum_types(self):
self.assertIsEnumType(AVFoundation.A... | flexible | {
"blob_id": "5ee667e8394ccacf83bfe4baec228373619b4edb",
"index": 2658,
"step-1": "<mask token>\n\n\nclass TestAVAssetSegmentReport(TestCase):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass TestAVAssetSegmentReport(TestCase):\n\n def test_enum_types(self):\n self.assertIsEn... | [
1,
2,
3,
4
] |
#!/usr/bin/python3
import json
def from_json_string(my_str):
"""Function returns a JSON file representation of an object (string)"""
return json.loads(my_str)
| normal | {
"blob_id": "b748c489b2c63546feada811aa3b66146ad8d28e",
"index": 9450,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef from_json_string(my_str):\n \"\"\"Function returns a JSON file representation of an object (string)\"\"\"\n return json.loads(my_str)\n",
"step-3": "import json\n\n\ndef f... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def text_cleaning(text_df):
corpus = []
for i in range(len(text_df)):
text = re.sub('[^a-zA-Z]', ' ', text_df['Text'][i])
text = text.lower()
text = text.split()
ps = PorterStemmer()
text = [ps.stem(word) for word in text if not word in set(... | flexible | {
"blob_id": "1305991a9cd82ddeaffff1545a35ced992e6792f",
"index": 7300,
"step-1": "<mask token>\n\n\ndef text_cleaning(text_df):\n corpus = []\n for i in range(len(text_df)):\n text = re.sub('[^a-zA-Z]', ' ', text_df['Text'][i])\n text = text.lower()\n text = text.split()\n ps = ... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
time.sleep(4)
<|reserved_special_token_0|>
for i in range(100):
lectura.append(arduino.readline())
arduino.close()
print(lectura)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
arduino = serial.Serial('COM7', 960... | flexible | {
"blob_id": "d514413c303dd174d8f56685158780a1681e1aba",
"index": 7925,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntime.sleep(4)\n<mask token>\nfor i in range(100):\n lectura.append(arduino.readline())\narduino.close()\nprint(lectura)\n",
"step-3": "<mask token>\narduino = serial.Serial('COM7', 9... | [
0,
1,
2,
3,
4
] |
class item():
def __init__(self,iname,itq,iup):
self.iname = iname
self.itq = itq
self.iup = iup
class store():
def __init__(self,dic):
self.dic = dic
def add(self,iname,itq,iup):
i = item(iname,itq,iup)
self.dic[iname]=[itq,iup]
def cal... | normal | {
"blob_id": "b11210e73b403bc7a9ee24a53201ab2366ec1808",
"index": 7106,
"step-1": "<mask token>\n\n\nclass store:\n <mask token>\n\n def add(self, iname, itq, iup):\n i = item(iname, itq, iup)\n self.dic[iname] = [itq, iup]\n\n def callbill(self, rname, rq):\n for i in range(0, len(s... | [
4,
6,
7,
9,
10
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
for name in ['Madan', 'Mohan', 'Reddy', 'Govindu']:
print('My name includes ' + name)
for i in range(1, 3):
for j in range(4, 7):
if j == 5:
break
print(j)
<|reserved_special_token_1|>
for name in ["Madan", "Mohan", "Red... | flexible | {
"blob_id": "c0376d94b34ea43e562e68cd65d4e5d2c5b04fb3",
"index": 6657,
"step-1": "<mask token>\n",
"step-2": "for name in ['Madan', 'Mohan', 'Reddy', 'Govindu']:\n print('My name includes ' + name)\nfor i in range(1, 3):\n for j in range(4, 7):\n if j == 5:\n break\n print(j)\n",... | [
0,
1,
2
] |
<|reserved_special_token_0|>
def build_request_body(email):
from_email = email['email']
name = email['name']
subject = email['subject']
body = email['body']
if not from_email:
from_email = FROM_EMAIL
if not name:
name = 'Anonymous'
if not subject:
subject = 'Portfol... | flexible | {
"blob_id": "cb29ee8687b469923896ceb7d5a6cd7f54b2c34e",
"index": 6207,
"step-1": "<mask token>\n\n\ndef build_request_body(email):\n from_email = email['email']\n name = email['name']\n subject = email['subject']\n body = email['body']\n if not from_email:\n from_email = FROM_EMAIL\n if ... | [
2,
3,
4,
5,
6
] |
# coding: utf-8
import logging
from flask import request
from flask.ext.admin import expose
from cores.actions import action
from cores.adminweb import BaseHandler
from dao.bannerdao import banner
from extends import csrf
from libs.flask_login import login_required
from utils.function_data_flow import flow_tools
from... | normal | {
"blob_id": "d80cb5ea57faa0f9e3a8dd5d40c9852c2f7f83e4",
"index": 4586,
"step-1": "<mask token>\n\n\nclass BannerHandler(BaseHandler):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @expose('/banner/action.html', methods=('POST',))\n @login_re... | [
6,
8,
9,
13,
16
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
app_name = 'voronoi'
urlpatterns = [url('^$', views.index, name='index'), url('^search/$', views
.search, name='search'), url('^house/create/$', CreateHouseView.as_view
(), name='create'), url('^get_search_json/$', views.g... | flexible | {
"blob_id": "e3ee00efa0e929b87ca33b79dc6a6064b8758d4a",
"index": 2640,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napp_name = 'voronoi'\nurlpatterns = [url('^$', views.index, name='index'), url('^search/$', views\n .search, name='search'), url('^house/create/$', CreateHouseView.as_view\n (), nam... | [
0,
1,
2,
3
] |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 4 20:55:22 2017
@author: Ivan
"""
# -----------
# User Instructions
#
# Modify the test() function to include two new test cases:
# 1) four of a kind (fk) vs. full house (fh) returns fk.
# 2) full house (fh) vs. full house (fh) returns fh.
#
# Since the program is stil... | normal | {
"blob_id": "90ae6fe37cea2c07d8308498c62460c10ca46846",
"index": 5945,
"step-1": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed Oct 4 20:55:22 2017\n\n@author: Ivan\n\"\"\"\n\n# -----------\n# User Instructions\n# \n# Modify the test() function to include two new test cases:\n# 1) four of a kind (fk) vs. full... | [
0
] |
'''
Created on Jul 10, 2018
@author: daniel
'''
#from multiprocessing import Process, Manager
#from keras.utils import np_utils
import sys
import os
from keras.utils import np_utils
from _codecs import decode
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from DataHandlers.SegNetDataHandler import Seg... | normal | {
"blob_id": "cb03fcf9c9cb61b3546865fe40cc411745e1fc94",
"index": 6872,
"step-1": "<mask token>\n\n\ndef computeDice(im1, im2):\n im1 = np.asarray(im1).astype(np.bool)\n im2 = np.asarray(im2).astype(np.bool)\n if im1.shape != im2.shape:\n raise ValueError(\n 'Shape mismatch: im1 and im2... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
__all__ = [k for k in globals().keys() if not k.startswith('_')]
<|reserved_special_token_1|>
from .build import build_backbone, BACKBONE_REGISTRY
from .backbone import Backbone
from .fpn import FPN
from .resnet import ResNet, ... | flexible | {
"blob_id": "502f405f48df92583757ebc9edb4b15910c1f76a",
"index": 2305,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n__all__ = [k for k in globals().keys() if not k.startswith('_')]\n",
"step-3": "from .build import build_backbone, BACKBONE_REGISTRY\nfrom .backbone import Backbone\nfrom .fpn import FP... | [
0,
1,
2,
3
] |
from torchtext import data
from torchtext import datasets
import re
import spacy
spacy_de = spacy.load('de')
spacy_en = spacy.load('en')
url = re.compile('(<url>.*</url>)')
def tokenize_de(text):
return [tok.text for tok in spacy_de.tokenizer(url.sub('@URL@', text))]
def tokenize_en(text):
return [tok.text ... | normal | {
"blob_id": "4e715ccb4f95e7fe7e495a1181ad5df530f5a53f",
"index": 5773,
"step-1": "<mask token>\n\n\ndef tokenize_de(text):\n return [tok.text for tok in spacy_de.tokenizer(url.sub('@URL@', text))]\n\n\ndef tokenize_en(text):\n return [tok.text for tok in spacy_en.tokenizer(url.sub('@URL@', text))]\n\n\n<ma... | [
2,
3,
4,
5
] |
from typing import List
class CourseSchedule:
"""
Problem: Course Schedule (#207)
Key Insights:
1. Create adjaceny list of courses to prerequisites.
2. Use DFS and visited set to detect a cycle. If there is a cycle, cannot finish all the courses.
3. Remember to remove a course (node) from visi... | normal | {
"blob_id": "7c53c7bec6b6b2d4d6be89b750eeef83ca9115cc",
"index": 2960,
"step-1": "<mask token>\n\n\nclass CourseSchedule:\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass CourseSchedule:\n <mask token>\n\n def can_finish(self, numCourses: int, prerequisites: List[List[int]]\n ... | [
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if Basex != Basey:
print('The files are different!')
else:
print('The files are the same!')
<|reserved_special_token_1|>
file1 = raw_input('Enter the path of your first file: ')
file2 = raw_input('Enter the path of your... | flexible | {
"blob_id": "661d82adc7d0746635fb57abf6d0e70ee615ada4",
"index": 5974,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif Basex != Basey:\n print('The files are different!')\nelse:\n print('The files are the same!')\n",
"step-3": "file1 = raw_input('Enter the path of your first file: ')\nfile2 = r... | [
0,
1,
2,
3
] |
from marshmallow import fields
from server.common.database import Media
from server.common.schema.ref import ma
class MediaSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = Media
fields = ('id', 'name', 'mimetype', 'extension', 'owner', '_links')
dump_only = ('id', 'owner', '_links')
... | normal | {
"blob_id": "1810fee40ff8a99871ecc1d024f6794a68ee54e8",
"index": 3543,
"step-1": "<mask token>\n\n\nclass MediaSchema(ma.SQLAlchemyAutoSchema):\n\n\n class Meta:\n model = Media\n fields = 'id', 'name', 'mimetype', 'extension', 'owner', '_links'\n dump_only = 'id', 'owner', '_links'\n ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
print('content-type: text/html')
print()
<|reserved_special_token_0|>
print(output)
<|reserved_special_token_1|>
print('content-type: text/html')
print()
<|reserved_special_token_0|>
db = cgi.FieldStorage()
ch = db.getvalue('ch')
url = (
'http://www.re... | flexible | {
"blob_id": "87a62f76027e0653f6966f76a42def2ce2a26ba3",
"index": 5893,
"step-1": "<mask token>\n",
"step-2": "print('content-type: text/html')\nprint()\n<mask token>\nprint(output)\n",
"step-3": "print('content-type: text/html')\nprint()\n<mask token>\ndb = cgi.FieldStorage()\nch = db.getvalue('ch')\nurl = (... | [
0,
1,
2,
3,
4
] |
# PySNMP SMI module. Autogenerated from smidump -f python DOCS-IETF-QOS-MIB
# by libsmi2pysnmp-0.1.3 at Thu May 22 11:57:36 2014,
# Python version sys.version_info(major=2, minor=7, micro=2, releaselevel='final', serial=0)
# Imports
( Integer, ObjectIdentifier, OctetString, ) = mibBuilder.importSymbols("ASN1", "Integ... | normal | {
"blob_id": "b90678c8f7ad9b97e13e5603bdf1dc8cb3511ca5",
"index": 5432,
"step-1": "<mask token>\n\n\nclass DocsIetfQosRfMacIfDirection(Integer):\n subtypeSpec = Integer.subtypeSpec + SingleValueConstraint(2, 1)\n namedValues = NamedValues(('downstream', 1), ('upstream', 2))\n\n\nclass DocsIetfQosSchedulingT... | [
4,
5,
6,
7,
9
] |
# ===================================================================
# Setup
# ===================================================================
from time import sleep
import sys, termios, tty, os, pygame, threading
# ===================================================================
# Functions
# ================... | normal | {
"blob_id": "44274446673225c769f63191d43e4747d8ddfbf7",
"index": 6934,
"step-1": "<mask token>\n\n\ndef play_emergency_sound():\n print('Playing emergency sound. There are ' + str(threading.\n active_count()) + ' threads active')\n while getattr(emergency_sound_thread, 'do_run', True):\n pyga... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class LeedsAcUkSpider(scrapy.Spider):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def parse(self, response):
item = {}
item['Subject'] = response.css('d... | flexible | {
"blob_id": "fb4a95197882cc6fe72a5f3c2420a474d9cd97aa",
"index": 7751,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass LeedsAcUkSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n\n def parse(self, response):\n item = {}\n item['Subject'] = response.cs... | [
0,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class LinkedListMod(LinkedList):
def remove_allnode(self):
while self.head:
temp = self.head
self.head = self.head.next
del temp
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class LinkedListM... | flexible | {
"blob_id": "45b20b57a3579c2527c674d0c2af88eedddadcae",
"index": 3724,
"step-1": "<mask token>\n\n\nclass LinkedListMod(LinkedList):\n\n def remove_allnode(self):\n while self.head:\n temp = self.head\n self.head = self.head.next\n del temp\n\n\n<mask token>\n",
"step... | [
2,
3,
4,
5,
6
] |
# Write a function that receives a string as a parameter and returns a dictionary in which the keys are the characters in the character string and the values are the number of occurrences of that character in the given text.
# Example: For string "Ana has apples." given as a parameter the function will return the dicti... | normal | {
"blob_id": "14807568af046594644095a2682e0eba4f445b26",
"index": 8053,
"step-1": "<mask token>\n\n\ndef funct(string):\n dict = {}\n for i in string:\n if i in dict:\n dict[i] += 1\n else:\n dict[i] = 1\n return dict\n\n\n<mask token>\n\n\ndef counter():\n string =... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for key, group in itertools.groupby('ABAABBBCCAAA'):
print(key, list(group))
<|reserved_special_token_1|>
import itertools
for key, group in itertools.groupby('ABAABBBCCAAA'):
print(key, list(group))
<|reserved_specia... | flexible | {
"blob_id": "b5568e84e19719f0fd72197ead47bd050e09f55d",
"index": 7310,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor key, group in itertools.groupby('ABAABBBCCAAA'):\n print(key, list(group))\n",
"step-3": "import itertools\nfor key, group in itertools.groupby('ABAABBBCCAAA'):\n print(key, l... | [
0,
1,
2,
3
] |
""" Class template
Ipea's Python for agent-based modeling course
"""
import random
# class name typically Capital letter
class Pessoa:
# Usually has an __init__ method called at the moment of instance creation
def __init__(self, name, distancia):
# Armazena os parâmetros de início dentro daqu... | normal | {
"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|>
def draw_circle():
niki = turtle.Turtle()
niki.circle(50)
def draw_triangle():
tri = turtle.Turtle()
tri.shape('turtle')
i = 0
while i < 3:
tri.forward(135)
tri.right(145)
i += 1
<|reserved_special_token_0|>
<|reserved_special_token_1|... | flexible | {
"blob_id": "9a982e0ab7fff882767a98ed01f5ed68bd710888",
"index": 7433,
"step-1": "<mask token>\n\n\ndef draw_circle():\n niki = turtle.Turtle()\n niki.circle(50)\n\n\ndef draw_triangle():\n tri = turtle.Turtle()\n tri.shape('turtle')\n i = 0\n while i < 3:\n tri.forward(135)\n tri... | [
2,
4,
5,
6,
7
] |
#!/usr/bin/env python3
import sys
import cksm
from pathlib import Path
VIRTUAL_TO_ROM = 0x800ff000
def patch_rom(rom_path, payload_path, c_code_path, entry_code_path, out_path):
rom = list(Path(rom_path).read_bytes())
payload = list(Path(payload_path).read_bytes())
c_code = list(Path(c_code_path).read_b... | normal | {
"blob_id": "f566c42674728f1874d89b15102627c3b404c9a0",
"index": 3534,
"step-1": "<mask token>\n\n\ndef patch_rom(rom_path, payload_path, c_code_path, entry_code_path, out_path):\n rom = list(Path(rom_path).read_bytes())\n payload = list(Path(payload_path).read_bytes())\n c_code = list(Path(c_code_path)... | [
1,
2,
3,
4,
5
] |
from flask import request, json, Response, Blueprint
from ..models.DriverModel import DriverModel, DriverSchema
driver_api = Blueprint('drivers', __name__)
driver_schema = DriverSchema()
@driver_api.route('/', methods=['POST'])
def create():
req_data = request.get_json()
data, error = driver_schema.load(req_... | normal | {
"blob_id": "ee7820d50b5020a787fbaf012480e8c70bc0ee41",
"index": 1690,
"step-1": "<mask token>\n\n\n@driver_api.route('/<int:driver_id>', methods=['PUT'])\ndef update(driver_id):\n req_data = request.get_json()\n data, error = driver_schema.load(req_data, partial=True)\n if error:\n return custom... | [
2,
5,
7,
9,
10
] |
# add some description here
import glob
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import xarray as xr
import pandas as pd
import os
import pickle
from scipy.interpolate import griddata
from mpl_toolkits.basemap import Basemap
from mpl_toolkits.axes_grid1 import make_axes_locatable
from mat... | normal | {
"blob_id": "4c1fea4dcf143ec976d3956039616963760d5af6",
"index": 5030,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nmatplotlib.style.use('ggplot')\n<mask token>\nsys.path.append('masterThesisPack/')\n<mask token>\nraw.wind_along.plot(ax=ax)\nax.axhline(y=3 * std, c='k', ls='dashed')\nax.axhline(y=-3 * ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def twitter_authenticate():
return
<|reserved_special_token_0|>
def get_tweets():
return
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def twitter_authenticate():
return
<|reserved_special_token_0|>
def remove_dupes():
return
def get_tweets():
... | flexible | {
"blob_id": "d4683d055ca70f31b050f0d84cb93c030feb4593",
"index": 2179,
"step-1": "<mask token>\n\n\ndef twitter_authenticate():\n return\n\n\n<mask token>\n\n\ndef get_tweets():\n return\n",
"step-2": "<mask token>\n\n\ndef twitter_authenticate():\n return\n\n\n<mask token>\n\n\ndef remove_dupes():\n ... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class TestUtils(test.NoDBTestCase):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class TestUtils(test.NoDBTestCase):
<|reserved_special_token_0|>
def test_compare_... | flexible | {
"blob_id": "9fa1dab7cb0debf363ae0864af1407c87aad063a",
"index": 4926,
"step-1": "<mask token>\n\n\nclass TestUtils(test.NoDBTestCase):\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass TestUtils(test.NoDBTestCase):\n <mask token>\n\n def test_compare_multiple(s... | [
1,
2,
4,
5,
6
] |
from nonebot_plugin_datastore import get_plugin_data
from sqlalchemy import UniqueConstraint
from sqlalchemy.orm import Mapped, MappedAsDataclass, mapped_column
Model = get_plugin_data().Model
class MorningGreeting(MappedAsDataclass, Model):
__table_args__ = (
UniqueConstraint(
"platform",
... | normal | {
"blob_id": "28e5667db4a620ec627cd94154a024b4c8dbc5f7",
"index": 6171,
"step-1": "<mask token>\n\n\nclass MorningGreeting(MappedAsDataclass, Model):\n <mask token>\n id: Mapped[int] = mapped_column(init=False, primary_key=True)\n platform: Mapped[str]\n bot_id: Mapped[str]\n group_id: Mapped[str] ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def constrain(val, minv, maxv):
return min(maxv, max(minv, val))
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def constrain(val, minv, maxv):
return min(maxv, max(minv, val))
<|reserved_special_token_0|>
control(pi, ESC, 1500, STE... | flexible | {
"blob_id": "3ccbafbdc84447438c194288b1409e332bb2b479",
"index": 3630,
"step-1": "<mask token>\n\n\ndef constrain(val, minv, maxv):\n return min(maxv, max(minv, val))\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef constrain(val, minv, maxv):\n return min(maxv, max(minv, val))\n\n\n<mask token>\nc... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def main():
lCommandLineArgs = CommandLineParser().parse()
lPathmaker = Pathmaker(lCommandLineArgs.root, lCommandLineArgs.top,
lCommandLineArgs.componentmap, lCommandLineArgs.verbosity)
lDepFileParser = DepFi... | flexible | {
"blob_id": "ccfc78ae430f835244e0618afdeebe960c868415",
"index": 6126,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n lCommandLineArgs = CommandLineParser().parse()\n lPathmaker = Pathmaker(lCommandLineArgs.root, lCommandLineArgs.top,\n lCommandLineArgs.componentmap, lComma... | [
0,
1,
2,
3,
4
] |
# coding: utf-8
"""
最简单的计数器,仅仅为了展示基本方式
"""
import tensorflow as tf
# 创建一个变量, 初始化为标量 0
state = tf.Variable(0, name="counter")
# 创建一个operation, 其作用是使state 增加 1
one = tf.constant(1)
new_value = tf.add(state, one)
update = tf.assign(state, new_value) # 这样才能重复执行+1的操作,实际上就代表:state=new_value
# 启动图后, 变量必须先经过`初始化` (init) o... | normal | {
"blob_id": "cf4582f4d0c6c94e617270a45425fe0b770142e0",
"index": 2937,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith tf.Session() as sess:\n sess.run(init_op)\n print(sess.run(state))\n for _ in range(10):\n sess.run(new_value)\n print(sess.run(new_value))\n",
"step-3": "<m... | [
0,
1,
2,
3,
4
] |
"""
Python wrapper that connects CPython interpreter to the numba dictobject.
"""
from collections import MutableMapping
from numba.types import DictType, TypeRef
from numba import njit, dictobject, types, cgutils
from numba.extending import (
overload_method,
box,
unbox,
NativeValue
)
@njit
def _mak... | normal | {
"blob_id": "ad44e9411ba6a07c54bb55b0d8af9d0c16c6b71b",
"index": 5173,
"step-1": "<mask token>\n\n\ndef _from_meminfo_ptr(ptr, dicttype):\n d = TypedDict(meminfo=ptr, dcttype=dicttype)\n return d\n\n\nclass TypedDict(MutableMapping):\n \"\"\"A typed-dictionary usable in Numba compiled functions.\n\n ... | [
19,
24,
28,
29,
33
] |
<|reserved_special_token_0|>
class BlenderDataset(Dataset):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def get_coords2d(self, H, W):
coord = np.linspace(0, 1, H, endpoint=False)
coords = np.stack(np.meshgrid(coord, coord), -1)
return coords
<|reserved_special_to... | flexible | {
"blob_id": "7180dc0d622fd449fcee32f2c50000d05ae2d8bb",
"index": 6850,
"step-1": "<mask token>\n\n\nclass BlenderDataset(Dataset):\n <mask token>\n <mask token>\n\n def get_coords2d(self, H, W):\n coord = np.linspace(0, 1, H, endpoint=False)\n coords = np.stack(np.meshgrid(coord, coord), -... | [
6,
9,
12,
14,
16
] |
#!/usr/bin/python3
"""0. How many subs"""
def number_of_subscribers(subreddit):
"""return the number of subscribers from an Reddit API"""
import requests
resInf = requests.get("https://www.reddit.com/r/{}/about.json"
.format(subreddit),
headers={"Us... | normal | {
"blob_id": "db1e3a109af2db2c8794a7c9c7dfb0c2ccee5800",
"index": 932,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef number_of_subscribers(subreddit):\n \"\"\"return the number of subscribers from an Reddit API\"\"\"\n import requests\n resInf = requests.get('https://www.reddit.com/r/{}/... | [
0,
1,
2
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.