code
stringlengths
13
1.2M
order_type
stringclasses
1 value
original_example
dict
step_ids
listlengths
1
5
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Created on 7/02/2014 @author: marco Generador de ambientes FACIL 2014 ''' import wx from formgenerador import FrameGeneral from Dial_Pagina import ObjPagina class IncioInterface(FrameGeneral): def __init__(self): #self.log = ObLog('Inicio programa') #self.lo...
normal
{ "blob_id": "9bd1fd2df7da068ac8aa4e6e24fe14d163a7e6b3", "index": 2362, "step-1": "#!/usr/bin/env python\n# -*- coding: utf-8 -*- \n'''\nCreated on 7/02/2014\n\n@author: marco\nGenerador de ambientes FACIL 2014\n'''\n\n\nimport wx\n\nfrom formgenerador import FrameGeneral\nfrom Dial_Pagina import ObjPagina\n\n\nc...
[ 0 ]
import os from flask import Flask, request, jsonify, Response, abort from sesamutils import sesam_logger, VariablesConfig from sesamutils.flask import serve required_env_vars = ["SUBDOMAIN"] optional_env_vars = ["DEBUG", "LOG_LEVEL", ("API_ROOT","zendesk.com/api/v2/tickets/")] # Default values can be given t...
normal
{ "blob_id": "bb58b4384eaeec45be1af865012c618af05f5a0a", "index": 9667, "step-1": "<mask token>\n\n\n@app.route('/api/orders/update/<int:orderID>', methods=['GET', 'PUT',\n 'POST', 'DELETE'])\ndef update_ticket(orderID):\n try:\n if request.method != 'PUT':\n abort(405)\n logger...
[ 3, 4, 5, 7, 8 ]
# -*- coding: utf-8 -*- from django.db import models from filebrowser.fields import FileBrowseField from localisations.models import Ville, Lieu from model_utils.managers import InheritanceManager from services.models import Service from equipements.models import Equipement from localisations.models import Ville from d...
normal
{ "blob_id": "596fe474ae60dd6a06123df6fe246f7e947b3482", "index": 1760, "step-1": "<mask token>\n\n\nclass SaisonCulturelle(Saison):\n\n def __unicode__(self):\n return self.nom\n\n\nclass Festival(Saison):\n saison_culture = models.ForeignKey(SaisonCulturelle)\n\n def __unicode__(self):\n ...
[ 30, 33, 34, 36, 39 ]
# Copyright (c) OpenMMLab. All rights reserved. import torch from mmagic.registry import MODELS def test_colorization_net(): model_cfg = dict( type='ColorizationNet', input_nc=4, output_nc=2, norm_type='batch') # build model model = MODELS.build(model_cfg) # test attributes assert mode...
normal
{ "blob_id": "94be205e516c1f1248b6028419c04c927236596e", "index": 618, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_colorization_net():\n model_cfg = dict(type='ColorizationNet', input_nc=4, output_nc=2,\n norm_type='batch')\n model = MODELS.build(model_cfg)\n assert model._...
[ 0, 1, 2, 3 ]
from matplotlib import cm from datascience.visu.util import plt, save_fig, get_figure from sklearn.metrics import roc_curve, auc, confusion_matrix import numpy as np y = np.array([ [0.8869, 1.], [1.-0.578, 0.], [0.7959, 1.], [0.8618, 1.], [1.-0.2278, 0.], [0.6607, 1.], [0.7006, 1.], ...
normal
{ "blob_id": "5b3514af839c132fda9a2e6e178ae62f780f291e", "index": 3388, "step-1": "<mask token>\n", "step-2": "<mask token>\nax.set_xlim([-0.007, 1.0])\nax.set_ylim([0.0, 1.01])\nax.set_xlabel('False Positive Rate')\nax.set_ylabel('True Positive Rate')\nax.set_title('Receiver operating characteristic (AUC: %.3f...
[ 0, 1, 2, 3, 4 ]
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
normal
{ "blob_id": "f0f4573808253ca4bff808104afa9f350d305a9c", "index": 3501, "step-1": "# ----------------------------------------------------------------------\n# Numenta Platform for Intelligent Computing (NuPIC)\n# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement\n# with Numenta, Inc., for a separate...
[ 0 ]
# Write a Python program to print alphabet pattern 'G'. result = '' for row in range(0,7): for col in range(0,7): if ((col ==0) and (row !=0 and row !=6) or ((row ==0 or row == 6) and (col>0 and col<6))or ((row ==1 or row == 5 or row == 4)and (col ==6))or ((row ==3)and ((col!=2)and col!=1))): r...
normal
{ "blob_id": "e598091fc6c05b1d7f9f35f2ae58494fed53f9af", "index": 5392, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor row in range(0, 7):\n for col in range(0, 7):\n if col == 0 and (row != 0 and row != 6) or (row == 0 or row == 6) and (\n col > 0 and col < 6) or (row == 1 or row...
[ 0, 1, 2, 3 ]
import os from logzero import logger as log from extract import data_generator from transform import create_dataframe def bigquery( datafile, dataset=os.environ["BQDATASET"], project=os.environ["GCPPROJECT"], schema=[ {"name": "conversation", "type": "STRING"}, {"name": "id", "type": ...
normal
{ "blob_id": "d6046217308745b85455aed78734700b9622782c", "index": 7559, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef bigquery(datafile, dataset=os.environ['BQDATASET'], project=os.environ[\n 'GCPPROJECT'], schema=[{'name': 'conversation', 'type': 'STRING'}, {\n 'name': 'id', 'type': 'INTEG...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 18 13:36:13 2019 @author: gennachiaro """ import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns; sns.set() import pyrolite.plot from pyrolite.plot.spider import spider #read in data df = pd.read_csv('/users/ge...
normal
{ "blob_id": "f6fee18898636ad6b0dc6d96d28dead4e09b8035", "index": 1650, "step-1": "<mask token>\n", "step-2": "<mask token>\nsns.set()\n<mask token>\nMG.pyroplot.spider(color='green', alpha=0.5, mode='fill')\nVCCR.pyroplot.spider(color='red', alpha=0.5, mode='fill')\nFG.pyroplot.spider(color='purple', alpha=0.5...
[ 0, 1, 2, 3, 4 ]
from django.contrib.auth import get_user_model from rest_framework import generics from rest_framework.response import Response from rest_framework_jwt.settings import api_settings from status.api.serializers import StatusInlineUserSerializer from status.api.views import StatusAPIView from status.models import Status ...
normal
{ "blob_id": "472a79767f5dc7dc3cd03d89999d322b3885dcbf", "index": 1220, "step-1": "<mask token>\n\n\nclass UserStatusAPIView(StatusAPIView):\n serializer_class = StatusInlineUserSerializer\n search_fields = 'id',\n\n def get_queryset(self, *args, **kwargs):\n username = self.kwargs.get('username')...
[ 4, 6, 7, 8, 9 ]
# -*- coding: utf-8 -*- import scrapy from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule from scrapy.selector import Selector from meizi.items import MeiziItem class MztspiderSpider(CrawlSpider): name = 'mztspider2' allowed_domains = ['meizitu.com'] start_urls = [...
normal
{ "blob_id": "a1ce43c3f64667619c4964bc4dc67215d3ecc1a0", "index": 9215, "step-1": "<mask token>\n\n\nclass MztspiderSpider(CrawlSpider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass MztspiderSpider(CrawlSpider):\n <mask token...
[ 1, 2, 3, 4, 5 ]
#Some people are standing in a queue. A selection process follows a rule where people standing on even positions are selected. Of the selected people a queue is formed and again out of these only people on even position are selected. This continues until we are left with one person. Find out the position of that person...
normal
{ "blob_id": "358fd8efd5c3823255ab64d5f8b88b343415ed0e", "index": 2708, "step-1": "def even(n):\n if n == 0 or n == 1:\n return\n elif n == 2:\n return 2\n else:\n for i in reversed(range(n + 1)):\n if 2 ** i < n:\n return 2 ** i\n\n\n<mask token>\n", "ste...
[ 1, 2, 3, 4, 5 ]
class Box: def __init__(self, id, capacity): self.id = id self.dogs = [] self.capacity = capacity @property def status(self): return len(self.dogs) def add_dog(self, dog): if self.capacity > self.status: self.dogs.append(dog) return True...
normal
{ "blob_id": "5f24c5a21dc151e9efbbfaff0fe1e71e65d1eb67", "index": 1590, "step-1": "class Box:\n\n def __init__(self, id, capacity):\n self.id = id\n self.dogs = []\n self.capacity = capacity\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class Box:\n\n def __init...
[ 2, 3, 4, 5 ]
/Users/jhajhajhajha1/anaconda/lib/python3.6/codecs.py
normal
{ "blob_id": "0354445d255cc79d3cb9242f82d37e035ff61788", "index": 2410, "step-1": "/Users/jhajhajhajha1/anaconda/lib/python3.6/codecs.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
from . import metrics from . import matrices from .pairwise import apply_pairwise_rect, apply_pairwise_sparse, apply_running_rect from . import numba_tools as nb_tools from . import running_metrics as running __all__ = ['metrics', 'apply_pairwise_rect', 'apply_pairwise_sparse', 'apply_running_rect', 'nb_tools', 'ma...
normal
{ "blob_id": "3605e8b8b2f8f49cc7c40fc436c147578b12091c", "index": 6026, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['metrics', 'apply_pairwise_rect', 'apply_pairwise_sparse',\n 'apply_running_rect', 'nb_tools', 'matrices', 'running']\n", "step-3": "from . import metrics\nfrom . import m...
[ 0, 1, 2 ]
from django.http import HttpResponse from django.shortcuts import get_object_or_404 from django.urls import reverse from gatheros_event.views.mixins import AccountMixin from gatheros_subscription.helpers.extract import ( create_extract, get_extract_file_name, ) from gatheros_subscription.models import Subscrip...
normal
{ "blob_id": "431f109903e014a29aed7f125d47f327e17b9f65", "index": 4366, "step-1": "<mask token>\n\n\nclass ExtractSubscriptionPDFView(AccountMixin):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ExtractSubscriptionPDFView(Account...
[ 1, 4, 6, 7, 8 ]
import numpy as np import cv2 import serial import serial.tools.list_ports import time import random import math #import mcpi.minecraft as minecraft #import mcpi.block as block #from house import House #Arduino Serials ports = list(serial.tools.list_ports.comports()) print (ports) for p in ports: print (p[1]) ...
normal
{ "blob_id": "7c80c98e32f386362003ac3cd729fa9b279b8e8e", "index": 7316, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(ports)\nfor p in ports:\n print(p[1])\n if 'Arduino' in p[1]:\n ser = serial.Serial(port=p[0])\n else:\n print('No Arduino Device was found connected to the c...
[ 0, 1, 2, 3, 4 ]
from .linked_list import LinkedList class Queue: def __init__(self): self.list = LinkedList() def enqueue(self, value): self.list.insert_last(value) def dequeue(self): element = self.list.get_head() self.list.remove_first() return element def front(self): ...
normal
{ "blob_id": "4830da6bee6b19a5e5a82a73d2f3b220ca59d28b", "index": 9025, "step-1": "<mask token>\n\n\nclass Queue:\n <mask token>\n <mask token>\n <mask token>\n\n def front(self):\n return self.list.get_tail()\n\n def rear(self):\n return self.list.get_head()\n", "step-2": "<mask to...
[ 3, 5, 6, 7 ]
# Generated by Django 2.2.15 on 2020-09-16 03:20 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.db.models.fields class Migration(migrations.Migration): dependencies = [ ('api', '0005_cashiershift_couriershift_couriershiftexpenses_...
normal
{ "blob_id": "1c979d505b58025aae74865d6556c726ed3f0769", "index": 2651, "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 = [('api',\n ...
[ 0, 1, 2, 3, 4 ]
import logging from logging import INFO from typing import Dict, List from .constants import Relations, POS from .evaluator import * from .general import DPHelper from .general import * from .utils import * # ========================================= DRIVER ================================================= def genera...
normal
{ "blob_id": "5923a12378225fb6389e7e0275af6d4aa476fe87", "index": 1635, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef generate(root: Dict):\n relations: List[Dict] = []\n subj = DPHelper.get_subject(root)\n obj = DPHelper.get_object(root)\n if subj is not None and DPHelper.is_proper_n...
[ 0, 1, 2, 3 ]
rak="hello\n" n=input() print(rak * int(n))
normal
{ "blob_id": "b0e4042ac4ed54cafedb9e53244c164527559e39", "index": 5406, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(rak * int(n))\n", "step-3": "rak = 'hello\\n'\nn = input()\nprint(rak * int(n))\n", "step-4": "rak=\"hello\\n\"\nn=input()\nprint(rak * int(n)) \n", "step-5": null, "step-i...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ Created on Sun Nov 8 22:11:53 2020 @author: Rick """ sum= 0; with open('workRecord.txt') as fp: for line in fp.readlines(): idx= line.rfind('x',len(line)-8,len(line)) if idx>=0: sum+= float(line.rstrip()[idx+1:len(line)]) else: sum+= 1 pr...
normal
{ "blob_id": "b838d2230cb3f3270e86807e875df4d3d55438cd", "index": 8891, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('workRecord.txt') as fp:\n for line in fp.readlines():\n idx = line.rfind('x', len(line) - 8, len(line))\n if idx >= 0:\n sum += float(line.rstrip()[...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ Created on Sun Mar 5 02:39:55 2017 @author: sparsh """ """ Crop Disease Classification Project for Code Fun Do 2017 - IIT Roorkee """ """ File for predicting a test image. """ import os os.environ['THEANO_FLAGS'] = "device=gpu1, floatX=float32" import theano import numpy as np np.random...
normal
{ "blob_id": "96210942b01c510300120913bed1bc6d497a39a9", "index": 1945, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.random.seed(1)\n<mask token>\nK.set_image_dim_ordering('th')\n<mask token>\nmodel.add(ZeroPadding2D((1, 1), input_shape=(3, img_width, img_height)))\nmodel.add(Convolution2D(64, 3, 3, ...
[ 0, 1, 2, 3, 4 ]
try: fh = open("testfile","w") fh.write("test") except IOError: print("Error:没有找到文件") else: print("sucess") fh.close()
normal
{ "blob_id": "15e0b396a4726f98ce5ae2620338d7d48985707e", "index": 9533, "step-1": "<mask token>\n", "step-2": "try:\n fh = open('testfile', 'w')\n fh.write('test')\nexcept IOError:\n print('Error:没有找到文件')\nelse:\n print('sucess')\n fh.close()\n", "step-3": "try:\r\n\tfh = open(\"testfile\",\"w\...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- # Copyright (c) 2018-2019 Linh Pham # wwdtm_panelistvspanelist is relased under the terms of the Apache License 2.0 """WWDTM Panelist Appearance Report Generator""" import argparse from collections import OrderedDict from datetime import datetime import json import os import shutil from typing ...
normal
{ "blob_id": "2d20bac0f11fa724b2d0a2e0676e5b9ce7682777", "index": 7387, "step-1": "<mask token>\n\n\ndef retrieve_all_years(database_connection: mysql.connector.connect) ->List[int\n ]:\n \"\"\"Retrieve a list of all available show years\"\"\"\n cursor = database_connection.cursor()\n query = (\n ...
[ 5, 6, 7, 8, 10 ]
print('-'*100) print('BIENVENIDOS A TIENDA ELEGANCIA') print('-'*100) prendas = ('Remeras', 'Camisas', 'Pantalones', 'Faldas', 'Vestidos', 'Abrigos', 'Calzado') precioSinPromo = 0 superPuntos = 0 #ARTICULO 1 tipoPrenda1 = int(input('Ingrese Codigo de la prenda seleccionada: 0=Remeras, 1=Camisas, 2=Pantalones, 3=Fald...
normal
{ "blob_id": "333d237dd4a203fcfde3668901d725f16fbc402e", "index": 1684, "step-1": "<mask token>\n", "step-2": "print('-' * 100)\nprint('BIENVENIDOS A TIENDA ELEGANCIA')\nprint('-' * 100)\n<mask token>\nprint(prendaseleccionada1)\n<mask token>\nprint('La prenda: ', tipoPrenda1, 'participa de del plan SuperPuntos...
[ 0, 1, 2, 3 ]
# Classic solution for merging two sorted arrays/list to a new one. # (Based on Merge Sort) class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """ m->Size of nums1 list n->Size of nums2 list """ mergedArray = [] i = 0 ...
normal
{ "blob_id": "a732e7141ffb403ca6c5d9c4204cb96c8e831aab", "index": 6814, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) ->None:\n \"\"\"\n m->Size of nums1 list\n ...
[ 0, 1, 2, 3 ]
from a10sdk.common.A10BaseClass import A10BaseClass class MacAgeTime(A10BaseClass): """Class Description:: Set Aging period for all MAC Interfaces. Class mac-age-time supports CRUD Operations and inherits from `common/A10BaseClass`. This class is the `"PARENT"` class for this module.` :para...
normal
{ "blob_id": "f08677430e54822abbce61d0cac5a6fea14d3872", "index": 6078, "step-1": "<mask token>\n\n\nclass MacAgeTime(A10BaseClass):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass MacAgeTime(A10BaseClass):\n <mask token>\n\n def __init__(self, **kwargs):\n self.ERROR_MSG...
[ 1, 2, 3, 4, 5 ]
import os import codecs import json #~ from lxml import etree import lxml.html target = "test/index.html" url = "http://de.wikipedia.org/wiki/Liste_von_Bergen_in_der_Schweiz" command = "wget %s -O %s" % (url, target) #~ os.popen(command) f = open(target) html = lxml.html.fromstring(f.read()) f.close() tables = html....
normal
{ "blob_id": "89499ea8dd02d5e1b2ff635ab5203a65ceee4276", "index": 8536, "step-1": "import os\nimport codecs\nimport json\n#~ from lxml import etree\nimport lxml.html\n\ntarget = \"test/index.html\"\nurl = \"http://de.wikipedia.org/wiki/Liste_von_Bergen_in_der_Schweiz\"\ncommand = \"wget %s -O %s\" % (url, target)...
[ 0 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import functools import os import platform import sys import webbrowser import config from pushbullet import Pushbullet class Zui: def __init__(self): self.pb = Pushbullet(self.api_key()) self.target = self.make_devices() self.dayone = confi...
normal
{ "blob_id": "66cc9ca3d8cbe9690da841e43cef217f3518122c", "index": 7939, "step-1": "<mask token>\n\n\nclass Zui:\n\n def __init__(self):\n self.pb = Pushbullet(self.api_key())\n self.target = self.make_devices()\n self.dayone = config.URL_SCHEME\n self.clear, self.pause = self.check_...
[ 8, 10, 11, 12, 13 ]
from django.conf.urls import url from . import views from .HouseView import CreateHouseView app_name = 'voronoi' urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^search/$', views.search, name='search'), url(r'^house/create/$', CreateHouseView.as_view(), name='create'), #url(r'^get_search...
normal
{ "blob_id": "e3ee00efa0e929b87ca33b79dc6a6064b8758d4a", "index": 2640, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'voronoi'\nurlpatterns = [url('^$', views.index, name='index'), url('^search/$', views\n .search, name='search'), url('^house/create/$', CreateHouseView.as_view\n (), nam...
[ 0, 1, 2, 3 ]
#!/usr/bin/python # -*- coding: latin-1 -*- from flask import Flask, render_template app = Flask(__name__) @app.route('/') def index(): return render_template('index.html', titre="Ludovic DELSOL - Portfolio") @app.route('/etude') def etude(): return render_template('etude.html', titre="Portfolio Ludovic DEL...
normal
{ "blob_id": "c7037b6a576374f211580b304f8447349bbbbea3", "index": 9583, "step-1": "<mask token>\n\n\n@app.route('/etude')\ndef etude():\n return render_template('etude.html', titre=\n 'Portfolio Ludovic DELSOL - Etude')\n\n\n@app.route('/experience')\ndef experience():\n return render_template('exper...
[ 4, 6, 7, 8, 9 ]
import logging from subprocess import Popen, PIPE from .exceptions import VideoEncodingError, WrongVideoTypeError # TODO: Create a switchable encoding engine. logger = logging.getLogger('video.encoding') cmd_ffmpeg = [ 'ffmpeg', '-i', ] cmd_mp4 = [ '-vf', 'scale=640:360', '-vcodec', 'h264', '-a...
normal
{ "blob_id": "163475bbe8a5b6eb161e2bb7e9b9a9a3ea0879d2", "index": 8138, "step-1": "<mask token>\n\n\ndef encode_video_file(src_filname, dst_filename, file_type):\n logger.info('Source file: %s, Destination file: %s, File Type: %s',\n src_filname, dst_filename, file_type)\n try:\n cmd = codecs[...
[ 1, 2, 3, 4, 5 ]
# config {stack,buffer,label} def get_features_da(config,sent_dict): features = [] # TODO Improve Features if len(config[0]) > 0: # Top of stack. top = config[0][-1] top_stk_token_feature = 'TOP_STK_TOKEN_'+str(sent_dict['FORM'][top].lower()) features.append(t...
normal
{ "blob_id": "e0ce8a8ad9c842b013bbb1ea1c585b6c4c2a68f5", "index": 2868, "step-1": "<mask token>\n", "step-2": "def get_features_da(config, sent_dict):\n features = []\n if len(config[0]) > 0:\n top = config[0][-1]\n top_stk_token_feature = 'TOP_STK_TOKEN_' + str(sent_dict['FORM'][\n ...
[ 0, 1, 2 ]
#!/usr/bin/env python2 # -*- coding: utf8 -*- from __future__ import print_function, division, absolute_import from flask.ext.login import current_user from . import cert_record_process as record_process_base from walis.thirdparty import thrift_client, thirdparty_svc from walis.exception.util import raise_user_exc f...
normal
{ "blob_id": "746971cd6c5bf65268e89303c8f4ce98a56eb111", "index": 8011, "step-1": "<mask token>\n\n\ndef get(restaurant_id):\n with thrift_client('ers') as ers:\n cert = ers.get_restaurant_certification(restaurant_id)\n cert.comment = cert.comment.encode('utf-8')\n return cert\n\n\n<mask token>\n\...
[ 4, 5, 6, 8, 9 ]
import requests from lxml import html headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36'} mail_ru_link = "http://mail.ru" lenta_link = "https://lenta.ru/" req = requests.get(mail_ru_link, headers=headers).text root = html....
normal
{ "blob_id": "00d2a29774a4278b1b022571b3f16c88224f08fc", "index": 5207, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(links) > 0:\n for i, l in enumerate(links):\n article = {'link': l, 'title': titles[i], 'source': mail_ru_link}\n news.append(article)\nelse:\n print('Error')\n...
[ 0, 1, 2, 3, 4 ]
from .sgd import StochasticGradientDescent from .momentum import Momentum
normal
{ "blob_id": "aa55f1dd4f363e07d5f9104346efaa24c0457d45", "index": 9126, "step-1": "<mask token>\n", "step-2": "from .sgd import StochasticGradientDescent\nfrom .momentum import Momentum\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# -*- coding: utf-8 -*- # Third party imports import numpy as np # Local application imports from mosqito.sound_level_meter import noct_spectrum from mosqito.sq_metrics.loudness.loudness_zwst._main_loudness import _main_loudness from mosqito.sq_metrics.loudness.loudness_zwst._calc_slopes import _calc_slopes from mosq...
normal
{ "blob_id": "75716aaaca63f8ca6d32c885021c1dc0f9a12dac", "index": 793, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef loudness_zwst(signal, fs=None, field_type='free', is_sdt_output=False):\n \"\"\"Zwicker-loudness calculation for stationary signals\n\n Calculates the acoustic loudness accor...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python # -*- coding: utf-8 -*- # Python version 3.8.5 # # Author Maria Catharina van Veen # # Purpose To provide users with a tool to create # or edit an html file. # # Tested OS This code was written and tested to # work with Windows 10. ...
normal
{ "blob_id": "63e5ead200fb2884d93f19e7d9b8dc76c7f4f0e3", "index": 4611, "step-1": "<mask token>\n\n\nclass MainWindow(Frame):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass MainWindow(Frame):\n\n def __init__(self, root):\n Frame.__init__(self, root)\n self.root = ro...
[ 1, 2, 3, 4, 5 ]
# Copyright The Linux Foundation and each contributor to CommunityBridge. # SPDX-License-Identifier: MIT """ Holds the AWS SNS email service that can be used to send emails. """ import boto3 import os import cla import uuid import json import datetime from cla.models import email_service_interface region = os.enviro...
normal
{ "blob_id": "16dd73f2c85eff8d62cf0e605489d0db1616e36e", "index": 8650, "step-1": "<mask token>\n\n\nclass SNS(email_service_interface.EmailService):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass MockSNS(SNS):\n \"\"\"\n...
[ 6, 12, 14, 15, 16 ]
#容器序列 #list tuple collections.deque dict #扁平序列 #str #可变序列 #list collections.deque dict #不变序列 # tuple str
normal
{ "blob_id": "1f45bdbfdd29a0b832ebac7e4ff91df1203ae158", "index": 7712, "step-1": "#容器序列\n#list tuple collections.deque dict\n#扁平序列\n#str \n#可变序列\n#list collections.deque dict\n#不变序列\n# tuple str", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 1 ] }
[ 1 ]
import time t0 = time.time() # ------------------------------ days_in_month = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] def count_days(start_date, end_date, ref_date, target_day): # ref_date must be exactly 1 year before start_date month = start_date[0] day = start_date[1] year = start_date...
normal
{ "blob_id": "9843f957435b74e63a6fe4827cc17c824f11c7d6", "index": 5372, "step-1": "<mask token>\n\n\ndef count_days(start_date, end_date, ref_date, target_day):\n month = start_date[0]\n day = start_date[1]\n year = start_date[2]\n end_month = end_date[0]\n end_day = end_date[1]\n end_year = end...
[ 1, 2, 3, 4, 5 ]
from Tkinter import * import time def create_window(): window = Toplevel(root) w, h = root.winfo_screenwidth(), root.winfo_screenheight() canvas = Canvas(window,width=w,height=h) canvas.create_text(w/2,h/2,text="this will close after 3 seconds",font="Arial") canvas.pack() window.overrideredirec...
normal
{ "blob_id": "cac49a9a2cb753bb81c45ac1d2d887b1f48dd9bb", "index": 9562, "step-1": "<mask token>\n\n\ndef create_window():\n window = Toplevel(root)\n w, h = root.winfo_screenwidth(), root.winfo_screenheight()\n canvas = Canvas(window, width=w, height=h)\n canvas.create_text(w / 2, h / 2, text='this wi...
[ 1, 2, 3, 4, 5 ]
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. # 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. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICEN...
normal
{ "blob_id": "de704bffe2e23a8a83d34204e325b7fb2454ef66", "index": 133, "step-1": "<mask token>\n\n\ndef build_recursive_traversal_spec(client_factory):\n rp_to_rp = client_factory.create('ns0:TraversalSpec')\n rp_to_rp.name = 'rpToRp'\n rp_to_rp.type = 'ResourcePool'\n rp_to_rp.path = 'resourcePool'\n...
[ 14, 18, 20, 22, 23 ]
import torch as th from tpp.processes.hawkes.r_terms_recursive_v import get_r_terms from tpp.utils.test import get_test_events_query def run_test(): marks = 3 events, query = get_test_events_query(marks=marks) beta = th.rand([marks, marks]) get_r_terms(events=events, beta=beta) if __name__ == '__mai...
normal
{ "blob_id": "2681bd9fe93a4d61214b7c45e5d73097ab73dc07", "index": 5486, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run_test():\n marks = 3\n events, query = get_test_events_query(marks=marks)\n beta = th.rand([marks, marks])\n get_r_terms(events=events, beta=beta)\n\n\n<mask token>...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import warnings from functools import wraps import re import logging import pandas as pd import requests def return_df(field="data"): """return DataFrame data""" def decorator(func): @wraps(func) def wrapper(self, *args, **kwargs):...
normal
{ "blob_id": "bd2edd5139a9c5050c582a54cdacca2b0739f333", "index": 9151, "step-1": "<mask token>\n\n\nclass RQOpenClient(object):\n\n def __init__(self, username, password, logger=None, log_level=logging.\n DEBUG, base_url='https://rqopen.ricequant.com', timeout=(5, 10),\n return_df=True):\n ...
[ 11, 12, 14, 15, 17 ]
PRECISAO = 3 MAX_ITER = 20 def gauss_jacobi(entrada,*valores_iniciais): tamanho = len(entrada[0]) variaveis = [*valores_iniciais[:tamanho]] variaveism1 = [None] * (tamanho-1) for _ in range(0,MAX_ITER): print(variaveis) for linha in range(tamanho-1): soma = 0 for coluna in range(...
normal
{ "blob_id": "842f8b4de0378a2c83d22f3fd54ba4857d249597", "index": 9323, "step-1": "<mask token>\n\n\ndef gauss_jacobi(entrada, *valores_iniciais):\n tamanho = len(entrada[0])\n variaveis = [*valores_iniciais[:tamanho]]\n variaveism1 = [None] * (tamanho - 1)\n for _ in range(0, MAX_ITER):\n prin...
[ 2, 3, 4, 5, 6 ]
from extras.plugins import PluginConfig from .version import __version__ class QRCodeConfig(PluginConfig): name = 'netbox_qrcode' verbose_name = 'qrcode' description = 'Generate QR codes for the objects' version = __version__ author = 'Nikolay Yuzefovich' author_email = 'mgk.kolek@gmail.com' ...
normal
{ "blob_id": "6306acd1508698687842ba6b55a839743af420cc", "index": 5840, "step-1": "<mask token>\n\n\nclass QRCodeConfig(PluginConfig):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "...
[ 1, 2, 3, 4, 5 ]
# PySNMP SMI module. Autogenerated from smidump -f python DS0BUNDLE-MIB # by libsmi2pysnmp-0.1.3 at Thu May 22 11:57:37 2014, # Python version sys.version_info(major=2, minor=7, micro=2, releaselevel='final', serial=0) # Imports ( Integer, ObjectIdentifier, OctetString, ) = mibBuilder.importSymbols("ASN1", "Integer",...
normal
{ "blob_id": "fab15d34d29301e53a26577725cdd66dca7507bc", "index": 2330, "step-1": "<mask token>\n", "step-2": "<mask token>\nif mibBuilder.loadTexts:\n ds0Bundle.setOrganization('IETF Trunk MIB Working Group')\nif mibBuilder.loadTexts:\n ds0Bundle.setContactInfo(\n \"\"\" David Fowler\n\nPos...
[ 0, 1, 2, 3 ]
from django.apps import AppConfig class Sharem8Config(AppConfig): name = 'ShareM8'
normal
{ "blob_id": "fd4d785d933c3a200f4aba094ecfe1e1c76737a5", "index": 7629, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Sharem8Config(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Sharem8Config(AppConfig):\n name = 'ShareM8'\n", "step-4": "from django.apps import App...
[ 0, 1, 2, 3 ]
from django.conf.urls import url from basket import views urlpatterns = [ url(r'^$', views.view_basket, name='basket'), url(r'^add/(?P<product_pk>\d+)$', views.add_to_basket, name='add_to_basket'), url(r'^remove/(?P<basketitem_pk>\d+)$', views.remove_from_basket, name='remove_from_basket'), ]
normal
{ "blob_id": "19d5e9db142237d1cb2276ccaf083ca4a96109fc", "index": 3670, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^$', views.view_basket, name='basket'), url(\n '^add/(?P<product_pk>\\\\d+)$', views.add_to_basket, name='add_to_basket'\n ), url('^remove/(?P<basketitem_pk>\\\\...
[ 0, 1, 2, 3 ]
import unittest import calla.test TestCase = calla.test.TestCase from math import pi from calla.TB.RC_strength import * class test(TestCase): def test1(self): """ 标准验证:铁路混凝土结构设计原理(容许应力计算法).ppt 例1 """ b = 200 h0 = 411 As = 763 n = 15 M = 31.5 r...
normal
{ "blob_id": "acb9b6128a3432aecf3498e1d27bdff204fee0f4", "index": 8110, "step-1": "<mask token>\n\n\nclass test(TestCase):\n <mask token>\n\n def test2(self):\n \"\"\"\n 标准验证:混凝土结构基本原理答案吕晓寅版第12章\n \"\"\"\n b = 250\n h = 350\n l0 = 5\n a = 40\n a_ = 40\...
[ 4, 5, 6, 8, 9 ]
... ... model = Sequential() model.add(Conv2D(32, kernel_size=3, input_shape=(256, 256, 3)) ... ...
normal
{ "blob_id": "ad054febac3a04c625653a2f3864506eeb672d9e", "index": 6273, "step-1": "...\n...\nmodel = Sequential()\nmodel.add(Conv2D(32, kernel_size=3, input_shape=(256, 256, 3))\n...\n...\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
# required !!! # pip install selenium # pip install webdriver-manager from theMachine import loops # fill the number and message # you can fill the number with array phoneNumber = "fill the number" message = "fill with ur message" loop = 1 # this how many u want to loop loops(loop, phoneNumber, message)...
normal
{ "blob_id": "81dfdf0479fc1f136fa5153840d8c7015f9db676", "index": 32, "step-1": "<mask token>\n", "step-2": "<mask token>\nloops(loop, phoneNumber, message)\n", "step-3": "<mask token>\nphoneNumber = 'fill the number'\nmessage = 'fill with ur message'\nloop = 1\nloops(loop, phoneNumber, message)\n", "step-4...
[ 0, 1, 2, 3, 4 ]
#! /usr/bin/env python2 ############################################################ # Program is part of PySAR v1.2 # # Copyright(c) 2015, Heresh Fattahi, Zhang Yunjun # # Author: Heresh Fattahi, Zhang Yunjun # ####################################################...
normal
{ "blob_id": "9515dcdfc0ece1a6740d6e7075bbcd1c20977590", "index": 9157, "step-1": "#! /usr/bin/env python2\n############################################################\n# Program is part of PySAR v1.2 #\n# Copyright(c) 2015, Heresh Fattahi, Zhang Yunjun #\n# Author: Heresh Fa...
[ 0 ]
def phi(n): r = n d = 2 p = n while r > 1: if r % d == 0: p -= int(r/d) while r % d == 0: r = int(r/d) d += 1 return p m = (0, 1) for n in range(2, 1000000): p = phi(n) m = max(m, (n/p, n)) if n % 10000 == 0: print(n) prin...
normal
{ "blob_id": "e4f97018567559fc2714b75654974fb7c51f770f", "index": 5266, "step-1": "<mask token>\n", "step-2": "def phi(n):\n r = n\n d = 2\n p = n\n while r > 1:\n if r % d == 0:\n p -= int(r / d)\n while r % d == 0:\n r = int(r / d)\n d += 1\n r...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Thu Jul 27 18:34:40 2017 @author: Peiyong Jiang :jiangpeiyong@impcas.ac.cn Wangsheng Wang : wwshunan@impcas.ac.cn Chi Feng : fengchi@impcas.ac.cn supervised by Zhijun Wang & Yuan He """ import os from ...
normal
{ "blob_id": "67f09cd8b41c7a4fe457766dfed916aaf71cc20d", "index": 9489, "step-1": "<mask token>\n\n\ndef GetPage5Docx(fileNameWithPath):\n word = Dispatch('Word.Application')\n word.Visible = False\n word = word.Documents.Open(fileNameWithPath)\n word.Repaginate()\n num_of_sheets = word.ComputeStat...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/python # -*- coding: utf-8 -*- import os, uuid, re, sys from decimal import Decimal from datetime import date, time, datetime from functools import lru_cache from typing import Iterator import pyodbc, pytest # WARNING: Wow Microsoft always manages to do the stupidest thing possible always trying to be # ...
normal
{ "blob_id": "51358ac7d4fc093f8291cfd9f098e3ac3db86cce", "index": 8282, "step-1": "<mask token>\n\n\ndef connect(autocommit=False, attrs_before=None):\n return pyodbc.connect(CNXNSTR, autocommit=autocommit, attrs_before=\n attrs_before)\n\n\n<mask token>\n\n\ndef test_nvarchar(cursor: pyodbc.Cursor):\n ...
[ 47, 56, 70, 97, 108 ]
#Adds states to the list states = { 'Oregon' : 'OR' , 'Flordia': 'FL' , 'California':'CA', 'New York':'NY', 'Michigan': 'MI', } #Adds cities to the list cities = { 'CA':'San Fransisco', 'MI': 'Detroit', 'FL': 'Jacksonville' } cities['NY'] = 'New York' cities['OR'] = 'PortLa...
normal
{ "blob_id": "1bdc1274cceba994524442c7a0065498a9c1d7bc", "index": 8919, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('-' * 10)\nprint('NY State has:', cities['NY'])\nprint('OR State has : ', cities['OR'])\nprint('-' * 10)\nprint(\"Michigan's abbreviation is: \", states['Michigan'])\nprint(\"Flord...
[ 0, 1, 2, 3 ]
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import tensorflow as tf import numpy as np x = 2 y = 3 add_op = tf.add(x, y) mul_op = tf.multiply(x, y) output_1 = tf.multiply(x, add_op) output_2 = tf.pow(add_op, mul_op) with tf.Session() as sess: output_1, output_2 = sess.run([output_1, output_2]) print(output_1...
normal
{ "blob_id": "da2e388c64bbf65bcef7d09d7596c2869f51524a", "index": 4025, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith tf.Session() as sess:\n output_1, output_2 = sess.run([output_1, output_2])\nprint(output_1, output_2)\n", "step-3": "<mask token>\nos.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'\n<ma...
[ 0, 1, 2, 3 ]
# Generated by Django 3.0.8 on 2020-08-11 13:43 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('recipe', '0006_recipe_description'), ] operations = [ migrations.AddField( model_name='recipe', name='portions', ...
normal
{ "blob_id": "43dc69c66d94d85337c11eb4cfed48d7fdef2074", "index": 5770, "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 = [('recipe', '0...
[ 0, 1, 2, 3, 4 ]
"""TcEx Framework Key Value Redis Module""" class KeyValueRedis: """TcEx Key Value Redis Module. Args: context (str): The Redis context (hash) for hashed based operations. redis_client (redis.Client): An instance of redis client. """ def __init__(self, context, redis_client): ...
normal
{ "blob_id": "a5b74c31aed103b55404afc538af60c3eb18cb1b", "index": 9738, "step-1": "<mask token>\n\n\nclass KeyValueRedis:\n <mask token>\n\n def __init__(self, context, redis_client):\n \"\"\"Initialize the Class properties.\"\"\"\n self._context = context\n self._redis_client = redis_c...
[ 5, 6, 8, 9, 10 ]
#! /usr/bin/env python3 """Publishes joint trajectory to move robot to given pose""" import rospy from trajectory_msgs.msg import JointTrajectory from trajectory_msgs.msg import JointTrajectoryPoint from std_srvs.srv import Empty import argparse import time def argumentParser(argument): """ Argument parser """ pa...
normal
{ "blob_id": "ee7c63f36b4720566389826680b90c6f68de85b2", "index": 5200, "step-1": "<mask token>\n\n\ndef moveFingers(jointcmds, prefix, nbJoints):\n topic_name = '/' + prefix + '/effort_finger_trajectory_controller/command'\n pub = rospy.Publisher(topic_name, JointTrajectory, queue_size=1)\n jointCmd = J...
[ 1, 2, 4, 5, 6 ]
from ..core.helpers import itemize from ..core.files import backendRep, expandDir, prefixSlash, normpath from .helpers import splitModRef from .repo import checkoutRepo from .links import provenanceLink # GET DATA FOR MAIN SOURCE AND ALL MODULES class AppData: def __init__( self, app, backend, moduleRef...
normal
{ "blob_id": "7be54b2bd99680beed3e8e9cb14225756a71a4ea", "index": 1135, "step-1": "<mask token>\n\n\nclass AppData:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass AppData:\n\n def __init__(se...
[ 1, 5, 8, 9, 10 ]
def to_bitmask(n, bits): # [2:] to chop off the "0b" part mask = [int(digit) for digit in bin(n)[2:]] # pad to fixed length return [0] * (bits - len(mask)) + mask def invert_mask(mask): return [int(not bit) for bit in mask]
normal
{ "blob_id": "98f36b216e718fc4fe42d1717ff9ba82cc24c2ff", "index": 7752, "step-1": "<mask token>\n", "step-2": "def to_bitmask(n, bits):\n mask = [int(digit) for digit in bin(n)[2:]]\n return [0] * (bits - len(mask)) + mask\n\n\n<mask token>\n", "step-3": "def to_bitmask(n, bits):\n mask = [int(digit)...
[ 0, 1, 2, 3 ]
import asyncio import sys import aioredis import msgpack async def main(host: str, endpoint: str, message: str): msg = msgpack.packb( { "endpoint": endpoint, "headers": {"Content-Type": "text/json"}, "payload": message.encode("utf-8"), }, ) redis = awai...
normal
{ "blob_id": "e94d66732a172286814bc0b0051a52c1374a4de5", "index": 3168, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nasync def main(host: str, endpoint: str, message: str):\n msg = msgpack.packb({'endpoint': endpoint, 'headers': {'Content-Type':\n 'text/json'}, 'payload': message.encode('u...
[ 0, 1, 2, 3 ]
"""2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? """ from fractions import gcd def smallest_divisible(nmax=20): smallest = 1 for i in range(1, nmax+1):...
normal
{ "blob_id": "1cc696410a5d2eaf294d032c04a96974d5ef5db0", "index": 2831, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef smallest_divisible(nmax=20):\n smallest = 1\n for i in range(1, nmax + 1):\n if smallest % i:\n smallest *= i / gcd(i, smallest)\n return smallest\n", ...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python import sys import typer from cupcake import version_callback from cupcake.sequence import GFF app = typer.Typer( name="cupcake.sequence.get_gffs_from_list", help="Get records from a GFF file from a list", ) def get_gff_from_list(gff_filename, listfile, partial_ok=False): seqs = [l...
normal
{ "blob_id": "166520ab5b9fd5a55dd2aa30b4d62f55096ce6cb", "index": 2105, "step-1": "<mask token>\n\n\ndef get_gff_from_list(gff_filename, listfile, partial_ok=False):\n seqs = [line.strip() for line in open(listfile)]\n for r in GFF.collapseGFFReader(gff_filename):\n if r.seqid in seqs or r.seqid.spli...
[ 1, 3, 4, 5, 6 ]
# MIT LICENSE # # Copyright 1997 - 2019 by IXIA Keysight # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify,...
normal
{ "blob_id": "4b78c99dd6156afe960effcacb25804446310f7c", "index": 9708, "step-1": "<mask token>\n\n\nclass VirtualChassis(Base):\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, parent):\n super(VirtualChassis, self).__init__(parent)\n <mask token>\n\n @property\n de...
[ 12, 13, 16, 17, 19 ]
import sqlite3 def to_string(pessoa): for linha in pessoa: print('id: {}\nNome: {}'.format(linha[0], linha[1])) if __name__ == '__main__': con = sqlite3.connect('lab05-ex01.sqlite') cursor = con.cursor() cursor.execute("SELECT * FROM Pessoa") print(cursor.fetchall()) nome = input(...
normal
{ "blob_id": "4246773a8da61ff21d5faa8ab8ad2d7e75fafb60", "index": 3058, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef to_string(pessoa):\n for linha in pessoa:\n print('id: {}\\nNome: {}'.format(linha[0], linha[1]))\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef to_string(pess...
[ 0, 1, 2, 3, 4 ]
#coding=utf-8 from django.contrib import admin from models import * #增加额外的方法 def make_published(modeladmin, request, queryset): queryset.update(state=1) class OrderInfoAdmin(admin.ModelAdmin): list_display = ('ordernum', 'total', 'state') search_fields = ('total', ) list_filter = ('bpub_date',) ac...
normal
{ "blob_id": "74a0282495bf4bbd34b397e0922074659a66d6ff", "index": 4809, "step-1": "<mask token>\n\n\nclass OrderInfoAdmin(admin.ModelAdmin):\n list_display = 'ordernum', 'total', 'state'\n search_fields = 'total',\n list_filter = 'bpub_date',\n actions = [make_published]\n\n\nclass address_infoAdmin(a...
[ 4, 5, 6, 7, 8 ]
import plotly.figure_factory as ff import pandas as pd import csv df=pd.read_csv("phone.csv") fig=ff.create_distplot([df["Avg Rating"].tolist()],["Samsung"],show_hist=False) fig.show()
normal
{ "blob_id": "5ae4f489da7b4f0913c9b16c86cc60537cc51234", "index": 9858, "step-1": "<mask token>\n", "step-2": "<mask token>\nfig.show()\n", "step-3": "<mask token>\ndf = pd.read_csv('phone.csv')\nfig = ff.create_distplot([df['Avg Rating'].tolist()], ['Samsung'],\n show_hist=False)\nfig.show()\n", "step-4...
[ 0, 1, 2, 3, 4 ]
def digitSum(x): if x < 10: return x return x % 10 + digitSum(x // 10) def solve(S, n): Discriminante = S * S + 4 * n r = int(Discriminante ** 0.5) if r * r == Discriminante: if r % 2 == S % 2: return (r - S) // 2 else: return -1 else: re...
normal
{ "blob_id": "f89800e0d8d4026c167381f275ca86c2cf7f011e", "index": 4066, "step-1": "<mask token>\n\n\ndef solve(S, n):\n Discriminante = S * S + 4 * n\n r = int(Discriminante ** 0.5)\n if r * r == Discriminante:\n if r % 2 == S % 2:\n return (r - S) // 2\n else:\n retur...
[ 1, 2, 3, 4 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- """ MIT License Copyright (c) 2016 Matt Menzenski Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation ...
normal
{ "blob_id": "576bb15ad081cd368265c98875be5d032cdafd22", "index": 4789, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fuzzy_match(pattern, instring, adj_bonus=5, sep_bonus=10, camel_bonus=\n 10, lead_penalty=-3, max_lead_penalty=-9, unmatched_penalty=-1):\n \"\"\"Return match boolean and ma...
[ 0, 1, 2, 3, 4 ]
# #Create a function that takes a text file and returns the number of words # ___ count_words filepath # w.. o.. ? ? __ file # read # strng = ?.r.. # strng_list = ?.s.. " " # r.. l.. ? # # print ? "words1.txt"
normal
{ "blob_id": "b83310c18294def950cef6710c7644c7e8a3208f", "index": 5219, "step-1": "# #Create a function that takes a text file and returns the number of words\n# ___ count_words filepath\n# w.. o.. ? ? __ file # read\n# strng = ?.r..\n# strng_list = ?.s.. \" \"\n# r.. l.. ?\n#\n# prin...
[ 1 ]
# coding: UTF-8 -*- import os.path PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) EMOTICONS = { "O:)": "angel", "o:)": "angel", "O:-)": "angel", "o:-)": "angel", "o:-3": "angel", "o:3": "angel", "O;^)": "angel", ">:[": "annoyed/disappointed", ":-(": "annoyed/disappointed...
normal
{ "blob_id": "3f3ed0165120dc135a4ce1f282dbdf9dad57adf8", "index": 980, "step-1": "<mask token>\n", "step-2": "<mask token>\nPROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))\nEMOTICONS = {'O:)': 'angel', 'o:)': 'angel', 'O:-)': 'angel', 'o:-)':\n 'angel', 'o:-3': 'angel', 'o:3': 'angel', 'O;^)': 'ang...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import requests ACHAEA_ENDPOINT = 'https://api.achaea.com' def _requires_auth(func): def wrapper(self, *args, **kwargs): if self.auth is not True: raise APIError() return func(self, *args, **kwargs) return wrapper class API: au...
normal
{ "blob_id": "da66b254afb3a8fcd3783a38d8624caa917e58c3", "index": 652, "step-1": "<mask token>\n\n\nclass API:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n ...
[ 12, 15, 20, 23, 26 ]
# defining private variables class Privacy: def __init__(self, val): self.__val = 900; print("Private data member =",self.__val,"\n") value = Privacy(800); print("Value not changable\n") value.__val;
normal
{ "blob_id": "b767519229058b50183d78bb97121f050e5b6bad", "index": 423, "step-1": "class Privacy:\n <mask token>\n\n\n<mask token>\n", "step-2": "class Privacy:\n\n def __init__(self, val):\n self.__val = 900\n print('Private data member =', self.__val, '\\n')\n\n\n<mask token>\n", "step-3"...
[ 1, 2, 3, 4, 5 ]
import numpy as np import pandas as pd import matplotlib.pyplot as plt import os, shutil, time, pickle, warnings, logging import yaml from sklearn import preprocessing from sklearn.model_selection import StratifiedKFold, KFold from sklearn import metrics from scipy.special import erfinv from scipy.stats import mode wa...
normal
{ "blob_id": "4d0b08f8ca77d188aa218442ac0689fd2c057a89", "index": 8357, "step-1": "<mask token>\n\n\ndef data_split_GroupKFold(df, col_index, col_group, n_splits=5, random_state=42\n ):\n \"\"\"\n\n :param df:\n :param col_index:\n :param col_group:\n :param n_splits:\n :param random_state:\n...
[ 2, 4, 5, 6, 7 ]
from network.utility import * from entities.message import Message, BroadcastMessage, GroupMessage from entities.node import Node from entities.group import GroupBroadcast from entities.request import Request import threading import time import logging import random import json import socket from services.user import U...
normal
{ "blob_id": "67446f50d1c062eddcad282d3bf508967c5192fc", "index": 4905, "step-1": "<mask token>\n\n\nclass Sender:\n\n def __init__(self, reverseMap, info):\n self.reverseMap = reverseMap\n self.info = info\n\n def sendMessage(self, message):\n data = {'timestamp': message.timestamp, 'm...
[ 9, 12, 13, 15, 16 ]
data=[1,4,2,3,6,8,9,7] def partition(data,l,h): i=l j=h pivot=data[l] while(i<j): while(data[i]<=pivot and i<=h-1): i=i+1 while(data[j]>pivot and j>=l+1): j=j-1 if(i<j): data[i],dat...
normal
{ "blob_id": "1cd82883e9a73cfbe067d58c30659b9b2e5bf473", "index": 9349, "step-1": "<mask token>\n\n\ndef partition(data, l, h):\n i = l\n j = h\n pivot = data[l]\n while i < j:\n while data[i] <= pivot and i <= h - 1:\n i = i + 1\n while data[j] > pivot and j >= l + 1:\n ...
[ 1, 2, 3, 4, 5 ]
from eums.test.api.api_test_helpers import create_option from eums.test.factories.question_factory import MultipleChoiceQuestionFactory from eums.test.api.authenticated_api_test_case import AuthenticatedAPITestCase from eums.test.config import BACKEND_URL from eums.models.question import MultipleChoiceQuestion ENDPOI...
normal
{ "blob_id": "1152f144e17c11416f9ed56b4408f18615b16dc2", "index": 5187, "step-1": "<mask token>\n\n\nclass OptionsEndPointTest(AuthenticatedAPITestCase):\n <mask token>\n <mask token>\n\n\nclass ReceivedOptionsEndPointTest(AuthenticatedAPITestCase):\n\n def test_should_only_get_received_options(self):\n ...
[ 7, 8, 9, 10, 12 ]
from django import forms class SignupAliasForm(forms.Form): alias = forms.CharField(max_length=20, required=True) email_secret = forms.CharField(max_length=100, required=True)
normal
{ "blob_id": "953186a330ae9dff15c037b556746590d748c7ad", "index": 4974, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass SignupAliasForm(forms.Form):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass SignupAliasForm(forms.Form):\n alias = forms.CharField(max_length=20...
[ 0, 1, 2, 3 ]
import sys byte = int(sys.argv[1]) qlty = float(sys.argv[2]) n = 0 while True: o = sys.stdin.read(byte) if qlty>(qlty*n)%1: oo = o sys.stdout.write(o) else: sys.stdout.write(oo) if not o: break n=n+1
normal
{ "blob_id": "70845ab4aab80d988a5c01d0b4fb76e63b800527", "index": 6484, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n o = sys.stdin.read(byte)\n if qlty > qlty * n % 1:\n oo = o\n sys.stdout.write(o)\n else:\n sys.stdout.write(oo)\n if not o:\n break\...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python __author__ = "Maxime Beauchamp" __version__ = "0.1" __date__ = "2020-12-10" __email__ = "maxime.beauchamp@imt-atantique.fr" from graphics_OSSE import * # function to create recursive paths def mk_dir_recursive(dir_path): if os.path.isdir(dir_path): return h, t = os.path.split(di...
normal
{ "blob_id": "9f4cd9ed8aea03f5908aef4a154d964f0810619b", "index": 9820, "step-1": "<mask token>\n\n\ndef mk_dir_recursive(dir_path):\n if os.path.isdir(dir_path):\n return\n h, t = os.path.split(dir_path)\n if not os.path.isdir(h):\n mk_dir_recursive(h)\n new_path = join_paths(h, t)\n ...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- # author : rovo98 # date: 2018.3.19 # this is a demo for test calling functions. n1 = 255 n2 = 1000 print(hex(n1)) print(hex(n2)) print(abs(-119999))
normal
{ "blob_id": "31064145ae2702f93a475d0957395c62a6b320ee", "index": 1741, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(hex(n1))\nprint(hex(n2))\nprint(abs(-119999))\n", "step-3": "n1 = 255\nn2 = 1000\nprint(hex(n1))\nprint(hex(n2))\nprint(abs(-119999))\n", "step-4": "# -*- coding: utf-8 -*-\r\n#...
[ 0, 1, 2, 3 ]
# Library for Stalker project #Libraries import pandas as pd import seaborn as sns from IPython.display import Image, display import matplotlib.pyplot as plt # Google search from googlesearch import search # Tldextract to get domain of url import tldextract as tld # BeautifulSoup from bs4 import BeautifulSoup as bs f...
normal
{ "blob_id": "9c7ecd3c878d43633606439aa63f840176f20dee", "index": 7941, "step-1": "<mask token>\n\n\ndef find_webs(query):\n urls = []\n rrss = ['facebook', 'twitter', 'linkedin', 'instagram', 'youtube',\n 'pinterest', 'angel']\n sites = []\n red_social = False\n for s in search(query, tld='...
[ 14, 15, 16, 20, 22 ]
# -*- coding: utf-8 -*- class Bot(dict): def __init__(self): self["getRayon"] = 0 self["getPosition"] = (-1000, -1000) self.traj = [] def getTrajectoires(self): return self.traj def getRayon(self): return self["getRayon"] def getPosition(self): return self["getPosition"] if __name__ == "__main__": i...
normal
{ "blob_id": "d178818faf5fb18f5da48c1e2cf7991600731d06", "index": 4457, "step-1": "class Bot(dict):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "class Bot(dict):\n\n def __init__(self):\n self['getRayon'] = 0\n self['getPosition'] = -1...
[ 1, 4, 5, 6, 7 ]
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]
normal
{ "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 ]
from fractions import Fraction as f print f(49,98) * f(19, 95) * f(16, 64) * f(26, 65)
normal
{ "blob_id": "51b32972c97df50a45eb2b9ca58cdec0394e63ee", "index": 3193, "step-1": "from fractions import Fraction as f\n\nprint f(49,98) * f(19, 95) * f(16, 64) * f(26, 65)\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
#!/usr/bin/env python # encoding: utf-8 # -*- coding: utf-8 -*- # @contact: ybsdeyx@foxmail.com # @software: PyCharm # @time: 2019/3/6 9:59 # @author: Paulson●Wier # @file: 5_词向量.py # @desc: # (1)Word2Vec from gensim.models import Word2Vec import jieba # 定义停用词、标点符号 punctuation = ['、',')','(',',',",", "。", ":", ";",...
normal
{ "blob_id": "5c61ec549a3e78da4ea8a18bb4f8382f2b5c2cfa", "index": 4438, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('sentences:\\n', sentences)\n<mask token>\nfor sentence in sentences:\n words = []\n for word in sentence:\n if word not in punctuation:\n words.append(word)...
[ 0, 1, 2, 3, 4 ]
#Write by Jess.S 25/1/2019 import pandas as pd import matplotlib.pyplot as plt import numpy as np plt.rcParams['font.sans-serif'] = ['FangSong'] # 指定默认字体 plt.rcParams['axes.unicode_minus'] = False # 解决保存图像是负号'-'显示为方块的问题 def draw_point(x,y): plt.scatter(x, y) plt.title('点分布图')#显示图表标题 plt.xlabel(...
normal
{ "blob_id": "1c60620814a4aea2573caf99cee87590a8d57c18", "index": 5483, "step-1": "<mask token>\n\n\ndef draw_point(x, y):\n plt.scatter(x, y)\n plt.title('点分布图')\n plt.xlabel('x轴')\n plt.ylabel('y轴')\n plt.grid(True)\n plt.show()\n\n\ndef draw_route(route_list, x, y):\n plt.scatter(x, y)\n ...
[ 5, 6, 7, 8, 9 ]
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-11-21 00:43 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('analysis', '0018_relatorioquedadeconsumo_justificado'), ] operations = [ mi...
normal
{ "blob_id": "a58949d25a719dc9ce0626948ab0397814e9ea0e", "index": 1574, "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 = [('analysis', ...
[ 0, 1, 2, 3, 4 ]
from django.urls import path from . import views urlpatterns = [ # @app.route("/") path('', views.home), path("teams", views.showTeams), path("teams/new", views.new), path("teams/<teamname>", views.showSpecificTeam), # path("allfood", views.showAllFoodItems), # path("team/<teamname>",...
normal
{ "blob_id": "e267108177841110493061a4f84ae3d29850d028", "index": 1853, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', views.home), path('teams', views.showTeams), path(\n 'teams/new', views.new), path('teams/<teamname>', views.showSpecificTeam)]\n", "step-3": "from django.url...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 import os from Alfred3 import Items, Tools def to_absolute_path(filepath): filepath = os.path.expanduser(filepath) return os.path.abspath(filepath) def is_valid_path(path): abs_path = to_absolute_path(path) if os.path.exists(abs_path) and os.path.isdir(abs_path): ret...
normal
{ "blob_id": "1cf573863fca660cc1fec71ab64743e7a2dd74d8", "index": 1730, "step-1": "<mask token>\n\n\ndef to_absolute_path(filepath):\n filepath = os.path.expanduser(filepath)\n return os.path.abspath(filepath)\n\n\ndef is_valid_path(path):\n abs_path = to_absolute_path(path)\n if os.path.exists(abs_pa...
[ 2, 3, 4, 5, 6 ]
from entities.GpsFix import GpsFix class Visit(object): """ A Visit, which represents an arrival-departure to a stay point Attributes: id_visit: the id of the visit itself id_stay_point: the id of the stay point pivot_arrival_fix: the GpsFix that corresponds to real wo...
normal
{ "blob_id": "703ed320e7c06856a0798d9c0de9aafe24458767", "index": 7937, "step-1": "<mask token>\n\n\nclass Visit(object):\n <mask token>\n\n def __init__(self, id_visit, id_stay_point, pivot_arrival_fix: GpsFix,\n pivot_departure_fix: GpsFix, detection_arrival_fix: GpsFix,\n detection_departur...
[ 4, 5, 6, 7, 8 ]
import tkinter as tk from tkinter import Tk, ttk from tkinter import filedialog import matplotlib.pyplot as plt import numpy as np import matplotlib from matplotlib.backends.backend_tkagg import ( FigureCanvasTkAgg, NavigationToolbar2Tk) from matplotlib.figure import Figure import matplotlib.animation as animation ...
normal
{ "blob_id": "137ed9c36265781dbebabbd1ee0ea84c9850201a", "index": 1642, "step-1": "<mask token>\n\n\nclass mainwin:\n\n def __init__(self, master):\n self.master = master\n master.title\n master.title('University of Utah XRD Analysis Multi-tool')\n self.tab_parent = ttk.Notebook(mas...
[ 2, 3, 4, 5, 6 ]
# this is just to test with ilp_polytope import polytope polytope.ilp_polytope.test2()
normal
{ "blob_id": "d2fce15636e43ca618c39c5c963bbf0c3a6a3886", "index": 4444, "step-1": "<mask token>\n", "step-2": "<mask token>\npolytope.ilp_polytope.test2()\n", "step-3": "import polytope\npolytope.ilp_polytope.test2()\n", "step-4": "# this is just to test with ilp_polytope\nimport polytope\n\npolytope.ilp_po...
[ 0, 1, 2, 3 ]
import common import student_code class bcolors: RED = "\x1b[31m" GREEN = "\x1b[32m" NORMAL = "\x1b[0m" def check_result(title, map1, map2): result=True print(title) for y in range(0,common.constants.MAP_HEIGHT): v="" for x in range(0,common.constants.MAP_WIDTH): if (map1[y][x]==map2[y]...
normal
{ "blob_id": "602d2c545c6e3eabe5c6285d2ab0c7f4216a00f5", "index": 1563, "step-1": "<mask token>\n\n\nclass bcolors:\n RED = '\\x1b[31m'\n GREEN = '\\x1b[32m'\n NORMAL = '\\x1b[0m'\n\n\ndef check_result(title, map1, map2):\n result = True\n print(title)\n for y in range(0, common.constants.MAP_HE...
[ 3, 4, 5, 6, 7 ]
from sqlalchemy import Integer, String, Column from sqlalchemy.orm import Query from server import db class Formation(db): __tablename__ = "formation" query: Query id_form = Column(Integer, primary_key=True) filiere = Column(String, nullable=False) lieu = Column(String, nullable=False) niveau = Column(Str...
normal
{ "blob_id": "fff70312fa7c3259cf4c3d9e7ebd8ca5b9a56887", "index": 2714, "step-1": "<mask token>\n\n\nclass Formation(db):\n <mask token>\n query: Query\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @staticmethod\n def create(filiere: str, lieu: str, niveau: str):\n ...
[ 2, 3, 4, 5, 6 ]