code stringlengths 13 1.2M | order_type stringclasses 1
value | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
import os
import base64
from binascii import hexlify
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.primitives import hashes, hmac
from cryptography.hazmat.backends import default_backend
backend = default_backend()
# Llave falsa
key = key = b"vcOqXPg==lz3M0IH4s... | normal | {
"blob_id": "c33aedbd5aaa853131c297a9382b72c3c646a319",
"index": 4006,
"step-1": "<mask token>\n\n\ndef decrypt(message):\n message = base64.urlsafe_b64decode(message)\n iv = message[:16]\n signed_data = message[16:36]\n encrypted_data = message[36:]\n cipher = Cipher(algorithms.AES(key), modes.CB... | [
1,
2,
3,
4,
5
] |
import pytest
from mine.models import Application
class TestApplication:
"""Unit tests for the application class."""
app1 = Application("iTunes")
app1.versions.mac = "iTunes.app"
app2 = Application("HipChat")
app3 = Application("Sublime Text")
app3.versions.linux = "sublime_text"
app4 = ... | normal | {
"blob_id": "f4df7688ed927e1788ada0ef11f528eab5a52282",
"index": 4899,
"step-1": "<mask token>\n\n\nclass TestApplication:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @pytest.mark.parametrize('string,applic... | [
4,
5,
6,
7,
8
] |
# coding=utf-8
from datetime import datetime, timedelta
from flask import current_app as app
from flask_script import Command
from main import db
from models.payment import Payment
from models.product import ProductGroup, Product, PriceTier, Price, ProductView, ProductViewProduct
from models.purchase import Purchase
... | normal | {
"blob_id": "1de46ee2818b4cb2ae68ef5870581c341f8d9b04",
"index": 4020,
"step-1": "<mask token>\n\n\nclass CancelReservedTickets(Command):\n\n def run(self):\n payments = Purchase.query.filter(Purchase.state == 'reserved', \n Purchase.modified < datetime.utcnow() - timedelta(days=3), ~\n ... | [
6,
7,
9,
10,
11
] |
from nodes.Value import Value
class Number(Value):
def __init__(self, number: int):
if abs(number) > 2 ** 31:
raise SyntaxError(str(number) + ' number is out of range')
self.number = number
def __str__(self):
return str(self.number)
| normal | {
"blob_id": "7da274803de80f2864471d00c9d15aff1103372f",
"index": 3648,
"step-1": "<mask token>\n\n\nclass Number(Value):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Number(Value):\n <mask token>\n\n def __str__(self):\n return str(self.number)\n",
"step-3": "<mask ... | [
1,
2,
3,
4
] |
import vigra
import os
import sys
import time
import json
from simpleference.inference.inference import run_inference_n5
# from simpleference.backends.pytorch import PyTorchPredict
from simpleference.backends.pytorch import InfernoPredict
from simpleference.backends.pytorch.preprocess import preprocess
def single_g... | normal | {
"blob_id": "5ca990bdcbe9378747e438015beb46760b1e987b",
"index": 7212,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef single_gpu_inference(sample, gpu):\n raw_path = (\n '/groups/saalfeld/home/papec/Work/neurodata_hdd/cremi_warped/sample%s_inference.n5'\n % sample)\n model_pa... | [
0,
1,
2,
3,
4
] |
import os
import pickle
import PySimpleGUI as sg
from typing import Dict
sg.ChangeLookAndFeel('Black')
import string
from nltk.tokenize import word_tokenize
from itertools import chain
from glob import glob
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk.stem import PorterStemmer
fro... | normal | {
"blob_id": "46bf5866d5353c58e130b20ffa4d95df8abf986b",
"index": 6609,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsg.ChangeLookAndFeel('Black')\n<mask token>\nfor parole in words:\n parola = lmtzr.lemmatize(parole, 'v')\n appendFile = open('filteredtext.txt', 'a')\n appendFile.write(' ' + st... | [
0,
1,
2,
3,
4
] |
import requests
import json
URL = 'https://www.sms4india.com/api/v1/sendCampaign'
# get request
def sendPostRequest(reqUrl, apiKey, secretKey, useType, phoneNo, senderId, textMessage):
req_params = {
'apikey':EON386947EGSUZ4VEMIL8AWQX8RQW6UH,
'secret':FB2K25JVMFPEM310,
'usetype':useType,
'p... | normal | {
"blob_id": "c889fd081eb606dca08fade03aa0a4d32319f98d",
"index": 9362,
"step-1": "import requests\r\nimport json\r\n\r\nURL = 'https://www.sms4india.com/api/v1/sendCampaign'\r\n\r\n\r\n\r\n\r\n# get request\r\ndef sendPostRequest(reqUrl, apiKey, secretKey, useType, phoneNo, senderId, textMessage):\r\n req_param... | [
0
] |
from dependency_injector import containers, providers
from src.repositories import MemcachedRepository
from src.services import FibonacciService
class Container(containers.DeclarativeContainer):
config = providers.Configuration()
cache_repository = providers.Singleton(MemcachedRepository,
... | normal | {
"blob_id": "e8ba1ae98b247eaf90d83339e5fdc27287a70c73",
"index": 2561,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Container(containers.DeclarativeContainer):\n <mask token>\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Container(containers.DeclarativeContai... | [
0,
1,
2,
3,
4
] |
from string import maketrans
def to_rna(str):
strtrans = maketrans('ACGT', 'UGCA')
return str.translate(strtrans)
| normal | {
"blob_id": "aace7bc6684f4a9cec2f8fe270b5123a375780af",
"index": 8059,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef to_rna(str):\n strtrans = maketrans('ACGT', 'UGCA')\n return str.translate(strtrans)\n",
"step-3": "from string import maketrans\n\n\ndef to_rna(str):\n strtrans = make... | [
0,
1,
2
] |
from datetime import datetime
import cv2
import numpy as np
from sklearn.cluster import KMeans,MiniBatchKMeans
class FeatureGetter(object):
def __init__(self):
self.sift_det = cv2.xfeatures2d.SIFT_create()
def get_img(self, img_path):
img = cv2.imread(img_path)
return img
def get_fe... | normal | {
"blob_id": "630011b188548df9e55b6f1ddbefa08e322b9cba",
"index": 169,
"step-1": "<mask token>\n\n\nclass FeaturesBuilder(object):\n <mask token>\n\n def getClusterCentures(self):\n start_time = datetime.now()\n feature_getter = FeatureGetter()\n des_list = []\n des_matrix = np.z... | [
5,
7,
8,
10,
12
] |
from PIL import Image, ImageDraw, ImageFont
from PIL.ExifTags import TAGS
from datetime import datetime
#Extracts the timestamp from the filename and inserts it into the image
def insert_timestamp_from_filename_into_image(path_to_image:str,
ignorable_string:str,
output_filename:str = "",
distance_to_border:int = 5, ... | normal | {
"blob_id": "e6ab18d87ace00436a480f4f01da224eead84fc0",
"index": 5145,
"step-1": "<mask token>\n\n\ndef insert_timestamp_from_filename_into_image(path_to_image: str,\n ignorable_string: str, output_filename: str='', distance_to_border: int\n =5, color_of_timestamp: tuple=(0, 0, 0), size_of_timestamp: int=2... | [
2,
3,
4,
5,
6
] |
import pandas as pd
from pandas.io.json import json_normalize
import numpy as np
import warnings
import re
warnings.filterwarnings("ignore")
data_path = '/Users/trietnguyen/Documents/Thesis/Thesis-2020/References/Crawler/summaryDataJson.json'
weights = ['mg', 'ml', '%']
def formatName(name):
arr = re.split(' |-'... | normal | {
"blob_id": "b808daf8d1fbe3cc585db57e1049a502d3ca46f5",
"index": 857,
"step-1": "<mask token>\n\n\ndef formatName(name):\n arr = re.split(' |-', name)\n print(arr)\n gweight = ''\n gname = []\n gnumber = ''\n for word in arr:\n if any(str.isdigit(c) for c in word):\n for weigh... | [
5,
6,
7,
8,
9
] |
import os
import closet
import unittest
import tempfile
def in_response(response, value):
return value.encode() in response.data
def is_404(response):
response.status_code == 404
class ClosetTestBase(unittest.TestCase):
def setUp(self):
"""Set up test environment befor each test"""
se... | normal | {
"blob_id": "a5856e12c281ed6a252f499a380f9c51082ea740",
"index": 3711,
"step-1": "<mask token>\n\n\nclass ModelBase(unittest.TestCase):\n <mask token>\n <mask token>\n\n def get(self, url):\n \"\"\"Process a GET request to the app\"\"\"\n return self.app.get(get_url(url), follow_redirects=... | [
31,
43,
44,
49,
56
] |
/Users/linhly/anaconda/lib/python3.6/reprlib.py | normal | {
"blob_id": "127ca34d3fae3af4506258388a28c539ccc7c33b",
"index": 4120,
"step-1": "/Users/linhly/anaconda/lib/python3.6/reprlib.py",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 4 20:55:22 2017
@author: Ivan
"""
# -----------
# User Instructions
#
# Modify the test() function to include two new test cases:
# 1) four of a kind (fk) vs. full house (fh) returns fk.
# 2) full house (fh) vs. full house (fh) returns fh.
#
# Since the program is stil... | normal | {
"blob_id": "90ae6fe37cea2c07d8308498c62460c10ca46846",
"index": 5945,
"step-1": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed Oct 4 20:55:22 2017\n\n@author: Ivan\n\"\"\"\n\n# -----------\n# User Instructions\n# \n# Modify the test() function to include two new test cases:\n# 1) four of a kind (fk) vs. full... | [
0
] |
s = 'Daum KaKao'
# s_split = s.split()
# s = s_split[1] + ' ' + s_split[0]
s = s[5:] + ' ' + s[:4]
print(s) | normal | {
"blob_id": "32c62bb8b6e4559bb7dfc67f4311bc8e71e549c9",
"index": 6942,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(s)\n",
"step-3": "s = 'Daum KaKao'\ns = s[5:] + ' ' + s[:4]\nprint(s)\n",
"step-4": "s = 'Daum KaKao'\n# s_split = s.split()\n# s = s_split[1] + ' ' + s_split[0]\ns = s[5:] + ' ... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
# made for comparing unfiltered and filtered scorefiles for Rosetta enzdes post analysis
import argparse
import collections
import re
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
def data_from_sc_file(axes, f, uf, true_max):
... | normal | {
"blob_id": "17b0baef5e366d70ea393259df1965e75b7d12e1",
"index": 5789,
"step-1": "#!/usr/bin/env python\n\n# made for comparing unfiltered and filtered scorefiles for Rosetta enzdes post analysis\n\nimport argparse\nimport collections\nimport re\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotl... | [
0
] |
import tty
import sys
import termios
def init():
orig_settings = termios.tcgetattr(sys.stdin)
tty.setcbreak(sys.stdin)
return orig_settings
def get_input():
return sys.stdin.read(1)
def exit(orig_settings):
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, orig_settings)
if __name__ == "__main... | normal | {
"blob_id": "c64e41609a19a20f59446399a2e864ff8834c3f0",
"index": 4322,
"step-1": "<mask token>\n\n\ndef get_input():\n return sys.stdin.read(1)\n\n\ndef exit(orig_settings):\n termios.tcsetattr(sys.stdin, termios.TCSADRAIN, orig_settings)\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef init():\n ... | [
2,
3,
4,
5,
6
] |
v = 426
# print 'Yeah!' if dividable by 4 but print 'End of program' after regardless
if (v%4) == 0:
print ("Yeah!")
else:
print ("End of the program")
| normal | {
"blob_id": "ceca1be15aded0a842c5f2c6183e4f54aba4fd24",
"index": 6752,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif v % 4 == 0:\n print('Yeah!')\nelse:\n print('End of the program')\n",
"step-3": "v = 426\nif v % 4 == 0:\n print('Yeah!')\nelse:\n print('End of the program')\n",
"step... | [
0,
1,
2,
3
] |
#!/usr/bin/python
debug = 0
if debug == 1:
limit = [8,20]
n = 3
p = [[2,10],[10,12],[8,30],[1,5]]
#n = 1
# p = [[8,30]]
print limit
print n
print p
def isIn(arr):
if arr[0] > limit[1] or arr[1] < limit[0] or \
arr[1] == 0:
return False
else:
return True
... | normal | {
"blob_id": "c8d27965df83eb3e673b3857ee700a8474826335",
"index": 3895,
"step-1": "#!/usr/bin/python\n\n\ndebug = 0\n\nif debug == 1:\n limit = [8,20]\n n = 3\n p = [[2,10],[10,12],[8,30],[1,5]]\n #n = 1\n # p = [[8,30]] \n print limit\n print n\n print p\n\ndef isIn(arr):\n\n if arr[0]... | [
0
] |
import dash_table
import pandas as pd
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output
from dash_oop_components import DashComponent
import dash_table
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output, State
from dash_oo... | normal | {
"blob_id": "485f85ec5e3f38148978453ea5e7f9a54eb310e1",
"index": 160,
"step-1": "<mask token>\n\n\nclass Table(DashComponent):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Table(DashComponent):\n\n def __init__(self, plot_factory, df, title='... | [
1,
3,
5,
6,
7
] |
# cases where DictAchievement should unlock
# >> CASE
{'name': 'John Doe', 'age': 24}
# >> CASE
{
'name': 'John Doe',
'age': 24
}
# >> CASE
func({'name': 'John Doe', 'age': 24})
| normal | {
"blob_id": "874fa2a6afdd04f3f2232a86f56d220447160ede",
"index": 5167,
"step-1": "<mask token>\n",
"step-2": "{'name': 'John Doe', 'age': 24}\n{'name': 'John Doe', 'age': 24}\nfunc({'name': 'John Doe', 'age': 24})\n",
"step-3": "# cases where DictAchievement should unlock\n\n# >> CASE\n{'name': 'John Doe', '... | [
0,
1,
2
] |
# Copyright (c) 2020, Galois, Inc.
#
# All Rights Reserved
#
# This material is based upon work supported by the Defense Advanced Research
# Projects Agency (DARPA) under Contract No. FA8750-20-C-0203.
#
# Any opinions, findings and conclusions or recommendations expressed in this
# material are those of the author(s) ... | normal | {
"blob_id": "41294c803cf42611fa003f21b74a49dd5576a8e8",
"index": 5973,
"step-1": "<mask token>\n\n\nclass MigrationVisitor(semtk.DefaultSemTKVisitor):\n\n def __init__(self, data: RemoveIsATypeOf):\n self.data = data\n",
"step-2": "<mask token>\n\n\n@dataclass\nclass RemoveIsATypeOf(OntologyChange):\... | [
2,
5,
6,
7,
8
] |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from collections import defaultdict
from past.builtins import basestring
from pycolocstats.core.config import REF_COLL_GSUITES_PATH
__metaclass__ = type
class RefTrackCollectionRegistry(object):
PREBUILT = '__prebuilt_... | normal | {
"blob_id": "9c2cc5b993f020b8a1c96ea4cd5c2fb2da44a251",
"index": 1534,
"step-1": "<mask token>\n\n\nclass RefTrackCollectionRegistry(object):\n <mask token>\n\n def __init__(self):\n self._genome2TrackIndexReg = defaultdict(set)\n self._trackIndex2CollectionReg = defaultdict(set)\n sel... | [
6,
7,
8,
10,
11
] |
from PyQt5.QtWidgets import QHeaderView, QWidget
from presenters.studyings_presenter import StudyingsPresenter
from view.q_objects_view import QObjectsView
class QStudyingsView(QObjectsView):
def __init__(self, parent):
QWidget.__init__(self, parent)
QObjectsView.__init__(self, parent)
se... | normal | {
"blob_id": "f7174bf4e7612921e730ac87141c85654a2f2411",
"index": 6194,
"step-1": "<mask token>\n\n\nclass QStudyingsView(QObjectsView):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass QStudyingsView(QObjectsView):\n <mask token>\n\n def init_table(self):\n self.table.set... | [
1,
2,
3,
4
] |
"""
Estructuras que extraen valores de una función y se almacenan en objetos iterables (que se pueden recorrer
Son mas eficientes que las funciones tradicionales
muy útiles con listas de valores infinitos
Bajos determinados escenarios, será muy útil que un generador devuelva los valores de uno en uno
Un generador ... | normal | {
"blob_id": "29abcfc010453e3a67346ea2df238e07b85502a8",
"index": 3107,
"step-1": "<mask token>\n\n\ndef generarPares(limite):\n num = 1\n milista = []\n while num < limite:\n milista.append(num * 2)\n num += 1\n return milista\n\n\n<mask token>\n\n\ndef devuelveCiudades2(*ciudades):\n ... | [
2,
5,
6,
7,
8
] |
from .submit import *
from .fck import *
| normal | {
"blob_id": "9a5ba88a61f5c27c0bc7b980fa9d865b52cbbb20",
"index": 7266,
"step-1": "<mask token>\n",
"step-2": "from .submit import *\nfrom .fck import *\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
# coding: utf-8
import numpy as np
def sparse(n, k):
u"""
return k sparse vector,
the value of non-zero entries are
normal distributed N(0,1).
[args]
n: size of vector
k: number of nonzero entries
[return]
k-sparse vector
"""
z = np.zeros(n)
for i in np.r... | normal | {
"blob_id": "f0e4cd13571728d61566c4093586c91323629e0b",
"index": 7624,
"step-1": "# coding: utf-8\nimport numpy as np\n\n\n\ndef sparse(n, k):\n u\"\"\"\n return k sparse vector, \n the value of non-zero entries are \n normal distributed N(0,1).\n [args]\n n: size of vector\n k: numb... | [
0
] |
import copy
import random
def parse_arrow(string):
return tuple(string.split(' -> '))
def parse_sig(string, vals=None):
parts = string.split()
if len(parts) == 1:
return resolve(parts[0], vals)
elif parts[1] == 'AND':
return resolve(parts[0], vals) & resolve(parts[2], vals)
elif ... | normal | {
"blob_id": "a4492af775899ec2dcc0cac44b2740edd8422273",
"index": 6012,
"step-1": "import copy\nimport random\n\n\ndef parse_arrow(string):\n return tuple(string.split(' -> '))\n\n\ndef parse_sig(string, vals=None):\n parts = string.split()\n if len(parts) == 1:\n return resolve(parts[0], vals)\n ... | [
0
] |
# Generated by Django 2.2.6 on 2019-12-08 22:18
import django.contrib.gis.db.models.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='company'... | normal | {
"blob_id": "9af71eaf8f6f4daacdc1def7b8c5b29e6bac6b46",
"index": 4897,
"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 = [('backend', '... | [
0,
1,
2,
3,
4
] |
from typing import List
import tensorflow as tf
from tensorflow.keras.layers import Dense
"""Possible agent network structures implemented as Tensorflow Modules"""
class QNetwork:
"""Create the neural network architecture for the DQN agent."""
def __init__(
self,
state_dim: int,
act... | normal | {
"blob_id": "a3e655350fb5fe7999bea4a87fb62c7698fb63f1",
"index": 6663,
"step-1": "<mask token>\n\n\nclass QNetwork:\n <mask token>\n\n def __init__(self, state_dim: int, action_dim: int=3,\n hidden_layer_sizes: List=[128, 256, 256, 128], activation: str='relu'):\n self._state_dim = state_dim\... | [
2,
3,
4,
5,
6
] |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
import dbindexer
dbindexer.autodiscover() #This needs to happen before anything else, hence strange import ordering
urlpatterns = patterns('harvester.views'... | normal | {
"blob_id": "9fc9d766915bcefde4f0ba5c24cb83e33fc66272",
"index": 1094,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ndbindexer.autodiscover()\n<mask token>\n",
"step-3": "<mask token>\ndbindexer.autodiscover()\nurlpatterns = patterns('harvester.views', url('^$', 'home', name='home'),\n url('^settin... | [
0,
1,
2,
3,
4
] |
from pytorch_lightning.callbacks import Callback
from evaluation.validator import Validator
class LSTMCallback(Callback):
def on_test_end(self, trainer, pl_module):
f = open('/evaluation.log', 'w')
for ev in pl_module.evaluation_data:
f.write(ev + '\n')
Validator(pl_module.eva... | normal | {
"blob_id": "42743ee2a812d8fe6fc036ba97daaff5be35564d",
"index": 4618,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass LSTMCallback(Callback):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass LSTMCallback(Callback):\n\n def on_test_end(self, trainer, pl_module):\n f = open('/... | [
0,
1,
2,
3
] |
from celery import shared_task
import tweepy
from datetime import datetime, timedelta
from .models import Tweet
from django.db import IntegrityError
CONSUMER_KEY = 'Vp7FVQLSwESvE9oTQruw0TnhW'
CONSUMER_SECRET = 'miy6EsGklNYxAaVn37vTjAVGwP0c67IOyuY71AAyL1p2Ba4VPN'
ACCESS_TOKEN = '1952022900-5WAHk6l5d3GllFtqDPaucSpnraIo... | normal | {
"blob_id": "d4d19411f0c48ffb99bd17e8387f1741144e43b4",
"index": 870,
"step-1": "<mask token>\n\n\n@shared_task(name='clean_tweetdb')\ndef clean_tweetdb():\n tweets = Tweet.objects.all()\n for tweets.tweet_date in tweets:\n if tweets.tweet_date <= datetime.now() - timedelta(days=8):\n twe... | [
2,
3,
4,
5,
6
] |
__author__ = 'changwoncheo'
# -*- coding: utf-8 -*-
import threading
import logging
logging.basicConfig(filename='crawl2.log',level=logging.DEBUG)
class NoParsingFilter(logging.Filter):
def filter(self, record):
msg = record.getMessage()
return not ('Starting' in msg or 'GET' in msg)
logger = loggin... | normal | {
"blob_id": "a52f009a755b45f8ed653a4a0385b1eb667f2318",
"index": 9797,
"step-1": "__author__ = 'changwoncheo'\n# -*- coding: utf-8 -*-\nimport threading\nimport logging\nlogging.basicConfig(filename='crawl2.log',level=logging.DEBUG)\nclass NoParsingFilter(logging.Filter):\n def filter(self, record):\n ... | [
0
] |
# You have an array arr of length n where arr[i] = (2 * i) + 1 for all valid values of i (i.e. 0 <= i < n).
# In one operation, you can select two indices x and y where 0 <= x, y < n and subtract 1 from arr[x] and add 1 to arr[y]
# (i.e. perform arr[x] -=1 and arr[y] += 1). The goal is to make all the elements of the... | normal | {
"blob_id": "d67842c05af9241dbe7e038a9b2dc4223ee7ef4d",
"index": 8055,
"step-1": "<mask token>\n",
"step-2": "def minOps(n):\n if n <= 1:\n return 0\n res = 0\n if n % 2 == 1:\n for i in range(1, n // 2 + 1):\n res += i * 2\n return res\n else:\n for j in rang... | [
0,
1,
2,
3,
4
] |
from mrjob.job import MRJob
from mrjob.step import MRStep
from collections import Counter
import csv
def read_csvLine(line):
# Given a comma delimited string, return fields
for row in csv.reader([line]):
return row
class MRTopVisitorCount(MRJob):
# Mapper1: emit page_id, 1
def mapper_coun... | normal | {
"blob_id": "471ce1eeb3293a424de74e25f36b76699a97ec2b",
"index": 7039,
"step-1": "<mask token>\n\n\nclass MRTopVisitorCount(MRJob):\n <mask token>\n <mask token>\n\n def mapper_sort(self, page, counts):\n top = Counter(counts).most_common(1)\n yield page, (top[0][0], top[0][1])\n\n def ... | [
3,
6,
7,
8,
10
] |
import tensorflow as tf
def build_shared_network(x, add_summaries=False):
conv1 = tf.layers.conv2d(x, 16, 8, 4, activation=tf.nn.relu, name="conv1")
conv2 = tf.layers.conv2d(conv1, 32, 4, 2, activation=tf.nn.relu, name="conv2")
fc1 = tf.layers.dense(tf.layers.flatten(conv2), 256, name="fc1")
if add_s... | normal | {
"blob_id": "0fbf8efd39f583581c46fcd3f84c65a7787145cd",
"index": 847,
"step-1": "<mask token>\n\n\nclass PolicyEstimator:\n <mask token>\n\n\nclass ValueEstimator:\n\n def __init__(self, reuse=False, trainable=True):\n self.states = tf.placeholder(shape=[None, 84, 84, 4], dtype=tf.\n uint... | [
3,
4,
5,
6,
7
] |
# terrascript/external/__init__.py
import terrascript
class external(terrascript.Provider):
pass | normal | {
"blob_id": "04e57739e6fb98cd237fbe09caecd17c728c1797",
"index": 5548,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass external(terrascript.Provider):\n pass\n",
"step-3": "import terrascript\n\n\nclass external(terrascript.Provider):\n pass\n",
"step-4": "# terrascript/external/__init... | [
0,
1,
2,
3
] |
import pandas as pd
from datetime import datetime
from iFinDPy import *
thsLogin = THS_iFinDLogin("iFind账号","iFind账号密码")
index_list = ['000001.SH','399001.SZ','399006.SZ']
result = pd.DataFrame()
today =datetime.today().strftime('%Y-%m-%d')
for index in index_list:
data_js = THS_DateSerial(index,'ths_pre_clo... | normal | {
"blob_id": "7f62af951b49c3d1796c2811527ceb30ca931632",
"index": 8607,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor index in index_list:\n data_js = THS_DateSerial(index,\n 'ths_pre_close_index;ths_open_price_index;ths_close_price_index;ths_high_price_index'\n , ';;;', 'Days:Traded... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 30 14:34:56 2019
ref :
https://stackoverflow.com/questions/11140163/plotting-a-3d-cube-a-sphere-and-a-vector-in-matplotlib
@author: jiedeng
"""
import numpy as np
from itertools import product, combinations
from mpl_toolkits.mplot3d.art3d impor... | normal | {
"blob_id": "086c74669b6762a6b35e8a46f816db2f4f172caa",
"index": 1437,
"step-1": "<mask token>\n\n\ndef switch_y_z(inter, liq_cutoff, vap_cutoff, liq_in, vap_in, int_in):\n triangles = inter.triangulated_surface[0][inter.triangulated_surface[1]]\n interface1 = np.zeros_like(triangles)\n interface2 = np.... | [
2,
3,
4,
5,
6
] |
from itertools import takewhile
import numpy as np
from .rrt import TreeNode
from .trajectory.linear import get_default_limits, solve_linear
from .trajectory.retime import spline_duration
from .utils import argmin, negate, circular_difference, UNBOUNDED_LIMITS, get_distance, get_delta
ASYMETRIC = True
def asymmetr... | normal | {
"blob_id": "84febcc599aa97858ded3b6f803b6b76960878d4",
"index": 7188,
"step-1": "<mask token>\n\n\ndef asymmetric_extend(q1, q2, extend_fn, backward=False):\n if backward and ASYMETRIC:\n return reversed(list(extend_fn(q2, q1)))\n return extend_fn(q1, q2)\n\n\n<mask token>\n\n\ndef calculate_radius... | [
7,
8,
10,
12,
13
] |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 21 15:09:26 2017
@author: Jieun
"""
from scipy.stats import invgauss
from scipy.stats import norm
# rv = invgauss.ppf(0.95,mu)
# a = 8/(2*rv)
# print a
# norm.ppf uses mean = 0 and stddev = 1, which is the "standard" normal distribution
# can use a different mean and s... | normal | {
"blob_id": "c9e0586942430fcd5b81c5716a06a4eef2c2f203",
"index": 3178,
"step-1": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Feb 21 15:09:26 2017\n\n@author: Jieun\n\"\"\"\n\nfrom scipy.stats import invgauss\nfrom scipy.stats import norm\n\n# rv = invgauss.ppf(0.95,mu) \n# a = 8/(2*rv)\n# print a\n# norm.pp... | [
0
] |
import turtle
import math
from tkinter import *
#活性边表节点:
class AetNode(object):
def __init__(self,x,tx,my):
self.x=x
self.tx=tx
self.my=my
def op(self):
return self.x
class AetList(object):
def __init__(self,y):
self.y=y
self.numy=0
self.l=[]
p... | normal | {
"blob_id": "0a7a95755924fd264169286cc5b5b7587d7ee8e4",
"index": 4608,
"step-1": "<mask token>\n\n\nclass AetNode(object):\n\n def __init__(self, x, tx, my):\n self.x = x\n self.tx = tx\n self.my = my\n\n def op(self):\n return self.x\n\n\nclass AetList(object):\n\n def __ini... | [
8,
10,
11,
12,
14
] |
a, b, c = map(int, input().split())
frag = 'NO'
for i in range(b - 1):
if (i + 1) * a % b == c:
frag = 'YES'
break
print(frag)
| normal | {
"blob_id": "6ad36f2b115c822a50a38e88a8d7d524fc5b045b",
"index": 195,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(b - 1):\n if (i + 1) * a % b == c:\n frag = 'YES'\n break\nprint(frag)\n",
"step-3": "a, b, c = map(int, input().split())\nfrag = 'NO'\nfor i in range(b -... | [
0,
1,
2
] |
import os
import sys
import time
from collections import deque
import pickle
import random
import string
from tensorflow.python.framework.errors import InvalidArgumentError
from baselines.ddpg.ddpg import DDPG
import baselines.common.tf_util as U
from baselines.ddpg import prosthetics_env
from baselines import logger... | normal | {
"blob_id": "3f92bf194058c97a40cd5728cfc7c9d1be6b2548",
"index": 8099,
"step-1": "<mask token>\n\n\ndef train(env, nb_epochs, nb_epoch_cycles, render_eval, reward_scale,\n render, param_noise, actor, critic, normalize_returns,\n normalize_observations, critic_l2_reg, actor_lr, critic_lr,\n action_noise,... | [
2,
3,
4,
5,
6
] |
from .parse_categories import extract_categories
from .parse_sections import extract_sections
from .utils import remove_xml_comments
def parse_page(page):
if 'redirect' in page.keys():
return
page_text = page['revision']['text']['#text']
page_text = remove_xml_comments(page_text)
title = page[... | normal | {
"blob_id": "0ad2e6d7e3fd61943fc1dfe6662110a6f48c1bd5",
"index": 5347,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef parse_page(page):\n if 'redirect' in page.keys():\n return\n page_text = page['revision']['text']['#text']\n page_text = remove_xml_comments(page_text)\n title ... | [
0,
1,
2
] |
i = 0
while i >= 0:
a=input("Name is: ")
print(a)
if a == "Zeal":
print("""Name_Zeal.
Age_16.
Interested in Programming.""")
elif a=="HanZaw":
print("""Name_Han Zaw.
Age_18.
Studying Code at Green Hacker.""")
elif a == "Murphy":
print("""Name_Murphy.
... | normal | {
"blob_id": "38184ed4117b1b7dcf9e135ce8612fa13c44a99c",
"index": 5891,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile i >= 0:\n a = input('Name is: ')\n print(a)\n if a == 'Zeal':\n print('Name_Zeal.\\n Age_16.\\n Interested in Programming.')\n elif a == 'HanZaw':\n ... | [
0,
1,
2,
3
] |
'''
@author: Ken Venner
@contact: ken@venerllc.com
@version: 1.13
Read in a file of wine names and create consistent wine descriptions
from these names.
'''
import kvutil
import kvcsv
import re
import sys
import shutil
# may comment out in the future
import pprint
pp = pprint.PrettyPrinte... | normal | {
"blob_id": "d786e89b9d478dcff3c541c89731247075d078c3",
"index": 678,
"step-1": "<mask token>\n\n\ndef globalVariableCheck(debug=False):\n for liquor in liquorLookup:\n if liquor in noGrapeLookup:\n print(\n 'WARNING:liquorLookup regexs will never execute - they are in noGrape... | [
7,
13,
15,
18,
19
] |
def divide(file):
index = 0
head = ''
while True:
if file[index].isnumeric():
head_index = index
break
if file[index].isalpha():
head += file[index].lower()
else:
head += file[index]
index += 1
while True:
if index >... | normal | {
"blob_id": "75837ab778e94693151de1c17b59e12f8b2336d3",
"index": 8341,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef solution(files):\n ans = []\n for i, file in enumerate(files):\n head, number, tail = divide(file)\n ans.append((head, number, i))\n ans.sort(key=lambda x: ... | [
0,
1,
2
] |
from LinkedList import LinkedList
from LinkedListHelper import CreateLinkedList
class LinkedListMod(LinkedList):
def remove_allnode(self):
while self.head:
temp = self.head
self.head = self.head.next
del temp
def main():
l1 = LinkedListMod()
CreateLinkedList(l1)
... | normal | {
"blob_id": "45b20b57a3579c2527c674d0c2af88eedddadcae",
"index": 3724,
"step-1": "<mask token>\n\n\nclass LinkedListMod(LinkedList):\n\n def remove_allnode(self):\n while self.head:\n temp = self.head\n self.head = self.head.next\n del temp\n\n\n<mask token>\n",
"step... | [
2,
3,
4,
5,
6
] |
# 選択肢が書き換えられないようにlistではなくtupleを使う
chose_from_two = ('A', 'B', 'C')
answer = []
answer.append('A')
answer.append('C')
print(chose_from_two)
# ('A', 'B', 'C')
print(answer)
# ['A', 'C'] | normal | {
"blob_id": "70b26052d9516fd067ff71074a6dc4c58ace7d80",
"index": 5513,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nanswer.append('A')\nanswer.append('C')\nprint(chose_from_two)\nprint(answer)\n",
"step-3": "chose_from_two = 'A', 'B', 'C'\nanswer = []\nanswer.append('A')\nanswer.append('C')\nprint(ch... | [
0,
1,
2,
3
] |
import numpy as np
import json
from netCDF4 import Dataset,stringtochar,chartostring,Variable,Group
def is_json(myjson):
try:
json_object = json.loads(myjson)
except:
return False
return True
def getType(type):
t=np.dtype(type).char
if t=="S":return 'S1'
if t=="U":return 'U1'
return t
def get... | normal | {
"blob_id": "57490e56833154d3ed3a18b5bf7bc4db32a50d69",
"index": 2979,
"step-1": "<mask token>\n\n\ndef prepareTransformAttributes(attributes):\n dtype = attributes.get('type')\n dtype = '{}'.format(dtype)\n min = attributes.get('min')\n max = attributes.get('max')\n ftype = attributes.get('ftype'... | [
6,
7,
11,
12,
13
] |
from flask import Flask, send_file
import StringIO
app = Flask(__name__)
@app.route('/')
def index():
strIO = StringIO.StringIO()
strIO.write('Hello from Dan Jacob and Stephane Wirtel !')
strIO.seek(0)
return send_file(strIO,
attachment_filename="testing.txt",
... | normal | {
"blob_id": "45335fa5d4773bdd0ef3e6c340fe06e84169be5e",
"index": 8708,
"step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n strIO = StringIO.StringIO()\n strIO.write('Hello from Dan Jacob and Stephane Wirtel !')\n strIO.seek(0)\n return send_file(strIO, attachment_filename='testing.txt',\n ... | [
1,
2,
3,
4,
5
] |
from django.apps import AppConfig
class AppValidationsConfig(AppConfig):
name = 'app_validations'
| normal | {
"blob_id": "7a6a8b5e344a7b60e369f100885d1e26afa28f46",
"index": 7600,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass AppValidationsConfig(AppConfig):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass AppValidationsConfig(AppConfig):\n name = 'app_validations'\n",
"step-4": "from ... | [
0,
1,
2,
3
] |
# Generated by Django 4.0.5 on 2023-02-14 18:57
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0020_festival_boxoffice_close_festival_boxoffice_open'),
]
operations = [
migrations.AlterModelOptions(
name='user',
... | normal | {
"blob_id": "e9bf5a40360d35f32bd2ad5aa404225f49895a14",
"index": 4221,
"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 = [('core',\n ... | [
0,
1,
2,
3,
4
] |
# Copyright 2021 TerminalWarlord under the terms of the MIT
# license found at https://github.com/TerminalWarlord/Subtitle-Downloader-Bot/blob/master/LICENSE
# Encoding = 'utf-8'
# Fork and Deploy, do not modify this repo and claim it yours
# For collaboration mail me at dev.jaybee@gmail.com
from pyrogram impo... | normal | {
"blob_id": "ecbb64223b0d5aa478cf91e1fcafe45572eac1af",
"index": 6197,
"step-1": "<mask token>\n\n\n@app.on_message(filters.command('start'))\ndef start(client, message):\n kb = [[InlineKeyboardButton('🍿 Channel', url=\n 'https://telegram.me/MyTestBotZ'), InlineKeyboardButton(\n '🍿 BotsList', ... | [
12,
13,
14,
15,
16
] |
# -*- coding: utf-8 -*-
# Copyright 2014 Foxdog Studios
#
# 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 l... | normal | {
"blob_id": "e103e7a215614e1a7923838b775f49bba2792036",
"index": 8508,
"step-1": "<mask token>\n\n\nclass MethodMessageParserTestCase(unittest.TestCase):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass MethodMessageParserTestCase(unittest.TestCase):\n <mask token>\n\n def test_... | [
1,
2,
3,
4,
5
] |
import sqlite3
forth = sqlite3.connect('databaserupin.db')
sql = "SELECT * from rupin;"
curforth = forth.cursor()
curforth.execute(sql)
result = curforth.fetchall()
for record in result:
print(record) | normal | {
"blob_id": "a7f082737bf476a4bc6a40c962764c05bed9ee14",
"index": 9247,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ncurforth.execute(sql)\n<mask token>\nfor record in result:\n print(record)\n",
"step-3": "<mask token>\nforth = sqlite3.connect('databaserupin.db')\nsql = 'SELECT * from rupin;'\ncur... | [
0,
1,
2,
3,
4
] |
import requests
from datetime import datetime, timedelta
from . import base
class YoutubeVerifier(base.SimpleVerifier):
def __init__(self, channel_id, access_token):
self.channel_id = channel_id
self.access_token = access_token
self.headers = {
'Authorization': 'Bearer {}'.fo... | normal | {
"blob_id": "7ba2377b7d4f8d127cfee63c856d20753da9b7c6",
"index": 4526,
"step-1": "<mask token>\n\n\nclass YoutubeVerifier(base.SimpleVerifier):\n <mask token>\n <mask token>\n\n def get_follower_info(self):\n \"\"\"\n Get follower information from youtube api subscriptions\n\n :rtyp... | [
2,
3,
4,
5,
6
] |
from wrapper import SeleniumWrapper
from selenium.webdriver.common.by import By
class PageDetector:
def __init__(self, driver):
self.selenium = SeleniumWrapper(driver)
def detect(self):
if self.selenium.wait_for_presence(locator=(By.ID, "teams-app-bar"), timeout=30):
if sel... | normal | {
"blob_id": "603d7df0639def2b620cca2299077674e35a74b2",
"index": 5980,
"step-1": "<mask token>\n\n\nclass PageDetector:\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass PageDetector:\n\n def __init__(self, driver):\n self.selenium = SeleniumWrapper(driver)\n <mask token>\... | [
1,
2,
3,
4,
5
] |
from .standup import *
from .auth_register import *
from .channels_create import *
import pytest
# If channel does not exist
def test_notExisting_channel():
db.reset_DB()
auth_register('testmail@gmail.com', 'pas123456', 'Bob', 'Smith')
realtoken = Token.generateToken('testmail@gmail.com')
fake_channel = ... | normal | {
"blob_id": "b6715ad42d59720eb021973394a0b7bfd540181b",
"index": 4338,
"step-1": "<mask token>\n\n\ndef test_notExisting_channel():\n db.reset_DB()\n auth_register('testmail@gmail.com', 'pas123456', 'Bob', 'Smith')\n realtoken = Token.generateToken('testmail@gmail.com')\n fake_channel = 70\n with ... | [
2,
3,
4,
5,
6
] |
# Project Overview
# Implement the k-means algorithm and apply your implementation on the given dataset,
# which contains a set of 2-D points.
# Import Libraries
import scipy.io
import pandas as pd
import matplotlib.pyplot as plt
import random
import numpy as np
import time
print("\nProgram Started :",tim... | normal | {
"blob_id": "b734a4405d1f5b3650d7149ae80e14548e2dbda4",
"index": 4297,
"step-1": "<mask token>\n\n\ndef map_cluster_data(data, K):\n clusterDataMap = {}\n for k in range(K):\n clusterDataMap[k + 1] = np.array([]).reshape(2, 0)\n for i in range(m):\n clusterDataMap[clusters[i]] = np.c_[clus... | [
3,
5,
6,
7,
9
] |
from django.shortcuts import render, redirect
from django.contrib.auth import authenticate, logout, login
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.views import View
class login_view(View):
template... | normal | {
"blob_id": "e4e2e8ca65d109805b267f148e8d255d81d4ee83",
"index": 1801,
"step-1": "<mask token>\n\n\nclass logout_view(View):\n\n def get(self, request):\n logout(request)\n return redirect('adminbiobses:login')\n\n\n@method_decorator(login_required, name='dispatch')\nclass index(View):\n temp... | [
5,
6,
7,
8,
11
] |
from django.apps import AppConfig
class AccountsnConfig(AppConfig):
name = 'accounts'
| normal | {
"blob_id": "a3fc624d6d101667ab11842eac96ed1b34d4317e",
"index": 3369,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass AccountsnConfig(AppConfig):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass AccountsnConfig(AppConfig):\n name = 'accounts'\n",
"step-4": "from django.apps impor... | [
0,
1,
2,
3
] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Import the otb applications package
import otbApplication
def ComputeHaralick(image, chan, xrad, yrad):
# The following line creates an instance of the HaralickTextureExtraction application
HaralickTextureExtraction = otbApplication.Registry.CreateApplication("Haral... | normal | {
"blob_id": "b4992a5b396b6809813875443eb8dbb5b00eb6a9",
"index": 4865,
"step-1": "#!/usr/bin/python \n# -*- coding: utf-8 -*-\n\n# Import the otb applications package \nimport otbApplication \n \ndef ComputeHaralick(image, chan, xrad, yrad):\n\n\t# The following line creates an instance of the HaralickTextureExt... | [
0
] |
# Python 3 program - Currency Sum Validator
# def bill_count
def bill_count(amount_user, list_of_money_bills):
n = len(list_of_money_bills)
# Initialize Result
ans = []
# Traverse through all the list
i = n - 1
while (i >= 0):
# Find list
while (amount_user >= list_of_mo... | normal | {
"blob_id": "53c5f298dbfb21d7688fef8f0312858e2fd73d79",
"index": 4423,
"step-1": "<mask token>\n",
"step-2": "def bill_count(amount_user, list_of_money_bills):\n n = len(list_of_money_bills)\n ans = []\n i = n - 1\n while i >= 0:\n while amount_user >= list_of_money_bills[i]:\n am... | [
0,
1,
2,
3
] |
import json
# numbers=[2,3,5,7,11,13]
filename='numbers.json'
with open(filename) as f:
numbers=json.load(f)
print(numbers) | normal | {
"blob_id": "8da775bd87bfeab5e30956e62bcdba6c04e26b27",
"index": 6720,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open(filename) as f:\n numbers = json.load(f)\nprint(numbers)\n",
"step-3": "<mask token>\nfilename = 'numbers.json'\nwith open(filename) as f:\n numbers = json.load(f)\nprin... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
# @Author: Lich_Amnesia
# @Email: alwaysxiaop@gmail.com
# @Date: 2016-11-17 11:00:33
# @Last Modified time: 2016-11-17 11:00:34
# @FileName: 346.py
class MovingAverage(object):
def __init__(self, size):
"""
Initialize your data structure here.
:type size: int
... | normal | {
"blob_id": "9e37b728d8045726aef7625fccc14111ecb0e1c8",
"index": 5578,
"step-1": "<mask token>\n",
"step-2": "class MovingAverage(object):\n <mask token>\n <mask token>\n",
"step-3": "class MovingAverage(object):\n\n def __init__(self, size):\n \"\"\"\n Initialize your data structure h... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-12-01 16:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('monitor', '0001_initial'),
]
operations = [
migrations.RemoveField(
... | normal | {
"blob_id": "1573af9cdf4817acbe80031e22489386ea7899cf",
"index": 4782,
"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 = [('monitor', '... | [
0,
1,
2,
3,
4
] |
import numpy as np
import pandas as pd
import xgboost as xgb
from sklearn.metrics import confusion_matrix
USE_MEMMAP = True
data = pd.read_csv( 'dataset.csv' ).as_matrix()
X = data[ :, 0:-1 ]
y = data[ :, -1 ]
if USE_MEMMAP:
Xmm = np.memmap( 'X.mmap', dtype=X.dtype, mode='w+', shape=X.shape )
ymm = np.memmap( ... | normal | {
"blob_id": "e2682a5cab95914e7567431cb04c3fb542eda3bf",
"index": 4353,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif USE_MEMMAP:\n Xmm = np.memmap('X.mmap', dtype=X.dtype, mode='w+', shape=X.shape)\n ymm = np.memmap('y.mmap', dtype=y.dtype, mode='w+', shape=y.shape)\n np.copyto(Xmm, X)\n ... | [
0,
1,
2,
3,
4
] |
"""
Copyright (C) 2005 - 2016 Splunk Inc. All Rights Reserved.
"""
import logging
import sys
if sys.platform == "win32":
import os, msvcrt
msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
import splunk.adm... | normal | {
"blob_id": "675dc9467dd6db9c2a429941af56d78d6c0e1c08",
"index": 4135,
"step-1": "<mask token>\n\n\nclass MissingTransitionException(InvalidConfigException):\n \"\"\"\n Describes a capability that is missing.\n \"\"\"\n\n def __init__(self, transitions):\n self.transitions = transitions\n ... | [
14,
16,
18,
23,
26
] |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue May 19 17:27:57 2020
@author: li
"""
import numpy as np
from opendr.renderer import ColoredRenderer
from opendr.lighting import LambertianPointLight
from opendr.camera import ProjectPoints
import cPickle as pkl
from models.smpl import Smpl, copy_smpl,... | normal | {
"blob_id": "2540e2752edaedbf2a011a25cb90f220ae770757",
"index": 7611,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open(model_file, 'rb') as fp:\n model_data = pkl.load(fp)\n<mask token>\nfor i in range(70563, 70564):\n imgname = mpi_inf_valid['imgname'][i]\n rgb_img = cv2.imread(join(RO... | [
0,
1,
2,
3,
4
] |
from distutils.core import setup
setup(name='json_config', version='0.0.01', packages=['', 'test'], url='',
license='', author='craig.ferguson', author_email='', description=
'Simple Functional Config For Changing Environments')
| normal | {
"blob_id": "ee57e6a1ccbec93f3def8966f5621ea459f3d228",
"index": 6538,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsetup(name='json_config', version='0.0.01', packages=['', 'test'], url='',\n license='', author='craig.ferguson', author_email='', description=\n 'Simple Functional Config For Chang... | [
0,
1,
2
] |
from django.apps import AppConfig
class MarketingemailsConfig(AppConfig):
name = 'marketingemails'
| normal | {
"blob_id": "19bb58ab440ca00bf6410a70a8b6bbc24eec96c1",
"index": 492,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass MarketingemailsConfig(AppConfig):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass MarketingemailsConfig(AppConfig):\n name = 'marketingemails'\n",
"step-4": "from... | [
0,
1,
2,
3
] |
import requests
if __name__ == "__main__":
# individual datacake webhook url
# Change this to the webhook url of your datacake device/product
datacake_url = "https://api.datacake.co/integrations/api/ae6dd531-4cf6-4966-b5c9-6c43939aae90/"
# Serial number
# Include Serial Number in Payload so Datac... | normal | {
"blob_id": "00af9627242648a5a16a34a18bfc117945f1bc08",
"index": 4936,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n datacake_url = (\n 'https://api.datacake.co/integrations/api/ae6dd531-4cf6-4966-b5c9-6c43939aae90/'\n )\n serial = 'python0001'\n numbe... | [
0,
1,
2,
3
] |
import pymongo
client = pymongo.MongoClient("mongodb://localhost:27017/")
# Database Name
db = client["Test"]
# Collection Name
col = db["C100"]
x = col.find_one()
print(x) | normal | {
"blob_id": "7d10fb58aa5213516c656c05966fcaad6868ae81",
"index": 1548,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(x)\n",
"step-3": "<mask token>\nclient = pymongo.MongoClient('mongodb://localhost:27017/')\ndb = client['Test']\ncol = db['C100']\nx = col.find_one()\nprint(x)\n",
"step-4": "im... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python
# -*-coding:utf-8 -*-
from common import http_requests_get,is_domain
import re
class Crt(object):
def __init__(self, domain):
self.domain=domain
self.site='http://crt.sh/?q=%25.'
self.result=[]
def run(self):
url = self.site + self.domain
print u... | normal | {
"blob_id": "3ac13cc74a7eabef686ceb9d9e46f2ef109a225e",
"index": 1354,
"step-1": "#!/usr/bin/env python\n# -*-coding:utf-8 -*-\n\n\nfrom common import http_requests_get,is_domain\nimport re\n\nclass Crt(object):\n def __init__(self, domain):\n self.domain=domain\n self.site='http://crt.sh/?q=%25... | [
0
] |
"""Contains functionality for tokenizing, parsing, embedding language."""
from . import parsing
from . import cleaning
from .config import NATURAL_EMB_DIM
| normal | {
"blob_id": "8a6c9fa67c02d69444c9c3a2e6811b982c49eb4e",
"index": 5585,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfrom . import parsing\nfrom . import cleaning\nfrom .config import NATURAL_EMB_DIM\n",
"step-3": "\"\"\"Contains functionality for tokenizing, parsing, embedding language.\"\"\"\n\nfrom... | [
0,
1,
2
] |
import requests, vars
def Cardid(name):
query = {"key":vars.Key, "token":vars.Token, "cards":"visible"}
execute = requests.request("GET", vars.BoardGetUrl, params=query).json()
for row in execute['cards']:
if row['name'] == name:
cardID = 1
break
else:
ca... | normal | {
"blob_id": "68493acce71060799da8c6cb03f2ddffce64aa92",
"index": 8970,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef Cardid(name):\n query = {'key': vars.Key, 'token': vars.Token, 'cards': 'visible'}\n execute = requests.request('GET', vars.BoardGetUrl, params=query).json()\n for row in... | [
0,
1,
2,
3
] |
#!/usr/bin/env python3
import os
import fileinput
project = input("Enter short project name: ")
if os.path.isdir(project):
print("ERROR: Project exists")
exit()
os.mkdir(project)
os.chdir(project)
cmd = "virtualenv env -p `which python3` --prompt=[django-" + project + "]"
os.system(cmd)
# Install django wi... | normal | {
"blob_id": "c700af6d44cd036212c9e4ae4932bc60630f961e",
"index": 6930,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif os.path.isdir(project):\n print('ERROR: Project exists')\n exit()\nos.mkdir(project)\nos.chdir(project)\n<mask token>\nos.system(cmd)\n<mask token>\nwith open('requirements.txt',... | [
0,
1,
2,
3,
4
] |
import boto3
import jinja2
import markdown
# Instantiate S3 client
s3_client = boto3.client('s3')
# HTML style template
TEMPLATE = """<!DOCTYPE html>
<html>
<head>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css" rel="stylesheet">
<style>
body {
... | normal | {
"blob_id": "3df57059539e5e3579c6dbee6be288e04b5f93b5",
"index": 3400,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef lambda_handler(event, context):\n for record in event['Records']:\n bucket = record['s3']['bucket']['name']\n key = record['s3']['object']['key']\n output_... | [
0,
1,
2,
3,
4
] |
# coding: utf-8
"""
Upbit Open API
## REST API for Upbit Exchange - Base URL: [https://api.upbit.com] - Official Upbit API Documents: [https://docs.upbit.com] - Official Support email: [open-api@upbit.com] # noqa: E501
OpenAPI spec version: 1.0.0
Contact: ujhin942@gmail.com
Generated by: https:... | normal | {
"blob_id": "b9bd1c0f4a5d2e6eeb75ba4f27d33ad5fb22530e",
"index": 557,
"step-1": "<mask token>\n\n\nclass DepositCompleteResponse(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @property\n def currency(self):\n \"\"\"Gets the currency of this De... | [
6,
9,
11,
16,
17
] |
#! /usr/bin/python
import glo
print glo.x
a = "hello world"
print id(a)
a = "ni hao"
print id(a)
for y in range(0, 5, 2):
print y
for y in 1, 2, 3:
print y
if (glo.x == 2):
print("a==2")
else:
print("a!=2")
tuple_name = ("name", "age", "school") #can't modify, only-read
list_name = ["boy", "girl... | normal | {
"blob_id": "17326597d0597d16717c87c9bdf8733fb3acb77b",
"index": 7943,
"step-1": "#! /usr/bin/python\n\nimport glo\nprint glo.x\n\na = \"hello world\"\nprint id(a)\n\na = \"ni hao\"\nprint id(a)\n\nfor y in range(0, 5, 2):\n print y\n\nfor y in 1, 2, 3:\n print y\n\nif (glo.x == 2):\n print(\"a==2\")\ne... | [
0
] |
class Solution(object):
def isIsomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
n1 = len(s)
n2 = len(t)
if n1 != n2:
return False
else:
map1 = {}
map2 = {}
for i in range(n1)... | normal | {
"blob_id": "7fdddf98fc7b588e9b8816ffa22bc24f715d7efe",
"index": 5210,
"step-1": "class Solution(object):\n <mask token>\n\n\n<mask token>\n",
"step-2": "class Solution(object):\n\n def isIsomorphic(self, s, t):\n \"\"\"\n :type s: str\n :type t: str\n :rtype: bool\n \"... | [
1,
2,
3,
4
] |
# This is main file where we create the instances of Movie class
# and run the file to view the movie website page
# we have to import media where class Movie is defined and
# fresh_tomatoes python files
import fresh_tomatoes
import media
# Each instance has 8 arguments: Title, story line, poster image,
# trailer url... | normal | {
"blob_id": "9dfc8414628a8b09de3c24c504dd4163efdd3d35",
"index": 6010,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfresh_tomatoes.open_movies_page(movies)\n",
"step-3": "<mask token>\nalien_covenant = media.Movie('Alien: Covenant',\n 'The crew of a colony ship, bound for a remote planet, discover... | [
0,
1,
2,
3,
4
] |
import sys
import os
import logging
import sh
from ..util.path import SmartTempDir, replace_path
logger = logging.getLogger('pyrsss.gps.teqc')
def rinex_info(rinex_fname,
nav_fname,
work_path=None):
"""
Query RINEX file *rinex_fname* and RINEX nav file *nav_fname* for
usef... | normal | {
"blob_id": "ec19567b49f686f613308d79e439f6ff9053fa40",
"index": 5064,
"step-1": "<mask token>\n\n\ndef rinex_merge(output_fname, rinex_fnames, _err=sys.stderr):\n \"\"\"\n Using teqc, merge *rinex_fnames* and store to the file\n *output_fname*. Returns *output_fname*. Redirect error output to\n *_er... | [
1,
3,
4,
5,
6
] |
#!/usr/bin/env python
# encoding: utf-8
"""
PreScaledTriggers.py
Created by Bryn Mathias on 2011-11-02.
Copyright (c) 2011 Imperial College. All rights reserved.
"""
import sys
import os
from plottingUtils import *
# HLT_HT600_v1Pre_1_HLT_HT300_v9Pre_210
def main():
c1 = Print("HLT_HT550_HLT_HT250.pdf")
c1.open(... | normal | {
"blob_id": "e748420dfdb77fa8661111a92fc48b79f64bff10",
"index": 4128,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n c1 = Print('HLT_HT550_HLT_HT250.pdf')\n c1.open()\n diffList = []\n cumuList = []\n histList = 'HT_Nom', 'HT_Denom'\n dirs = ['HLT_HT550_v11_HLT_HT250_... | [
0,
1,
2,
3,
4
] |
planet_list = ["Mercury", "Mars"]
planet_list.append("Jupiter")
planet_list.append("Saturn")
planet_list.extend(["Uranus", "Neptune"])
planet_list.insert(1, "Earth")
planet_list.insert(1, "Venus")
planet_list.append("Pluto")
del planet_list[-1]
print(planet_list) | normal | {
"blob_id": "1280ab66b817011e22e560a78104bbc4340989e7",
"index": 8495,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nplanet_list.append('Jupiter')\nplanet_list.append('Saturn')\nplanet_list.extend(['Uranus', 'Neptune'])\nplanet_list.insert(1, 'Earth')\nplanet_list.insert(1, 'Venus')\nplanet_list.append(... | [
0,
1,
2,
3
] |
# Copyright (c) 2020 Open Collector, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... | normal | {
"blob_id": "6e01e36170f3f08f2030dbd4dd91019936fb9f5c",
"index": 849,
"step-1": "<mask token>\n\n\n@routes.route('/signin', name='signin')\nclass SigninEndpoint(PoolHTTPEndpoint):\n <mask token>\n <mask token>\n\n @back_to.setter\n def back_to(self, value: typing.Optional[str]):\n self.request... | [
9,
13,
14,
19,
20
] |
print ("hello guys")
print ("hello everyone") | normal | {
"blob_id": "4d87c3f70809bbd488159f0b55131af903c7e7b4",
"index": 1509,
"step-1": "<mask token>\n",
"step-2": "print('hello guys')\nprint('hello everyone')\n",
"step-3": "print (\"hello guys\")\nprint (\"hello everyone\")",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
from abc import ABC, abstractmethod
class Book:
def __init__(self, title: str, content: str):
self.title = title
self.content = content
class Formatter(ABC):
@abstractmethod
def format(self, book: Book):
pass
class TitleFormatter(Formatter):
def format(self, book: Book) ... | normal | {
"blob_id": "d025b0719c6eecdfccb2e39a58af7842f4229c72",
"index": 2678,
"step-1": "<mask token>\n\n\nclass Formatter(ABC):\n <mask token>\n\n\nclass TitleFormatter(Formatter):\n\n def format(self, book: Book) ->str:\n return book.title\n\n\nclass ContentFormatter(Formatter):\n\n def format(self, b... | [
7,
8,
10,
11
] |
import pandas as pd
import glob
import string
import os
ALLOWED_CHARS = string.ascii_letters + "-,. \"()'"
def concat_all_data(path : str = 'Data/*.csv', save_path : str = 'Data/final.csv'):
csvs = glob.glob(path)
li = []
for csv in csvs:
df = pd.read_csv(csv)
li.append(df)
final_... | normal | {
"blob_id": "0a5e30483c1fde10410c442a1ccd1f79bfb329c8",
"index": 8457,
"step-1": "<mask token>\n\n\ndef concat_all_data(path: str='Data/*.csv', save_path: str='Data/final.csv'):\n csvs = glob.glob(path)\n li = []\n for csv in csvs:\n df = pd.read_csv(csv)\n li.append(df)\n final_df = pd... | [
4,
5,
6,
7,
8
] |
# Generated by Django 2.2.8 on 2019-12-10 10:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fieldsapp', '0003_pole_avatar'),
]
operations = [
migrations.AddField(
model_name='pole',
name='email',
... | normal | {
"blob_id": "9d6516ea099e035fb97e5165071103698a7ec140",
"index": 5812,
"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 = [('fieldsapp',... | [
0,
1,
2,
3,
4
] |
import os
def is_admin():
"""
The function ``is_admin`` detects whether the calling process is running
with administrator/superuser privileges. It works cross-platform on
either Windows NT systems or Unix-based systems.
"""
if os.name == 'nt':
try:
# Only Windows users wit... | normal | {
"blob_id": "f1601d3d820b93631f9b1358627a5716016ad135",
"index": 5473,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef is_admin():\n \"\"\"\n The function ``is_admin`` detects whether the calling process is running\n with administrator/superuser privileges. It works cross-platform on \n ... | [
0,
1,
2,
3
] |
"""product_ingredient unique constraint
Revision ID: a07768b0d4c0
Revises: a80cd9a35e58
Create Date: 2017-05-18 11:39:52.258266
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a07768b0d4c0'
down_revision = 'a80cd9a35e58'
branch_labels = None
depends_on = None
... | normal | {
"blob_id": "d0a73385db0dd6f729d267095ef83b9fec72e40c",
"index": 1464,
"step-1": "<mask token>\n\n\ndef upgrade():\n op.create_unique_constraint('_unique_name_unit', 'ingredient', ['name',\n 'unit'])\n op.create_unique_constraint(None, 'product', ['nappi_code'])\n op.add_column('product_ingredien... | [
1,
2,
3,
4,
5
] |
class Reader:
@staticmethod
def read_file(file_path):
return ''
| normal | {
"blob_id": "8c51b2c06f971c92e30d6b2d668fdd2fd75142d2",
"index": 4846,
"step-1": "<mask token>\n",
"step-2": "class Reader:\n <mask token>\n",
"step-3": "class Reader:\n\n @staticmethod\n def read_file(file_path):\n return ''\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
... | [
0,
1,
2
] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-16 12:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0033_auto_20171016_1334'),
]
operations = [
migrations.AlterField(
... | normal | {
"blob_id": "d0dfea27128ca6966c85da6529ead5c95c86c4cf",
"index": 1183,
"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 = [('blog', '003... | [
0,
1,
2,
3,
4
] |
import json
from .errors import TorrentNotValid, TorrentHashNotFound, FailedLogin, HttpException
class QBittorrentClient:
"""
QBittorent client
"""
def __init__(self, *, connector):
self.connector = connector
def login(self, username: str, password: str):
return self.connector.l... | normal | {
"blob_id": "8ce2db0a28de8ddd504b744f3c9210d1a0ed7d45",
"index": 699,
"step-1": "<mask token>\n\n\nclass QBittorrentClient:\n <mask token>\n <mask token>\n\n def login(self, username: str, password: str):\n return self.connector.login(username, password)\n\n def logout(self):\n return s... | [
8,
11,
13,
14
] |
#! /usr/bin/python3
class Animal:
def eat(self):
print("吃")
def bark(self):
print("喝")
def run(seft):
print("跑")
def sleep(self):
print("睡")
class Dog(Animal):
# 子类拥有父类的所有属性和方法
def bark(self):
print("汪汪叫")
class XiaoTianQuan(Dog): # 3. 增加其... | normal | {
"blob_id": "d7aa85c2458ee12a8de0f75419945fbe2acdf95d",
"index": 3946,
"step-1": "class Animal:\n\n def eat(self):\n print('吃')\n\n def bark(self):\n print('喝')\n <mask token>\n <mask token>\n\n\nclass Dog(Animal):\n\n def bark(self):\n print('汪汪叫')\n\n\nclass XiaoTianQuan(Dog... | [
8,
9,
11,
12,
13
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.