code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
from flask import *
app = Flask(__name__)
from app import views
from app import admin_views
from app import usr_reg
from app import cookie
from app import db_connect
| normal | {
"blob_id": "e736991f364ba9ff709348e4b1f612b1e9673281",
"index": 252,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napp = Flask(__name__)\n<mask token>\n",
"step-3": "from flask import *\napp = Flask(__name__)\nfrom app import views\nfrom app import admin_views\nfrom app import usr_reg\nfrom app impor... | [
0,
1,
2
] |
import re
with open('input.txt') as f:
input_file = f.readlines()
input_file = [x.strip() for x in input_file]
def check_passport(text):
arr = text.split()
dct = {}
for elem in arr:
key = elem.split(":")[0]
val = elem.split(":")[1]
dct[key] = val
try:
if len(dc... | normal | {
"blob_id": "166329c967e83806e3482179a56ac7e5541d5010",
"index": 1589,
"step-1": "<mask token>\n\n\ndef check_passport(text):\n arr = text.split()\n dct = {}\n for elem in arr:\n key = elem.split(':')[0]\n val = elem.split(':')[1]\n dct[key] = val\n try:\n if len(dct['byr'... | [
1,
2,
3,
4,
5
] |
from twisted.internet import reactor
from scrapy.crawler import Crawler
from scrapy.settings import CrawlerSettings
from scrapy import log, signals
from spiders.songspk_spider import SongsPKSpider
from scrapy.xlib.pydispatch import dispatcher
def stop_reactor():
reactor.stop()
dispatcher.connect(stop_reactor, sig... | normal | {
"blob_id": "0d14534b210b13ede4a687e418d05d756d221950",
"index": 3297,
"step-1": "from twisted.internet import reactor\nfrom scrapy.crawler import Crawler\nfrom scrapy.settings import CrawlerSettings\nfrom scrapy import log, signals\nfrom spiders.songspk_spider import SongsPKSpider\nfrom scrapy.xlib.pydispatch i... | [
0
] |
import json
import pickle
import zlib
from diskcollections.interfaces import IHandler
class PickleHandler(IHandler):
dumps = staticmethod(pickle.dumps)
loads = staticmethod(pickle.loads)
class PickleZLibHandler(IHandler):
@staticmethod
def dumps(obj, protocol=pickle.HIGHEST_PROTOCOL, level=zlib.
... | normal | {
"blob_id": "60202758a0a42fc26dc1bca9f134a70f28967093",
"index": 2728,
"step-1": "<mask token>\n\n\nclass PickleZLibHandler(IHandler):\n\n @staticmethod\n def dumps(obj, protocol=pickle.HIGHEST_PROTOCOL, level=zlib.\n Z_DEFAULT_COMPRESSION):\n pickled = pickle.dumps(obj, protocol=protocol)\n ... | [
8,
9,
10,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
@game_blueprint.route('/<string:game_id>')
@requires_login
def game_index(game_id):
return render_template('game/game.html')
<|reserved_special_token_1|>
<|reserved_special_token_0|>
game_blueprint = Blueprint('game', __n... | flexible | {
"blob_id": "1ccb23435d8501ed82debf91bd6bf856830d01cb",
"index": 6063,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@game_blueprint.route('/<string:game_id>')\n@requires_login\ndef game_index(game_id):\n return render_template('game/game.html')\n",
"step-3": "<mask token>\ngame_blueprint = Blu... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
try:
r = requests.get(url)
r.raise_for_status()
print(r.encoding)
r.encoding = r.apparent_encoding
print(r.text[:1000])
print(r.apparent_encoding)
except:
print('error')
<|reserved_special_token_1|>
... | flexible | {
"blob_id": "0271c45a21047b948946dd76f147692bb16b8bcf",
"index": 5378,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntry:\n r = requests.get(url)\n r.raise_for_status()\n print(r.encoding)\n r.encoding = r.apparent_encoding\n print(r.text[:1000])\n print(r.apparent_encoding)\nexcept:\n... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class URL(models.Model):
<|reserved_special_token_0|>
<|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 URL(models.Model):
<|reser... | flexible | {
"blob_id": "2dcb02ea2f36dd31eda13c1d666201f861c117e7",
"index": 4027,
"step-1": "<mask token>\n\n\nclass URL(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass URL(models.Model):\n <mask token>\n <mask token>\n ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def work1(num):
global g_num
for i in range(num):
g_num += 1
print('__in work1: g_num is {}'.format(g_num))
def work2(num):
global g_num
for i in range(num):
g_num += 1
print('__in work2: g_num is {}'.format(g_num))
def main():
print('__线程创建... | flexible | {
"blob_id": "60079005c2091d2dc0b76fb71739671873f0e0f1",
"index": 9534,
"step-1": "<mask token>\n\n\ndef work1(num):\n global g_num\n for i in range(num):\n g_num += 1\n print('__in work1: g_num is {}'.format(g_num))\n\n\ndef work2(num):\n global g_num\n for i in range(num):\n g_num +... | [
3,
4,
5,
6,
7
] |
class Solution:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
def repeatedNTimes(self, A):
freq = {}
for i in A:
if i in freq.keys():
freq[i] += 1
else:
freq[i] = 1
key ... | flexible | {
"blob_id": "d50618f7784e69b46cb665ec1a9c56f7a2867785",
"index": 5033,
"step-1": "class Solution:\n <mask token>\n\n\n<mask token>\n",
"step-2": "class Solution:\n\n def repeatedNTimes(self, A):\n freq = {}\n for i in A:\n if i in freq.keys():\n freq[i] += 1\n ... | [
1,
2,
3,
4,
5
] |
import aiohttp
import asyncio
import base64
import discord
import json
from discord.ext import commands
class BasicMC(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.session = aiohttp.ClientSession()
@commands.command(name="stealskin", aliases=["skinsteal", "skin"])
@command... | normal | {
"blob_id": "a6f242a0443ffbad835f86098b70ede41c03515b",
"index": 7652,
"step-1": "<mask token>\n\n\nclass BasicMC(commands.Cog):\n <mask token>\n\n @commands.command(name='stealskin', aliases=['skinsteal', 'skin'])\n @commands.cooldown(1, 4, commands.BucketType.user)\n async def skinner(self, ctx, ga... | [
1,
2,
3,
4,
5
] |
from django.apps import AppConfig
class MarketingemailsConfig(AppConfig):
name = 'marketingemails'
| normal | {
"blob_id": "19bb58ab440ca00bf6410a70a8b6bbc24eec96c1",
"index": 492,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass MarketingemailsConfig(AppConfig):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass MarketingemailsConfig(AppConfig):\n name = 'marketingemails'\n",
"step-4": "from... | [
0,
1,
2,
3
] |
from modeller import *
from modeller.automodel import *
# This part was within the script loop_modelling_2
# Here is is in a separate file for loop_modelling_3 so the script can be run in parallel
class MyLoop(dopehr_loopmodel):
def select_atoms(self):
# Here only the second loop atoms are allowed to move s... | normal | {
"blob_id": "d058c3df8513e07e4ff7035aa5c5885819e43687",
"index": 7295,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass MyLoop(dopehr_loopmodel):\n <mask token>\n\n def select_loop_atoms(self):\n return selection(self.residue_range('218:', '231:'))\n",
"step-3": "<mask token>\n\n\n... | [
0,
2,
3,
4,
5
] |
from sympy import *
import sys
x = Symbol("x")
# EOF
try:
in_str = input()
except Exception as e:
print("WRONG FORMAT!") # Wrong Format!
sys.exit(0)
in_str = in_str.replace("^", "**") #change '^'into'**' for recognition
# wrong expression
try:
in_exp = eval(in_str) # turn s... | normal | {
"blob_id": "1634ae0e329b4f277fa96a870fbd19626c0ece81",
"index": 6516,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntry:\n in_str = input()\nexcept Exception as e:\n print('WRONG FORMAT!')\n sys.exit(0)\n<mask token>\ntry:\n in_exp = eval(in_str)\nexcept Exception as e:\n print('WRONG FO... | [
0,
1,
2,
3,
4
] |
# Time :O(N) space: O(1)
def swap(arr, start, end):
while start < end:
arr[start], arr[end] = arr[end], arr[start]
start += 1
end -= 1
def rotation(arr, k, n):
k = k % n
swap(arr, 0, k-1)
print(arr)
swap(arr, k, n-1)
print(arr)
swap(arr, 0, n-1)
print(arr)
if _... | normal | {
"blob_id": "2180146da7ea745f5917ee66fd8c467437b5af4c",
"index": 6761,
"step-1": "<mask token>\n",
"step-2": "def swap(arr, start, end):\n while start < end:\n arr[start], arr[end] = arr[end], arr[start]\n start += 1\n end -= 1\n\n\n<mask token>\n",
"step-3": "def swap(arr, start, end... | [
0,
1,
2,
3,
4
] |
# Generated by Django 2.2.6 on 2020-05-27 19:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pancar', '0006_auto_20200526_1058'),
]
operations = [
migrations.AlterField(
model_name='process',
name='price',
... | normal | {
"blob_id": "316a34bbc2b3e3c818ef837f51bc1f86863ea59a",
"index": 2473,
"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 = [('pancar', '0... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class MonthYearWidget(DateWidget):
""" Month and year widget """
zope.interface.implementsOnly(IMonthYearWidget)
klass = u'monthyear-widget'
value = '', '', 1
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class MonthYearWidge... | flexible | {
"blob_id": "d0f9dd0a06023dd844b0bf70dff360f6bb46c152",
"index": 4412,
"step-1": "<mask token>\n\n\nclass MonthYearWidget(DateWidget):\n \"\"\" Month and year widget \"\"\"\n zope.interface.implementsOnly(IMonthYearWidget)\n klass = u'monthyear-widget'\n value = '', '', 1\n\n\n<mask token>\n",
"ste... | [
3,
4,
5,
6,
7
] |
x = '我是一个字符串'
y = "我也是一个字符串"
z = """我还是一个字符串"""
#字符串str用单引号(' ')或双引号(" ")括起来
#使用反斜杠(\)转义特殊字符。
s = 'Yes,he doesn\'t'
#如果你不想让反斜杠发生转义,
#可以在字符串前面添加一个r,表示原始字符串
print('C:\some\name')
print('C:\\some\\name')
print(r'C:\some\name')
#反斜杠可以作为续行符,表示下一行是上一行的延续。
s = "abcd\
efg"
print(s)
#还可以使用"""...""... | normal | {
"blob_id": "8fe9d21bb65b795a6633ab390f7f5d24a90146d5",
"index": 6774,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('C:\\\\some\\name')\nprint('C:\\\\some\\\\name')\nprint('C:\\\\some\\\\name')\n<mask token>\nprint(s)\n<mask token>\nprint(s)\n",
"step-3": "x = '我是一个字符串'\ny = '我也是一个字符串'\nz = '我还... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
"""Diverse wiskundige structuren weergeven in LaTeX in Jupyter Notebook."""
__author__ = "Brian van der Bijl"
__copyright__ = "Copyright 2020, Hogeschool Utrecht"
from IPython.display import display, Math, Markdown
import re
def show_num(x):
return re.compile(r"\.(?!\d)")... | normal | {
"blob_id": "7f7bd2e9ec1932ccfd8aa900956ce85473ee8dbd",
"index": 4668,
"step-1": "<mask token>\n\n\ndef latex_formula(form):\n latex = form.simplify().to_latex(outer=True)\n if latex:\n display(Math(latex))\n display(Markdown('<details><pre>$' + latex + '$</pre></details>'))\n\n\n<mask token>... | [
1,
5,
7,
9,
10
] |
<|reserved_special_token_0|>
def Yes():
global player
global comp
tplayer = randint(1, 6)
tcomp = randint(1, 6)
message = ''
if tplayer > tcomp:
message = 'Wygrales!'
player += 1
elif tplayer == tcomp:
message = 'Remis'
else:
message = 'Przegrales'
... | flexible | {
"blob_id": "0a5baacf17d33dbf6ea69114a8632f7fcef52c3c",
"index": 9419,
"step-1": "<mask token>\n\n\ndef Yes():\n global player\n global comp\n tplayer = randint(1, 6)\n tcomp = randint(1, 6)\n message = ''\n if tplayer > tcomp:\n message = 'Wygrales!'\n player += 1\n elif tplay... | [
2,
3,
4,
5,
6
] |
from get_info import parse_matches as pm
def all_match_data(year):
"""
Searches through the parse_matches data for all games in a specific season prints them out with a game ID and
returns the data in a list to the main program
:param year: Specific format YYYY between 2008 - 2017
:return: year_ma... | normal | {
"blob_id": "bc53af24bb46d2be3122e290c4732b312f4ebdf5",
"index": 5313,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef all_match_data(year):\n \"\"\"\n Searches through the parse_matches data for all games in a specific season prints them out with a game ID and\n returns the data in a lis... | [
0,
1,
2,
3
] |
import sys
n = int(input())
min_number = sys.maxsize
max_number = -sys.maxsize
for i in range(0, n):
num = int(input())
if num > max_number:
max_number = num
if num < min_number:
min_number = num
print(f"Max number: {max_number}")
print(f"Min number: {min_number}") | normal | {
"blob_id": "ac6f2287390bdad8fe20cdc73c0063f685970cfb",
"index": 5289,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(0, n):\n num = int(input())\n if num > max_number:\n max_number = num\n if num < min_number:\n min_number = num\nprint(f'Max number: {max_number}')\n... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class Command(NoArgsCommand):
"""
Import directory structure into the filer ::
manage.py --path=/tmp/assets/images
manage.py --path=/tmp/assets/news --folder=images
"""
option_list = BaseCommand.option_list + (make_option('--path', action=
'store',... | flexible | {
"blob_id": "864e9063ec1ed80cd1da3128a38633cbeb2f8bba",
"index": 3775,
"step-1": "<mask token>\n\n\nclass Command(NoArgsCommand):\n \"\"\"\n Import directory structure into the filer ::\n\n manage.py --path=/tmp/assets/images\n manage.py --path=/tmp/assets/news --folder=images\n \"\"\"\n ... | [
4,
6,
9,
11,
12
] |
<|reserved_special_token_0|>
def part_one():
"""Solution to Part 1"""
return ''.join(networkx.lexicographical_topological_sort(G))
def part_two():
"""Solution to Part 2"""
tasks = {}
current_time = 0
while G.nodes():
candidate_next_tasks = [task for task in G.nodes() if task not in
... | flexible | {
"blob_id": "1c5884c10ac0b6a3335f8e677007fc52311245e2",
"index": 7603,
"step-1": "<mask token>\n\n\ndef part_one():\n \"\"\"Solution to Part 1\"\"\"\n return ''.join(networkx.lexicographical_topological_sort(G))\n\n\ndef part_two():\n \"\"\"Solution to Part 2\"\"\"\n tasks = {}\n current_time = 0\... | [
2,
3,
4,
5,
6
] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
MQTT handler for Event subscriptions.
"""
import json
import time
import tornado.gen
import tornado.ioloop
from hbmqtt.mqtt.constants import QOS_0
from tornado.queues import QueueFull
from wotpy.protocols.mqtt.handlers.base import BaseMQTTHandler
from wotpy.protocol... | normal | {
"blob_id": "b3f72bc12f85724ddcdaf1c151fd2a68b29432e8",
"index": 6545,
"step-1": "<mask token>\n\n\nclass EventMQTTHandler(BaseMQTTHandler):\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, mqtt_server, qos=QOS_0, callback_ms=None):\n super(EventMQTTHandler, self).__init__(m... | [
6,
7,
8,
9,
10
] |
<|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": "d145f4c061c8f364756012832a07adc305e35e5c",
"index": 5772,
"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
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
os.mkdir(base_dir)
<|reserved_special_token_0|>
os.mkdir(train_dir)
<|reserved_special_token_0|>
os.mkdir(validation_dir)
<|reserved_special_token_0|>
os.mkdir(test_dir)
<|reserved_special_token_0|>
os.mkdir(train_cats_dir)
<|rese... | flexible | {
"blob_id": "8340872f03c1bf7c1aee0c437258ac8e44e08bb8",
"index": 7313,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nos.mkdir(base_dir)\n<mask token>\nos.mkdir(train_dir)\n<mask token>\nos.mkdir(validation_dir)\n<mask token>\nos.mkdir(test_dir)\n<mask token>\nos.mkdir(train_cats_dir)\n<mask token>\nos.m... | [
0,
1,
2,
3,
4
] |
from django.db import models
# Create your models here.
class Login(models.Model):
trinity_id = models.CharField('',max_length=200)
trinity_password = models.CharField('',max_length=500)
objects = models.Manager() | normal | {
"blob_id": "1c5cb9363c2903905f1026ede77615e8373c250b",
"index": 7321,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Login(models.Model):\n <mask token>\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Login(models.Model):\n trinity_id = models.CharField('', m... | [
0,
1,
2,
3,
4
] |
class Solution(object):
def moveZeroes(self, nums):
"""
给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。
---
输入: [0,1,0,3,12]
输出: [1,3,12,0,0]
---
思路;
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
num = nums.count(0)
while 0 i... | normal | {
"blob_id": "ece80a7765674f9d2991029bb86486b616a90f58",
"index": 3944,
"step-1": "<mask token>\n",
"step-2": "class Solution(object):\n <mask token>\n",
"step-3": "class Solution(object):\n\n def moveZeroes(self, nums):\n \"\"\"\n\t\t给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。\n\t\t---\n\t\t... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
from mtots.parser import base
from mtots.parser import combinator
from mtots.parser.combinator import All
from mtots.parser.combinator import Any
from mtots.parser.combinator import AnyTokenBut
from mtots.parser.combinator import Forward
from mtots.parser.com... | flexible | {
"blob_id": "f9edbef46494cc2993c6a633fe35406524dbbf67",
"index": 1199,
"step-1": "<mask token>\n",
"step-2": "from mtots.parser import base\nfrom mtots.parser import combinator\nfrom mtots.parser.combinator import All\nfrom mtots.parser.combinator import Any\nfrom mtots.parser.combinator import AnyTokenBut\nfr... | [
0,
1
] |
import numpy as np
mydict = {}
mylist0 = np.array([1, 2, 3, 4, 5])
mylist1 = np.array([2, 3, 4, 5, 6])
print(mydict)
print(mylist0)
print(mylist1)
for c in ('0', '1'):
if c in mydict:
mydict[c] += mylist0
else:
mydict[c] = mylist0
print(mydict)
for c in ('0', '1'):
if c in mydict:
my... | normal | {
"blob_id": "6e5b8be6182f39f185f4547f0abd84a4e404bf34",
"index": 1861,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(mydict)\nprint(mylist0)\nprint(mylist1)\nfor c in ('0', '1'):\n if c in mydict:\n mydict[c] += mylist0\n else:\n mydict[c] = mylist0\nprint(mydict)\nfor c in ('0... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class MfccLocal(Mfcc):
<|reserved_special_token_0|>
abstract_class = False
@staticmethod
def sample_result_filename(out_sample_path):
return f'{out_sample_path[:-5]}_mfcc_result.json'
@staticmethod
def filenames_to_skip_sample(out_sample_path):
re... | flexible | {
"blob_id": "44214492dd7283da4b9a77bd2a1fa9d9c0643ff2",
"index": 1188,
"step-1": "<mask token>\n\n\nclass MfccLocal(Mfcc):\n <mask token>\n abstract_class = False\n\n @staticmethod\n def sample_result_filename(out_sample_path):\n return f'{out_sample_path[:-5]}_mfcc_result.json'\n\n @static... | [
6,
7,
8,
9,
10
] |
<|reserved_special_token_0|>
class Solution(object):
<|reserved_special_token_0|>
directions = [(-1, 0), (0, 1), (1, 0), (0, -1)]
def numIslands(self, grid):
"""
:type grid: List[List[str]]
:rtype: int
"""
if len(grid) == 0:
return 0
m = len(gri... | flexible | {
"blob_id": "b46f19708e9e2a1be2bbd001ca6341ee7468a60d",
"index": 7147,
"step-1": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n directions = [(-1, 0), (0, 1), (1, 0), (0, -1)]\n\n def numIslands(self, grid):\n \"\"\"\n :type grid: List[List[str]]\n :rtype: int\n ... | [
3,
5,
7,
10,
12
] |
<|reserved_special_token_0|>
def deconnexion(Chrome):
"""登陆"""
"""初始化"""
global web, actions
web = webdriver.Chrome(Chrome)
web.maximize_window()
web.implicitly_wait(10)
web.get(
'http://www.wjw-cdc.com:8003/user-center-portal/login?redirect=%2Fmain'
)
actions = ActionC... | flexible | {
"blob_id": "d2c31d9c3cc66b43966cfd852582539d4e4bea17",
"index": 321,
"step-1": "<mask token>\n\n\ndef deconnexion(Chrome):\n \"\"\"登陆\"\"\"\n \"\"\"初始化\"\"\"\n global web, actions\n web = webdriver.Chrome(Chrome)\n web.maximize_window()\n web.implicitly_wait(10)\n web.get(\n 'http://... | [
10,
14,
16,
18,
20
] |
#! /usr/bin/python
import Nodo,CLS,copy,sys
from excepcion import *
sys.setrecursionlimit(100000)
# Match
def match(nodo1,nodo2):
#print 'MATCH\n -',nodo1,'\n -',nodo2
# if isinstance(nodo1,Nodo.Nodo) and isinstance(nodo2,Nodo.Nodo):
# print ' -',nodo1.type,'\n -',nodo2.type
# Fin de recursion
if (not isinsta... | normal | {
"blob_id": "1178ad09638a4822461f7394e6cabb2db9516053",
"index": 9664,
"step-1": "#! /usr/bin/python\nimport Nodo,CLS,copy,sys\nfrom excepcion import *\nsys.setrecursionlimit(100000)\n# Match\ndef match(nodo1,nodo2):\n\t#print 'MATCH\\n -',nodo1,'\\n -',nodo2\n#\tif isinstance(nodo1,Nodo.Nodo) and isinstance(nod... | [
0
] |
import urllib.request
def get_html(url):
"""
Returns the html of url or None if status code is not 200
"""
req = urllib.request.Request(
url,
headers={
'User-Agent': 'Python Learning Program',
'From': 'hklee310@gmail.com'
}
)
resp = urllib.reques... | normal | {
"blob_id": "4572e243f75ad92c04f5cdc0b454df7389183a6a",
"index": 3238,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_html(url):\n \"\"\"\n Returns the html of url or None if status code is not 200\n \"\"\"\n req = urllib.request.Request(url, headers={'User-Agent':\n 'Pytho... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if numero % 2 == 0:
p = numero
print(p, 'é um número par')
else:
i = numero
print(i, 'é um número ímpar')
<|reserved_special_token_1|>
p = 0
i = 0
numero = int(input('Insira um número: '))
if numero % 2 == 0:
... | flexible | {
"blob_id": "382bc321c5fd35682bc735ca4d6e293d09be64ec",
"index": 9990,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif numero % 2 == 0:\n p = numero\n print(p, 'é um número par')\nelse:\n i = numero\n print(i, 'é um número ímpar')\n",
"step-3": "p = 0\ni = 0\nnumero = int(input('Insira um... | [
0,
1,
2,
3
] |
# This simulation obtains dose on a cylindical disk phantom at various
# distances from a 14MeV photon source. Dose in millisieverts is found
# and compared to the yearly limit
# The model is built to have a human tissue and human height and volume which
# is typically referred to as a phantom.
# source details based... | normal | {
"blob_id": "28bf11cb4205dd186b84cc7b7c8b9009f35fe408",
"index": 7415,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nmat_tissue.add_element('O', 0.079013)\nmat_tissue.add_element('C', 0.32948)\nmat_tissue.add_element('H', 0.546359)\nmat_tissue.add_element('N', 0.008619)\nmat_tissue.add_element('Mg', 0.0... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class Tile(pygame.sprite.Sprite):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __init__(self, sprite, x, y, surface):
super().__init__()
self.image = pygame.image.load(sprite).convert_alpha()
self.rect = self.image.get_rect()
s... | flexible | {
"blob_id": "0c8eb90c1d8a58f54186a30ce98a67310955a367",
"index": 3024,
"step-1": "<mask token>\n\n\nclass Tile(pygame.sprite.Sprite):\n <mask token>\n <mask token>\n\n def __init__(self, sprite, x, y, surface):\n super().__init__()\n self.image = pygame.image.load(sprite).convert_alpha()\n... | [
7,
13,
14,
15,
16
] |
<|reserved_special_token_0|>
def _get_site_name(f, i):
data_file = f + '\\' + 'new_desc_sele_data.csv'
site_name = pd.read_csv(data_file)['SITE_ID'][i]
return site_name
<|reserved_special_token_0|>
def _get_version_res_folder(f, version, site_name=None, i=None):
import os
version_folder = f + ... | flexible | {
"blob_id": "c034fba0b9204545b00ba972a17e63cf9c20854e",
"index": 3930,
"step-1": "<mask token>\n\n\ndef _get_site_name(f, i):\n data_file = f + '\\\\' + 'new_desc_sele_data.csv'\n site_name = pd.read_csv(data_file)['SITE_ID'][i]\n return site_name\n\n\n<mask token>\n\n\ndef _get_version_res_folder(f, ve... | [
3,
4,
6,
7,
8
] |
<|reserved_special_token_0|>
class PersonTemporaryCode(models.Model):
person = models.ForeignKey(Person, on_delete=models.CASCADE)
code = models.IntegerField()
expiration_date = models.DateTimeField()
def __str__(self):
return f'{self.person} - {self.code} -- {self.expiration_date}'
<|reser... | flexible | {
"blob_id": "28f4f14c3c29ee96c370ffe71c268549552b915e",
"index": 2419,
"step-1": "<mask token>\n\n\nclass PersonTemporaryCode(models.Model):\n person = models.ForeignKey(Person, on_delete=models.CASCADE)\n code = models.IntegerField()\n expiration_date = models.DateTimeField()\n\n def __str__(self):\... | [
3,
4,
6,
7
] |
<|reserved_special_token_0|>
class Truss:
def __init__(self, node1, node2, size, result, ax):
self.node1 = node1
self.node2 = node2
self.rod = Rod.Rod(node1, node2, result)
self.size = size
self.result = result
self.ax = ax
self.length = math.sqrt((node1.x ... | flexible | {
"blob_id": "f01a1b6d0de4ba685c489af2742159447f943d2d",
"index": 5605,
"step-1": "<mask token>\n\n\nclass Truss:\n\n def __init__(self, node1, node2, size, result, ax):\n self.node1 = node1\n self.node2 = node2\n self.rod = Rod.Rod(node1, node2, result)\n self.size = size\n ... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
urlpatterns += [url('^api-auth/', include('rest_framework.urls', namespace=
'rest_framework'))]
<|reserved_special_token_1|>
<|reserved_special_token_0|>
urlpatterns = [url('^admin/', admin.site.urls), url('^', include(
... | flexible | {
"blob_id": "9e950f6fe895cfd497e94139397e8a0f19725dc0",
"index": 1902,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns += [url('^api-auth/', include('rest_framework.urls', namespace=\n 'rest_framework'))]\n",
"step-3": "<mask token>\nurlpatterns = [url('^admin/', admin.site.urls), url('^'... | [
0,
1,
2,
3,
4
] |
#! /usr/bin/env python
def see_great_place_about_large_man(str_arg):
own_day_and_last_person(str_arg)
print('own_case')
def own_day_and_last_person(str_arg):
print(str_arg)
if __name__ == '__main__':
see_great_place_about_large_man('use_work_of_next_way')
| normal | {
"blob_id": "515c14fcf2c3e9da31f6aba4b49296b18f04f262",
"index": 4786,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef own_day_and_last_person(str_arg):\n print(str_arg)\n\n\n<mask token>\n",
"step-3": "def see_great_place_about_large_man(str_arg):\n own_day_and_last_person(str_arg)\n p... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
print('content-type: text/html')
print()
<|reserved_special_token_0|>
if status == 0:
print('{} OS is stopped succesfully....'.format(osname))
else:
print('some error: {}'.format(info))
<|reserved_special_token_1|>
print('content-type: text/html')
... | flexible | {
"blob_id": "1d2dae7f1d937bdd9a6044b23f8f1897e61dac23",
"index": 6330,
"step-1": "<mask token>\n",
"step-2": "print('content-type: text/html')\nprint()\n<mask token>\nif status == 0:\n print('{} OS is stopped succesfully....'.format(osname))\nelse:\n print('some error: {}'.format(info))\n",
"step-3": "... | [
0,
1,
2,
3,
4
] |
from pylab import *
def f(x,y): return (1-x/2+x**5+y**3)*np.exp(-x**2-y**2)
n = 256
x = np.linspace(-3,3,n)
y = np.linspace(-3,3,n)
X,Y = np.meshgrid(x,y)
axes([0.025,0.025,0.95,0.95])
contourf(X, Y, f(X,Y), 8, alpha=.75, cmap=cm.hot)
C = contour(X, Y, f(X,Y), 8, colors='black', linewidth=.5)
clabel(C, inline=1, fo... | normal | {
"blob_id": "e9c439eafac8fd689980ffcb562f3b5ee903dd56",
"index": 2604,
"step-1": "<mask token>\n\n\ndef f(x, y):\n return (1 - x / 2 + x ** 5 + y ** 3) * np.exp(-x ** 2 - y ** 2)\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef f(x, y):\n return (1 - x / 2 + x ** 5 + y ** 3) * np.exp(-x ** 2 - y **... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Solution:
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Solution:
def isValidSudoku(self, board: List[List[str]]) ->bool:
cells = {}
for i in ran... | flexible | {
"blob_id": "57c911c9a10f9d116f1b7099c5202377e16050f1",
"index": 7871,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Solution:\n\n def isValidSudoku(self, board: List[List[str]]) ->bool:\n cells = {}\n for i ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class Solution:
def isMonotonic(self, A: List[int]) ->bool:
flag = 0
for i in range(1, len(A)):
diff = A[i] - A[i - 1]
if diff * flag < 0:
return False
if flag == 0:
flag = diff
return True
... | flexible | {
"blob_id": "a55d1286485e66a64aa78259ad1b1922c5c4c831",
"index": 4385,
"step-1": "<mask token>\n\n\nclass Solution:\n\n def isMonotonic(self, A: List[int]) ->bool:\n flag = 0\n for i in range(1, len(A)):\n diff = A[i] - A[i - 1]\n if diff * flag < 0:\n return... | [
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class SetGetMixin:
def get(path_variable):
def decorator(func):
@wraps(func)
def wrapper(self, *args, **kwargs):
if not self.zk_client.exists(getattr(self, path_variable)):
return None
return func(s... | flexible | {
"blob_id": "f9a0c3b643c2ee6bb6778477bf8fc21564812081",
"index": 3373,
"step-1": "<mask token>\n\n\nclass SetGetMixin:\n\n def get(path_variable):\n\n def decorator(func):\n\n @wraps(func)\n def wrapper(self, *args, **kwargs):\n if not self.zk_client.exists(getattr(... | [
2,
3,
4,
5,
6
] |
#!/usr/bin/env python
# Copyright (c) 2016, SafeBreach
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of cond... | normal | {
"blob_id": "278f0ece7cc2c7bb2ec1a3a2a7401bf3bc09611d",
"index": 2659,
"step-1": "#!/usr/bin/env python\n# Copyright (c) 2016, SafeBreach\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n#... | [
0
] |
# -*- coding: utf-8 -*-
"""
Created on Wed May 16 10:17:32 2018
@author: pearseb
"""
#%% imporst
import os
import numpy as np
import netCDF4 as nc
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import cmocean.cm as cmo
import seaborn as sb
sb.set(style='ticks')
import mpl_toolkits.basemap as bm
import p... | normal | {
"blob_id": "635b02e03578d44f13530bd57ab1a99987d4909d",
"index": 5987,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsb.set(style='ticks')\n<mask token>\nos.chdir(\n 'C://Users/pearseb/Dropbox/PhD/My articles/nitrogen-carbon cycles/data_for_publication'\n )\n<mask token>\nlon_bnds[:, 0] += 360.0\n... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def make_dir(directory):
import os
import errno
try:
os.makedirs(directory)
except OSError as e:
if e.errno != errno.EEXIST:
raise
<|reserved_special_token_0|>
def save_images(images, file_pattern, start_idx=1):
for i, image in enumerate... | flexible | {
"blob_id": "42a717591fb8fe480581d8996e9811d0292d0eb1",
"index": 7567,
"step-1": "<mask token>\n\n\ndef make_dir(directory):\n import os\n import errno\n try:\n os.makedirs(directory)\n except OSError as e:\n if e.errno != errno.EEXIST:\n raise\n\n\n<mask token>\n\n\ndef save... | [
3,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
class MyDictTestCase(unittest.TestCase):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class MyDictTestCase(unittest.TestCase):
def test_Dict(self):
actualDict1 = cldf.ConvertListsToDict([1, 2, 3... | flexible | {
"blob_id": "3421c3b839721694945bdbb4f17183bceaed5296",
"index": 786,
"step-1": "<mask token>\n\n\nclass MyDictTestCase(unittest.TestCase):\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass MyDictTestCase(unittest.TestCase):\n\n def test_Dict(self):\n actualDict1 = cldf.Conve... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class MNIST3dModel(nn.Module):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class MNIST3dModel(nn.Module):
<|reserved_special_token_0|>
def forward(self, x):
x = self.conv1(x)
x = ... | flexible | {
"blob_id": "f6838906c961a9ca7d91d2ab02fd2af72797b880",
"index": 4628,
"step-1": "<mask token>\n\n\nclass MNIST3dModel(nn.Module):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass MNIST3dModel(nn.Module):\n <mask token>\n\n def forward(self, x):\n x = self.conv1(x)\n ... | [
1,
2,
3,
4
] |
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
r_data_df = pd.read_csv('./Shootout Data/Shootout_Mac2017.csv')
em_data_df = pd.read_csv('./Shootout Data/Shootout_Emily.csv')
aishah_data_df = pd.read_csv('./Shootout Data/Shootout_Aishah_Mac2011.csv')
agni_data_df = pd.read_csv('./Shootout Data/S... | normal | {
"blob_id": "467b919f6953737eedd3f99596df244bd1177575",
"index": 5411,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nplt.bar(pos, df['Mersenne Twister'], width, alpha=0.5, color='#EE3224')\nplt.bar([(p + width) for p in pos], df['Xorshift 128+'], width, alpha=0.5,\n color='#F78F1E')\nplt.bar([(p + wi... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def test_divide_in_zero_from_start():
expression = '56/0'
result = main_evaluate(expression)
assert result.error_type == DIVIDE_ZERO
<|reserved_special_token_0|>
def test_mod_in_zero():
expression = '-3%0'
result = main_evaluate(expression)
assert result.error_... | flexible | {
"blob_id": "f17d59ca9bfa82848ec6a599e98f759449ccdd14",
"index": 6376,
"step-1": "<mask token>\n\n\ndef test_divide_in_zero_from_start():\n expression = '56/0'\n result = main_evaluate(expression)\n assert result.error_type == DIVIDE_ZERO\n\n\n<mask token>\n\n\ndef test_mod_in_zero():\n expression = ... | [
16,
25,
26,
33,
36
] |
import time
import math
from random import randrange
import multilineMAX7219 as LEDMatrix
from multilineMAX7219_fonts import CP437_FONT, SINCLAIRS_FONT, LCD_FONT, TINY_FONT
from multilineMAX7219 import DIR_L, DIR_R, DIR_U, DIR_D
from multilineMAX7219 import DIR_LU, DIR_RU, DIR_LD, DIR_RD
from multilineMAX7219 import D... | normal | {
"blob_id": "ba486b64b1da3dc1775bee0980d5236516e130d4",
"index": 4033,
"step-1": "import time\nimport math\nfrom random import randrange\n\nimport multilineMAX7219 as LEDMatrix\nfrom multilineMAX7219_fonts import CP437_FONT, SINCLAIRS_FONT, LCD_FONT, TINY_FONT\nfrom multilineMAX7219 import DIR_L, DIR_R, DIR_U, D... | [
0
] |
"""
Problem Statement
You and Fredrick are good friends. Yesterday, Fredrick received N credit
cards from ABCD Bank. He wants to verify whether his credit card numbers are
valid or not. You happen to be great at regex so he is asking for your help!
A valid credit card from ABCD Bank has the following characteristics:... | normal | {
"blob_id": "09f2fabaf3c19aa0d4cb522c6dbf5fd8d720b4df",
"index": 1567,
"step-1": "\"\"\"\nProblem Statement\n\nYou and Fredrick are good friends. Yesterday, Fredrick received N credit\ncards from ABCD Bank. He wants to verify whether his credit card numbers are\nvalid or not. You happen to be great at regex so h... | [
0
] |
# coding: utf-8
'''
Programa : py02_variavel.py
Homepage : http://www
Autor : Helber Palheta <hpalheta@outlook.com>
Execução:
python py02_variavel.py
'''
#variável curso e sua atribuição
curso = "Introdução a Biopython!"
#função print
print("Nome do Curso: "+curso) | normal | {
"blob_id": "ad59c1f0038294144b1c63db5f048b0a6b5ebb89",
"index": 4654,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Nome do Curso: ' + curso)\n",
"step-3": "<mask token>\ncurso = 'Introdução a Biopython!'\nprint('Nome do Curso: ' + curso)\n",
"step-4": "# coding: utf-8\n'''\n \n Programa... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class UnLoginGetArticleJsonTestCase(TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
call_command('loaddata', 'fixtures/auth.json', verbosity=0)
call_command('loaddata', 'fixtures/dump.json', verbosity=0)
def test_article_success_data... | flexible | {
"blob_id": "676caabb103f67c631bc191b11ab0d2d8ab25d1e",
"index": 5803,
"step-1": "<mask token>\n\n\nclass UnLoginGetArticleJsonTestCase(TestCase):\n\n @classmethod\n def setUpClass(cls):\n super().setUpClass()\n call_command('loaddata', 'fixtures/auth.json', verbosity=0)\n call_command... | [
5,
7,
8,
9,
11
] |
#!/usr/bin/python
import sys
import cgi
import urllib2
url = sys.argv[1]
try:
response = urllib2.urlopen(url)
redir = response.geturl()
except Exception:
import traceback
redir = 'generic exception: ' + traceback.format_exc()
print redir
| normal | {
"blob_id": "3ff3b8a1d8e74c09da9d6f39e4abf0963002a812",
"index": 5682,
"step-1": "#!/usr/bin/python\nimport sys\nimport cgi\nimport urllib2\n\n\nurl = sys.argv[1]\n\ntry:\n\tresponse = urllib2.urlopen(url)\n\tredir = response.geturl()\nexcept Exception:\n\timport traceback\n\tredir = 'generic exception: ' + trac... | [
0
] |
<|reserved_special_token_0|>
@register.inclusion_tag('tags/fieldsetForm.html')
def show_fieldsetform(form):
"""
Renders given form without marking required fields.
@param form:
@return:
"""
return {'form': form, 'required_fields': True}
@register.inclusion_tag('tags/fieldsetForm.html')
def s... | flexible | {
"blob_id": "9f2105d188ac32a9eef31b21065e9bda13a02995",
"index": 6735,
"step-1": "<mask token>\n\n\n@register.inclusion_tag('tags/fieldsetForm.html')\ndef show_fieldsetform(form):\n \"\"\"\n Renders given form without marking required fields.\n @param form:\n @return:\n \"\"\"\n return {'form':... | [
4,
5,
6,
7,
8
] |
# -*- coding: utf-8 -*-
# !/usr/bin/env python3
import pathlib
from PIL import Image
if __name__ == '__main__':
img_path = (pathlib.Path('..') / 'images' / 'tiger.jpg').resolve()
# image load
with Image.open(str(img_path)) as img:
# image info
print('IMAGE: {}'.format(str(img_path)))
... | normal | {
"blob_id": "05edbf3662936465eee8eee0824d1a0cca0df0e5",
"index": 4855,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n img_path = (pathlib.Path('..') / 'images' / 'tiger.jpg').resolve()\n with Image.open(str(img_path)) as img:\n print('IMAGE: {}'.format(str(img_pa... | [
0,
1,
2,
3
] |
# $Header: //depot/cs/s/ajax_support.wsgi#10 $
from werkzeug.wrappers import Response
from p.DRequest import DRequest
from db.Support import SupportSession
from db.Exceptions import DbError, SupportSessionExpired
import db.Db as Db
import db.Support
import cgi
import simplejson as json
def application(environ, start_... | normal | {
"blob_id": "be58862b66708c9de8cf7642c9de52ec744b079e",
"index": 805,
"step-1": "<mask token>\n\n\ndef application(environ, start_response):\n \"\"\"AJAX scripts for email templates.\"\"\"\n request = DRequest(environ)\n resp = None\n try:\n Db.start_transaction()\n form = cgi.FieldStor... | [
4,
5,
6,
7,
8
] |
import tensorflow as tf
from tensorflow.python.framework import graph_util
from net import siameseNet_batchnorm as siameseNet
import dataset
import numpy as np
import cv2
import os
batch_size=64
input_height=32
input_width=32
total_epoch_num=50
snapshot=100
support_image_extensions=[".jpg",".png",".jpeg",".bmp"]
margi... | normal | {
"blob_id": "97bbb181cbc0f5bfbf0b2298133fc226b6217d91",
"index": 399,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif not os.path.exists(pb_path):\n os.makedirs(pb_path)\nif not os.path.exists(ckpt_path):\n os.makedirs(ckpt_path)\n<mask token>\nif __name__ == '__main__':\n first_shape = None\n... | [
0,
1,
2,
3,
4
] |
def koodrinate(kraj, kraji):
for ime, x, y in kraji:
if ime == kraj:
return x, y
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def koodrinate(kraj, kraji):
for ime, x, y in kraji:
if ime == kraj:
return x, y
<|reserved_special_token_0|>
def koodrinate... | flexible | {
"blob_id": "2cfc1bea6dd1571eff67c3f49b2a1899560c7ba7",
"index": 3469,
"step-1": "def koodrinate(kraj, kraji):\n for ime, x, y in kraji:\n if ime == kraj:\n return x, y\n\n\n<mask token>\n",
"step-2": "def koodrinate(kraj, kraji):\n for ime, x, y in kraji:\n if ime == kraj:\n ... | [
1,
2,
3,
4,
5
] |
from abc import ABC, abstractmethod
from datetime import datetime, timedelta, date
import os
import housekeeper
import yfinance as yf
import pandas as pd
class DataManager(ABC):
def __init__(self):
self.__myHousekeeper = housekeeper.instance_class()
self.__config_filename = "tickers... | normal | {
"blob_id": "e77e0791ddf211807566528e9532eebb54db43b5",
"index": 5550,
"step-1": "<mask token>\n\n\nclass DataManager(ABC):\n\n def __init__(self):\n self.__myHousekeeper = housekeeper.instance_class()\n self.__config_filename = 'tickers_config.json'\n self.__dir_list = ['Data', 'Tickers'... | [
30,
34,
35,
40,
41
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
SceneName = 'sphere'
DefaultColor = QtCore.Qt.yellow
<|reserved_special_token_1|>
from PyQt4 import QtCore
SceneName = 'sphere'
DefaultColor = QtCore.Qt.yellow
<|reserved_special_token_1|>
from PyQt4 import QtCore
Scene... | flexible | {
"blob_id": "874b87ca20385aa15cc7299707c9c1c0360ace43",
"index": 1045,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nSceneName = 'sphere'\nDefaultColor = QtCore.Qt.yellow\n",
"step-3": "from PyQt4 import QtCore\nSceneName = 'sphere'\nDefaultColor = QtCore.Qt.yellow\n",
"step-4": "from PyQt4 import Q... | [
0,
1,
2,
3
] |
#상관분석
"""
유클리디안 거리 공식의 한계점: 특정인의 점수가 극단적으로 높거나 낮다면 제대로된 결과를 도출해내기 어렵다.
=>상관분석:두 변수간의 선형적 관계를 분석하겠다는 의미
"""
#BTS와 유성룡 평점, 이황, 조용필
import matplotlib as mpl
mpl.rcParams['axes.unicode_minus']=False #한글 깨짐 방지
from matplotlib import font_manager, rc
import matplotlib.pyplot as plt
from math import sqrt
font_name ... | normal | {
"blob_id": "b377a652eec55b03f689a5097bf741b18549cba0",
"index": 4939,
"step-1": "<mask token>\n\n\ndef drawGraph(data, name1, name2):\n plt.figure(figsize=(14, 8))\n li = []\n li2 = []\n for i in critics[name1]:\n if i in data[name2]:\n li.append(critics[name1][i])\n li2... | [
4,
5,
6,
7,
8
] |
# -*- coding: utf-8 -*-
"""
This is the very first A.I. in this series.
The vision is to devlop 'protocol droid' to talk to, to help with tasks, and with whom to play games.
The droid will be able to translate langages and connect ppl.
"""
import speech_recognition as sr
import pyttsx3
import pywhatkit
... | normal | {
"blob_id": "f5d353694a719472320f4d6fa28bc9d2cc5a69b0",
"index": 951,
"step-1": "<mask token>\n\n\ndef talk(text):\n engine.say('heyo' + text)\n engine.runAndWait()\n\n\ndef take_command():\n try:\n with sr.Microphone() as source:\n print('listening....')\n voice = listener.... | [
2,
4,
5,
6,
7
] |
#coding=utf-8
from numpy import *
#代码5-1,Logistic回归梯度上升优化算法。
def loadDataSet():
"""解析文件
Return: dataMat 文档列表 [[1,x1,x2]...]; labelMat 类别标签列表[1,0,1...]
@author:VPrincekin
"""
dataMat = []; labelMat= []
fr = open('testSet.txt')
#每行前两个分别是X1和X2,第三个只是数据对应的类别
for line in fr.readlines():
... | normal | {
"blob_id": "d47ea763ac1a4981fc5dee67cd396ad49570f923",
"index": 7821,
"step-1": "<mask token>\n\n\ndef loadDataSet():\n \"\"\"解析文件\n Return: dataMat 文档列表 [[1,x1,x2]...]; labelMat 类别标签列表[1,0,1...]\n @author:VPrincekin\n \"\"\"\n dataMat = []\n labelMat = []\n fr = open('testSet.txt')\n f... | [
4,
6,
8,
9,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def to_path(key):
if isinstance(key, tuple):
if len(key) == 1:
key = key[0]
else:
raise ValueError(error_msg)
if '/' in key or '\\' in key or os.path.sep in key:
raise Valu... | flexible | {
"blob_id": "e4ff6d689a7da5b16786fd59d6a4707b9b6e3e7d",
"index": 8076,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef to_path(key):\n if isinstance(key, tuple):\n if len(key) == 1:\n key = key[0]\n else:\n raise ValueError(error_msg)\n if '/' in key or '\... | [
0,
2,
3,
4,
5
] |
# Generated by Django 2.0.5 on 2018-07-12 11:08
import assessment.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assessment', '0006_auto_20180712_1428'),
]
operations = [
migrations.AlterModelManagers(
name='season',... | normal | {
"blob_id": "adff75857a1de24267e771c599e4d89486a6ad32",
"index": 7439,
"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 = [('assessment'... | [
0,
1,
2,
3,
4
] |
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('', admin.site.urls),
path('upload/', include('links.urls')),
]
| normal | {
"blob_id": "45e8bdacad4ed293f7267d96abc9cbe8c8e192ae",
"index": 4148,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [path('', admin.site.urls), path('upload/', include(\n 'links.urls'))]\n",
"step-3": "from django.contrib import admin\nfrom django.urls import include, path\nurlpatter... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if number <= 100:
bonus = 5
total_point = number + bonus
elif number > 1000:
bonus = 0.1 * number
total_point = number + bonus
else:
bonus = 0.2 * number
total_point = number + bonus
if number % 2 == 0:
... | flexible | {
"blob_id": "7ee3301b55d323d156bd394f8525e37502d19430",
"index": 7669,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif number <= 100:\n bonus = 5\n total_point = number + bonus\nelif number > 1000:\n bonus = 0.1 * number\n total_point = number + bonus\nelse:\n bonus = 0.2 * number\n t... | [
0,
1,
2
] |
<|reserved_special_token_0|>
def worker():
display_subtitle = ''
while True:
item = q.get()
image = np.zeros((480, 640))
if item is not None:
vertices = item
show_img = plot_vertices(np.zeros_like(image), vertices)
else:
show_img = image
... | flexible | {
"blob_id": "0ec5d6ce11851a577046cf73cf98c91b6dfb9f67",
"index": 1550,
"step-1": "<mask token>\n\n\ndef worker():\n display_subtitle = ''\n while True:\n item = q.get()\n image = np.zeros((480, 640))\n if item is not None:\n vertices = item\n show_img = plot_verti... | [
3,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with tf.Session() as sess:
predictions = []
labels = []
accuracies = []
for i in range(4):
sess.run(init)
choice = i + 1
choose_test_set(str(choice))
train_data, train_labels = get_n... | flexible | {
"blob_id": "dbc599a03d91f369d862f6cc90c31221747ead80",
"index": 2811,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith tf.Session() as sess:\n predictions = []\n labels = []\n accuracies = []\n for i in range(4):\n sess.run(init)\n choice = i + 1\n choose_test_set(str... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class IntCode:
def __init__(self, code):
self.code = code
self.base = 0
self.idx = 0
self.terminated = False
@staticmethod
def load_code(code_string):
return IntCode(read_code(code_string))
@staticmethod
def load_from_file(fil... | flexible | {
"blob_id": "68c2fd1d8ca9e1dd9373ca9f641c2920c87b2392",
"index": 1346,
"step-1": "<mask token>\n\n\nclass IntCode:\n\n def __init__(self, code):\n self.code = code\n self.base = 0\n self.idx = 0\n self.terminated = False\n\n @staticmethod\n def load_code(code_string):\n ... | [
10,
11,
12,
13,
14
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
admin.site.register(Sport)
admin.site.register(Action)
<|reserved_special_token_1|>
from django.contrib import admin
from .models import Sport
from .models import Action
admin.site.register(Sport)
admin.site.register(Action)
| flexible | {
"blob_id": "ab38371ee3941e214344497b7e56786908a9b3d1",
"index": 2236,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nadmin.site.register(Sport)\nadmin.site.register(Action)\n",
"step-3": "from django.contrib import admin\nfrom .models import Sport\nfrom .models import Action\nadmin.site.register(Sport... | [
0,
1,
2
] |
# -*- coding: UTF-8 -*-
from flask import Blueprint, jsonify, request, abort, current_app
import json
from config import config_orm_initial
orm = config_orm_initial.initialize_orm()
session = orm['dict_session']
Article_list = orm['dict_Articlelist']
user = orm['dict_user']
app = Blueprint('api_get_comments', __name_... | normal | {
"blob_id": "016c004fd95d901a6d55b6f7460397223a6baa3b",
"index": 1881,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@app.route('/comments/<article_id>', methods=['POST'])\ndef get_comments(article_id):\n comments_range = request.form.get('comments_for_single')\n try:\n temp_list = json... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--mode', type=str, default='train', help=
'could be either infer or train')
parser.add_argument('--model_dir', type=str, defaul... | flexible | {
"blob_id": "f0fa85f240b74b003ade767ffe8642feacdfaa32",
"index": 5807,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n parser = argparse.ArgumentParser()\n parser.add_argument('--mode', type=str, default='train', help=\n 'could be either infer or train')\n pars... | [
0,
1,
2,
3
] |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Agile Business Group sagl (<http://www.agilebg.com>)
# Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com>
#
# This program is free software: you can redistribute it and/or modi... | normal | {
"blob_id": "b111d799b9e71cf36253c37f83dc0cdc8887a32e",
"index": 7404,
"step-1": "<mask token>\n\n\nclass StockPicking(orm.Model):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass StockPicking(orm.Model):\n <mask token>\n\n def _get_invoice_vals(self, cr, uid, key, inv_type, jou... | [
1,
2,
3,
4,
5
] |
import cx_Oracle
import datetime
SDATE = '01.01.2014'
FDATE = '01.01.2020'
#p.PRESZAB,
#GDR_RATE.RFLUID,
#p.NRES
#join GDR_RATE on GDR_RATE.IDWELL = p.IDWELL and GDR_RATE.DTBGN = p.DTBGN and GDR_RATE.NRES = p.NRES)
pbu_query_raw = f"""
select
WELLNAME,
DTBGN,
DPDEVICE,
(TVDSS-(MD - DPDEVICE)*... | normal | {
"blob_id": "39f1595374147c71bc2d4c945a0f1149891f1883",
"index": 5300,
"step-1": "<mask token>\n\n\ndef get_data_from_database_cns(connection, query_string, delimiter=';'):\n with connection.cursor() as cur:\n cur.execute(query_string)\n [print(x[0], end=delimiter) for x in cur.description]\n ... | [
3,
4,
5,
6,
7
] |
#os for file system
import os
from sys import platform as _platform
import fnmatch
import inspect
files = 0
lines = 0
extension0 = '.c'
extension1 = '.cpp'
extension2 = '.h'
extension3 = '.hpp'
filename = inspect.getframeinfo(inspect.currentframe()).filename
startPath = os.path.dirname(os.path.abspath(... | normal | {
"blob_id": "d287123acdbabdd5a223e774c89945ab888fcbcc",
"index": 5439,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('files_with_extensions.txt', 'w', encoding='utf-8') as filewrite:\n for r, d, f in os.walk(startPath):\n for file in f:\n if file.endswith(extension0) or fi... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
def subsets(self, nums: List[int]) ->List[List[int]]:
"""
ans = set()
n = len(nums)
for x, val in enumerate(nums):
... | flexible | {
"blob_id": "7d873ed216355d1688ec79ff337304d8ebfd2754",
"index": 7625,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def subsets(self, nums: List[int]) ->List[List[int]]:\n \"\"\"\n ans = set()\n n = len(nums)\n for ... | [
0,
1,
2,
3
] |
class Honda:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class Audi:
def __init__(self, name, color):
self.name = name
self.color = color
def display(self):
print('Audi car name is : ', self.name, ' and color is : ', self.color)
<|reserved_special_token_0|>
... | flexible | {
"blob_id": "92f59612b2697db155da1bdc625fdabc115867b0",
"index": 9600,
"step-1": "class Honda:\n <mask token>\n <mask token>\n\n\nclass Audi:\n\n def __init__(self, name, color):\n self.name = name\n self.color = color\n\n def display(self):\n print('Audi car name is : ', self.na... | [
4,
6,
7,
8,
9
] |
from django.contrib import admin
from .models import (AddressLink, Address, Child, Citation,
Configuration, Event, Exclusion, FactType,
Family, Group, Label, LinkAncestry,
Link, MediaLink, Multimedia, Name,
Person, Place, ResearchItem,... | normal | {
"blob_id": "b4d48427dddc7c0240cf05c003cbf7b0163279ee",
"index": 9729,
"step-1": "<mask token>\n\n\nclass FactTypeAdmin(RootsMagicModelAdmin):\n list_display = ['id', 'owner_type', 'name', 'abbreviation',\n 'gedcom_tag', 'use_value', 'use_date', 'use_place', 'sentence', 'flags'\n ]\n\n\nclass Fa... | [
31,
35,
38,
39,
48
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print("Welcome to my basic 'Calculator'")
print('Please choose your best option (+, -, *, /) ')
while True:
try:
A = int(input('Now Enter your first Value='))
break
except:
print('Oops!', sys.exc_in... | flexible | {
"blob_id": "1cca94040cdd8db9d98f587c62eff7c58eae7535",
"index": 6974,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(\"Welcome to my basic 'Calculator'\")\nprint('Please choose your best option (+, -, *, /) ')\nwhile True:\n try:\n A = int(input('Now Enter your first Value='))\n b... | [
0,
1,
2,
3
] |
# -*- coding: utf-8 -*-
from euler.baseeuler import BaseEuler
from os import path, getcwd
def get_name_score(l, name):
idx = l.index(name) + 1
val = sum([(ord(c) - 64) for c in name])
return idx * val
class Euler(BaseEuler):
def solve(self):
fp = path.join(getcwd(), 'euler/resources/names.t... | normal | {
"blob_id": "40d08bfa3286aa30b612ed83b5e9c7a29e9de809",
"index": 6540,
"step-1": "<mask token>\n\n\nclass Euler(BaseEuler):\n\n def solve(self):\n fp = path.join(getcwd(), 'euler/resources/names.txt')\n with open(fp, 'r') as f:\n names = sorted([name for name in f.read().replace('\"',... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
class CartPoleModel(nn.Module):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class CartPoleModel(nn.Module):
def __init__(self):
super(CartPoleModel, self).__init__()
self.fc1 = nn.Lin... | flexible | {
"blob_id": "bde3975f5b614a4b00ad392d9f0b4c1bd8c55dc0",
"index": 6855,
"step-1": "<mask token>\n\n\nclass CartPoleModel(nn.Module):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass CartPoleModel(nn.Module):\n\n def __init__(self):\n super(CartPoleModel, self).__init__()\n ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution(object):
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution(object):
def sortArrayByParityII(self, A):
"""
:type A: List[int]
:rtype: List[int]
"""
i = 0
for j in... | flexible | {
"blob_id": "429af603bf8f1c003799c3d94c0ce9a2c2f80dfc",
"index": 3835,
"step-1": "<mask token>\n",
"step-2": "class Solution(object):\n <mask token>\n",
"step-3": "class Solution(object):\n\n def sortArrayByParityII(self, A):\n \"\"\"\n :type A: List[int]\n :rtype: List[int]\n ... | [
0,
1,
2
] |
<|reserved_special_token_0|>
@probe_time
def opencl_multi_convolve_image(*args):
return _opencl_multi_convolve_image(*args)
<|reserved_special_token_0|>
def multi_convolve_image(data, kernel, bias, dil_x, dil_y):
if device < 0:
return cpu_multi_convolve_image(data, kernel, bias, dil_x, dil_y)
... | flexible | {
"blob_id": "8ec257d5dfe84e363e3c3aa5adee3470c20d1765",
"index": 5866,
"step-1": "<mask token>\n\n\n@probe_time\ndef opencl_multi_convolve_image(*args):\n return _opencl_multi_convolve_image(*args)\n\n\n<mask token>\n\n\ndef multi_convolve_image(data, kernel, bias, dil_x, dil_y):\n if device < 0:\n ... | [
2,
6,
7,
9,
12
] |
class Solution:
def jump(self, nums: List[int]) -> int:
if len(nums) < 2: return 0
jump = 1
curr_max = max_reach = nums[0]
for i ... | normal | {
"blob_id": "7f2ffa653486d000c9eee0087fc1e6ca0c84003c",
"index": 5671,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def jump(self, nums: List[int]) ->int:\n if len(nums) < 2:\n return 0\n jump = 1\n curr_max = m... | [
0,
1,
2,
3
] |
import sys
from reportlab.graphics.barcode import code39
from reportlab.lib.pagesizes import letter
from reportlab.lib.units import mm
from reportlab.pdfgen import canvas
from parseAccessionNumbers import parseFile
def main():
if len(sys.argv) <= 1:
print "No filepath argument passed."
return
... | normal | {
"blob_id": "bc32518e5e37d4055f1bf5115953948a2bb24ba6",
"index": 3506,
"step-1": "import sys\nfrom reportlab.graphics.barcode import code39\nfrom reportlab.lib.pagesizes import letter\nfrom reportlab.lib.units import mm\nfrom reportlab.pdfgen import canvas\nfrom parseAccessionNumbers import parseFile\n\n\ndef ma... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
os.mkdir('作业')
<|reserved_special_token_0|>
for i in range(10):
f.write('hello world\n')
f.seek(0)
<|reserved_special_token_0|>
print(s)
<|reserved_special_token_0|>
for i in s:
f.write(i)
f.close()
<|reserved_special_to... | flexible | {
"blob_id": "5f5e314d2d18deb12a8ae757a117ef8fbb2ddad5",
"index": 2391,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nos.mkdir('作业')\n<mask token>\nfor i in range(10):\n f.write('hello world\\n')\nf.seek(0)\n<mask token>\nprint(s)\n<mask token>\nfor i in s:\n f.write(i)\nf.close()\n",
"step-3": "... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class IPBanMiddleware(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class IPBanMiddleware(object):
<|reserved_special_token_0|>
def process_request(self, request):
ip = request.MET... | flexible | {
"blob_id": "9289eb32db145187c5b4140e32acff520be8366e",
"index": 7620,
"step-1": "<mask token>\n\n\nclass IPBanMiddleware(object):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass IPBanMiddleware(object):\n <mask token>\n\n def process_request(self, request):\n ip = reque... | [
1,
2,
3,
4,
5
] |
"""
Naive Bayes Class
- Bernoulli Naive Bayes
- Multinomial Naive Bayes
- Gaussian Naive Bayes
Arthor: Zhenhuan(Steven) Sun
"""
import numpy as np
class BernoulliNB:
def __init__(self, k=1.0, binarize=0.0):
# Laplace Smoothing Factor
self.K = k
# the degree... | normal | {
"blob_id": "5dfe86d654e4184bab4401f8b634326996e42e9c",
"index": 2646,
"step-1": "<mask token>\n\n\nclass MultinomialNB:\n <mask token>\n\n def fit(self, X, y):\n X_separated_by_class = [[x for x, t in zip(X, y) if t == c] for c in\n np.unique(y)]\n self.n_classes = len(np.unique(y... | [
8,
9,
14,
15,
16
] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-30 14:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('books', '0007_auto_20170127_2254'),
]
operations = [
migrations.AlterField(... | normal | {
"blob_id": "65ea27851d9db0f0a06d42bd37eff633d22a1548",
"index": 9528,
"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 = [('books', '00... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while number < count:
print(number, '.', lines[number])
number = number + 1
fileopen.close()
<|reserved_special_token_1|>
fileopen = open(input(
'Please enter the name of the file that you wish to open.'), 'r')
line... | flexible | {
"blob_id": "258b28153124ce42578c9eede429354069d8a7d6",
"index": 2869,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile number < count:\n print(number, '.', lines[number])\n number = number + 1\nfileopen.close()\n",
"step-3": "fileopen = open(input(\n 'Please enter the name of the file tha... | [
0,
1,
2,
3
] |
# 1-[2-3-4-5]-1
# 순열로 돌리고, 백트래킹으로 걷어내기
def DFS(idx, cost, cur_loc):
global min_cost
if min_cost < cost: return
if idx == N and arr[cur_loc][0]:
if min_cost > cost + arr[cur_loc][0]:
min_cost = cost + arr[cur_loc][0]
return
for i in range(1, N):
if way[i] or not arr[c... | normal | {
"blob_id": "4ff7e83c6e85a041578a8b3471cbbb7e0c2543e6",
"index": 2663,
"step-1": "<mask token>\n",
"step-2": "def DFS(idx, cost, cur_loc):\n global min_cost\n if min_cost < cost:\n return\n if idx == N and arr[cur_loc][0]:\n if min_cost > cost + arr[cur_loc][0]:\n min_cost = c... | [
0,
1,
2,
3,
4
] |
# new libraries
import ConfigParser
import logging
from time import time
from os import path
# imports from nike.py below
import smass
import helperFunctions
import clusterSMass_orig
import numpy as np
from joblib import Parallel, delayed
def getConfig(section, item, boolean=False,
userConfigFile="BMA_StellarMass_C... | normal | {
"blob_id": "ae71cbd17ec04125354d5aac1cf800f2dffa3e04",
"index": 3314,
"step-1": "# new libraries\nimport ConfigParser\nimport logging\nfrom time import time\nfrom os import path\n# imports from nike.py below\nimport smass\nimport helperFunctions\nimport clusterSMass_orig\nimport numpy as np\nfrom joblib import ... | [
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.