code stringlengths 13 1.2M | order_type stringclasses 1
value | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
''' extract package names from the Meteor guide and write them to packages-guide
Uses the content folder of https://github.com/meteor/guide '''
from collections import defaultdict
import os
import sys
import markdown
from bs4 import BeautifulSoup
def get_links_from_markdown(path, name):
try:
with op... | normal | {
"blob_id": "274185896ab5c11256d69699df69fc2c0dde4f2d",
"index": 987,
"step-1": "<mask token>\n\n\ndef get_links_from_markdown(path, name):\n try:\n with open(path, 'r') as file:\n md = file.read()\n html = markdown.markdown(md)\n soup = BeautifulSoup(html, 'html.parser... | [
2,
3,
4,
5,
6
] |
import pandas as pd
from sqlalchemy import create_engine
# file = 'testfile.csv'
# print(pd.read_csv(file, nrows=5))
with open('testfile_short1.csv', 'r') as original: data = original.read()
for i in range(2):
with open('testfile_short3.csv', 'a') as modified: modified.write(data) | normal | {
"blob_id": "d7b45e76f150107cd62be160e8938f17dad90623",
"index": 58,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('testfile_short1.csv', 'r') as original:\n data = original.read()\nfor i in range(2):\n with open('testfile_short3.csv', 'a') as modified:\n modified.write(data)\n",
... | [
0,
1,
2,
3
] |
ID = '113'
TITLE = 'Path Sum II'
DIFFICULTY = 'Medium'
URL = 'https://oj.leetcode.com/problems/path-sum-ii/'
BOOK = False
PROBLEM = r"""Given a binary tree and a sum, find all root-to-leaf paths where each path's
sum equals the given sum.
For example:
Given the below binary tree and `sum = 22`,
... | normal | {
"blob_id": "9a62a57f6d9af7ef09c8ed6e78a100df7978da6e",
"index": 8631,
"step-1": "<mask token>\n",
"step-2": "ID = '113'\nTITLE = 'Path Sum II'\nDIFFICULTY = 'Medium'\nURL = 'https://oj.leetcode.com/problems/path-sum-ii/'\nBOOK = False\nPROBLEM = \"\"\"Given a binary tree and a sum, find all root-to-leaf paths... | [
0,
1,
2
] |
# 文字列(結合)
str1 = "py"
str2 = "thon"
print(str1+str2)
| normal | {
"blob_id": "d95cbca8e892f18f099b370e139176770ce0c1b7",
"index": 8270,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(str1 + str2)\n",
"step-3": "str1 = 'py'\nstr2 = 'thon'\nprint(str1 + str2)\n",
"step-4": "# 文字列(結合)\n\nstr1 = \"py\"\nstr2 = \"thon\"\nprint(str1+str2)\n",
"step-5": null,
"... | [
0,
1,
2,
3
] |
/home/salmane/anaconda3/lib/python3.7/_weakrefset.py | normal | {
"blob_id": "05d21a27097cf3295e9328aeafa466973a4d2611",
"index": 5696,
"step-1": "/home/salmane/anaconda3/lib/python3.7/_weakrefset.py",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
import shutil
import tempfile
import salt.runners.net as net
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock
from tests.support.runtests import RUNTIME_VARS
from tests.support.unit import TestCase, skipIf
@skipIf(not net.HAS_NAPALM, "napalm module required for this tes... | normal | {
"blob_id": "0fb288e3ab074e021ec726d71cbd5c8546a8455b",
"index": 744,
"step-1": "<mask token>\n\n\n@skipIf(not net.HAS_NAPALM, 'napalm module required for this test')\nclass NetTest(TestCase, LoaderModuleMockMixin):\n <mask token>\n <mask token>\n\n def test_interfaces(self):\n ret = net.interfac... | [
5,
6,
8,
10,
11
] |
import sys
with open(sys.argv[1], 'r') as test_cases:
for test in test_cases:
stringe = test.strip()
list1 = stringe.split(" | ")
list2 = list1[0].split(" ")
kha = 0
for item in list2:
for c in list1[1]:
if c in item:
... | normal | {
"blob_id": "def2721cd89501b1004d5d3f4f58df300616c1be",
"index": 2747,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open(sys.argv[1], 'r') as test_cases:\n for test in test_cases:\n stringe = test.strip()\n list1 = stringe.split(' | ')\n list2 = list1[0].split(' ')\n ... | [
0,
1,
2,
3
] |
import plotly.express as px
import pandas as pd
def fiig(plan):
df = pd.DataFrame(plan)
fig = px.timeline(df, x_start="Начало", x_end="Завершение", y="РЦ", color='РЦ', facet_row_spacing=0.6,
facet_col_spacing=0.6, opacity=0.9, hover_data=['Проект', 'МК', 'Наменование', 'Номер', 'Минут'],... | normal | {
"blob_id": "09850f0d3d295170545a6342337e97a0f190989a",
"index": 6578,
"step-1": "<mask token>\n\n\ndef fig_porc_projects(plan):\n df = pd.DataFrame(plan)\n fig = px.timeline(df, x_start='Начало', x_end='Завершение', y='Проект',\n color='РЦ', facet_row_spacing=0.2, facet_col_spacing=0.1, opacity=\n ... | [
2,
3,
4,
5,
6
] |
from HDPython import *
import HDPython.examples as ahe
from enum import Enum, auto
class counter_state(Enum):
idle = auto()
running = auto()
done = auto()
class Counter_cl(v_class_master):
def __init__(self):
super().__init__()
self.counter = v_variable(v_slv(32))
self.cou... | normal | {
"blob_id": "046db03b146ce0182ba7889908f536a09de051d5",
"index": 5069,
"step-1": "<mask token>\n\n\nclass Counter_cl(v_class_master):\n\n def __init__(self):\n super().__init__()\n self.counter = v_variable(v_slv(32))\n self.counter_max = v_variable(v_slv(32))\n self.state = v_vari... | [
7,
8,
9,
12,
15
] |
from django.shortcuts import render
from django.shortcuts import redirect
from django.http import HttpResponse
from .models import *
from django.contrib.auth import logout, authenticate, login
from django.contrib.auth.decorators import login_required
from django.template.loader import get_template
from django.template ... | normal | {
"blob_id": "e982fd5bed540b836fd4e2caaec033d8cbfb0e4f",
"index": 9854,
"step-1": "<mask token>\n\n\n@csrf_exempt\ndef login_form(request):\n formulario = '<form action=\"login\" method=\"POST\">'\n formulario += 'Nombre<br><input type=\"text\" name=\"Usuario\"><br>'\n formulario += 'Contraseña<br><input... | [
8,
12,
13,
14,
17
] |
numero_uno=int(input("ingresa el primer numero "))
numero_dos=int(input("ingresa el segundo numero "))
print(numero_uno)
print(numero_dos)
total=numero_uno +numero_dos
print("el total de la suma de : "+str(numero_uno)+" + "+str(numero_dos)+" es = a "+str(total)) | normal | {
"blob_id": "5685befae923fc336a2a5e0eb5e382c2e7d82d04",
"index": 9613,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(numero_uno)\nprint(numero_dos)\n<mask token>\nprint('el total de la suma de : ' + str(numero_uno) + ' + ' + str(\n numero_dos) + ' es = a ' + str(total))\n",
"step-3": "numero... | [
0,
1,
2,
3
] |
from django.contrib import admin
from .models import Client, Adress
# Register your models here.
class ClientInline(admin.StackedInline):
model = Adress
can_delete = False
extra = 1
class ClientAdmin(admin.ModelAdmin):
inlines = [ClientInline]
admin.site.register(Client, ClientAdmin) | normal | {
"blob_id": "ffd7aef2e72e64ac5b9f85b9d12845479187d89b",
"index": 2010,
"step-1": "<mask token>\n\n\nclass ClientInline(admin.StackedInline):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass ClientAdmin(admin.ModelAdmin):\n inlines = [ClientInline]\n\n\n<mask token>\n",
"step-2": "<mask token... | [
3,
4,
5,
6,
7
] |
import numpy as np
import matplotlib.pyplot as plt
conf_arr = [[2987, 58, 955, 832, 1991, 181, 986], [142, 218, 195, 44, 235,
11, 27], [524, 8, 3482, 478, 2406, 708, 588], [140, 0, 386, 12491, 793,
182, 438], [368, 15, 883, 635, 6331, 71, 1357], [77, 0, 942, 394, 223,
4530, 176], [224, 7, 601, 929, 2309, ... | normal | {
"blob_id": "923a2979df3c37583eec712880ad821541bd898b",
"index": 8735,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in conf_arr:\n a = 0\n tmp_arr = []\n a = sum(i, 0)\n for j in i:\n tmp_arr.append(float(j) / float(a))\n norm_conf.append(tmp_arr)\n<mask token>\nplt.clf()\n<... | [
0,
1,
2,
3
] |
import json
import logging
logger = logging.getLogger(__name__)
from django.db.models import Q
from channels_api.bindings import ResourceBinding
from .models import LetterTransaction, UserLetter, TeamWord, Dictionary
from .serializers import LetterTransactionSerializer, UserLetterSerializer, TeamWordSerializer
cla... | normal | {
"blob_id": "c2e0f2eda6ef44a52ee4e192b8eb71bde0a69bff",
"index": 8954,
"step-1": "<mask token>\n\n\nclass TeamWordBinding(ResourceBinding):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def group_names(self, instance, action):\n return [str(instance.user.... | [
13,
14,
15,
17,
18
] |
"""
Client component of the Quartjes connector. Use the ClientConnector to create
a connection to the Quartjes server.
Usage
-----
Create an instance of this object with the host and port to connect to.
Call the start() method to establish the connection.
Now the database and the stock_exchange variable can be used to... | normal | {
"blob_id": "a8f200e0ae1252df4ad6560e5756347cd0e4c8ba",
"index": 5034,
"step-1": "<mask token>\n\n\nclass ClientConnector(object):\n <mask token>\n\n def __init__(self, host=None, port=None):\n self._host = host\n if port:\n self._port = port\n else:\n from quartj... | [
12,
16,
19,
20,
21
] |
import sys
import re
import math
s=sys.stdin.read()
digits=re.findall(r"-?\d+",s)
listline= [int(e) for e in digits ]
x=listline[-1]
del(listline[-1])
n=len(listline)//2
customers=listline[:n]
grumpy=listline[n:]
maxcus=0
if x==n:
print(sum(customers))
else:
for i in range(n-x):
total=0
for j in... | normal | {
"blob_id": "24bc43c1fe035430afde05fec1330e27fb5f1d86",
"index": 8809,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ndel listline[-1]\n<mask token>\nif x == n:\n print(sum(customers))\nelse:\n for i in range(n - x):\n total = 0\n for j in range(i, i + x):\n total += custom... | [
0,
1,
2,
3,
4
] |
def main():
#entrada
N = int(input())
num = 1
#processamento
for i in range (N+1):
if i > 0:
#saida
print("%d %d %d" %(i, i**2, i**3))
num +=1
if __name__ == '__main__':
main() | normal | {
"blob_id": "b55984da73d3cfb3109a52990a0d4d05a27d51a5",
"index": 1794,
"step-1": "<mask token>\n",
"step-2": "def main():\n N = int(input())\n num = 1\n for i in range(N + 1):\n if i > 0:\n print('%d %d %d' % (i, i ** 2, i ** 3))\n num += 1\n\n\n<mask token>\n",
"step-3"... | [
0,
1,
2,
3
] |
import pickle
from pathlib import Path
from rich.console import Console
from fourierdb import FourierDocument, FourierCollection, FourierDB
console = Console()
doc = FourierDocument({"bar": "eggs", "xyz": "spam"})
doc2 = FourierDocument({"a": "foo", "b": "bar"})
doc3 = FourierDocument({"abc": "xyz"})
doc4 = FourierDo... | normal | {
"blob_id": "f15f96658130ac9bba748a518371ad80d9772fbc",
"index": 4121,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ndb.add_collection(coll)\ndb.add_collection(coll2)\npickle.dump(db, open(''))\n",
"step-3": "<mask token>\nconsole = Console()\ndoc = FourierDocument({'bar': 'eggs', 'xyz': 'spam'})\ndoc... | [
0,
1,
2,
3,
4
] |
from django.contrib import admin
from django.urls import path
from . import views
from .views import index
from .views import Login , logout
from .views import CheckOut
urlpatterns = [
path("",views.index, name="index"),
path('login', Login.as_view(), name='login'),
path('logout',... | normal | {
"blob_id": "c8aa93a33a6513129b4980180c4eb8d5d5eb3b5b",
"index": 2592,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [path('', views.index, name='index'), path('login', Login.\n as_view(), name='login'), path('logout', logout, name='logout'), path(\n 'cart/', views.cart, name='cart')... | [
0,
1,
2,
3
] |
i = 0
num = ''
while len(num) < 1e6:
i += 1
num += str(i)
prod = 1
for i in xrange(0, 7):
prod *= int(num[10 ** i - 1])
print prod
| normal | {
"blob_id": "f19056222be713c1556817d852af14d04483c9a3",
"index": 5931,
"step-1": "i = 0\nnum = ''\n\nwhile len(num) < 1e6:\n i += 1\n num += str(i)\n\nprod = 1\nfor i in xrange(0, 7):\n prod *= int(num[10 ** i - 1])\n\nprint prod\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null... | [
0
] |
import json
from typing import TYPE_CHECKING
import pytest
from eth_utils import is_checksum_address
from rotkehlchen.globaldb.handler import GlobalDBHandler
from rotkehlchen.types import ChainID
if TYPE_CHECKING:
from rotkehlchen.chain.ethereum.node_inquirer import EthereumInquirer
def test_evm_contracts_data... | normal | {
"blob_id": "52dc8a4f9165a88dddc1da16e0adb045c4d851ed",
"index": 5017,
"step-1": "<mask token>\n\n\ndef test_evm_contracts_data(globaldb):\n \"\"\"Test that all evm contract entries in the packaged global DB have legal data\"\"\"\n serialized_chain_ids = [x.serialize_for_db() for x in ChainID]\n with gl... | [
2,
3,
4,
5,
6
] |
# hw.shin@konantech.com
#leekiljae@ogqcorp.com | normal | {
"blob_id": "193d48237b4b1e406eb565943cf01f0423449fca",
"index": 3682,
"step-1": "# hw.shin@konantech.com\n#leekiljae@ogqcorp.com",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
1
]
} | [
1
] |
print('Hello World!')
print('2nd Test')
d = dict()
d['a'] = dict()
d['a']['b'] = 5
d['a']['c'] = 6
d['x'] = dict()
d['x']['y'] = 10
print(d)
print(d['a'])
import random
random.seed(30)
r = random.randrange(0,5)
print(r)
import numpy as np
np.random.seed
for i in range(20):
newArray = list(set(np.random.ran... | normal | {
"blob_id": "e4a60008ca7d61d825b59e6202b40c6be02841cd",
"index": 2024,
"step-1": "<mask token>\n",
"step-2": "print('Hello World!')\nprint('2nd Test')\n<mask token>\nprint(d)\nprint(d['a'])\n<mask token>\nrandom.seed(30)\n<mask token>\nprint(r)\n<mask token>\nnp.random.seed\nfor i in range(20):\n newArray =... | [
0,
1,
2,
3,
4
] |
from django.db import models
# Create your models here.
from user.models import User
class Post(models.Model):
class Meta:
db_table = 'bl_post'
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=200, null=False)
pubdate = models.DateTimeField(null=False)
# 作者
... | normal | {
"blob_id": "34a523b31e5567d2a8aec95c5820792d1ae80892",
"index": 5335,
"step-1": "<mask token>\n\n\nclass Post(models.Model):\n\n\n class Meta:\n db_table = 'bl_post'\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Content(models.Mo... | [
4,
5,
6,
7,
8
] |
import os, sys, shutil
import fnmatch, logging, zipfile
logging.basicConfig(format='%(asctime)s [%(levelname)s] %(message)s', datefmt='%Y-%m-%d,%H:%M:%S', level=logging.DEBUG)
def scan_files(dir, pattern):
fileList = []
for root, subFolders, files in os.walk(dir):
for file in files:
... | normal | {
"blob_id": "187c2a56ba9360b89c8ded09861091e2deedf32e",
"index": 7783,
"step-1": "<mask token>\n\n\ndef scan_files(dir, pattern):\n fileList = []\n for root, subFolders, files in os.walk(dir):\n for file in files:\n if fnmatch.fnmatch(file, pattern):\n fileList.append(os.pa... | [
1,
2,
3,
4,
5
] |
#Copyright 2008, Meka Robotics
#All rights reserved.
#http://mekabot.com
#Redistribution and use in source and binary forms, with or without
#modification, are permitted.
#THIS SOFTWARE IS PROVIDED BY THE Copyright HOLDERS AND CONTRIBUTORS
#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
#LIMITED... | normal | {
"blob_id": "b227f222569761493f50f9dfee32f21e0e0a5cd6",
"index": 4400,
"step-1": "#Copyright 2008, Meka Robotics\n#All rights reserved.\n#http://mekabot.com\n\n#Redistribution and use in source and binary forms, with or without\n#modification, are permitted. \n\n\n#THIS SOFTWARE IS PROVIDED BY THE Copyright HOL... | [
0
] |
import torch
import numpy as np
import torch.utils.data as data
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import time
class CNN(nn.Module):
def __init__(self, fragment_length, conv_layers_num, conv_kernel_size,
pool_kernel_size, fc_size, conv_dilation=1, pool_dilat... | normal | {
"blob_id": "415a6cf1c3f633a863851a4a407d416355398b39",
"index": 7732,
"step-1": "<mask token>\n\n\nclass CNN(nn.Module):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass CNN(nn.Module):\n\n def __init__(self, fragment_length, conv_layers_num, conv_kernel_size,\n pool_kernel... | [
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _
class StaffApp(CMSApp):
name = _('Staff')
urls = ['blog.urls', ]
app_name = 'staff'
apphook_pool.register(StaffApp)
| normal | {
"blob_id": "40ee790f4272c05c1619eb7b2cc66a8b57bbe8a8",
"index": 5988,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass StaffApp(CMSApp):\n name = _('Staff')\n urls = ['blog.urls']\n app_name = 'staff'\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\nclass StaffApp(CMSApp):\n name... | [
0,
2,
3,
4,
5
] |
name = ['zhangsan']
def func(n):
name = n
print(name)
def func1():
nonlocal name
name = 'xiaohong'
print(name)
func1()
print(name)
func('lisi')
| normal | {
"blob_id": "b04aef64dc0485d9112a40e00d178042833a9ddd",
"index": 4294,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef func(n):\n name = n\n print(name)\n\n def func1():\n nonlocal name\n name = 'xiaohong'\n print(name)\n func1()\n print(name)\n\n\n<mask token>\... | [
0,
1,
2,
3
] |
#! /usr/bin/env python3
# -*- coding:utf-8 -*-
"""
企查查-行政许可[工商局]
"""
import json
import time
import random
import requests
from lxml import etree
from support.use_mysql import QccMysql as db
from support.others import DealKey as dk
from support.others import TimeInfo as tm
from support.headers import GeneralHeaders a... | normal | {
"blob_id": "63822d60ef9dcc1e123a3d20874e9f492b439c6d",
"index": 3313,
"step-1": "<mask token>\n\n\nclass AdmLicenseBc(AdmLicense):\n\n def bc_judge(self):\n global com_id, com_name\n alb = AdmLicenseBc()\n count_bc = 0\n count = 0\n while count_bc == 0:\n result ... | [
7,
9,
10,
11,
14
] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
# Add gumpy path
sys.path.append('../shared')
from gumpy import signal
import numpy as np
def preprocess_data(data, sample_rate=160, ac_freq=60, hp_freq=0.5, bp_low=2, bp_high=60, notch=False,
hp_filter=False, bp_filter=False, artifact_rem... | normal | {
"blob_id": "5f1cbe1019f218d2aad616ea8bbe760ea760534c",
"index": 9359,
"step-1": "<mask token>\n\n\ndef preprocess_data(data, sample_rate=160, ac_freq=60, hp_freq=0.5, bp_low=\n 2, bp_high=60, notch=False, hp_filter=False, bp_filter=False,\n artifact_removal=False, normalize=False):\n if notch:\n ... | [
4,
6,
7,
8,
9
] |
import sys
import pytest
from presidio_evaluator.evaluation import Evaluator
from tests.conftest import assert_model_results_gt
from presidio_evaluator.models.flair_model import FlairModel
@pytest.mark.slow
@pytest.mark.skipif("flair" not in sys.modules, reason="requires the Flair library")
def test_flair_simple(sm... | normal | {
"blob_id": "813d27e8f9c1a416dab2f891dd71e4791bb92dbb",
"index": 1040,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@pytest.mark.slow\n@pytest.mark.skipif('flair' not in sys.modules, reason=\n 'requires the Flair library')\ndef test_flair_simple(small_dataset):\n flair_model = FlairModel(mode... | [
0,
1,
2,
3
] |
import os
import yaml
import sys
import random
import shutil
import openpyxl
import yaml
import audioanalysis as aa
import numpy as np
import argparse
import logging
"""
manualtest.py
Script to create a listeneing test. The output, test
case directory and answer_key.yml file, can be
found in the root directory.
m... | normal | {
"blob_id": "c6ef9154285dee3b21980801a101ad5e34a50cab",
"index": 4656,
"step-1": "<mask token>\n\n\nclass Answer:\n \"\"\"\n Wrapper for A_B_X directory containing all associated attributes. \n Populate all fields of the class and call grade to determine if the \n question was correct\n **user_ans... | [
4,
10,
11,
13,
15
] |
"""
Unpacks and preprocesses all of the data from the tarball of partial data,
which includes the flats and dark frames.
"""
import tools.unpack
import util.files
import util.dark
import util.flat
def main():
tools.unpack.main()
util.files.main()
util.dark.main()
util.flat.main()
if __name__ == '__m... | normal | {
"blob_id": "3667651697ac1c093d48fe2c4baa4b4dbdf20f8a",
"index": 6832,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n tools.unpack.main()\n util.files.main()\n util.dark.main()\n util.flat.main()\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef main():\n tools.unp... | [
0,
1,
2,
3,
4
] |
import numpy as np
import matplotlib.pyplot as plt
# image data
a = np.array([0.1,0.2,0.3,
0.4,0.5,0.6,
0.7,0.8,0.9]).reshape(3,3)
plt.imshow(a,interpolation='nearest',cmap='bone',origin='upper')
plt.colorbar()
plt.xticks(())
plt.yticks(())
plt.show()
| normal | {
"blob_id": "f01f97f8998134f5e4b11232d1c5d341349c3c79",
"index": 4074,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nplt.imshow(a, interpolation='nearest', cmap='bone', origin='upper')\nplt.colorbar()\nplt.xticks(())\nplt.yticks(())\nplt.show()\n",
"step-3": "<mask token>\na = np.array([0.1, 0.2, 0.3,... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python
import sys
import requests
import numpy as np
import astropy.table as at
if __name__=='__main__':
targets = at.Table.read('targets_LCO2018A_002.txt', format='ascii')
headers={'Authorization': 'Token {}'.format(sys.argv[1])}
for x in targets['targetname']:
obs = requests.get('h... | normal | {
"blob_id": "705bc651e7d12769bcf5994168fe6685a6bae05d",
"index": 5983,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n targets = at.Table.read('targets_LCO2018A_002.txt', format='ascii')\n headers = {'Authorization': 'Token {}'.format(sys.argv[1])}\n for x in targets[... | [
0,
1,
2,
3
] |
#!/usr/bin/python3
"""
This module add a better setattr function
"""
def add_attribute(obj, name, value):
""" add an attribute to a class if possible"""
if hasattr(obj, "__dict__"):
setattr(obj, name, value)
else:
raise TypeError("can't add new attribute")
| normal | {
"blob_id": "bee7f3acdb103f3c20b6149407854c83ad367a6b",
"index": 2621,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef add_attribute(obj, name, value):\n \"\"\" add an attribute to a class if possible\"\"\"\n if hasattr(obj, '__dict__'):\n setattr(obj, name, value)\n else:\n ... | [
0,
1,
2
] |
from vmgCommanderBase import CommanderBase
from vmgInstallerApt import InstallerApt
from vmgInstallerYum import InstallerYum
from vmgConfigLinux import ConfigLinux
from runCommands import *
import shutil
import os
import time
from vmgLogging import *
from writeFormat import *
from vmgControlVmware import *
from vmgUtil... | normal | {
"blob_id": "22fe07a237f2c5f531d189c07596a22df191d038",
"index": 1140,
"step-1": "from vmgCommanderBase import CommanderBase\nfrom vmgInstallerApt import InstallerApt\nfrom vmgInstallerYum import InstallerYum\nfrom vmgConfigLinux import ConfigLinux\nfrom runCommands import *\nimport shutil\nimport os\nimport tim... | [
0
] |
"""
The epitome package is a set of command-line tools for analyzing MRI data, and a
set of scriptuit modules for stitching them (and others) together.
"""
from . import utilities
from . import stats
from . import signal
from . import plot
from . import docopt
| normal | {
"blob_id": "4d58926e812789768fdf5be59bd54f9b66850e57",
"index": 2554,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfrom . import utilities\nfrom . import stats\nfrom . import signal\nfrom . import plot\nfrom . import docopt\n",
"step-3": "\"\"\"\nThe epitome package is a set of command-line tools fo... | [
0,
1,
2
] |
#!/usr/bin/env python3
import base64
from apiclient import errors
import os
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
import mimetypes
def Get_Attachments(service, userId, msg_id, store_dir):
"""Get and store... | normal | {
"blob_id": "dee1ab3adb7f627680410c774be44ae196f63f6c",
"index": 587,
"step-1": "<mask token>\n\n\ndef Get_Attachments(service, userId, msg_id, store_dir):\n \"\"\"Get and store attachment from Message with given id.\n Args:\n service: Authorized Gmail API service instance.\n user... | [
2,
4,
5,
6,
7
] |
import os
import lasagne
import theano
import theano.tensor as T
import numpy as np
from lasagne.layers import Conv2DLayer,\
MaxPool2DLayer,\
InputLayer
from lasagne.nonlinearities import elu, sigmoid, rectify
from lasagne.regularization import l2, regularize_layer_... | normal | {
"blob_id": "1dd5c25cd3b7bc933ba0b63d9a42fdddc92b8531",
"index": 8737,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass FaceTrigger(CascadeBase):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass FaceTrigger(CascadeBase):\n\n def build_network(self):\n net = lasagne.layers.batc... | [
0,
1,
2,
3,
4
] |
# coding: utf-8
from openerp import SUPERUSER_ID
from openerp.osv import osv, fields
from openerp.addons.ud.ud import _TIPOS_BOLSA
TIPOS_BOLSA = dict(_TIPOS_BOLSA)
def get_banco(cls, cr, browse_record, usuario_id, context=None):
dados_bancarios_model = cls.pool.get("ud.dados.bancarios")
args = [("banco_id", ... | normal | {
"blob_id": "fd877f5952c1fc0b2115d0950a066501ee7545f8",
"index": 4150,
"step-1": "<mask token>\n\n\nclass AdicionarBolsaWizard(osv.TransientModel):\n <mask token>\n <mask token>\n <mask token>\n\n def _bolsas(self, cr, uid, ids, campos, args, context=None):\n oferta_model = self.pool.get('ud.m... | [
18,
20,
22,
24,
26
] |
import sys
from PySide2.QtWidgets import QApplication, QDialog, QLineEdit, QPushButton,QVBoxLayout, QLabel, QWidget
from docx import Document
from docx.shared import Inches
class Form(QDialog):
def __init__(self, parent=None):
super(Form, self).__init__(parent)
#set the size
#Creat widgets... | normal | {
"blob_id": "bad13218a7a9e687fbd29099ca80771296789d36",
"index": 1321,
"step-1": "<mask token>\n\n\nclass Form(QDialog):\n\n def __init__(self, parent=None):\n super(Form, self).__init__(parent)\n self.setWindowTitle('Cover Letter Developer')\n self.label1 = QLabel('Input Company Name')\n... | [
2,
3,
4,
5,
6
] |
from django.contrib import admin
from students.models import Child_detail
class ChildAdmin(admin.ModelAdmin):
def queryset(self, request):
"""
Filter the Child objects to only
display those for the currently signed in user.
"""
qs = super(ChildAdmin, self).queryset(reque... | normal | {
"blob_id": "582f2e6972bad85c2aaedd248f050f708c61973b",
"index": 2332,
"step-1": "<mask token>\n\n\nclass ChildAdmin(admin.ModelAdmin):\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass ChildAdmin(admin.ModelAdmin):\n\n def queryset(self, request):\n \"\"\"\n Filter th... | [
1,
2,
3,
4,
5
] |
#Import dependencies
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import string
import operator
from sklearn.feature_extraction.text import CountVectorizer
import pickle
import nltk
from nltk.corpus import stopwords
#nltk.download('stopwords')
from nltk.tokenize import wo... | normal | {
"blob_id": "82f86284dddf48bf2c65ddf55eb6d7a372306373",
"index": 7182,
"step-1": "<mask token>\n\n\ndef positive_words(scrape_results_df):\n\n def text_process(text):\n nopunc = [char for char in text if char not in string.punctuation]\n nopunc = ''.join(nopunc)\n return [word for word in... | [
2,
3,
4,
5,
6
] |
# coding: utf-8
from flask import Blueprint, make_response, render_template, request
from flask_restful import Resource
from flask_security import login_required
from ..clients.service import list_clients
from ..roles.service import list_roles
from ...models import Client, Role
admin = Blueprint('admin', __name__, u... | normal | {
"blob_id": "f5f1a4db33cea8421cb4236606dfb288efee7621",
"index": 2142,
"step-1": "<mask token>\n\n\n@admin.route('/', methods=['GET'])\n@login_required\ndef index():\n headers = {'Content-Type': 'text/html'}\n return make_response(render_template('index.html'), headers)\n\n\n<mask token>\n\n\n@admin.route(... | [
2,
3,
4,
5,
6
] |
import pandas as pd
from fbprophet import Prophet
import os
from utils.json_utils import read_json, write_json
from sklearn.model_selection import train_test_split
import numpy as np
from sklearn.metrics import mean_absolute_error
root_dir = "/home/charan/Documents/workspaces/python_workspaces/Data/ADL_Project/"
final... | normal | {
"blob_id": "25dd7ea4a154e5693c65f8c42107224efee42516",
"index": 4533,
"step-1": "<mask token>\n\n\ndef mean_absolute_percentage_error(y_true, y_pred):\n y_true, y_pred = np.array(y_true), np.array(y_pred)\n return np.mean(np.abs((y_true - y_pred) / y_true)) * 100\n\n\n<mask token>\n",
"step-2": "<mask t... | [
1,
2,
3,
4,
5
] |
from typing import (Any, Callable, Dict, List, Optional, Set, Tuple, Type,
Union, overload)
from pccm.stubs import EnumClassValue, EnumValue
from cumm.tensorview import Tensor
class ConvMainUnitTest:
@staticmethod
def implicit_gemm(input: Tensor, weight: Tensor, output: Tensor, padding: L... | normal | {
"blob_id": "a6f3c51d4115a6e0d6f01aa75bf5e6e367840d43",
"index": 914,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass ConvMainUnitTest:\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass ConvMainUnitTest:\n\n @staticmethod\n def implicit_gemm(input: Tensor, weight: Tensor, output: ... | [
0,
1,
2,
3,
4
] |
# 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 agreed to in writing, software
# distributed under t... | normal | {
"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
] |
import cv2
import os
import re
class TestData:
def __init__(self, image_path= '../../data/test_images/'):
test_names = os.listdir(image_path)
self.images = []
self.numbers = []
self.treshold = .25
for name in test_names:
self.images.append(cv2.imread(... | normal | {
"blob_id": "122c4f3a2949ee675b7dd64b9f9828e80cbe5610",
"index": 1246,
"step-1": "<mask token>\n\n\nclass TestData:\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass TestData:\n <mask token>\n\n def get_test_data(self):\n return self.images\n",
"step-3": "<mask token>\n\... | [
1,
2,
3,
4,
5
] |
import json
import os
import pickle
import random
import urllib.request
from pathlib import Path
import tensorflow as tf
from matplotlib import pyplot as plt
class CNN(object):
def __init__(self):
self.model = tf.keras.Sequential([
tf.keras.layers.Conv2D(32, (3, 3), activation='relu', input_... | normal | {
"blob_id": "9535335c70129f997d7b8739444a503d0b984ac8",
"index": 9753,
"step-1": "<mask token>\n\n\nclass CNN(object):\n\n def __init__(self):\n self.model = tf.keras.Sequential([tf.keras.layers.Conv2D(32, (3, 3),\n activation='relu', input_shape=(150, 150, 1)), tf.keras.layers.\n ... | [
12,
13,
14,
15,
16
] |
import torch
import argparse
from DialogGenerator import DialogGenerator
from DialogDataset import DialogDataset
from DialogDiscriminator import DialogDiscriminator
from transformers import GPT2Tokenizer
import os
def prep_folder(args):
""" Append to slash to filepath if needed, and generate folder if it doesn't e... | normal | {
"blob_id": "18be97061c65185fcebf10c628e0e51bb08522cf",
"index": 3609,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef prep_folder(args):\n \"\"\" Append to slash to filepath if needed, and generate folder if it doesn't exist\"\"\"\n if args.save_folder[-1] != '/':\n args.save_folder ... | [
0,
1,
2,
3,
4
] |
import json
import requests
import random
import boto3
from email.parser import BytesParser, Parser
from email.policy import default
##################################
endpoint = 'https://5295t8jcs0.execute-api.us-east-1.amazonaws.com/Prod'
##################################
def get_msg_body(msg):
type = msg.get_... | normal | {
"blob_id": "cc99811321083147540a00e8029b792c8afc2ada",
"index": 3233,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_msg_body(msg):\n type = msg.get_content_maintype()\n if type == 'multipart':\n for part in msg.get_payload():\n if part.get_content_maintype() == 'text... | [
0,
2,
3,
4,
5
] |
# =============================================================================
# Created By : Mohsen Malmir
# Created Date: Fri Nov 09 8:10 PM EST 2018
# Purpose : this file implements the gui handling to interact with emulators
# =============================================================================
from... | normal | {
"blob_id": "043ea0efd490522de4f6ee4913c8d66029b34ff5",
"index": 5136,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef activate_emu():\n \"\"\"\n This function scans all the open windows and returns a handle to the first known\n and supported emulator-game pair.\n Args:\n None\n... | [
0,
2,
3,
4,
5
] |
from keras.models import Sequential
from keras.layers import Dense
import numpy as np
x = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
y = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
x2 = np.array([11, 12, 13, 14, 15])
model = Sequential()
model.add(Dense(5, input_dim=1, activation='relu'))
model.add(Dense(3))
model.add(D... | normal | {
"blob_id": "43d9edd9120351ce5065eb266d482ccaa2e56177",
"index": 2416,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nmodel.add(Dense(5, input_dim=1, activation='relu'))\nmodel.add(Dense(3))\nmodel.add(Dense(1))\nmodel.summary()\n<mask token>\n",
"step-3": "<mask token>\nx = np.array([1, 2, 3, 4, 5, 6,... | [
0,
1,
2,
3,
4
] |
password = ["123456", "1111"]
pw = input("รหัสผ่านคือ>>>")
for data in password:
if data != pw:
pass
else:
print("พบข้อมูลรหัสผ่านนี้")
print("แล้วเจอกันใหม่")
| normal | {
"blob_id": "6f05b1352e776e20d6a9e0eb457d8914cbfc2d22",
"index": 2779,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor data in password:\n if data != pw:\n pass\n else:\n print('พบข้อมูลรหัสผ่านนี้')\nprint('แล้วเจอกันใหม่')\n",
"step-3": "password = ['123456', '1111']\npw = inpu... | [
0,
1,
2,
3
] |
from flask import *
app = Flask(__name__)
from app import views
from app import admin_views
from app import usr_reg
from app import cookie
from app import db_connect
| normal | {
"blob_id": "e736991f364ba9ff709348e4b1f612b1e9673281",
"index": 252,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napp = Flask(__name__)\n<mask token>\n",
"step-3": "from flask import *\napp = Flask(__name__)\nfrom app import views\nfrom app import admin_views\nfrom app import usr_reg\nfrom app impor... | [
0,
1,
2
] |
import sys
import logging
import copy
import socket
from . import game_map
class GameUnix:
"""
:ivar map: Current map representation
:ivar initial_map: The initial version of the map before game starts
"""
def _send_string(self, s):
"""
Send data to the game. Call :function:`done_... | normal | {
"blob_id": "09d31df9c76975377b44470e1f2ba4a5c4b7bbde",
"index": 912,
"step-1": "<mask token>\n\n\nclass GameStdIO:\n <mask token>\n <mask token>\n\n def _done_sending(self):\n \"\"\"\n Finish sending commands to the game.\n\n :return: nothing\n \"\"\"\n sys.stdout.wri... | [
8,
14,
18,
21,
22
] |
"""
Contain meta-data related functions:
* accessing integration schema: fields, values, constraints on inputs/queries
* tracking fields available
* tracking known (input field) values
"""
# coding=utf-8
__author__ = 'vidma'
| normal | {
"blob_id": "abdedad2c2b42b54cdba0e61e095ba3df0783b81",
"index": 1172,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n__author__ = 'vidma'\n",
"step-3": "\"\"\"\nContain meta-data related functions:\n\n* accessing integration schema: fields, values, constraints on inputs/queries\n* tracking fields avai... | [
0,
1,
2
] |
import matplotlib.pyplot as plt
import numpy as np
import unittest
from ema_workbench.analysis import clusterer
from test import utilities
class ClusterTestCase(unittest.TestCase):
def test_cluster(self):
n = 10
experiments, outcomes = utilities.load_flu_data()
data = outcomes["infected f... | normal | {
"blob_id": "a7e2b016131dfdb75e537e86875e1b2f19fb3d9d",
"index": 2580,
"step-1": "<mask token>\n\n\nclass ClusterTestCase(unittest.TestCase):\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass ClusterTestCase(unittest.TestCase):\n\n def test_cluster(self):\n n = 10\n ex... | [
1,
2,
3,
4,
5
] |
ba1466.pngMap = [
'11111111111111111111111111111100000000011111111111111111111111111000000000000000011111111111111111111111111111111111111111111111',
'11111111111111111111111111111110000000011111111111111111111111111000000000000000011111111111111111111111111111111111111111111111',
'1111111111111111111111111111111000000... | normal | {
"blob_id": "dbefca59376e567a6116dec4e07c44b1fe301ca9",
"index": 9911,
"step-1": "<mask token>\n",
"step-2": "ba1466.pngMap = [\n '11111111111111111111111111111100000000011111111111111111111111111000000000000000011111111111111111111111111111111111111111111111'\n ,\n '1111111111111111111111111111111000... | [
0,
1,
2
] |
from django.urls import path
from .views import FirstModelView
urlpatterns = [path('firstModel', FirstModelView.as_view())]
| normal | {
"blob_id": "4efd22d132accd0f5945a0c911b73b67654b92e4",
"index": 9358,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [path('firstModel', FirstModelView.as_view())]\n",
"step-3": "from django.urls import path\nfrom .views import FirstModelView\nurlpatterns = [path('firstModel', FirstModel... | [
0,
1,
2
] |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 25 12:07:32 2021
@author: yashv
"""
import numpy as np
X= [0.7, 1.5]
Y= [3.9,0.2]
def f(w,b,x): #sigmoid logistic function
return 1.0/(1.0 + np.exp(-(w*x +b)))
def error(w,b): #loss function
err=0.0
for x,y in zip(X,Y):
fx= f(w,b,... | normal | {
"blob_id": "2387856757ad1c3ff911cf2a7537ca6df7786997",
"index": 9244,
"step-1": "<mask token>\n\n\ndef f(w, b, x):\n return 1.0 / (1.0 + np.exp(-(w * x + b)))\n\n\ndef error(w, b):\n err = 0.0\n for x, y in zip(X, Y):\n fx = f(w, b, x)\n err += 0.5 * (fx - y) ** 2\n return err\n\n\ndef... | [
5,
6,
7,
8,
9
] |
from datetime import datetime
from logging import Logger
from pathlib import Path
from typing import Dict
import ignite
import ignite.distributed as idist
import torch
from omegaconf import OmegaConf
from config_schema import ConfigSchema
def log_metrics(
logger: Logger, epoch: int, elapsed: float, tag: str, me... | normal | {
"blob_id": "d8fb5aeb5453b986cc698165749992e4a7677257",
"index": 1506,
"step-1": "<mask token>\n\n\ndef prepare_output_directory(config: ConfigSchema) ->None:\n formatted = datetime.now().strftime(config.output_path_format)\n output_path = Path(formatted)\n output_path.mkdir(parents=True, exist_ok=False... | [
1,
2,
3,
4,
5
] |
__author__ = 'simsun'
| normal | {
"blob_id": "2b746d89d34435eb5f3a5b04da61c5cc88178852",
"index": 8784,
"step-1": "<mask token>\n",
"step-2": "__author__ = 'simsun'\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
from com.kakao.cafe.menu.tea.milkTea import MilkTea
class MatchaMilkTea(MilkTea):
def __init__(self):
super().__init__()
self.__matcha = 1
self.__condensedMilk = 1
self.name = "MatchaMilkTea"
self.__price = 4500
self.__milk = 400
self.__blackTea = 2
de... | normal | {
"blob_id": "96b113678a3453520cd2e62eb11efd9582710409",
"index": 2087,
"step-1": "<mask token>\n\n\nclass MatchaMilkTea(MilkTea):\n <mask token>\n\n def getName(self) ->str:\n return self.name\n <mask token>\n <mask token>\n\n def setPrice(self, price: int) ->None:\n self.__price = p... | [
9,
15,
20,
23,
24
] |
ALPACA_KEY = 'Enter your apaca key here'
ALPACA_SECRET_KEY = 'Enter your apaca secret key here'
ALPACA_MARKET = 'enter alpaca market link here'
TWILIO_KEY = 'enter your twilio key here'
TWILIO_SECRET_KEY = 'enter your twilio secret key here'
YOUR_PHONE_NUMBER = 'Enter your phone number'
YOUR_TWILIO_NUMBER = 'Enter your... | normal | {
"blob_id": "10cb4b59d1e1e823c56ae5ceea0514b1c1904292",
"index": 3769,
"step-1": "<mask token>\n",
"step-2": "ALPACA_KEY = 'Enter your apaca key here'\nALPACA_SECRET_KEY = 'Enter your apaca secret key here'\nALPACA_MARKET = 'enter alpaca market link here'\nTWILIO_KEY = 'enter your twilio key here'\nTWILIO_SECR... | [
0,
1
] |
class Solution:
def uniquePaths(self, A, B):
# A - rows
# B - columns
if A == 0 or B == 0:
return 0
grid = [[1 for _ in range(B)] for _ in range(A)]
for i in range(1, A):
for j in range(1, B):
grid[i][j] = grid[i-1][j] + grid[i][j-1]
return grid[A-1][B-1]
s = Solution... | normal | {
"blob_id": "027e53d69cfece0672556e34fa901412e483bc3e",
"index": 8805,
"step-1": "class Solution:\n\n def uniquePaths(self, A, B):\n # A - rows\n # B - columns\n if A == 0 or B == 0:\n return 0\n\n grid = [[1 for _ in range(B)] for _ in range(A)]\n\n for i in range(1, A):\n for j in ran... | [
0
] |
from flask import Flask, render_template, jsonify, request, make_response #BSD License
import requests #Apache 2.0
#StdLibs
import json
from os import path
import csv
###################################################
#Programmato da Alex Prosdocimo e Matteo Mirandola#
###################################... | normal | {
"blob_id": "14b9927435536a4b29b0930791ab4525acd80bc9",
"index": 5783,
"step-1": "<mask token>\n\n\n@application.route('/')\ndef index():\n return make_response(render_template('index.html'))\n\n\n@application.route('/getGraph', methods=['POST', 'GET'])\ndef getgraph():\n if request.method == 'POST':\n ... | [
2,
3,
4,
6,
7
] |
import hive
from ..bind import Instantiator as _Instantiator
from ..event import bind_info as event_bind_info
bind_infos = (event_bind_info,)
def build_scene_instantiator(i, ex, args, meta_args):
bind_bases = tuple((b_i.environment_hive for b_i in bind_infos if b_i.is_enabled(meta_args)))
# Update bind env... | normal | {
"blob_id": "23d4619527b5fce7fed0b0a66d834e26bb984129",
"index": 6443,
"step-1": "<mask token>\n\n\nclass SceneClass:\n\n def __init__(self):\n self._entities = {}\n self.scene = None\n\n def get_entity_id(self, identifier):\n return self._entities[identifier]\n\n def get_position_a... | [
9,
10,
11,
12,
14
] |
import logging
from datetime import datetime
from preprocessing import death_preprocessing
from preprocessing_three_month import death_preprocessing_three_month
from death_rule_first_55 import death_rule_first_55
from death_rule_second import death_rule_second_new
from death_escalation import death_escalation
if __n... | normal | {
"blob_id": "f44a8837056eb77fbf0ff37b9c57891cc3a3d6b2",
"index": 6783,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n logging.basicConfig(filename='logfile.log', filemode='a', format=\n '%(asctime)s - %(levelname)s - %(message)s', level=logging.INFO)\n logging.in... | [
0,
1,
2,
3
] |
#!/usr/bin/env python3
# encoding: utf-8
"""
@version: ??
@author: ami
@license: Apache Licence
@file: dictTest.py
@time: 2019/9/25 18:26
@tools: PyCharm
"""
def func():
pass
class Main():
def __init__(self):
pass
if __name__ == '__main__':
pass
d = {'name': 'Bob', ... | normal | {
"blob_id": "797cedc9dc2a47713b9554e4f5975a4505ecf6d3",
"index": 9568,
"step-1": "<mask token>\n\n\nclass Main:\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef func():\n pass\n\n\nclass Main:\n\n def __init__(self):\n pass\n\n\n<mask token>\n",
"step-3": "<mask token>\n\... | [
1,
3,
4,
5,
6
] |
from datetime import datetime
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
Base = declarative_base()
class BusLine(Base):
__tablename__ = "bus_lines"
id = Column(Integer, primary_key=True)... | normal | {
"blob_id": "9e896d935cc57e580ed46cd501b41053bbaab38f",
"index": 6490,
"step-1": "<mask token>\n\n\nclass BusRoute(Base):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass BusRoutePos(Base):\n __tablename__ = 'bus_route_pos'\n id = Column... | [
12,
15,
16,
17,
19
] |
#coding:utf-8
#base string opeate
#rstrip()删除字符串末尾被指定的字符,默认是空格,如末尾有多个相同的字符,则一并删除
str1="djcc"
str2="adcd"
print("this's rstrip() function---------")
print(str1.rstrip("c"))
print(str1.rstrip("d"))
#replace()用新字符替换字符串中被指定的字符,str.replace(old, new[, max]),max表示替换多少个,如不指定,全部替换
str3="this is history,it is not fake"
prin... | normal | {
"blob_id": "59170e6b0b0705b9908ed1c32bbea87373126594",
"index": 9484,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(\"this's rstrip() function---------\")\nprint(str1.rstrip('c'))\nprint(str1.rstrip('d'))\n<mask token>\nprint(\"this's replace function----------\")\nprint(str3.replace('is', 'was')... | [
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
] |
from django.urls import path, include
from django.conf.urls import url, re_path
#from rest_framework.urlpatterns import format_suffix_patterns
from .views import (HomePageView,
WordViewSet, WordNormalViewSet,
TextViewSet, TextNormalViewSet, TextTagViewSet,
TagSetViewSet, TagViewSet... | normal | {
"blob_id": "991b124d365443744c946b258504c97e9076dcea",
"index": 7627,
"step-1": "<mask token>\n\n\nclass OptionalSlashRouter(DefaultRouter):\n\n def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self.trailing_slash = '/?'\n\n\n<mask token>\n",
"step-2": "<mask token>\... | [
2,
3,
4,
5,
6
] |
#! /usr/bin/env python3
from PIL import Image
from imtools import *
import os
cwd = os.getcwd()
filelist = get_imlist(os.getcwd())
print(filelist)
for infile in filelist:
outfile = os.path.splitext(infile)[0] + ".jpg"
if infile != outfile:
try:
Image.open(infile).save(outfile)
except IOError:
print("ca... | normal | {
"blob_id": "31416f1ba9f3c44a7aa740365e05b5db49e70444",
"index": 9106,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(filelist)\nfor infile in filelist:\n outfile = os.path.splitext(infile)[0] + '.jpg'\n if infile != outfile:\n try:\n Image.open(infile).save(outfile)\n ... | [
0,
1,
2,
3,
4
] |
"""
Function of main.py:
config loader
hprams loader
feature extraction
Call model training and validation
Model Save and Load
Call model validation
载入训练参数
载入指定模型超参数
调用特征提取
调用模型训练和验证
模型保存与载入
调用模型验证
"""
"""A very simple MNIST classifier.
See extensive documentation at
https://www.tensorflow.org/get_started/mnist/beg... | normal | {
"blob_id": "c6174fae929366cabb8da3d810df705b19895c1c",
"index": 2763,
"step-1": "\"\"\"\nFunction of main.py:\n\nconfig loader\nhprams loader\nfeature extraction\nCall model training and validation\nModel Save and Load\nCall model validation\n\n载入训练参数\n载入指定模型超参数\n调用特征提取\n调用模型训练和验证\n模型保存与载入\n调用模型验证\n\"\"\"\n\n\... | [
0
] |
ii = [('LeakWTI2.py', 6)]
| normal | {
"blob_id": "997b68e42547b8f8a1059776c55c3ad16df494da",
"index": 1468,
"step-1": "<mask token>\n",
"step-2": "ii = [('LeakWTI2.py', 6)]\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
from django.contrib import admin
from .models import Profile, Address
admin.site.register(Profile)
admin.site.register(Address)
| normal | {
"blob_id": "4cc6a9c48e174b33ed93d7bda159fcc3a7b59d4c",
"index": 6727,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nadmin.site.register(Profile)\nadmin.site.register(Address)\n",
"step-3": "from django.contrib import admin\nfrom .models import Profile, Address\nadmin.site.register(Profile)\nadmin.sit... | [
0,
1,
2
] |
def clear_firefox_driver_session(firefox_driver):
firefox_driver.delete_all_cookies()
# Note this only works if the browser is set to a location.
firefox_driver.execute_script('window.localStorage.clear();')
firefox_driver.execute_script('window.sessionStorage.clear();')
class LocationNotSet(Exception... | normal | {
"blob_id": "6d0b9523668bd0b302fdbc196d3d7ff25be10b23",
"index": 5045,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass LocationNotSet(Exception):\n pass\n",
"step-3": "def clear_firefox_driver_session(firefox_driver):\n firefox_driver.delete_all_cookies()\n firefox_driver.execute_scri... | [
0,
1,
2,
3
] |
import pandas as pd
import json
import spacy
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.decomposition import NMF
nlp = spacy.load('en_core_web_sm')
list_data = []
list_data_only_reviews = []
list_data_reviewerid = []
result = []
l = []
for line in open('Automotive_5.json', 'r'):
li... | normal | {
"blob_id": "43b519d7db2e46a0bf9317eddac1f5cf6b7b79e3",
"index": 6417,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor line in open('Automotive_5.json', 'r'):\n list_data.append(json.loads(line))\nfor item in list_data:\n list_data_only_reviews.append(item['reviewText'])\n list_data_revieweri... | [
0,
1,
2,
3,
4
] |
from django.contrib import admin
from coupon.models import Coupon, Games
admin.site.register(Coupon)
admin.site.register(Games)
| normal | {
"blob_id": "6c10213c2e866ec84f229aa426c7122aa817d167",
"index": 4239,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nadmin.site.register(Coupon)\nadmin.site.register(Games)\n",
"step-3": "from django.contrib import admin\nfrom coupon.models import Coupon, Games\nadmin.site.register(Coupon)\nadmin.site... | [
0,
1,
2
] |
import requests
from bs4 import BeautifulSoup
from urllib.request import urlretrieve
import json
import time
#功能一:下载单一歌曲、歌词
def single_song(song_id,path,song_name): #下载单一歌曲,输入为歌曲id,保存路径,歌曲名称
song_url = "http://music.163.com/song/media/outer/url?id=%s" % song_id
down_path = path +'... | normal | {
"blob_id": "3b11d514b15775e4c818a7a2adf9a80e89dca968",
"index": 5801,
"step-1": "<mask token>\n\n\ndef save2txt(songname, lyric, path):\n print('歌词下载完成:' + songname)\n lyric_path = path + '\\\\' + songname + '.txt'\n with open(lyric_path, 'a', encoding='utf-8') as f:\n f.write(lyric)\n\n\n<mask ... | [
17,
20,
21,
24,
33
] |
#!/usr/bin/python
import errno
import fuse
import stat
import time
#from multiprocessing import Queue
from functools import wraps
from processfs.svcmanager import Manager
import processfs.svcmanager as svcmanager
fuse.fuse_python_api = (0, 2)
_vfiles = ['stdin', 'stdout', 'stderr', 'cmdline', 'control', 'status']
... | normal | {
"blob_id": "028c2193e180ccdbfdcc51e5d061904ea1d6164e",
"index": 3536,
"step-1": "#!/usr/bin/python\n\nimport errno\nimport fuse\nimport stat\nimport time\n#from multiprocessing import Queue\nfrom functools import wraps\n\nfrom processfs.svcmanager import Manager\nimport processfs.svcmanager as svcmanager\n\nfus... | [
0
] |
from django.conf.urls.defaults import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'foo.views.home', name='home'),
# url(r'^foo/', include('foo.foo.urls')),
# Uncomm... | normal | {
"blob_id": "266ce1aaa3283cf2aaa271a317a80c3860880a49",
"index": 4901,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nadmin.autodiscover()\n<mask token>\nurlpatterns += patterns('piston.authentication', url(\n '^oauth/request_token/$', 'oauth_request_token'), url(\n '^oauth/authorize/$', 'oauth_use... | [
0,
1,
2,
3,
4
] |
import numpy as np
import tensorflow as tf
x_data = np.random.rand(100)
y_data = x_data * 10 + 5
#构造线性模型
b = tf.Variable(0.)
k = tf.Variable(0.)
y=k*x_data+b
#二次代价函数 square求平方
loss= tf.reduce_mean(tf.square(y_data-y))
#定义一个梯度下降法来进行训练的优化器
optimizer=tf.train.GradientDescentOptimizer(.2)
train=optimizer.minimize(... | normal | {
"blob_id": "ba7f66a0f9cf1028add778315033d596e10d6f16",
"index": 3197,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith tf.Session() as ss:\n ss.run(init)\n for step in range(201):\n ss.run(train)\n if step % 10 == 0:\n print(step, ss.run([k, b]))\n",
"step-3": "<mask ... | [
0,
1,
2,
3,
4
] |
#coding=UTF-8
import random
import random
list=[]
s=0
for i in range(1,5):
for j in range(1,5):
for k in range(1,5):
if i!=j and j<>k:
list.append(str(i)+str(j)+str(k))
s=s+1
print len(list)
print s
if len(list)==s:
print "是相等的!"
else:
print "不相等!"
print l... | normal | {
"blob_id": "fa07553477e3bb2ecbeb87bd1383a2194282579c",
"index": 4081,
"step-1": "#coding=UTF-8\nimport random\nimport random\nlist=[]\ns=0\nfor i in range(1,5):\n for j in range(1,5):\n for k in range(1,5):\n if i!=j and j<>k:\n list.append(str(i)+str(j)+str(k))\n ... | [
0
] |
import numpy as np
import pandas as pd
import geopandas as gp
from sklearn.cluster import KMeans
import shapely
from descartes import PolygonPatch
# -- load the data
data = pd.read_csv('/scratch/share/gdobler/parqa/output/Tables/'
'ParkQualityScores/QualityArea_ZipCode_FiscalYears.csv')
zips = gp.... | normal | {
"blob_id": "2c181a33c84ce262404c192abdc515924a1916a9",
"index": 6165,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nvals -= vals[:, np.newaxis].mean(-1)\nvals /= vals[:, np.newaxis].std(-1)\n<mask token>\nkm.fit(vals)\n<mask token>\nfor ii in range(len(zips)):\n tzip = int(zips.ZIPCODE[ii])\n if ... | [
0,
1,
2,
3,
4
] |
# This script created by Joseph Aaron Campbell - 10/2020
""" With Help from Agisoft Forum @:
https://www.agisoft.com/forum/index.php?topic=12027.msg53791#msg53791
"""
""" Set up Working Environment """
# import Metashape library module
import Metashape
# create a reference to the current project via Document... | normal | {
"blob_id": "dcfc6d76730ba3b33e64cc8f2c166f739bbde5ff",
"index": 3655,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('parent Folder is : ' + parentFolderPath)\n<mask token>\nprint('output folder: ' + str(outputFolder))\nprint('output chunk folder: ' + str(outputChunkFolder))\nprint('mask output fo... | [
0,
1,
2,
3,
4
] |
class subset:
def __init__(self, weight, itemSet, size, setNum):
self.weight = weight
self.itemSet = itemSet
self.size = size
self.setNum = setNum
def findCover(base, arr):
uniq = [] #array that can be union
uni = [] #array has been unionized w/ base
if len(base.itemSet) == rangeOfVal:
# print("COVER:"... | normal | {
"blob_id": "b865c37623f405f67592d1eabc620d11ff87827e",
"index": 3378,
"step-1": "class subset:\n <mask token>\n\n\n<mask token>\n",
"step-2": "class subset:\n\n def __init__(self, weight, itemSet, size, setNum):\n self.weight = weight\n self.itemSet = itemSet\n self.size = size\n ... | [
1,
3,
4,
5,
6
] |
date = input()
if date == ("DEC 25") or date == ("OCT 31"):
print("yup")
else:
print("nope") | normal | {
"blob_id": "bc5b368a710b8dfc4492b996c42c46638e1f538c",
"index": 9811,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif date == 'DEC 25' or date == 'OCT 31':\n print('yup')\nelse:\n print('nope')\n",
"step-3": "date = input()\nif date == 'DEC 25' or date == 'OCT 31':\n print('yup')\nelse:\n ... | [
0,
1,
2,
3
] |
from pyspark import SparkContext
from pyspark.sql import SQLContext
from pyspark.sql.types import *
sc = SparkContext("local", "weblog app")
effective_care = sc.textFile('file:///data/exercise1/effective_care').map(lambda l:l.encode().split(',')).map(lambda x: (x[0], x[1:]))
procedure_care = effective_care.map(lambda ... | normal | {
"blob_id": "4c60fd123f591bf2a88ca0affe14a3c3ec0d3cf6",
"index": 60,
"step-1": "<mask token>\n\n\ndef range_func(measures):\n scores = []\n for entry in measures:\n try:\n curr = int(entry[1])\n except:\n curr = None\n if curr is not None:\n scores.appe... | [
1,
2,
3,
4,
5
] |
from scipy.stats import mannwhitneyu
import matplotlib.patches as patches
import os
import numpy
import pandas
from matplotlib.gridspec import GridSpec
from scipy.cluster.hierarchy import fcluster, linkage, dendrogram
from scipy.spatial.distance import squareform
import seaborn as sns
from scipy.stats import spearmanr
... | normal | {
"blob_id": "bfd31d0b80511721ee5117daced04eaf63679fd8",
"index": 2230,
"step-1": "<mask token>\n\n\ndef get_clusters(link, dn, inds, th=0.7):\n clst = fcluster(link, criterion='distance', t=th)\n return pandas.Series(index=inds, data=clst).iloc[dn['leaves']]\n\n\ndef draw_significant_groups(groups, dn_ax, ... | [
4,
5,
6,
7,
8
] |
class people:
def __init__(self, name):
self.name = name
self.purchase_descrip = []
self.purchase_price_descrip = []
self.purchases = []
self.total_spent = 0
self.debt = 0
self.debt_temp = 0
self.pay = []
self.pay_out = []
self.pay_who... | normal | {
"blob_id": "bdda42665acfefccad45a2b49f5436a186140579",
"index": 8576,
"step-1": "class people:\n <mask token>\n\n def add_purchase(self, purchase):\n self.purchases.append(purchase)\n\n def add_description(self, description):\n self.purchase_descrip.append(description)\n <mask token>\n... | [
13,
18,
20,
22,
24
] |
from django.shortcuts import render
from django.views.generic import ListView, DetailView
from django.views.generic.edit import CreateView, UpdateView
from django.urls import reverse_lazy
from django.utils import timezone
from time import time
import json
from .models import Attendance, Disciple
from users.models imp... | normal | {
"blob_id": "38c78a51a50ee9844aec8b8cdcdd42b858748518",
"index": 2552,
"step-1": "<mask token>\n\n\nclass AttendanceDetailView(DetailView):\n <mask token>\n <mask token>\n\n\n<mask token>\n\n\nclass AttendanceCreateView(CreateView):\n model = Attendance\n template_name = 'attendance_new.html'\n fi... | [
5,
8,
9,
10,
11
] |
# Sets up directories
MusicDir = "AudioFiles\\"
ModelsDir = "Models\\"
MonstersDir = "Models\\Monsters\\" | normal | {
"blob_id": "a929bfbe2be6d8f93cafa5b6cc66c7506037ffca",
"index": 4735,
"step-1": "<mask token>\n",
"step-2": "MusicDir = 'AudioFiles\\\\'\nModelsDir = 'Models\\\\'\nMonstersDir = 'Models\\\\Monsters\\\\'\n",
"step-3": "# Sets up directories\nMusicDir = \"AudioFiles\\\\\"\nModelsDir = \"Models\\\\\"\nMonsters... | [
0,
1,
2
] |
from django import forms
class CriteriaForm(forms.Form):
query = forms.CharField(widget=forms.Textarea)
| normal | {
"blob_id": "b6529dc77d89cdf2d49c689dc583b78c94e31c4d",
"index": 4716,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass CriteriaForm(forms.Form):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass CriteriaForm(forms.Form):\n query = forms.CharField(widget=forms.Textarea)\n",
"step-4"... | [
0,
1,
2,
3
] |
__author__ = 'ldd'
# -*- coding: utf-8 -*-
from view.api_doc import handler_define, api_define, Param
from view.base import BaseHandler,CachedPlusHandler
@handler_define
class HelloWorld(BaseHandler):
@api_define("HelloWorld", r'/', [
], description="HelloWorld")
def get(self):
self.write({'st... | normal | {
"blob_id": "3c738a07d71338ab838e4f1d683e631252d50a30",
"index": 4085,
"step-1": "<mask token>\n\n\n@handler_define\nclass HelloWorld(BaseHandler):\n <mask token>\n",
"step-2": "<mask token>\n\n\n@handler_define\nclass HelloWorld(BaseHandler):\n\n @api_define('HelloWorld', '/', [], description='HelloWorl... | [
1,
2,
3,
4,
5
] |
import cv2
import numpy
import os
import glob
import ntpath
from backSub import *
from ConfigParser import SafeConfigParser
filepath = "./tl3Pictures/" # where the input files are
pathRGB = ".diff/" # where the result is saved
extension = "*.jpg" # only jpg files considered
batchCount = 0
backSubI... | normal | {
"blob_id": "506d33587ff6c8b2c3d9bc546307996d2f518d86",
"index": 2060,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif not os.path.exists(filepath + pathRGB):\n os.makedirs(filepath + pathRGB)\nbackSubInstance.setConfig('sample.cfg')\nfor filename in glob.glob(filepath + extension):\n pathAndFile... | [
0,
1,
2,
3,
4
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.