code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
"""Command 'run' module.""" import click from loguru import logger from megalus.main import Megalus @click.command() @click.argument("command", nargs=1, required=True) @click.pass_obj def run(meg: Megalus, command: str) -> None: """Run selected script. :param meg: Megalus instance :param command: comma...
normal
{ "blob_id": "23a4ca8eec50e6ab72be3f1b1077c61f676b3cce", "index": 5777, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@click.command()\n@click.argument('command', nargs=1, required=True)\n@click.pass_obj\ndef run(meg: Megalus, command: str) ->None:\n \"\"\"Run selected script.\n\n :param meg: M...
[ 0, 1, 2, 3 ]
''' PROBLEM N. 5: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? ''' ''' Greatest common divisior using the Euclidean Algorithm, vide http://en.wikipedia.org/wi...
normal
{ "blob_id": "0f0ded26e115b954a5ef698b03271ddf2b947334", "index": 9998, "step-1": "'''\nPROBLEM N. 5:\n2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.\n\nWhat is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?\n''...
[ 0 ]
#给你一个字符串 croakOfFrogs,它表示不同青蛙发出的蛙鸣声(字符串 "croak" )的组合。由于同一时间可以有多只青蛙呱呱作响,所以 croakOfFrogs 中会混合多个 “croak” 。请你返回模拟字符串中所有蛙鸣所需不同青蛙的最少数目。 #注意:要想发出蛙鸣 "croak",青蛙必须 依序 输出 ‘c’, ’r’, ’o’, ’a’, ’k’ 这 5 个字母。如果没有输出全部五个字母,那么它就不会发出声音。 #如果字符串 croakOfFrogs 不是由若干有效的 "croak" 字符混合而成,请返回 -1 。 #来源:力扣(LeetCode) #链接:https://leetcode-cn.com/pr...
normal
{ "blob_id": "b4491b5522e85fec64164b602045b9bd3e58c5b8", "index": 4666, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def minNumberOfFrogs(self, croakOfFrogs: str) ->int:\n c, r, o, a, k = 0, 0, 0, 0, 0\n ans = 0\n for i in ...
[ 0, 1, 2, 3 ]
import random def generatePassword (): numLowerCase = numUpperCase = numSpecialCase = numNumber = 0 password = "" randomChars = "-|@.,?/!~#%^&*(){}[]\=*" length = random.randint(10, 25) while(numSpecialCase < 1 or numNumber < 1 or numLowerCase < 1 or numUpperCase < 1): password = "" ...
normal
{ "blob_id": "3956d4cdb0a8654b6f107975ac003ce59ddd3de1", "index": 4485, "step-1": "<mask token>\n\n\ndef main():\n print(generatePassword())\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef generatePassword():\n numLowerCase = numUpperCase = numSpecialCase = numNumber = 0\n password = ''\n ran...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- def quick_sort(a): _quick_sort(a, 0, len(a)-1) return a def _quick_sort(a, lo, hi): if lo < hi: j = partition2(a, lo, hi) _quick_sort(a, lo, j-1) _quick_sort(a, j+1, hi) def partition(a, lo, hi): # simply select first element as...
normal
{ "blob_id": "52513bf3f50726587bee800f118e2ac0fa00d98b", "index": 4354, "step-1": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\ndef quick_sort(a):\n _quick_sort(a, 0, len(a)-1)\n return a\n\n\ndef _quick_sort(a, lo, hi):\n\n if lo < hi:\n j = partition2(a, lo, hi)\n _quick_sort(a, lo, ...
[ 0 ]
from django.shortcuts import render,redirect from django.contrib.auth.decorators import login_required from .form import UserForm, ProfileForm, PostForm from django.contrib import messages from .models import Profile, Projects from django.contrib.auth.models import User from django.http import HttpResponseRedirect # ...
normal
{ "blob_id": "67de51e2a176907fd89793bd3ec52f898130e104", "index": 3713, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@login_required(login_url='/accounts/login/')\ndef postpoject(request):\n if request.method == 'POST':\n postform = PostForm(request.POST, request.FILES)\n if postfor...
[ 0, 3, 4, 5, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def projectionArea(self, grid): """ :type grid: List[List[int]] :rtype: int """ res = 0 for i in grid: ...
flexible
{ "blob_id": "62fc71e26ba3788513e5e52efc5f20453080837d", "index": 8514, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def projectionArea(self, grid):\n \"\"\"\n :type grid: List[List[int]]\n :rtype: int\n \"\"\"\n ...
[ 0, 1, 2 ]
def pattern4(n): """ n: length of the base of the triangle ie. the max number of starts it will contain. """ for row in range(1, n+1): for col in range(1, row+1): print("*", end="") print("") if __name__ == '__main__': n = int(input(("Enter height of the triangle: "))) pattern4(n)
normal
{ "blob_id": "d77036ed07231719358658a42dc14d20453bd792", "index": 7563, "step-1": "<mask token>\n", "step-2": "def pattern4(n):\n \"\"\"\n\tn: length of the base of the triangle ie. the max number\n\t\tof starts it will contain.\n\t\"\"\"\n for row in range(1, n + 1):\n for col in range(1, row + 1)...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [m...
flexible
{ "blob_id": "7040db119f8fd6da78499fc732e291280228ca10", "index": 1852, "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 = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
class Process: def __init__(self, id, at, bt): self.id = id self.at = at self.bt = bt self.wt = 0 self.ct = 0 self.st = 0 self.tat = 0 <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_toke...
flexible
{ "blob_id": "be58a2e0dcdbcb3a3df0da87be29ce7ebcee7fe9", "index": 6185, "step-1": "class Process:\n\n def __init__(self, id, at, bt):\n self.id = id\n self.at = at\n self.bt = bt\n self.wt = 0\n self.ct = 0\n self.st = 0\n self.tat = 0\n <mask token>\n <ma...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('Hello') <|reserved_special_token_1|> # ---------------------MODULE 1 notes-------------------- # . # . # . # . # . # . # . # . # . # . # save as (file).py first if not it will not work print("Hello") # control s to save
flexible
{ "blob_id": "bb64da929ff2e1e04267518ec93a28bedb5a4de5", "index": 7306, "step-1": "<mask token>\n", "step-2": "print('Hello')\n", "step-3": "# ---------------------MODULE 1 notes--------------------\r\n# .\r\n# .\r\n# .\r\n# .\r\n# .\r\n# .\r\n# .\r\n# .\r\n# .\r\n# .\r\n\r\n# save as (file).py first if not i...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- """ @File : densenet_block.py @Time : 12/11/20 9:59 PM @Author : Mingqiang Ning @Email : ningmq_cv@foxmail.com @Modify Time @Version @Description ------------ -------- ----------- 12/11/20 9:59 PM 1.0 None # @Software: PyCharm """ import torch from torch...
normal
{ "blob_id": "c2ba18062b8555c77b329718ec1f2ae7f326c78e", "index": 1988, "step-1": "<mask token>\n\n\nclass DenseBlock(nn.Module):\n <mask token>\n\n def forward(self, x):\n out = self.denseblock(x)\n return out\n", "step-2": "<mask token>\n\n\nclass BottleNeck(nn.Module):\n <mask token>\n...
[ 2, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class ListNode: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class ListNode: def __init__(self, listt, node, g, h): self.node_list = [] for element in listt: self.node_list....
flexible
{ "blob_id": "2b796fb99e4607d310a533e8d9897100c4df087d", "index": 2665, "step-1": "<mask token>\n", "step-2": "class ListNode:\n <mask token>\n <mask token>\n", "step-3": "class ListNode:\n\n def __init__(self, listt, node, g, h):\n self.node_list = []\n for element in listt:\n ...
[ 0, 1, 2, 3, 4 ]
# -*- coding:utf-8 -*- ''' Created on 2018/2/23 @author : xxfore ''' import time import sys import re sys.dont_write_bytecode = True class TimeUtils(object): @staticmethod def convert_timestamp_to_date(timestamp): time_local = time.localtime(timestamp) dt = time.strftime("%Y-%m-%d %H:%M:%S",t...
normal
{ "blob_id": "933f74e4fda0b30bdf70ff3f3dbde2383b10c694", "index": 8773, "step-1": "<mask token>\n\n\nclass TimeUtils(object):\n <mask token>\n\n\nclass StringUtils(object):\n\n @staticmethod\n def remove_emoji_from_string(text):\n co = re.compile(u'[𐀀-\\U0010ffff]')\n return co.sub(u'', te...
[ 3, 4, 5, 6, 7 ]
for i in range(-10,0): print(i,end=" ")
normal
{ "blob_id": "8d0fcf0bf5effec9aa04e7cd56b4b7098c6713cb", "index": 70, "step-1": "<mask token>\n", "step-2": "for i in range(-10, 0):\n print(i, end=' ')\n", "step-3": "for i in range(-10,0):\n print(i,end=\" \")", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import sys import json import eventlet import datetime import flask from flask import Flask from flask import render_template __version__ = 0.1 PORT = 8000 HOST = '0.0.0.0' DEBUG = False RELDR = False app = Flask(__name__) app.config['SECRET_KEY'] = 'secretkey' @app.route('/login/') def login(): return render_tem...
normal
{ "blob_id": "a945d7f673d009a59e597cd3c99a886094ea9e57", "index": 2639, "step-1": "<mask token>\n\n\n@app.route('/login/')\ndef login():\n return render_template('login.html', name=None)\n\n\n@app.route('/chat/')\ndef chat():\n return render_template('chat.html', name=None)\n\n\n@app.route('/messages/')\nde...
[ 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import swapper from haystack.constants import Indexable from haystack.fields import CharField, DateTimeField from haystack.indexes import SearchIndex class BasePageIndex(SearchIndex): text = CharField(document=True, use_template=True...
normal
{ "blob_id": "8e1eef3c5a9ca3ea504bbc269b48446527637626", "index": 1323, "step-1": "<mask token>\n\n\nclass PageIndex(BasePageIndex, Indexable):\n template = CharField(model_attr='template')\n template_title = CharField(model_attr='get_template_display')\n get_template_display = CharField(model_attr='get_...
[ 2, 4, 5, 6, 7 ]
from sqlalchemy import create_engine, Column, Integer, Float, \ String, Text, DateTime, Boolean, ForeignKey from sqlalchemy.orm import sessionmaker, relationship from sqlalchemy.ext.declarative import declarative_base from flask_sqlalchemy import SQLAlchemy engine = create_engine('sqlite:///app/databases/fays-web-...
normal
{ "blob_id": "3d2b8730953e9c2801eebc23b6fb56a1b5a55e3c", "index": 6156, "step-1": "<mask token>\n", "step-2": "<mask token>\nengine = create_engine('sqlite:///app/databases/fays-web-dev.db',\n connect_args={'check_same_thread': False})\nSession = sessionmaker(bind=engine)\nsession = Session()\nBase = declara...
[ 0, 1, 2, 3 ]
# Напишите программу, которая вводит с клавиатуры последовательность чисел и выводит её # отсортированной в порядке возрастания. def is_numb_val(val): try: x = float(val) except ValueError: return False else: return True def main(): num_seq = input("Введите последовательность ...
normal
{ "blob_id": "4c8a873c816678532b029af409be13258757eae1", "index": 7577, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n num_seq = input('Введите последовательность чисел через пробел: ').split()\n num_lst = [float(s) for s in num_seq if is_numb_val(s)]\n print(sorted(num_lst))\n\...
[ 0, 1, 2, 3, 4 ]
# -*- coding: UTF-8 -*- '''================================================= @Project -> File :AutoMailApp -> handle_yaml @IDE :PyCharm @Author :Mr. wang @Date :2019/11/15 0015 19:53 @Desc : ==================================================''' import yaml from Common.dir_path import YAML_FILE_PATH class Han...
normal
{ "blob_id": "08c309645a4ee59716bdd00556096be1c784331a", "index": 2469, "step-1": "<mask token>\n\n\nclass HandleYaml:\n \"\"\"\n 处理并封装yaml文件\n \"\"\"\n\n def __init__(self):\n with open(YAML_FILE_PATH, 'r') as fs:\n content = fs.read()\n self.ya = yaml.load(content, yaml....
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> mpl_logger.setLevel(logging.WARNING) <|reserved_special_token_0|> if __name__ == '__main__': if 'experiments' in os.getcwd(): os.chdir('../..') this_dir = dirname(abspath(__file__)) for dir_name in ('.cache', '...
flexible
{ "blob_id": "88d8d04dd7117daed0e976f3abc52c5d7bf18434", "index": 9334, "step-1": "<mask token>\n", "step-2": "<mask token>\nmpl_logger.setLevel(logging.WARNING)\n<mask token>\nif __name__ == '__main__':\n if 'experiments' in os.getcwd():\n os.chdir('../..')\n this_dir = dirname(abspath(__file__))\...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # BSD 3-Clause License # # Copyright (c) 2017 # All rights reserved. # Copyright 2022 Huawei Technologies Co., Ltd # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source ...
normal
{ "blob_id": "ee489c2e313a96671db79398218f8604f7ae1bf3", "index": 3569, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef collect_env():\n \"\"\"Collect the information of the running environments.\n\n Returns:\n dict: The environment information. The following fields are contained.\n\n ...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Mar 11 13:25:03 2020 @author: Dr. Michael Sigmond, Canadian Centre for Climate Modelling and Analysis """ import matplotlib.colors as col import matplotlib.cm as cm import numpy as np def register_cccmacms(cmap='all'): """create my ...
normal
{ "blob_id": "31a5bf0b275238e651dcb93ce80446a49a4edcf4", "index": 6561, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef register_cccmacms(cmap='all'):\n \"\"\"create my personal colormaps with discrete colors and register them.\n \n \n default is to register all of them. can also specif...
[ 0, 1, 2, 3, 4 ]
#exceptions.py #-*- coding:utf-8 -*- #exceptions try: print u'try。。。' r = 10/0 print 'result:',r except ZeroDivisionError,e: print 'except:',e finally: print 'finally...' print 'END' try: print u'try。。。' r = 10/int('1') print 'result:',r except ValueError,e: print 'ValueError:',e ...
normal
{ "blob_id": "1568cf544a4fe7aec082ef1d7506b8484d19f198", "index": 3776, "step-1": "#exceptions.py \n#-*- coding:utf-8 -*-\n\n#exceptions\ntry:\n print u'try。。。'\n r = 10/0\n print 'result:',r\nexcept ZeroDivisionError,e:\n print 'except:',e\nfinally:\n print 'finally...'\nprint 'END'\n\ntry:\n p...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def testeum(): a = 10 print(id(a)) <|reserved_special_token_0|> <|reserved_special_token_1|> def testeum(): a = 10 print(id(a)) def testedois(): a = 10 print(id(a)) <|reserved_special_token_1|> # -*- coding: utf-8 -*- def tes...
flexible
{ "blob_id": "a2e2528f560f6117d4ceeb9cd20d3f6f6b2a30a7", "index": 213, "step-1": "<mask token>\n", "step-2": "def testeum():\n a = 10\n print(id(a))\n\n\n<mask token>\n", "step-3": "def testeum():\n a = 10\n print(id(a))\n\n\ndef testedois():\n a = 10\n print(id(a))\n", "step-4": "# -*- co...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def add_info(report): if os.path.exists('/var/log/oem-config.log'): report['OemConfigLog'] = '/var/log/oem-config.log', <|reserved_special_token_1|> import os.path def add_info(report): if os.path.exists('/v...
flexible
{ "blob_id": "74b1cdcb1aaf6cde7e8ce3eeb73cd82689719b00", "index": 6404, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef add_info(report):\n if os.path.exists('/var/log/oem-config.log'):\n report['OemConfigLog'] = '/var/log/oem-config.log',\n", "step-3": "import os.path\n\n\ndef add_info...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> df.head() <|reserved_special_token_0|> df.drop(labels=columns_to_remove, axis=1, inplace=True) df.head() df['bat_team'].unique() <|reserved_special_token_0|> df.head() <|reserved_special_token_0|> df.head() <|reserved_special_toke...
flexible
{ "blob_id": "3b1b3cab1fa197f75812ca5b1f044909914212c0", "index": 9050, "step-1": "<mask token>\n", "step-2": "<mask token>\ndf.head()\n<mask token>\ndf.drop(labels=columns_to_remove, axis=1, inplace=True)\ndf.head()\ndf['bat_team'].unique()\n<mask token>\ndf.head()\n<mask token>\ndf.head()\n<mask token>\ndf.he...
[ 0, 1, 2, 3, 4 ]
import control.matlab as ctrl import matplotlib.pylab as plt def process_data(num11, den11, num21, den21): w11 = ctrl.tf(num11, den11) w21 = ctrl.tf(num21, den21) print('результат w11={} w21={}'.format(w11, w21)) TimeLine = [] for i in range (1, 3000): TimeLine.append(i/1000) plt.figur...
normal
{ "blob_id": "c08e6cee61e9f32a9f067a9554c74bb2ddbd7cf3", "index": 2288, "step-1": "<mask token>\n\n\ndef process_data(num11, den11, num21, den21):\n w11 = ctrl.tf(num11, den11)\n w21 = ctrl.tf(num21, den21)\n print('результат w11={} w21={}'.format(w11, w21))\n TimeLine = []\n for i in range(1, 3000...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class StepName(Enum): <|reserved_special_token_0|> null = 'null' unitTest = 'unitTest' integrationTest = 'integrationTest' changeLog = 'changeLog' requirements = 'requirements' docs = 'docs' build = 'build' githubRelease = 'githubRelease' artifactPu...
flexible
{ "blob_id": "21e86e4719cda5c40f780aca6e56eb13c8c9b8e5", "index": 988, "step-1": "<mask token>\n\n\nclass StepName(Enum):\n <mask token>\n null = 'null'\n unitTest = 'unitTest'\n integrationTest = 'integrationTest'\n changeLog = 'changeLog'\n requirements = 'requirements'\n docs = 'docs'\n ...
[ 15, 20, 21, 25, 27 ]
# Generated by Django 3.0.4 on 2020-07-20 00:05 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0004_auto_20200720_0154'), ] operations = [ migrations.DeleteModel( name='Report', ), migrations.AlterF...
normal
{ "blob_id": "98bc6e0552991d7de1cc29a02242b25e7919ef82", "index": 3764, "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 = [('users', '00...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> env.Execute('cd vjunit && make -f makevjunit') env.Execute('cd VJQA/src && make -f makexmlcheck') Execute('rm -rf ovj_qa') <|reserved_special_token_0|> if not os.path.exists(path): os.makedirs(path) Execute('cp -r VJQA ovj_qa/...
flexible
{ "blob_id": "549d7368d49cf2f4d2c6e83e300f31db981b62bd", "index": 6285, "step-1": "<mask token>\n", "step-2": "<mask token>\nenv.Execute('cd vjunit && make -f makevjunit')\nenv.Execute('cd VJQA/src && make -f makexmlcheck')\nExecute('rm -rf ovj_qa')\n<mask token>\nif not os.path.exists(path):\n os.makedirs(p...
[ 0, 1, 2, 3, 4 ]
# coding=utf-8 # Copyright 2016 Mystopia. from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from django.db.models.signals import m2m_changed, post_save from django.dispatch import receiver from dicpick.models import...
normal
{ "blob_id": "065a566b3e520c14f20d0d7d668ec58404d6e11b", "index": 494, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@receiver(post_save, sender=TaskType)\ndef create_task_instances(sender, instance, **kwargs):\n \"\"\"Ensure that there is a task instance for each date in the range specified by th...
[ 0, 1, 2, 3, 4 ]
def part_1() -> int: start = 382345 end = 843167 total = 0 for number in range(start, end + 1): if check_number(str(number)): total += 1 return total def check_number(problem_input: str) -> bool: previous = 0 double = False for current in range(1, len(problem_inpu...
normal
{ "blob_id": "c46495eebbe796253f56b7472d5548b41c5d0bc4", "index": 2411, "step-1": "def part_1() ->int:\n start = 382345\n end = 843167\n total = 0\n for number in range(start, end + 1):\n if check_number(str(number)):\n total += 1\n return total\n\n\n<mask token>\n\n\ndef check_nu...
[ 3, 4, 5, 6, 7 ]
import numpy as n, pylab as p from scipy import stats as st a=st.norm(0,1) b=st.norm(0.1,1) domain=n.linspace(-4,4,10000) avals=a.cdf(domain) bvals=b.cdf(domain) diffN=n.abs(avals-bvals).max() a=st.norm(0,1) b=st.norm(0,1.2) domain=n.linspace(-4,4,10000) avals=a.cdf(domain) bvals=b.cdf(domain) diffN2=n.abs(avals-bvals...
normal
{ "blob_id": "647258ee5f2f6f1cb8118bcf146b8959c65b70cd", "index": 8045, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef weib(x, nn, a):\n return a / nn * (x / nn) ** (a - 1) * n.exp(-(x / nn) ** a)\n\n\n<mask token>\nprint('distancias de KS para os modelos matematicos:', diffN, diffN2, diffU,\n ...
[ 0, 2, 3, 4, 5 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sqlite3 # 连接到db文件 conn = sqlite3.connect('app.db') # 创建一个Cursor: cursor = conn.cursor() # 查询所有表名: cursor.execute("select name from sqlite_master where type = 'table' order by name") print("Tables name:", cursor.fetchall()) # 查询表user的结构: cursor.ex...
normal
{ "blob_id": "dd8f4b08b88d487b68e916e9f92c08c9c0bc39da", "index": 2681, "step-1": "<mask token>\n", "step-2": "<mask token>\ncursor.execute(\n \"select name from sqlite_master where type = 'table' order by name\")\nprint('Tables name:', cursor.fetchall())\ncursor.execute('PRAGMA table_info(user)')\nprint('Ta...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def isCourseCode(corseCode): try: matchObj = re.match('[A-Z]?[A-Z]?[A-Z]?[A-Z]?\\d?\\d?\\d?\\d?([A-Z]?)', str(corseCode)) if matchObj != None: return True except ValueError as err: print('Your courseCode is not correct: ', err) r...
flexible
{ "blob_id": "b3a07107ef64bb50f4768954cbb579d8e66bd003", "index": 6612, "step-1": "<mask token>\n\n\ndef isCourseCode(corseCode):\n try:\n matchObj = re.match('[A-Z]?[A-Z]?[A-Z]?[A-Z]?\\\\d?\\\\d?\\\\d?\\\\d?([A-Z]?)',\n str(corseCode))\n if matchObj != None:\n return True\n...
[ 6, 13, 14, 18, 19 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2018-01-26 05:04 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Discou...
normal
{ "blob_id": "957db647500433fd73723fdeb3933037ba0641b1", "index": 1527, "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 ]
from app import db, session, Node_Base, Column, relationship from datetime import datetime import models import os import json
normal
{ "blob_id": "1711f74fae36ba761a7c0d84b95271b4e5043d27", "index": 6312, "step-1": "<mask token>\n", "step-2": "from app import db, session, Node_Base, Column, relationship\nfrom datetime import datetime\nimport models\nimport os\nimport json\n", "step-3": null, "step-4": null, "step-5": null, "step-ids"...
[ 0, 1 ]
<|reserved_special_token_0|> class TestCOEClusters(base.TestCase): <|reserved_special_token_0|> def get_mock_url(self, service_type= 'container-infrastructure-management', base_url_append=None, append =None, resource=None): return super(TestCOEClusters, self).get_mock_url(service_type...
flexible
{ "blob_id": "2bf057621df3b860c8f677baf54673d2da8c2bd1", "index": 5804, "step-1": "<mask token>\n\n\nclass TestCOEClusters(base.TestCase):\n <mask token>\n\n def get_mock_url(self, service_type=\n 'container-infrastructure-management', base_url_append=None, append\n =None, resource=None):\n ...
[ 3, 5, 6, 7, 8 ]
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE...
normal
{ "blob_id": "a491772258a52bdfc93083343d2a2e48a240340d", "index": 490, "step-1": "<mask token>\n\n\n@ClassFactory.register(ClassType.METRIC, alias='accuracy')\nclass Accuracy(MetricBase):\n <mask token>\n __metric_name__ = 'accuracy'\n\n def __init__(self, topk=(1, 5)):\n \"\"\"Init Accuracy metri...
[ 12, 13, 14, 15, 16 ]
n=7 a=[] for i in range(1,n+1): print(i) if(i<n): print("+") a.append(i) print("= {}".format(sum(a)))
normal
{ "blob_id": "de9b85c250dea15ff9201054957ebc38017a8c35", "index": 5435, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, n + 1):\n print(i)\n if i < n:\n print('+')\n a.append(i)\nprint('= {}'.format(sum(a)))\n", "step-3": "n = 7\na = []\nfor i in range(1, n + 1):\n pr...
[ 0, 1, 2, 3 ]
#!/usr/bin/python3 # The uploader service listens for connections from localhost on port 3961. # It expects a JSON object on a line by itself as the request. It responds # with another JSON object on a line by itself, then closes the connection. # Atropine CGI scripts can send requests to this service to tell it to: #...
normal
{ "blob_id": "bd202e18cb98efc2b62ce4670fadcf70c35a33cb", "index": 2529, "step-1": "<mask token>\n\n\nclass UploaderThread(object):\n <mask token>\n\n def is_uploading_tourney(self, tourney):\n return tourney in self.uploading_tourneys\n <mask token>\n <mask token>\n\n def get_last_successful...
[ 19, 21, 26, 31, 34 ]
# stopwatch.py - A simple stopwatch program. import time # Display the porgram's instructions print( """ \n\nInstructions\n press Enter to begin.\n Afterwards press Enter to "click" the stopwatch.\n Press Ctrl-C to quit""" ) input() # press Enter to begin print("Started") startTime = time.time() lastTime = star...
normal
{ "blob_id": "cc87682d4ebb283e2d0ef7c09ad28ba708c904bd", "index": 4407, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\n \"\"\" \n\nInstructions\n\npress Enter to begin.\n\nAfterwards press Enter to \"click\" the stopwatch.\n\nPress Ctrl-C to quit\"\"\"\n )\ninput()\nprint('Started')\n<mask t...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def hurdleRace(k, height): if k < max(height): return max(height) - k return 0 <|reserved_special_token_0|> <|reserved_special_token_1|> def hurdleRace(k, height): if k < max(height): return max(height) - k return 0 prin...
flexible
{ "blob_id": "c139cbc3e693d75ad196e10257ff3028aa835709", "index": 428, "step-1": "<mask token>\n", "step-2": "def hurdleRace(k, height):\n if k < max(height):\n return max(height) - k\n return 0\n\n\n<mask token>\n", "step-3": "def hurdleRace(k, height):\n if k < max(height):\n return m...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 from typing import ClassVar, List print(1, 2) # Annotated function (Issue #29) def foo(x: int) -> int: return x + 1 # Annotated variables #575 CONST: int = 42 class Class: cls_var: ClassVar[str] def m(self): xs: List[int] = [] # True and False are keywords in Python ...
normal
{ "blob_id": "689c6c646311eba1faa93cc72bbe1ee4592e45bc", "index": 8392, "step-1": "<mask token>\n\n\ndef foo(x: int) ->int:\n return x + 1\n\n\n<mask token>\n\n\nclass Class:\n cls_var: ClassVar[str]\n\n def m(self):\n xs: List[int] = []\n\n\n<mask token>\n\n\ndef a():\n pass\n\n\n<mask token>\...
[ 5, 7, 8, 10, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> matplotlib.use('Agg') <|reserved_special_token_0|> f.close() <|reserved_special_token_0|> train_model.load_weights(weights_file) <|reserved_special_token_0|> if data_format == 'channels_first': X_test = np.transpose(X_test, (0...
flexible
{ "blob_id": "a3507019ca3310d7ad7eb2a0168dcdfe558643f6", "index": 1615, "step-1": "<mask token>\n", "step-2": "<mask token>\nmatplotlib.use('Agg')\n<mask token>\nf.close()\n<mask token>\ntrain_model.load_weights(weights_file)\n<mask token>\nif data_format == 'channels_first':\n X_test = np.transpose(X_test, ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> loadPly('head.ply', mesh) <|reserved_special_token_0|> for v in mesh.getVertices(): verts.append((v.x, v.y, v.z)) for t in mesh.getTrianglesIndices(): faces.append((t.x, t.y, t.z)) for e in mesh.getLinesIndices(): edge...
flexible
{ "blob_id": "c02af2ecd980da4ceff133c13072ad7c6b724041", "index": 5329, "step-1": "<mask token>\n", "step-2": "<mask token>\nloadPly('head.ply', mesh)\n<mask token>\nfor v in mesh.getVertices():\n verts.append((v.x, v.y, v.z))\nfor t in mesh.getTrianglesIndices():\n faces.append((t.x, t.y, t.z))\nfor e in...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_trajectories(args, global_min, path='regularized_evolution', methods=['RE', 'RS']): all_trajectories = {} for m in methods: dfs = [] for seed in range(500): filename = os.path.join(path, m, 'algo_{}_0_ssp_{}_seed_{}.obj' .for...
flexible
{ "blob_id": "a757bbb9ad2f6f5bf04cdf4091b97841b8e40432", "index": 6601, "step-1": "<mask token>\n\n\ndef get_trajectories(args, global_min, path='regularized_evolution',\n methods=['RE', 'RS']):\n all_trajectories = {}\n for m in methods:\n dfs = []\n for seed in range(500):\n fi...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "0cba18ca7126dda548a09f34dc26b83d6471bf68", "index": 1652, "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 = [('courses', '...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python2.7 # Google APIs from oauth2client import client, crypt CLIENT_ID = '788221055258-j59svg86sv121jdr7utnhc2rs9tkb9s4.apps.googleusercontent.com' def fetchIdToken(): url = 'https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=' f = urllib.urlopen(url + urllib.urlencode(CLIENT_ID)) i...
normal
{ "blob_id": "2251a6064998f25cca41b018a383053d73bd09eb", "index": 2321, "step-1": "<mask token>\n\n\ndef getIdInfo(token):\n try:\n idinfo = client.verify_id_token(token, CLIENT_ID)\n if idinfo['aud'] not in [CLIENT_ID]:\n return None\n if idinfo['iss'] not in ['accounts.google....
[ 1, 2, 3, 4, 5 ]
from flask import Flask app = Flask(__name__) @app.route('/') def root(): return "Test!" @app.route('/federal/geographic') def federal_geographic(): pass @app.route('/federal/issue') def federal_issue(): pass @app.route('/state/geographic') def state_geographic(): pass @app.route('/local/temporal'...
normal
{ "blob_id": "cc094f8aeff3b52bd9184f7b815320529ecb4550", "index": 9928, "step-1": "<mask token>\n\n\n@app.route('/')\ndef root():\n return 'Test!'\n\n\n@app.route('/federal/geographic')\ndef federal_geographic():\n pass\n\n\n<mask token>\n\n\n@app.route('/state/geographic')\ndef state_geographic():\n pas...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(input, output): vocab = OrderedDict({'</s>': 0, '<unk>': 1}) for line in io.open(input, 'r', encoding='utf-8'): word, count = line.strip().split() vocab[word] = len(vocab) with io.open(output...
flexible
{ "blob_id": "e3665141397d52877242463d548c059272d13536", "index": 863, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(input, output):\n vocab = OrderedDict({'</s>': 0, '<unk>': 1})\n for line in io.open(input, 'r', encoding='utf-8'):\n word, count = line.strip().split()\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ToolBar(QWidget): <|reserved_special_token_0|> def __init__(self, parent): super().__init__(parent) self._main_wnd = parent self.setAttribute(Qt.WA_StyledBackground, True) self.setObjectName('options') self.setStyleSheet( ...
flexible
{ "blob_id": "772e2e0a442c1b63330e9b526b76d767646b0c7c", "index": 7819, "step-1": "<mask token>\n\n\nclass ToolBar(QWidget):\n <mask token>\n\n def __init__(self, parent):\n super().__init__(parent)\n self._main_wnd = parent\n self.setAttribute(Qt.WA_StyledBackground, True)\n sel...
[ 3, 5, 6, 9, 10 ]
# Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import datetime import json import logging import mock from parameterized import parameterized from buildbucket_proto import common_pb2 from buildbucket_pr...
normal
{ "blob_id": "325efe65030ad3488a7fc45c0d4a289eb0b17196", "index": 1311, "step-1": "<mask token>\n\n\nclass StepUtilTest(wf_testcase.WaterfallTestCase):\n\n def testGetLowerBoundBuildNumber(self):\n self.assertEqual(5, step_util._GetLowerBoundBuildNumber(5, 100))\n self.assertEqual(50, step_util._...
[ 26, 32, 43, 49, 55 ]
import os path = r'D:\python\风变编程\python基础-山顶班\fb_16' path1 = 'test_01' path2 = 'fb_csv-01-获取网页内容.py' print(os.getcwd()) # 返回当前工作目录 print(os.listdir(path)) # 返回path指定的文件夹包含的文件或文件夹的名字的列表 #print(os.mkdir(path1)) # 创建文件夹 print(os.path.abspath(path)) # 返回绝对路径 print(os.path.basename(path)) # 返回文件名 print(os.path.isfi...
normal
{ "blob_id": "c01ea897cd64b3910531babe9fce8c61b750185d", "index": 7912, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(os.getcwd())\nprint(os.listdir(path))\nprint(os.path.abspath(path))\nprint(os.path.basename(path))\nprint(os.path.isfile(path2))\nprint(os.path.isdir(path1))\n", "step-3": "<mask ...
[ 0, 1, 2, 3, 4 ]
import json parsed = {} with open('/Users/danluu/dev/dump/terra/filtered_events.json','r') as f: # with open('/Users/danluu/dev/dump/terra/game-data/2017-05.json','r') as f: # with open('/Users/danluu/dev/dump/terra/ratings.json','r') as f: parsed = json.load(f) # print(json.dumps(parsed, indent=2)) print(js...
normal
{ "blob_id": "886024a528112520948f1fb976aa7cb187a1da46", "index": 6767, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('/Users/danluu/dev/dump/terra/filtered_events.json', 'r') as f:\n parsed = json.load(f)\nprint(json.dumps(parsed['4pLeague_S1_D1L1_G4']['events']['faction'], indent=2))\n", ...
[ 0, 1, 2, 3, 4 ]
#### #Some more on variables #### #Variables are easily redefined. #Let's start simple. x=2 #x is going to start at 2 print (x) x=54 #we are redefining x to equal 54 print (x) x= "Cheese" #x is now the string 'cheese' print (x) #Try running this program to see x #printed at each point #Clearly variables can be...
normal
{ "blob_id": "dae8529aa58f1451d5acdd6607543c202c3c0c66", "index": 3810, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(x)\n<mask token>\nprint(x)\n<mask token>\nprint(x)\n", "step-3": "x = 2\nprint(x)\nx = 54\nprint(x)\nx = 'Cheese'\nprint(x)\n", "step-4": "####\n#Some more on variables\n####\n\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('The ave_age of survivors is {}'.format(ave_survived_age)) print('The ave_age of victims is {}'.format(ave_non_survived_age)) <|reserved_special_token_1|> survived_age = [48.0, 15.0, 40.0, 36.0, 47.0, 32.0, 60.0, 31.0, 17...
flexible
{ "blob_id": "85c51f155439ff0cb570faafc48ac8da094515bf", "index": 3362, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('The ave_age of survivors is {}'.format(ave_survived_age))\nprint('The ave_age of victims is {}'.format(ave_non_survived_age))\n", "step-3": "survived_age = [48.0, 15.0, 40.0, 36....
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> numpy.random.seed(1) <|reserved_special_token_0|> Y.observe(y) <|reserved_special_token_0|> C.initialize_from_random() <|reserved_special_token_0|> Q.set_callback(R.rotate) Q.update(repeat=1000) <|reserved_special_token_0|> bpplt....
flexible
{ "blob_id": "9af2b94c6eef47dad0348a5437593cc8561a7deb", "index": 3593, "step-1": "<mask token>\n", "step-2": "<mask token>\nnumpy.random.seed(1)\n<mask token>\nY.observe(y)\n<mask token>\nC.initialize_from_random()\n<mask token>\nQ.set_callback(R.rotate)\nQ.update(repeat=1000)\n<mask token>\nbpplt.hinton(C)\n"...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> mydata.rename(columns=lambda x: x.strip(' '), inplace=True) <|reserved_special_token_0|> print(my_need_data.iloc[:, 0:3]) my_need_data.to_csv('result_csv.csv', index=0) <|reserved_special_token_1|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "ab760ec4cbb9f616f38b0f0f2221987460c6f618", "index": 6492, "step-1": "<mask token>\n", "step-2": "<mask token>\nmydata.rename(columns=lambda x: x.strip(' '), inplace=True)\n<mask token>\nprint(my_need_data.iloc[:, 0:3])\nmy_need_data.to_csv('result_csv.csv', index=0)\n", "step-3": "<mask token>\n...
[ 0, 1, 2, 3, 4 ]
from ._sinAction import * from ._sinActionFeedback import * from ._sinActionGoal import * from ._sinActionResult import * from ._sinFeedback import * from ._sinGoal import * from ._sinResult import *
normal
{ "blob_id": "c6b261a09b2982e17704f847586bbf38d27cb786", "index": 353, "step-1": "<mask token>\n", "step-2": "from ._sinAction import *\nfrom ._sinActionFeedback import *\nfrom ._sinActionGoal import *\nfrom ._sinActionResult import *\nfrom ._sinFeedback import *\nfrom ._sinGoal import *\nfrom ._sinResult impor...
[ 0, 1 ]
import os from sklearn import metrics import pandas as pd import numpy as np from submission import submission import argparse import glob def calc_auc(subm): preds=subm['target'].values labels=subm['labels'].values if len(set(labels))==1: print('warning calc_auc with single label dataset, return...
normal
{ "blob_id": "fe0b21deb2e48ad74449b264265729cb328090ea", "index": 6380, "step-1": "<mask token>\n\n\ndef calc_auc(subm):\n preds = subm['target'].values\n labels = subm['labels'].values\n if len(set(labels)) == 1:\n print('warning calc_auc with single label dataset, return 0')\n return 0\n ...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python3 import sys import collections as cl def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) MOD = 998244353 def main(): N, K = MI() kukan = [] for _ in range(K): ...
normal
{ "blob_id": "60b70171dededd758e00d6446842355a47b54cc0", "index": 9700, "step-1": "<mask token>\n\n\ndef II():\n return int(sys.stdin.readline())\n\n\ndef MI():\n return map(int, sys.stdin.readline().split())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\n<mask token>\n", "st...
[ 3, 5, 6, 7, 8 ]
#!/usr/bin/env python # encoding: utf8 #from __future__ import unicode_literals class RefObject(object): def __init__(self,): self.pose = [] self.name = [] self.time = None self.id = None def set_data(self,pose, name, time, Id): self.pose = pose self....
normal
{ "blob_id": "7611a57705939ce456e34d5ae379d6ca748b13c3", "index": 1884, "step-1": "<mask token>\n\n\nclass Datafunction(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n ...
[ 3, 11, 12, 16, 18 ]
<|reserved_special_token_0|> class Visit(object): <|reserved_special_token_0|> def __init__(self, id_visit, id_stay_point, pivot_arrival_fix: GpsFix, pivot_departure_fix: GpsFix, detection_arrival_fix: GpsFix, detection_departure_fix: GpsFix): """ Builds a Visit object ...
flexible
{ "blob_id": "703ed320e7c06856a0798d9c0de9aafe24458767", "index": 7937, "step-1": "<mask token>\n\n\nclass Visit(object):\n <mask token>\n\n def __init__(self, id_visit, id_stay_point, pivot_arrival_fix: GpsFix,\n pivot_departure_fix: GpsFix, detection_arrival_fix: GpsFix,\n detection_departur...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Article(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|> <|...
flexible
{ "blob_id": "28233cb4a56ee805e66f34e6abd49137503d5f7b", "index": 1405, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Article(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Article(models.Model):\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from access.ssh.session import Client from access.ssh.datachannel import DataChannel
flexible
{ "blob_id": "967c8348352c805b926643617b88b03a62df2d16", "index": 2271, "step-1": "<mask token>\n", "step-2": "from access.ssh.session import Client\nfrom access.ssh.datachannel import DataChannel\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
import sys from pcaspy import SimpleServer, Driver import time from datetime import datetime import thread import subprocess import argparse #import socket #import json import pdb class myDriver(Driver): def __init__(self): super(myDriver, self).__init__() def printDb(prefix): global pvdb print...
normal
{ "blob_id": "03943e146c0d64cfe888073e3a7534b6615b023f", "index": 6410, "step-1": "import sys\n\nfrom pcaspy import SimpleServer, Driver\nimport time\nfrom datetime import datetime\nimport thread\nimport subprocess\nimport argparse\n#import socket\n#import json\nimport pdb\n\nclass myDriver(Driver):\n def __in...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for _ in range(u + v): s, e = map(int, input().split()) warp[s] = e <|reserved_special_token_0|> q.append(1) <|reserved_special_token_0|> while q: now = q.popleft() for k in range(1, 7): if now + k <= 100 a...
flexible
{ "blob_id": "dd792c502317288644d4bf5d247999bb08d5f401", "index": 5369, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(u + v):\n s, e = map(int, input().split())\n warp[s] = e\n<mask token>\nq.append(1)\n<mask token>\nwhile q:\n now = q.popleft()\n for k in range(1, 7):\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class InheritUser(models.Model): _inherit = 'res.users' pos_sessions = fields.Many2many('pos.config', string= 'Point of Sale Accessible') @api.multi def write(self, vals): if 'pos_sessions' in vals: if vals['pos_sessions'][0][2]: ...
flexible
{ "blob_id": "2cff5fdfc86793592dd97de90ba9c3a11870b356", "index": 8987, "step-1": "<mask token>\n\n\nclass InheritUser(models.Model):\n _inherit = 'res.users'\n pos_sessions = fields.Many2many('pos.config', string=\n 'Point of Sale Accessible')\n\n @api.multi\n def write(self, vals):\n i...
[ 4, 6, 7, 8, 10 ]
<|reserved_special_token_0|> class GANSynthWrapper(GenerativeModel): def __init__(self, ckpt_path, data_size, use_approx=True): super(GANSynthWrapper, self).__init__(use_approx=use_approx) self.latent_size = 256 self.data_size = data_size self.data_dim = 1 self.expected_di...
flexible
{ "blob_id": "f13a2820fe1766354109d1163c7e6fe887cd6f34", "index": 7051, "step-1": "<mask token>\n\n\nclass GANSynthWrapper(GenerativeModel):\n\n def __init__(self, ckpt_path, data_size, use_approx=True):\n super(GANSynthWrapper, self).__init__(use_approx=use_approx)\n self.latent_size = 256\n ...
[ 7, 8, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('loveMusic.csv', 'w', newline='') as csvFile: fieldsName = ['nameFile', 'tittle', 'artist', 'gender', 'path'] writer = csv.DictWriter(csvFile, fieldnames=fieldsName) writer.writeheader() tittle = audiofil...
flexible
{ "blob_id": "629649abe9d855122a5db6d61a20735ceb89c5cf", "index": 6426, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('loveMusic.csv', 'w', newline='') as csvFile:\n fieldsName = ['nameFile', 'tittle', 'artist', 'gender', 'path']\n writer = csv.DictWriter(csvFile, fieldnames=fieldsName)\n...
[ 0, 1, 2, 3 ]
friends = ["Rolf", "Bob", "Anne"] print(friends[0]) print(friends[1]) print(len(friends)) new_friends = [ ["Rolf", 24], ["Bob", 30], ["Anne", 27], ["Charlie", 25], ["Jen", 25], ["Adam", 29] ] print(friends[0][0]) friends.append("Jen") print(friends) new_friends.remove(["Anne", 27]) print(new...
normal
{ "blob_id": "355d60300cbbed817b4512e9b02cc4dd53d1293e", "index": 2692, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(friends[0])\nprint(friends[1])\nprint(len(friends))\n<mask token>\nprint(friends[0][0])\nfriends.append('Jen')\nprint(friends)\nnew_friends.remove(['Anne', 27])\nprint(new_friends)\...
[ 0, 1, 2, 3 ]
button6 = Button(tk,text=" ",font=('Times 26 bold'), heigh = 4, width = 8, command=lambda:checker(button6)) button6.grid(row=2, column=2,sticky = S+N+E+W) button7 = Button(tk,text=" ",font=('Times 26 bold'), heigh = 4, width = 8, command=lambda:checker(button7)) button7.grid(row=3, column=0,sticky = S+N+E+W) button8 = ...
normal
{ "blob_id": "e543c7f7f1b249e53b8ebf82641ec398abf557af", "index": 477, "step-1": "<mask token>\n", "step-2": "<mask token>\nbutton6.grid(row=2, column=2, sticky=S + N + E + W)\n<mask token>\nbutton7.grid(row=3, column=0, sticky=S + N + E + W)\n<mask token>\nbutton8.grid(row=3, column=1, sticky=S + N + E + W)\n<...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if len(argv) == 2 and (argv[1] == '--help' or argv[1] == '-h'): print(__doc__) exit(0) <|reserved_special_token_0|> if __name__ == '__main__': window = MainWindow() window.mainloop() <|reserved_special_token_1|> ...
flexible
{ "blob_id": "c153c7a3a11a09ed645540632daec42e8905432a", "index": 4165, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(argv) == 2 and (argv[1] == '--help' or argv[1] == '-h'):\n print(__doc__)\n exit(0)\n<mask token>\nif __name__ == '__main__':\n window = MainWindow()\n window.mainloop(...
[ 0, 1, 2, 3 ]
import logging import ibmsecurity.utilities.tools import os.path logger = logging.getLogger(__name__) def get(isamAppliance, check_mode=False, force=False): """ Get information on existing snapshots """ return isamAppliance.invoke_get("Retrieving snapshots", "/snapshots") def get_latest(isamApplian...
normal
{ "blob_id": "23066cd644826bcfef1ef41f154924ac89e12069", "index": 2081, "step-1": "<mask token>\n\n\ndef get(isamAppliance, check_mode=False, force=False):\n \"\"\"\n Get information on existing snapshots\n \"\"\"\n return isamAppliance.invoke_get('Retrieving snapshots', '/snapshots')\n\n\n<mask token...
[ 9, 12, 13, 14, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def solution(prices): answer = [0] * len(prices) for i in range(len(prices) - 1): for j in range(i + 1, len(prices)): answer[i] += 1 if prices[i] > prices[j]: break return answer <|reserved_special...
flexible
{ "blob_id": "23b6d754adf1616bc6ea1f8c74984fbd8dade6dd", "index": 4238, "step-1": "<mask token>\n", "step-2": "def solution(prices):\n answer = [0] * len(prices)\n for i in range(len(prices) - 1):\n for j in range(i + 1, len(prices)):\n answer[i] += 1\n if prices[i] > prices[j...
[ 0, 1, 2 ]
import xarray as xr import pandas as pd import numpy as np import matplotlib.pyplot as plt import pickle import seaborn as sns %load_ext autoreload %autoreload 2 %matplotlib data_dir = Path('/Volumes/Lees_Extend/data/ecmwf_sowc/data/') # READ in model (maybe want to do more predictions on historical data) from src.m...
normal
{ "blob_id": "d265781c6b618752a1afcf65ac137052c26388a6", "index": 985, "step-1": "import xarray as xr\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport pickle\nimport seaborn as sns\n\n%load_ext autoreload\n%autoreload 2\n%matplotlib\n\ndata_dir = Path('/Volumes/Lees_Extend/data/ec...
[ 0 ]
# -*- coding: utf-8 -*- import time import re from config import allowed_users, master_users, chat_groups from bs4 import BeautifulSoup import requests import urllib.request, urllib.error, urllib.parse import http.cookiejar import json import os import sys #from random import randint, choice from random import uniform,...
normal
{ "blob_id": "98dd7446045f09e6d709f8e5e63b0a94341a796e", "index": 3158, "step-1": "<mask token>\n\n\ndef fetch_images_from_db(chat_id, keyword_id, keyword_n, db, shared_dict):\n search = False\n if str(chat_id) + str(keyword_id) + 'db' in shared_dict:\n print('%s for group %s already in progress, sle...
[ 4, 5, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(list(myquery)) <|reserved_special_token_0|> print(list(myquery)) <|reserved_special_token_1|> <|reserved_special_token_0|> myclient = pymongo.MongoClient('mongodb://localhost:27017/') mydb = myclient['divya_db'] mycol = m...
flexible
{ "blob_id": "d91bacfd4b45832a79189c0f1ec4f4cb3ef14851", "index": 2210, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(list(myquery))\n<mask token>\nprint(list(myquery))\n", "step-3": "<mask token>\nmyclient = pymongo.MongoClient('mongodb://localhost:27017/')\nmydb = myclient['divya_db']\nmycol = ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Product: <|reserved_special_token_0|> def __init__(self, cost: int) ->None: self.__cost = cost def get_yen(self) ->int: return self.__cost class ProductAdapter(ProductPrice): """Adapter""" DOLL_RATE: int = 110 def __init__(self, product: ...
flexible
{ "blob_id": "829e23ce2388260467ed159aa7e1480d1a3d6045", "index": 6546, "step-1": "<mask token>\n\n\nclass Product:\n <mask token>\n\n def __init__(self, cost: int) ->None:\n self.__cost = cost\n\n def get_yen(self) ->int:\n return self.__cost\n\n\nclass ProductAdapter(ProductPrice):\n \...
[ 7, 9, 12, 13, 14 ]
<|reserved_special_token_0|> def base(request): return render(request, 'VICHealth_app/base.html') <|reserved_special_token_0|> def check_activity_level(request): return render(request, 'VICHealth_app/check_activity_level.html') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_spec...
flexible
{ "blob_id": "b0818b545ab47c27c705f2ccfa3b9edb741602f7", "index": 4757, "step-1": "<mask token>\n\n\ndef base(request):\n return render(request, 'VICHealth_app/base.html')\n\n\n<mask token>\n\n\ndef check_activity_level(request):\n return render(request, 'VICHealth_app/check_activity_level.html')\n\n\n<mask...
[ 2, 3, 5, 6, 7 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2016-03-15 16:39:32 # @Author : Your Name (you@example.org) # @Link : http://example.org # @Version : $Id$ from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * from widgets.favorits.favorit_win import Ui_DialogFavorit import j...
normal
{ "blob_id": "14023785983f493af57189b3d96254efef2e33ae", "index": 8180, "step-1": "<mask token>\n\n\nclass Favorits(QDialog, Ui_DialogFavorit):\n <mask token>\n\n def __init__(self):\n super(Favorits, self).__init__()\n self.setupUi(self)\n self.buttonBox.button(QDialogButtonBox.Save).s...
[ 4, 5, 7, 8, 9 ]
<|reserved_special_token_0|> class ZhouyiSpider(scrapy.Spider): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def parse_detail(self, response): item = response.meta['item'] item['hexagram1'] = response.xpath( ...
flexible
{ "blob_id": "cd9f25a2810b02f5588e4e9e8445e7aaec056bf8", "index": 7704, "step-1": "<mask token>\n\n\nclass ZhouyiSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def parse_detail(self, response):\n item = response.meta['item']\n item['hexagram1'] ...
[ 2, 3, 4, 5, 6 ]
from sklearn.preprocessing import RobustScaler from statsmodels.tsa.arima.model import ARIMA from sklearn.metrics import mean_squared_error, r2_score, mean_absolute_error from math import sqrt import tensorflow as tf import pandas as pd import numpy as np import os import random # set random seed random.seed(1) np.ra...
normal
{ "blob_id": "d78ac5188cad104ee1b3e214898c41f843b6d8c0", "index": 5185, "step-1": "<mask token>\n", "step-2": "<mask token>\nrandom.seed(1)\nnp.random.seed(1)\ntf.random.set_random_seed(1)\n<mask token>\nfor i in range(1, 6):\n df = pd.read_csv(random_sample_save_folder_path + \n 'power_demand_sample%...
[ 0, 1, 2, 3, 4 ]
from face_recognition.model import Backbone import torch import numpy class face_verifier(): def __init__(self, net_depth=50, drop_ratio=0.6, net_mode="ir_se", device="cuda"): # create model self.model = Backbone(net_depth, drop_ratio, net_mode).to(device) save_path = "face_recognit...
normal
{ "blob_id": "0659df48bb150582917e333a7a25d2d25395dfda", "index": 1381, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass face_verifier:\n <mask token>\n\n def verify_person(self, f1, f2):\n batch_tensor = torch.cat([f1, f2], 0)\n output_feat = self.model(batch_tensor.cuda())\n ...
[ 0, 2, 3, 4, 5 ]
from const import BORN_KEY, PRESIDENT_KEY, CAPITAL_KEY, PRIME_KEY, MINISTER_KEY, POPULATION_KEY, \ GOVERNMENT_KEY,AREA_KEY, WHO_KEY, IS_KEY, THE_KEY, OF_KEY, WHAT_KEY, WHEN_KEY, WAS_KEY from geq_queries import capital_of_country_query, area_of_country_query, government_of_country_query, \ population_of_country...
normal
{ "blob_id": "18dce1ce683b15201dbb5436cbd4288a0df99c28", "index": 938, "step-1": "<mask token>\n\n\ndef get_last_argument(words):\n return ' '.join(words)[:-1]\n\n\n<mask token>\n\n\ndef parse_what_is_the(words):\n question_number = None\n arg = None\n if words[3] == POPULATION_KEY:\n question_...
[ 5, 6, 7, 8, 9 ]
#! /usr/bin/env python import smtpsend S = smtpsend.Smtpsent(SUBJECT='Test') S.sendemail(''' this is a test! ''')
normal
{ "blob_id": "7754974e79202b2df4ab9a7f69948483042a67cc", "index": 855, "step-1": "<mask token>\n", "step-2": "<mask token>\nS.sendemail(\"\"\"\nthis is a test!\n\"\"\")\n", "step-3": "<mask token>\nS = smtpsend.Smtpsent(SUBJECT='Test')\nS.sendemail(\"\"\"\nthis is a test!\n\"\"\")\n", "step-4": "import smtp...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.stdin = open('sample_input.txt', 'r') test_case = int(input()) <|reserved_special_token_0|> <|reserved_special_token_1|> import sys from pprint import pprint sys.stdin = open('sample_input.txt', 'r') test_case = int(input()...
flexible
{ "blob_id": "15fea8a84accdfc2dac87c111cbe8bfca61fe801", "index": 3482, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.stdin = open('sample_input.txt', 'r')\ntest_case = int(input())\n<mask token>\n", "step-3": "import sys\nfrom pprint import pprint\nsys.stdin = open('sample_input.txt', 'r')\ntest_c...
[ 0, 1, 2, 3 ]
import os from flask import ( Flask, render_template, request ) # from flask_jwt_extended import JWTManager from flask_login import LoginManager from flask_migrate import Migrate from flask_sqlalchemy import SQLAlchemy from flask_wtf.csrf import CSRFError, CSRFProtect from config import Config from log_con...
normal
{ "blob_id": "9d142e8de5235d55cd99371c9884e8dc7a10c947", "index": 8111, "step-1": "<mask token>\n\n\n@app.errorhandler(404)\ndef not_found(error):\n logger.warning(f'page not found {error} - {request.url}')\n return render_template('error_pages/404.html'), 404\n\n\n@app.errorhandler(500)\ndef server_error(e...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/python # -*- coding: utf-8 -*- """ Created on Fri Apr 12 16:38:15 2013 @author: a92549 Fixes lack of / between tzvp and tzvpfit """ import sys def main(argv): for com in argv: with open(com, 'rb') as f: txt = f.read() if 'tzvp tzvpfit' in txt: parts = txt.spl...
normal
{ "blob_id": "85974e48c7eafdf39379559820ed7f0bdc07fb7a", "index": 3680, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(argv):\n for com in argv:\n with open(com, 'rb') as f:\n txt = f.read()\n if 'tzvp tzvpfit' in txt:\n parts = txt.split('tzvp tzvpfit',...
[ 0, 1, 2, 3, 4 ]
""" Module for generic standard analysis plots. """ import numpy as np import matplotlib.pyplot as plt import cartopy as cart import xarray as xr import ecco_v4_py as ecco def global_and_stereo_map(lat, lon, fld, plot_type='pcolormesh', cmap='YlOrRd', ...
normal
{ "blob_id": "b039ed74e62f3a74e8506d4e14a3422499046c06", "index": 860, "step-1": "<mask token>\n\n\ndef plot_depth_slice(x, depth, fld, stretch_depth=-500, plot_type=\n 'pcolormesh', cmap='YlOrRd', title=None, cmin=None, cmax=None, dpi=100,\n show_colorbar=True):\n \"\"\"2D plot of depth vs some other va...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @torch.no_grad() def validate(data, model): model.evaluate() out = model(data.x, data.train_index) return model.loss(out[data.val_mask == 1], data.y[data.val_mask == 1]) @torch.no_grad() def validate_fb(data, model, lsym): model.evaluate() out = model(data.x, data.tr...
flexible
{ "blob_id": "83c109bc5aab6739a3a32116fae4f0c011d6118e", "index": 4136, "step-1": "<mask token>\n\n\n@torch.no_grad()\ndef validate(data, model):\n model.evaluate()\n out = model(data.x, data.train_index)\n return model.loss(out[data.val_mask == 1], data.y[data.val_mask == 1])\n\n\n@torch.no_grad()\ndef ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if not webcam.isOpened(): print('Could not open webcam') exit() <|reserved_special_token_0|> while webcam.isOpened(): status, frame = webcam.read() sample_num = sample_num + 1 if not status: break c...
flexible
{ "blob_id": "856a27e953a6b4e1f81d02e00717a8f95a7dea5f", "index": 7790, "step-1": "<mask token>\n", "step-2": "<mask token>\nif not webcam.isOpened():\n print('Could not open webcam')\n exit()\n<mask token>\nwhile webcam.isOpened():\n status, frame = webcam.read()\n sample_num = sample_num + 1\n ...
[ 0, 1, 2, 3, 4 ]
import logging import random from pyage.core.address import Addressable from pyage.core.agent.agent import AbstractAgent from pyage.core.inject import Inject, InjectOptional logger = logging.getLogger(__name__) class AggregateAgent(Addressable, AbstractAgent): @Inject("aggregated_agents:_AggregateAgent__agents")...
normal
{ "blob_id": "85903f0c6bd4c896379c1357a08ae3bfa19d5415", "index": 7065, "step-1": "<mask token>\n\n\nclass AggregateAgent(Addressable, AbstractAgent):\n\n @Inject('aggregated_agents:_AggregateAgent__agents')\n @InjectOptional('locator')\n def __init__(self, name=None):\n self.name = name\n ...
[ 7, 10, 11, 13, 15 ]
from random import shuffle """all sorting algorithm implementation""" class Sorts: def quick_sort(self, elements): """quick sort implementation""" if len(elements) < 2: return elements else: shuffle(elements) pivot = elements[0] print("pivot ...
normal
{ "blob_id": "2044140fb2678f9507946007fdfb7edbaf11798e", "index": 5683, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Sorts:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Sorts:\n\n def quick_sort(self, elements):\n \"\"\"quick sort implementation\"\"\"\n if len(el...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class KayakHandler(webapp.RequestHandler): <|reserved_special_token_0|> class ClearTripHandler(webapp.RequestHandler): def get(self): file = open('result.xml', 'r') content = file.read() content = replace(content, '&', '&amp;') xml = XML2Dict() ...
flexible
{ "blob_id": "08568c31e5a404957c11eca9cbc9472c71cf088b", "index": 9546, "step-1": "<mask token>\n\n\nclass KayakHandler(webapp.RequestHandler):\n <mask token>\n\n\nclass ClearTripHandler(webapp.RequestHandler):\n\n def get(self):\n file = open('result.xml', 'r')\n content = file.read()\n ...
[ 5, 8, 9, 11, 17 ]
''' Created on Dec 23, 2011 @author: boatkrap ''' import kombu from kombu.common import maybe_declare from . import queues import logging logger = logging.getLogger(__name__) import threading cc = threading.Condition() class Publisher: def __init__(self, exchange_name, channel, routing_key=None): s...
normal
{ "blob_id": "8205541dcdd4627a535b14c6775f04b80e7c0d15", "index": 3354, "step-1": "<mask token>\n\n\nclass Publisher:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TopicPublisher(Publisher):\n\n def __init__(self, exchange_name, channel, routing_key=None):...
[ 7, 9, 12, 13, 15 ]
from django.urls import path from .views import PollsList, SinglePollsView, PollsCreate, PollsAnswer app_name = "authors" # app_name will help us do a reverse look-up latter. urlpatterns = [ path('polls/', PollsList.as_view()), path('polls/create', PollsCreate.as_view()), path('polls/<int:pk>', SinglePollsV...
normal
{ "blob_id": "64ac007faeebe0e71ba0060e74fa07154e6291e2", "index": 6053, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'authors'\nurlpatterns = [path('polls/', PollsList.as_view()), path('polls/create',\n PollsCreate.as_view()), path('polls/<int:pk>', SinglePollsView.as_view(\n )), path('...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @numba.jit(nopython=True) def backtrack_steps(): """ Compute the number of steps it takes a 1d random walker starting at zero to get to +1. """ x = 0 n_steps = 0 while x < 1: x += 2 * np.random.randint(0, 2) - 1 n_steps += 1 return n_steps ...
flexible
{ "blob_id": "00a2992af78f9edadd3f4cbc7d073c1f74fcd9a2", "index": 2810, "step-1": "<mask token>\n\n\n@numba.jit(nopython=True)\ndef backtrack_steps():\n \"\"\"\n Compute the number of steps it takes a 1d random walker starting\n at zero to get to +1.\n \"\"\"\n x = 0\n n_steps = 0\n while x <...
[ 2, 3, 4, 5, 6 ]