code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids sequencelengths 1 5 |
|---|---|---|---|
#! /usr/bin/env python2
############################################################
# Program is part of PySAR v1.2 #
# Copyright(c) 2015, Heresh Fattahi, Zhang Yunjun #
# Author: Heresh Fattahi, Zhang Yunjun #
####################################################... | normal | {
"blob_id": "9515dcdfc0ece1a6740d6e7075bbcd1c20977590",
"index": 9157,
"step-1": "#! /usr/bin/env python2\n############################################################\n# Program is part of PySAR v1.2 #\n# Copyright(c) 2015, Heresh Fattahi, Zhang Yunjun #\n# Author: Heresh Fa... | [
0
] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from django.http import JsonResponse
from knowdb.models import Knowledge
import random
# Create your views here.
def answer(request):
ret = {}
data = Knowledge.objects.all()
num = random.choice(range(1,int... | normal | {
"blob_id": "eb558644283d992af2c324d457dbe674b714235f",
"index": 735,
"step-1": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.shortcuts import render\nfrom django.http import JsonResponse\nfrom knowdb.models import Knowledge\n\nimport random\n# Create your views here.\n\ndef an... | [
0
] |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
# Copyright © YXC
# CreateTime: 2016-03-09 10:06:02
"""
Example of functions with arbitrary number arguments
"""
def optional_argument_func(arg1='', arg2=''):
"""
Function with two optional arguments
"""
print("arg1:{0}".format(arg1))
... | normal | {
"blob_id": "061a78650e2abf6a9d1e4796dd349174a8df5cb8",
"index": 8747,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef optional_argument_func(arg1='', arg2=''):\n \"\"\"\n Function with two optional arguments\n \"\"\"\n print('arg1:{0}'.format(arg1))\n print('arg2:{0}'.format(arg2))... | [
0,
1,
2,
3,
4
] |
import unittest
import sys
import os
#Add project root to path
sys.path.append('../..')
from speckle.SpeckleClient import SpeckleApiClient
class TestSpeckleStream(unittest.TestCase):
def setUp(self):
self.s = SpeckleApiClient()
self.user = {'email':'testuser@arup.com','password':'testpassword',... | normal | {
"blob_id": "b39403171ed264c8fae5ea4ae9d17f77cfcab497",
"index": 9122,
"step-1": "<mask token>\n\n\nclass TestSpeckleStream(unittest.TestCase):\n\n def setUp(self):\n self.s = SpeckleApiClient()\n self.user = {'email': 'testuser@arup.com', 'password':\n 'testpassword', 'username': 'te... | [
7,
11,
12,
13,
14
] |
def lucas():
yield 2
a = 2
b = 1
while True:
yield b
a, b = b, a + b
l = lucas()
for i in range(10):
print('{}: {}'.format(i, next(l)))
| normal | {
"blob_id": "4745c00ca0f3ca4316117228a9d44bdb5df02877",
"index": 7799,
"step-1": "<mask token>\n",
"step-2": "def lucas():\n yield 2\n a = 2\n b = 1\n while True:\n yield b\n a, b = b, a + b\n\n\n<mask token>\n",
"step-3": "def lucas():\n yield 2\n a = 2\n b = 1\n while ... | [
0,
1,
2,
3
] |
def solution(S):
# write your code in Python 3.6
# Definitions
log_sep = ','
num_sep = '-'
time_sep = ':'
# Initialization
from collections import defaultdict
# defaultdict initialize missing key to default value -> 0
bill = defaultdict(int)
total = defaultdict(int)
calls = S... | normal | {
"blob_id": "bf8bbeb408cb75af314ef9f3907456036e731c0b",
"index": 294,
"step-1": "<mask token>\n",
"step-2": "def solution(S):\n log_sep = ','\n num_sep = '-'\n time_sep = ':'\n from collections import defaultdict\n bill = defaultdict(int)\n total = defaultdict(int)\n calls = S.splitlines()... | [
0,
1,
2
] |
from data_structures.datacenter import Datacenter, urllib, json,
URL = "http://www.mocky.io/v2/5e539b332e00007c002dacbe"
def get_data(url, max_retries=5, delay_between_retries=1):
"""
Fetch the data from http://www.mocky.io/v2/5e539b332e00007c002dacbe
and return it as a JSON object.
Args:
... | normal | {
"blob_id": "e56a7912b9940b1cab6c19d0047f1f60f0083f66",
"index": 4911,
"step-1": "from data_structures.datacenter import Datacenter, urllib, json,\n\n\nURL = \"http://www.mocky.io/v2/5e539b332e00007c002dacbe\"\n\n\ndef get_data(url, max_retries=5, delay_between_retries=1):\n \"\"\"\n Fetch the data from ht... | [
0
] |
#!usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author: Jack
@datetime: 2018/8/31 13:32
@E-mail: zhangxianlei117@gmail.com
"""
def isValid(s):
stack = []
for ss in s:
if ss in '([{':
stack.append(ss)
if ss in ')]}':
if len(stack) <= 0:
return Fal... | normal | {
"blob_id": "607f0aac0d6d2c05737f59803befcff37d559398",
"index": 5117,
"step-1": "#!usr/bin/env python\n# -*- coding:utf-8 -*-\n\"\"\"\n@author: Jack\n@datetime: 2018/8/31 13:32\n@E-mail: zhangxianlei117@gmail.com\n\"\"\"\n\n\ndef isValid(s):\n stack = []\n for ss in s:\n if ss in '([{':\n ... | [
0
] |
version https://git-lfs.github.com/spec/v1
oid sha256:7f0b7267333e6a4a73d3df0ee7f384f7b3cb6ffb14ed2dc8a5894b853bac8957
size 1323
| normal | {
"blob_id": "f1972baee8b399c9a52561c8f015f71cb9922bb0",
"index": 4875,
"step-1": "version https://git-lfs.github.com/spec/v1\noid sha256:7f0b7267333e6a4a73d3df0ee7f384f7b3cb6ffb14ed2dc8a5894b853bac8957\nsize 1323\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
... | [
0
] |
from flask import Flask
from flask import render_template
import datetime
from person import Person
import requests
from post import Post
app = Flask(__name__)
all_posts = all_posts = requests.get(
"https://api.npoint.io/5abcca6f4e39b4955965").json()
post_objects = []
for post in all_posts:
post_obj = Post(po... | normal | {
"blob_id": "895ece0b8d45cd64e43f8ddc54824f7647254185",
"index": 2547,
"step-1": "<mask token>\n\n\n@app.route('/guess/<name>')\ndef guesser(name):\n person = Person(name=name)\n return render_template('guess.html', name=person.name, gender=person.\n gender, age=person.age, country=person.country)\n... | [
2,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
def main():
reader = csv.reader(row for row in fileinput.input() if not row.
startswith('#'))
circles = lps.parse_lps(reader)
for circle in circles:
circle.r = R
print(circle)
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_spe... | flexible | {
"blob_id": "00f62fec7f5372c5798b0ebf3f3783233360581e",
"index": 2987,
"step-1": "<mask token>\n\n\ndef main():\n reader = csv.reader(row for row in fileinput.input() if not row.\n startswith('#'))\n circles = lps.parse_lps(reader)\n for circle in circles:\n circle.r = R\n print(cir... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if d == m:
print(a[0])
elif 0 < d < m:
for i in range(hmin, hmax + 1):
fin1 = a[0] - i + m
if hmin <= fin1 - a[-1] <= hmax or fin1 == a[-1]:
print(a[0] - i)
found = 1
bre... | flexible | {
"blob_id": "3da82bcff0a4f91c1245892bc01e9f743ea354a8",
"index": 4484,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif d == m:\n print(a[0])\nelif 0 < d < m:\n for i in range(hmin, hmax + 1):\n fin1 = a[0] - i + m\n if hmin <= fin1 - a[-1] <= hmax or fin1 == a[-1]:\n prin... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
@transaction.atomic
def computers(request):
ctx = {}
computer = Computer.objects.all()
ctx['brand'] = Brand.objects.all()
if request.method == 'POST':
if request.POST['computer_id'] != '':
computer = computer.filter(computer_id__icontains=request.POST[
... | flexible | {
"blob_id": "18689741a33e6d17e694ee0619a1f36d8d178cbb",
"index": 3223,
"step-1": "<mask token>\n\n\n@transaction.atomic\ndef computers(request):\n ctx = {}\n computer = Computer.objects.all()\n ctx['brand'] = Brand.objects.all()\n if request.method == 'POST':\n if request.POST['computer_id'] !... | [
1,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while t:
t -= 1
y = []
z = []
x = str(input())
for i in range(len(x)):
if not int(i) % 2:
y.append(x[i])
else:
z.append(x[i])
print(''.join(y) + ' ' + ''.join(z))
<... | flexible | {
"blob_id": "ac32fb5fcd71790f9dbf0794992a9dc92a202c9b",
"index": 7972,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile t:\n t -= 1\n y = []\n z = []\n x = str(input())\n for i in range(len(x)):\n if not int(i) % 2:\n y.append(x[i])\n else:\n z.appen... | [
0,
1,
2,
3
] |
#!usr/bin/env python
#-*- coding:utf-8 -*-
# this model is for decision tree
# objective: To cluster different service
# JialongLi 2017/03/18
import re
import os
import sys
import pickle
import copy
import random
import pydotplus
USER_NUM = 1000
reload(sys)
sys.setdefaultencoding( "utf-8" )
from ... | normal | {
"blob_id": "65c0d940bacc2d016121812c435cc60f3fc1ba90",
"index": 7233,
"step-1": "#!usr/bin/env python\r\n#-*- coding:utf-8 -*-\r\n\r\n# this model is for decision tree\r\n# objective: To cluster different service\r\n# JialongLi 2017/03/18\r\n\r\nimport re\r\nimport os\r\nimport sys\r\nimport pickle\r\nimport co... | [
0
] |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 25