code
stringlengths
13
1.2M
order_type
stringclasses
1 value
original_example
dict
step_ids
listlengths
1
5
from django.core.management.base import BaseCommand from journal.models import Journal from article.models import ArticleCoverSetting from django.conf import settings import os class Command(BaseCommand): def handle(self, *args, **options): print('Loading article settings') ArticleCoverSetting.ob...
normal
{ "blob_id": "a3d27561488c38e1256eb33abad108ad42081eb6", "index": 9253, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Command(BaseCommand):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Command(BaseCommand):\n\n def handle(self, *args, **options):\n print('Loading article...
[ 0, 1, 2, 3 ]
from .server import CanvasServer try: from .jupyter import JupyterCanvas, create_jupyter_canvas HAS_JUPYTER = True except: HAS_JUPYTER = False JupyterCanvas = None # type: ignore def http_server( file: str = None, host: str = "localhost", port: int = 5050 ) -> CanvasServer: """Creates a new...
normal
{ "blob_id": "b11e2837d3ba9c14770b8039186a2175adc41ea1", "index": 283, "step-1": "<mask token>\n\n\ndef http_server(file: str=None, host: str='localhost', port: int=5050\n ) ->CanvasServer:\n \"\"\"Creates a new HTTP server for displaying the network, using WebSockets to\n transmit data. The server will ...
[ 1, 2, 3, 4, 5 ]
import datetime from app.api.v2.models.db import Database now = datetime.datetime.now() db = Database() cur = db.cur class Meetup(): #meetup constructor def __init__(self, topic, location, tags, happening_on): self.topic = topic self.location = location self.tags = tags self.h...
normal
{ "blob_id": "275f8b6ac31792a9e4bb823b61366f868e45ef4e", "index": 6521, "step-1": "<mask token>\n\n\nclass Meetup:\n <mask token>\n\n def check_if_meetup_exists(self, topic):\n query = 'SELECT topic from meetups WHERE topic=%s;'\n cur.execute(query, (topic,))\n meetup = cur.fetchone()\n...
[ 4, 7, 8, 9, 10 ]
class SensorReadings: def __init__(self, sense_hat): self.temprerature_humidity_sensor = sense_hat.get_temperature_from_humidity() self.temperature_pressure_sensor = sense_hat.get_temperature_from_pressure() self.humidity = sense_hat.get_humidity() self.pressure = sense_hat.get_pressure() def prin...
normal
{ "blob_id": "f680503488a2780624b28e49b045aad75506d8c5", "index": 3248, "step-1": "class SensorReadings:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class SensorReadings:\n <mask token>\n\n def printReadings(self):\n print('temperature from humidity sensor...
[ 1, 2, 3, 4, 6 ]
import imgui print("begin") imgui.create_context() imgui.get_io().display_size = 100, 100 imgui.get_io().fonts.get_tex_data_as_rgba32() imgui.new_frame() imgui.begin("Window", True) imgui.text("HelloWorld") imgui.end() imgui.render() imgui.end_frame() print("end")
normal
{ "blob_id": "146cae8f60b908f04bc09b10c4e30693daec89b4", "index": 6560, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('begin')\nimgui.create_context()\n<mask token>\nimgui.get_io().fonts.get_tex_data_as_rgba32()\nimgui.new_frame()\nimgui.begin('Window', True)\nimgui.text('HelloWorld')\nimgui.end()\...
[ 0, 1, 2, 3, 4 ]
from gpiozero import Motor class Car: def __init__(self, speed: float=1): self.speed = speed self.forward_right_motor = Motor(forward=12, backward=16) self.backward_right_motor = Motor(forward=21, backward=20) self.forward_left_motor = Motor(forward=23, backward=18) self.b...
normal
{ "blob_id": "6bf1a0fbf65895eac9baa71bc5e04e861f0a3ed5", "index": 4190, "step-1": "<mask token>\n\n\nclass Car:\n\n def __init__(self, speed: float=1):\n self.speed = speed\n self.forward_right_motor = Motor(forward=12, backward=16)\n self.backward_right_motor = Motor(forward=21, backward=...
[ 5, 6, 7, 8 ]
from sklearn.datasets import fetch_20newsgroups from sklearn.decomposition import TruncatedSVD from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_extraction.text import HashingVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.pipeline import make_pipeline...
normal
{ "blob_id": "53cbc3ca3a34a8aafa97d6964337cfabb1bebac5", "index": 8957, "step-1": "from sklearn.datasets import fetch_20newsgroups\nfrom sklearn.decomposition import TruncatedSVD\nfrom sklearn.feature_extraction.text import TfidfVectorizer\nfrom sklearn.feature_extraction.text import HashingVectorizer\nfrom sklea...
[ 0 ]
# This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. from PyQt5 import QtWidgets, uic import sys import pymysql import mysql.connector class Ui_Login(QtWidgets.QDi...
normal
{ "blob_id": "0ff6e22f8704a0c6c0ffff3c53761b9d3a531b6d", "index": 683, "step-1": "<mask token>\n\n\nclass Ui_Login(QtWidgets.QDialog):\n\n def __init__(self):\n super(Ui_Login, self).__init__()\n uic.loadUi('login.ui', self)\n self.icon = self.findChild(QtWidgets.QLabel, 'ilogin')\n ...
[ 5, 7, 8, 9, 10 ]
#これは明日20200106に走らせましょう! import numpy as np import sys,os import config2 CONSUMER_KEY = config2.CONSUMER_KEY CONSUMER_SECRET = config2.CONSUMER_SECRET ACCESS_TOKEN = config2.ACCESS_TOKEN ACCESS_TOKEN_SECRET = config2.ACCESS_TOKEN_SECRET import tweepy auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_...
normal
{ "blob_id": "8fac4571a3a1559e297754e89375be06d6c45c2d", "index": 4795, "step-1": "<mask token>\n\n\ndef skip_func(list):\n cnt = 0\n for i in list:\n padd = [0] * 200\n try:\n got = api.friends_ids(i, count=200)\n except:\n print('========NG=============', cnt)\n ...
[ 1, 2, 3, 4, 5 ]
from django.apps import AppConfig class SmashbotspainConfig(AppConfig): name = 'smashbotspain'
normal
{ "blob_id": "e714755d660ba809f7958cad4f0b9f95b0a0ffdc", "index": 9320, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass SmashbotspainConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass SmashbotspainConfig(AppConfig):\n name = 'smashbotspain'\n", "step-4": "from djan...
[ 0, 1, 2, 3 ]
# -*- python -*- # ex: set syntax=python: # vim: set syntax=python: import os import re from collections import defaultdict, namedtuple from enum import Enum from pathlib import Path import buildbot.www.authz.endpointmatchers as ems from buildbot.changes.filter import ChangeFilter from buildbot.changes.gitpoller impo...
normal
{ "blob_id": "4abcca52095a169b71d2527ce52b8367534c42a4", "index": 5989, "step-1": "<mask token>\n\n\nclass Purpose(Enum):\n halide_nightly = 1\n halide_testbranch = 2\n llvm_nightly = 3\n\n\nclass BuildSystem(Enum):\n make = 0\n cmake = 1\n\n\nclass BuilderType:\n \"\"\"A class to encapsulate th...
[ 45, 55, 62, 69, 80 ]
{"filter":false,"title":"settings.py","tooltip":"/mysite/settings.py","undoManager":{"mark":53,"position":53,"stack":[[{"start":{"row":107,"column":13},"end":{"row":107,"column":16},"action":"remove","lines":["UTC"],"id":2},{"start":{"row":107,"column":13},"end":{"row":107,"column":23},"action":"insert","lines":["Asia/...
normal
{ "blob_id": "f6b38698dbed6c1a48faa86183b601f855a7f737", "index": 5728, "step-1": "<mask token>\n", "step-2": "{'filter': false, 'title': 'settings.py', 'tooltip': '/mysite/settings.py',\n 'undoManager': {'mark': 53, 'position': 53, 'stack': [[{'start': {'row':\n 107, 'column': 13}, 'end': {'row': 107, 'c...
[ 0, 1, 2 ]
from flask import Flask, render_template from flask_ask import Ask, statement, question, session import reverse_geocoder as rg from geopy import distance from geopy.geocoders import Nominatim import requests import time ''' :::::::: ::::::::: ::: :::::::: :::::::::: ::: ::: ::: ::: ...
normal
{ "blob_id": "726f133bcf592315c42f8701be8308422ffbf0d9", "index": 426, "step-1": "<mask token>\n\n\ndef where_is_the_iss_now():\n iss_now_website = 'http://api.open-notify.org/iss-now.json'\n webby = requests.get(iss_now_website)\n data = webby.json()\n if data['iss_position']:\n longitude = da...
[ 8, 9, 11, 12, 17 ]
# Generated by Django 2.2.6 on 2019-11-05 02:28 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('drchrono', '0011_patient_cell_phone'), ] operations = [ migrations.AddField( model_name='appointment', name='date', ...
normal
{ "blob_id": "0c7f2412fe9a83d70d41fbc4bbaf135e6bc4149a", "index": 8129, "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 = [('drchrono', ...
[ 0, 1, 2, 3, 4 ]
#' % Computational Biology Lab 3 #' % Alois Klink #' % 18 May 2017 #' # Converting Reaction Equations to a ODE #' To convert many reaction equations to one ODE, one must first find the propensity #' and the changes of each reaction. #' The Reaction class takes a lambda function of the propensity and the change matri...
normal
{ "blob_id": "87a1624707e4a113a35d975518e432277c851e41", "index": 9962, "step-1": "<mask token>\n", "step-2": "<mask token>\nsystem.trajectories()\n<mask token>\nprint('r is ' + str(r))\nsystem.gillespieConcentrations(50000 * r)\nsystem.gillespieTrajectories([[0, 0], [4, 23]], 10000 * r)\n<mask token>\nsystem.g...
[ 0, 1, 2, 3, 4 ]
TRAIN_INPUT_PATH = "~/Projects/competitions/titanic/data/train.csv" TEST_INPUT_PATH = "~/Projects/competitions/titanic/data/test.csv" OUTPUT_PATH = "output/" TRAIN_VAL_SPLIT = 0.75 RANDOM_SEED = 42 MODEL = "LOGISTIC_REGRESSION" LOG_PATH = "logs/"
normal
{ "blob_id": "f1f708f00e05941c9a18a24b9a7556558583c3c7", "index": 738, "step-1": "<mask token>\n", "step-2": "TRAIN_INPUT_PATH = '~/Projects/competitions/titanic/data/train.csv'\nTEST_INPUT_PATH = '~/Projects/competitions/titanic/data/test.csv'\nOUTPUT_PATH = 'output/'\nTRAIN_VAL_SPLIT = 0.75\nRANDOM_SEED = 42\...
[ 0, 1, 2 ]
from tqdm import tqdm import os import pandas as pd import pickle import numpy as np def inv_list(l, start=0): d = {} for i in range(len(l)): d[l[i]] = i+start return d raw_data_path = '/home/reddy/sindhu/datasets/physionet_2012/' def read_dataset(d): ts = [] pbar = tqdm(os.listdir(raw_dat...
normal
{ "blob_id": "3e07a2a2d0a810c016720fa41d71d0771cbccfef", "index": 626, "step-1": "<mask token>\n\n\ndef inv_list(l, start=0):\n d = {}\n for i in range(len(l)):\n d[l[i]] = i + start\n return d\n\n\n<mask token>\n\n\ndef read_dataset(d):\n ts = []\n pbar = tqdm(os.listdir(raw_data_path + '/s...
[ 2, 3, 4, 5, 6 ]
import numpy as np class LayerBase(object): def __init__(self, units_count, activation_func): self.current_layer_dim = units_count self.activation_func = activation_func self.weights = None self.bias = None self.pre_activation = None self.activation_layer = None ...
normal
{ "blob_id": "389ccddcbe2214ae5c012bc82a404a81942792d8", "index": 1770, "step-1": "<mask token>\n\n\nclass LayerBase(object):\n\n def __init__(self, units_count, activation_func):\n self.current_layer_dim = units_count\n self.activation_func = activation_func\n self.weights = None\n ...
[ 4, 7, 9, 10, 12 ]
import sys import os import unittest from wireless.trex_wireless_manager import APMode from wireless.trex_wireless_manager_private import * class APInfoTest(unittest.TestCase): """Tests methods for the APInfo class.""" def test_init_correct(self): """Test the __init__ method when parameters are corr...
normal
{ "blob_id": "ae5dfa7fa6a0d7349d6ae29aeac819903facb48f", "index": 3518, "step-1": "<mask token>\n\n\nclass APInfoTest(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n\n def test_init_no_ip(self):\n \"\"\"Test the __init__ method when parameter 'ip' is None.\n Since the ...
[ 10, 11, 13, 14, 16 ]
from flask import jsonify from flask_restful import Resource from flask_apispec.views import MethodResource import pandas as pd import jellyfish df = pd.read_csv('data/trancotop1m.csv') df_dict = df.to_dict('records') class StrComparison(MethodResource,Resource): # @requires_auth def get(self, domain): ...
normal
{ "blob_id": "6d974580ff546bda17caa1e61e2621b4bc705f3f", "index": 2952, "step-1": "<mask token>\n\n\nclass StrComparison(MethodResource, Resource):\n <mask token>\n", "step-2": "<mask token>\n\n\nclass StrComparison(MethodResource, Resource):\n\n def get(self, domain):\n domain_found = ''\n ...
[ 1, 2, 3, 4, 5 ]
""" Definition of SegmentTreeNode: """ class SegmentTreeNode: def __init__(self, start, end): self.start, self.end = start, end self.left, self.right = None, None class Solution: """ @param: start: start value. @param: end: end value. @return: The root of Segment Tree. """ ...
normal
{ "blob_id": "5e20a517131f7a372d701548e4f370766a84ba52", "index": 6134, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n \"\"\"\n @param: start: start value.\n @param: end: end value.\n @return: The root of Segment Tr...
[ 1, 3, 4, 5, 6 ]
class Node: def __init__(self, char = None): self.char = char self.children = [] self.end = False root = Node('*') curr = root # recursive insert into the trie def insert(s, curr): if curr.children and curr.children[0].char == s[0]: curr = curr.children[0] elif len(curr.chi...
normal
{ "blob_id": "37c42a5e52832c81660e88f45d93e6a9f0300de0", "index": 7654, "step-1": "class Node:\n\n def __init__(self, char=None):\n self.char = char\n self.children = []\n self.end = False\n\n\n<mask token>\n\n\ndef search(sequence):\n tmp_node = root\n found = False\n for letter ...
[ 3, 4, 5, 6, 7 ]
import os import math import time from tqdm import tqdm import torch from torch import nn import torch.optim as optim from torch.nn import functional as F from torch.nn.utils import clip_grad_norm_ from torch.utils.data import DataLoader from nag.modules import Transformer, TransformerTorch from nag.logger...
normal
{ "blob_id": "bc6c3383684cbba775d17f81ead3346fe1a01f90", "index": 5102, "step-1": "<mask token>\n\n\ndef train(epoch, model, dataloader, criterion, optimizer, scheduler):\n global global_train_step\n model.train()\n total_loss = 0.0\n bleu_score = 0.0\n distinct_1_score, distinct_2_score = 0.0, 0.0...
[ 3, 4, 5, 6, 8 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- """Install and activate pre-commit and its hooks into virtual environment.""" from __future__ import (absolute_import, division, print_function, unicode_literals) import os import sys # if sys.version_info[0] > 2 or sys.version_info[1] < 7: # p...
normal
{ "blob_id": "210d1a184d338d77d4c41327d0a9e2a5a56eb2ae", "index": 2724, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n VENV = os.environ[VENV_NAME]\n if VENV == '':\n print(\"Environment variable '%s' is empty\" % VENV_NAME)\n print('Please activate your virtualenv first')\n ...
[ 0, 1, 2, 3, 4 ]
from __future__ import annotations from abc import ABC, abstractmethod class AbstractMoviment(ABC): @abstractmethod def move(self, dt) -> None: pass class Mov_LinearFall(AbstractMoviment): def move(self, coordinates, speed, lastcoordinate, dt): coordinates[1] = round(coordinates[1] + spe...
normal
{ "blob_id": "57935b560108ef0db59de9eee59aa0c908c58b8f", "index": 2348, "step-1": "<mask token>\n\n\nclass Mov_ZigZag(AbstractMoviment):\n <mask token>\n\n def move(self, coordinates, speed, startcoordinate, dt):\n ZigZageamento = 100\n coordinates[1] = round(coordinates[1] + speed * dt)\n ...
[ 8, 9, 11, 12, 15 ]
from tracking.centroidtracker import CentroidTracker from tracking.trackableobject import TrackableObject import tensornets as nets import cv2 import numpy as np import time import dlib import tensorflow.compat.v1 as tf import os # For 'disable_v2_behavior' see https://github.com/theislab/scgen/issues/14 tf.disable_v2...
normal
{ "blob_id": "7b01e81c3e31e0a315ee01f36bf1b1f7384a9d10", "index": 3597, "step-1": "<mask token>\n", "step-2": "<mask token>\ntf.disable_v2_behavior()\n<mask token>\nprint('Loading video {video_path}...'.format(video_path=video_path))\nif not os.path.exists(video_path):\n print('File does not exist. Exited.')...
[ 0, 1, 2, 3, 4 ]
from django.db import models class Location(models.Model): id_location = models.AutoField(primary_key=True) city = models.CharField(max_length=100, null=True) street_name = models.CharField(max_length=100, null=True) street_number = models.IntegerField(null=True) zip = models.IntegerField(null=Tru...
normal
{ "blob_id": "914f477518918619e0e42184bd03c2a7ed16bb01", "index": 86, "step-1": "<mask token>\n\n\nclass Relation_type(models.Model):\n <mask token>\n <mask token>\n\n def __str__(self):\n return str(self.name)\n\n\nclass Relation(models.Model):\n id_relation = models.AutoField(primary_key=True...
[ 9, 18, 20, 21, 24 ]
from django.http import HttpResponse, JsonResponse from django.shortcuts import render from django.views.generic.base import View from elasticsearch import Elasticsearch from elasticsearch_dsl import Search # from com_search.get_info import Search as Search_1 # from com_search.models import CompanyType import json # Cr...
normal
{ "blob_id": "e5e7856d752f14e0671bae8d8b7997207c667ae1", "index": 6602, "step-1": "<mask token>\n\n\nclass SearchSuggest(View):\n <mask token>\n\n\nclass SearchDetail(View):\n\n def get(self, request):\n key_words = request.GET.get('q', '')\n data = {}\n if key_words:\n es = ...
[ 5, 6, 7, 8, 9 ]
# -*- coding: UTF-8 -*- # File Name: ll.py # Author: Sam # mail: samyunwei@163.com # Created Time: 2016年03月09日 星期三 19时18分02秒 ######################################################################### #!/usr/bin/env python def checkmark(marks): if not isinstance(marks,list): return 'marks Error' else: ...
normal
{ "blob_id": "f98d6dd9ac4714c24ce070a1a81dc4610d04b97e", "index": 6017, "step-1": "# -*- coding: UTF-8 -*- \n# File Name: ll.py\n# Author: Sam\n# mail: samyunwei@163.com\n# Created Time: 2016年03月09日 星期三 19时18分02秒\n#########################################################################\n#!/usr/bin/env python\nde...
[ 0 ]
""" Plugin for ResolveUrl Copyright (C) 2022 shellc0de This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ...
normal
{ "blob_id": "8dfea24545ec4bb95b66d4b5ff3c4936990eb73a", "index": 9500, "step-1": "<mask token>\n\n\nclass TubeloadResolver(ResolveUrl):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def get_url(self, host, media_id):\n return self._default_get_url(host, media_id, template=...
[ 2, 3, 4, 5, 6 ]
import array def swap(arr, first, second): """ Swaps the first index with the second. arr: an input array first: an index in the array second: an index in the array This function has the side effect mentioned above. """ arr[first], arr[second] = arr[second], arr[first] def parent(i...
normal
{ "blob_id": "1262d41be3bf873d003464cb23998dde20fde318", "index": 8115, "step-1": "<mask token>\n\n\ndef swap(arr, first, second):\n \"\"\"\n Swaps the first index with the second.\n\n arr: an input array\n first: an index in the array\n second: an index in the array\n\n This function has the si...
[ 5, 7, 8, 10 ]
from .signals import get_restaurant_coordinates, count_average_price, count_total_calories from .dish import Dish from .ingredients import Ingredient from .restaurants import Restaurant
normal
{ "blob_id": "1935cab249bf559aeadf785ce7abcecb03344c04", "index": 6058, "step-1": "<mask token>\n", "step-2": "from .signals import get_restaurant_coordinates, count_average_price, count_total_calories\nfrom .dish import Dish\nfrom .ingredients import Ingredient\nfrom .restaurants import Restaurant\n", "step-...
[ 0, 1 ]
# -*- coding: utf-8 -*- # @Author: huerke # @Date: 2016-09-03 10:55:54 # @Last Modified by: huerke # @Last Modified time: 2016-09-03 15:54:50 from flask import render_template from . import main @main.app_errorhandler(404) def page_not_found(e): return render_template('404.html'), 404 @main.app_errorhandler...
normal
{ "blob_id": "021cbd1bd22f9ec48db2e52b2a98be169bbfdbbd", "index": 5979, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@main.app_errorhandler(404)\ndef page_not_found(e):\n return render_template('404.html'), 404\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\n@main.app_errorhandler(404)\ndef ...
[ 0, 1, 2, 3, 4 ]
aminotable = [ ['Ile' , 'AUU','AUC','AUA'], #0 ['Leu' , 'CUU','CUC','CUA','CUG','UUA','UUG'], #1 ['Val' , 'GUU','GUC','GUA','GUG'], #2 ['Phe' , 'UUU','UUC'], #3 ['Met' , 'AUG'], ...
normal
{ "blob_id": "d5a31e53444e2efa2eb972f1152b6d3e37d5ab79", "index": 5321, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Original sequence: ', sequence, '\\n')\n<mask token>\nprint('Amino Sequence: ')\nwhile n < seqlength:\n codon = sequence[n:n + 3]\n for amino in aminotable:\n for i in...
[ 0, 1, 2, 3 ]
''' Function Description Complete the extraLongFactorials function in the editor below. It should print the result and return. extraLongFactorials has the following parameter(s): n: an integer Note: Factorials of can't be stored even in a long long variable. Big integers must be used for such calcu...
normal
{ "blob_id": "5c1ce46f45da33acf75a7f47add811b14d58414d", "index": 1169, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef extraLongFactorials(n):\n print(math.factorial(n))\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef extraLongFactorials(n):\n print(math.factorial(n))\n\n\nif __name...
[ 0, 1, 2, 3, 4 ]
import discord from discord.ext import commands from os import path import os import datetime as dt import numpy as np import math # client = commands.Bot(command_prefix = '.', case_insensitive=True) # UTOPIA = 679921845671035034 # DEV_BOT_TOKEN = 'NzUzMzg1MjE1MTAzMzM2NTg4.X1laqA.vKvoV8Gz9jBWDWvIaBGDC4xbLB4' # BO...
normal
{ "blob_id": "bc8d3a5e3ed845b4ab2d203bec47881be64ba3f8", "index": 3723, "step-1": "<mask token>\n", "step-2": "import discord\nfrom discord.ext import commands\nfrom os import path\nimport os\nimport datetime as dt\nimport numpy as np\nimport math\n", "step-3": "import discord\nfrom discord.ext import command...
[ 0, 1, 2 ]
from paper_processor import PaperProcessor import logging logging.basicConfig( level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') q = "levamisole inhibitor" p = PaperProcessor(q)
normal
{ "blob_id": "96e64b715dbfc1c59ba44d608ad2694b165017b5", "index": 1975, "step-1": "<mask token>\n", "step-2": "<mask token>\nlogging.basicConfig(level=logging.DEBUG, format=\n '%(asctime)s - %(levelname)s - %(message)s')\n<mask token>\n", "step-3": "<mask token>\nlogging.basicConfig(level=logging.DEBUG, fo...
[ 0, 1, 2, 3, 4 ]
# coding: utf-8 # In[1]: #coding:utf8 import matplotlib import os if 'DISPLAY' not in os.environ: matplotlib.use('Agg') else: pass import torch import torch.nn as nn from torch.autograd import Variable import torch.optim as optim from matplotlib import pyplot as plt import seaborn as sns from tqdm import tq...
normal
{ "blob_id": "3022cade3bfa36925bcbda8023e5cd98ed33d093", "index": 9901, "step-1": "<mask token>\n\n\ndef get_accuracy(model, kb):\n results = []\n for clause in kb.clauses:\n o1, o2 = model.forward(clause)\n if o2.data.numpy()[0][0] > 0.9:\n results.append(1.0)\n else:\n ...
[ 2, 3, 4, 5, 6 ]
from django.shortcuts import render from rest_framework import status from rest_framework.decorators import api_view, renderer_classes from rest_framework.renderers import BrowsableAPIRenderer, JSONRenderer from rest_framework.response import Response from feedback.models import Feedback from feedback.serializers impor...
normal
{ "blob_id": "bd6c72c3215265a349c5f47573063a9288f64198", "index": 5227, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@api_view(['GET', 'POST'])\n@renderer_classes([JSONRenderer, BrowsableAPIRenderer])\ndef feedback_list(request, format=None):\n \"\"\"\n List all feedback or create a new feedba...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ Created on Thu Feb 15 17:28:48 2018 @author: otalabay """ LOCAL_INFO = 1 LSM = 2 TLS = 3 TLS_STOP = 4 DANGER = 5 STOP_DANGER = 6 PM = 7 PM_STOP = 8
normal
{ "blob_id": "db341c3686c53f1cd9fe98c532f17e872952cbba", "index": 6733, "step-1": "<mask token>\n", "step-2": "<mask token>\nLOCAL_INFO = 1\nLSM = 2\nTLS = 3\nTLS_STOP = 4\nDANGER = 5\nSTOP_DANGER = 6\nPM = 7\nPM_STOP = 8\n", "step-3": "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Thu Feb 15 17:28:48 2018\...
[ 0, 1, 2 ]
import os import sys import shutil import re dl_dir = '/home/acarnec/Downloads/' college_dir = '/home/acarnec/Documents/3rdYear' latex_dir = '/home/acarnec/Documents/Latex/' modules = ['mta', 'ana', 'met', 'log', 'mat', 'lin', 'min', 'pol', 'mic', 'mte'] michaelmas = ['mta', 'ana', 'met', 'log', 'mat']...
normal
{ "blob_id": "3989b4c2a15fa8cd54fef86f9d7150fbd0fb74cf", "index": 8724, "step-1": "<mask token>\n\n\ndef change_directory(path):\n \"\"\" \n Changes directory to path. \n \"\"\"\n os.chdir(path)\n\n\n<mask token>\n\n\ndef get_key_from_values(f, catalog):\n \"\"\"\n Gets the full associated with ...
[ 6, 9, 13, 15, 16 ]
from src.basepages.BreadCrumbTicketInfoBasePage import * class BreadCrumbHomeBasePage: def __init__(self): "" def gotoTicketInfoBasePage(self,ticketInfoPage): self.driver.get(ticketInfoPage) breadCrumbTicketInfoBasePage = BreadCrumbTicketInfoBasePage() breadCrumbTicketInfoBasePage.driver = self.driver r...
normal
{ "blob_id": "47c1746c2edfe4018decd59efbacc8be89a1f49e", "index": 3653, "step-1": "<mask token>\n\n\nclass BreadCrumbHomeBasePage:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass BreadCrumbHomeBasePage:\n <mask token>\n\n def gotoTicketInfoBasePage(self, ticketInfoPage):\n ...
[ 1, 2, 3, 4, 5 ]
""" 作用域 在Python中,当引用一个变量的时候,对这个【变量的搜索】是按照 本地作用域(Local)、 嵌套作用域(Enclosing function locals)、 全局作用域(Global)、 内置作用域(builtins模块) 的顺序来进行的, 即所谓的LEGB规则。 然而当在一个【函数内部为一个变量赋值】时,并不是按照上面所说LEGB规则来首先找到变量,之后为该变量赋值。在Python中,在函数中为一个变量赋值时,有下面这样一条规则 “当在函数中给一个变量名赋值是(而不是在一个表达式中对其进行引用),Python总是🔹创建或改变本地作用域的变量名🔹,除非它已经在那个函数中被声明为全局变量. ” """ ...
normal
{ "blob_id": "e98767fbac44f50f58c149e16124fef95b38cf71", "index": 8190, "step-1": "<mask token>\n\n\ndef func():\n x = 88\n\n\n<mask token>\n\n\ndef func_y():\n global y\n y = 101\n\n\n<mask token>\n\n\ndef func_e():\n count = 0\n\n def foo():\n nonlocal count\n count = 12\n foo()\...
[ 3, 4, 5, 6, 7 ]
import sys from . import cli def main() ->None: try: command = sys.argv[0] args = sys.argv[1:] cli.main(command, args) except KeyboardInterrupt: pass
normal
{ "blob_id": "9969dcf820a5ff34b483593cd43e4dfba9588ed2", "index": 4348, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main() ->None:\n try:\n command = sys.argv[0]\n args = sys.argv[1:]\n cli.main(command, args)\n except KeyboardInterrupt:\n pass\n", "step-3": ...
[ 0, 1, 2 ]
def filtra_acima(wires, origem): return [wire for wire in wires if wire[0] > origem ] def filtra_abaixo(wires, destino): return [wire for wire in wires if wire[1] < destino ] def calculate(wires): count = 0 for i in xrange(len(wires)): wires_acima = filtra_acima(wires, wires[i][0]) wir...
normal
{ "blob_id": "fa8d603fbea287161d31499f96a7fe7e56e8eaa1", "index": 129, "step-1": "def filtra_acima(wires, origem):\n return [wire for wire in wires if wire[0] > origem ]\n\ndef filtra_abaixo(wires, destino):\n return [wire for wire in wires if wire[1] < destino ]\n\ndef calculate(wires):\n count = 0\n ...
[ 0 ]
def describe(): desc = """ Problem : Given a string, find the length of the longest substring in it with no more than K distinct characters. For example : Input: String="araaci", K=2 Output: 4 Explanation: The longest substring with no more than '2' distinct characters is "araa", where the distinct char...
normal
{ "blob_id": "1a730f4a5fa2be434af41a3e320cab8338d93644", "index": 5050, "step-1": "<mask token>\n\n\ndef main():\n describe()\n str = 'araaci'\n k = 2\n res = find_substr_with_distinct_chars(str, k)\n print('Input', str, k)\n print('Longest substring with k distinct chars is : ', res)\n print...
[ 1, 2, 3, 4, 5 ]
flags =[] sourcefiles:str = [] headerfiles:str = [] mainfile:str = "" outfilename = "a.out" assemblyfilename = "a.asm" includedfilenames = [] class Variables: size:bytes name:str class cstruct: structname:string def claprocessor(): print(sys.argv) i=0 for stri in sys.argv: if stri....
normal
{ "blob_id": "24187284ff3e03cf79b8545415005c71f9355ddc", "index": 9062, "step-1": "<mask token>\n\n\nclass Variables:\n size: bytes\n name: str\n\n\nclass cstruct:\n structname: string\n\n\n<mask token>\n\n\ndef cpreprosscssor():\n maintokens = lexer(mainfile)\n return\n\n\ndef cprocessor():\n r...
[ 4, 5, 6, 7, 8 ]
# Download the helper library from https://www.twilio.com/docs/python/install from twilio.rest import Client account_sid = 'AC76d9b17b2c23170b7019924f709f366b' auth_token = '8fba7a54c6e3dc3754043b3865fa9d82' client = Client(account_sid, auth_token) user_sample = [ { "_id": "5e804c501c9d440000986adc", "name"...
normal
{ "blob_id": "67eb9985fc0ae9a00ce84a2460b69b00df1c9096", "index": 3310, "step-1": "<mask token>\n", "step-2": "<mask token>\nif user_sample[0].get('milesRan') >= user_sample[1].get('milesGoal'):\n message = client.messages.create(body='Oh, no! ' + user_sample[0].get(\n 'name') +\n ' surpassed y...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python ''' Generate tree search dot file ''' import copy # Colors supported by graphviz, in some pleasing order colors = { "fa": "brown", "fb": "brown1", "ea": "cadetblue", "eb": "cadetblue1", "pa": "orange", "pb": "orange4" } curId = 1 capAset = 4 capBset = 7 goal = 2 de...
normal
{ "blob_id": "599da0f045ab5c2b3f568def3d89452b56cac029", "index": 9083, "step-1": "#!/usr/bin/env python\n\n'''\n Generate tree search dot file\n'''\nimport copy\n\n# Colors supported by graphviz, in some pleasing order\ncolors = {\n \"fa\": \"brown\",\n \"fb\": \"brown1\",\n \"ea\": \"cadetblue\",\n ...
[ 0 ]
#!/usr/bin/env python # # Copyright (C) University College London, 2007-2012, all rights reserved. # # This file is part of HemeLB and is CONFIDENTIAL. You may not work # with, install, use, duplicate, modify, redistribute or share this # file, or any part thereof, other than as allowed by any agreement # specifical...
normal
{ "blob_id": "7700e3c4061f0e81a1dea8fa8b27a0380fc26e71", "index": 7171, "step-1": "<mask token>\n\n\nclass TestFabric(unittest.TestCase):\n\n def setUp(self):\n env.test_home = os.path.join(env.localroot, 'deploy', 'test')\n user_config = yaml.load(open(os.path.join(env.localroot, 'deploy',\n ...
[ 12, 14, 16, 19, 20 ]
""" LeetCode Problem: 242. Valid Anagram Link: https://leetcode.com/problems/valid-anagram/ Written by: Mostofa Adib Shakib Language: Python """ class Solution(object): def isAnagram(self, s, t): """ :type s: str :type t: str :rtype: bool """ length1 = len(s...
normal
{ "blob_id": "a4f932a8566afe0265dc1057d0f6534a608697f7", "index": 365, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution(object):\n\n def isAnagram(self, s, t):\n \"\"\"\n :type s: str\n :t...
[ 0, 1, 2, 3 ]
# coding:utf-8 class SpiderMiddlewares1(object): def process_request(self, request): print(u"SpiderMiddlewares1 process_request {}".format(request.url)) return request def process_item(self, item): print(u"SpiderMiddlewares1 process_item {}".format(item.data)) return item cl...
normal
{ "blob_id": "8a2ab260f4758bcca7b1a68d1fb65b7eebab5533", "index": 2518, "step-1": "<mask token>\n\n\nclass SpiderMiddlewares2(object):\n\n def process_request(self, request):\n print(u'SpiderMiddlewares2 process_request {}'.format(request.url))\n return request\n\n def process_item(self, item)...
[ 3, 4, 5, 6, 7 ]
def tetrahedron_filled(tetrahedrons, water): var=0 br=0 tetrahedrons.sort() for numbers in tetrahedrons: v=(tetrahedrons[var]**3*(2**0.5))/12000 if v<water: br=br+1 water=water-v var=var+1 print (br) print (tetrahedron_filled([1000,10],10))
normal
{ "blob_id": "c926e16ef2daa5978b6c71e7794721d320bb9b1e", "index": 1224, "step-1": "<mask token>\n", "step-2": "def tetrahedron_filled(tetrahedrons, water):\n var = 0\n br = 0\n tetrahedrons.sort()\n for numbers in tetrahedrons:\n v = tetrahedrons[var] ** 3 * 2 ** 0.5 / 12000\n if v < w...
[ 0, 1, 2, 3 ]
#Import Discord Package import discord from discord.ext import commands import asyncio import glob from dotenv import load_dotenv import os load_dotenv() # Load your Discord Token TOKEN = os.getenv("TOKEN") bot = commands.Bot(command_prefix='.',case_insensitive=True) print('Ready!') @bot.command() async def stop...
normal
{ "blob_id": "41842e8b75860c65e87e9db1f7ae058957e37e45", "index": 1822, "step-1": "<mask token>\n", "step-2": "<mask token>\nload_dotenv()\n<mask token>\nprint('Ready!')\n\n\n@bot.command()\nasync def stop(ctx):\n await ctx.message.delete()\n await ctx.voice_client.disconnect()\n\n\n@bot.command()\nasync ...
[ 0, 1, 2, 3, 4 ]
strings = ['(())())', '(((()())()', '(()())((()))', '((()()(()))(((())))()', '()()()()(()()())()', '(()((())()('] #print(string[0]) ''' for i in string: testlist = [] for j in string[i]: if j == ')': if ''' def isVPS(phrase): testlist = [] for char in phrase: if char == '(...
normal
{ "blob_id": "d9f055301f050eea4281ce418974546c1245ac7e", "index": 4621, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef isVPS(phrase):\n testlist = []\n for char in phrase:\n if char == '(':\n testlist.append(char)\n elif len(testlist) == 0:\n return 'NO'\n...
[ 0, 1, 2, 3, 4 ]
import requests #!/usr/bin/env python from confluent_kafka import Producer, KafkaError import json import ccloud_lib delivered_records = 0 url = "https://api.mockaroo.com/api/cbb61270?count=1000&key=5a40bdb0" # Optional per-message on_delivery handler (triggered by poll() or flush()) # when a message has be...
normal
{ "blob_id": "b4f522398cd2658c2db926216e974781e10c44df", "index": 7897, "step-1": "<mask token>\n\n\ndef get_data():\n r = requests.get(url)\n return '{ \"data\": ' + str(r.text) + '}'\n\n\ndef main():\n args = ccloud_lib.parse_args()\n config_file = args.config_file\n topic = args.topic\n conf ...
[ 2, 4, 5, 6, 7 ]
from PIL import Image, ImageStat import os import shutil # full white photo - 255.0 # full black photo - 0.0 class ImageSelection: def __init__(self, path): self.path = path def brightness_check(self, image): '''count function to set value of brightness, 0 - full black, 100 - fu...
normal
{ "blob_id": "897075810912e8360aa5cdedda3f12ce7c868263", "index": 4547, "step-1": "<mask token>\n\n\nclass ImageSelection:\n\n def __init__(self, path):\n self.path = path\n\n def brightness_check(self, image):\n \"\"\"count function to set value of brightness, 0 - full black, 100 - full brigh...
[ 5, 6, 7, 8, 9 ]
from texttable import Texttable from nexuscli import exception from nexuscli.api import cleanup_policy from nexuscli.cli import constants def cmd_list(nexus_client): """Performs ``nexus3 cleanup_policy list``""" policies = nexus_client.cleanup_policies.list() if len(policies) == 0: return excepti...
normal
{ "blob_id": "521b90ffb4bace4cbd50d08ed4be278d4f259822", "index": 7049, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef cmd_create(nexus_client, **kwargs):\n \"\"\"Performs ``nexus3 cleanup_policy create``\"\"\"\n policy = cleanup_policy.CleanupPolicy(None, **kwargs)\n nexus_client.cleanup...
[ 0, 1, 2, 3, 4 ]
쫲𪪌𤣬㐭𤙵⃢姅幛𑄹馻돷軔ሠ𡺶ײַ𢊅𠞡鞿𭞎𦠟𦔻뜸𣦏蛫履뜟𢒰疅𗕢𨞧漷𫴫礴𬽣𨚒𠻚゚罉ꉷ🕸𡑁𩂱𑫌抿锃𫕊𦿮橖𓋊𧭠酞Ё햾𞄶𪳧蕱ꗍ𐊯𬏷먽𬻩뱩𗼾𠑧銋𝂥蘒굳뜀𬜀𮧛𡐔𭋇𭘡𬙒蕶믅𬂚𡟐剿𨸒ᄉ𮩨烘𮩽𭚱𗨦ﳇ큿턽쾘𩁻ꫲ𗨿蚀𨊍胗𗔑鼴𨵾㽡𩠌ݜ𪢭𩘼넴𤩭𬩽𢺤𫅬𧁏響𬶉喡𘨘뉵𨲊Ζ𥀐𩨇𠮢⏂𭖳𫓢𧛃𦥮単𦇭𮏨𬋪婓츏𪱔𭄿𦭺𣍵蹖🨞ޝ仂䱔讔ﭑ𨹟𐊁ﱥ𧅔𓇪뽼𗩢픛𖮌䮁ီ邾ࢠ㭨𣯇𩱵𥋭ѽ샑𭹓𫳃𧝽𥲇ᛲ𘁕粣𣑑ᒔ𣥕쯞⒋𩍥纝攂𨄷ͭ𧲵퍃氩𢐅𤵲뎋𥵘黴𤼩𬝉ⶌ𥬥𧺥浞🇴𑨲𠎆筬⌝༤쾘𤌲ы𡚎𑲙㽰𐛱𫛛�...
normal
{ "blob_id": "76c1929e901fce469661a299184765875d0eb53f", "index": 3658, "step-1": "쫲𪪌𤣬㐭𤙵⃢姅幛𑄹馻돷軔ሠ𡺶ײַ𢊅𠞡鞿𭞎𦠟𦔻뜸𣦏蛫履뜟𢒰疅𗕢𨞧漷𫴫礴𬽣𨚒𠻚゚罉ꉷ🕸𡑁𩂱𑫌抿锃𫕊𦿮橖𓋊𧭠酞Ё햾𞄶𪳧蕱ꗍ𐊯𬏷먽𬻩뱩𗼾𠑧銋𝂥蘒굳뜀𬜀𮧛𡐔𭋇𭘡𬙒蕶믅𬂚𡟐剿𨸒ᄉ𮩨烘𮩽𭚱𗨦ﳇ큿턽쾘𩁻ꫲ𗨿蚀𨊍胗𗔑鼴𨵾㽡𩠌ݜ𪢭𩘼넴𤩭𬩽𢺤𫅬𧁏響𬶉喡𘨘뉵𨲊Ζ𥀐𩨇𠮢⏂𭖳𫓢𧛃𦥮単𦇭𮏨𬋪婓츏𪱔𭄿𦭺𣍵蹖🨞ޝ仂䱔讔ﭑ𨹟𐊁ﱥ𧅔𓇪뽼...
[ 0 ]
# Software License Agreement (BSD License) # # Copyright (c) 2009-2011, Eucalyptus Systems, Inc. # All rights reserved. # # Redistribution and use of this software in source and binary forms, with or # without modification, are permitted provided that the following conditions # are met: # # Redistributions of source ...
normal
{ "blob_id": "920cd41b18f5cfb45f46c44ed707cebe682d4dd9", "index": 820, "step-1": "# Software License Agreement (BSD License)\n#\n# Copyright (c) 2009-2011, Eucalyptus Systems, Inc.\n# All rights reserved.\n#\n# Redistribution and use of this software in source and binary forms, with or\n# without modification, ar...
[ 0 ]
from ..lib import read_input, write_output def link_bits(num: str = None, bit_i: str = '0', bit_j: str = '0', write: bool = True) -> int: if num is None: num, bit_i, bit_j = read_input() num = int(num, 2) num_len = num.bit_length() mask = 2 ** num_len - 1 first_i = (num >> (num_len - int(b...
normal
{ "blob_id": "113572682ca83408b7c22e0e178f29945d741142", "index": 6672, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef link_bits(num: str=None, bit_i: str='0', bit_j: str='0', write: bool=True\n ) ->int:\n if num is None:\n num, bit_i, bit_j = read_input()\n num = int(num, 2)\n ...
[ 0, 1, 2, 3, 4 ]
from rest_framework import serializers from api.models.Phones import Phones class PhoneSerializer(serializers.ModelSerializer): class Meta: model = Phones fields = ( 'id', 'number', 'area_code', 'country_code' )
normal
{ "blob_id": "e3ba6395a8d7272fc7e5a8be37e6b0b18c355e14", "index": 9272, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass PhoneSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = Phones\n fields = 'id', 'number', 'area_code', 'country_code'\n", "step-3": "from re...
[ 0, 1, 2, 3 ]
import twitter def twitter_authenticate(): return; def identify_dupes(): return; def remove_dupes(): return; def get_tweets(): return;
normal
{ "blob_id": "d4683d055ca70f31b050f0d84cb93c030feb4593", "index": 2179, "step-1": "<mask token>\n\n\ndef twitter_authenticate():\n return\n\n\n<mask token>\n\n\ndef get_tweets():\n return\n", "step-2": "<mask token>\n\n\ndef twitter_authenticate():\n return\n\n\n<mask token>\n\n\ndef remove_dupes():\n ...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python import mincemeat import sys from mapinput import FileShardsMapInput from mapinput import JsonFileMapInput def mapfn(k, v): for w in v.split(): yield w, 1 def reducefn(k, vs): result = 0 for v in vs: result += v return result s = mincemeat.Server() s.map_input =...
normal
{ "blob_id": "09c6dd0f32b8d71dacdd8b10d995ea1575f91f6f", "index": 2887, "step-1": "<mask token>\n\n\ndef mapfn(k, v):\n for w in v.split():\n yield w, 1\n\n\ndef reducefn(k, vs):\n result = 0\n for v in vs:\n result += v\n return result\n\n\n<mask token>\n", "step-2": "<mask token>\n\n...
[ 2, 3, 4, 5, 6 ]
ss = str(input()) print(len(ss) - ss.count(' '))
normal
{ "blob_id": "7f72f6a2ff0c7ceacb0f893d04c20402e850421a", "index": 1840, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(len(ss) - ss.count(' '))\n", "step-3": "ss = str(input())\nprint(len(ss) - ss.count(' '))\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import random def generatePassword (): numLowerCase = numUpperCase = numSpecialCase = numNumber = 0 password = "" randomChars = "-|@.,?/!~#%^&*(){}[]\=*" length = random.randint(10, 25) while(numSpecialCase < 1 or numNumber < 1 or numLowerCase < 1 or numUpperCase < 1): password = "" ...
normal
{ "blob_id": "3956d4cdb0a8654b6f107975ac003ce59ddd3de1", "index": 4485, "step-1": "<mask token>\n\n\ndef main():\n print(generatePassword())\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef generatePassword():\n numLowerCase = numUpperCase = numSpecialCase = numNumber = 0\n password = ''\n ran...
[ 1, 2, 3, 4, 5 ]
import ray import os import sys import random path_join = os.path.join real_path = os.path.realpath perfd_dir = real_path(path_join(os.getcwd())) microps_dir = path_join(perfd_dir, "thirdparty", "microps") sys.path += [perfd_dir, microps_dir] from thirdparty.microps.oracle.experiments.spark_sql_perf.main import Spar...
normal
{ "blob_id": "25595b5f86a41fee1dc43f199f3bcff73f6d256b", "index": 9418, "step-1": "<mask token>\n\n\n@ray.remote\ndef run(run_config: dict, wrks: dict) ->dict:\n try:\n add_spk_role()\n except:\n print('run, spark: ignore')\n os.chdir(microps_dir)\n base_spk_config = spk.apps_config_map[...
[ 1, 2, 3, 4, 5 ]
from artichoke import DefaultManager, Config from artichoke.helpers import read, prompt from fabric.api import env, task, run import os chars = ''.join(chr(c) if chr(c).isupper() or chr(c).islower() else '_' for c in range(256)) class MagicDefaultManager(DefaultManager): def __init__(self, env): self.en...
normal
{ "blob_id": "09f032301fa9389f6b07687e0ee13844e0b4ddf3", "index": 249, "step-1": "from artichoke import DefaultManager, Config\nfrom artichoke.helpers import read, prompt\nfrom fabric.api import env, task, run\nimport os\n\nchars = ''.join(chr(c) if chr(c).isupper() or chr(c).islower() else '_' for c in range(256...
[ 0 ]
from .menu import menu from .create_portfolio import create_portfolio from .search import search from .list_assets import list_assets from .add_transaction import add_transaction from .stats import stats from .info import info
normal
{ "blob_id": "f2abb7ea3426e37a10e139d83c33011542e0b3d1", "index": 3863, "step-1": "<mask token>\n", "step-2": "from .menu import menu\nfrom .create_portfolio import create_portfolio\nfrom .search import search\nfrom .list_assets import list_assets\nfrom .add_transaction import add_transaction\nfrom .stats impor...
[ 0, 1 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 7 03:41:18 2020 @author: owlthekasra """ import methods as md import add_label as al import numpy as np import pandas as pd import random sb_rd_1 = '/Users/owlthekasra/Documents/Code/Python/AudioStimulus/data/sine_bass/trials_2' sb_rd_2 = '/Users...
normal
{ "blob_id": "54d714d1e4d52911bcadf3800e7afcc2c9a615a5", "index": 6743, "step-1": "<mask token>\n\n\ndef subtract_moving_average(df, n=50):\n k = n\n bgnorm = pd.DataFrame(np.zeros((len(df), len(df.columns))))\n for j in range(0, len(df)):\n for i in range(0, len(df.columns)):\n indices...
[ 2, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'test1.ui' # # Created by: PyQt5 UI code generator 5.7 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName(...
normal
{ "blob_id": "3222dd7c2d19d86f2e085cb489ab4a48307ba132", "index": 7458, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_Dialog(object):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Ui_Dialog(object):\n\n def setupUi(self, Dialog):\n Dialog.setObjectNam...
[ 0, 1, 2, 4, 5 ]
import sys, serial, time, signal, threading from MFRC522 import MFRC522 from event import Event class Sensor(threading.Thread): # main program for reading and processing tags def __init__(self, name): threading.Thread.__init__(self) self.name = name self.continue_reading = False self.tag_reader = MFRC522() ...
normal
{ "blob_id": "c179d27f1620414061d376d4f30d2ddd4fd2750e", "index": 3842, "step-1": "import sys, serial, time, signal, threading\nfrom MFRC522 import MFRC522\nfrom event import Event\n\nclass Sensor(threading.Thread):\n\n\t# main program for reading and processing tags\n\tdef __init__(self, name):\n\t\tthreading.Th...
[ 0 ]
from django.urls import path from group import views app_name = 'group' urlpatterns = [ path('group/',views.CreateGroup.as_view(), name='group_create'), path('shift/',views.CreateShift.as_view(), name='shift_create'), path('subject/',views.createSubject.as_view(), name='subject_create'), ]
normal
{ "blob_id": "0b7e858eb6d4a5f3cf6aca4fea994dae9f889caa", "index": 4781, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'group'\nurlpatterns = [path('group/', views.CreateGroup.as_view(), name=\n 'group_create'), path('shift/', views.CreateShift.as_view(), name=\n 'shift_create'), path('su...
[ 0, 1, 2, 3 ]
#!/usr/bin/python import os import psycopg2 import datetime import time import json import decimal import requests import csv import asyncio from config import get_connection, get_db_sql, get_sql_record_count, CORP_TYPES_IN_SCOPE, corp_num_with_prefix, bare_corp_num from orgbook_data_load import ( get_orgbook_all...
normal
{ "blob_id": "cdb49af584ae7befcaebfd9bb303073c8229667e", "index": 3433, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nasync def process_credential_queue():\n print(\"Get exported wallet id's from agent\", datetime.datetime.now())\n agent_wallet_ids = get_agent_wallet_ids()\n print(\"# wallet...
[ 0, 1, 2, 3, 4 ]
import FWCore.ParameterSet.Config as cms class StageOneCustomize(): """ Customizaton class for STXS stage 1 analysis """ def __init__(self, process, customize, metaConditions): self.process = process self.customize = customize self.metaConditions = metaConditions se...
normal
{ "blob_id": "ce12ede15f4ca4a085e38e455515d8a028da8fd2", "index": 2115, "step-1": "<mask token>\n\n\nclass StageOneCustomize:\n <mask token>\n\n def __init__(self, process, customize, metaConditions):\n self.process = process\n self.customize = customize\n self.metaConditions = metaCond...
[ 6, 7, 8, 9, 10 ]
import asyncio import logging import os from async_cron.job import CronJob from async_cron.schedule import Scheduler from sqlalchemy import asc import spider import squid import verifier from db import sess_maker from model import Proxy, STATUS_OK, STATUS_ERROR from server import run_api_server from tool import logge...
normal
{ "blob_id": "1d529e2ea5526ddcda0d0da30ed8ed4724002c63", "index": 7074, "step-1": "<mask token>\n", "step-2": "<mask token>\nlogging.basicConfig(level=logging.INFO, datefmt='%Y/%m/%d %H:%M:%S', format\n ='%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n<mask token>\n\n\n@cron_wait\nasync def verify_e...
[ 0, 1, 2, 3, 4 ]
from django.contrib import admin from .models import Spot from leaflet.admin import LeafletGeoAdmin class SpotAdmin(LeafletGeoAdmin): pass admin.site.register(Spot, SpotAdmin)
normal
{ "blob_id": "7633944366c6655306bc41087b19a474e9c414b5", "index": 7688, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass SpotAdmin(LeafletGeoAdmin):\n pass\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass SpotAdmin(LeafletGeoAdmin):\n pass\n\n\nadmin.site.register(Spot, SpotAdmin)\...
[ 0, 1, 2, 3 ]
import tkinter.ttk import tkinter as tk def update_info(info_t, data): # temp = info_t.selection_set("x") # print(temp) # info_t.delete(temp) # temp = info_t.selection_set("y") # info_t.delete(temp) pass def path_to_string(s): res = "" for i in range(len(s)-1): res += str(s[i...
normal
{ "blob_id": "a4d47b9a28ec66f6a0473498674ebc538d909519", "index": 5111, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef path_to_string(s):\n res = ''\n for i in range(len(s) - 1):\n res += str(s[i][0])\n res += ', '\n res += str(s[i][1])\n res += ' > '\n res += ...
[ 0, 3, 4, 5, 6 ]
from . import FixtureTest class GatesLineGeometry(FixtureTest): def test_linear_gate(self): # Add barrier:gates with line geometries in landuse # Line barrier:ghate feature self.load_fixtures(['http://www.openstreetmap.org/way/391260223']) self.assert_has_feature( 16, ...
normal
{ "blob_id": "2192e328bdfa454ff1d1f66a05fb6a322c48b244", "index": 2847, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass GatesLineGeometry(FixtureTest):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass GatesLineGeometry(FixtureTest):\n\n def test_linear_gate(self):\n self.load_...
[ 0, 1, 2, 3, 4 ]
from time import sleep import sys def cmdline(): available_commands = ['help', 'quit', 'echo', 'pbar', 'joke'] keepgoing = True while (keepgoing): typed = input("Type something. (Type 'help' for options)") words = [w for w in typed.split(" ")] command = words[0].lower() argu...
normal
{ "blob_id": "a028661f9bcaa6dfe5389cb57f31b07d7e981487", "index": 9890, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef cmdline():\n available_commands = ['help', 'quit', 'echo', 'pbar', 'joke']\n keepgoing = True\n while keepgoing:\n typed = input(\"Type something. (Type 'help' for...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python from xrouter import api api.main()
normal
{ "blob_id": "64368679aa2e387e25a36b2f3d0312a99b819e95", "index": 2147, "step-1": "<mask token>\n", "step-2": "<mask token>\napi.main()\n", "step-3": "from xrouter import api\napi.main()\n", "step-4": "#!/usr/bin/env python\nfrom xrouter import api\napi.main()\n", "step-5": null, "step-ids": [ 0, ...
[ 0, 1, 2, 3 ]
import datetime, time, threading, os from . import queues logLevels = ["none", "info", "debug"] level = "none" def write(message): queues.logger_queue.put(message) def runLogger(): while True: # The log path should be read from config. Pass into logger? log_path = "/home/pi/Desktop/Projects/r...
normal
{ "blob_id": "91188b55b0f5d8277812d82711f5bcde82819b30", "index": 9563, "step-1": "<mask token>\n\n\ndef runLogger():\n while True:\n log_path = '/home/pi/Desktop/Projects/rose/robot_code/logs/'\n try:\n os.makedirs(log_path)\n except FileExistsError:\n pass\n ...
[ 3, 4, 5, 6, 7 ]
text = input('Ввести имя файла: ') def a(): lines = 0 words = 0 letters = 0 for line in open(f'{text}.txt', 'r'): lines += 1 letters += len(line.strip('.,:-()!?;)"\'\n}')) words += len(line.split()) return f'Lines = {lines}, words = {words}, letters = {letters}' print(a()...
normal
{ "blob_id": "2a65287588fe1337ba1a6f7c2e15e0505611d739", "index": 2228, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef a():\n lines = 0\n words = 0\n letters = 0\n for line in open(f'{text}.txt', 'r'):\n lines += 1\n letters += len(line.strip('.,:-()!?;)\"\\'\\n}'))\n ...
[ 0, 1, 2, 3 ]
import os import time import json import click import click_log import logging from flightsio.scraper import FlightScraper logger = logging.getLogger(__name__) click_log.basic_config(logger) @click.group() def main(): """ An empty click group, required in order to bundle the other commands. """ pass...
normal
{ "blob_id": "234aad868ea71bbe476b303bcff37221820f1d90", "index": 4310, "step-1": "<mask token>\n\n\n@click.group()\ndef main():\n \"\"\"\n An empty click group, required in order to bundle the other commands.\n \"\"\"\n pass\n\n\n<mask token>\n\n\n@main.command(help=\n \"\"\"Reads the route list b...
[ 4, 6, 7, 8, 10 ]
# -*- coding: utf-8 -*- """Application configuration. See https://github.com/sloria/cookiecutter-flask for configuration options with other flask-extensions """ import os class Config(object): """Base configuration.""" SECRET_KEY = os.environ.get('DELIVERY_ASSISTANT_SECRET', 'secret-key') # TODO: Change me...
normal
{ "blob_id": "4cc1c8668a84cc6faadf60053568d155b8852c5f", "index": 5643, "step-1": "<mask token>\n\n\nclass DevConfig(Config):\n <mask token>\n ENV = 'dev'\n DEBUG = True\n\n\nclass TestConfig(Config):\n \"\"\"Test configuration.\"\"\"\n TESTING = True\n DEBUG = True\n", "step-2": "<mask token>...
[ 5, 9, 11, 13, 14 ]
from django.contrib.auth.models import User from django.db import models class Chat(models.Model): category = models.CharField(unique=True, max_length=100) def __str__(self): return self.category class ChatMessage(models.Model): context = models.CharField(max_length=1000) user = models.Fore...
normal
{ "blob_id": "61179dc734069017adaabd53804ed0102d9416e3", "index": 8865, "step-1": "<mask token>\n\n\nclass ChatMessage(models.Model):\n context = models.CharField(max_length=1000)\n user = models.ForeignKey(User, on_delete=models.CASCADE)\n chat = models.ForeignKey(Chat, on_delete=models.CASCADE)\n ti...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/python # -*- coding: utf-8 -*- import asyncio from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from myshell.environment import Environment from myshell.job import Job, JobState class JobManager: """事务管理器,用以调度前台和后台事务""" def __init__(self, environment: "Environment"): self...
normal
{ "blob_id": "e09f914f00e59124ef7d8a8f183bff3f7f74b826", "index": 5869, "step-1": "<mask token>\n\n\nclass JobManager:\n <mask token>\n\n def __init__(self, environment: 'Environment'):\n self.foreground_job: Optional[Job] = None\n self.background_jobs: list[Optional[Job]] = [None]\n se...
[ 11, 12, 14, 15, 16 ]
from command import Command, is_command, CommandException from event import Event class ItemInfo(Command): @is_command def item_info(self, player, *args): if len(args) == 0: raise CommandException(CommandException.NOT_ENOUGH_ARGUMENTS) item_id = args[0] if item_id in playe...
normal
{ "blob_id": "6b2bd6954f188626fa857ffc37611d3f971d22e2", "index": 5259, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ItemInfo(Command):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ItemInfo(Command):\n\n @is_command\n def item_info(self, player, *args):\n if len(args...
[ 0, 1, 2, 3, 4 ]
default_app_config = "assistant.additionalpage.apps.AdditionalPageAppConfig"
normal
{ "blob_id": "0e2c71ab4f194af3c2ee65c2cbd6f36921eb587e", "index": 2079, "step-1": "<mask token>\n", "step-2": "default_app_config = 'assistant.additionalpage.apps.AdditionalPageAppConfig'\n", "step-3": "default_app_config = \"assistant.additionalpage.apps.AdditionalPageAppConfig\"\n", "step-4": null, "ste...
[ 0, 1, 2 ]
class Solution(object): def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ exist = set() s_to_t = {} if len(s) != len(t): return False for i, v in enumerate(s): if v not in s_t...
normal
{ "blob_id": "b4e2897e20448d543c93402174db7da4066a8510", "index": 5144, "step-1": "<mask token>\n\n\nclass Solution_ref(object):\n\n def isIsomorphic(self, s, t):\n return [s.find(i) for i in s] == [t.find(j) for j in t]\n\n\n<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n\n\nc...
[ 2, 3, 4, 5, 6 ]
num1 = 101 num2 = 20 add = num1 + num2 sub = num1 - num2 mul = num1 * num2 div = num1 / num2 mod = num1 % num2 exp = num1 ** num2 fd = num1 // num2 print(num1) print(num2) print(add) print(sub) print(mul) print(div) print(mod) print(exp) print(fd)
normal
{ "blob_id": "3ffbef142d8fb53b734567ebea874f9c59ff9a9e", "index": 1455, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(num1)\nprint(num2)\nprint(add)\nprint(sub)\nprint(mul)\nprint(div)\nprint(mod)\nprint(exp)\nprint(fd)\n", "step-3": "num1 = 101\nnum2 = 20\nadd = num1 + num2\nsub = num1 - num2\nm...
[ 0, 1, 2 ]
from enum import IntEnum class DaqListType(IntEnum): """ This class describes a daq list type. """ DAQ = 0x01 STIM = 0x02 DAQ_STIM = 0x03
normal
{ "blob_id": "71e0137fc02b4f56bdf87cc15c275f5cca1588c4", "index": 8925, "step-1": "<mask token>\n\n\nclass DaqListType(IntEnum):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass DaqListType(IntEnum):\n <mask token>\n DAQ = 1\n STIM = 2\n ...
[ 1, 2, 3, 4, 5 ]
Relevance Thus, designing an automatic MWP solver, with semantic understanding and inference capability, has been considered as a crucial step towards general AI. Solving a math problem manually involves too many steps. So MWP will reduc Attachment final.pdf added.Conversation opened. 1 read message. Skip ...
normal
{ "blob_id": "eb6a4170e5427f10eda4d650996c2cbd8a34ca21", "index": 2667, "step-1": "Relevance\r\n\r\nThus, designing an automatic MWP solver, with semantic understanding and\r\n inference capability, has been considered as a crucial step towards general AI. \r\n Solving a math problem manually involves too many s...
[ 0 ]
/Applications/anaconda2/lib/python2.7/warnings.py
normal
{ "blob_id": "cd2062055e30fc37a5f00f4bce6ffd9ea5eda860", "index": 4134, "step-1": "/Applications/anaconda2/lib/python2.7/warnings.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
# import os,sys # BASE_DIR=os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # sys.path.append(BASE_DIR) from lib import common from conf import settings import random import pickle import os import xlrd import time class Base: def save(self): file_path=r'%s/%s' %(self.DB_PATH,self.id) p...
normal
{ "blob_id": "7cd6a8a106c21e8e377666d584e19d30c607b7d2", "index": 9345, "step-1": "<mask token>\n\n\nclass Subject(Base):\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def filter_question(cls):\n id_l = os.listdir(settings.QUESTION_PATH)\n r_id_l = random.sample(id_l...
[ 21, 23, 24, 27, 30 ]
from ipyleaflet import Map, DrawControl, Marker, Rectangle from sentinelhub import BBox, CRS from ipywidgets import widgets as w class BBoxSelector: def __init__(self, bbox, zoom=8, resolution=10): center = (bbox.min_y + bbox.max_y) / 2, (bbox.min_x + bbox.max_x) / 2 self.map = Map(center=center,...
normal
{ "blob_id": "0545aff80e19e47cb9e5b1941e92ff5cb109f9e6", "index": 1921, "step-1": "<mask token>\n\n\nclass BBoxSelector:\n\n def __init__(self, bbox, zoom=8, resolution=10):\n center = (bbox.min_y + bbox.max_y) / 2, (bbox.min_x + bbox.max_x) / 2\n self.map = Map(center=center, zoom=zoom, scroll_w...
[ 3, 4, 5, 6, 7 ]
from django.conf.urls import url from tipz import views urlpatterns = [ # /tipz/ url(r'^$', views.IndexView.as_view(), name='index'), # /tipz/login url(r'^login/$', views.LoginFormView.as_view(), name='login'), # /tipz/logout url(r'^logout/$', views.LogoutFormView.as_view(), name='logout'), ...
normal
{ "blob_id": "3ea123aceb72e4731afe98cf4c5beced2d424035", "index": 3302, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^$', views.IndexView.as_view(), name='index'), url(\n '^login/$', views.LoginFormView.as_view(), name='login'), url(\n '^logout/$', views.LogoutFormView.as_view(...
[ 0, 1, 2, 3 ]
import random def createRandomPhoneNumber(): phoneNumberFront = ['130', '131', '132', '133', '134', '135', '136', '137', '138', '139', '150', '151', '152', '153', '158', '159', '177', '180', '181', '182', '183', '186', '188', '189'] phoneNumberBack = [] for i in range(8): phoneNumb...
normal
{ "blob_id": "5e8f9a222fb2c35b4720e48f0277481e410aee47", "index": 2791, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef createRandomPhoneNumber():\n phoneNumberFront = ['130', '131', '132', '133', '134', '135', '136',\n '137', '138', '139', '150', '151', '152', '153', '158', '159',\n ...
[ 0, 1, 2 ]
__author__ = "Rick Sherman" __credits__ = "Jeremy Schulman, Nitin Kumar" import unittest from nose.plugins.attrib import attr from jnpr.junos import Device from jnpr.junos.utils.scp import SCP from mock import patch @attr('unit') class TestScp(unittest.TestCase): def setUp(self): self.dev = Device(host...
normal
{ "blob_id": "65ea40ad1c1bf6bf23aed5316b91862c9cdc353d", "index": 5564, "step-1": "<mask token>\n\n\n@attr('unit')\nclass TestScp(unittest.TestCase):\n <mask token>\n <mask token>\n\n @patch('paramiko.SSHClient')\n def test_scp_close(self, mock_connect):\n self.dev.bind(scp=SCP)\n self.d...
[ 4, 6, 7, 8, 9 ]
import socket import sys from datetime import datetime from threading import Thread import logging class RRConnection(): def __init__(self): self._listenerSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self._inSock = None self._inThread = Thread(target=self.inLoop) self...
normal
{ "blob_id": "2ccc5e01a3b47a77abcb32160dee74a6a74fcfbb", "index": 5808, "step-1": "<mask token>\n\n\nclass RRConnection:\n <mask token>\n <mask token>\n\n def stop(self):\n self._isRunning = False\n self._listenerSocket.close()\n self._inSock.close()\n <mask token>\n <mask toke...
[ 7, 12, 13, 16, 19 ]