code
stringlengths
13
1.2M
order_type
stringclasses
1 value
original_example
dict
step_ids
listlengths
1
5
from django.contrib import admin from .models import CarouselImage, Budget admin.site.register(CarouselImage) admin.site.register(Budget)
normal
{ "blob_id": "98fb70e1911522365292c86603481656e7b86d73", "index": 8337, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(CarouselImage)\nadmin.site.register(Budget)\n", "step-3": "from django.contrib import admin\nfrom .models import CarouselImage, Budget\nadmin.site.register(CarouselI...
[ 0, 1, 2 ]
""" Copyright 2019 Enzo Busseti, Walaa Moursi, and Stephen Boyd 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-2.0 Unless required by applicable law or ...
normal
{ "blob_id": "00a0668d5fcb8358b4bd7736c48e4867afc0f5b6", "index": 780, "step-1": "<mask token>\n\n\nclass SolverError(Exception):\n pass\n\n\n<mask token>\n\n\ndef ecos_solve(A, b, c, dim_dict, **kwargs):\n \"\"\"Wraps ecos.solve for convenience.\"\"\"\n ecos_cones = {'l': dim_dict['l'] if 'l' in dim_dic...
[ 2, 3, 4, 5, 6 ]
import matplotlib.pyplot as plt from sklearn.decomposition import PCA from sklearn.discriminant_analysis import LinearDiscriminantAnalysis import pandas as pd import numpy as np from sklearn import datasets from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split # a = pd....
normal
{ "blob_id": "d0448ca8e3fd2f3bb8a3a7ec052e29ab0be6351a", "index": 471, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.figure()\n<mask token>\nfor color, i, target_name in zip(colors, [0, 1, 2], target_names):\n plt.scatter(X_r[y == i, 0], X_r[y == i, 1], color=color, alpha=0.8, lw=\n lw, lab...
[ 0, 1, 2, 3, 4 ]
import os import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') def test_configuration(host): sshd = host.file('/etc/ssh/sshd_config') assert sshd.contains(r'^PermitRootLogin no$') assert sshd.co...
normal
{ "blob_id": "2345d1f72fb695ccec5af0ed157c0606f197009c", "index": 3398, "step-1": "<mask token>\n\n\ndef test_configuration(host):\n sshd = host.file('/etc/ssh/sshd_config')\n assert sshd.contains('^PermitRootLogin no$')\n assert sshd.contains('^X11Forwarding no$')\n assert sshd.contains('^UsePAM yes$...
[ 1, 2, 3, 4, 5 ]
from argparse import ArgumentParser, Namespace def parse_arguments() ->Namespace: """ Parse arguments :return: Arguments """ parser = ArgumentParser(description= 'DLP project: Stock Prediction using Transformer') parser.add_argument('-e', '--epochs', default=10, type=int, help= ...
normal
{ "blob_id": "81573b4a57f540733ff2faaf82bab78381b9dd46", "index": 1194, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef parse_arguments() ->Namespace:\n \"\"\"\n Parse arguments\n :return: Arguments\n \"\"\"\n parser = ArgumentParser(description=\n 'DLP project: Stock Predicti...
[ 0, 1, 2 ]
from kivy.app import App from kivy.lang import Builder from kivy.uix.screenmanager import ScreenManager, Screen import subprocess import socket from kivy.uix.button import Button from kivy.uix.button import Label from kivy.uix.boxlayout import BoxLayout Builder.load_string(""" <MenuScreen>: BoxLayout: orie...
normal
{ "blob_id": "237a647e7bf0b1c12abd78b1ef6e293e73232a6c", "index": 2217, "step-1": "from kivy.app import App\nfrom kivy.lang import Builder\nfrom kivy.uix.screenmanager import ScreenManager, Screen\nimport subprocess\nimport socket\nfrom kivy.uix.button import Button\nfrom kivy.uix.button import Label\nfrom kivy.u...
[ 0 ]
# Generated by Django 2.2.6 on 2020-05-21 09:44 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('DHOPD', '0015_auto_20200515_0126'), ] operations = [ migrations.CreateModel( name='Patient_c', field...
normal
{ "blob_id": "52da8608e43b2d8dfe00f0956a1187fcf2e7b1ff", "index": 41, "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 = [('DHOPD', '0015...
[ 0, 1, 2, 3, 4 ]
class Queue(object): def __init__(self, val_list=None): self.stack_one = [] self.stack_two = [] if val_list: for item in val_list: self.stack_one.append(item) def push(self, val=None): if val: self.stack_one.append(val) def pop(self)...
normal
{ "blob_id": "d4d8d800b81a50f2c520f0394412935738d1a8ee", "index": 2986, "step-1": "class Queue(object):\n\n def __init__(self, val_list=None):\n self.stack_one = []\n self.stack_two = []\n if val_list:\n for item in val_list:\n self.stack_one.append(item)\n\n d...
[ 3, 4, 5, 6 ]
print('SYL_2整型数组_12 合并排序数组')
normal
{ "blob_id": "571636be9d213d19bddfd1d04688bc0955c9eae5", "index": 4427, "step-1": "<mask token>\n", "step-2": "print('SYL_2整型数组_12 合并排序数组')\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from setuptools import Command class decl_cmd1(Command): user_options = [] def initialize_options(self): pass def finalize_options(self): pass def run(self): pass class decl_cmd2(Command): user_options = [] def initialize_options(self): pass def final...
normal
{ "blob_id": "70b8efa844395592131382d1d1e2c39150804f99", "index": 4111, "step-1": "<mask token>\n\n\nclass decl_cmd1(Command):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass decl_cmd2(Command):\n user_options = []\n\n def initialize_options(self):\n pass\n\n def...
[ 6, 8, 9, 10, 11 ]
# socket_address_packing.py import binascii import socket import struct import sys for string_address in ['192.168.1.1', '127.0.0.1']: packed = socket.inet_aton(string_address) print('Originale :', string_address) print('Impacchettato:', binascii.hexlify(packed)) print('Spacchettato :', socket.inet...
normal
{ "blob_id": "01626772b0f47987157e9f92ba2ce66a0ec2dcb4", "index": 4379, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor string_address in ['192.168.1.1', '127.0.0.1']:\n packed = socket.inet_aton(string_address)\n print('Originale :', string_address)\n print('Impacchettato:', binascii.hexli...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 """ Calculates the maximization step in the EM algorithm for a GMM """ import numpy as np def maximization(X, g): """ Returns: pi, m, S, or None, None, None on failure """ if type(X) is not np.ndarray or len(X.shape) != 2: return None, None, None if type(g) is not...
normal
{ "blob_id": "a55daebd85002640db5e08c2cf6d3e937b883f01", "index": 1611, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef maximization(X, g):\n \"\"\"\n Returns: pi, m, S, or None, None, None on failure\n \"\"\"\n if type(X) is not np.ndarray or len(X.shape) != 2:\n return None, No...
[ 0, 1, 2, 3 ]
""" Looks up values in createresistorvaluesdbm.py. Outputs string value ( cmd ). """ import dbm # Open a DB. The c option opens in read/write mode and creates the file if needed. db = dbm.open( 'resistorvalues', 'c' ) with open( "dummyoutput.txt", "r" ) as file_object: #print (file_object.readli...
normal
{ "blob_id": "69eb62ba47a63cf007334c777709b0513d75f396", "index": 1504, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('dummyoutput.txt', 'r') as file_object:\n data = file_object.readlines()\n for line in data:\n words = line.split(';')\n for i in range(1, len(words), 4):\n ...
[ 0, 1, 2, 3, 4 ]
#!/bin/python import sys import notify2 import subprocess from time import sleep def notification(message: str): """ Display notification to the desktop Task: 1. show() -> it will generate a complete new pop 2. update() -> it will update the payload part of same notification pop-up, not is...
normal
{ "blob_id": "8a7904881d936a3cb421ed5550856b600894fcee", "index": 5397, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef notification(message: str):\n \"\"\"\n Display notification to the desktop\n Task:\n 1. show() -> it will generate a complete new pop\n 2. update() -> it wi...
[ 0, 2, 3, 4, 5 ]
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- """Module for mimic explainer and explainable surrogate models.""" from .mimic_explainer import MimicExplainer __all__ = ["MimicExplainer"...
normal
{ "blob_id": "0b8cb522c531ac84d363b569a3ea4bfe47f61993", "index": 5390, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['MimicExplainer']\n", "step-3": "<mask token>\nfrom .mimic_explainer import MimicExplainer\n__all__ = ['MimicExplainer']\n", "step-4": "# ----------------------------------...
[ 0, 1, 2, 3 ]
import os import redis class Carteiro(): if os.environ.get("REDIS_URL") != None: redis_pool = redis.ConnectionPool.from_url(os.environ.get("REDIS_URL")) else: redis_pool = '' def __init__(self, id, pacote): if os.environ.get("REDIS_URL") != None: self.redis_bd ...
normal
{ "blob_id": "dd95d14f35b6a92b3363d99a616678da18733a61", "index": 7839, "step-1": "<mask token>\n\n\nclass Carteiro:\n if os.environ.get('REDIS_URL') != None:\n redis_pool = redis.ConnectionPool.from_url(os.environ.get('REDIS_URL'))\n else:\n redis_pool = ''\n\n def __init__(self, id, pacot...
[ 4, 5, 6, 7, 8 ]
from django.shortcuts import render, get_object_or_404 from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView from accounts.models import Employee from leave.models import ApplyLeave from departments.models import Department, Position from django.contrib.auth.models import User from...
normal
{ "blob_id": "7c6ac2837751703ac4582ee81c29ccf67b8277bc", "index": 1632, "step-1": "<mask token>\n\n\nclass UpdatePerformanceView(SuccessMessageMixin, UpdateView):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass DetailPerformanceView(DetailView...
[ 7, 12, 17, 20, 21 ]
#-*- coding: utf-8 -*- # Copyright (C) 2011 by # Jordi Torrents <jtorrents@milnou.net> # Aric Hagberg <hagberg@lanl.gov> # All rights reserved. # BSD license. import itertools import networkx as nx __author__ = """\n""".join(['Jordi Torrents <jtorrents@milnou.net>', 'Aric Hagb...
normal
{ "blob_id": "a21c132ba9f24ff2c695bf66cae074705025d6b1", "index": 8063, "step-1": "<mask token>\n\n\ndef cc_dot(nu, nv):\n return float(len(nu & nv)) / len(nu | nv)\n\n\ndef cc_max(nu, nv):\n return float(len(nu & nv)) / max(len(nu), len(nv))\n\n\n<mask token>\n\n\ndef average_clustering(G, nodes=None, mode...
[ 4, 8, 9, 10, 11 ]
import os.path as osp from evaluations.common import tiou from evaluations.util import load_file import generate_track_link def eval_ground_scores(gt_relations, pred_relations, tiou_threshold): """ :param gt_relations: :param pred_relations: :param tiou_threshold: :return: """ # pred_relat...
normal
{ "blob_id": "f26e6164fc4c07fd3339171e316b3a1f7a4be669", "index": 2447, "step-1": "<mask token>\n\n\ndef eval_ground_scores(gt_relations, pred_relations, tiou_threshold):\n \"\"\"\n\n :param gt_relations:\n :param pred_relations:\n :param tiou_threshold:\n :return:\n \"\"\"\n relation_num = l...
[ 2, 3, 4, 5, 6 ]
# Generated by Django 2.2.4 on 2019-08-19 19:14 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('application', '0003_auto_20190818_1623'), ] operations = [ migrations.AlterField( model_name='user', name='visited',...
normal
{ "blob_id": "913e1f5a0af436ef081ab567c44b4149299d0ec6", "index": 3154, "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 = [('application...
[ 0, 1, 2, 3, 4 ]
import os import sys from subprocess import check_output from charmhelpers.fetch import ( apt_install, apt_update, add_source, ) from charmhelpers.core.templating import render from charmhelpers.contrib.database.mysql import MySQLHelper def install_mysql(package='mysql-server', sources=None, keys=None)...
normal
{ "blob_id": "083a9555f8db586fbb065d59e4e333bb16ee3d2a", "index": 5521, "step-1": "<mask token>\n\n\ndef install_mysql(package='mysql-server', sources=None, keys=None):\n if not sources:\n sources = []\n if not keys:\n keys = []\n from subprocess import Popen, PIPE\n for source in source...
[ 9, 10, 11, 13, 14 ]
# Basic script which send some request via rest api to the test-management-tool. # Be sure you setup host and api_token variable import http.client host = "localhost:8000" api_token = "fuukp8LhdxxwoVdtJu5K8LQtpTods8ddLMq66wSUFXGsqJKpmJAa1YyqkHN3" # Connection conn = http.client.HTTPConnection(host) # Create a heade...
normal
{ "blob_id": "0cc1aaa182fcf002ff2ae6cbcd6cbb84a08a3bc1", "index": 936, "step-1": "<mask token>\n", "step-2": "<mask token>\nconn.request('POST', '/api/v1/testsuites', payload, headers)\n<mask token>\nconn.request('POST', '/api/v1/testsuites', payload, headers)\n<mask token>\nconn.request('POST', '/api/v1/testca...
[ 0, 1, 2, 3, 4 ]
from pyecharts import options as opts from pyecharts.charts import * import pandas as pd import namemap from pyecharts.globals import ThemeType # import time import json import requests from datetime import datetime import pandas as pd import numpy as np def read_country_code(): """ 获取...
normal
{ "blob_id": "fe3584dd858c06d66215b4a182adf87d35324975", "index": 4486, "step-1": "<mask token>\n\n\ndef read_country_code():\n \"\"\"\n 获取国家中英文字典\n :return:\n \"\"\"\n country_dict = {}\n for key, val in namemap.nameMap.items():\n country_dict[val] = key\n return country_dict\n\n\ndef...
[ 6, 7, 8, 9, 10 ]
rule run_all: shell: ''' echo 'Hello World!' '''
normal
{ "blob_id": "c967a63d03f9f836d97ae917dba2a7bfb7a54a0e", "index": 9673, "step-1": "rule run_all:\n shell:\n '''\n echo 'Hello World!'\n '''\n\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
import re import os import pandas as pd instruments_file = os.path.abspath("instruments.csv") input_names_file = os.path.abspath("names.txt") output_names_file = os.path.abspath("names.csv") inst_name_file = os.path.abspath("name_instrument.csv") reg_ex = '; |, |\\*|\n' name_header = ["first_name", "last_name"] def ...
normal
{ "blob_id": "8c539dbbb762717393b9a71ddca8eb3872890854", "index": 288, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef process_names():\n \"\"\"\n Opening, reading name file and building name array.\n \"\"\"\n with open(input_names_file, 'r') as data:\n plaintext = data.read()\n ...
[ 0, 1, 2, 3, 4 ]
import json import sys import time # boardName pageNum indexNewest # Baseball 5000 5183 # Elephants 3500 3558 # Monkeys 3500 3672 # Lions 3300 3381 # Guardians 3500 3542 boardNameList = ["Baseball", "Elephants", "Monkeys", "Lions", "Guardians"] def loadData(filename): _data = json.loads(open(filename).read()) return...
normal
{ "blob_id": "306240db8a1652fe7cd79808c40e4354c3158d3e", "index": 3434, "step-1": "<mask token>\n\n\ndef loadData(filename):\n _data = json.loads(open(filename).read())\n return _data\n\n\ndef buildUserDict(userDict, _data, boardName):\n for article in _data:\n _user = article['b_作者'].split(' ')[0...
[ 3, 4, 5, 6, 7 ]
from django.db import models #Precisa existir uma conversao ticker -> ticker_id mais facil, ou definir como trabalhar com o ticker.name, #na maioria dos casos só tenho o nome do ticker, nao o id. class User(models.Model): """ Usuario que pode operar ativos """ name = models.CharField(max_length=200) ...
normal
{ "blob_id": "13e7484a80e4e45ee911f15837b9d82a1ef4d0b1", "index": 7259, "step-1": "from django.db import models\r\n\r\n#Precisa existir uma conversao ticker -> ticker_id mais facil, ou definir como trabalhar com o ticker.name,\r\n#na maioria dos casos só tenho o nome do ticker, nao o id.\r\n\r\nclass User(models...
[ 0 ]
from django.db import models from django.template.defaultfilters import slugify # Create your models here. class SlugStampMixin(object): ''' An Worflow is an ordered collection of a Protocols ''' def save(self, *args, **kwargs): super(SlugStampMixin, self).save(*args, **kwargs) # Method may n...
normal
{ "blob_id": "c30f11e9bac54771df5198971c312624f68d0a33", "index": 4259, "step-1": "<mask token>\n\n\nclass SlugStampMixin(object):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass SlugStampMixin(object):\n <mask token>\n\n def save(self, *args, **kwargs):\n ...
[ 1, 3, 4, 5, 6 ]
#!/usr/bin/python3 def file_to_code(fname): mem = [] for line in open(fname,"r"): mem.extend([int(i) for i in line.split(",")]) return mem class Opcode(object): def __init__(self, mem, ptr, code, inc): """ >>> o = Opcode([1001, 2, 4, 1], 0, 1, 4) >>> o._Opcode__par_modes [0, 1] """ if mem[ptr]%100 !...
normal
{ "blob_id": "653e65281984ebb06467aeadb6f0e2b11f1bcb4d", "index": 496, "step-1": "<mask token>\n\n\nclass Opcode1(Opcode):\n <mask token>\n\n def __init__(self, mem, ptr):\n super().__init__(mem, ptr, 1, 4)\n self.__first = self.get_val(1)\n self.__second = self.get_val(2)\n self...
[ 43, 44, 55, 57, 62 ]
# Tip Calculator # Dan Soloha # 9/12/2019 total = int(input("What was the total your bill came to? ")) print(f"With a total of {total}, you should tip ${int(total + (total * 0.15))}. If the waiter did a really good job, you should tip ${int(total + (total * 0.20))}. ") # Multiplying by 1.x was returning the numb...
normal
{ "blob_id": "45d5c75a993ff50e1a88510bdb16e963403c5356", "index": 8588, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\n f'With a total of {total}, you should tip ${int(total + total * 0.15)}. If the waiter did a really good job, you should tip ${int(total + total * 0.2)}. '\n )\n", "step-3...
[ 0, 1, 2, 3 ]
# The actual code begins here # This file is intended to load everything downloaded from loaddata.py, preventing user getting banned from IMDB # The code is written to see what are some key words of the reviews from critics and normal viewers # And to see what are some of the differences # The second task is to asses t...
normal
{ "blob_id": "1f69cf5f6d15048e6ead37b5da836c9e2f783f74", "index": 803, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('loading data...')\nwith open('movienumbers.pickle', 'rb') as input_file:\n movienumbers = pickle.load(input_file)\nwith open('ratings.pickle', 'rb') as input_file:\n ratings =...
[ 0, 1, 2, 3, 4 ]
#!env/bin/python3 from app import app from config import config as cfg app.run(debug=True, host=cfg.APP_HOST, port=cfg.APP_PORT)
normal
{ "blob_id": "f97150f60dfb3924cda2c969141d5bfe675725ef", "index": 9150, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.run(debug=True, host=cfg.APP_HOST, port=cfg.APP_PORT)\n", "step-3": "from app import app\nfrom config import config as cfg\napp.run(debug=True, host=cfg.APP_HOST, port=cfg.APP_PORT)...
[ 0, 1, 2, 3 ]
def getmin(a, b, c): if a <= b and a <= c: print(a) elif b <= a and b <= c: print(b) else: print(c) def filtername(name): if len(name) > 3: return name[:3] elif len(name) < 3: return name + " " * (3 - len(name)) return name def filternames(names): ...
normal
{ "blob_id": "917241482dc1f234d5fae9c107a5f21b018fe6d4", "index": 9843, "step-1": "<mask token>\n\n\ndef filtername(name):\n if len(name) > 3:\n return name[:3]\n elif len(name) < 3:\n return name + ' ' * (3 - len(name))\n return name\n\n\ndef filternames(names):\n re = []\n for n in ...
[ 2, 3, 4, 5, 6 ]
from util import AutomataError from automata import NFA from base import Node from copy import copy, deepcopy from os.path import commonprefix DEBUG = False LAMBDA = u'\u03bb' PHI = u'\u00d8' def copyDeltas(src): out = dict() for k in src: out[k] = dict() for k2 in src[k]: out[k]...
normal
{ "blob_id": "2fe20f28fc7bba6b8188f5068e2b3c8b87c15edc", "index": 94, "step-1": "<mask token>\n\n\ndef replaceNode(nfa, old, new):\n if DEBUG:\n print('R_Start(%s, %s) ---' % (old, new), nfa)\n if old in nfa._deltas:\n for input in nfa._deltas[old]:\n nfa.addDelta(new, input, nfa._d...
[ 8, 9, 11, 13, 14 ]
from conans import * class GlibConan(ConanFile): name = "glib" description = "Common C routines used by Gtk+ and other libs" license = "LGPL" settings = {"os": ["Linux"], "arch": ["x86_64", "armv8"]} build_requires = ( "generators/1.0.0", "autotools/1.0.0", ) requires = ( ...
normal
{ "blob_id": "e49c5c6475a1210a9657d7bbd0490c8d20863718", "index": 2285, "step-1": "<mask token>\n\n\nclass GlibConan(ConanFile):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def build(self):\n args = ['--disable-static'...
[ 2, 3, 4, 5, 6 ]
__author__ = 'Or'
normal
{ "blob_id": "54c1b294d826deb43978591cad590c5e969bebd7", "index": 6655, "step-1": "<mask token>\n", "step-2": "__author__ = 'Or'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
""" Card rarity parameters """ from typing import List, Optional from django.db.models.query import Q from cards.models.rarity import Rarity from cardsearch.parameters.base_parameters import ( OPERATOR_MAPPING, OPERATOR_TO_WORDY_MAPPING, CardTextParameter, CardSearchContext, ParameterArgs, Que...
normal
{ "blob_id": "c7d9bbdff9148c5d928de66f4406ee8b4e1bcdac", "index": 2672, "step-1": "<mask token>\n\n\nclass CardRarityParam(CardTextParameter):\n <mask token>\n\n @classmethod\n def get_parameter_name(cls) ->str:\n return 'rarity'\n <mask token>\n <mask token>\n <mask token>\n <mask tok...
[ 4, 5, 6, 8, 12 ]
import datetime class Dato: def __init__(self, id: int, dato: str, tipo: str, fecha: datetime.datetime): self.__id = id self.__dato = dato self.__tipo = tipo self.__fecha = fecha def getId(self): return self.__id def setId(self, id): self.__id = id def...
normal
{ "blob_id": "95256390e1e7e9227b96dccce33082de9d2cddd3", "index": 5158, "step-1": "<mask token>\n\n\nclass Dato:\n <mask token>\n <mask token>\n\n def setId(self, id):\n self.__id = id\n <mask token>\n\n def setDato(self, dato):\n self.__dato = dato\n <mask token>\n\n def setTip...
[ 6, 7, 9, 10, 12 ]
import requests def squeezed (client_name): return client_name.replace('Индивидуальный предприниматель', 'ИП') def get_kkm_filled_fn(max_fill=80): ## возвращает список ККМ с заполнением ФН больше max_fill в % LOGIN_URL = 'https://pk.platformaofd.ru/auth/login' API_URL = 'https://pk.platformaofd.ru/api/mon...
normal
{ "blob_id": "cd2e03666a890d6e9ea0fcb45fe28510d684916d", "index": 83, "step-1": "<mask token>\n\n\ndef squeezed(client_name):\n return client_name.replace('Индивидуальный предприниматель', 'ИП')\n\n\ndef get_kkm_filled_fn(max_fill=80):\n LOGIN_URL = 'https://pk.platformaofd.ru/auth/login'\n API_URL = 'ht...
[ 2, 3, 4, 5, 6 ]
# pylint: skip-file from sorter.lib.request_data import read_url from urllib2 import HTTPError class fake_urllib(object): def __init__(self, should_fail=False): self.should_fail = should_fail def urlopen(self, uri): if self.should_fail == True: raise HTTPError('FAKER.GTLD', 404, 'F...
normal
{ "blob_id": "2bbfbc597a4e1f8b46f58a4c6002a9943eff557a", "index": 5644, "step-1": "<mask token>\n\n\nclass fake_logger(object):\n\n def __init__(self):\n self.msg = None\n\n def info(self, msg, *args):\n pass\n\n def warn(self, msg, *args):\n self.msg = msg.reason\n\n\nclass TestRequ...
[ 7, 9, 10, 12, 14 ]
def patternCount(dnaText, pattern): count = 0 for i in range(0, len(dnaText) - len(pattern)): word = dnaText[i:i+len(pattern)] if (word == pattern): count = count + 1 return count def freqWordProblem(text, k): countWords = [] for i in range(0, len(text) - k): pa...
normal
{ "blob_id": "29c1a989365408bf5c3d6196f7afc969be63df85", "index": 5942, "step-1": "<mask token>\n\n\ndef complimentDNA(text):\n result = ''\n for letter in text:\n result = result + mapDNA[letter]\n return result[::-1]\n\n\ndef patternFind(text, pattern):\n index = []\n for i in range(0, len...
[ 2, 4, 5, 6, 7 ]
#encoding:utf-8 x="There are %d types of peopel."%10 #定义字符串变量x,将10以%d方式输出 binary="binary" do_not="don't" #定义字符串变量binary和do_not y="Those who know %s and those who %s."%(binary,do_not) #使用binary和do_not定义字符串变量y print x print y #打印以上两个变量 print "I said:%r"%x print "I also said:%r."%y #用%r的格式输出以上两个变量 hilarious=False joke_...
normal
{ "blob_id": "c2ba60a321eff63f6321831093d7254f6939549b", "index": 9040, "step-1": "#encoding:utf-8\nx=\"There are %d types of peopel.\"%10\n#定义字符串变量x,将10以%d方式输出\nbinary=\"binary\"\ndo_not=\"don't\"\n#定义字符串变量binary和do_not\ny=\"Those who know %s and those who %s.\"%(binary,do_not)\n#使用binary和do_not定义字符串变量y\n\nprint...
[ 0 ]
def interseccao_chaves(lis_dic): lista = [] for dic1 in lis_dic[0]: for cahves in dic1: lista.append(dic1) for dic2 in lis_dic[1]: for cahves in dic2: lista.append(dic2) return lista
normal
{ "blob_id": "f3ff453655d7938cb417ce212f3836fabafaea43", "index": 1696, "step-1": "<mask token>\n", "step-2": "def interseccao_chaves(lis_dic):\n lista = []\n for dic1 in lis_dic[0]:\n for cahves in dic1:\n lista.append(dic1)\n for dic2 in lis_dic[1]:\n for cahves in dic2:\n ...
[ 0, 1 ]
from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import path, include from home import views from order import views as OV urlpatterns = [ path('user', include('user.urls')), path('order', include('order.urls')), path('shopcart/',...
normal
{ "blob_id": "97cc29e0d54e5d5e05dff16c92ecc4046363185f", "index": 344, "step-1": "<mask token>\n", "step-2": "<mask token>\nif settings.DEBUG:\n urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT\n )\n", "step-3": "<mask token>\nurlpatterns = [path('user', include('user.urls...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python3 import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # or any {'0', '1', '2' os.environ['KERAS_BACKEND'] = 'tensorflow' import numpy as np import sys from util import load_model from keras.preprocessing.text import hashing_trick from keras.preprocessing.sequence import pad_sequences from southpar...
normal
{ "blob_id": "ed7b29a4d7f3a48884434373418c3528f2f397ac", "index": 271, "step-1": "<mask token>\n\n\ndef main():\n print('Loading model...')\n model, charset = load_model(MODEL_NAME)\n print(charset)\n seed_text = input('Enter a String: ').strip()\n print()\n generate_script(seed_text, model, cha...
[ 4, 5, 6, 7, 8 ]
import os import random import pygame # Class for all the game's obstacles class Obstacle(pygame.sprite.Sprite): # Class constructor def __init__(self, game_params, game_speed): self.obs_type = random.randrange(0, 3) # Becomes a pterodactyl obstacle if (self.obs_type == 0): ...
normal
{ "blob_id": "09dac7bfe98a15b3e79edcb0d0a53c0ab4d771ca", "index": 7053, "step-1": "<mask token>\n\n\nclass Obstacle(pygame.sprite.Sprite):\n\n def __init__(self, game_params, game_speed):\n self.obs_type = random.randrange(0, 3)\n if self.obs_type == 0:\n self.create_pterodactyl(game_p...
[ 7, 8, 9, 10, 11 ]
from typing import List from fastapi import Depends, APIRouter from sqlalchemy.orm import Session from attendance.database import get_db from attendance import schemas from attendance.models import User from attendance import crud from attendance.dependency import get_current_user router = APIRouter() #BASE_SALARY #...
normal
{ "blob_id": "f10e20d5c409930d697c36d1897ebcb648511e27", "index": 3694, "step-1": "<mask token>\n\n\n@router.get('/salary/{user_id}', status_code=200)\ndef read_base_salary(user_id: int, db: Session=Depends(get_db),\n current_user: User=Depends(get_current_user)):\n return crud.get_base_salarys(db, user_id=...
[ 1, 2, 3, 4, 5 ]
import pandas as pd triples = pd.read_csv("SollTripel.csv", sep=",", skip_blank_lines=True, skipinitialspace=True) triples.columns = ["triple", "found"] triples = triples["#" not in triples.triple] print(triples)
normal
{ "blob_id": "97afa67cbe20900e2388994481abebe772e22818", "index": 5301, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(triples)\n", "step-3": "<mask token>\ntriples = pd.read_csv('SollTripel.csv', sep=',', skip_blank_lines=True,\n skipinitialspace=True)\ntriples.columns = ['triple', 'found']\nt...
[ 0, 1, 2, 3, 4 ]
from bs4 import BeautifulSoup from cybersource.constants import CHECKOUT_BASKET_ID, CHECKOUT_ORDER_NUM, CHECKOUT_SHIPPING_CODE, CHECKOUT_ORDER_ID from cybersource.tests import factories as cs_factories from decimal import Decimal as D from django.core import mail from django.core.urlresolvers import reverse from mock i...
normal
{ "blob_id": "9155b3eed8ac79b94a033801dbf142392b50720b", "index": 5123, "step-1": "<mask token>\n\n\nclass CheckoutIntegrationTest(BaseCheckoutTest):\n <mask token>\n\n def test_checkout_process(self):\n \"\"\"Full checkout process using minimal api calls\"\"\"\n product = self.create_product(...
[ 19, 25, 29, 32, 33 ]
# -*- coding: utf-8 -*- from copy import copy from openprocurement.api.utils import ( json_view, context_unpack, APIResource, get_now, ) from openprocurement.tender.core.utils import save_tender, apply_patch from openprocurement.tender.core.validation import ( validate_requirement_data, validat...
normal
{ "blob_id": "6194079dd506553b4e5b66f1fb92bb8642704b59", "index": 6893, "step-1": "<mask token>\n\n\nclass BaseTenderCriteriaRGRequirementResource(APIResource):\n <mask token>\n\n @json_view(permission='view_tender')\n def collection_get(self):\n return {'data': [i.serialize('view') for i in self....
[ 4, 5, 6, 7, 8 ]
#!/usr/bin/python3 """ This module contains a Fabric function definition. """ from datetime import datetime, time from fabric.api import * from pathlib import Path def do_pack(): timestamp = datetime.utcnow().strftime("%Y%m%d%H%M%S") archive = "web_static_" + timestamp + ".tgz" local("mkdir -p version...
normal
{ "blob_id": "6f3de70267956a6c7c3c5b261cf591051de4c548", "index": 1968, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef do_pack():\n timestamp = datetime.utcnow().strftime('%Y%m%d%H%M%S')\n archive = 'web_static_' + timestamp + '.tgz'\n local('mkdir -p versions')\n local('tar -cvzf vers...
[ 0, 1, 2, 3 ]
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str ...
normal
{ "blob_id": "006e1088e72201fab7eebd1409c025b5dba69403", "index": 5938, "step-1": "<mask token>\n", "step-2": "class Codec:\n <mask token>\n <mask token>\n", "step-3": "class Codec:\n <mask token>\n\n def deserialize(self, data):\n \"\"\"Decodes your encoded data to tree.\n \n ...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020-2021 by Murray Altheim. All rights reserved. This file is part # of the Robot Operating System project, released under the MIT License. Please # see the LICENSE file included as part of this package. # # author: Murray Altheim # created: 2020-04-15 # ...
normal
{ "blob_id": "3a6038cb80548b98fc7e4a328092f1dc1ffd6dfd", "index": 1154, "step-1": "<mask token>\n\n\nclass ConfigLoader:\n <mask token>\n\n def __init__(self, level):\n self._log = Logger('configloader', level)\n self._log.info('ready.')\n\n def configure(self, filename='config.yaml'):\n ...
[ 3, 4, 5, 6, 7 ]
""" Constant types in Python. 定数上書きチェック用 """ import os from common import const from datetime import timedelta from linebot.models import ( TemplateSendMessage, CarouselTemplate, CarouselColumn, MessageAction, QuickReplyButton, CameraAction, CameraRollAction, LocationAction ) const.API_PROFILE_URL = 'https://...
normal
{ "blob_id": "25fcf162306b3d6d6307e703a7d829754cba2778", "index": 2347, "step-1": "<mask token>\n", "step-2": "<mask token>\nconst.API_PROFILE_URL = 'https://api.line.me/v2/profile'\nconst.API_NOTIFICATIONTOKEN_URL = (\n 'https://api.line.me/message/v3/notifier/token')\nconst.API_ACCESSTOKEN_URL = 'https://a...
[ 0, 1, 2, 3 ]
# Generated by Django 3.0.7 on 2020-06-15 15:26 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('products', '0003_auto_20200615_1225'), ] operations = [ migrations.AlterField( model_name='product', name='harmoniza...
normal
{ "blob_id": "c382b298cce8d7045d6ce8a84f90b3800dba7717", "index": 297, "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 = [('products', '...
[ 0, 1, 2, 3, 4 ]
from binaryninja import * import yara def get_yara_rule_path(): return get_open_filename_input("Open YARA rule", "YARA rules (*.yar *.yara)") def get_markdown_result(matches): entry_fmt = "| {} | {} | {} |\n" md_text = """# YARA - Scan results | Rule Name | Function | Strings offsets | |-----------|----------|---...
normal
{ "blob_id": "56d4532b633242f34f7a6ed86a35290836861f67", "index": 4201, "step-1": "<mask token>\n\n\ndef get_markdown_result(matches):\n entry_fmt = '| {} | {} | {} |\\n'\n md_text = \"\"\"# YARA - Scan results\n\n| Rule Name | Function | Strings offsets |\n|-----------|----------|-----------------|\n\"\"\"...
[ 3, 4, 5, 6, 7 ]
import os from pathlib import Path DEFAULT_ROOT_PATH = Path(os.path.expanduser(os.getenv("PLOTTER_ROOT", "~/.plotter/mainnet"))).resolve()
normal
{ "blob_id": "3a8164299fa51b7d781f2b80d77cfba05b5f6915", "index": 4157, "step-1": "<mask token>\n", "step-2": "<mask token>\nDEFAULT_ROOT_PATH = Path(os.path.expanduser(os.getenv('PLOTTER_ROOT',\n '~/.plotter/mainnet'))).resolve()\n", "step-3": "import os\nfrom pathlib import Path\nDEFAULT_ROOT_PATH = Path...
[ 0, 1, 2, 3 ]
list1 = [('北京大洋路', '红蛋', '散框批发', '120-125', '44', '落', '8车'), ('北京回龙观', '红蛋', '散框批发', '124', '44', '落', ''), ('北京石门', '红蛋', '散框批发', '124', '44', '落', '')] mysql_data = [] import numpy as np for l in list1: array = np.array(l) tolist = array.tolist() tolist.insert(0, 'ppp') tolist.append('lll') ...
normal
{ "blob_id": "896d836ede533bad24f4077e5ba964105d96bf7a", "index": 9485, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor l in list1:\n array = np.array(l)\n tolist = array.tolist()\n tolist.insert(0, 'ppp')\n tolist.append('lll')\n mysql_data.append(tolist)\nprint(mysql_data)\n<mask token...
[ 0, 1, 2, 3 ]
source = open("input.txt", "r") total = 0 def calculateWeight( weight ): fuel = calculateFuel(weight) if fuel > 0: sum = fuel + calculateWeight(fuel) return sum else: return max(0, fuel) def calculateFuel ( weight ): return weight // 3 -2 for line in source.readlines(): t...
normal
{ "blob_id": "bea1a5bc9c92d095a2f187a4c06d18d0a939f233", "index": 3376, "step-1": "<mask token>\n\n\ndef calculateFuel(weight):\n return weight // 3 - 2\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef calculateWeight(weight):\n fuel = calculateFuel(weight)\n if fuel > 0:\n sum = fuel + ca...
[ 1, 2, 3, 4, 5 ]
import os import sqlite3 import operator from collections import OrderedDict import matplotlib.pyplot as plt def parse(url): try: parsed_url_components = url.split('//') sublevel_split = parsed_url_components[1].split('/', 1) domain = sublevel_split[0].replace("www.", "") return domain except IndexError: p...
normal
{ "blob_id": "c74fc99bf8582fd83c312f27dfffbe894a2c8c1b", "index": 3431, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef parse(url):\n try:\n parsed_url_components = url.split('//')\n sublevel_split = parsed_url_components[1].split('/', 1)\n domain = sublevel_split[0].replace...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python3 # -*- coding: utf-8 -*- import random a = random.sample(range(100), 10) print("All items: {}".format(a)) it = iter(a) # call a.__iter__() print("Num01: {}".format(next(it))) # call it.__next__() print("Num02: {}".format(next(it))) print("Num03: {}".format(it.__next__())) it = iter(a) i = 1 while...
normal
{ "blob_id": "f5513bea4ca5f4c2ac80c4bf537a264a4052d1e9", "index": 8866, "step-1": "<mask token>\n\n\nclass Node2:\n\n def __init__(self, value):\n self._value = value\n self._children = []\n self._idx = 0\n\n def __repr__(self):\n return 'Node2({!r})'.format(self._value)\n <ma...
[ 12, 13, 15, 16, 24 ]
from PyInstaller.utils.hooks import collect_data_files hiddenimports = ['sklearn.utils.sparsetools._graph_validation', 'sklearn.utils.sparsetools._graph_tools', 'sklearn.utils.lgamma', 'sklearn.utils.weight_vector'] datas = collect_data_files('sklearn')
normal
{ "blob_id": "12396130dc52866cc54d6dc701cf0f9a41a168b6", "index": 8351, "step-1": "<mask token>\n", "step-2": "<mask token>\nhiddenimports = ['sklearn.utils.sparsetools._graph_validation',\n 'sklearn.utils.sparsetools._graph_tools', 'sklearn.utils.lgamma',\n 'sklearn.utils.weight_vector']\ndatas = collect...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import versatileimagefield.fields class Migration(migrations.Migration): dependencies = [ ('venue', '0001_initial'), ] operations = [ migrations.CreateModel( name='Images...
normal
{ "blob_id": "09bf7460b2c928bf6e1346d9d1e2e1276540c080", "index": 3099, "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 = [('venue', '00...
[ 0, 1, 2, 3, 4 ]
from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer from nltk.stem import SnowballStemmer import pandas as pd from sklearn.feature_selection import SelectKBest from sklearn.feature_selection import chi2 from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_extraction.tex...
normal
{ "blob_id": "658532e1b81b025b8295bbf468dc01ecf12b922a", "index": 6463, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef process_review(review):\n review = re.sub('[^a-zA-Z]', ' ', review)\n review = review.lower()\n texts = [wnl.lemmatize(word) for word in review.lower().split() if word\n ...
[ 0, 2, 3, 4, 5 ]
""" You are given pre-order traversal with a slight modification. It includes null pointers when a particular node has nil left/right child. Reconstruct the binary tree with this information. Ex. [H, B, F, None, None, E, A, None, None, None, C, None, D, None, G, I, None, None, None] H / \ B C / \ ...
normal
{ "blob_id": "3aee336956ac6f962c34f51a27dc4abebf2cc7c8", "index": 8474, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef contruct_tree(pre_order, index=0):\n index += 1\n if index >= len(pre_order):\n raise IndexError('wtf is wrong with you?')\n root = pre_order[index]\n if root i...
[ 0, 1, 2, 3 ]
# Your code here d = dict() count = 0 fave_fast_food = input("Fave fast food restaurant: ") for i in range(1, 11): if fave_fast_food in d: d[fave_fast_food] += 1 else: d[fave_fast_food] = 1 count+= 1 fave_fast_food = input("Fave fast food restaurant: ") for k,v in d.items(): print('Fast Food R...
normal
{ "blob_id": "a494b3469682a909b76e67e1b78ad25affe99f24", "index": 8688, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, 11):\n if fave_fast_food in d:\n d[fave_fast_food] += 1\n else:\n d[fave_fast_food] = 1\n count += 1\n fave_fast_food = input('Fave fast food r...
[ 0, 1, 2, 3 ]
from zipfile import ZipFile import reference_new_stdds import reader import os def runall(path): print("==========================") """get the current path """ abs_file_path = os.path.abspath(__file__) parent_dir = os.path.dirname(abs_file_path) parent_dir = os.path.dirname(parent_dir) """ ...
normal
{ "blob_id": "1158ab95ac67d62459284267a8cc9f587daf89b1", "index": 9329, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef runall(path):\n print('==========================')\n \"\"\"get the current path \"\"\"\n abs_file_path = os.path.abspath(__file__)\n parent_dir = os.path.dirname(abs_...
[ 0, 1, 2, 3, 4 ]
from django.urls import path from . import views # url configuration for view.index function app_name = 'movies' urlpatterns = [ path('', views.index, name='index'), # represents a root of this app path('<int:movie_id>', views.detail, name='detail') ]
normal
{ "blob_id": "5aaac757b766b0143ca3ea54d8fc4b8936160ec7", "index": 5090, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'movies'\nurlpatterns = [path('', views.index, name='index'), path('<int:movie_id>',\n views.detail, name='detail')]\n", "step-3": "from django.urls import path\nfrom . im...
[ 0, 1, 2, 3 ]
from http import HTTPStatus from ninja import Router mock_post_router = Router() @mock_post_router.get( "/mock_posts", url_name="mock_post_list", summary="전체 mock post의 list를 반환한다", response={200: None}, ) def retrieve_all_mock_posts(request): return HTTPStatus.OK
normal
{ "blob_id": "dcb57ecf2c72b8ac816bb06986d80544ff97c669", "index": 5915, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@mock_post_router.get('/mock_posts', url_name='mock_post_list', summary=\n '전체 mock post의 list를 반환한다', response={(200): None})\ndef retrieve_all_mock_posts(request):\n return HT...
[ 0, 1, 2, 3, 4 ]
n=int(input("val : ")) def fact(n): c=1; for i in range(1,n+1): c*=i; return c; print(fact(n));
normal
{ "blob_id": "1f4d9f5406b91fd687c0ace8ed29e3c4dfb4d3d2", "index": 8748, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fact(n):\n c = 1\n for i in range(1, n + 1):\n c *= i\n return c\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef fact(n):\n c = 1\n for i in range(1...
[ 0, 1, 2, 3, 4 ]
# Print name and marks f = open("marks.txt", "rt") for line in f: line = line.strip() if len(line) == 0: # Blank line continue name, *marks = line.split(",") if len(marks) == 0: continue marks = filter(str.isdigit, marks) # Take only numbers total = sum(map(int, marks)) ...
normal
{ "blob_id": "00587de133ee68415f31649f147fbff7e9bf65d5", "index": 3337, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in f:\n line = line.strip()\n if len(line) == 0:\n continue\n name, *marks = line.split(',')\n if len(marks) == 0:\n continue\n marks = filter(str.is...
[ 0, 1, 2, 3 ]
import packaging.requirements import pydantic import pytest from prefect.software.pip import PipRequirement, current_environment_requirements class TestPipRequirement: def is_packaging_subclass(self): r = PipRequirement("prefect") assert isinstance(r, packaging.requirements.Requirement) def ...
normal
{ "blob_id": "64366e8532ffe05db7e7b7313e1d573c78a4e030", "index": 796, "step-1": "<mask token>\n\n\nclass TestPipRequirement:\n\n def is_packaging_subclass(self):\n r = PipRequirement('prefect')\n assert isinstance(r, packaging.requirements.Requirement)\n\n def test_can_be_used_in_pydantic_mod...
[ 6, 7, 8, 10, 11 ]
#!/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 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Calcu.py # import os, sys def menuCalc(): os.system('clear') print("Esto parece un menu:") print("\t1 - Suma") print("\t2 - Resta") print("\t3 - Multiplicacion") print("\t4 - Division") print("\tq - Para salir") def calculadora(cal...
normal
{ "blob_id": "ac033e45ea61770c302be677f4dfc95945e2cca5", "index": 6100, "step-1": "<mask token>\n\n\ndef calculadora(calcu):\n if calcu == '1':\n os.system('clear')\n s1 = int(input('Ingrese un numero\\n'))\n s2 = int(input('Ingrese otro\\n'))\n os.system('clear')\n print(f'{...
[ 1, 2, 3, 4, 5 ]
import matplotlib.pyplot as plt import pandas as pd from collections import Counter import numpy as np import imdb import csv import networkx as nx from networkx import * def split_data(data): df = pd.read_csv(data) ranks = df.groupby('userId')['timestamp'].rank(method='first') counts = df['userId'].map(df....
normal
{ "blob_id": "e3b39c6655fc14efec3b3f95b08bc7b2c036cbdc", "index": 4117, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef split_data(data):\n df = pd.read_csv(data)\n ranks = df.groupby('userId')['timestamp'].rank(method='first')\n counts = df['userId'].map(df.groupby('userId')['timestamp']....
[ 0, 1, 2, 3, 4 ]
""" Main CLI endpoint for GeoCube """ import importlib.metadata import click from click import group import geocube.cli.commands as cmd_modules from geocube import show_versions CONTEXT_SETTINGS = { "help_option_names": ["-h", "--help"], "token_normalize_func": lambda x: x.replace("-", "_"), } def check_ve...
normal
{ "blob_id": "0964121d88fad2906311de7532eac52ff784fff6", "index": 8306, "step-1": "<mask token>\n\n\ndef check_version(ctx, _, value):\n \"\"\"\n Print current version, and check for latest version.\n\n Called via 'geocube --version'\n\n :param ctx: Application context object (click.Context)\n :par...
[ 4, 5, 6, 7, 8 ]
nome = str(input('Digite um nome completo: ')).lower() silva = 'silva' in nome if silva == True: print('Existe Silva nesse nome') else: print('Não há Silva nesse nome')
normal
{ "blob_id": "faebefcadbc184fab29deb2988089223a8f09e7e", "index": 8219, "step-1": "<mask token>\n", "step-2": "<mask token>\nif silva == True:\n print('Existe Silva nesse nome')\nelse:\n print('Não há Silva nesse nome')\n", "step-3": "nome = str(input('Digite um nome completo: ')).lower()\nsilva = 'silv...
[ 0, 1, 2 ]
#!/usr/bin/env python3 from collections import deque from itertools import permutations INS_ADD = 1 INS_MULTIPLY = 2 INS_INPUT = 3 INS_OUTPUT = 4 INS_JUMP_IF_TRUE = 5 INS_JUMP_IF_FALSE = 6 INS_LESS_THAN = 7 INS_EQUALS = 8 INS_ADJUST_RELATIVE_BASE = 9 INS_DONE = 99 ...
normal
{ "blob_id": "121fddf022c4eed7fd00e81edcb2df6a7a3b7510", "index": 4903, "step-1": "<mask token>\n\n\nclass Computer:\n\n def __init__(self, data, inputs, memory_size=8192, interactive=True):\n self._memory = [0] * memory_size\n for i in range(len(data)):\n self._memory[i] = data[i]\n ...
[ 17, 19, 21, 22, 25 ]
import re from pathlib import Path RAW_DUMP_XML = Path("raw_data/Wikipedia.xml") def count_regexp(): """Counts the occurences of the regular expressions you will write. """ # Here's an example regular expression that roughly matches a valid email address. # The ones you write below should b...
normal
{ "blob_id": "8a4269f2094fa8ab8f6a93e653183dafb141232e", "index": 5717, "step-1": "<mask token>\n\n\ndef count_regexp():\n \"\"\"Counts the occurences of the regular expressions you will write.\n \"\"\"\n email = re.compile('[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+\\\\.[a-zA-Z]{2,5}')\n subheading = re.compile('...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python3 from ev3dev2.sensor import INPUT_1, INPUT_2, INPUT_3, INPUT_4 from ev3dev2.sensor.lego import ColorSensor, UltrasonicSensor from ev3dev2.power import PowerSupply # initiate color sensors # the colour sensor needs to be between 1-2 cm away from the surface you are trying to measure. (color mode) ...
normal
{ "blob_id": "84a13e3dea885d6c4a5f195dfac51c7110102fc2", "index": 6729, "step-1": "<mask token>\n\n\ndef getColorString(color_reading):\n if color_reading == 1:\n return 'black'\n elif color_reading == 2:\n return 'white'\n elif color_reading == 3:\n return 'green'\n elif color_re...
[ 1, 2, 3, 4, 5 ]
import cv2 import os """ 视频场景拼接 """ stich_path="stichImage\\" def read_video(filename): ''' 将视频每秒的内容提取出来 :param filename: 视频文件路径 :return: 视频文件名,用来拼接 ''' cap=cv2.VideoCapture(filename) rate = cap.get(cv2.CAP_PROP_FPS) count=0 success, frame = cap.read() imageCount=0 while suc...
normal
{ "blob_id": "a8506420b1bc558fa953f0cec3f8c16beaf44909", "index": 9886, "step-1": "<mask token>\n\n\ndef read_video(filename):\n \"\"\"\n 将视频每秒的内容提取出来\n :param filename: 视频文件路径\n :return: 视频文件名,用来拼接\n \"\"\"\n cap = cv2.VideoCapture(filename)\n rate = cap.get(cv2.CAP_PROP_FPS)\n count = 0\...
[ 2, 3, 4, 5, 6 ]
v0 = 5 g = 9.81 t = 0.6 y = v0 * t - 0.5 * g * t ** 2 print(y)
normal
{ "blob_id": "378032a8d02bc49e5ed8ebccbeddfbb281c2cbd7", "index": 6231, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(y)\n", "step-3": "v0 = 5\ng = 9.81\nt = 0.6\ny = v0 * t - 0.5 * g * t ** 2\nprint(y)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import os import shutil from tqdm import tqdm from pathlib import Path from eval_mead import PERCENT DATAPATH = '../../../data/test' # MEAD_DIR = 'mead' MEAD_DIR = os.path.abspath('mead') MEAD_DATA_PATH = f'{MEAD_DIR}/data' MEAD_BIN = f'{MEAD_DIR}/bin' MEAD_LIB = f'{MEAD_DIR}/lib' MEAD_FORMATTING_ADDONS = f'{MEAD_BIN}...
normal
{ "blob_id": "887ae9b7c629be679bf4f5fb4311c31bff605c73", "index": 8874, "step-1": "<mask token>\n", "step-2": "<mask token>\nif os.path.exists(DATA_DIR):\n override = input('Data exist, override (delete and re-parse)? (Y/n): ')\n if override.lower() == 'y':\n shutil.rmtree(DATA_DIR)\n else:\n ...
[ 0, 1, 2, 3, 4 ]
with open("out.txt", "w", encoding = "utf_8") as file: file.write("明日の天気です∖n") file.write("関西地方はおおむね晴れ.") file.write("紅葉を見るには絶好の日和でしょう∖n") file.write(“映像は嵐山の様子です.") file.write("今年も大変な数の観光客が訪れているようですね.∖n")
normal
{ "blob_id": "4fea9941defd6703be3cae034d979933262074e3", "index": 3728, "step-1": "with open(\"out.txt\", \"w\", encoding = \"utf_8\") as file:\n file.write(\"明日の天気です∖n\")\n file.write(\"関西地方はおおむね晴れ.\")\n file.write(\"紅葉を見るには絶好の日和でしょう∖n\")\n file.write(“映像は嵐山の様子です.\")\n file.write(\"今年も大変な数の観光客が訪れて...
[ 0 ]
#!/usr/bin/env python3 import json import sys import time import zmq log_file = "./mavlink-log.txt" zmq_context = zmq.Context() connect_to = sys.argv[1] send_socket = zmq_context.socket(zmq.PUSH) send_socket.connect(connect_to) def get_first_timestamp(log_file): with open(log_file) as f: for line in f: line_...
normal
{ "blob_id": "49679782ac696b3dc4f5038565f88304a44098e1", "index": 6188, "step-1": "<mask token>\n\n\ndef get_first_timestamp(log_file):\n with open(log_file) as f:\n for line in f:\n line_json = json.loads(line)\n return line_json['timestamp']\n\n\n<mask token>\n", "step-2": "<ma...
[ 1, 2, 3, 4, 5 ]
# Duy B. Lam # 61502602 # Project 3 # A module that reads the input and constructs the objects # that will generate the program's output. This is the only # module that should have an if __name__ == '__main__' block # to make it executable; you would execute this module to run your program. import Module1 ...
normal
{ "blob_id": "da19bc4fc999bd48a3d55b8cb5f47ba6208bc02b", "index": 4502, "step-1": "<mask token>\n\n\ndef outputQ() ->int:\n try:\n outputQ = int(input())\n return outputQ\n finally:\n print('output quantity:' + str(outputQ))\n\n\n<mask token>\n\n\ndef quantityToOutput(outputQ: int) ->li...
[ 2, 4, 5, 6, 7 ]
from discord.ext import commands import discord import os import random bot = commands.Bot(command_prefix="!") @bot.event async def on_ready(): print(f"Logged in as {bot.user.name}") @bot.command() async def ping(ctx): await ctx.send("pong") # Lucky command, it picks a number between 0-50 and spams your dm'...
normal
{ "blob_id": "b48bc9475a8dc593ba858af8ed4e930ae290fd69", "index": 6479, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@bot.event\nasync def on_ready():\n print(f'Logged in as {bot.user.name}')\n\n\n@bot.command()\nasync def ping(ctx):\n await ctx.send('pong')\n\n\n@bot.command()\nasync def luck...
[ 0, 1, 2, 3, 4 ]
# Question : determine whether given number is power of 2 # logic : every no. of the form 2^i has bit represetntaion of the form : # 2 -> 10 1->01 # 4 -> 100 3->011 # 8 -> 1000 7->0111 # 16 -> 10000 15->01111 # 32 -> 100000 31->011111 # ... and so on # Thus there is a pattern here, ever p...
normal
{ "blob_id": "676aec735dd7441b0c481956ad18b012b8d98ea4", "index": 8459, "step-1": "<mask token>\n", "step-2": "def is_power(n):\n if n == 0:\n return 'not power of two'\n if n & n - 1 == 0:\n return 'power of 2'\n return 'not power of 2'\n\n\n<mask token>\n", "step-3": "def is_power(n):...
[ 0, 1, 2, 3 ]
import numpy as np from feature.features import Features class RealWorldFeatures(Features): def __init__(self): super().__init__('tsagkias/real_world_features') def _extract_features(self, df): # weather from http://www.dwd.de/DE/leistungen/klimadatendeutschland/klimadatendeutschland.html features = ...
normal
{ "blob_id": "f6b2e66379b483c6a573d34d73ae0d10de7315a3", "index": 6815, "step-1": "<mask token>\n\n\nclass RealWorldFeatures(Features):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass RealWorldFeatures(Features):\n\n def __init__(self):\n super().__init__('tsagkias/real_worl...
[ 1, 2, 3, 4, 5 ]
# create item based on name using post method, get specific item or list of items using get method, update item using put and delete item using del method. import os from flask import Flask from flask_restful import Api from flask_jwt import JWT, timedelta from security import authenticate, identity from resources.us...
normal
{ "blob_id": "7525691ece4fe66bb175e470db3ac78f701e3730", "index": 199, "step-1": "<mask token>\n", "step-2": "<mask token>\napi.add_resource(Store, '/store/<string:name>')\napi.add_resource(Item, '/item/<string:name>')\napi.add_resource(ItemList, '/items')\napi.add_resource(StoreList, '/stores')\napi.add_resour...
[ 0, 1, 2, 3, 4 ]
"""A tiny example binary for the native Python rules of Bazel.""" import unittest from bazel_tutorial.examples.py.lib import GetNumber from bazel_tutorial.examples.py.fibonacci.fib import Fib class TestGetNumber(unittest.TestCase): def test_ok(self): self.assertEqual(GetNumber(), 42) def test_fib(self): ...
normal
{ "blob_id": "d126efa91b964a3a374d546bb860b39ae26dfa22", "index": 256, "step-1": "<mask token>\n\n\nclass TestGetNumber(unittest.TestCase):\n <mask token>\n\n def test_fib(self):\n self.assertEqual(Fib(5), 8)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass TestGetNumber(unittest.TestCase):...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- """ Created on Sun Dec 20 14:48:56 2020 @author: dhk1349 """ n = int(input()) #목표채널 m = int(input()) broken=[int(i) for i in input().split()] #망가진 버튼 normal=[i for i in range(10)] #사용가능한 버튼 ans=abs(n-100) #시작 시 정답 for i in broken: normal.remove(i) tempnum=0 iternum=1 def solve(ls...
normal
{ "blob_id": "2a6ae615b427a7c970aacf9804865ea7952d065f", "index": 5888, "step-1": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun Dec 20 14:48:56 2020\n\n@author: dhk1349\n\"\"\"\n\nn = int(input()) #목표채널 \nm = int(input())\nbroken=[int(i) for i in input().split()] #망가진 버튼 \nnormal=[i for i in range(10)] #사용가능한 ...
[ 0 ]
a=list(input("enter the string or sentence to perform caesar cipher : ")) b=int(input('enter the frequency to perform ceasar cipher ')) e=[] #print(a) #print (a[4]) c=len(a) #print(c) for i in range (0,c): d=ord(a[i]) #print(d) if b> 0: for j in range (1,b+1): if a[i] >='a' ...
normal
{ "blob_id": "287d4c2d490c9dcdd7be7e86fe577139a3d30f54", "index": 6676, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, c):\n d = ord(a[i])\n if b > 0:\n for j in range(1, b + 1):\n if a[i] >= 'a' and a[i] <= 'z' or a[i] >= 'A' and a[i] <= 'Z':\n if ...
[ 0, 1, 2, 3 ]
import time import machine from machine import Timer import network import onewire, ds18x20 import ujson import ubinascii from umqtt.simple import MQTTClient import ntptime import errno #Thrown if an error that is fatal occurs, #stop measurement cycle. class Error(Exception): pass #Thrown if an error that is not ...
normal
{ "blob_id": "b934770e9e57a0ead124e245f394433ce853dec9", "index": 8691, "step-1": "<mask token>\n\n\nclass Error(Exception):\n pass\n\n\nclass Warning(Exception):\n pass\n\n\ndef gettimestr():\n rtc = machine.RTC()\n curtime = rtc.datetime()\n _time = '%04d' % curtime[0] + '%02d' % curtime[1] + '%0...
[ 4, 5, 6, 8, 9 ]
from .storage import Storage class ConnectionManager: def __init__(self): self.store = Storage() def handle(self,msg): if msg['type'] in {'register', 'heartbeat'}: self.store.reg_hb(**msg['payload']) elif msg['type'] == 'result': self.store.result(msg['payload']...
normal
{ "blob_id": "03b38e6e2d0097d5d361b0794aba83b8e430323d", "index": 4370, "step-1": "<mask token>\n\n\nclass ConnectionManager:\n <mask token>\n\n def handle(self, msg):\n if msg['type'] in {'register', 'heartbeat'}:\n self.store.reg_hb(**msg['payload'])\n elif msg['type'] == 'result'...
[ 3, 4, 7, 8, 10 ]
from .models import Owner, Vehicle from rest_framework import viewsets, permissions from .serializers import OwnerSerializer, VehicleSerializer class OwnerViewSet(viewsets.ModelViewSet): queryset = Owner.objects.all().order_by('id') serializer_class = OwnerSerializer permission_classes = [permissions.IsAu...
normal
{ "blob_id": "9290294b5df081ef0cae5450a9ea3baef789c041", "index": 6421, "step-1": "<mask token>\n\n\nclass VehicleViewSet(viewsets.ModelViewSet):\n queryset = Vehicle.objects.all().order_by('id')\n serializer_class = VehicleSerializer\n permission_classes = [permissions.IsAuthenticated]\n", "step-2": "...
[ 2, 3, 4, 5 ]
# "Time Warner Python" Salma Hashem netid: sh5640 #Design costumer service application by asking users series of questions, and based on the customers' answers to the questions, provide them with instructions. #Ask the user to choose from the following options print("Choose from the following options: ") #assign each...
normal
{ "blob_id": "736b84bbcf1d5954b491068be4060edeade2c1c5", "index": 2205, "step-1": "<mask token>\n", "step-2": "print('Choose from the following options: ')\n<mask token>\nprint(one, '\\n', two, '\\n', three, '\\n', four, '\\n', five)\n<mask token>\nif value == 1:\n modem_on = input('\\nIs your modem on? (Ent...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- # @File :fi_handlers.py # @Author:ZengYu # @Date :2019/5/16 # @software:PyCharm import tornado.web import tornado.websocket from PIL import Image import base64 from model.flower_identify import flower_identify class FlowersInfo(): flowersInfo = ["月季花(学名:Rosa chinensis Jacq.)...
normal
{ "blob_id": "1c3b1776f14a085bec90be11028c87dc47f00293", "index": 1722, "step-1": "<mask token>\n\n\nclass FlowerIdentify(tornado.web.RequestHandler):\n\n def get(self):\n self.render('flower_identify.html')\n\n\nclass IdentifyHandler(tornado.websocket.WebSocketHandler):\n\n def post(self):\n ...
[ 4, 5, 6, 7, 8 ]
aax=int(input("enter aa-x")) aay=int(input("enter aa-y")) bbx=int(input("enter bb-x")) bby=int(input("enter bb-y")) ccx=int(input("enter cc-x")) ccy=int(input("enter cc-y")) ddx=int(input("enter dd-x")) ddy=int(input("enter dd-y")) if aax==aay and aay==bbx and bby==ccx and ccx==ccy and ccy==ddx and ddy==aax: print(...
normal
{ "blob_id": "bd0cc8cf059440f8fd7ad135894d82c9b18ebc80", "index": 4583, "step-1": "<mask token>\n", "step-2": "<mask token>\nif aax == aay and aay == bbx and bby == ccx and ccx == ccy and ccy == ddx and ddy == aax:\n print('yes')\nelse:\n print('no')\n", "step-3": "aax = int(input('enter aa-x'))\naay = ...
[ 0, 1, 2, 3 ]
from django.utils.html import strip_tags from django.core.mail import send_mail from django.urls import reverse from django.http import HttpResponseRedirect def Email(doctorFullName,password,otp,email,id): print("\n== UTILS ===") html_message=''' <html> <body> <p>Welcome %s and pass is %s...
normal
{ "blob_id": "4ecf9c03750a31ecd113a7548df4e2a700e775e0", "index": 4034, "step-1": "<mask token>\n\n\ndef emailpatient(firstname, lastname, password, otp, email, id):\n print('\\n== UTILS ===')\n html_message = (\n \"\"\"\n <html>\n <body>\n <p>Welcome %s %s and pass is %s and otp is %d</p>\n...
[ 1, 2, 3, 4, 5 ]