code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys # Add gumpy path sys.path.append('../shared') from gumpy import signal import numpy as np def preprocess_data(data, sample_rate=160, ac_freq=60, hp_freq=0.5, bp_low=2, bp_high=60, notch=False, hp_filter=False, bp_filter=False, artifact_rem...
normal
{ "blob_id": "5f1cbe1019f218d2aad616ea8bbe760ea760534c", "index": 9359, "step-1": "<mask token>\n\n\ndef preprocess_data(data, sample_rate=160, ac_freq=60, hp_freq=0.5, bp_low=\n 2, bp_high=60, notch=False, hp_filter=False, bp_filter=False,\n artifact_removal=False, normalize=False):\n if notch:\n ...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class MaskShadowGANModel(BaseModel): <|reserved_special_token_0|> <|reserved_special_token_0|> def generate_dataset(self): """ Add ops for dataset loaders to graph """ if self.training: dataset = UnpairedDataset(self.opt, self.train...
flexible
{ "blob_id": "cbbe273a19a4e60b760e35aeb8d43972a46760f5", "index": 3436, "step-1": "<mask token>\n\n\nclass MaskShadowGANModel(BaseModel):\n <mask token>\n <mask token>\n\n def generate_dataset(self):\n \"\"\"\n Add ops for dataset loaders to graph\n \"\"\"\n if self.training:\...
[ 8, 9, 11, 12, 13 ]
<|reserved_special_token_0|> class Card(namedtuple('Card', 'face, suit')): def __repr__(self): return ''.join(self) def royal_flush(hand): royalface = 'TJQKA' ordered = sorted(hand, key=lambda card: (faces.index(card.face), card.suit) ) first_card = ordered[0] other_cards = orde...
flexible
{ "blob_id": "561763d4d7b613446f2890ef629b631542f2f472", "index": 2776, "step-1": "<mask token>\n\n\nclass Card(namedtuple('Card', 'face, suit')):\n\n def __repr__(self):\n return ''.join(self)\n\n\ndef royal_flush(hand):\n royalface = 'TJQKA'\n ordered = sorted(hand, key=lambda card: (faces.index...
[ 7, 8, 10, 17, 19 ]
from django.db import models from django.utils import timezone from pprint import pprint class Cast(models.Model): name = models.CharField(max_length=50, blank=True, null=True) image = models.ImageField(upload_to='cast', blank=True, null=True) description = models.CharField(max_length=400, blank=True, null...
normal
{ "blob_id": "45dc9d362a2ddfd408f93452bda0b7338057ca81", "index": 8322, "step-1": "<mask token>\n\n\nclass Comic(models.Model):\n MAX_PAGES_PER_ISSUE = 1000\n sort_number = models.IntegerField(blank=True, null=True)\n page_number = models.IntegerField(blank=True, null=True)\n last_page = models.Intege...
[ 12, 13, 14, 19, 20 ]
""" Copyright (C) 2019-2020 Zilliz. 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/LICENSE-2.0 Unless required by applicable law or agreed...
normal
{ "blob_id": "65a9f732fc8c7b9c63f6ef0d7b2172bb4138a895", "index": 2761, "step-1": "<mask token>\n\n\nclass TestScope:\n\n @pytest.mark.run(order=1)\n def test_create_scope(self, host, port):\n url = 'http://' + host + ':' + port + '/scope'\n r = requests.post(url=url)\n print(r.text)\n ...
[ 10, 14, 17, 18, 20 ]
# nomer7 import no2_modul2 # Atau apapun file-nya yang kamu buat tadi class MhsTIF(no2_modul2.Mahasiswa): # perhatikan class induknya : Mahasiswa """Class MhsTIF yang dibangun dari class Mahasiswa""" def kataKanPy(self): print('Python is cool.') "Apakah metode / state itu berasal ...
normal
{ "blob_id": "b54f47de85fe95d47a1b1be921997ad86d7b450d", "index": 8777, "step-1": "# nomer7\r\n\r\nimport no2_modul2 # Atau apapun file-nya yang kamu buat tadi\r\n\r\nclass MhsTIF(no2_modul2.Mahasiswa): # perhatikan class induknya : Mahasiswa\r\n \"\"\"Class MhsTIF yang dibangun dari class Mahasiswa...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_read_stats(isize=400): stats = readstatistics.ReadStatistics(None) stats.insertSizes = numpy.random.normal(400, 20, 2000).astype(int) stats.orientations = ['+-'] return stats <|reserved_special_token_0|...
flexible
{ "blob_id": "97a362fc65731bb8fc3743c49a669b4cd3f0e155", "index": 9426, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_read_stats(isize=400):\n stats = readstatistics.ReadStatistics(None)\n stats.insertSizes = numpy.random.normal(400, 20, 2000).astype(int)\n stats.orientations = ['+-'...
[ 0, 1, 2, 3, 4 ]
# __ __ __ ______ __ # / | / | / | / \ / | # $$ | $$ |_$$ |_ ______ ______ _______ /$$$$$$ | ______ $$/ _______ _______ # $$ \/$$// $$ | / \ / \ / \ ...
normal
{ "blob_id": "ae72d832039f36149988da02d8a4174d80a4ecfb", "index": 2350, "step-1": "\n # __ __ __ ______ __\n# / | / | / | / \\ / |\n# $$ | $$ |_$$ |_ ______ ______ _______ /$$$$$...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def is_power(n): if n == 0: return 'not power of two' if n & n - 1 == 0: return 'power of 2' return 'not power of 2' <|reserved_special_token_0|> <|reserved_special_token_1|> def is_power(n): if n == 0: return 'not...
flexible
{ "blob_id": "676aec735dd7441b0c481956ad18b012b8d98ea4", "index": 8459, "step-1": "<mask token>\n", "step-2": "def is_power(n):\n if n == 0:\n return 'not power of two'\n if n & n - 1 == 0:\n return 'power of 2'\n return 'not power of 2'\n\n\n<mask token>\n", "step-3": "def is_power(n):...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class PidorWeekly: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @classmethod def get_top_pidor(cls, cid, date=None): monday = cls.__get_current_monday( ) if date is None else cls.__get_date_monday(date) ...
flexible
{ "blob_id": "109ca06685eece74034f77a98b1d7172a17aca21", "index": 7469, "step-1": "<mask token>\n\n\nclass PidorWeekly:\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def get_top_pidor(cls, cid, date=None):\n monday = cls.__get_current_monday(\n ) if date is None ...
[ 9, 12, 13, 14, 15 ]
from django.urls import path from . import views app_name = 'restuarant' urlpatterns = [path('orderplaced/', views.orderplaced), path('restaurant/', views.restuarent, name='restuarant'), path('login/restaurant/', views. restLogin, name='rlogin'), path('register/restaurant/', views. restRegister, name='rregi...
normal
{ "blob_id": "63830a3c09a2d0a267b030a336062d5e95b9a71a", "index": 3308, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'restuarant'\nurlpatterns = [path('orderplaced/', views.orderplaced), path('restaurant/',\n views.restuarent, name='restuarant'), path('login/restaurant/', views.\n restL...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> df_grade.head() <|reserved_special_token_0|> df_sinfo.head() <|reserved_special_token_0|> df_sinfo.head() <|reserved_special_token_0|> df_merge.head() <|reserved_special_token_0|> for name in ['姓名', '性别'][::-1]: new_columns.re...
flexible
{ "blob_id": "f6c48731b2a4e0a6f1f93034ee9d11121c2d0427", "index": 6810, "step-1": "<mask token>\n", "step-2": "<mask token>\ndf_grade.head()\n<mask token>\ndf_sinfo.head()\n<mask token>\ndf_sinfo.head()\n<mask token>\ndf_merge.head()\n<mask token>\nfor name in ['姓名', '性别'][::-1]:\n new_columns.remove(name)\n...
[ 0, 1, 2, 3, 4 ]
''' Utility functions to do get frequencies of n-grams Author: Jesus I. Ramirez Franco December 2018 ''' import nltk import pandas as pd from nltk.stem.snowball import SnowballStemmer from pycorenlp import StanfordCoreNLP import math from nltk.tokenize import RegexpTokenizer from nltk.corpus import stopwords import st...
normal
{ "blob_id": "367c3b4da38623e78f2853f9d3464a414ad049c2", "index": 9596, "step-1": "<mask token>\n\n\ndef clean_doc(text, language='english'):\n \"\"\"\n\tRemoves unknown characters and punctuation, change capital to lower letters and remove\n\tstop words. If stem=False\n\tInputs:\n\tsentence (string): a sting ...
[ 3, 8, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> db.create_all() <|reserved_special_token_0|> db.session.add(admin) db.session.add(guest) db.session.commit() <|reserved_special_token_0|> print(users) <|reserved_special_token_1|> <|reserved_special_token_0|> db.create_all() ad...
flexible
{ "blob_id": "99c2bd56deccc327faf659e91fc1fd0f6ff7a219", "index": 3932, "step-1": "<mask token>\n", "step-2": "<mask token>\ndb.create_all()\n<mask token>\ndb.session.add(admin)\ndb.session.add(guest)\ndb.session.commit()\n<mask token>\nprint(users)\n", "step-3": "<mask token>\ndb.create_all()\nadmin = User('...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> helper.greeting('Hey, dummy') <|reserved_special_token_1|> <|reserved_special_token_0|> __author__ = 'AdrianLeo' helper.greeting('Hey, dummy') <|reserved_special_token_1|> import helper __author__ = 'AdrianLeo' helper.greeti...
flexible
{ "blob_id": "03156992355a756b2ae38735a98251eb611d4245", "index": 2611, "step-1": "<mask token>\n", "step-2": "<mask token>\nhelper.greeting('Hey, dummy')\n", "step-3": "<mask token>\n__author__ = 'AdrianLeo'\nhelper.greeting('Hey, dummy')\n", "step-4": "import helper\n__author__ = 'AdrianLeo'\nhelper.greet...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('ratings.csv') as in_file: csvreader = csv.reader(in_file) with open('ratings_train.csv', 'w') as train_out: with open('ratings_test.csv', 'w') as test_out: for row in csvreader: ...
flexible
{ "blob_id": "e48a6a84268a0fe64e90714bd32712665934fc39", "index": 2223, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('ratings.csv') as in_file:\n csvreader = csv.reader(in_file)\n with open('ratings_train.csv', 'w') as train_out:\n with open('ratings_test.csv', 'w') as test_out:\n...
[ 0, 1, 2, 3, 4 ]
import tkinter import csv import datetime import time root = tkinter.Tk() root.title("Attendance") root.geometry("+450+250") ts = time.time() date = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d') fileName = "Attendance/Attendance_"+date+".csv" # open file with open(fileName, newline="") as file: reader ...
normal
{ "blob_id": "2343a9d3e253b5a0347b5890a5d7b9c3be777669", "index": 5958, "step-1": "<mask token>\n", "step-2": "<mask token>\nroot.title('Attendance')\nroot.geometry('+450+250')\n<mask token>\nwith open(fileName, newline='') as file:\n reader = csv.reader(file)\n r = 0\n for col in reader:\n c = ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(len(x)): ans += abs(x[i] - y[i]) for i in range(1, len(y)): ans += abs(x[i - 1] - y[i]) if n % 2 == 1: ans += max(abs(a[n // 2] - x[-1]), abs(a[n // 2] - y[0])) print(ans) <|reserved_special_token_1|> ...
flexible
{ "blob_id": "0e9d0927e8d69b0c0fad98479d47f2409c95a751", "index": 794, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(len(x)):\n ans += abs(x[i] - y[i])\nfor i in range(1, len(y)):\n ans += abs(x[i - 1] - y[i])\nif n % 2 == 1:\n ans += max(abs(a[n // 2] - x[-1]), abs(a[n // 2] - y[...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='ckanext-MYEXTENSION', version=version, description= 'description', long_description='\t', classifiers=[], keywords='', author='ldhspace', author_email='ldhspace@yahoo.co.kr', url= 'www.naver.com', license='...
flexible
{ "blob_id": "9d2c0d59b0b2b4e4fca942e648059738053c53d0", "index": 9376, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='ckanext-MYEXTENSION', version=version, description=\n 'description', long_description='\\t', classifiers=[], keywords='',\n author='ldhspace', author_email='ldhspace@yah...
[ 0, 1, 2, 3, 4 ]
import csv from matplotlib import pyplot as plt from datetime import datetime file_one = 'data/dwifh_all_sales.csv' file_two = 'data/dwifh_bc_sales.csv' # create code to automatically build a dictionary for each album? with open(file_one) as fo: reader = csv.reader(fo) header = next(reader) album = {} ...
normal
{ "blob_id": "53380810a3d9787fe7c373cf1829f2d849a91c3c", "index": 8456, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(file_one) as fo:\n reader = csv.reader(fo)\n header = next(reader)\n album = {}\n dates, cd_income, dd_income, total_profit, artist_payout = [], [], [], [\n ]...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while a == 1: b = source() <|reserved_special_token_0|> <|reserved_special_token_1|> a = 2 while a == 1: b = source() c = function(b)
flexible
{ "blob_id": "56cae7b7a0338bd4a405cdc3cdcd9945a9df8823", "index": 5839, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile a == 1:\n b = source()\n<mask token>\n", "step-3": "a = 2\nwhile a == 1:\n b = source()\nc = function(b)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1...
[ 0, 1, 2 ]
import os import time from datetime import datetime, timedelta from git import Repo class CommitAnalyzer(): """ Takes path of the repo """ def __init__(self, repo_path): self.repo_path = repo_path self.repo = Repo(self.repo_path) assert not self.repo.bare def get_conflict_commits(self): conflict_commits...
normal
{ "blob_id": "8479c70fed36dc6f1e6094c832fb22d8c2e53e3a", "index": 920, "step-1": "<mask token>\n\n\nclass CommitAnalyzer:\n <mask token>\n\n def __init__(self, repo_path):\n self.repo_path = repo_path\n self.repo = Repo(self.repo_path)\n assert not self.repo.bare\n <mask token>\n\n\n...
[ 2, 5, 6, 7, 8 ]
def non_dupulicates_lette(word): text = list(word); print(text) i=0 for i in range(len(text)): for k in text: print(c) def has_dupulicates(word): d= dict() for c in word: if c not in d: d[c]=1 else: d[c]+=1 ...
normal
{ "blob_id": "8cd234c2ec1b36abd992cc1a46147376cc241ede", "index": 3276, "step-1": "<mask token>\n\n\ndef has_dupulicates(word):\n d = dict()\n for c in word:\n if c not in d:\n d[c] = 1\n else:\n d[c] += 1\n for k in d:\n if d[k] == 1:\n print(k)\n ...
[ 1, 2, 3, 4, 5 ]
""" """ ##################################################################### #This software was developed by the University of Tennessee as part of the #Distributed Data Analysis of Neutron Scattering Experiments (DANSE) #project funded by the US National Science Foundation. #See the license text in license.txt #copyr...
normal
{ "blob_id": "3cdb39e201983e672f6c22c25492a120be3d0d48", "index": 9937, "step-1": "\"\"\"\n\"\"\"\n#####################################################################\n#This software was developed by the University of Tennessee as part of the\n#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)...
[ 0 ]
# -*- coding: utf-8 -*- """Application configuration. See https://github.com/sloria/cookiecutter-flask for configuration options with other flask-extensions """ import os class Config(object): """Base configuration.""" SECRET_KEY = os.environ.get('DELIVERY_ASSISTANT_SECRET', 'secret-key') # TODO: Change me...
normal
{ "blob_id": "4cc1c8668a84cc6faadf60053568d155b8852c5f", "index": 5643, "step-1": "<mask token>\n\n\nclass DevConfig(Config):\n <mask token>\n ENV = 'dev'\n DEBUG = True\n\n\nclass TestConfig(Config):\n \"\"\"Test configuration.\"\"\"\n TESTING = True\n DEBUG = True\n", "step-2": "<mask token>...
[ 5, 9, 11, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': url_arg = sys.argv[1] email = sys.argv[2] params = {'email': email} response = requests.post(url_arg, data=params) print(response.text) <|reserved_special_token_1|> <|reserved_spec...
flexible
{ "blob_id": "0d9c50e55df5aa5614bd5a9679729cf7fa69c5df", "index": 1461, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n url_arg = sys.argv[1]\n email = sys.argv[2]\n params = {'email': email}\n response = requests.post(url_arg, data=params)\n print(response.text)...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @app.task def delete_kube_by_name(name): try: logging.info(kubectl['delete', name]()) return True except ProcessExecutionError: return False <|reserved_special_token_1|> <|reserved_special_token_0|> @app.task def create_kube_from_template(file_name, *a...
flexible
{ "blob_id": "137e80b3bfdc0dba33a3108b37d21d298a8f251d", "index": 1544, "step-1": "<mask token>\n\n\n@app.task\ndef delete_kube_by_name(name):\n try:\n logging.info(kubectl['delete', name]())\n return True\n except ProcessExecutionError:\n return False\n", "step-2": "<mask token>\n\n\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Node: object_id = 0 weight = 0 value = 0 def __init__(self, object_id, weight, value): self.object_id = object_id self.weight = weight self.value = value <|reserved_special_token_0|> def read_file(file): f = open(file, 'r') f.seek...
flexible
{ "blob_id": "be408b349e2795101b525ad8d948dbf52cab81bf", "index": 4281, "step-1": "<mask token>\n\n\nclass Node:\n object_id = 0\n weight = 0\n value = 0\n\n def __init__(self, object_id, weight, value):\n self.object_id = object_id\n self.weight = weight\n self.value = value\n\n\...
[ 4, 5, 7, 8, 9 ]
<|reserved_special_token_0|> def main(): root = tk.Tk() root.title('DailyFudan') set_win_center(root, 700, 350) root.resizable(0, 0) lblid = tk.Label(root, text='学号:') lblid.grid(row=0, column=0) entID = tk.Entry(root) entID.grid(row=0, column=1, padx=25, pady=0) lblPW = tk.Label(r...
flexible
{ "blob_id": "d133a07f69d2dadb5559d881b01050abb2a9602b", "index": 3891, "step-1": "<mask token>\n\n\ndef main():\n root = tk.Tk()\n root.title('DailyFudan')\n set_win_center(root, 700, 350)\n root.resizable(0, 0)\n lblid = tk.Label(root, text='学号:')\n lblid.grid(row=0, column=0)\n entID = tk....
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def main(): print('\n', sys.version_info) try: while True: print('\n\nPress Ctrl+C to exit.') usr = test() out = binascii.hexlify(bytes(usr, encoding='utf8')) print('\nHex:\t\t', out) print('Base 10:\t', int(out, ...
flexible
{ "blob_id": "a52cbe6dbf4b4fc82d09e5f34e6e135933f3af38", "index": 1418, "step-1": "<mask token>\n\n\ndef main():\n print('\\n', sys.version_info)\n try:\n while True:\n print('\\n\\nPress Ctrl+C to exit.')\n usr = test()\n out = binascii.hexlify(bytes(usr, encoding='u...
[ 1, 2, 3, 4, 5 ]
from checkio.home.long_repeat import long_repeat def test_long_repeat(): assert long_repeat("sdsffffse") == 4, "First" assert long_repeat("ddvvrwwwrggg") == 3, "Second" def test_fails_1(): assert long_repeat("") == 0, "Empty String" def test_fails_2(): assert long_repeat("aa") == 2
normal
{ "blob_id": "b459919e779063247c176e127368c687c903cf0f", "index": 7869, "step-1": "<mask token>\n\n\ndef test_fails_1():\n assert long_repeat('') == 0, 'Empty String'\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef test_fails_1():\n assert long_repeat('') == 0, 'Empty String'\n\n\ndef test_fails_2(...
[ 1, 2, 3, 4, 5 ]
class Solution: def longestConsecutive(self, nums) -> int: s = set(nums) answer = 0 # n = len(s) for value in s: if value - 1 not in s: j = value while (j in s): j = j + 1 answer = max(answer, j - val...
normal
{ "blob_id": "9cb5573fada7a1529507da1d031f836044c10066", "index": 2474, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def longestConsecutive(self, nums) ->int:\n s = set(nums)\n answer = 0\n for value in s:\n if v...
[ 0, 1, 2, 3 ]
from django.contrib import admin # from django.contrib.admin import AdminSite # class MyAdminSite(AdminSite): # site_header = 'Finder Administration' # admin_site = MyAdminSite(name='Finder Admin') from finder.models import Database, Column, GpsData, Alarm, System class ColumnInline(admin.TabularInline): mo...
normal
{ "blob_id": "e1968e0d6146ce7656505eeed8e9f31daa4b558a", "index": 5447, "step-1": "<mask token>\n\n\nclass DatabaseAdmin(admin.ModelAdmin):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n\n\nclass AlarmAdmin(admin.ModelAdmin):\n list_display = ['nam...
[ 5, 7, 10, 11, 13 ]
import discord from collections import Counter from db import readDB, writeDB INFO_DB_SUCCESS = 'Database updated successfully!' ERROR_DB_ERROR = 'Error: Unable to open database for writing' ERROR_DB_NOT_FOUND = 'Error: Database for specified game does not exist. Check your spelling or use !addgame first.' ERROR_PLA...
normal
{ "blob_id": "5869669f1e3f648c0ddc68683f0b1d2754b40169", "index": 8714, "step-1": "<mask token>\n\n\ndef roundMultiple(num, multiple):\n if num % multiple:\n return num + (multiple - num % multiple)\n return num\n\n\n<mask token>\n\n\ndef incrementStats(msgChannel, statsFile, winner, losers):\n da...
[ 4, 5, 6, 7, 9 ]
""" common tests """ from django.test import TestCase from src.core.common import get_method_config from src.predictive_model.classification.models import ClassificationMethods from src.predictive_model.models import PredictiveModels from src.utils.tests_utils import create_test_job, create_test_predictive_model cl...
normal
{ "blob_id": "824038a56e8aaf4adf6ec813a5728ab318547582", "index": 1638, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TestCommon(TestCase):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TestCommon(TestCase):\n\n def test_get_method_config(self):\n job = create_test_job(pr...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> log.setLevel(logging.DEBUG) <|reserved_special_token_0|> stream_hander.setFormatter(formatter) log.addHandler(stream_hander) <|reserved_special_token_1|> <|reserved_special_token_0|> formatter = logging.Formatter('%(asctime)s ...
flexible
{ "blob_id": "675fbdfd519d00ab10bf613e8abb7338e484fe65", "index": 57, "step-1": "<mask token>\n", "step-2": "<mask token>\nlog.setLevel(logging.DEBUG)\n<mask token>\nstream_hander.setFormatter(formatter)\nlog.addHandler(stream_hander)\n", "step-3": "<mask token>\nformatter = logging.Formatter('%(asctime)s [%...
[ 0, 1, 2, 3, 4 ]
#str owog="Delger" # len()- urt # lower()- jijigruuleh # upper()- tomruulah # capitalize()- ehnii useg tomruulah # replace()- temdegt solih print(owog.find("e")) print(owog.count("e")) print(owog[2:10]) a=21 b=21 if a>b: print("a too ih") elif a==b: print("tentsuu") else: print("b to...
normal
{ "blob_id": "c4ca4b5c77c3c912b44a4853be30298ec845c4fd", "index": 243, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(owog.find('e'))\nprint(owog.count('e'))\nprint(owog[2:10])\n<mask token>\nif a > b:\n print('a too ih')\nelif a == b:\n print('tentsuu')\nelse:\n print('b too ih')\n<mask to...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_offset_date(modifed_date, offset_in_days): return date.isoformat(modifed_date + timedelta(days=int(offset_in_days))) def get_trending_repositories(start_search_date, number_of_results=20): github_api_uri = 'https://api.github.com' query_search_url = '{}/search/reposi...
flexible
{ "blob_id": "8a7536b998a6d122e2e7529af1ebe2a0f025303f", "index": 5620, "step-1": "<mask token>\n\n\ndef get_offset_date(modifed_date, offset_in_days):\n return date.isoformat(modifed_date + timedelta(days=int(offset_in_days)))\n\n\ndef get_trending_repositories(start_search_date, number_of_results=20):\n g...
[ 3, 4, 5, 6 ]
<|reserved_special_token_0|> def skip_func(list): cnt = 0 for i in list: padd = [0] * 200 try: got = api.friends_ids(i, count=200) except: print('========NG=============', cnt) follower_list.append(padd) else: print('==========OK=...
flexible
{ "blob_id": "8fac4571a3a1559e297754e89375be06d6c45c2d", "index": 4795, "step-1": "<mask token>\n\n\ndef skip_func(list):\n cnt = 0\n for i in list:\n padd = [0] * 200\n try:\n got = api.friends_ids(i, count=200)\n except:\n print('========NG=============', cnt)\n ...
[ 1, 2, 3, 4, 5 ]
import os import imageio import h5py import numpy as np def create_segmentation_test_data(data_path, raw_key, label_key, shape, chunks): with h5py.File(data_path, 'a') as f: f.create_dataset(raw_key, data=np.random.rand(*shape), chunks=chunks) f.create_dataset(label_key, data=np.random.randint(0, ...
normal
{ "blob_id": "e3417980599448f1293b56cb95312088e7a8abe3", "index": 9713, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef create_segmentation_test_data(data_path, raw_key, label_key, shape, chunks\n ):\n with h5py.File(data_path, 'a') as f:\n f.create_dataset(raw_key, data=np.random.rand...
[ 0, 1, 2, 3, 4 ]
conf = {'PROJECT': 'WCCIA', 'NAS_FOLDER': 'Q:\\GROUPS\\CORP_JGS_DSE\\ATI\\quotations', 'DB_SERVER': '10.0.36.129', 'DB_PORT': '34000/'}
normal
{ "blob_id": "fbce185671267bd70cf7b91696867b72dfcc8d5b", "index": 1585, "step-1": "<mask token>\n", "step-2": "conf = {'PROJECT': 'WCCIA', 'NAS_FOLDER':\n 'Q:\\\\GROUPS\\\\CORP_JGS_DSE\\\\ATI\\\\quotations', 'DB_SERVER': '10.0.36.129',\n 'DB_PORT': '34000/'}\n", "step-3": null, "step-4": null, "step...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> np.set_printoptions(formatter={'float_kind': float_formatter}) <|reserved_special_token_0|> if __name__ == '__main__': import numpy.random as random import sys if len(sys.argv) == 1: sys.exit('{} [directory]'.f...
flexible
{ "blob_id": "f1c6340880b52ba86856913f74c7d589d9b49f49", "index": 5179, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.set_printoptions(formatter={'float_kind': float_formatter})\n<mask token>\nif __name__ == '__main__':\n import numpy.random as random\n import sys\n if len(sys.argv) == 1:\n ...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Wed Feb 7 17:42:18 2018 @author: Tim """ import music21 as m21 import music21.features.jSymbolic as jsym import scipy.stats from collections import Counter import numpy as np import matplotlib.pyplot as plt from timeit import default_timer as timer # round all duration values t...
normal
{ "blob_id": "eb9135c6bcf89a62534cfc8480e5d44a089fe5a8", "index": 1216, "step-1": "<mask token>\n\n\ndef extractPatternOccurrence(songName, inStart, inEnd, useTies, songs):\n \"\"\"\n given song name, occurrence start, occurrence end, and the database of score files,\n return the notes of the associated ...
[ 3, 8, 9, 10, 11 ]
# Mezzanine Django Framework createdb error on Max OSX 10.9.2 import django django.version
normal
{ "blob_id": "56afde2a31ad9dddee35e84609dff2eb0fc6fe1a", "index": 9438, "step-1": "<mask token>\n", "step-2": "<mask token>\ndjango.version\n", "step-3": "import django\ndjango.version\n", "step-4": "# Mezzanine Django Framework createdb error on Max OSX 10.9.2\nimport django\ndjango.version\n", "step-5":...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class RLTrainer(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class RLTrainer(object): <|reserved_special_token_0|> def __init__(self, config_, grid_search...
flexible
{ "blob_id": "7c004cb0c9eefa5e88f5085fb3b2878db98d2b20", "index": 3200, "step-1": "<mask token>\n\n\nclass RLTrainer(object):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass RLTrainer(object):\n <mask token>\n\n def __init__(self, config_, grid_search=False):\n...
[ 1, 3, 4, 5, 6 ]
def quick_sort(arr): q_sort(arr, 0, len(arr) - 1) def q_sort(arr, left, right): if left < right: pivot_index = partition(arr, left, right) q_sort(arr, left, pivot_index - 1) q_sort(arr, pivot_index + 1, right) def partition(arr, left, right): pivot = arr[left] while left < ...
normal
{ "blob_id": "09a5c96b7f496aca6b34d7f0a83d5b1e182ca409", "index": 1627, "step-1": "def quick_sort(arr):\n q_sort(arr, 0, len(arr) - 1)\n\n\ndef q_sort(arr, left, right):\n if left < right:\n pivot_index = partition(arr, left, right)\n q_sort(arr, left, pivot_index - 1)\n q_sort(arr, piv...
[ 2, 3, 4, 5, 6 ]
#grabbed the following from moses marsh -- https://github.com/sidetrackedmind/gimme-bus/blob/master/gimmebus/utilities.py from datetime import datetime as dt from math import radians, cos, sin, acos, asin, sqrt import networkx as nx ## These functions will go in model.py for matching historical GPS ## positions to th...
normal
{ "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 ]
from scipy.optimize import newton from math import sqrt import time def GetRadius(Ri,DV,mu): def f(Rf): return sqrt(mu/Ri)*(sqrt(2*Rf/(Rf+Ri))-1)+sqrt(mu/Rf)*(1-sqrt(2*Ri/(Rf+Ri)))-DV return newton(f,Ri) if __name__ == '__main__': starttime = time.time() print(GetRadius(10000.0,23546.2146710...
normal
{ "blob_id": "20722cf82371d176942e068e91b8fb38b4db61fd", "index": 6951, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef GetRadius(Ri, DV, mu):\n\n def f(Rf):\n return sqrt(mu / Ri) * (sqrt(2 * Rf / (Rf + Ri)) - 1) + sqrt(mu / Rf\n ) * (1 - sqrt(2 * Ri / (Rf + Ri))) - DV\n re...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def path_check(hosts): """ Parses username, port, host and local and remote path, finds all local and remote files, using find_local_files and find_remote_files functions, and then opens ssh session using paramiko for each given host. """ local_files = [] local...
flexible
{ "blob_id": "6e3aa677985d7bd91bfbbd2078665206839bac63", "index": 3578, "step-1": "<mask token>\n\n\ndef path_check(hosts):\n \"\"\"\n Parses username, port, host and local and remote path,\n finds all local and remote files, using find_local_files and find_remote_files functions,\n and then opens ssh...
[ 4, 6, 7, 8, 9 ]
import argparse import debug.debug as dbg import helper.helper as hlp import prep.preprocessor as pre import sample.sample as s def main(dir_train, C, gamma, number_partitions, do_subsampling, write_labels): hlp.setup_logging() # Files as folds? if number_partitions is None or number_partitions == 0: #...
normal
{ "blob_id": "4a63431aa71ca3f4b75fcd89a50bf599e7717645", "index": 2442, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(dir_train, C, gamma, number_partitions, do_subsampling, write_labels):\n hlp.setup_logging()\n if number_partitions is None or number_partitions == 0:\n do_conca...
[ 0, 1, 2, 3, 4 ]
# Copyright Materialize, Inc. and contributors. All rights reserved. # # Use of this software is governed by the Business Source License # included in the LICENSE file at the root of this repository. # # As of the Change Date specified in that file, in accordance with # the Business Source License, use of this software...
normal
{ "blob_id": "97ca134ffce404f4b2bc7352d4aac73a7bb764bd", "index": 5708, "step-1": "<mask token>\n\n\nclass OptbenchRun(MeasurementSource):\n\n def __init__(self, optbench_scenario: str, query: int):\n self._executor: Optional[Executor] = None\n self._optbench_scenario = optbench_scenario\n ...
[ 7, 9, 12, 13, 14 ]
import pygame import sys # класс для хранения настроек class Settings(): """docstring for Setting""" def __init__(self): # параметры экрана self.colour = (230, 230, 230) self.screen_width = 1200 self.screen_height = 800 # параметры коробля self.ship_speed = 1.5 # параметры пули self.bullet_speed = ...
normal
{ "blob_id": "2402188380bc0189b88e3cfcbaabf64a9919b3d5", "index": 8810, "step-1": "<mask token>\n\n\nclass Settings:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Settings:\n <mask token>\n\n def __init__(self):\n self.colour = 230, 230, 230\n self.screen_width =...
[ 1, 2, 3, 4, 5 ]
import pygame import time import math from pygame.locals import * from pygux.widgets.widget import Widget, hlBox from pygux.colours import Colours class Sprite(Widget): def __init__(self, x, y, w, h, image=None, callback=None, **kw): """Sprite widget """ Widget.__init__(self, x, y, w, h, ...
normal
{ "blob_id": "0003d104a4dcd5a5b2357016cbc0317738c2cd3c", "index": 2007, "step-1": "<mask token>\n\n\nclass Sprite(Widget):\n\n def __init__(self, x, y, w, h, image=None, callback=None, **kw):\n \"\"\"Sprite widget\n \"\"\"\n Widget.__init__(self, x, y, w, h, **kw)\n if image:\n ...
[ 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> db.create_all() Patient.add_patient() Appointment.add_appointment() PhoneCalls.add_call() <|reserved_special_token_1|> from config import SQLALCHEMY_DATABASE_URI from app.models import Patient, Appointment, PhoneCalls from app ...
flexible
{ "blob_id": "173e6017884a1a4df64018b306ea71bcaa1c5f1d", "index": 4528, "step-1": "<mask token>\n", "step-2": "<mask token>\ndb.create_all()\nPatient.add_patient()\nAppointment.add_appointment()\nPhoneCalls.add_call()\n", "step-3": "from config import SQLALCHEMY_DATABASE_URI\nfrom app.models import Patient, A...
[ 0, 1, 2, 3 ]
import json import sys with open(sys.argv[1], 'r') as f: x = json.load(f) with open('my_wire_to_quartus_wire.json', 'r') as f: wirenamemap = json.load(f) print("----- There are {} muxes in the database".format(len(x))) print("----- There are {} routing pairs in the database".format(sum((len(v) for k, v in x.i...
normal
{ "blob_id": "95163a28a35cc88240d9d6edc2e9b416e5493909", "index": 6021, "step-1": "<mask token>\n\n\ndef bits2str(bits):\n ret = ''\n for row in bits:\n rowstr = ''\n for bit in row:\n rowstr += '1' if bit else '0'\n ret += rowstr + '\\n'\n return ret\n\n\ndef parse_xyi(in...
[ 6, 7, 9, 10, 11 ]
from urllib.error import URLError from urllib.request import urlopen from bs4 import BeautifulSoup import re import pymysql import ssl from pymysql import Error def decode_page(page_bytes, charsets=('utf-8',)): """通过指定的字符集对页面进行解码(不是每个网站都将字符集设置为utf-8)""" page_html = None for charset in charsets: try...
normal
{ "blob_id": "53fae0103168f4074ba0645c33e4640fcefdfc96", "index": 731, "step-1": "<mask token>\n\n\ndef decode_page(page_bytes, charsets=('utf-8',)):\n \"\"\"通过指定的字符集对页面进行解码(不是每个网站都将字符集设置为utf-8)\"\"\"\n page_html = None\n for charset in charsets:\n try:\n page_html = page_bytes.decode(c...
[ 5, 6, 7, 8, 9 ]
def name_of_function(): """ Docstring explains function. """ return 'Hello' def dog_check(mystring): if 'dog' in mystring.lower(): return True else: return False <|reserved_special_token_0|> def dog_check(mystring): return 'dog' in mystring.lower() <|reserved_special_toke...
flexible
{ "blob_id": "1deb070dd91c01190b70fa678add31ecb82f34fa", "index": 3404, "step-1": "def name_of_function():\n \"\"\"\n Docstring explains function.\n \"\"\"\n return 'Hello'\n\n\ndef dog_check(mystring):\n if 'dog' in mystring.lower():\n return True\n else:\n return False\n\n\n<mask tok...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class JobTest(TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def test_field_order(self): """ Job test with field order. """ ...
flexible
{ "blob_id": "d2298ad1e4737b983ba6d1f2fff59750137510b5", "index": 904, "step-1": "<mask token>\n\n\nclass JobTest(TestCase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def test_field_order(self):\n \"\"\"\n Job test with field order.\n \"\...
[ 10, 15, 16, 17, 20 ]
from jabberbot import JabberBot, botcmd import datetime import logging import sys import time; from config import username, password, chatroom, adminuser class SystemInfoJabberBot(JabberBot): @botcmd def serverinfo( self, mess, args): """Displays information about the server""" version = open(...
normal
{ "blob_id": "c9872fb536fd6552e2a5353566305555808747f7", "index": 1777, "step-1": "<mask token>\n\n\nclass SystemInfoJabberBot(JabberBot):\n\n @botcmd\n def serverinfo(self, mess, args):\n \"\"\"Displays information about the server\"\"\"\n version = open('/proc/version').read().strip()\n ...
[ 4, 5, 6, 7, 9 ]
""" This module is used to extract features from the lines extracted from documents using BERT encodings. This package leverages the bert-as-a-server package to create the embeddings. Example: feature_extractor = FeatureExtractor(document) # document is of class Document encoded_doc = feature_extracto...
normal
{ "blob_id": "882d265f14c04b2f2f626504d18e2cd07dcc8637", "index": 3042, "step-1": "<mask token>\n\n\nclass FeatureExtractor:\n <mask token>\n <mask token>\n\n def encode(self):\n \"\"\" encodes the text in the Document object, and then adds it to the encoding attribute \"\"\"\n text_lines =...
[ 3, 4, 5, 6, 7 ]
from Socket import Socket import threading class Server(Socket): def __init__(self): super(Server, self).__init__() print("server listening") self.users = [] def set_up(self): self.bind(("192.168.0.109", 1337)) self.listen(0) self.accept_sockets() def sen...
normal
{ "blob_id": "2027904401e5be7b1c95eebec3a1e6a88c25660c", "index": 9338, "step-1": "<mask token>\n\n\nclass Server(Socket):\n\n def __init__(self):\n super(Server, self).__init__()\n print('server listening')\n self.users = []\n\n def set_up(self):\n self.bind(('192.168.0.109', 13...
[ 5, 6, 7, 8, 9 ]
from deuces.card import Card from deuces.deck import Deck from fast_utils.hand_strength.original_HS import * from fast_utils.hand_strength.nn_HS import encode_hs from fast_utils.expected_hand_strength.nn_EHS import * from keras.models import load_model def read_lookup_table(hole_cards, lookup_table): """ Read...
normal
{ "blob_id": "8503998fc881f47dc695d3ea4c7f56fa65a96e8a", "index": 2874, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef read_lookup_table(hole_cards, lookup_table):\n \"\"\"\n Reads the preflop lookup table preflop_EHSs.txt.\n Args: \n hole_cards: list of int (deuces cards)\n ...
[ 0, 1, 2 ]
from random import randint cantidad = int(input("Numero de preguntas: ")) contador_bien = 0 contador_mal = 0 while cantidad <= 0: print ("El numero de preguntas debe ser al menos 1") cantidad = int(input("Numero de preguntas: ")) for i in range(cantidad): numero = randint(2,10) numero2 = randint(2,10) aleatorio ...
normal
{ "blob_id": "48bc5d4b191fa631650b60240560dbece6396312", "index": 655, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile cantidad <= 0:\n print('El numero de preguntas debe ser al menos 1')\n cantidad = int(input('Numero de preguntas: '))\nfor i in range(cantidad):\n numero = randint(2, 10)\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(mydict) print(mylist0) print(mylist1) for c in ('0', '1'): if c in mydict: mydict[c] += mylist0 else: mydict[c] = mylist0 print(mydict) for c in ('0', '1'): if c in mydict: mydict[c] += my...
flexible
{ "blob_id": "6e5b8be6182f39f185f4547f0abd84a4e404bf34", "index": 1861, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(mydict)\nprint(mylist0)\nprint(mylist1)\nfor c in ('0', '1'):\n if c in mydict:\n mydict[c] += mylist0\n else:\n mydict[c] = mylist0\nprint(mydict)\nfor c in ('0...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: sleep(0.5) r = random.choice(mineral) x, y, z = mc.entity.getTilePos(myID) mc.setBlocks(x + 1, y + 3, z + 1, x - 1, y - 3, z - 1, r) <|reserved_special_token_1|> <|reserved_special_token_0|> mc = Min...
flexible
{ "blob_id": "b28ae19f31ae746f901dea645dfeaa211a15cd31", "index": 1879, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n sleep(0.5)\n r = random.choice(mineral)\n x, y, z = mc.entity.getTilePos(myID)\n mc.setBlocks(x + 1, y + 3, z + 1, x - 1, y - 3, z - 1, r)\n", "step-3": "<mask...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_results_df(fname, problem): """Process csv into dataframe. """ t = '\t' val_cols = ['Actions', 'Expansions', 'GoalTests', 'NewNodes', 'PlanLength', 'ElapsedSeconds'] err = '' df = pd.read_csv(fname, sep=t) if df.shape[0] < len(val_cols): ...
flexible
{ "blob_id": "cd49230be3c418853aa2986ed727204e51a6b6ae", "index": 3794, "step-1": "<mask token>\n\n\ndef get_results_df(fname, problem):\n \"\"\"Process csv into dataframe.\n \"\"\"\n t = '\\t'\n val_cols = ['Actions', 'Expansions', 'GoalTests', 'NewNodes',\n 'PlanLength', 'ElapsedSeconds']\n ...
[ 6, 12, 14, 16, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': sac_gym_test() <|reserved_special_token_1|> from neodroidagent.entry_points.agent_tests import sac_gym_test if __name__ == '__main__': sac_gym_test() <|reserved_special_token_1|> from neodr...
flexible
{ "blob_id": "e9890fcf9ad2a78b3400f6e4eeb75deac8edcd6a", "index": 1609, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n sac_gym_test()\n", "step-3": "from neodroidagent.entry_points.agent_tests import sac_gym_test\nif __name__ == '__main__':\n sac_gym_test()\n", "step...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TRSInterface: def toolsGet(self): raise NotImplementedError def metadataGet(self): raise NotImplementedError <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_s...
flexible
{ "blob_id": "d122267e1da2d9cf68d245148bb496dfba3e7d19", "index": 4467, "step-1": "<mask token>\n\n\nclass TRSInterface:\n\n def toolsGet(self):\n raise NotImplementedError\n\n def metadataGet(self):\n raise NotImplementedError\n <mask token>\n <mask token>\n <mask token>\n <mask t...
[ 18, 21, 24, 27, 30 ]
# Generated by Django 3.1.2 on 2021-07-02 05:38 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('asset', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='balance', name='title', ), ]
normal
{ "blob_id": "257f18db95e069c037341d2af372269e988b0a80", "index": 536, "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 = [('asset', '000...
[ 0, 1, 2, 3, 4 ]
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class StravaAuthConfig(AppConfig): name = "strava.contrib.strava_django" verbose_name = _("Strava Auth") def ready(self): pass
normal
{ "blob_id": "9e43eb3c3ab3be4e695dbc80aa005332b8d8a4ec", "index": 9515, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass StravaAuthConfig(AppConfig):\n <mask token>\n <mask token>\n\n def ready(self):\n pass\n", "step-3": "<mask token>\n\n\nclass StravaAuthConfig(AppConfig):\n ...
[ 0, 2, 3, 4, 5 ]
#!/usr/bin/python from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String, ForeignKey from sqlalchemy.orm import sessionmaker, relationship engine = create_engine("sqlite:///banco.db") Base = declarative_base() Session = sessionmaker(...
normal
{ "blob_id": "6d5257158a7d2eef63faf2fea27f36721d4349ae", "index": 4273, "step-1": "#!/usr/bin/python\n\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy import Column, Integer, String, ForeignKey\nfrom sqlalchemy.orm import sessionmaker, relationship\n...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def split_the_bill(x): owed_dict = {} sum = 0 people = 0 for key in x: sum = sum + x[key] people = people + 1 price_pp = sum / people for key in x: owed_value = x[key] - price_pp ...
flexible
{ "blob_id": "69d7e7eb644a67ee921086005f0a55f39507f361", "index": 2864, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef split_the_bill(x):\n owed_dict = {}\n sum = 0\n people = 0\n for key in x:\n sum = sum + x[key]\n people = people + 1\n price_pp = sum / people\n f...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class SoftmaxWithLossLayer: <|reserved_special_token_0|> def __init__(self): self.y = None self.t = None def forward(self, x, t): """ x: input to softmax t: teacher data """ self.t = t self.y = softmax(x) ...
flexible
{ "blob_id": "8ae64c65d6d5dc9f2a99aeceff31657deff06c15", "index": 5236, "step-1": "<mask token>\n\n\nclass SoftmaxWithLossLayer:\n <mask token>\n\n def __init__(self):\n self.y = None\n self.t = None\n\n def forward(self, x, t):\n \"\"\"\n x: input to softmax\n t: teach...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(New_list) <|reserved_special_token_1|> <|reserved_special_token_0|> lst = [1, -3, 4, -56, 7, 3, -8, -5, 2, 4, 9] New_list = list(filter(lambda x: x > 0, lst)) print(New_list) <|reserved_special_token_1|> '''4. Write a ...
flexible
{ "blob_id": "d61151859390ab1c907ac3753143312da434981e", "index": 2624, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(New_list)\n", "step-3": "<mask token>\nlst = [1, -3, 4, -56, 7, 3, -8, -5, 2, 4, 9]\nNew_list = list(filter(lambda x: x > 0, lst))\nprint(New_list)\n", "step-4": "'''4. Write a ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): def eventualSafeNodes(self, graph): """ :type graph: List[List[int]] :rtype: List[int] """ WHITE, GRA...
flexible
{ "blob_id": "5c5cfcd240c8b05970dc8dff57bfbbdc98f1d100", "index": 9838, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n", "step-3": "class Solution(object):\n\n def eventualSafeNodes(self, graph):\n \"\"\"\n :type graph: List[List[int]]\n :rtype: List...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class MissingTransitionException(InvalidConfigException): """ Describes a capability that is missing. """ def __init__(self, transitions): self.transitions = transitions super(InvalidConfigException, self).__init__( 'Missing transition detected...
flexible
{ "blob_id": "675dc9467dd6db9c2a429941af56d78d6c0e1c08", "index": 4135, "step-1": "<mask token>\n\n\nclass MissingTransitionException(InvalidConfigException):\n \"\"\"\n Describes a capability that is missing.\n \"\"\"\n\n def __init__(self, transitions):\n self.transitions = transitions\n ...
[ 14, 16, 18, 23, 26 ]
import markovify import argparse import sqlite3 import time modelFile = './data/model.json' corpusFile = './data/corpus.txt' dbFile = './data/tweets.sqlite3' def generate(): generate_count = 168 model_json = open(modelFile, 'r').read() model = markovify.Text.from_json(model_json) conn = sqlite3.conne...
normal
{ "blob_id": "cc71c0cc1ec21dc465486fb5894c4d389c39bd62", "index": 8164, "step-1": "<mask token>\n\n\ndef make_model():\n corpus = open(corpusFile).read()\n text_model = markovify.Text(corpus, state_size=4)\n model_json = text_model.to_json()\n f = open(modelFile, mode='w')\n f.write(model_json)\n ...
[ 1, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> NUM_CLASSES = 31 AUDIO_SR = 16000 AUDIO_LENGTH = 16000 LIBROSA_AUDIO_LENGTH = 22050 EPOCHS = 25 categories = {'stop': 0, 'nine': 1, 'off': 2, 'four': 3, 'right': 4, 'eight': 5, 'one': 6, 'bird': 7, 'dog': 8, 'no': 9, 'on': 10, 'seven': 11, 'cat': 12,...
flexible
{ "blob_id": "6a9e18cde94258b01a37f459eceaac58118b4976", "index": 5813, "step-1": "<mask token>\n", "step-2": "NUM_CLASSES = 31\nAUDIO_SR = 16000\nAUDIO_LENGTH = 16000\nLIBROSA_AUDIO_LENGTH = 22050\nEPOCHS = 25\ncategories = {'stop': 0, 'nine': 1, 'off': 2, 'four': 3, 'right': 4,\n 'eight': 5, 'one': 6, 'bir...
[ 0, 1, 2 ]
class Date: def __init__(self, strDate): strDate = strDate.split('.') self.day = strDate[0] self.month = strDate[1] self.year = strDate[2]
normal
{ "blob_id": "805fc9a26650f85227d14da972311ffbd9dbd555", "index": 16, "step-1": "<mask token>\n", "step-2": "class Date:\n <mask token>\n", "step-3": "class Date:\n\n def __init__(self, strDate):\n strDate = strDate.split('.')\n self.day = strDate[0]\n self.month = strDate[1]\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class imageAnalyzer: <|reserved_special_token_0|> def getImage(self, img_number): temp = open(self.temp_img_path + str(img_number) + '.jpeg', 'wb') img = requests.get(self.url + '/image') temp.write(img.content) temp.close() def analyzeHSV(sel...
flexible
{ "blob_id": "7d3264e9a90ebd72439f77983cbf4f9755048a85", "index": 4300, "step-1": "<mask token>\n\n\nclass imageAnalyzer:\n <mask token>\n\n def getImage(self, img_number):\n temp = open(self.temp_img_path + str(img_number) + '.jpeg', 'wb')\n img = requests.get(self.url + '/image')\n te...
[ 6, 8, 9, 10, 11 ]
import requests import toml from pathlib import Path imgs:list config:dict def parseTex(lines:list): new_lines = [] for i, line in enumerate(lines): if line == "\n": continue inline = False if (line[0] == "$" and line[1] != "$"): inline = True line = li...
normal
{ "blob_id": "dbd04f7b88fa43ae920a6744e3979dbf917d3fc6", "index": 7649, "step-1": "<mask token>\n\n\ndef parseTex(lines: list):\n new_lines = []\n for i, line in enumerate(lines):\n if line == '\\n':\n continue\n inline = False\n if line[0] == '$' and line[1] != '$':\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> exec(open('docker_zabbix_script_sender/version.py').read()) setup(name=NAME, version=version, author='Cyril Moreau', author_email= 'cyril.moreauu@gmail.com', url=GITHUB_ORG_URL + '/' + NAME, download_url='{0}/{1}/tarball/v...
flexible
{ "blob_id": "0769003c248c099da5bcd75541d35234b01af5de", "index": 2723, "step-1": "<mask token>\n", "step-2": "<mask token>\nexec(open('docker_zabbix_script_sender/version.py').read())\nsetup(name=NAME, version=version, author='Cyril Moreau', author_email=\n 'cyril.moreauu@gmail.com', url=GITHUB_ORG_URL + '/...
[ 0, 1, 2, 3, 4 ]
from collections import defaultdict def k_most_frequent(arr:list, k:int): ''' ''' counts = defaultdict(int) for n in nums: counts[n] += 1 counts = [(k,v) for k,v in counts.items()] ordered = list(reversed(sorted(counts, key=lambda d: d[1]))) return [o[0] for o in ordered[:k]] num...
normal
{ "blob_id": "1298c2abae519a5365cc0d9d406196db987eb219", "index": 5923, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef k_most_frequent(arr: list, k: int):\n \"\"\" \"\"\"\n counts = defaultdict(int)\n for n in nums:\n counts[n] += 1\n counts = [(k, v) for k, v in counts.items()]...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> ANCHO = 600 ALTO = 800
flexible
{ "blob_id": "71ca67948100fb7ad388934740cead1ebe4a2b52", "index": 8549, "step-1": "<mask token>\n", "step-2": "ANCHO = 600\nALTO = 800\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# -*- coding: utf-8 -*- """ Created on Tue Apr 24 18:50:16 2018 @author: User """ # -*- coding: utf-8 -*- """ Created on Mon Apr 23 19:05:42 2018 @author: User """ from bs4 import BeautifulSoup import pandas as pd import numpy as np import lxml import html5lib import csv path = 'E:/Data Scienc...
normal
{ "blob_id": "c7768e44464703552f579a1ec68b58fd9746a381", "index": 8743, "step-1": "<mask token>\n", "step-2": "<mask token>\nlen(dfhtml)\ndfhtml\ntype(dfhtml)\n<mask token>\nprint(txtnew)\n<mask token>\nf.writelines(str(txtnew))\nf.close()\n<mask token>\n", "step-3": "<mask token>\npath = (\n 'E:/Data Scie...
[ 0, 1, 2, 3, 4 ]
from threading import Thread, Lock from utils import reloj import random class Imprimidor(Thread): def __init__(self, nombre, berlin, bolsa_dinero): super().__init__() pass def run(self): ''' Funcionalidad de iMPRIMIDOR que imprime dinero cada 5 minutos, cada iteracio...
normal
{ "blob_id": "ab79e2f9584dbbb526c62bde882a1bc9874b56f9", "index": 7903, "step-1": "<mask token>\n\n\nclass Imprimidor(Thread):\n\n def __init__(self, nombre, berlin, bolsa_dinero):\n super().__init__()\n pass\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\...
[ 2, 4, 5, 6, 7 ]
import requests from urllib.parse import urlparse, urlencode from json import JSONDecodeError from requests.exceptions import HTTPError def validate_response(response): """ raise exception if error response occurred """ r = response try: r.raise_for_status() except HTTPError as e: ...
normal
{ "blob_id": "5bd2cf2ae68708d2b1dbbe0323a5f83837f7b564", "index": 7842, "step-1": "<mask token>\n\n\nclass CpmsConnector:\n <mask token>\n <mask token>\n\n def __init__(self, config):\n \"\"\"initialize with config\n config(dict): must supply username, api_key, api_url\n \"\"\"\n ...
[ 13, 16, 17, 19, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> from socket import socket <|reserved_special_token_1|> #!/usr/bin python3 # coding: utf-8 """ AUTHOR: bovenson EMAIL: szhkai@qq.com FILE: 03.py DATE: 17-9-25 下午7:59 DESC: """ from socket import socket
flexible
{ "blob_id": "74d1491280eba1ceb06ccf6f45546cdb41149687", "index": 5642, "step-1": "<mask token>\n", "step-2": "<mask token>\nfrom socket import socket\n", "step-3": "#!/usr/bin python3\n# coding: utf-8\n\n\"\"\"\nAUTHOR: bovenson\nEMAIL: szhkai@qq.com\nFILE: 03.py\nDATE: 17-9-25 下午7:59\nDESC:\n\"\"\"\n\nfrom ...
[ 0, 1, 2 ]
alunos = list() while True: nome = str(input('Nome: ')) nota1 = float(input('Nota 1: ')) nota2 = float(input('Nota 2: ')) media = (nota1+nota2)/2 alunos.append([nome, [nota1, nota2], media]) pergunta = str(input('Quer continuar [S/N]? ')).upper()[0] if pergunta == 'N': break print('-...
normal
{ "blob_id": "8dcd4914c58a7ecafdfdd70b698ef3b7141386a6", "index": 2632, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n nome = str(input('Nome: '))\n nota1 = float(input('Nota 1: '))\n nota2 = float(input('Nota 2: '))\n media = (nota1 + nota2) / 2\n alunos.append([nome, [nota1,...
[ 0, 1, 2, 3 ]
# Write a class to hold player information, e.g. what room they are in # currently. class Player(): def __init__(self, name, location, items=[]): self.name = name self.location = location self.items = items # def try_direction(self, user_action): # attribute = user_action + '_...
normal
{ "blob_id": "b355bd5a519d65ea35d4e8d5e6a384424d79130a", "index": 3620, "step-1": "<mask token>\n", "step-2": "class Player:\n <mask token>\n\n def pick_up_item(self, item):\n if len(self.items) <= 3:\n self.items.append(item)\n print(\n f\"\"\"\n\nNOW YOU HAVE ...
[ 0, 2, 3, 4, 5 ]
# The actual code begins here # This file is intended to load everything downloaded from loaddata.py, preventing user getting banned from IMDB # The code is written to see what are some key words of the reviews from critics and normal viewers # And to see what are some of the differences # The second task is to asses t...
normal
{ "blob_id": "1f69cf5f6d15048e6ead37b5da836c9e2f783f74", "index": 803, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('loading data...')\nwith open('movienumbers.pickle', 'rb') as input_file:\n movienumbers = pickle.load(input_file)\nwith open('ratings.pickle', 'rb') as input_file:\n ratings =...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def foi_tab_v1(): path_foi = f"{config.get_value(['paths', 'temp'])}/foi/" path_foi_func = foi_v1.path_foi_func progress = Output() def outlog(*text): with progress: print(*text) foi_info...
flexible
{ "blob_id": "2f9a081845685a4748c8b028ae4ee3a056a10284", "index": 9779, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef foi_tab_v1():\n path_foi = f\"{config.get_value(['paths', 'temp'])}/foi/\"\n path_foi_func = foi_v1.path_foi_func\n progress = Output()\n\n def outlog(*text):\n ...
[ 0, 2, 3, 4, 5 ]
import numpy as np import imutils import cv2 image = cv2.imread("D:\\Github\\python-opencv\\images\\trex.png") cv2.imshow("Original", image) cv2.waitKey(0) (h, w) = image.shape[:2] # get height and width of the image center = (w/2, h/2) # which point to rotate around M = cv2.getRotationMatrix2D(center, 45, 1.0) # ro...
normal
{ "blob_id": "4462fec6e0edc25530c93ffeeae2372c86fef2cc", "index": 528, "step-1": "<mask token>\n", "step-2": "<mask token>\ncv2.imshow('Original', image)\ncv2.waitKey(0)\n<mask token>\ncv2.imshow('Rotated by 45 degrees', rotated)\ncv2.waitKey(0)\n<mask token>\ncv2.imshow('Rotated by -90 degrees', rotated)\ncv2....
[ 0, 1, 2, 3, 4 ]
from flask import Flask, render_template, request, jsonify, make_response app = Flask(__name__) @app.route("/") def hello(): # return render_template('chat.html') return make_response(render_template('chat.html'),200) if __name__ == "__main__": app.run(debug=True)
normal
{ "blob_id": "98841630964dd9513e51c3f13bfdb0719600712d", "index": 6941, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/')\ndef hello():\n return make_response(render_template('chat.html'), 200)\n\n\nif __name__ == '__main__':\n app.run(debug=True)\n", "step-3": "<mask token>\napp ...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def disemvowel(s): return s.translate(None, 'aeiouAEIOU') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def disemvowel(string): returnString = '' vowels = ['a', 'e', 'i', 'o', 'u'] upperVowels = ['A', 'E', 'I', 'O', 'U'] ...
flexible
{ "blob_id": "4dea0967a0ee3e9eb3b46145739dfeb233f3a120", "index": 5307, "step-1": "<mask token>\n\n\ndef disemvowel(s):\n return s.translate(None, 'aeiouAEIOU')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef disemvowel(string):\n returnString = ''\n vowels = ['a', 'e', 'i', 'o', 'u']\n upper...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> df.to_csv('Tweets.csv', index=None, header=None) <|reserved_special_token_1|> <|reserved_special_token_0|> df1 = pd.read_csv('Tweets1.csv', names=['tweet']) df2 = pd.read_csv('Tweets2.csv', names=['tweet']) df3 = pd.read_csv('T...
flexible
{ "blob_id": "7d6196268b85861e76efaa53e14976f2eae09405", "index": 3226, "step-1": "<mask token>\n", "step-2": "<mask token>\ndf.to_csv('Tweets.csv', index=None, header=None)\n", "step-3": "<mask token>\ndf1 = pd.read_csv('Tweets1.csv', names=['tweet'])\ndf2 = pd.read_csv('Tweets2.csv', names=['tweet'])\ndf3 =...
[ 0, 1, 2, 3 ]
# Generated by Django 3.2.3 on 2021-07-02 08:18 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('khovan', '0003_nhapkho'), ] operations = [ migrations.AddField( model_name='phieunhaphang', ...
normal
{ "blob_id": "016255d74ccf4ac547e4b212d33bb9a39295c830", "index": 2715, "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 = [('khovan', '0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.bar(pos, df['Mersenne Twister'], width, alpha=0.5, color='#EE3224') plt.bar([(p + width) for p in pos], df['Xorshift 128+'], width, alpha=0.5, color='#F78F1E') plt.bar([(p + width * 2) for p in pos], df['SPCG64'], width, c...
flexible
{ "blob_id": "467b919f6953737eedd3f99596df244bd1177575", "index": 5411, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.bar(pos, df['Mersenne Twister'], width, alpha=0.5, color='#EE3224')\nplt.bar([(p + width) for p in pos], df['Xorshift 128+'], width, alpha=0.5,\n color='#F78F1E')\nplt.bar([(p + wi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Line(MapBase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __repr__(self): return ("<Line(id='{}', len='{}', p0=...
flexible
{ "blob_id": "6b3cb7a42c8bc665e35206b135f6aefea3439758", "index": 7381, "step-1": "<mask token>\n\n\nclass Line(MapBase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __repr__(self):\n return (\"<Line(id='{}', len='{}', p0='{}', p1='...
[ 14, 16, 17, 18, 21 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> parser.add_argument('--batch_size', help='batch_size', required=False, default=32) parser.add_argument('--data_size', help='data_size', required=False, default=1700) parser.add_argument('--num_intra_threads', help='num_int...
flexible
{ "blob_id": "2e8d39d6d72672de8e4eac8295b90d68b1dff938", "index": 9007, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('--batch_size', help='batch_size', required=False,\n default=32)\nparser.add_argument('--data_size', help='data_size', required=False,\n default=1700)\nparser.ad...
[ 0, 1, 2, 3, 4 ]