code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class LocationViewSet(viewsets.ModelViewSet): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class LocationViewSe...
flexible
{ "blob_id": "aef45cb8ea9fcaeffcca147da7637536bcc4b226", "index": 6217, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass LocationViewSet(viewsets.ModelViewSet):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass LocationViewSet(viewsets.ModelViewSet):\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class SceneClass: def __init__(self): self._entities = {} self.scene = None def get_entity_id(self, identifier): return self._entities[identifier] def get_position_absolute(self, entity): return tuple(entity.worldPosition) def get_orient...
flexible
{ "blob_id": "23d4619527b5fce7fed0b0a66d834e26bb984129", "index": 6443, "step-1": "<mask token>\n\n\nclass SceneClass:\n\n def __init__(self):\n self._entities = {}\n self.scene = None\n\n def get_entity_id(self, identifier):\n return self._entities[identifier]\n\n def get_position_a...
[ 9, 10, 11, 12, 14 ]
import pyximport pyximport.install(build_in_temp=False,inplace=True) import Cython.Compiler.Options Cython.Compiler.Options.annotate = True import numpy as np from test1 import c_test,c_test_result_workaround a = np.ascontiguousarray(np.array([ [1,2,3],[1,2,3],[1,2,3] ], dtype=np.long), dtype=np.long) print '\nStar...
normal
{ "blob_id": "0276181055f2c70562c1f557a16d00ba7107d003", "index": 1219, "step-1": "\n\nimport pyximport\npyximport.install(build_in_temp=False,inplace=True)\nimport Cython.Compiler.Options\nCython.Compiler.Options.annotate = True\nimport numpy as np\nfrom test1 import c_test,c_test_result_workaround\n\na = np.as...
[ 0 ]
import requests import urllib.request from utilities.read_write_utilities import read_set,write_to_csv import time from bs4 import BeautifulSoup import pickledb import json import glob import csv drugs = read_set('/Users/sandeep.dey/Downloads/2020-02-06_scrape/drugs') print(drugs) output_records = [] # fields = ["equ...
normal
{ "blob_id": "e7f511b97f316157a768203afe9f36ea834ebb6c", "index": 5493, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(drugs)\n<mask token>\nfor drug in drugs:\n with open('/Users/sandeep.dey/Downloads/2020-02-06_scrape/%s' % drug\n ) as json_file:\n for record in json.load(json_fil...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestConsoleUrlShow(TestConsole): _server = compute_fakes.create_one_server() def setUp(self): super(TestConsoleUrlShow, self).setUp() self.sdk_client.find_server.return_value = self._server fake_console_data = {'url': 'http://localhost', 'protocol': ...
flexible
{ "blob_id": "cc9485dea0975a0974f037b129816a9359b2b622", "index": 2875, "step-1": "<mask token>\n\n\nclass TestConsoleUrlShow(TestConsole):\n _server = compute_fakes.create_one_server()\n\n def setUp(self):\n super(TestConsoleUrlShow, self).setUp()\n self.sdk_client.find_server.return_value = ...
[ 10, 15, 18, 19, 20 ]
<|reserved_special_token_0|> class Region: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Region: <|reserved_special_token_0|> def calc_feature(self, cumul_sum): yy = self.y + self.height xx = self.x + sel...
flexible
{ "blob_id": "03e92eae4edb4bdbe9fa73e39e7d5f7669746fe5", "index": 3859, "step-1": "<mask token>\n\n\nclass Region:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Region:\n <mask token>\n\n def calc_feature(self, cumul_sum):\n yy = self.y + self.height\n xx = self....
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> {'variables': {'mac_asan_dylib': '<(PRODUCT_DIR)/libclang_rt.asan_osx_dynamic.dylib'}, 'targets': [{ 'target_name': 'fletch-vm', 'type': 'none', 'dependencies': [ 'src/vm/vm.gyp:fletch-vm']}, {'target_name': 'c_test_library', 'type': 'none', '...
flexible
{ "blob_id": "84b98ebf6e44d03d16f792f3586be1248c1d0221", "index": 6957, "step-1": "<mask token>\n", "step-2": "{'variables': {'mac_asan_dylib':\n '<(PRODUCT_DIR)/libclang_rt.asan_osx_dynamic.dylib'}, 'targets': [{\n 'target_name': 'fletch-vm', 'type': 'none', 'dependencies': [\n 'src/vm/vm.gyp:fletch-v...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> fout.close() <|reserved_special_token_0|> if not drive: drive = 'C:' <|reserved_special_token_0|> os.system(runString) <|reserved_special_token_0|> fout.close() <|reserved_special_token_0|> for index, line in enumerate(lines):...
flexible
{ "blob_id": "9aee715e976db632f0829a06cb9e0101c90512be", "index": 2150, "step-1": "<mask token>\n", "step-2": "<mask token>\nfout.close()\n<mask token>\nif not drive:\n drive = 'C:'\n<mask token>\nos.system(runString)\n<mask token>\nfout.close()\n<mask token>\nfor index, line in enumerate(lines):\n panelD...
[ 0, 1, 2, 3, 4 ]
import typing import time import cv2 import os from .ABC import ABC from .Exceptions import * from .Constants import * class Video(ABC): def __init__(self, filename: str, *, scale: float = 1, w_stretch: float = 2, gradient: typing.Union[int, str] = 0, verbose: int = False): if not os.path.isfile(filename...
normal
{ "blob_id": "24368b6c607c0524f8b52b279a6dce0fde72294b", "index": 8936, "step-1": "<mask token>\n\n\nclass Video(ABC):\n\n def __init__(self, filename: str, *, scale: float=1, w_stretch: float=2,\n gradient: typing.Union[int, str]=0, verbose: int=False):\n if not os.path.isfile(filename):\n ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class UploadForm(forms.Form): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class UploadForm(forms.Form): file = forms.FileField(label='Json с данными об отправлении') <|re...
flexible
{ "blob_id": "0878bfa1151371ff3aaa59f8be5ea9af74ada331", "index": 4978, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass UploadForm(forms.Form):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass UploadForm(forms.Form):\n file = forms.FileField(label='Json с данными об отправлении')\n",...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def takePicture(): global setImage setImage = True def addRectangles(locations): _, axe = pt.subplots() img = imread('hola.jpg') cv2image = cv2.cvtColor(img, cv2.COLOR_BGR2RGBA) axe.imshow(cv2image) alto, ancho, _ = img.shape for item in locations: ...
flexible
{ "blob_id": "8d8c211895fd43b1e2a38216693b0c00f6f76756", "index": 5748, "step-1": "<mask token>\n\n\ndef takePicture():\n global setImage\n setImage = True\n\n\ndef addRectangles(locations):\n _, axe = pt.subplots()\n img = imread('hola.jpg')\n cv2image = cv2.cvtColor(img, cv2.COLOR_BGR2RGBA)\n ...
[ 4, 5, 6, 7, 8 ]
import tkinter as tk import cnt_script as sW import key_script as kW import text_script as tW class MainWindow(tk.Tk): def __init__(self): super().__init__() self.title("Main Window") self.geometry("600x400+30+30") tk.Button(self, text = "Count Tags", command = self.new_ta...
normal
{ "blob_id": "1482c8276f9cfc912293356d04e08307edf6d367", "index": 5133, "step-1": "<mask token>\n\n\nclass MainWindow(tk.Tk):\n\n def __init__(self):\n super().__init__()\n self.title('Main Window')\n self.geometry('600x400+30+30')\n tk.Button(self, text='Count Tags', command=self.n...
[ 4, 5, 7, 8, 11 ]
<|reserved_special_token_0|> class plm_component(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def _insertlog(self, ids, changes={}, note={}): ret = False op_type,...
flexible
{ "blob_id": "06643bf4b1bded757078b0974c21ddec814f5889", "index": 1762, "step-1": "<mask token>\n\n\nclass plm_component(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def _insertlog(self, ids, changes={}, note={}):\n ret = False\n op_...
[ 20, 34, 38, 44, 49 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from eval_lib.classification_results import analyze_one_classification_result from eval_lib.classification_results import ClassificationBatches from eval_lib.cloud_client import CompetitionDatastoreClient from eval_lib.cloud_client import CompetitionStorageCl...
flexible
{ "blob_id": "64935ae910d5f330722b637dcc5794e7e07ab52d", "index": 8375, "step-1": "<mask token>\n", "step-2": "from eval_lib.classification_results import analyze_one_classification_result\nfrom eval_lib.classification_results import ClassificationBatches\nfrom eval_lib.cloud_client import CompetitionDatastoreC...
[ 0, 1 ]
<|reserved_special_token_0|> def prepare_directories(options, extension, subversiondir=None): datadir = options['datadir'] print('Creating directory {0:s}.'.format(datadir + extension)) try: os.makedirs(datadir + extension) except OSError as err: if err.errno == errno.EEXIST: ...
flexible
{ "blob_id": "6aeaa2ed01e0c0dac54cd8220c5da005fccc53e9", "index": 2609, "step-1": "<mask token>\n\n\ndef prepare_directories(options, extension, subversiondir=None):\n datadir = options['datadir']\n print('Creating directory {0:s}.'.format(datadir + extension))\n try:\n os.makedirs(datadir + exten...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-10-20 11:05 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0052_encounter_note'), ] operations = [ migrations.CreateModel( ...
normal
{ "blob_id": "05851df7ae64d792e0c1faf96e2aca5b40e86d53", "index": 2744, "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', '005...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_qa_set(directory, jsonl_file): """Download the WMT en-fr training corpus to directory unless it's there.""" set_name = os.path.splitext(os.path.basename(jsonl_file))[0] set_path = os.path.join(directory, set_name) src_path = set_path + '.src' targ_path = set_pa...
flexible
{ "blob_id": "bf51da12632013c62aa543ae7f02415057138c7a", "index": 694, "step-1": "<mask token>\n\n\ndef get_qa_set(directory, jsonl_file):\n \"\"\"Download the WMT en-fr training corpus to directory unless it's there.\"\"\"\n set_name = os.path.splitext(os.path.basename(jsonl_file))[0]\n set_path = os.pa...
[ 2, 3, 7, 8, 10 ]
<|reserved_special_token_0|> class DLT(object): <|reserved_special_token_0|> def getimg(self, idx): images = sorted(glob.glob(datadir + 'images_undistorted/*.jpg')) return cv2.imread(images[idx]) <|reserved_special_token_0|> def estimatePoseDLT(self, p, P, idx): """ D...
flexible
{ "blob_id": "50ae47c88bbc0f281ef75784377fb65192e257b0", "index": 1206, "step-1": "<mask token>\n\n\nclass DLT(object):\n <mask token>\n\n def getimg(self, idx):\n images = sorted(glob.glob(datadir + 'images_undistorted/*.jpg'))\n return cv2.imread(images[idx])\n <mask token>\n\n def est...
[ 4, 6, 7, 8, 10 ]
from pwn import * DEBUG = False if DEBUG: p = process("binary_100") else: p = remote("bamboofox.cs.nctu.edu.tw", 22001) padding = 0x34 - 0xc payload = padding * "A" + p32(0xabcd1234) p.send(payload) p.interactive() p.close()
normal
{ "blob_id": "fab75c5b55d85cef245fa6d7e04f4bf3a35e492c", "index": 7068, "step-1": "<mask token>\n", "step-2": "<mask token>\nif DEBUG:\n p = process('binary_100')\nelse:\n p = remote('bamboofox.cs.nctu.edu.tw', 22001)\n<mask token>\np.send(payload)\np.interactive()\np.close()\n", "step-3": "<mask token>...
[ 0, 1, 2, 3, 4 ]
import datetime import os import uuid from abc import ABC, abstractmethod from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.contrib.contenttypes.fields import (GenericForeignKey, GenericRelation) from django.contrib.conten...
normal
{ "blob_id": "9da995184641525cd763ecdb0bca4f28159ae740", "index": 7617, "step-1": "<mask token>\n\n\nclass ActExam(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def get_files_path(cls, package: 'DocumentsPackage'):\n tmp_path = package.get_s...
[ 76, 93, 95, 98, 116 ]
from gurobipy import * import math # params.NonConvex = 2 # K = 5 # R = {0: 1000, 1: 5000, 2: 10000, 3: 20000, 4: 69354} # imbalanced # R = {0: 50, 1: 100, 2: 150, 3: 84, 4: 400} # imbalanced # R = {0: 100, 1: 200, 2: 484} # imbalanced # R = {0: 10, 1: 20, 2: 30, 3: 50, 4: 100} # imbalanced # R = {0...
normal
{ "blob_id": "2ed9eafb6e26971f642d1e33cbb3d1f3df34990a", "index": 3401, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solve_model(K, R, N, L_max, G):\n print(\n 'parameters==| k=%d \\t |R=%s \\t |N=%d \\t |eta=%f \\t |L_max=%f \\t |G=%f'\n % (K, R, N, eta, L_max, G))\n R_sum ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def getStatsByYear(teamID, year, data): """ Returns the stats for a chosen team for a specific year. Choices are 2016 - 2019 """ teamStats = data[data['team_id'] == teamID] for index, row in teamStats.iterrows(): if row['season'] == year: teamStatsForGivenY...
flexible
{ "blob_id": "9b581df505765e895047584c5bb586faef95295f", "index": 453, "step-1": "<mask token>\n\n\ndef getStatsByYear(teamID, year, data):\n \"\"\" Returns the stats for a chosen team for a specific year. Choices are 2016 - 2019 \"\"\"\n teamStats = data[data['team_id'] == teamID]\n for index, row in te...
[ 8, 9, 11, 12, 13 ]
def filter_long_words(word_lng, words_list): return [word for word in words_list if len(word) > word_lng] assert filter_long_words(5, ['piwo', 'wino', 'czasopisma', 'ubrania', 'napoje'] ) == ['czasopisma', 'ubrania', 'napoje']
normal
{ "blob_id": "e221b840239b6e9af735238760fd1157f333c1a4", "index": 9014, "step-1": "<mask token>\n", "step-2": "def filter_long_words(word_lng, words_list):\n return [word for word in words_list if len(word) > word_lng]\n\n\n<mask token>\n", "step-3": "def filter_long_words(word_lng, words_list):\n retur...
[ 0, 1, 2 ]
from collections import defaultdict class Solution: def multiply(self, A: List[List[int]], B: List[List[int]]) -> List[List[int]]: output = [[0 for j in range(len(B[0]))] for i in range(len(A))] rows = defaultdict(list) cols = defaultdict(list) for i in ran...
normal
{ "blob_id": "8425ee79fcb41799e5edbbab822f93dd40e39d8e", "index": 6481, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def multiply(self, A: List[List[int]], B: List[List[int]]) ->List[List[int]\n ]:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def drawGraph(data, name1, name2): plt.figure(figsize=(14, 8)) li = [] li2 = [] for i in critics[name1]: if i in data[name2]: li.append(critics[name1][i]) li2.append(critics[name2][i]) plt.text(critics[name1][i], critics[name2][i...
flexible
{ "blob_id": "b377a652eec55b03f689a5097bf741b18549cba0", "index": 4939, "step-1": "<mask token>\n\n\ndef drawGraph(data, name1, name2):\n plt.figure(figsize=(14, 8))\n li = []\n li2 = []\n for i in critics[name1]:\n if i in data[name2]:\n li.append(critics[name1][i])\n li2...
[ 4, 5, 6, 7, 8 ]
# Copyright 2021 The JAX Authors. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
normal
{ "blob_id": "79c8e87e1d247eef8dd1ca8e307bbe6d25bf48e2", "index": 8172, "step-1": "<mask token>\n\n\nclass PickleTest(jtu.JaxTestCase):\n\n def testPickleOfDeviceArray(self):\n x = jnp.arange(10.0)\n s = pickle.dumps(x)\n y = pickle.loads(s)\n self.assertArraysEqual(x, y)\n s...
[ 6, 9, 10, 11, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Images & labels read!') <|reserved_special_token_0|> for i, l in zip(images, labels): images_flat.append(Vector(Utils.normalize(Utils.flatten_2d(i), 0, 1))) labels_oh.append(Utils.onehot_label_arr(l)) for i in test_...
flexible
{ "blob_id": "1f86fe72c90c8457715a2f400dae8d355a9a97cf", "index": 8577, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Images & labels read!')\n<mask token>\nfor i, l in zip(images, labels):\n images_flat.append(Vector(Utils.normalize(Utils.flatten_2d(i), 0, 1)))\n labels_oh.append(Utils.oneh...
[ 0, 1, 2, 3, 4 ]
final=[] refer={2:'abc',3:'def',4:'ghi',5:'jkl',6:'mno',7:'pqrs',8:'tuv',9:'wxyz'} ##Complete this function def possibleWords(a,N,index=0,s=''): ##Your code here if index==N: final.append(s) print(s, end=' ') return possible_chars=refer[a[0]] for i in possible_chars: ...
normal
{ "blob_id": "5f237a820832181395de845cc25b661878c334e4", "index": 9965, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef possibleWords(a, N, index=0, s=''):\n if index == N:\n final.append(s)\n print(s, end=' ')\n return\n possible_chars = refer[a[0]]\n for i in possibl...
[ 0, 1, 2, 3 ]
#crfで英文に固有表現認識(タグ付け)をする #usr/bin/python3 #coding:utf-8 from itertools import chain from sklearn.metrics import classification_report, confusion_matrix from sklearn.preprocessing import LabelBinarizer import sklearn import pycrfsuite from sklearn import cross_validation import sys import os import math import random d...
normal
{ "blob_id": "af9b83b6e213359f5e193918b6c09c22220e5457", "index": 607, "step-1": "<mask token>\n\n\ndef word2features(sent, i):\n word = sent[i][0]\n tag = sent[i][1]\n features = ['bias', 'word.lower=' + word.lower(), 'word[-3:]=' + word[-\n 3:], 'word[-2:]=' + word[-2:], 'word.isupper=%s' % word...
[ 4, 5, 7, 8, 9 ]
<|reserved_special_token_0|> def open_config(): if os.path.isfile('fin/config.json') != True: return 'no config found' else: print('config found') with open('fin/config.json') as conf: conf = json.load(conf) return conf <|reserved_special_token_0|> def get_local_date():...
flexible
{ "blob_id": "e690587c9b056f8d5a1be6dd062a2aa32e215f50", "index": 2328, "step-1": "<mask token>\n\n\ndef open_config():\n if os.path.isfile('fin/config.json') != True:\n return 'no config found'\n else:\n print('config found')\n with open('fin/config.json') as conf:\n conf = json.loa...
[ 3, 6, 7, 9, 11 ]
from django.shortcuts import render,redirect from django.http import HttpResponse from .tasks import read_all_models, update_a_model, delete_a_model, read_a_model, create_a_model from .forms import MyModelForm def home(request): content = read_all_models() sorted_list = sorted(content, key=lambda k: k['title'].title...
normal
{ "blob_id": "dc4de382ab16f036c6174e711f5c9fe52868ccc9", "index": 8445, "step-1": "<mask token>\n\n\ndef delete(request, pk):\n if delete_a_model(pk):\n return redirect('myapp:home')\n else:\n return HttpResponse('Error Occured')\n\n\ndef search(request):\n if request.method == 'POST':\n ...
[ 2, 4, 5, 6, 7 ]
# Procedures for automatic COBD calculation. # The useful ones are: # - get_heuristic4_OBD() as a heuristic one [the only heuristic one here that does not miss-out solutions] # - getOBD2plus4() as the fastest exhaustive one [uses two filtering techniques for early detection of graphs without an OBD] import itertool...
normal
{ "blob_id": "51711c9293f8b5d9dc4d299569da04e2d1bc0064", "index": 1982, "step-1": "\n\n# Procedures for automatic COBD calculation.\n# The useful ones are:\n# - get_heuristic4_OBD() as a heuristic one [the only heuristic one here that does not miss-out solutions]\n# - getOBD2plus4() as the fastest exhaustive one...
[ 0 ]
from flask import Flask, request from flask import jsonify from preprocessing import QueryProcessor from flask_cors import CORS app = Flask(__name__) CORS(app) qp = QueryProcessor() @app.route('/search_general', methods=['POST']) def query(): message = None searchQuery = request.json['searchQuery'] resul...
normal
{ "blob_id": "e582787a912f479830ed99575b2c6adb8088b4e5", "index": 257, "step-1": "<mask token>\n\n\n@app.route('/search_general', methods=['POST'])\ndef query():\n message = None\n searchQuery = request.json['searchQuery']\n result = qp.generateQuery(searchQuery)\n response = jsonify(result)\n resp...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('blog/', PostListView.as_view()), path('blog/<pk>/', PostDetailView.as_view())] <|reserved_special_token_1|> from django.urls import path from .views import PostListView, PostDetailView urlpatterns = [pa...
flexible
{ "blob_id": "be7fb94c3c423b67aa917a34328acda5926cf78a", "index": 3133, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('blog/', PostListView.as_view()), path('blog/<pk>/',\n PostDetailView.as_view())]\n", "step-3": "from django.urls import path\nfrom .views import PostListView, Po...
[ 0, 1, 2, 3 ]
"""Generic utilities module""" from . import average from . import extract_ocean_scalar from . import git from . import gmeantools from . import merge from . import netcdf from . import xrtools __all__ = [ "average", "extract_ocean_scalar", "git", "gmeantools", "merge", "netcdf", "xrtools"...
normal
{ "blob_id": "ab6450ee9038e0c58ca8becf6d2518d5e00b9c90", "index": 9393, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['average', 'extract_ocean_scalar', 'git', 'gmeantools', 'merge',\n 'netcdf', 'xrtools']\n", "step-3": "<mask token>\nfrom . import average\nfrom . import extract_ocean_sca...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function, with_statement """ cosi299a- Cinderella alexluu@brandeis.edu """ def truecase_is(string): """ -> lower/title/upper/other """ if string.islower(): return 'l' if string.istitle(): return 't' if string...
normal
{ "blob_id": "75ddcdd4e80b962198ff9de1d996837927c3ac1a", "index": 824, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef truecase_is(string):\n \"\"\" -> lower/title/upper/other \"\"\"\n if string.islower():\n return 'l'\n if string.istitle():\n return 't'\n if string.isuppe...
[ 0, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Train Benign: ' + str(np.count_nonzero(Y_Train == 0))) print('Train Malignant: ' + str(np.count_nonzero(Y_Train == 1))) print('Test Benign: ' + str(np.count_nonzero(Y_Test == 0))) print('Test Malignant: ' + str(np.count_non...
flexible
{ "blob_id": "42ae3804c2d8f6a0d440e2bb6231186a868630b1", "index": 2772, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Train Benign: ' + str(np.count_nonzero(Y_Train == 0)))\nprint('Train Malignant: ' + str(np.count_nonzero(Y_Train == 1)))\nprint('Test Benign: ' + str(np.count_nonzero(Y_Test == 0))...
[ 0, 1, 2, 3, 4 ]
import unittest.mock import assist import pytest def test_simple_query(): q = assist.build_query(select='time, value', from_='system_load', where='L2=\'cpuload\' and time > \'2021-06-16 00:00:00\' and time < \'2021-06-17 00:00:00\' and "name" != \'Idle\'', gr...
normal
{ "blob_id": "8aa9ba145b6c7347a7a926d50dca35383ddd52a3", "index": 9217, "step-1": "<mask token>\n\n\ndef test_nested_query_with_datetime():\n inner_q = assist.build_query(select='time, value', from_='system_load',\n where='L2=\\'cpuload\\' and \"name\" != \\'Idle\\'', groupby=('host', 'L3'))\n outer_...
[ 6, 8, 9, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for x in range(1, 100000): b = a * x print(x, '*', a, '=', b) if b > 100: break <|reserved_special_token_1|> a = int(input('Choose a number: ')) for x in range(1, 100000): b = a * x print(x, '*', a, ...
flexible
{ "blob_id": "043dd97d4d4ade29536a83c3557a34db3a4cb0f9", "index": 2002, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor x in range(1, 100000):\n b = a * x\n print(x, '*', a, '=', b)\n if b > 100:\n break\n", "step-3": "a = int(input('Choose a number: '))\nfor x in range(1, 100000):\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @router.get('/salary/{user_id}', status_code=200) def read_base_salary(user_id: int, db: Session=Depends(get_db), current_user: User=Depends(get_current_user)): return crud.get_base_salarys(db, user_id=user_id, current=current_user) <|reserved_special_token_0|> <|reserved_spec...
flexible
{ "blob_id": "f10e20d5c409930d697c36d1897ebcb648511e27", "index": 3694, "step-1": "<mask token>\n\n\n@router.get('/salary/{user_id}', status_code=200)\ndef read_base_salary(user_id: int, db: Session=Depends(get_db),\n current_user: User=Depends(get_current_user)):\n return crud.get_base_salarys(db, user_id=...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def rule(type): if booktabs: if type == 'top': return '\\toprule' if type == 'mid': return '\\midrule' if type == 'bottom': return '\\bottomrule' else: return '\\hline' def make_header(alignment, border, custom,...
flexible
{ "blob_id": "591ac07e735e08bcafa8274eb1a1547a01261f55", "index": 8430, "step-1": "<mask token>\n\n\ndef rule(type):\n if booktabs:\n if type == 'top':\n return '\\\\toprule'\n if type == 'mid':\n return '\\\\midrule'\n if type == 'bottom':\n return '\\\\bo...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def RetrieveMemory(): ram_info = psutil.virtual_memory() typePresented = 'Total : ', 'Used : ', 'Free : ', 'Usage : ' counter = 0 print() for info in ram_info: try: if info > 100: print(typePresented[counter], convert_size(info)) ...
flexible
{ "blob_id": "d960d3d1680f825f0f68fc6d66f491bbbba805ce", "index": 5004, "step-1": "<mask token>\n\n\ndef RetrieveMemory():\n ram_info = psutil.virtual_memory()\n typePresented = 'Total : ', 'Used : ', 'Free : ', 'Usage : '\n counter = 0\n print()\n for info in ram_info:\n try:\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class ChrDuplicates(ElementwiseDuplicateElimination): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ChrDuplicates(ElementwiseDuplicateElimination): <|reserved_special_token_0|> def is_equal(s...
flexible
{ "blob_id": "9276c4106cbe52cf0e2939b5434d63109910a45c", "index": 8801, "step-1": "<mask token>\n\n\nclass ChrDuplicates(ElementwiseDuplicateElimination):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ChrDuplicates(ElementwiseDuplicateElimination):\n <mask token>\n\n def is_eq...
[ 1, 2, 3, 4 ]
#! /usr/bin/python # encode:utf-8 import subprocess import sys import pdb argvs = sys.argv if len(argvs) != 2: print "Please input 1 argument" quit() searchWord = argvs[1] cmd1 = "ls -a /etc/" p1 = subprocess.Popen(cmd1.strip().split(" "), stdout=subprocess.PIPE) stdout_data, stderr_data = p1.communicate() p1.st...
normal
{ "blob_id": "c12d45644098aef5c042a62095eeae5829d70f45", "index": 7641, "step-1": "#! /usr/bin/python\n# encode:utf-8\nimport subprocess\nimport sys\nimport pdb\n\nargvs = sys.argv\nif len(argvs) != 2:\n print \"Please input 1 argument\"\n quit()\n\nsearchWord = argvs[1]\n\ncmd1 = \"ls -a /etc/\"\np1 = subproce...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def twenty(): pass
flexible
{ "blob_id": "3727c4413cd69305c8ee8d02f4532629da7d25de", "index": 7135, "step-1": "<mask token>\n", "step-2": "def twenty():\n pass\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
a = list(range(1, 501)) b = list(range(1, 501)) c = list(range(1, 501)) for i in a: for j in b: for k in c: if i + k + j == 1000 and i < j < k and j ** 2 + i ** 2 == k ** 2: print(i) print(j) print(k) break
normal
{ "blob_id": "34947b7ed300f2cbcbf9042fee3902458921d603", "index": 2912, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in a:\n for j in b:\n for k in c:\n if i + k + j == 1000 and i < j < k and j ** 2 + i ** 2 == k ** 2:\n print(i)\n print(j)\n ...
[ 0, 1, 2 ]
import numpy as np import random import sys import canton as ct from canton import * import tensorflow as tf time_steps = 16 def get_text_data(filename): import codecs with open(filename,'rb') as f: text = f.read() length = len(text) print('got corpus length:', length) return text def mod...
normal
{ "blob_id": "0016e38d39ed2a4c7a75bed103bc47a5b6fd0e8c", "index": 2538, "step-1": "<mask token>\n\n\ndef r(ep=100):\n length = len(corpus)\n batch_size = 256\n mbl = time_steps * batch_size\n sr = length - mbl - time_steps - 2\n for i in range(ep):\n print('---------------------iter', i, '/'...
[ 6, 9, 12, 13, 14 ]
import math #h=g^x h=input("h: ") g=input("g: ") p=input("p: ") m=math.ceil(math.sqrt(p)) m=int(m) aj=[0]*m for i in range(m): aj[i]=pow(g,i*m) ainvm=pow(g,p-2,p) gamma = h for i in range(m): if gamma in aj: j = aj.index(gamma) print (j*m)+i break gamma=(gamma*ainvm)%p
normal
{ "blob_id": "94439ffe3303f5efe15562f26d693e1e7a8115df", "index": 2009, "step-1": "import math #h=g^x\nh=input(\"h: \")\ng=input(\"g: \")\np=input(\"p: \")\nm=math.ceil(math.sqrt(p))\nm=int(m)\naj=[0]*m\nfor i in range(m):\n aj[i]=pow(g,i*m)\nainvm=pow(g,p-2,p)\ngamma = h\nfor i in range(m):\n if gamma in ...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(i) <|reserved_special_token_0|> print(i) <|reserved_special_token_0|> print(i) <|reserved_special_token_0|> print(i) <|reserved_special_token_0|> print(s) <|reserved_special_token_0|> print(s) <|reserved_special_token_0|> pr...
flexible
{ "blob_id": "bea7853d1f3eac50825bc6eb10438f3f656d6d04", "index": 1947, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(i)\n<mask token>\nprint(i)\n<mask token>\nprint(i)\n<mask token>\nprint(i)\n<mask token>\nprint(s)\n<mask token>\nprint(s)\n<mask token>\nprint(s)\n<mask token>\nprint(s)\n<mask tok...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def best_rank_selection(generation): max_selected = len(generation) // 10 sorted_by_fitness = sorted(generation, key=lambda x: x.fitness, reverse =True) return sorted_by_fitness[:max_selected]
flexible
{ "blob_id": "05a80a904548e90bea635469b94264f219062560", "index": 7968, "step-1": "<mask token>\n", "step-2": "def best_rank_selection(generation):\n max_selected = len(generation) // 10\n sorted_by_fitness = sorted(generation, key=lambda x: x.fitness, reverse\n =True)\n return sorted_by_fitness...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> os.chdir(masterdir) exec(open('01_newqs_directory.py', 'r', encoding='utf8').read()) exec(open('02_new_register.py', 'r', encoding='utf8').read()) exec(open('03_moved_in.py', 'r', encoding='utf8').read()) exec(open('04_false_death...
flexible
{ "blob_id": "5a2716fc7b4c0a56fbd0de5d45d71fb33320adf0", "index": 2889, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.chdir(masterdir)\nexec(open('01_newqs_directory.py', 'r', encoding='utf8').read())\nexec(open('02_new_register.py', 'r', encoding='utf8').read())\nexec(open('03_moved_in.py', 'r', enco...
[ 0, 1, 2, 3, 4 ]
from unittest import TestCase from tests import AuthHelperTestCase class TestTestHelper(TestCase): """ Test our helper functions """ def test_assertAnyIn_fails(self): """ Make sure assertInAny fails correctly :return: """ test_case = AuthHelperTestCase('asser...
normal
{ "blob_id": "ae1aab7563443db3a31fe98b5b26b32944d57c9d", "index": 1473, "step-1": "<mask token>\n\n\nclass TestTestHelper(TestCase):\n <mask token>\n <mask token>\n\n def test_assertAnyIn_suceeds(self):\n \"\"\"\n Make sure assertInAny succeeds\n \n :return: \n \"\"\"\n...
[ 2, 3, 4, 5 ]
import tensorflow as tf def data_rescale(x): return tf.subtract(tf.divide(x, 127.5), 1) def inverse_rescale(y): return tf.round(tf.multiply(tf.add(y, 1), 127.5))
normal
{ "blob_id": "1a09b38838f40c4c6049da8e6a72ba3d56806c07", "index": 3703, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef inverse_rescale(y):\n return tf.round(tf.multiply(tf.add(y, 1), 127.5))\n", "step-3": "<mask token>\n\n\ndef data_rescale(x):\n return tf.subtract(tf.divide(x, 127.5), 1)\...
[ 0, 1, 2, 3 ]
from os import listdir from os.path import isfile, join import sys cat_list = dict(); def onImport(): mypath = "../../data/roget_processed"; onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]; for f_name in onlyfiles: f_temp = open(mypath + "/" + f_name); f_lines = f_temp.readlines(); for l...
normal
{ "blob_id": "b1b9840fabc96c901e5ed45e22ee63af2f3550cb", "index": 8643, "step-1": "<mask token>\n\n\ndef onImport():\n mypath = '../../data/roget_processed'\n onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]\n for f_name in onlyfiles:\n f_temp = open(mypath + '/' + f_name)\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class LoginPage(BasePage): <|reserved_special_token_0|> @teststeps def __init__(self): self.home = HomePage() self.toast = Toast() <|reserved_special_token_0|> @teststeps def wait_check_test1(self): """以微信主界面“tab:微信”的text为依据""" try...
flexible
{ "blob_id": "600b49c7884f8b6e3960549702a52deb20089f5a", "index": 3503, "step-1": "<mask token>\n\n\nclass LoginPage(BasePage):\n <mask token>\n\n @teststeps\n def __init__(self):\n self.home = HomePage()\n self.toast = Toast()\n <mask token>\n\n @teststeps\n def wait_check_test1(s...
[ 17, 18, 20, 21, 22 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def subset2_helper(num, mid_result, result, position): result.append(mid_result[:]) for i in range(position, len(num)): mid_result.append(num[i]) subset2_helper(num, mid_result, result, i + 1) mid...
flexible
{ "blob_id": "829910af55ca84838537a2e1fa697713c7a6c6ca", "index": 8400, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef subset2_helper(num, mid_result, result, position):\n result.append(mid_result[:])\n for i in range(position, len(num)):\n mid_result.append(num[i])\n subset2_h...
[ 0, 1, 2, 3, 4 ]
import tensorflow as tf import csv from tensorflow.keras import layers from tensorflow.keras.layers.experimental import preprocessing import pandas as pd import numpy as np import random import matplotlib.pyplot as plt import math def plot_loss(history): plt.plot(history.history['loss'], label='loss') plt.plot(his...
normal
{ "blob_id": "196147d7b2b0cf7176b5baa50d7e7618f88df493", "index": 7911, "step-1": "<mask token>\n\n\ndef plot_loss(history):\n plt.plot(history.history['loss'], label='loss')\n plt.plot(history.history['val_loss'], label='val_loss')\n plt.ylim([0, 10])\n plt.xlabel('Epoch')\n plt.ylabel('Error')\n ...
[ 1, 2, 3, 4, 5 ]
# # PySNMP MIB module Nortel-MsCarrier-MscPassport-AtmEbrMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-AtmEbrMIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:19:41 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4...
normal
{ "blob_id": "202670314ad28685aaa296dce4b5094daab3f47a", "index": 4889, "step-1": "<mask token>\n", "step-2": "<mask token>\nif mibBuilder.loadTexts:\n mscAtmIfVpcSrcEbrOvRowStatusTable.setStatus('mandatory')\n<mask token>\nif mibBuilder.loadTexts:\n mscAtmIfVpcSrcEbrOvRowStatusEntry.setStatus('mandatory'...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Menu: def __init__(self): self.data = dict() self.main = Tk() self.main.title('Molécules') self.main.config(bg='black') self.main.minsize(210, 220) self.mean = float Button(self.main, width=14, bg='black', fg='white', text...
flexible
{ "blob_id": "4d05e65dce9f689ae533a57466bc75fa24db7b4d", "index": 4558, "step-1": "<mask token>\n\n\nclass Menu:\n\n def __init__(self):\n self.data = dict()\n self.main = Tk()\n self.main.title('Molécules')\n self.main.config(bg='black')\n self.main.minsize(210, 220)\n ...
[ 17, 18, 23, 24, 26 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(calculation) print(calculation2) print(calculation3) <|reserved_special_token_0|> print('Hi there, You are ' + myage + ' years old') <|reserved_special_token_0|> print('The result is ' + result) print('average: %.2f' % ((3 +...
flexible
{ "blob_id": "03f73a55e0a0773bbdbb0d5e29a2db598ba2e080", "index": 149, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(calculation)\nprint(calculation2)\nprint(calculation3)\n<mask token>\nprint('Hi there, You are ' + myage + ' years old')\n<mask token>\nprint('The result is ' + result)\nprint('avera...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> import Ploneboard import PloneboardForum import PloneboardConversation import PloneboardComment
flexible
{ "blob_id": "abdf5aee77ee879c50d0e605d5fd95e28a7ef7aa", "index": 5631, "step-1": "<mask token>\n", "step-2": "import Ploneboard\nimport PloneboardForum\nimport PloneboardConversation\nimport PloneboardComment\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# Bradley N. Miller, David L. Ranum # Introduction to Data Structures and Algorithms in Python # Copyright 2005 # __all__=['BinaryTree', 'Stack'] class Stack: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def push(self, item): self.items.append...
normal
{ "blob_id": "5f48c7a68cb9734d84dee2cf8ff4d7be490cf328", "index": 2888, "step-1": "<mask token>\n\n\nclass BinaryTree:\n <mask token>\n\n def __init__(self, rootObj):\n self.key = rootObj\n self.leftChild = None\n self.rightChild = None\n self.parent = None\n\n def insertLeft(...
[ 12, 19, 30, 31, 37 ]
<|reserved_special_token_0|> def test_uri_manager_mock_write(): mock_file = mock.Mock() opener = mock.Mock(spec=open, return_value=mock_file) manager = URIManager(opener, 'filename') f = manager.acquire() f.write('contents') manager.close() opener.assert_called_once_with('filename', mode='...
flexible
{ "blob_id": "8fe71e87512dfd2ccfcd21c9c175cb50274d9661", "index": 1867, "step-1": "<mask token>\n\n\ndef test_uri_manager_mock_write():\n mock_file = mock.Mock()\n opener = mock.Mock(spec=open, return_value=mock_file)\n manager = URIManager(opener, 'filename')\n f = manager.acquire()\n f.write('con...
[ 5, 6, 7, 8, 9 ]
#!/usr/bin/env python from pathlib import Path import os from setuptools import setup, find_packages install_requires = [ "numpy", "tensorflow-hub==0.4.0", "bert-tensorflow==1.0.1", "click" ] # Hacky check for whether CUDA is installed has_cuda = any("CUDA" in name.split("_") for name in os.environ....
normal
{ "blob_id": "a1141e6aae6992a5037d53093378f0d346f2ca29", "index": 7666, "step-1": "<mask token>\n", "step-2": "<mask token>\ninstall_requires.append('tensorflow-gpu==1.13.1' if has_cuda else\n 'tensorflow==1.13.1')\n<mask token>\nsetup(name='easybert', version=version, url=\n 'https://github.com/robrua/ea...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def mig_loss_function(output1, output2, p): new_output = output1 / p m = new_output @ output2.transpose(1, 0) noise = torch.rand(1) * 0.0001 m1 = torch.log(m * I + I * noise + E - I) m2 = m * (E - I) return -(sum(sum(m1)) + Config.batch_size) / normalize_1 + sum(su...
flexible
{ "blob_id": "be9179b33991ba743e6e6b7d5dd4dc85ffc09fc3", "index": 6331, "step-1": "<mask token>\n\n\ndef mig_loss_function(output1, output2, p):\n new_output = output1 / p\n m = new_output @ output2.transpose(1, 0)\n noise = torch.rand(1) * 0.0001\n m1 = torch.log(m * I + I * noise + E - I)\n m2 = ...
[ 10, 11, 12, 14, 15 ]
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # https://doc.scrapy.org/en/latest/topics/items.html import scrapy class JiayuanItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() person_id = scrapy.Field(...
normal
{ "blob_id": "9dbadb2421b04961e8e813831d06abc1ff301566", "index": 3283, "step-1": "<mask token>\n\n\nclass PersonInfo(scrapy.Item):\n person_id = scrapy.Field()\n buy_car = scrapy.Field()\n address = scrapy.Field()\n\n\nclass OtherItem(scrapy.Item):\n \"\"\"\n 可以定义另外一个item\n \"\"\"\n ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def k_most_frequent(arr: list, k: int): """ """ counts = defaultdict(int) for n in nums: counts[n] += 1 counts = [(k, v) for k, v in counts.items()] ordered = list(reversed(sorted(counts, key=lambda d...
flexible
{ "blob_id": "1298c2abae519a5365cc0d9d406196db987eb219", "index": 5923, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef k_most_frequent(arr: list, k: int):\n \"\"\" \"\"\"\n counts = defaultdict(int)\n for n in nums:\n counts[n] += 1\n counts = [(k, v) for k, v in counts.items()]...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for _ in range(times): removed = elements.pop() elements.insert(0, removed) print(elements) <|reserved_special_token_1|> elements = str(input('Type the elements of list: ')).split() elements = list(map(float, elements))...
flexible
{ "blob_id": "307bb7461a729ba979f6a862fe7c292c42f96ce6", "index": 1164, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(times):\n removed = elements.pop()\n elements.insert(0, removed)\nprint(elements)\n", "step-3": "elements = str(input('Type the elements of list: ')).split()\neleme...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class App(npyscreen.StandardApp): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class App(npyscreen.StandardApp): def onStart(self): self.MainForm = self.addForm('MA...
flexible
{ "blob_id": "dc2c429bae10ee14737583a3726eff8fde8306c7", "index": 6940, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass App(npyscreen.StandardApp):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass App(npyscreen.StandardApp):\n\n def onStart(self):\n self.MainForm = self.addFor...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': pickled = True create_sets = True normed = False if len(sys.argv) > 2: filename = sys.argv[1] else: filename = os.path.join(os.path.pardir, os.path.pardir, 'data', ...
flexible
{ "blob_id": "18a17c7326a6ae96f74c843d1a902074b377a6d2", "index": 2701, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n pickled = True\n create_sets = True\n normed = False\n if len(sys.argv) > 2:\n filename = sys.argv[1]\n else:\n filename = os.pat...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def menu(x): """ Takes a list as argument and displays as a menu """ for i in range(len(x)): print('{0:>4s} {1:<3s}{2:^5s}{3:<15}'.format(str(i + 1) + ')', x[i] [1], '-->', x[i][0])) <|reserved_special_token_0|> def secondary_message(t, unit): """ A mes...
flexible
{ "blob_id": "235bb1b9d4c41c12d7667a6bac48737464c685c7", "index": 568, "step-1": "<mask token>\n\n\ndef menu(x):\n \"\"\" Takes a list as argument and displays as a menu \"\"\"\n for i in range(len(x)):\n print('{0:>4s} {1:<3s}{2:^5s}{3:<15}'.format(str(i + 1) + ')', x[i]\n [1], '-->', x[i...
[ 3, 5, 7, 10, 11 ]
class Person: def __init__(self, fname, lname): self.fname = fname self.lname = lname def GetName(self): return (self.fname + ' ' + self.lname)
normal
{ "blob_id": "ff358136bc96fa7f3eb41d019ddfd10fc4db8f0d", "index": 5558, "step-1": "<mask token>\n", "step-2": "class Person:\n <mask token>\n <mask token>\n", "step-3": "class Person:\n <mask token>\n\n def GetName(self):\n return self.fname + ' ' + self.lname\n", "step-4": "class Person:...
[ 0, 1, 2, 3, 4 ]
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> import turtle turtle.setup(650,350,200,200) turtle.penup() turtle.fd(-250) turtle.pendown() ...
normal
{ "blob_id": "e069ad88b5173e5859f1b01b9fb45951d1e82593", "index": 4280, "step-1": "Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32\nType \"help\", \"copyright\", \"credits\" or \"license()\" for more information.\n>>> import turtle \nturtle.setup(65...
[ 0 ]
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You may # not use this file except in compliance with the License. A copy of the # License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompanyin...
normal
{ "blob_id": "6f107d0d0328c2445c0e1d0dd10e51227da58129", "index": 3900, "step-1": "<mask token>\n\n\n@service_marker\nclass TestTrainingDebuggerJob:\n\n def _wait_sagemaker_training_rule_eval_status(self, training_job_name,\n rule_type: str, expected_status: str, wait_periods: int=30,\n period_le...
[ 4, 7, 8, 9, 11 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # menuScrnTxt.py # Created on Mon Mar 8 16:17:50 2021 # @author: jcj52436999 # menuScrnTxt.py-2021-03-08-1641-just noting a general restart in efforts here import sys def printTest2(): if 0 == 0 : print(" ") print("# jcj-jcj-jcj- TOP START OF...
normal
{ "blob_id": "e4f7e0c40edde4aac6ba0a7529a2e028a09689ae", "index": 7260, "step-1": "<mask token>\n\n\ndef printTest2():\n if 0 == 0:\n print(' ')\n print(\n '# jcj-jcj-jcj- TOP START OF PROGRAM - jcj-jcj-jcj-jcj-jcj-jcj-jcj-jcj-jcj'\n )\n thisProgramIs = 'menuScrnTxt.p...
[ 3, 4, 5, 6, 7 ]
from utils import * from wordEmbedding import * print("bat dau") def predict(text, phobert, tokenizer): model = load_model('model.h5') X_test = word2vec(text, phobert, tokenizer) x_test_tensor = tf.convert_to_tensor(X_test) X_tests = [] X_tests.append(x_test_tensor) X_tests = tf.convert_to_t...
normal
{ "blob_id": "d2c9ee64472c74767812d842d2c49eec962e28c6", "index": 4451, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef predict(text, phobert, tokenizer):\n model = load_model('model.h5')\n X_test = word2vec(text, phobert, tokenizer)\n x_test_tensor = tf.convert_to_tensor(X_test)\n X_te...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sg.ChangeLookAndFeel('Black') <|reserved_special_token_0|> for parole in words: parola = lmtzr.lemmatize(parole, 'v') appendFile = open('filteredtext.txt', 'a') appendFile.write(' ' + str(parola)) appendFile.close(...
flexible
{ "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 ]
<|reserved_special_token_0|> def search_word(qst): global txt for h in qst: temp = [] for n, l in enumerate(txt): if [n for i, j in enumerate(l) if h in j] != []: temp.append(n) if temp != []: fnd.append(temp) <|reserved_special_token_0|> def...
flexible
{ "blob_id": "d30129248f5245560ee0d3ee786e118427e169d7", "index": 4616, "step-1": "<mask token>\n\n\ndef search_word(qst):\n global txt\n for h in qst:\n temp = []\n for n, l in enumerate(txt):\n if [n for i, j in enumerate(l) if h in j] != []:\n temp.append(n)\n ...
[ 3, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def but(a): global op op = op + str(a) displayStr.set(op) def eq(): global op result = str(eval(op)) displayStr.set(result) op = '' def clrbut(): displayStr.set('') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_...
flexible
{ "blob_id": "106cca8af164fa4ae946f77b40c76e03accf171c", "index": 9645, "step-1": "<mask token>\n\n\ndef but(a):\n global op\n op = op + str(a)\n displayStr.set(op)\n\n\ndef eq():\n global op\n result = str(eval(op))\n displayStr.set(result)\n op = ''\n\n\ndef clrbut():\n displayStr.set(''...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app.run(debug=True, host='0.0.0.0') <|reserved_special_token_1|> <|reserved_special_token_0|> os.environ['CITY_CONF'] = '/opt/ris-web/city/duisburg.py' <|reserved_special_token_0|> app.run(debug=True, host='0.0.0.0') <|reserv...
flexible
{ "blob_id": "4276fd61ad48b325961cd45be68eea6eab51f916", "index": 6085, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.run(debug=True, host='0.0.0.0')\n", "step-3": "<mask token>\nos.environ['CITY_CONF'] = '/opt/ris-web/city/duisburg.py'\n<mask token>\napp.run(debug=True, host='0.0.0.0')\n", "step...
[ 0, 1, 2, 3 ]
from django.db import models from skills.models import skill from offres.models import Offer # Create your models here. class OfferRequirement(models.Model): skill = models.ForeignKey(skill, on_delete=models.DO_NOTHING ,default="") offer = models.ForeignKey(Offer , on_delete=models.CASCADE, default="")
normal
{ "blob_id": "3640f1df412b43b42fb4e856604508f698a208ad", "index": 6385, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass OfferRequirement(models.Model):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass OfferRequirement(models.Model):\n skill = models.ForeignKey(skill...
[ 0, 1, 2, 3, 4 ]
import tensorflow as tf from models.base_model import BaseModel from utils.im_utils import batch_convert_2_int from datasets.single_dataset import SingleDataset from datasets.unpaired_dataset import UnpairedDataset from models.generators.maskshadowgan_generators import Generator from models.discriminators.maskshadowgan...
normal
{ "blob_id": "cbbe273a19a4e60b760e35aeb8d43972a46760f5", "index": 3436, "step-1": "<mask token>\n\n\nclass MaskShadowGANModel(BaseModel):\n <mask token>\n <mask token>\n\n def generate_dataset(self):\n \"\"\"\n Add ops for dataset loaders to graph\n \"\"\"\n if self.training:\...
[ 8, 9, 11, 12, 13 ]
two_digit_number=input("Type a two digit number: ") first_digit=two_digit_number[0] second_digit=two_digit_number[1] print(int(first_digit)+int(second_digit))
normal
{ "blob_id": "7d65e4e925e90d6b013ae2c059cde58538884d22", "index": 7239, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(int(first_digit) + int(second_digit))\n", "step-3": "two_digit_number = input('Type a two digit number: ')\nfirst_digit = two_digit_number[0]\nsecond_digit = two_digit_number[1]\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def build_default_args_for_node_classification(dataset): cpu = not torch.cuda.is_available() args = {'lr': 0.01, 'weight_decay': 0.0005, 'max_epoch': 1000, 'max_epochs': 1000, 'patience': 100, 'cpu': cpu, 'device_id': [0], 'seed': [42], 'dropout': 0.5, 'hidden_size...
flexible
{ "blob_id": "2396f7acab95260253c367c62002392760157705", "index": 1236, "step-1": "<mask token>\n\n\ndef build_default_args_for_node_classification(dataset):\n cpu = not torch.cuda.is_available()\n args = {'lr': 0.01, 'weight_decay': 0.0005, 'max_epoch': 1000,\n 'max_epochs': 1000, 'patience': 100, '...
[ 5, 6, 7, 8, 10 ]
<|reserved_special_token_0|> class Fuzzer: <|reserved_special_token_0|> <|reserved_special_token_0|> @classmethod def from_list(cls, params): raise NotImplementedError('ABSTRACT METHOD') @property def prng_state(self): raise NotImplementedError('ABSTRACT METHOD') def fuz...
flexible
{ "blob_id": "aa2a268143856d8f33b1aaf24f4e28ffd95cab01", "index": 4658, "step-1": "<mask token>\n\n\nclass Fuzzer:\n <mask token>\n <mask token>\n\n @classmethod\n def from_list(cls, params):\n raise NotImplementedError('ABSTRACT METHOD')\n\n @property\n def prng_state(self):\n rai...
[ 7, 8, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> __author__ = 'raek' web = '910d59f0-30bd-495b-a54c-bf5addc81a8a' app = '21ec74fb-e941-43be-8772-a2f8dc6ccc4f' <|reserved_special_token_1|> #! /usr/bin/python # -*- coding: utf-8 -*- __author__ = 'raek' web = '910d59f0-30bd-495b-a54c-bf5addc81a8a' app = '2...
flexible
{ "blob_id": "cce645073ba117b9e297dfccf5a39710b0c6cd14", "index": 8479, "step-1": "<mask token>\n", "step-2": "__author__ = 'raek'\nweb = '910d59f0-30bd-495b-a54c-bf5addc81a8a'\napp = '21ec74fb-e941-43be-8772-a2f8dc6ccc4f'\n", "step-3": "#! /usr/bin/python\n# -*- coding: utf-8 -*-\n__author__ = 'raek'\n\nweb ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('user/<int:id>/', views.getUser), path('user/addImage/', views.addImage), path('user/getImage/<int:id>/', views.getImage), path( 'user/signup/', views.signUp), path('user/login/', views.logIn), path( ...
flexible
{ "blob_id": "2458b8169029b3af501b650d548925770b0da74e", "index": 6656, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('user/<int:id>/', views.getUser), path('user/addImage/',\n views.addImage), path('user/getImage/<int:id>/', views.getImage), path(\n 'user/signup/', views.signUp...
[ 0, 1, 2, 3 ]
import os import string filenames = os.listdir('data/SENTIMENT_test') filenames.sort() outfile = open('sentiment_test.txt', 'w') remove_punctuation_map = dict((ord(char), None) for char in string.punctuation) for filename in filenames: infile = open('data/SENTIMENT_test/' + filename, errors='ignore') infiletext...
normal
{ "blob_id": "6434e427c9015544985a38104cffeaa10866b9ea", "index": 4585, "step-1": "<mask token>\n", "step-2": "<mask token>\nfilenames.sort()\n<mask token>\nfor filename in filenames:\n infile = open('data/SENTIMENT_test/' + filename, errors='ignore')\n infiletext = infile.read()\n infiletext = infilet...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Person: def __call__(self, name): print('__call__' + ' Hello ' + name) <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Person: def __call__(self, name): print('__call__' + ...
flexible
{ "blob_id": "7b1c7228c1fc9501ab857cba62a7e073691e75c9", "index": 755, "step-1": "<mask token>\n\n\nclass Person:\n\n def __call__(self, name):\n print('__call__' + ' Hello ' + name)\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Person:\n\n def __call__(self, name):\n ...
[ 2, 3, 4, 5, 6 ]
from unittest.mock import MagicMock import pytest from charpe.mediums.email_handler import EmailHandler from charpe.errors import InsuficientInformation def test_send_requirements(config): handler = EmailHandler(config) with pytest.raises(InsuficientInformation): handler.publish({}) with pytest...
normal
{ "blob_id": "e2d8a1e13a4162cd606eec12530451ab230c95b6", "index": 3103, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_send_requirements(config):\n handler = EmailHandler(config)\n with pytest.raises(InsuficientInformation):\n handler.publish({})\n with pytest.raises(Insuficie...
[ 0, 1, 2, 3, 4 ]
import os import config ############################ # NMJ_RNAI LOF/GOF GENE LIST def nmj_rnai_set_path(): return os.path.join(config.datadir, 'NMJ RNAi Search File.txt') def nmj_rnai_gain_of_function_set_path(): return os.path.join(config.datadir, 'NMJ_RNAi_gain_of_function_flybase_ids.txt') def get_n...
normal
{ "blob_id": "6a9d64b1ef5ae8e9d617c8b0534e96c9ce7ea629", "index": 4951, "step-1": "\nimport os\n\nimport config\n\n\n############################\n# NMJ_RNAI LOF/GOF GENE LIST\n\ndef nmj_rnai_set_path():\n return os.path.join(config.datadir, 'NMJ RNAi Search File.txt')\n\n\ndef nmj_rnai_gain_of_function_set_pa...
[ 0 ]
import tensorflow as tf from rnn_cells import gru_cell, lstm_cell from tensorflow.python.ops import rnn def shape_list(x): ps = x.get_shape().as_list() ts = tf.shape(x) return [ts[i] if ps[i] is None else ps[i] for i in range(len(ps))] def bi_dir_lstm(X, c_fw, h_fw, c_bw, h_bw, units, scope='bi_dir_lstm')...
normal
{ "blob_id": "e550a2d46e46f0e07d960e7a214fbaa776bab0d5", "index": 4697, "step-1": "<mask token>\n\n\ndef shape_list(x):\n ps = x.get_shape().as_list()\n ts = tf.shape(x)\n return [(ts[i] if ps[i] is None else ps[i]) for i in range(len(ps))]\n\n\ndef bi_dir_lstm(X, c_fw, h_fw, c_bw, h_bw, units, scope='bi...
[ 6, 7, 8, 9, 12 ]
from __future__ import unicode_literals from django.db import models # Create your models here. class Group(models.Model): name = models.CharField(max_length=200, db_index=True) loan_eligibility = models.CharField(max_length=200, db_index=True) account_number = models.CharField(max_length=200, db_index=Tr...
normal
{ "blob_id": "0c8b58acf33bdfa95984d29a75ae01e49d0da149", "index": 9202, "step-1": "<mask token>\n\n\nclass Member(models.Model):\n name = models.CharField(max_length=200, db_index=True)\n age = models.CharField(max_length=200)\n phone = models.CharField(max_length=200)\n address1 = models.CharField(ma...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file '/home/cypher/.eric6/eric6plugins/vcsGit/ConfigurationPage/GitPage.ui' # # Created by: PyQt5 UI code generator 5.8 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_GitPage(object):...
normal
{ "blob_id": "80891a4c9703f91509d2c1b22304f33426dfb962", "index": 4419, "step-1": "<mask token>\n\n\nclass Ui_GitPage(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_GitPage(object):\n\n def setupUi(self, GitPage):\n GitPage.setObjectName('GitPage')\n GitP...
[ 1, 2, 3, 4, 5 ]
# Generated by Django 2.1.7 on 2019-03-18 02:25 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('training_area', '0006_remove_event_day'), ] operations = [ migrations.Crea...
normal
{ "blob_id": "9905559909f10831373e659cde0f275dc5d71e0d", "index": 7041, "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 = [('training_ar...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestH2FrameEnabledDisabledTsoGroGso( TestH2FrameEnabledDisabledTsoGroGsoBase, NetWorker): def test_headers_frame_with_continuation(self): client, server = self.setup_tests() self.run_test_tso_gro_gso_disabled(client, server, self. _test_headers_f...
flexible
{ "blob_id": "e474cb3db74b5344bd861aacf779cb9f77830ef6", "index": 5661, "step-1": "<mask token>\n\n\nclass TestH2FrameEnabledDisabledTsoGroGso(\n TestH2FrameEnabledDisabledTsoGroGsoBase, NetWorker):\n\n def test_headers_frame_with_continuation(self):\n client, server = self.setup_tests()\n sel...
[ 27, 33, 37, 46, 48 ]
<|reserved_special_token_0|> @view_config(route_name='auto_api', request_method='GET', renderer='json') def single_auto(request: Request): car_id = request.matchdict.get('car_id') car = Repository.car_by_id(car_id) if not car: msg = "The car with id '{}' was not found.".format(car_id) retu...
flexible
{ "blob_id": "cb903f3f7fd3c4f3ba5f8ff2ce12aac9c680aa15", "index": 6116, "step-1": "<mask token>\n\n\n@view_config(route_name='auto_api', request_method='GET', renderer='json')\ndef single_auto(request: Request):\n car_id = request.matchdict.get('car_id')\n car = Repository.car_by_id(car_id)\n if not car:...
[ 1, 2, 3, 4, 5 ]
import numpy as np import tensorflow as tf import math from .. import util def debug_inference(inference, dummy, entropy, cross_entropy, expected_log_likelhood): dummy = tf.Print(dummy, [entropy], 'entropy: ') dummy = tf.Print(dummy, [cross_entropy], 'cross_entropy: ') dummy = tf.Print(dummy, [expected_log...
normal
{ "blob_id": "4758d6efde21e3b5d91f107188f24b6ddf7cbbe4", "index": 7935, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef debug_inference(inference, dummy, entropy, cross_entropy,\n expected_log_likelhood):\n dummy = tf.Print(dummy, [entropy], 'entropy: ')\n dummy = tf.Print(dummy, [cross_en...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def update(stdin=None): """Update the current address book installation.""" curr_path = Path.cwd() / CURRENT_NAME if not curr_path.exists(): print('ERROR: There is no symlink named {!r} in the current directo...
flexible
{ "blob_id": "f5274f5d838d484ca0c1cc5a5192a2fd698cf827", "index": 9432, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef update(stdin=None):\n \"\"\"Update the current address book installation.\"\"\"\n curr_path = Path.cwd() / CURRENT_NAME\n if not curr_path.exists():\n print('ERROR...
[ 0, 1, 2, 3, 4 ]
import sys from PySide2.QtWidgets import QApplication, QDialog, QLineEdit, QPushButton,QVBoxLayout, QLabel, QWidget from docx import Document from docx.shared import Inches class Form(QDialog): def __init__(self, parent=None): super(Form, self).__init__(parent) #set the size #Creat widgets...
normal
{ "blob_id": "bad13218a7a9e687fbd29099ca80771296789d36", "index": 1321, "step-1": "<mask token>\n\n\nclass Form(QDialog):\n\n def __init__(self, parent=None):\n super(Form, self).__init__(parent)\n self.setWindowTitle('Cover Letter Developer')\n self.label1 = QLabel('Input Company Name')\n...
[ 2, 3, 4, 5, 6 ]