code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
from codar.cheetah import Campaign from codar.cheetah import parameters as p from codar.savanna.machines import SummitNode import copy def get_shared_node_layout (n_writers, n_readers): nc = SummitNode() for i in range(n_writers): nc.cpu[i] = "writer:{}".format(i) for i in range(n_readers): ...
normal
{ "blob_id": "475cc5130e847b1a74a33bfa5cbc202a6bf31621", "index": 6932, "step-1": "<mask token>\n\n\ndef get_sweeps(ref_params_d, n_writers):\n params_d = copy.deepcopy(ref_params_d)\n params_d['writer']['nprocs'].values = [n_writers]\n params_d['writer']['decomposition'].values = [n_writers]\n all_di...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> @csrf_exempt def login_form(request): formulario = '<form action="login" method="POST">' formulario += 'Nombre<br><input type="text" name="Usuario"><br>' formulario += 'Contraseña<br><input type="password" name="Password"><br>' formulario += '<br><input type="submit" value...
flexible
{ "blob_id": "e982fd5bed540b836fd4e2caaec033d8cbfb0e4f", "index": 9854, "step-1": "<mask token>\n\n\n@csrf_exempt\ndef login_form(request):\n formulario = '<form action=\"login\" method=\"POST\">'\n formulario += 'Nombre<br><input type=\"text\" name=\"Usuario\"><br>'\n formulario += 'Contraseña<br><input...
[ 8, 12, 13, 14, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def fuzzy_match(pattern, instring, adj_bonus=5, sep_bonus=10, camel_bonus= 10, lead_penalty=-3, max_lead_penalty=-9, unmatched_penalty=-1): """Return match boolean and match score. :param pattern: the pattern to be ...
flexible
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for game in raw_scores: game_len = len(game) + 1 total = 0 prev = None player = 1 max_so_far = -100 min_so_far = 100 max_drop = 0 max_gain = 0 white_improve = [0] black_improve = [0] gam...
flexible
{ "blob_id": "ad9bb34fdb05ab885f4871693729449f3618603a", "index": 8321, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor game in raw_scores:\n game_len = len(game) + 1\n total = 0\n prev = None\n player = 1\n max_so_far = -100\n min_so_far = 100\n max_drop = 0\n max_gain = 0\n ...
[ 0, 1, 2, 3, 4 ]
import io from flask import Flask, send_file app = Flask(__name__) @app.route('/') def index(): buf = io.BytesIO() buf.write('hello world') buf.seek(0) return send_file(buf, attachment_filename="testing.txt", as_attachment=True)
normal
{ "blob_id": "362c4e572f0fe61b77e54ab5608d4cd052291da4", "index": 4043, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/')\ndef index():\n buf = io.BytesIO()\n buf.write('hello world')\n buf.seek(0)\n return send_file(buf, attachment_filename='testing.txt', as_attachment=True\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Apigee(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Apigee(object): <|reserved_special_token_0|> def __init__(self, org_name, username, password): self.proxies = Proxi...
flexible
{ "blob_id": "656927013d9a0254e2bc4cdf05b7cfd5947feb05", "index": 7868, "step-1": "<mask token>\n\n\nclass Apigee(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Apigee(object):\n <mask token>\n\n def __init__(self, org_name, username, password):\n self.proxies =...
[ 1, 2, 3, 4 ]
from collections import Counter from copy import deepcopy from itertools import count from traceback import print_exc #https://www.websudoku.com/?level=4 class SudukoBoard: side=3 sz=side*side class Cell: def __init__(self,board,row,col): self._values= [None] * SudukoBoard.sz ...
normal
{ "blob_id": "44d9e628e31cdb36088b969da2f6e9af1b1d3efe", "index": 7841, "step-1": "<mask token>\n\n\nclass SudukoBoard:\n <mask token>\n <mask token>\n\n\n class Cell:\n\n def __init__(self, board, row, col):\n self._values = [None] * SudukoBoard.sz\n self._value = None\n ...
[ 6, 8, 9, 10, 11 ]
"""The prediction classes. Instances of the class are returned by the recommender. """ class RelationshipPrediction(object): """The prediction of the predicted_relationship appearing between the given subject-object pair. @type subject: the domain-specific subject @ivar subject: the subject ...
normal
{ "blob_id": "c3de9e6129bcafd863cd330ac281345fb563cc8c", "index": 6259, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass RelationshipPrediction(object):\n <mask token>\n <mask token>\n\n def __unicode__(self):\n return u'%s <- %s: %f, %s' % (self.subject, self.object_, self.\n ...
[ 0, 2, 3, 4, 6 ]
#8 def matrix(m): for i in range(len(m)): for j in range (len(m[0])): m[i][j]=(m[i][j])**2 a=[[1,2,3],[4,5,6],[8,9,0]] print('The matrix is ',a) matrix(a) print('The updated matrix is ',a)
normal
{ "blob_id": "f46dd5217c8e015546d7fff7ee52569ecc2c8e41", "index": 5487, "step-1": "<mask token>\n", "step-2": "def matrix(m):\n for i in range(len(m)):\n for j in range(len(m[0])):\n m[i][j] = m[i][j] ** 2\n\n\n<mask token>\n", "step-3": "def matrix(m):\n for i in range(len(m)):\n ...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ plastiqpublicapi This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). """ import json import dateutil.parser from tests.controllers.controller_test_base import ControllerTestBase from tests.test_helper import TestHelper from tests.http_respon...
normal
{ "blob_id": "a4f2418e746cc43bd407b6a212de9802044351e1", "index": 3928, "step-1": "<mask token>\n\n\nclass CategoriesControllerTests(ControllerTestBase):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass CategoriesControllerTests(ControllerTestBase):\n\n @classmethod\n def setUpCl...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> logging.basicConfig(level=logging.INFO, datefmt='%Y/%m/%d %H:%M:%S', format ='%(asctime)s - %(name)s - %(levelname)s - %(message)s') <|reserved_special_token_0|> @cron_wait async def verify_error_proxy_task(): logger.inf...
flexible
{ "blob_id": "1d529e2ea5526ddcda0d0da30ed8ed4724002c63", "index": 7074, "step-1": "<mask token>\n", "step-2": "<mask token>\nlogging.basicConfig(level=logging.INFO, datefmt='%Y/%m/%d %H:%M:%S', format\n ='%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n<mask token>\n\n\n@cron_wait\nasync def verify_e...
[ 0, 1, 2, 3, 4 ]
# operatorTest02.py x = 5 x += 3 #복함 대입 연산자 print("x : ", x) print("-"*30) total = 0 total += 1 total
normal
{ "blob_id": "4f8bc19bb113c9eac7c2ac774ac7b16f569d9704", "index": 3083, "step-1": "<mask token>\n", "step-2": "<mask token>\nx += 3\nprint('x : ', x)\nprint('-' * 30)\n<mask token>\ntotal += 1\ntotal\n", "step-3": "x = 5\nx += 3\nprint('x : ', x)\nprint('-' * 30)\ntotal = 0\ntotal += 1\ntotal\n", "step-4": ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(f'Selamat datang di Game Tebak angka') while nyawa > limit: print(f'Percobaan anda tersisa {nyawa}') jawaban = int(input('Masukkan angka 0-10 = ')) if jawaban == angka_rahasia: print('Anda Benar') ...
flexible
{ "blob_id": "d4b01b015723950a4d8c3453d736cd64f306d27b", "index": 2940, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(f'Selamat datang di Game Tebak angka')\nwhile nyawa > limit:\n print(f'Percobaan anda tersisa {nyawa}')\n jawaban = int(input('Masukkan angka 0-10 = '))\n if jawaban == ang...
[ 0, 1, 2, 3, 4 ]
users = { 'Students': [ {'first_name': 'Michael', 'last_name' : 'Jordan'}, {'first_name' : 'John', 'last_name' : 'Rosales'}, {'first_name' : 'Mark', 'last_name' : 'Guillen'}, {'first_name' : 'KB', 'last_name' : 'Tonel'} ], 'Instructors': [ {'first_name' : 'Michael', 'last_name' : 'Choi'}, ...
normal
{ "blob_id": "c0f4f9eef12d99d286f5ad56f6554c5910b7cc71", "index": 8356, "step-1": "users = {\n 'Students': [\n {'first_name': 'Michael', 'last_name' : 'Jordan'},\n {'first_name' : 'John', 'last_name' : 'Rosales'},\n {'first_name' : 'Mark', 'last_name' : 'Guillen'},\n {'first_name' : 'KB', 'last_n...
[ 0 ]
<|reserved_special_token_0|> class BaseEncoder(nn.Module): <|reserved_special_token_0|> def __init__(self, **kwargs): if len(kwargs) > 0: raise RuntimeError('Unrecognized options: {}'.format(', '.join( kwargs.keys()))) super(BaseEncoder, self).__init__() <|rese...
flexible
{ "blob_id": "86ee2300b5270df3dadb22f2cfea626e6556e5db", "index": 9951, "step-1": "<mask token>\n\n\nclass BaseEncoder(nn.Module):\n <mask token>\n\n def __init__(self, **kwargs):\n if len(kwargs) > 0:\n raise RuntimeError('Unrecognized options: {}'.format(', '.join(\n kwarg...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Root(object): <|reserved_special_token_0|> def __init__(self, request): pass <|reserved_special_token_1|> __author__ = 'anderson' <|reserved_special_token_0|> class Root(object): __acl__ = [(Allow...
flexible
{ "blob_id": "5ee2a51ea981f0feab688d9c571620a95d89a422", "index": 6980, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Root(object):\n <mask token>\n\n def __init__(self, request):\n pass\n", "step-3": "__author__ = 'anderson'\n<mask token>\n\n\nclass Root(object):\n __acl__ = ...
[ 0, 2, 4, 5, 6 ]
<|reserved_special_token_0|> class Cart(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|>...
flexible
{ "blob_id": "ae0ccbb9b0a2c61d9ee9615ba8d0c1a186a81c34", "index": 3177, "step-1": "<mask token>\n\n\nclass Cart(models.Model):\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\n ...
[ 6, 8, 9, 11, 12 ]
<|reserved_special_token_0|> class BlockwiseLayer(object): <|reserved_special_token_0|> def __init__(self, parent): """ Initialize a Blockwise Layer. :type parent: coapserver.CoAP :param parent: the CoAP server """ self._parent = parent def handle_request...
flexible
{ "blob_id": "70d740a7003ca3f2d2cde039b2fc470ef2165e77", "index": 7078, "step-1": "<mask token>\n\n\nclass BlockwiseLayer(object):\n <mask token>\n\n def __init__(self, parent):\n \"\"\"\n Initialize a Blockwise Layer.\n\n :type parent: coapserver.CoAP\n :param parent: the CoAP s...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(getal1 * getal2 + getal3) print(getal1 * (getal2 + getal3)) print(getal2 + getal3 / getal1) print((getal2 + getal3) / getal1) print(getal2 + getal3 % getal1) print(abs(getal4 * getal1)) print(pow(getal3, getal5)) print(round...
flexible
{ "blob_id": "30d75aafd9612ac02557b947fc4e3c2f7322a7fd", "index": 3555, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(getal1 * getal2 + getal3)\nprint(getal1 * (getal2 + getal3))\nprint(getal2 + getal3 / getal1)\nprint((getal2 + getal3) / getal1)\nprint(getal2 + getal3 % getal1)\nprint(abs(getal4 *...
[ 0, 1, 2, 3 ]
#! /usr/bin/python3 from scapy.all import * import sys ip=IP(src=sys.argv[1], dst=sys.argv[2]) syn_packet = TCP(sport=52255, dport=1237, flags="S", seq=100, options=[('MSS',689),('WScale',1)]) synack_packet = sr1(ip/syn_packet) my_ack = synack_packet.seq+1 ack_packet = TCP(sport=52255, dport=1237, flags="A", seq=101,...
normal
{ "blob_id": "acd6197e60cf59ffcaa33bb50a60a03592bb3559", "index": 7169, "step-1": "<mask token>\n", "step-2": "<mask token>\nsend(ip / ack_packet)\n", "step-3": "<mask token>\nip = IP(src=sys.argv[1], dst=sys.argv[2])\nsyn_packet = TCP(sport=52255, dport=1237, flags='S', seq=100, options=[(\n 'MSS', 689), ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def ex51(): with urllib.request.urlopen(TIME_URL) as response: body = response.read() parsed = json.loads(body) date = datetime.fromisoformat(parsed['currentTime']) stamp = date.strftime('%H:%M:%S %Z %B %m %d') print('The current time is %s' % stamp) <|reserv...
flexible
{ "blob_id": "e8f05a66c642ef3b570130a2996ca27efb8b0cb5", "index": 5287, "step-1": "<mask token>\n\n\ndef ex51():\n with urllib.request.urlopen(TIME_URL) as response:\n body = response.read()\n parsed = json.loads(body)\n date = datetime.fromisoformat(parsed['currentTime'])\n stamp = date.strfti...
[ 1, 2, 3, 4, 5 ]
import secrets from pathlib import Path HASHCAT_WPA_CACHE_DIR = Path.home() / ".hashcat" / "wpa-server" ROOT_PRIVATE_DIR = Path(__file__).parent.parent WORDLISTS_DIR = ROOT_PRIVATE_DIR / "wordlists" WORDLISTS_USER_DIR = HASHCAT_WPA_CACHE_DIR / "wordlists" # user custom wordlists RULES_DIR = ROOT_PRIVATE_DIR / "rules...
normal
{ "blob_id": "20d480517226cb7fbced765554a02fa5cbc29033", "index": 6491, "step-1": "<mask token>\n\n\nclass Config:\n \"\"\" Flask application config \"\"\"\n SECRET_KEY = secrets.token_bytes(64)\n SQLALCHEMY_DATABASE_URI = 'sqlite:///{}'.format(DATABASE_PATH)\n SQLALCHEMY_TRACK_MODIFICATIONS = False\n...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get(): market = 'Premium' url = 'https://coinpremiums.herokuapp.com/json' try: result = '' premiums = requests.get(url).json() for exchange, exchange_currencies in premiums['premium'].item...
flexible
{ "blob_id": "b5581be044013df9ff812f285f99ca67c4f96a62", "index": 2927, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get():\n market = 'Premium'\n url = 'https://coinpremiums.herokuapp.com/json'\n try:\n result = ''\n premiums = requests.get(url).json()\n for exchan...
[ 0, 1, 2, 3 ]
# =============>This is a Normal mathematical tasks<========== x = 7 x = 7 // 3 # rounds the number = 2 ans class int #x = 7 / 3 # gives the floating number = 2.33333335 ans class float #x = 7 % 3 # gives the reminder = 1 ans class int #print("x is {}" .format(x)) #print(type(x)) # ================>This is how to ...
normal
{ "blob_id": "62a7958ba5ebb6da866d6ef156e52136df22f235", "index": 107, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('x is {}'.format(x))\nprint(type(x))\n<mask token>\nprint('x is {}'.format(x))\nprint(type(x))\n", "step-3": "x = 7\nx = 7 // 3\n<mask token>\nx = 0.1 + 0.1 + 0.1 - 0.3\nprint('x i...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 2.1.3 on 2020-06-05 23:06 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('index', '0005_userip_serial_number'), ] operations = [ migrations.AddField( model_name='userip', name='ip_attributio...
normal
{ "blob_id": "a90db2073d43d54cbcc04e3000e5d0f2a2da4a55", "index": 5281, "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 = [('index', '00...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def fence_decipher(m: str, key: int) ->str: chunklens = [(0) for _ in range(key)] nfence = 0 dx = 1 for i in m: chunklens[nfence] += 1 nfence += dx if dx == 1 and nfence == key - 1: ...
flexible
{ "blob_id": "a8bed0b5a6a95d67b5602b395f1d0ea12cd53fb0", "index": 9166, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fence_decipher(m: str, key: int) ->str:\n chunklens = [(0) for _ in range(key)]\n nfence = 0\n dx = 1\n for i in m:\n chunklens[nfence] += 1\n nfence += ...
[ 0, 1, 2, 3, 4 ]
from bs4 import BeautifulSoup from aiounfurl.parsers import oembed def test_oembed_not_match(oembed_providers): oembed_url_extractor = oembed.OEmbedURLExtractor(oembed_providers) url = 'http://test.com' assert oembed_url_extractor.get_oembed_url(url) is None def test_oembed_founded(oembed_providers): ...
normal
{ "blob_id": "7b2ad0b4eca7b31b314e32ad57d51be82f0eaf61", "index": 6979, "step-1": "<mask token>\n\n\ndef test_oembed_founded(oembed_providers):\n oembed_url_extractor = oembed.OEmbedURLExtractor(oembed_providers)\n url = 'https://www.instagram.com/p/BNHh2YJDdcY/'\n oembed_url = oembed_url_extractor.get_o...
[ 2, 3, 4, 5 ]
from django.db import models from django.utils import timezone from django.contrib.auth.models import User, Group # Create your models here. def default_expiration(): return timezone.now() + timezone.timedelta(days=10) class Category(models.Model): name = models.CharField(max_length=200) description = ...
normal
{ "blob_id": "33b6a4c76079ed698809b29772abb59a34831472", "index": 5900, "step-1": "<mask token>\n\n\nclass Survey(models.Model):\n name = models.CharField(max_length=200)\n description = models.TextField()\n category = models.ForeignKey(Category, blank=True, null=True, on_delete\n =models.CASCADE)...
[ 16, 17, 18, 19, 22 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "d0a053faccecddc84a9556aec3dff691b171df96", "index": 9977, "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 = [('event', '00...
[ 0, 1, 2, 3, 4 ]
''' Project Euler Problem #41 - Pandigital prime David 07/06/2017 ''' import time import math maxPandigitalPrime = 2 def isPrime(num): if(num<=1): return False elif(num==2): return True elif(num%2==0): return False else: sqrt_num = math.sqrt(num) bound = int(...
normal
{ "blob_id": "7ca7693b842700a7b15242b656648e8a7e58cd23", "index": 1691, "step-1": "<mask token>\n\n\ndef isPrime(num):\n if num <= 1:\n return False\n elif num == 2:\n return True\n elif num % 2 == 0:\n return False\n else:\n sqrt_num = math.sqrt(num)\n bound = int(s...
[ 2, 3, 4, 5, 6 ]
primos = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37] # números entre (8 - 26) e (44 - 44) intervalo = list(range(8, 27)) + list(range(49, 50)) is_magic = [] for n in primos: quadrado = n ** 2 if quadrado in intervalo: is_magic.append(quadrado) print(len(is_magic)) # 3
normal
{ "blob_id": "b7f443521e165f327aae9ff5d7bbb7b8462abeb5", "index": 2890, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor n in primos:\n quadrado = n ** 2\n if quadrado in intervalo:\n is_magic.append(quadrado)\nprint(len(is_magic))\n", "step-3": "primos = [2, 3, 5, 7, 11, 13, 17, 19, 23, ...
[ 0, 1, 2, 3 ]
from django.shortcuts import render, redirect from django.contrib.auth import authenticate, logout, login from django.contrib import messages from django.contrib.auth.decorators import login_required from django.utils.decorators import method_decorator from django.views import View class login_view(View): template...
normal
{ "blob_id": "e4e2e8ca65d109805b267f148e8d255d81d4ee83", "index": 1801, "step-1": "<mask token>\n\n\nclass logout_view(View):\n\n def get(self, request):\n logout(request)\n return redirect('adminbiobses:login')\n\n\n@method_decorator(login_required, name='dispatch')\nclass index(View):\n temp...
[ 5, 6, 7, 8, 11 ]
from django.db.models import Q, Avg from django.http import JsonResponse from rest_framework import permissions from rest_framework.authtoken.models import Token from rest_framework.authtoken.views import ObtainAuthToken from rest_framework.decorators import action from rest_framework.response import Response from rest...
normal
{ "blob_id": "9e8b5cebd48b3b98e421c896d9835ada5ec4166e", "index": 2740, "step-1": "<mask token>\n\n\nclass RestaurantViewSet(ModelViewSet):\n serializer_class = RestaurantSerializer\n permission_classes = [permissions.IsAuthenticatedOrReadOnly]\n queryset = Restaurant.objects.all()\n\n def _get_recomm...
[ 34, 40, 41, 42, 56 ]
import Tkinter import random secret = random.randint(1, 100) ### TKINTER ELEMENTS ### window = Tkinter.Tk() # greeting text greeting = Tkinter.Label(window, text="Guess the secret number!") greeting.pack() # guess entry field guess = Tkinter.Entry(window) guess.pack() # submit button submit = Tkinter.Button(windo...
normal
{ "blob_id": "59eb705d6d388de9afbcc0df3003f4d4f45f1fbd", "index": 3989, "step-1": "<mask token>\n", "step-2": "<mask token>\ngreeting.pack()\n<mask token>\nguess.pack()\n<mask token>\nsubmit.pack()\nwindow.mainloop()\n", "step-3": "<mask token>\nsecret = random.randint(1, 100)\nwindow = Tkinter.Tk()\ngreeting...
[ 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 ]
from pyecharts import options as opts from pyecharts.charts import * import pandas as pd import namemap from pyecharts.globals import ThemeType # import time import json import requests from datetime import datetime import pandas as pd import numpy as np def read_country_code(): """ 获取...
normal
{ "blob_id": "fe3584dd858c06d66215b4a182adf87d35324975", "index": 4486, "step-1": "<mask token>\n\n\ndef read_country_code():\n \"\"\"\n 获取国家中英文字典\n :return:\n \"\"\"\n country_dict = {}\n for key, val in namemap.nameMap.items():\n country_dict[val] = key\n return country_dict\n\n\ndef...
[ 6, 7, 8, 9, 10 ]
import sys sys.path.append('/usr/local/anaconda3/lib/python3.6/site-packages') from numpy import sin, linspace x = linspace(0, 4, 101) y = sin(x) from numpy import sin, linspace plt.grid() plt.xlabel('x') plt.ylabel('f(x)') plt.title('Funkcija $sin(x)$ un tās izvitzījums rindā') plt.plot(x, y2) plt.plot(x, y2, color ...
normal
{ "blob_id": "1dcea61908753777604d99235407981e89c3b9d4", "index": 4452, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append('/usr/local/anaconda3/lib/python3.6/site-packages')\n<mask token>\nplt.grid()\nplt.xlabel('x')\nplt.ylabel('f(x)')\nplt.title('Funkcija $sin(x)$ un tās izvitzījums rindā')...
[ 0, 1, 2, 3, 4 ]
import json import unittest from pathlib import Path from deepdiff import DeepDiff from electricitymap.contrib import config CONFIG_DIR = Path(__file__).parent.parent.joinpath("config").resolve() class ConfigTestcase(unittest.TestCase): def test_generate_zone_neighbours_two_countries(self): exchanges =...
normal
{ "blob_id": "22b8ecfecc0e76d758f14dea865a426db56c6343", "index": 3538, "step-1": "<mask token>\n\n\nclass ConfigTestcase(unittest.TestCase):\n <mask token>\n\n def test_generate_zone_neighbours_one_country_one_subzone(self):\n exchanges = {'DE->SE-SE4': {'parsers': {'exchange': 'source'}}}\n ...
[ 7, 8, 10, 11, 12 ]
# -*- coding: utf-8 -*- """TODO """ import logging import numpy import evo.gp.support import evo.sr import evo.utils.stats class RegressionFitness(evo.Fitness): LOG = logging.getLogger(__name__ + '.RegressionFitness') def __init__(self, train_inputs, train_output, error_fitness, handled_e...
normal
{ "blob_id": "e53d4bb853eb54e4dfedf7126480e2c3e1af1378", "index": 2825, "step-1": "<mask token>\n\n\nclass RegressionFitness(evo.Fitness):\n <mask token>\n\n def __init__(self, train_inputs, train_output, error_fitness,\n handled_errors, stats: evo.utils.stats.Stats=None, store_bsfs: bool\n =T...
[ 5, 6, 7, 9, 11 ]
' a test module ' __author__ = 'Aaron Jiang' import sys def test(): args = sys.argv if len(args) == 1: print('Hello World') elif len(args) == 2: print('Hello, %s!' % args[1]) else: print('TOO MANY ARGUMENTS!') if __name__ == '__main__': test() class Test(): count =...
normal
{ "blob_id": "ececcf40005054e26e21152bcb5e68a1bce33e88", "index": 7947, "step-1": "<mask token>\n\n\nclass Test:\n <mask token>\n print('called ', count)\n <mask token>\n\n\n<mask token>\n\n\nclass Screen:\n\n @property\n def width(self):\n return self._width\n\n @width.setter\n def wi...
[ 12, 14, 15, 17, 19 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': path_clusters = snakemake.input[0] path_clusters = '/'.join(path_clusters.split('/')[:-1]) + '/' merge_vcf = snakemake.output[0] ref_genome = snakemake.params[0] regions = snakemake.p...
flexible
{ "blob_id": "f6d81387f61ac4150cd6279121780b7113517b1e", "index": 2860, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n path_clusters = snakemake.input[0]\n path_clusters = '/'.join(path_clusters.split('/')[:-1]) + '/'\n merge_vcf = snakemake.output[0]\n ref_genome ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> DEBUG = True SQLALCHEMY_DATABASE_URI = ( 'postgresql://username:password@IPOrDomain/databasename') SQLALCHEMY_TRACK_MODIFICATIONS = True DATABASE_CONNECT_OPTIONS = {} THREADS_PER_PAGE = 2 <|reserved_special_token_1|> DEBUG = True SQLALCHEMY_DATABASE_UR...
flexible
{ "blob_id": "a1b0e72b62abc89d5292f199ec5b6193b544e271", "index": 7813, "step-1": "<mask token>\n", "step-2": "DEBUG = True\nSQLALCHEMY_DATABASE_URI = (\n 'postgresql://username:password@IPOrDomain/databasename')\nSQLALCHEMY_TRACK_MODIFICATIONS = True\nDATABASE_CONNECT_OPTIONS = {}\nTHREADS_PER_PAGE = 2\n", ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def sort_position_data(pos, type='A'): """Sorts the position data according to player positions. As the final matrix should contain the player according to their position starting from left to right from back to front the indexed ragged array list should be sorted such th...
flexible
{ "blob_id": "81ae5bbc8e3e712ee4f54656bc28f385a0b4a29f", "index": 6059, "step-1": "<mask token>\n\n\ndef sort_position_data(pos, type='A'):\n \"\"\"Sorts the position data according to player positions.\n\n As the final matrix should contain the player according to their\n position starting from left to ...
[ 5, 8, 9, 10, 11 ]
from .proxies import Proxies from .roles import Roles from .products import Products from .resourcefiles import ResourceFiles class Apigee(object): """Provides easy access to all endpoint classes Args: domain (str): Your Auth0 domain, e.g: 'username.auth0.com' token (str): Management API v2 ...
normal
{ "blob_id": "656927013d9a0254e2bc4cdf05b7cfd5947feb05", "index": 7868, "step-1": "<mask token>\n\n\nclass Apigee(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Apigee(object):\n <mask token>\n\n def __init__(self, org_name, username, password):\n self.proxies =...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class NGram(object): <|reserved_special_token_0|> <|reserved_special_token_0|> @abc.abstractmethod def load_text(self, text): pass def load_ngram(self): counts = self.empty_count() c = self.n while c < len(self.text): l = s...
flexible
{ "blob_id": "41e3c18b02f9d80f987d09227da1fbc6bde0ed1d", "index": 4812, "step-1": "<mask token>\n\n\nclass NGram(object):\n <mask token>\n <mask token>\n\n @abc.abstractmethod\n def load_text(self, text):\n pass\n\n def load_ngram(self):\n counts = self.empty_count()\n c = self...
[ 7, 9, 11, 13, 15 ]
from .base import * import os SECRET_KEY = os.environ['SECRET_KEY'] ALLOWED_HOSTS = ['demo.pythonic.nl'] DEBUG = False
normal
{ "blob_id": "e5607d9893b775b216d1790897124a673b190c26", "index": 2085, "step-1": "<mask token>\n", "step-2": "<mask token>\nSECRET_KEY = os.environ['SECRET_KEY']\nALLOWED_HOSTS = ['demo.pythonic.nl']\nDEBUG = False\n", "step-3": "from .base import *\nimport os\nSECRET_KEY = os.environ['SECRET_KEY']\nALLOWED_...
[ 0, 1, 2 ]
import fs gInfo = { 'obj': g2.go(capUrl), 'Headers-C-T': g2.response.headers['Content-Type'], 'url': g2.response.url, 'urlDetails': g2.response.url_details() } capHtml = capHtml = gInfo['obj'].unicode_body(ignore_errors=True, fix_special_entities=True) b64cap = re.findall(r'base64,(.*?)\\" id=', capHtml, re.DO...
normal
{ "blob_id": "2a5f69fbb26bd1f94c10ff0da687391bf5bd3c23", "index": 6054, "step-1": "<mask token>\n", "step-2": "<mask token>\nsavecaptcha.write(b64cap[0])\nsavecaptcha.close()\n<mask token>\nf.close()\n<mask token>\nfincapfile.close()\n", "step-3": "<mask token>\ngInfo = {'obj': g2.go(capUrl), 'Headers-C-T': g...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> TEST_HEAD = """ >>>>>> >>>>>> Test in progress: {0} >>>>>>""" TEST_TAIL = '>>>>>> Test execution done, tearDown\n\r' <|reserved_special_token_1|> """ ConstantsCommands.py """ TEST_HEAD = "\n >>>>>> " \ "\n >>>>...
flexible
{ "blob_id": "45f0a7a78184195a593061d863ff2114abe01a46", "index": 6321, "step-1": "<mask token>\n", "step-2": "<mask token>\nTEST_HEAD = \"\"\"\n >>>>>> \n >>>>>> Test in progress: {0}\n >>>>>>\"\"\"\nTEST_TAIL = '>>>>>> Test execution done, tearDown\\n\\r'\n", "step-3": "\"\"\"\nConstantsCommands.py\n\"\"\"\...
[ 0, 1, 2 ]
<|reserved_special_token_0|> @task(max_retries=2, retry_delay=datetime.timedelta(seconds=5)) def pull_forecast(city, api_key): """ Extract the 5-day 3-hour forecast for the provided City. """ base_url = 'http://api.openweathermap.org/data/2.5/forecast?' url = base_url + 'appid=' + api_key + '&q=' ...
flexible
{ "blob_id": "7f52354487f85a0bf1783c8aa76f228ef17e6d6b", "index": 5119, "step-1": "<mask token>\n\n\n@task(max_retries=2, retry_delay=datetime.timedelta(seconds=5))\ndef pull_forecast(city, api_key):\n \"\"\"\n Extract the 5-day 3-hour forecast for the provided City.\n \"\"\"\n base_url = 'http://api....
[ 2, 3, 4, 5, 6 ]
# import gmplot package import gmplot import numpy as np # generate 700 random lats and lons latitude = (np.random.random_sample(size = 700) - 0.5) * 180 longitude = (np.random.random_sample(size = 700) - 0.5) * 360 # declare the center of the map, and how much we want the map zoomed in gmap = gmplot.GoogleMapPlotter(0...
normal
{ "blob_id": "1cc77ed1c5da025d1b539df202bbd3310a174eac", "index": 3902, "step-1": "<mask token>\n", "step-2": "<mask token>\ngmap.heatmap(latitude, longitude)\ngmap.scatter(latitude, longitude, c='r', marker=True)\n<mask token>\ngmap.draw('c:\\\\users\\\\jackc\\\\desktop\\\\country_heatmap.html')\n<mask token>\...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-10-14 19:37 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ...
normal
{ "blob_id": "8c05259ce577e6b6a6efdf778832e9bb817e47fd", "index": 1414, "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 = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
""" SUMMARY Auxiliary functions, provided here to avoid clutter """ """ Transforms a point (P = [x, y]) using the x, y intervals (Δxy = [Δx, Δy]) into the corresponding discrete point (D = [xd, yd]) loc_min = [x_min, y_min] """ def discretize_location(P, loc_min, Δxy): x_from_start = P[0] - loc_min[0] y_from...
normal
{ "blob_id": "8bbc929e2ff2321b97195031fa675fbdab269fcb", "index": 3288, "step-1": "<mask token>\n\n\ndef first_append_to_last(arr):\n return arr + [arr[0]]\n\n\n<mask token>\n\n\ndef RMS(arr):\n n = len(arr)\n sq_sum = sum(a ** 2 for a in arr)\n return (sq_sum / n) ** 0.5\n\n\n<mask token>\n\n\ndef L1...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): def lexicalOrder(self, n): """ :type n: int :rtype: List[int] """ ac...
flexible
{ "blob_id": "79f4ede16628c6fbf37dfb4fe5afb8489c120f5a", "index": 6597, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n <mask token>\n", "step-3": "class Solution(object):\n\n def lexicalOrder(self, n):\n \"\"\"\n :type n: int\n :rtype: List[int]\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class B: <|reserved_special_token_0|> class C(B, A): print('class C') <|reserved_special_token_0|> <|reserved_special_token_1|> class A: <|reserved_special_token_0|> class B: def m(self): print('Class B') class C(B, A): print('class C') <|reserved...
flexible
{ "blob_id": "3d59b8d6a34935ff332028443276f161430a981c", "index": 9687, "step-1": "<mask token>\n\n\nclass B:\n <mask token>\n\n\nclass C(B, A):\n print('class C')\n\n\n<mask token>\n", "step-2": "class A:\n <mask token>\n\n\nclass B:\n\n def m(self):\n print('Class B')\n\n\nclass C(B, A):\n ...
[ 2, 4, 6, 7, 8 ]
from django.apps import AppConfig class TimestechConfig(AppConfig): name = 'TimesTech'
normal
{ "blob_id": "94f50e371ef65e86d0d2d40a3ed16946f8811be3", "index": 2601, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TimestechConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TimestechConfig(AppConfig):\n name = 'TimesTech'\n", "step-4": "from django.apps impo...
[ 0, 1, 2, 3 ]
import numpy as np import pandas as pd import time from sklearn.metrics import log_loss from keras.models import Sequential, Model from keras.layers import Dense, Input from keras.layers import Dropout from keras.layers import Flatten from keras.layers import LSTM from keras.layers.convolutional import Convolution3D f...
normal
{ "blob_id": "e3d886dedaf5b120392d0dc81c4c71398f08f8d6", "index": 8234, "step-1": "<mask token>\n\n\ndef base_model():\n input_shape = 1, HM_SLICES, IMG_PX_SIZE, IMG_PX_SIZE\n inputs = Input(shape=input_shape)\n conv1 = Convolution3D(32, 5, 5, 5, activation='relu')(inputs)\n drop1 = Dropout(0.2)(conv1...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> import ludwig.schema.decoders.base import ludwig.schema.decoders.sequence_decoders <|reserved_special_token_1|> # Register all decoders import ludwig.schema.decoders.base import ludwig.schema.decoders.sequence_decoders # noqa
flexible
{ "blob_id": "53509d826b82211bac02ea5f545802007b06781c", "index": 1630, "step-1": "<mask token>\n", "step-2": "import ludwig.schema.decoders.base\nimport ludwig.schema.decoders.sequence_decoders\n", "step-3": "# Register all decoders\nimport ludwig.schema.decoders.base\nimport ludwig.schema.decoders.sequence_...
[ 0, 1, 2 ]
__author__ = 'Or'
normal
{ "blob_id": "54c1b294d826deb43978591cad590c5e969bebd7", "index": 6655, "step-1": "<mask token>\n", "step-2": "__author__ = 'Or'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> def haversine(pt1, pt2): """ INPUT: tuples (lon1, lat1), (lon2, lat2) OUTPUT: The great circle distance between two points on the earth (specified in decimal degrees) """ lon1, lat1, lon2, lat2 = map(radians, [pt1[0], pt1[1], pt2[0], pt2[1]]) dlon = lon2 - lon...
flexible
{ "blob_id": "89ce3d3ec9691ab8f54cc0d9d008e06c65b5f2cc", "index": 7847, "step-1": "<mask token>\n\n\ndef haversine(pt1, pt2):\n \"\"\"\n INPUT: tuples (lon1, lat1), (lon2, lat2)\n\n OUTPUT: The great circle distance between two points\n on the earth (specified in decimal degrees)\n \"\"\"\n lon1...
[ 2, 3, 4, 5, 6 ]
import nevergrad as ng import numpy as np import torch from pix2latent.utils.image import binarize class _BaseNevergradOptimizer(): """ Base template for NeverGrad optimization. Should be used jointly with BaseOptimizer. For full list of available optimizers > https://github.com...
normal
{ "blob_id": "4a136a6284add3bcbd7f9546e18e79151cea685f", "index": 623, "step-1": "<mask token>\n\n\nclass _BaseNevergradOptimizer:\n <mask token>\n\n def __init__(self, method):\n self.method = method\n self.valid_methods = [x[0] for x in ng.optimizers.registry.items()]\n self.sequentia...
[ 3, 4, 5, 6, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): assert len(sys.argv ) == 3, 'jsonsubschema cli takes exactly two arguments lhs_schema and rhs_schema' s1_file = sys.argv[1] s2_file = sys.argv[2] with open(s1_file, 'r') as f1: s1 = js...
flexible
{ "blob_id": "ba78a1e29736c4f109a0efc6f5b9993994661058", "index": 3527, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n assert len(sys.argv\n ) == 3, 'jsonsubschema cli takes exactly two arguments lhs_schema and rhs_schema'\n s1_file = sys.argv[1]\n s2_file = sys.argv[2]\n...
[ 0, 1, 2, 3, 4 ]
from eboss_qso.fits.joint import run_joint_mcmc_fit from eboss_qso.measurements.utils import make_hash import os.path as osp import os from glob import glob ARGS = [(False, 1.0), (False, 1.6), (True, 1.6), (True, 1.0) ] ITERATIONS = 500 WALKERS = 100 def main(argnum, kmin): z_we...
normal
{ "blob_id": "a40c87fe4b805495e5bd30155faa861cbe16c368", "index": 6123, "step-1": "<mask token>\n\n\ndef main(argnum, kmin):\n z_weighted, p = ARGS[argnum]\n kws = {}\n kws['version'] = 'v1.9f'\n kws['krange'] = '%s-0.3' % kmin\n kws['params'] = 'basemodel-N-fnl'\n kws['zrange'] = '0.8-2.2'\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @login_required @csrf_exempt def social(request): if request.method == 'POST': data = request.POST project_id = int(json.loads(data.get('projid'))) head = data.get('head') head = json.loads(he...
flexible
{ "blob_id": "c2839046592469dfae7526f72be947126960ba19", "index": 621, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@login_required\n@csrf_exempt\ndef social(request):\n if request.method == 'POST':\n data = request.POST\n project_id = int(json.loads(data.get('projid')))\n he...
[ 0, 1, 2, 3 ]
# Generated by Django 2.2.5 on 2019-10-09 12:06 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import mptt.fields class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MOD...
normal
{ "blob_id": "5485fe4f612ededc11e3a96dfd546e97a56cbe2a", "index": 3316, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
class Solution: def merge(self, nums1, m, nums2, n): """ Do not return anything, modify nums1 in-place instead. """ if n == 0: nums1 = nums1 if nums1[m-1] <= nums2[0]: for i in range(n): nums1[m+i] = nums2[i] ...
normal
{ "blob_id": "4f13e2858d9cf469f14026808142886e5c3fcc85", "index": 28, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "class Solution:\n\n def merge(self, nums1, m, nums2, n):\n \"\"\"\n Do not return anything, modify nums1 in-place ins...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def primeiras_ocorrencias(str): dic = {} for i, letra in enumerate(str): if letra not in dic: dic[letra] = i return dic
flexible
{ "blob_id": "bb1a6815649eb9e79e2ab1e110ea8acd8adce5aa", "index": 3379, "step-1": "<mask token>\n", "step-2": "def primeiras_ocorrencias(str):\n dic = {}\n for i, letra in enumerate(str):\n if letra not in dic:\n dic[letra] = i\n return dic\n", "step-3": null, "step-4": null, "s...
[ 0, 1 ]
# -*- coding: utf-8 -*- """ Created on Wed Aug 22 18:05:44 2018 @author: Administrator """ from sklearn.model_selection import cross_val_score, train_test_split from sklearn.datasets import load_iris from sklearn.linear_model import LogisticRegression from sklearn.model_selection import StratifiedKFold from sklearn.m...
normal
{ "blob_id": "aaa0ac5e31e2c10b5baba6077e952fff1a92ef82", "index": 882, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('cross-vali score is: {}'.format(score.mean()))\n<mask token>\nfor train_index, test_index in kfold.split(iris.data, iris.target):\n print(train_index, test_index)\n<mask token>\n...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def crop_image_center(file, crop_left, crop_right, crop_top, crop_bottom): img = Image.open(file) x, y = img.size box = (crop_left, crop_top, x - crop_left - crop_right, y - crop_top - crop_bottom) crop = img.crop(box) crop.save(file) def create_empty_folder(...
flexible
{ "blob_id": "a9876c61578a53f29865062c0915db622aaaba72", "index": 6916, "step-1": "<mask token>\n\n\ndef crop_image_center(file, crop_left, crop_right, crop_top, crop_bottom):\n img = Image.open(file)\n x, y = img.size\n box = (crop_left, crop_top, x - crop_left - crop_right, y - crop_top -\n crop...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Todo(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Todo(models.Model): title = models.CharField(max_length=200) ...
flexible
{ "blob_id": "4b075d8211d7047f6f08fe6f6f55e4703bdb6f1f", "index": 3164, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Todo(models.Model):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Todo(models.Model):\n title = models.CharField(max_length=200)\n completed...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python3 """ module that has fucntions that shows attributes """ def lookup(obj): """ function that returns attributes and methods of an object """ return(dir(obj))
normal
{ "blob_id": "67380fb8b1557b0ed6779009e5f9ae93fd81aedd", "index": 8753, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef lookup(obj):\n \"\"\"\n function that returns attributes and methods of an object\n \"\"\"\n return dir(obj)\n", "step-3": "#!/usr/bin/python3\n\"\"\"\nmodule that h...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def wrong_subtraction(n, k): output = n for i in range(k): string_n = str(output) if string_n[len(string_n) - 1] == '0': output = int(string_n[:-1]) else: output -= 1 return output <|reserved_special_token_0|> <|reserved_spec...
flexible
{ "blob_id": "166a8cd0e09fbec739f43019659eeaf98b1d4fa4", "index": 4446, "step-1": "<mask token>\n\n\ndef wrong_subtraction(n, k):\n output = n\n for i in range(k):\n string_n = str(output)\n if string_n[len(string_n) - 1] == '0':\n output = int(string_n[:-1])\n else:\n ...
[ 1, 2, 3, 4, 5 ]
# Simulador de sistema M/M/1. # # Variables de respuesta: # - Demora promedio por cliente # - Número promedio de clientes en cola # - Utilización promedio de cliente # # Funciones: # arribo() # partida() # nuevoEvento() # medidasDesempeño() # generarTiempoExponencial(t) # generarHi...
normal
{ "blob_id": "62cc731982846f08b3f3caace5df1bfafd421869", "index": 1701, "step-1": "<mask token>\n\n\ndef arribo():\n global reloj\n global tiempoUltEvento\n global estadoServ\n global tiempoServicioTotal\n global areaQ\n global numCliEnCola\n global cola\n global tiempoLibre\n global co...
[ 6, 7, 8, 9, 10 ]
from kivy.uix.button import Button from kivy.uix.gridlayout import GridLayout from kivy.uix.floatlayout import FloatLayout from kivy.uix.label import Label from kivy.app import App import webbrowser a=0.0 b="?" n=0.0 k="" g="" class ghetto(GridLayout): def matCallback(self,a): webbrowser.open_n...
normal
{ "blob_id": "39affe139eec4cf6877646188839d79ed575235c", "index": 8952, "step-1": "<mask token>\n\n\nclass ghetto(GridLayout):\n <mask token>\n\n def biyoCallback(self, a):\n webbrowser.open_new(\n 'https://us04web.zoom.us/j/8651192984?pwd=cFV0bUNPTXRUOGVPZWw4dEhDQm0vUT09'\n )\n...
[ 11, 12, 15, 17, 18 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(n): x, x1 = [int(i) for i in input().strip().split(' ')] x, x1 = x - 1, x1 - 1 t[i] = [x, x1] <|reserved_special_token_0|> while len(res) < n: a = res[-1] b = t[a][0] c = t[a][1] if c not...
flexible
{ "blob_id": "0e3c6e14ff184401a3f30a6198306a17686e6ebe", "index": 2382, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n):\n x, x1 = [int(i) for i in input().strip().split(' ')]\n x, x1 = x - 1, x1 - 1\n t[i] = [x, x1]\n<mask token>\nwhile len(res) < n:\n a = res[-1]\n b = t[...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while index < len(array): count = 0 while count <= len(array) - 2: if count == len(array) - 1: break if array[count] > array[count + 1]: sift = array[count] array[count] ...
flexible
{ "blob_id": "fc8976141a19afd099f92cbbdb578e9c620cb745", "index": 5075, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile index < len(array):\n count = 0\n while count <= len(array) - 2:\n if count == len(array) - 1:\n break\n if array[count] > array[count + 1]:\n ...
[ 0, 1, 2, 3 ]
import random import matplotlib.pyplot as plt import numpy as np def dado(n): i = 1 dos =0 tres =0 cuatro =0 cinco=0 seis =0 siete=0 ocho=0 nueve=0 diez=0 once=0 doce=0 cont = [0,0,0,0,0,0,0,0,0,0,0] while i <= n: r1 = random.randint(1,6)...
normal
{ "blob_id": "2d0d73c0ea20d6736c10d5201abcfa9d561ef216", "index": 7474, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef dado(n):\n i = 1\n dos = 0\n tres = 0\n cuatro = 0\n cinco = 0\n seis = 0\n siete = 0\n ocho = 0\n nueve = 0\n diez = 0\n once = 0\n doce = 0\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> dataloader = ALF200KLoader(path='data/processed/dataset-lfm-genres.pickle', load_feature_groups=['rhymes', 'statistical', 'statistical_time', 'explicitness', 'audio'], text_vectorizers=lda() + tfidf(), target= genre_ta...
flexible
{ "blob_id": "473c653da54ebdb7fe8a9eefc166cab167f43357", "index": 3994, "step-1": "<mask token>\n", "step-2": "<mask token>\ndataloader = ALF200KLoader(path='data/processed/dataset-lfm-genres.pickle',\n load_feature_groups=['rhymes', 'statistical', 'statistical_time',\n 'explicitness', 'audio'], text_vect...
[ 0, 1, 2, 3 ]
# coding: utf-8 from __future__ import ( absolute_import, division, print_function, unicode_literals, ) import time from urllib import urlencode from urlparse import parse_qs, urlparse, urlunparse from flask import current_app as app from flask import url_for from jose import jwt from oauth2client.cl...
normal
{ "blob_id": "fe73a80b15cad025a33930ddd9abb31524cd0244", "index": 9404, "step-1": "<mask token>\n\n\ndef create_oauth_flow():\n \"\"\"Prepare Google OAuth workflow from config file.\"\"\"\n app.flow = flow_from_clientsecrets(str(Path(app.config['ROOT_DIR'],\n 'configs/client_secrets.json')), scope=['...
[ 4, 5, 6, 7, 8 ]
from unittest import TestCase from unittest.mock import patch, mock_open, call from network_simulator.exceptions.device_exceptions import DeviceAlreadyRegisteredException, UnknownDeviceException from network_simulator.service import NetworkSimulatorService from network_simulator.service.network_simulator_service impor...
normal
{ "blob_id": "8e854398084e89b0b8436d6b0a2bf8f36a9c7bd5", "index": 187, "step-1": "<mask token>\n\n\nclass TestNetworkSimulatorService(TestCase):\n\n @patch(\n 'network_simulator.service.network_topology_handler.write_network_topology_to_file'\n )\n def setUp(self, write_network_topology_to_fil...
[ 5, 6, 7, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @public def Main() ->int: a = 'just a test' return len(a) <|reserved_special_token_1|> from boa3.builtin import public @public def Main() ->int: a = 'just a test' return len(a)
flexible
{ "blob_id": "e44e19dbeb6e1e346ca371ca8730f53ee5b95d47", "index": 5402, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@public\ndef Main() ->int:\n a = 'just a test'\n return len(a)\n", "step-3": "from boa3.builtin import public\n\n\n@public\ndef Main() ->int:\n a = 'just a test'\n retur...
[ 0, 1, 2 ]
dic = {} try: print(dic[55]) except Exception as err: print('Mensagem: ', err)
normal
{ "blob_id": "618aa64c08ebf8d9a0bc9662195ece2bbd485c17", "index": 1079, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n print(dic[55])\nexcept Exception as err:\n print('Mensagem: ', err)\n", "step-3": "dic = {}\ntry:\n print(dic[55])\nexcept Exception as err:\n print('Mensagem: ', err...
[ 0, 1, 2 ]
from flask_restful import Resource, reqparse import sqlite3 from flask_jwt import jwt_required from models.item_model import ItemModel from flask_sqlalchemy import SQLAlchemy from d import db from models.store_model import StoreModel class Modell(Resource): def get(self, name): item = Store...
normal
{ "blob_id": "5616ec135a2233e742ff3b2b1f378ec12298b935", "index": 9578, "step-1": "<mask token>\n\n\nclass Modell(Resource):\n <mask token>\n <mask token>\n\n def put(self, name):\n item = StoreModel.find_by_name(name)\n item.save_to_db()\n return item.json()\n <mask token>\n\n\nc...
[ 4, 5, 6, 8, 9 ]
from mbc import MBC import random import sys from typing import Dict from interface import Interface from reg import Register, HandlerProxy # I/O Registers IE = 0xFFFF DIV = 0xFF04 TIMA= 0xFF05 TMA = 0xFF06 TAC = 0xFF07 IF = 0xFF0F LY = 0xFF44 class MMU(): #0000 3FFF 16KB ROM bank 00 From cartridge, usual...
normal
{ "blob_id": "1a7363736076620b7704d7264b2f0bb24514165c", "index": 9816, "step-1": "<mask token>\n\n\nclass MMU:\n <mask token>\n\n def dma(self, val: int) ->None:\n dest = 65024\n offset = val * 256\n for n in range(160):\n self.mem[dest + n] = self.mem[n + offset]\n <mask...
[ 4, 6, 7, 8, 9 ]
import pygame import wave import threading import numpy as np import pylab import struct import io from PIL import Image import sounddevice as sd # 处理音频频谱 # voice.wav 格式:8000 rate 16bit 单声道 class SpectrumMap: def __init__(self): FILENAME = 'Sound/SoundResource/voice.wav' self.wavefile = wave.open(...
normal
{ "blob_id": "fbde00d727d7ea99d1a7704f46cb9850c8b210d7", "index": 2610, "step-1": "<mask token>\n\n\nclass SpectrumMap:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass SpectrumMap2:\n\n def __init__(self):\n devices = sd.query_devices()\n devic...
[ 12, 14, 16, 18, 19 ]
from django import forms from .models import Note class NoteForm(forms.ModelForm): class Meta: model = Note fields = ['title', 'text'] class NoteFullForm(NoteForm): note_id = forms.IntegerField(required=False) images = forms.FileField(widget=forms.ClearableFileInput(attrs={ 'mu...
normal
{ "blob_id": "e0fd9663a5635873f4ffc0f73aff5106c0933781", "index": 9180, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass NoteFullForm(NoteForm):\n note_id = forms.IntegerField(required=False)\n images = forms.FileField(widget=forms.ClearableFileInput(attrs={\n 'multiple': True}), requ...
[ 0, 2, 3, 4 ]
from timeit import default_timer as timer import numpy as np bets1 = [ # lowest config possible 0.00000001, 0.00000004, 0.0000001, 0.0000005, 0.00000150, 0.00000500, 0.00001000 ] bets2 = [ # 2 is 10x 1 0.0000001, 0.0000004, 0.000001, 0.000005, 0.0000150, 0.0000500,...
normal
{ "blob_id": "4c66ab6110e81bb88fc6916a1695e0f23e6e0e9d", "index": 6754, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor seed in range(start_position, start_position + max_seeds):\n cur_wins = 0\n max_wins = 0\n cur_losses = 0\n max_losses = 0\n win_streak = []\n loss_streak = []\n ...
[ 0, 1, 2, 3, 4 ]
from Player import Player class GameSequence: ''' GameSequence summary: Keeps track of player turn sequence and Game end Functionalities -start game -must start turns -change turns -end turns -end game ''' def __init__(self, ArrayofPlaye...
normal
{ "blob_id": "bdfd941be29a31d6c1bbedd270dadac844f49fc4", "index": 1198, "step-1": "<mask token>\n\n\nclass GameSequence:\n <mask token>\n <mask token>\n\n def changeMode(self, number):\n self.currentMode = self.modes[number]\n\n def startGame(self):\n self.currentTurn = 0\n \"\"\"...
[ 6, 7, 8, 9, 11 ]
n = int(input()) num = list(map(int, input().split())) plus_cnt = 0 div_max = 0 for i in num: div = 0 while i > 0: if i % 2 == 0: i //= 2 div += 1 else: i -= 1 plus_cnt += 1 div_max = max(div_max, div) print(plus_cnt + div_max)
normal
{ "blob_id": "9247896850e5282265cd08240f6f505e675ce5f0", "index": 5904, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in num:\n div = 0\n while i > 0:\n if i % 2 == 0:\n i //= 2\n div += 1\n else:\n i -= 1\n plus_cnt += 1\n div_max ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class dequeue: def __init__(self): self.front = None self.last = None self.count = 0 def add_front(self, data): new_nodef = Node(data) if self.front == None: self.front = self.last = new_nodef self.count += 1 ...
flexible
{ "blob_id": "2f6e0b6a7e14ac9c5a38db6fd2b1cf23cff7144e", "index": 172, "step-1": "<mask token>\n\n\nclass dequeue:\n\n def __init__(self):\n self.front = None\n self.last = None\n self.count = 0\n\n def add_front(self, data):\n new_nodef = Node(data)\n if self.front == Non...
[ 8, 10, 12, 13, 15 ]
from django.db import models #from publicservants import models from django.utils.encoding import smart_unicode # Create your models here. class Score(models.Model): #score ID - publicservant ID plus score #sID = models.ManyToOneRel(field=PublicServant.psID) #PS Score at time t pst = models.Inte...
normal
{ "blob_id": "8c166dd4cb091dcd2d80b5ae3085b5dee77564e0", "index": 1227, "step-1": "<mask token>\n\n\nclass Score(models.Model):\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", "step-2": "<mask t...
[ 1, 2, 3, 4, 5 ]
"""A simple script to create a motion plan.""" import os import json import logging from logging.config import dictConfig import argparse import numpy as np from opentrons_hardware.hardware_control.motion_planning import move_manager from opentrons_hardware.hardware_control.motion_planning.types import ( AxisConst...
normal
{ "blob_id": "b7d75c2523dba0baaf06ba270045a4a344b8156c", "index": 3023, "step-1": "<mask token>\n\n\ndef main() ->None:\n \"\"\"Entry point.\"\"\"\n parser = argparse.ArgumentParser(description='Motion planning script.')\n parser.add_argument('--params-file-path', '-p', type=str, required=\n False...
[ 1, 2, 3, 4, 5 ]
#ERP PROJECT import pyrebase import smtplib config = { "apiKey": "apiKey", "authDomain": "erproject-dd24e-default-rtdb.firebaseapp.com", "databaseURL": "https://erproject-dd24e-default-rtdb.firebaseio.com", "storageBucket": "erproject-dd24e-default-rtdb.appspot.com" } firebase = pyrebase.initialize_app(conf...
normal
{ "blob_id": "3e7e6d7a0137d91dc7437ff91a39d7f8faad675e", "index": 7075, "step-1": "<mask token>\n\n\ndef j():\n global i\n import pandas as pd\n st1.update({i: st})\n data = pd.DataFrame(st1)\n print(data)\n data.to_csv('student.csv')\n fa1.update({i: fa})\n data1 = pd.DataFrame(fa1)\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> pygame.init() <|reserved_special_token_0|> pygame.display.set_caption("Omar's Simulation") screen.fill(background_colour) <|reserved_special_token_0|> for i in range(population_size): robots.append(Robot(175, 300, 10, 360, 9, ...
flexible
{ "blob_id": "cbcbc0d01c32693ebbdbcf285efdc8e521c447ee", "index": 3998, "step-1": "<mask token>\n", "step-2": "<mask token>\npygame.init()\n<mask token>\npygame.display.set_caption(\"Omar's Simulation\")\nscreen.fill(background_colour)\n<mask token>\nfor i in range(population_size):\n robots.append(Robot(175...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def DFS(x): if x > 7: return else: DFS(x * 2) print(x) DFS(x * 2 + 1) <|reserved_special_token_0|> <|reserved_special_token_1|> def DFS(x): if x > 7: return else: DFS(x * 2) print(x)...
flexible
{ "blob_id": "1cc8695aa694359314b6d478fe6abed29fdc6c91", "index": 3309, "step-1": "<mask token>\n", "step-2": "def DFS(x):\n if x > 7:\n return\n else:\n DFS(x * 2)\n print(x)\n DFS(x * 2 + 1)\n\n\n<mask token>\n", "step-3": "def DFS(x):\n if x > 7:\n return\n el...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Descuento(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> def __str__(self): return self.codigo_descuento class Venta(models.Model): descripcion = models.CharField(max_length=100) total_venta = models.IntegerField() def __...
flexible
{ "blob_id": "0e19d7251db3382c34ad2d38a7984b65325ecfbf", "index": 7584, "step-1": "<mask token>\n\n\nclass Descuento(models.Model):\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.codigo_descuento\n\n\nclass Venta(models.Model):\n descripcion = models.CharField(max_length=100...
[ 22, 29, 33, 34, 40 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': img = np.array([[1, 2], [1, 3], [1, 4]]) print(img.tolist()) sys.stdout.flush() <|reserved_special_token_1|> import numpy as np import sys import os import cv2 if __name__ == '__main__': ...
flexible
{ "blob_id": "54833c19d68bb7a1817639ef761367ce75a3a46f", "index": 9200, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n img = np.array([[1, 2], [1, 3], [1, 4]])\n print(img.tolist())\n sys.stdout.flush()\n", "step-3": "import numpy as np\nimport sys\nimport os\nimpor...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def maximalSquare(self, matrix: List[List[str]]) ->int: ...
flexible
{ "blob_id": "e5d31a2ea4a8615d24626be2414f5ae49b9cd6a1", "index": 184, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def maximalSquare(self, matrix: List[List[str]]) ->int:\n if not ma...
[ 0, 1, 2, 3 ]
# %% import libs import os import argparse import logging as logger import mxnet as mx import tqdm from mxnet import autograd from mxnet import gluon from gluoncv.utils import makedirs import datasets as gan_datasets from utils import vis, get_cpus, TrainingHistory import models mx.random.seed(5) logger.basicConfig(l...
normal
{ "blob_id": "c14d76493cd3dacc55c993f588dec555b7a4a13c", "index": 4192, "step-1": "<mask token>\n\n\ndef make_noises(bs):\n return mx.nd.random_normal(0, 1, shape=(bs, 512), ctx=CTX, dtype='float32'\n ).reshape((bs, 512, 1, 1))\n\n\n<mask token>\n", "step-2": "<mask token>\nmx.random.seed(5)\nlogger.b...
[ 1, 3, 4, 5, 6 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def calcLuckyNumber(x): resultSet = set() for i in range(30): for j in range(30): for k in range(30): number = pow(3, i) * pow(5, j) * pow(7, k) if number > 1 and number <= x: resultSet.add(nu...
normal
{ "blob_id": "49a9fb43f3651d28d3ffac5e33d10c428afd08fd", "index": 6072, "step-1": "<mask token>\n", "step-2": "def calcLuckyNumber(x):\n resultSet = set()\n for i in range(30):\n for j in range(30):\n for k in range(30):\n number = pow(3, i) * pow(5, j) * pow(7, k)\n ...
[ 0, 1, 2, 3, 4 ]
""" AuthService class module. """ from urllib.parse import urlencode from http.client import HTTPConnection, HTTPResponse, HTTPException from dms2021sensor.data.rest.exc import NotFoundError class AuthService(): """ REST client to connect to the authentication service. """ def __init__(self, host: str, ...
normal
{ "blob_id": "1438a268780217e647999ba031aa4a50a6912d2f", "index": 3069, "step-1": "<mask token>\n\n\nclass AuthService:\n <mask token>\n <mask token>\n\n def __get_connection(self) ->HTTPConnection:\n \"\"\" Creates a new connection to the authentication server.\n ---\n Returns:\n ...
[ 2, 3, 5, 6, 7 ]