code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
# Parsing the raw.csv generated by running lis2dh_cluster.py g = 9.806 def twos_complement(lsb, msb): signBit = (msb & 0b10000000) >> 7 msb &= 0x7F # Strip off sign bit if signBit: x = (msb << 8) + lsb x ^= 0x7FFF x = -1 - x else: x = (msb << 8) + lsb x = x>>6 # Remove left justification of...
normal
{ "blob_id": "a1b579494d20e8b8a26f7636ebd444252d2aa250", "index": 4824, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef twos_complement(lsb, msb):\n signBit = (msb & 128) >> 7\n msb &= 127\n if signBit:\n x = (msb << 8) + lsb\n x ^= 32767\n x = -1 - x\n else:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def upgrade(): op.drop_constraint('component_files_component_id_fkey', 'component_files') op.drop_constraint('components_topic_id_fkey', 'components') op.drop_constraint('files_job_id_fkey', 'files') op.drop_constraint('files_jobstate_id_fkey', 'files') op.drop_constra...
flexible
{ "blob_id": "a34584a71fdff65e5b1bb15a6304af79774dac2c", "index": 1315, "step-1": "<mask token>\n\n\ndef upgrade():\n op.drop_constraint('component_files_component_id_fkey', 'component_files')\n op.drop_constraint('components_topic_id_fkey', 'components')\n op.drop_constraint('files_job_id_fkey', 'files'...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> reload(plib) reload(rdl) <|reserved_special_token_0|> plt.rcParams.update(params) <|reserved_special_token_0|> if not os.path.exists(outpath): os.mkdir(outpath) plt.close('all') <|reserved_special_token_0|> if config['plot_par...
flexible
{ "blob_id": "c5bbfa1a86dbbd431566205ff7d7b941bdceff58", "index": 1233, "step-1": "<mask token>\n", "step-2": "<mask token>\nreload(plib)\nreload(rdl)\n<mask token>\nplt.rcParams.update(params)\n<mask token>\nif not os.path.exists(outpath):\n os.mkdir(outpath)\nplt.close('all')\n<mask token>\nif config['plot...
[ 0, 1, 2, 3, 4 ]
import web import datetime # run with sudo to run on port 80 and use GPIO urls = ('/', 'index', '/survey', 'survey') render = web.template.render('templates/') class survey: def GET(self): return render.survey() class index: def GET(self): i = web.input(enter=None) ...
normal
{ "blob_id": "07a0ba3ded8a2d4a980cfb8e3dbd6fd491ea24b0", "index": 1842, "step-1": "<mask token>\n\n\nclass survey:\n <mask token>\n\n\nclass index:\n\n def GET(self):\n i = web.input(enter=None)\n date = datetime.datetime.now().ctime()\n hour = datetime.datetime.now().hour\n retu...
[ 3, 4, 5, 7, 8 ]
/Applications/anaconda2/lib/python2.7/warnings.py
normal
{ "blob_id": "cd2062055e30fc37a5f00f4bce6ffd9ea5eda860", "index": 4134, "step-1": "/Applications/anaconda2/lib/python2.7/warnings.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_preprocessor(): """ """ nb = nbformat.v4.new_notebook() nb.cells.append(nbformat.v4.new_code_cell(dedent( """ a = True b = False f = lambda x: not x g = f(a) + f(b...
flexible
{ "blob_id": "d9f08e770dacaa86a03d553afd78fdcd725efb62", "index": 5204, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_preprocessor():\n \"\"\"\n \"\"\"\n nb = nbformat.v4.new_notebook()\n nb.cells.append(nbformat.v4.new_code_cell(dedent(\n \"\"\" a = True\n b...
[ 0, 1, 2, 3 ]
import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy import stats import datetime #takes in a sorted data frame holding the actuals, the predicted values (sorted descending) and the percentile of each obsevation #and returns a new dataframe with all of the appropriate calculations ...
normal
{ "blob_id": "8e71ea23d04199e8fb54099c404c5a4e9af6c4b1", "index": 9336, "step-1": "<mask token>\n\n\ndef lift_calculations(df):\n df['sample_num'] = range(len(df))\n df['actual_sum'] = df['actual'].cumsum()\n df['per_sample_covered'] = (df['sample_num'] + 1) * 100 / len(df)\n df['per_pos_captured'] = ...
[ 5, 7, 8, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(nodes): r, g, b = colorsys.hsv_to_rgb(float(i) / nodes, 1.0, 1.0) R, G, B = int(255 * r), int(255 * g), int(255 * b) color = [R, G, B] print(color) img[markers == i + 2] = list(color) <|reserved_...
flexible
{ "blob_id": "39dda191ab2137b5f5538660f17e39b0a1358bf4", "index": 206, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(nodes):\n r, g, b = colorsys.hsv_to_rgb(float(i) / nodes, 1.0, 1.0)\n R, G, B = int(255 * r), int(255 * g), int(255 * b)\n color = [R, G, B]\n print(color)\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ReinforcementLearner: def __init__(self, clf=None, load=False, clfName=None): """ Initialise the Classifier, either from the provided model or from the stored classifier :param clf: The current classifier, not yet fitted to the data :param load:...
flexible
{ "blob_id": "c9be3d25824093528e2bee51c045d05e036daa67", "index": 9715, "step-1": "<mask token>\n\n\nclass ReinforcementLearner:\n\n def __init__(self, clf=None, load=False, clfName=None):\n \"\"\"\n Initialise the Classifier, either from the provided model or from the stored classifier\n\n ...
[ 3, 4, 5, 6, 8 ]
<|reserved_special_token_0|> def calcularHipotenusa(catA, catB): hipotenusa = catA ** 2 + catB ** 2 hipotenusa = math.sqrt(hipotenusa) hipotenusa = float(hipotenusa) print('la hipotenusa es: ', hipotenusa) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> prin...
flexible
{ "blob_id": "af217d0cc111f425282ee21bd47d9007a69a6239", "index": 6297, "step-1": "<mask token>\n\n\ndef calcularHipotenusa(catA, catB):\n hipotenusa = catA ** 2 + catB ** 2\n hipotenusa = math.sqrt(hipotenusa)\n hipotenusa = float(hipotenusa)\n print('la hipotenusa es: ', hipotenusa)\n\n\n<mask token...
[ 1, 2, 3, 4, 5 ]
import proactive import unittest import numbers import os import pytest class RestApiTestSuite(unittest.TestCase): """Advanced test cases.""" gateway = None username = "" password = "" @pytest.fixture(autouse=True) def setup_gateway(self, metadata): self.gateway = proactive.ProActive...
normal
{ "blob_id": "da2c615b8fab8de6bd63864508da254a46e65bb8", "index": 4543, "step-1": "<mask token>\n\n\nclass RestApiTestSuite(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @pytest.fixture(autouse=True)\n def setup_gateway(self, metadata):\n self.gateway...
[ 4, 7, 8, 9, 10 ]
<|reserved_special_token_0|> class TailwindTraders: def __init__(self, req): self._settings = Settings() self._cs = CognitiveServices() self._storage = BlobStorageService(self._settings. get_storage_connection_string()) self._reqbody = req.get_json() <|reserved_spe...
flexible
{ "blob_id": "75ba2448897bed8388a7b8d876827461e1bc9dd7", "index": 2809, "step-1": "<mask token>\n\n\nclass TailwindTraders:\n\n def __init__(self, req):\n self._settings = Settings()\n self._cs = CognitiveServices()\n self._storage = BlobStorageService(self._settings.\n get_stor...
[ 5, 6, 7, 8, 9 ]
#!/usr/bin/env python import sys import requests import numpy as np import astropy.table as at if __name__=='__main__': targets = at.Table.read('targets_LCO2018A_002.txt', format='ascii') headers={'Authorization': 'Token {}'.format(sys.argv[1])} for x in targets['targetname']: obs = requests.get('h...
normal
{ "blob_id": "705bc651e7d12769bcf5994168fe6685a6bae05d", "index": 5983, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n targets = at.Table.read('targets_LCO2018A_002.txt', format='ascii')\n headers = {'Authorization': 'Token {}'.format(sys.argv[1])}\n for x in targets[...
[ 0, 1, 2, 3 ]
__title__ = 'FUCKTHEINTRUDERS' __description__ = 'Checking for Intruders in my locality' __version__ = '0.0.1' __author__ = 'Shivam Jalotra' __email__ = 'shivam_11710495@nitkkr.ac.in' __license__ = 'MIT 1.0'
normal
{ "blob_id": "ba94a69ac356969ab593afc922a2517f4713771f", "index": 5536, "step-1": "<mask token>\n", "step-2": "__title__ = 'FUCKTHEINTRUDERS'\n__description__ = 'Checking for Intruders in my locality'\n__version__ = '0.0.1'\n__author__ = 'Shivam Jalotra'\n__email__ = 'shivam_11710495@nitkkr.ac.in'\n__license__ ...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(x[8]) <|reserved_special_token_0|> print(x[14:17]) <|reserved_special_token_0|> print(greet.upper()) print(len('banana') * 7) <|reserved_special_token_0|> print(data[pos:pos + 3]) <|reserved_special_token_0|> print(stuff.get...
flexible
{ "blob_id": "e26f673dfae38148a56927ce82d5ea7ea2545e12", "index": 8540, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(x[8])\n<mask token>\nprint(x[14:17])\n<mask token>\nprint(greet.upper())\nprint(len('banana') * 7)\n<mask token>\nprint(data[pos:pos + 3])\n<mask token>\nprint(stuff.get('candy', -1...
[ 0, 1, 2, 3 ]
# Copyright 2018 The Cornac Authors. 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 ...
normal
{ "blob_id": "d414e4497bae23e4273526c0bbdecd23ed665cac", "index": 4857, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef sample_items(num_items, shape, random_state=None):\n \"\"\"\n Randomly sample a number of items.\n\n Parameters\n ----------\n\n num_items: int\n Total numbe...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in in_file: data = line.strip().split(': ') eng_word = data[0] kor_word = data[1] voca_dic[eng_word] = kor_word while True: keys = list(voca_dic.keys()) index = randint(1, len(keys) - 1) input_...
flexible
{ "blob_id": "be64c981e7ea70dfcbd840988a633b4a71a43783", "index": 9814, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in in_file:\n data = line.strip().split(': ')\n eng_word = data[0]\n kor_word = data[1]\n voca_dic[eng_word] = kor_word\nwhile True:\n keys = list(voca_dic.keys())...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class SurveyFeedback(forms.Form): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class SurveyFeedback(forms.Form)...
flexible
{ "blob_id": "a9b7abaaaa811cf12a15def1f2dd21f95bac3d62", "index": 6310, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass SurveyFeedback(forms.Form):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass SurveyFeedback(forms.Form):\n CHOICES = [('Very Sat...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @pytest.fixture(scope='module') def module_scope_prefix(request, session_scope_prefix): """ Generate a name prefix to be shared by objects created during this pytest module Relies on pytest's builtin fixture "request" https://docs.pytest.org/en/6.2.x/reference.html#std-fix...
flexible
{ "blob_id": "eb1737ac671129ed3459ce4feacb81d414eef371", "index": 5667, "step-1": "<mask token>\n\n\n@pytest.fixture(scope='module')\ndef module_scope_prefix(request, session_scope_prefix):\n \"\"\"\n Generate a name prefix to be shared by objects created during this pytest module\n Relies on pytest's bu...
[ 17, 20, 21, 23, 45 ]
<|reserved_special_token_0|> class PersonView(TemplateView): def get(self, request): persons = Person.objects.all() context = {'persons': persons} return render(request, 'budget/person.html', context) class AddView(TemplateView): template = 'budget/add.html' def get(self, reque...
flexible
{ "blob_id": "2d65ffa3fc8a5360702337d749884903b2cb0423", "index": 2353, "step-1": "<mask token>\n\n\nclass PersonView(TemplateView):\n\n def get(self, request):\n persons = Person.objects.all()\n context = {'persons': persons}\n return render(request, 'budget/person.html', context)\n\n\ncl...
[ 10, 11, 13, 14, 16 ]
PROJECT_ID = "aaet-geoscience-dev" # The tmp folder is for lasio I/O purposes DATA_PATH = "/home/airflow/gcs/data/tmp" # Credential JSON key for accessing other projects # CREDENTIALS_JSON = "gs://aaet_zexuan/flow/keys/composer_las_merge.json" CREDENTIALS_JSON = "keys/composer_las_merge.json" # Bucket name fo...
normal
{ "blob_id": "0b2a036b806cca6e7f58008040b3a261a8bc844d", "index": 4092, "step-1": "<mask token>\n", "step-2": "PROJECT_ID = 'aaet-geoscience-dev'\nDATA_PATH = '/home/airflow/gcs/data/tmp'\nCREDENTIALS_JSON = 'keys/composer_las_merge.json'\nBUCKET_LAS_MERGE = 'las_merged'\nBUCKET_LAS_SPLICE = 'us-central1-lithos...
[ 0, 1, 2 ]
import numpy as np from sklearn import model_selection from iterstrat.ml_stratifiers import MultilabelStratifiedKFold """ - binary cross-validate - multi-class cross-validate - multi-label cross-validate - holdout - regression """ class CrossValidate(object): def __init__(self, df, target_cols...
normal
{ "blob_id": "0dad1937df39c012f7991c3897f27964bed1d5a0", "index": 1533, "step-1": "<mask token>\n\n\nclass CrossValidate(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass CrossValidate(object):\n\n def __init__(self, df, target_cols, problem_type, num_folds=3, shuffle=\n ...
[ 1, 2, 3, 4, 5 ]
import pandas as pd # read the data df = pd.read_csv("data/lottery.csv") # extract needed column df1 = df[['1','2','3','4','5','6','bonus']] # translate dataframe to list for convenience df2 = df1.values.tolist() # cnt_number is each number's apearance times cnt_number = [] for i in range(0, 46): cnt_number.app...
normal
{ "blob_id": "b257e36b3cb4bda28cf18e192aa95598105f5ae9", "index": 2705, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, 46):\n cnt_number.append(0)\nfor i in range(0, len(df2)):\n for j in range(0, 7):\n cnt_index = df2[i][j]\n cnt_number[int(cnt_index)] += 1\nfor k in...
[ 0, 1, 2, 3, 4 ]
'''a,b = input().split() a, b = [int(a),int(b)] List = set() ArrayA = list(map(int, input().split())) temp = 1 ArrayB = list(map(int, input().split())) for i in range(max(ArrayA), min(ArrayB)+1): for j in ArrayA: if i%j is 1: temp += 1 if temp is len(ArrayA): List.add(i) temp=1 ...
normal
{ "blob_id": "73d02615863826d77d65fbf0314dc71acb97ef28", "index": 4035, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(numberOfObs):\n obs = input().split()\n obstacle.append((int(obs[0]), int(obs[1])))\n<mask token>\nwhile 1 <= q <= board and 1 <= r <= board:\n if (q, r) in obstac...
[ 0, 1, 2, 3, 4 ]
from setuptools import Command class decl_cmd1(Command): user_options = [] def initialize_options(self): pass def finalize_options(self): pass def run(self): pass class decl_cmd2(Command): user_options = [] def initialize_options(self): pass def final...
normal
{ "blob_id": "70b8efa844395592131382d1d1e2c39150804f99", "index": 4111, "step-1": "<mask token>\n\n\nclass decl_cmd1(Command):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass decl_cmd2(Command):\n user_options = []\n\n def initialize_options(self):\n pass\n\n def...
[ 6, 8, 9, 10, 11 ]
from django.contrib import admin from employees.models import Leave,EmployeeProfile admin.site.register(Leave) admin.site.register(EmployeeProfile) # Register your models here.
normal
{ "blob_id": "77ea670b537e9ff7082aeb9ed54b011fa8e3a035", "index": 6328, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Leave)\nadmin.site.register(EmployeeProfile)\n", "step-3": "from django.contrib import admin\nfrom employees.models import Leave, EmployeeProfile\nadmin.site.registe...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Matching: <|reserved_special_token_0|> <|reserved_special_token_0|> @staticmethod def process_order(self, order: Order): if order.status == Order.STATUS_WAITING_NEW: order.status = Order.STATUS_NEW order.save() if order.pr...
flexible
{ "blob_id": "866ee2c4fa52bf9bda4730c7a9d46bb4798adcd4", "index": 1775, "step-1": "<mask token>\n\n\nclass Matching:\n <mask token>\n <mask token>\n\n @staticmethod\n def process_order(self, order: Order):\n if order.status == Order.STATUS_WAITING_NEW:\n order.status = Order.STATUS_N...
[ 7, 8, 9, 11, 12 ]
s = 'ejp mysljylc kd kxveddknmc re jsicpdrysirbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcdde kr kd eoya kw aej tysr re ujdr lkgc jv' sa = 'our language is impossible to understandthere are twenty six factorial possibilitiesso it is okay if you want to just give up' ans = {} for i in range(len(s)): ans[s[i]] = sa[i]; ...
normal
{ "blob_id": "77b9b111cfb4d0b54e14b2aab81b7b05fd6bbccd", "index": 8552, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(len(s)):\n ans[s[i]] = sa[i]\n<mask token>\nfor k in ans:\n S.add(k)\n<mask token>\nfor i in range(1, len(L)):\n s = L[i]\n S = ''\n for j in range(len(s)):\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(pay) <|reserved_special_token_0|> print(odds) print(type(name), type(age), type(weight), type(kill_streak)) <|reserved_special_token_0|> print(mean) <|reserved_special_token_0|> print(tens) <|reserved_special_token_0|> print...
flexible
{ "blob_id": "af2ef3c77cefe675f3d30c3234401f0f9bda3505", "index": 8916, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(pay)\n<mask token>\nprint(odds)\nprint(type(name), type(age), type(weight), type(kill_streak))\n<mask token>\nprint(mean)\n<mask token>\nprint(tens)\n<mask token>\nprint(average_age...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> p.add_argument('--foo', action='store_true') <|reserved_special_token_0|> print(args.foo) <|reserved_special_token_1|> <|reserved_special_token_0|> p = argparse.ArgumentParser() p.add_argument('--foo', action='store_true') args...
flexible
{ "blob_id": "2cc9f8c476026311456857d3395a14a45e2f4b80", "index": 1460, "step-1": "<mask token>\n", "step-2": "<mask token>\np.add_argument('--foo', action='store_true')\n<mask token>\nprint(args.foo)\n", "step-3": "<mask token>\np = argparse.ArgumentParser()\np.add_argument('--foo', action='store_true')\narg...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> from .book import book from . import style, to, read, dist <|reserved_special_token_1|> """ .. currentmodule:: jotting .. automodule:: jotting.book :members: .. automodule:: jotting.to :members: .. automodule:: jotti...
flexible
{ "blob_id": "ce6dba2f682b091249f3bbf362bead4b95fee1f4", "index": 292, "step-1": "<mask token>\n", "step-2": "<mask token>\nfrom .book import book\nfrom . import style, to, read, dist\n", "step-3": "\"\"\"\n.. currentmodule:: jotting\n\n.. automodule:: jotting.book\n :members:\n\n.. automodule:: jotting.to...
[ 0, 1, 2 ]
from django.contrib import admin from django_summernote.admin import SummernoteModelAdmin from .models import ArticlePost # Register your models here. class SomeModelAdmin(SummernoteModelAdmin): # instead of ModelAdmin summernote_fields = '__all__' admin.site.register(ArticlePost, SummernoteModelAdmin)
normal
{ "blob_id": "a86b64ccd0dab4ab70ca9c2b7625fb34afec3794", "index": 63, "step-1": "<mask token>\n\n\nclass SomeModelAdmin(SummernoteModelAdmin):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass SomeModelAdmin(SummernoteModelAdmin):\n summernote_fields = '__all__'\n\n\n<mask token>\n",...
[ 1, 2, 3, 4, 5 ]
import json import joblib import numpy as np import datetime import sqlalchemy as sa import cx_Oracle import pandas as pd from flask import Flask, render_template, session, request, redirect, url_for app = Flask(__name__) oracle_engine = sa.create_engine('oracle://ft:1234@localhost:1522/xe') @app.route("/") def inde...
normal
{ "blob_id": "74aa93bf3731d4e3ddb920bedc7daced50b4f2c3", "index": 1565, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n return render_template('index.html')\n\n\n@app.route('/survey', methods=['POST', 'GET'])\ndef survey():\n if request.method == 'GET':\n return render_template('survey.h...
[ 2, 4, 5, 6, 7 ]
# Copyright 2013 Rackspace Hosting Inc. # 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 applic...
normal
{ "blob_id": "cf931da4c06e16fe6f6da5eb1826d8b7a59c1f7b", "index": 9057, "step-1": "<mask token>\n\n\nclass TestQuarkUpdateIpPolicies(test_quark_plugin.TestQuarkPlugin):\n\n @contextlib.contextmanager\n def _stubs(self, ip_policy, subnets=None, networks=None):\n if not subnets:\n subnets = ...
[ 37, 43, 48, 57, 67 ]
<|reserved_special_token_0|> class Department(SQLAlchemyObjectType): class Meta: model = DepartmentModel interfaces = relay.Node, class Query(graphene.ObjectType): node = relay.Node.Field() all_employees = SQLAlchemyConnectionField(Department) <|reserved_special_token_0|> <|reserve...
flexible
{ "blob_id": "2f76bcfde11597f87bb9e058f7617e95c78ed383", "index": 7950, "step-1": "<mask token>\n\n\nclass Department(SQLAlchemyObjectType):\n\n\n class Meta:\n model = DepartmentModel\n interfaces = relay.Node,\n\n\nclass Query(graphene.ObjectType):\n node = relay.Node.Field()\n all_employ...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- """ Created on Fri Nov 15 10:39:55 2019 @author: PC """ import pandas as pd dictionary={"Name":["Ali","Buse","Selma","Hakan","Bülent","Yağmur","Ahmet"], "Age":[18,45,12,36,40,18,63], "Maas":[100,200,400,500,740,963,123]} dataFrame1=pd.DataFrame(dictionary) ...
normal
{ "blob_id": "efa94f8442c9f43234d56a781d2412c9f7ab1bb3", "index": 7910, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(dataFrame1.columns)\nprint(dataFrame1.info())\nprint(dataFrame1.dtypes)\nprint(dataFrame1.describe())\n", "step-3": "<mask token>\ndictionary = {'Name': ['Ali', 'Buse', 'Selma', '...
[ 0, 1, 2, 3, 4 ]
import json import os import sys """ Course: cmps 4883 Assignemt: A03 Date: 2/10/19 Github username: acdczlc Repo url: https://github.com/acdczlc/4883-SWTools-Conley Name: Zac Conley Description: Calculates all stats for questions about stats """ ############################################################## # Mos...
normal
{ "blob_id": "2a4f57cd0fc1c50cba06c285849432c6f71f28e2", "index": 2642, "step-1": "<mask token>\n\n\ndef MostTeams(OffAndDef):\n most = []\n count = 0\n for playerid, playerdata in OffAndDef.items():\n if playerdata['name'] != '':\n if len(playerdata['Teams']) > count:\n ...
[ 8, 9, 10, 15, 17 ]
#Nianzu Wang #Email: wangn89@gmail.com #for_while.py: demonstrates some fun things with for and while loops def starsFor(x): array = range(x, 0, -1) array2 = range(1, x) for num in array2: print "*" * num for num in array: print "*" * num def starsWhile(n): a = 1 while a < n: ...
normal
{ "blob_id": "7e287eca041cf27d99292a331604fef9e9f90fc2", "index": 7268, "step-1": "#Nianzu Wang\n#Email: wangn89@gmail.com\n\n#for_while.py: demonstrates some fun things with for and while loops\n\ndef starsFor(x):\n array = range(x, 0, -1)\n array2 = range(1, x)\n for num in array2:\n print \"*\"...
[ 0 ]
from django.db import models from albums.models import Albums class Song(models.Model): name = models.CharField(max_length=255) filename = models.FileField(upload_to='canciones/') album = models.ForeignKey(Albums) def __unicode__(self,): return self.name
normal
{ "blob_id": "8ec18e259af1123fad7563aee3a363e095e30e8e", "index": 1064, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Song(models.Model):\n <mask token>\n <mask token>\n <mask token>\n\n def __unicode__(self):\n return self.name\n", "step-3": "<mask token>\n\n\nclass Song(m...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class HookView(APIView): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class HookView(APIView): def post(self, request, *args, **kwargs): SCRIPT_PATH = os.path.join(...
flexible
{ "blob_id": "6f5bca8c1afcd9d9971a64300a576ca2b2f6ef70", "index": 1694, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass HookView(APIView):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass HookView(APIView):\n\n def post(self, request, *args, **kwargs):\n SCRIPT_PATH = os.path....
[ 0, 1, 2, 3, 4 ]
import torch import torch.nn as nn import numpy as np class EuclideanLoss(nn.Module): def __init__(self, c_p, c_h): super().__init__() self.c_p = c_p self.c_h = c_h def forward(self, y, d): ''' y: prediction, size = (n_product, n_obs) d: actual sales, size = ...
normal
{ "blob_id": "67be25e8fdf004515e18e1c20b8d0238222a2172", "index": 1401, "step-1": "<mask token>\n\n\nclass EuclideanLoss(nn.Module):\n <mask token>\n <mask token>\n\n\nclass CostFunction(nn.Module):\n\n def __init__(self, c_p, c_h):\n super().__init__()\n self.c_p = c_p\n self.c_h = ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for index in range(test_set.shape[0]): print(index) <|reserved_special_token_1|> #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 24 22:05:12 2019 @author: admin """ for index in range(test_set.shape[...
flexible
{ "blob_id": "35647ed5e2c128a5bf819a1e47ead7e958172b1c", "index": 9711, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor index in range(test_set.shape[0]):\n print(index)\n", "step-3": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed Apr 24 22:05:12 2019\n\n@author: admin\n\...
[ 0, 1, 2 ]
#!/bin/env python3 """ https://www.hackerrank.com/challenges/triangle-quest-2 INPUT: integer N where 0 < N < 10 OUTPUT: print palindromic triangle of size N e.g.for N=5 1 121 12321 1234321 123454321 """ for i in range(1, int(input()) + 1): j = 1 while j < i: print(j,end='') j += 1 w...
normal
{ "blob_id": "94cbd9554e3326897147dc417d9fc8f91974786a", "index": 5098, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, int(input()) + 1):\n j = 1\n while j < i:\n print(j, end='')\n j += 1\n while i > 0:\n print(i, end='')\n i -= 1\n print()\n", ...
[ 0, 1, 2 ]
import dash_html_components as html import dash_core_components as dcc layout = html.Div([ html.Div([ html.Div([ html.H6('Répartition des biens'), dcc.Graph( id = "pieGraph", figure = { "data": [{ "values"...
normal
{ "blob_id": "83c3193ea40c9328d16fb91774762a76352d8e09", "index": 8417, "step-1": "<mask token>\n", "step-2": "<mask token>\nlayout = html.Div([html.Div([html.Div([html.H6('Répartition des biens'),\n dcc.Graph(id='pieGraph', figure={'data': [{'values': [2878001, 2342181,\n 1773296, 521395], 'labels': ['Ma...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2017--2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You may not # use this file except in compliance with the License. A copy of the License # is located at # # http://aws....
normal
{ "blob_id": "8adcd75e925fe0c5a50b2fc7dc8c472a9610b4f2", "index": 9575, "step-1": "<mask token>\n\n\ndef smart_open(file, mode='rt', encoding='utf-8'):\n \"\"\"Convenience function for reading compressed or plain text files.\n :param file: The file to read.\n :param mode: The file mode (read, write).\n ...
[ 27, 29, 31, 37, 42 ]
class Solution(object): def lexicalOrder(self, n): """ :type n: int :rtype: List[int] """ acc = [] self.backtrack(acc, 1, n) return acc def backtrack(self, acc, counter, n): if counter > n: return elif len(acc) == n: ...
normal
{ "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 ]
#roblem: Have the function PrimeTime(num) # take the num parameter being passed and return # the string true if the parameter is a prime number, \ # otherwise return the string false. # The range will be between 1 and 2^16. def PrimeTime(num): prime1 = (num-1)%6 prime2 = (num+1)%6 if prime1 * prime2 =...
normal
{ "blob_id": "5068a78a1aa31a277b3b5854ddd1d8990d07b104", "index": 3627, "step-1": "<mask token>\n", "step-2": "def PrimeTime(num):\n prime1 = (num - 1) % 6\n prime2 = (num + 1) % 6\n if prime1 * prime2 == 0:\n return 'True'\n else:\n return 'False'\n\n\n<mask token>\n", "step-3": "de...
[ 0, 1, 2, 3 ]
import datetime class assignmentObject: def __init__(self, name, day): self.name = name self.day = day
normal
{ "blob_id": "1673214215043644e1a878ed7c30b69064f1a022", "index": 5375, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass assignmentObject:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass assignmentObject:\n\n def __init__(self, name, day):\n self.name = name\n self.day ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def TheRabbitsFoot(s, encode): if encode: return encode_s(s) return decode_s(s) <|reserved_special_token_1|> <|reserved_special_token_0|> def decode_s(s): arr = s.split(' ') decoded_s = '' for j in range(0, len(arr[0])): for word in arr: ...
flexible
{ "blob_id": "a3ed47c285b26dca452fa192eb354a21a78b8424", "index": 4632, "step-1": "<mask token>\n\n\ndef TheRabbitsFoot(s, encode):\n if encode:\n return encode_s(s)\n return decode_s(s)\n", "step-2": "<mask token>\n\n\ndef decode_s(s):\n arr = s.split(' ')\n decoded_s = ''\n for j in rang...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class StageOneCustomize: <|reserved_special_token_0|> def __init__(self, process, customize, metaConditions): self.process = process self.customize = customize self.metaConditions = metaConditions self.modifyForttH = True self.tagList = [['...
flexible
{ "blob_id": "ce12ede15f4ca4a085e38e455515d8a028da8fd2", "index": 2115, "step-1": "<mask token>\n\n\nclass StageOneCustomize:\n <mask token>\n\n def __init__(self, process, customize, metaConditions):\n self.process = process\n self.customize = customize\n self.metaConditions = metaCond...
[ 6, 7, 8, 9, 10 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division, print_function, absolute_import, unicode_literals import os from qtpy.QtCore import * # from qtpy.QtGui import * from qtpy.QtWidgets import * from six import string_types from ..widgets import PathParamWidget, RelPathParamWidget, FilePath...
normal
{ "blob_id": "ee91e8c9dcb940882733b2d23b74a76d0392f4fe", "index": 2126, "step-1": "<mask token>\n\n\nclass TypeDirPath(TypeBase):\n\n @classmethod\n def control(cls, delegate, property_item, parent):\n return PathParamWidget(delegate, parent=parent)\n <mask token>\n\n @classmethod\n def valu...
[ 21, 41, 43, 45, 61 ]
# # -*- coding: utf-8 -*- # # """ # Py40 PyQt5 tutorial # # This example shows three labels on a window # using absolute positioning. # # author: Jan Bodnar # website: py40.com # last edited: January 2015 # """ # # import sys # from PyQt5.QtWidgets import QWidget, QLabel, QApplication # # # class Example(QWidget): # # ...
normal
{ "blob_id": "e05dac901228e6972c1cb48ce2def3d248b4c167", "index": 3053, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef absent(lectureid, sectionid):\n connection = psycopg2.connect(database='profmate', user='python',\n password='python', host='34.74.217.167', port='5432')\n cursor = c...
[ 0, 1, 2, 3, 4 ]
from flask import Flask, request, render_template, redirect from pymongo import MongoClient from envparse import env from flask_httpauth import HTTPDigestAuth import os.path # Get env vars stored either in an env file or on the machine def get_env(name): if (os.path.exists('./env')): env.read_envfile('./env') ret...
normal
{ "blob_id": "ad813216ba8162a7089340c677e47c3e656f7c95", "index": 6198, "step-1": "<mask token>\n\n\n@app.route('/')\ndef show_home():\n return render_template('index.html')\n\n\n@app.route('/addhost', methods=['GET', 'POST'])\ndef hosts():\n if request.method == 'POST':\n db = mongo_login()\n ...
[ 6, 7, 10, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Valor da conta com 10%: R$', a) <|reserved_special_token_1|> a = float.input('Valor da conta') print('Valor da conta com 10%: R$', a) <|reserved_special_token_1|> a=float.input('Valor da conta') print('Valor da conta ...
flexible
{ "blob_id": "d1ce6c081dce2e4bdb6087cd61d7f857dbb1348d", "index": 8781, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Valor da conta com 10%: R$', a)\n", "step-3": "a = float.input('Valor da conta')\nprint('Valor da conta com 10%: R$', a)\n", "step-4": "a=float.input('Valor da conta')\nprint('...
[ 0, 1, 2, 3 ]
class TimeInterval(object): def __init__(self, start_time, end_time): self.start_time = start_time self.end_time = end_time
normal
{ "blob_id": "9d772d5500593583907b65bc2c81490e61375e8b", "index": 8081, "step-1": "<mask token>\n", "step-2": "class TimeInterval(object):\n <mask token>\n", "step-3": "class TimeInterval(object):\n\n def __init__(self, start_time, end_time):\n self.start_time = start_time\n self.end_time ...
[ 0, 1, 2 ]
from os import chdir from os.path import dirname, realpath import random from flask import Flask, render_template, send_from_directory app = Flask(__name__) # gets list of list of all classes def get_data(): class_list = [] with open('counts.tsv') as fd: for line in fd.read().splitlines(): ...
normal
{ "blob_id": "af8a3fbce35685cd89dee72449a8be2a133b4a3f", "index": 4684, "step-1": "<mask token>\n\n\ndef get_data():\n class_list = []\n with open('counts.tsv') as fd:\n for line in fd.read().splitlines():\n class_data = line.split('\\t')\n class_list.append(class_data)\n ...
[ 17, 19, 24, 26, 27 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for gen in range(params['gens']): parents = select(population, params['n_pars']) offspring = reproduce(params, parents, crossover) offspring = mutate(params, offspring) offspring = evaluate(params, offspring) p...
flexible
{ "blob_id": "5eab41a2ef536365bab6f6b5ad97efb8d26d7687", "index": 4456, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor gen in range(params['gens']):\n parents = select(population, params['n_pars'])\n offspring = reproduce(params, parents, crossover)\n offspring = mutate(params, offspring)\n ...
[ 0, 1, 2, 3 ]
#import fungsi_saya as fs # from fungsi_saya import kalkulator as k # hasil = k(10,5,'+') # print(hasil) from kelas import Siswa siswa_1 = Siswa('Afif', "A.I.", 17, 'XII IPA') siswa_2 = Siswa('Bayu', 'Sudrajat', 20, 'XII IPS') siswa_3 = Siswa('Bayu', 'Sudrajat', 20, 'XII IPS') siswa_4 = Siswa('Bayu', 'Sudrajat', 20,...
normal
{ "blob_id": "bd2c327915c1e133a6e7b7a46290369440d50347", "index": 3876, "step-1": "<mask token>\n", "step-2": "<mask token>\nsiswa_1 = Siswa('Afif', 'A.I.', 17, 'XII IPA')\nsiswa_2 = Siswa('Bayu', 'Sudrajat', 20, 'XII IPS')\nsiswa_3 = Siswa('Bayu', 'Sudrajat', 20, 'XII IPS')\nsiswa_4 = Siswa('Bayu', 'Sudrajat',...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> MusicDir = 'AudioFiles\\' ModelsDir = 'Models\\' MonstersDir = 'Models\\Monsters\\' <|reserved_special_token_1|> # Sets up directories MusicDir = "AudioFiles\\" ModelsDir = "Models\\" MonstersDir = "Models\\Monsters\\"
flexible
{ "blob_id": "a929bfbe2be6d8f93cafa5b6cc66c7506037ffca", "index": 4735, "step-1": "<mask token>\n", "step-2": "MusicDir = 'AudioFiles\\\\'\nModelsDir = 'Models\\\\'\nMonstersDir = 'Models\\\\Monsters\\\\'\n", "step-3": "# Sets up directories\nMusicDir = \"AudioFiles\\\\\"\nModelsDir = \"Models\\\\\"\nMonsters...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @borg.on(admin_cmd(pattern='stupid$')) async def _(event): if event.fwd_from: return animation_interval = 1 animation_ttl = range(0, 14) await event.edit('brain') animation_chars = [ 'YOᑌᖇ...
flexible
{ "blob_id": "51cff2f7dd1fd10c6f447d62db3e98075caebe51", "index": 1708, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@borg.on(admin_cmd(pattern='stupid$'))\nasync def _(event):\n if event.fwd_from:\n return\n animation_interval = 1\n animation_ttl = range(0, 14)\n await event.edit...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('rap.sweeps.data_management level init') <|reserved_special_token_1|> print("rap.sweeps.data_management level init")
flexible
{ "blob_id": "7d138a0ad7e4d8f7047dd73ae503bdc7ae5aa065", "index": 9801, "step-1": "<mask token>\n", "step-2": "print('rap.sweeps.data_management level init')\n", "step-3": "print(\"rap.sweeps.data_management level init\")", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
#!/usr/bin/env python # # Copyright (C) 2016 The Android Open Source Project # # 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 req...
normal
{ "blob_id": "2ea335dd8d879731aad7713499440db6d1f60d36", "index": 2427, "step-1": "<mask token>\n\n\nclass ArchiveParserTest(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n\n def testReadFile(self):\n \"\"\"Tests that file is read correctly.\n\n Tests that correctly fo...
[ 2, 3, 6, 7, 8 ]
import sqlite3 import pandas as pd #%matplotlib inline import matplotlib.pyplot as plt db_filename = 'readonly/dinofunworld.db' conn = sqlite3.connect(db_filename) c = conn.cursor() c.execute("SELECT a.Name, count(c.visitorID) \ FROM attraction as a, checkin c \ WHERE \ a.AttractionID = c.attraction \ AND a.Category l...
normal
{ "blob_id": "c19c3f580d7555379bd7e077b0264a3784179e93", "index": 696, "step-1": "<mask token>\n", "step-2": "<mask token>\nc.execute(\n \"SELECT a.Name, count(c.visitorID) FROM attraction as a, checkin c WHERE a.AttractionID = c.attraction AND a.Category like 'Thrill Rides%' GROUP BY a.AttractionID \"\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> application = Application('./', ['local.ini', 'production.ini'], server= 'main', logging='prodlogging.ini') <|reserved_special_token_1|> from __future__ import unicode_literals from moya.wsgi import Application application ...
flexible
{ "blob_id": "cb0be932813a144cfb51b3aa2f6e0792e49c4945", "index": 3021, "step-1": "<mask token>\n", "step-2": "<mask token>\napplication = Application('./', ['local.ini', 'production.ini'], server=\n 'main', logging='prodlogging.ini')\n", "step-3": "from __future__ import unicode_literals\nfrom moya.wsgi i...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for word in arr: for a in word: if a not in alphabet: alphabet.append(a) <|reserved_special_token_0|> for a in alphabet: value = 0 for word in arr: if a not in word: continue ...
flexible
{ "blob_id": "6efc7ff304a05dfc5a7bed7d646e5d6ac034ce85", "index": 4706, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor word in arr:\n for a in word:\n if a not in alphabet:\n alphabet.append(a)\n<mask token>\nfor a in alphabet:\n value = 0\n for word in arr:\n if a no...
[ 0, 1, 2, 3, 4 ]
import requests import os import numpy as np from bs4 import BeautifulSoup from nltk import word_tokenize from collections import Counter import random from utils import save_pickle root = 'data' ratios = [('train', 0.85), ('valid', 0.05), ('test', 0.1)] max_len = 64 vocab_size = 16000 data = [] path = os.path.joi...
normal
{ "blob_id": "977841e0bb73cec879fbb1868f1e64102c6d8c1a", "index": 2119, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor topic in topics:\n i += 1\n arts = os.listdir(os.path.join(path, topic))\n j = 0\n for art in arts:\n j += 1\n with open(os.path.join(path, topic, art), enco...
[ 0, 1, 2, 3, 4 ]
class Solution: def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]: def convert(word): table = {} count, converted = 0, '' for w in word: if w in table: converted += table[w] else: ...
normal
{ "blob_id": "e9ea48dec40e75f2fc73f8dcb3b5b975065cf8af", "index": 5854, "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 findAndReplacePattern(self, words: List[str], pattern: str) ->List[str\n ]:\n\n def convert...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Nov 1 11:06:35 2020 @author: fitec """ # version 1 print(" Début du projet covid-19 !! ") print(" test repository distant")
normal
{ "blob_id": "3657d02271a27c150f4c67d67a2a25886b00c593", "index": 3306, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(' Début du projet covid-19 !! ')\nprint(' test repository distant')\n", "step-3": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun Nov 1 11:06:35 2020\n\n...
[ 0, 1, 2 ]
""" Tests for `yatsm.utils` """ import numpy as np import pytest from yatsm import utils @pytest.mark.parametrize('nrow,njob', [(793, 13), (700, 1), (700, 700)]) def test_distribute_jobs_interlaced(nrow, njob): assigned = [] for i in range(njob): assigned.extend(utils.distribute_jobs(i, njob, nrow, i...
normal
{ "blob_id": "a513dfd84b5d9267b7e96fedc88e5b6dabeea19e", "index": 640, "step-1": "<mask token>\n\n\n@pytest.mark.parametrize('nrow,njob', [(793, 13), (700, 1), (700, 700)])\ndef test_distribute_jobs_sequential(nrow, njob):\n assigned = []\n for i in range(njob):\n assigned.extend(utils.distribute_job...
[ 4, 6, 7, 8, 9 ]
# This is an auto-generated Django model module. # You'll have to do the following manually to clean this up: # * Rearrange models' order # * Make sure each model has one field with primary_key=True # * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior # * Remove `managed =...
normal
{ "blob_id": "5ce5fbfa33c241fc316d5e414df01a39bfc9be18", "index": 7063, "step-1": "<mask token>\n\n\nclass AnnouncedPuResults(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n managed = False\n...
[ 15, 17, 19, 21, 22 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': logger = Log() conf = Configuration('configuration/configuration.yaml' ).load_configuration() ph = ProductsHandler(conf['products_path']) logger.info('Configuration loaded') p...
flexible
{ "blob_id": "2e140d1174e0b2d8a97df880b1bffdf84dc0d236", "index": 1029, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n logger = Log()\n conf = Configuration('configuration/configuration.yaml'\n ).load_configuration()\n ph = ProductsHandler(conf['products_path']...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> workspace.obstacles.append(box) workspace.obstacles.append(segment) workspace.obstacles.append(circle) <|reserved_special_token_0|> viewer.draw_ws_img(signed_distance_field) viewer.draw_ws_obstacles() viewer.show_once() <|reserv...
flexible
{ "blob_id": "0d6177660a9b9c22bcf6eb11763e7fe1ee03b46a", "index": 3454, "step-1": "<mask token>\n", "step-2": "<mask token>\nworkspace.obstacles.append(box)\nworkspace.obstacles.append(segment)\nworkspace.obstacles.append(circle)\n<mask token>\nviewer.draw_ws_img(signed_distance_field)\nviewer.draw_ws_obstacles...
[ 0, 1, 2, 3, 4 ]
from django.urls import path from .consumers import NotificationsConsumer websocket_urlpatterns = [ path('ws/notifications', NotificationsConsumer), ]
normal
{ "blob_id": "31e5b249516f4e9d57d8fd82713966a69e0516b4", "index": 9185, "step-1": "<mask token>\n", "step-2": "<mask token>\nwebsocket_urlpatterns = [path('ws/notifications', NotificationsConsumer)]\n", "step-3": "from django.urls import path\nfrom .consumers import NotificationsConsumer\nwebsocket_urlpattern...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Extractor(object): """docstring for Parser""" def __init__(self, html, base_url): self.soup = BeautifulSoup(html, 'html5lib') self.base_url = base_url def get_album(self): galaries = self.soup.find('div', {'id': 'galleries'}) table = gal...
flexible
{ "blob_id": "a53d7b4c93fa49fb0162138d4a262fe7a5546148", "index": 5215, "step-1": "<mask token>\n\n\nclass Extractor(object):\n \"\"\"docstring for Parser\"\"\"\n\n def __init__(self, html, base_url):\n self.soup = BeautifulSoup(html, 'html5lib')\n self.base_url = base_url\n\n def get_album...
[ 9, 10, 11, 13, 14 ]
from huobi import RequestClient from huobi.constant.test import * request_client = RequestClient(api_key=g_api_key, secret_key=g_secret_key) obj_list = request_client.get_cross_margin_loan_orders() if len(obj_list): for obj in obj_list: obj.print_object() print()
normal
{ "blob_id": "c65969bba72142f4a328f978d78e0235cd56e393", "index": 8618, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(obj_list):\n for obj in obj_list:\n obj.print_object()\n print()\n", "step-3": "<mask token>\nrequest_client = RequestClient(api_key=g_api_key, secret_key=g_secr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_exact(x, y, t, trunc): """Get the exact solution at a set t """ Z = 0 for n in range(1, trunc): for m in range(1, trunc): Z_num = -120 * ((-n) ** 4 * np.pi ** 4 * (-1) ** n + 12 * n ** 2 * np.pi ** 2 * (-1) ** n + 24 + 24 * (-1)...
flexible
{ "blob_id": "c556aaf6aecb3c91d9574e0a158a9fa954108d70", "index": 8193, "step-1": "<mask token>\n\n\ndef get_exact(x, y, t, trunc):\n \"\"\"Get the exact solution at a set t\n \"\"\"\n Z = 0\n for n in range(1, trunc):\n for m in range(1, trunc):\n Z_num = -120 * ((-n) ** 4 * np.pi *...
[ 2, 4, 5, 6, 7 ]
from arma_scipy.fit import fit, predict
normal
{ "blob_id": "0f6512bb734336a67eab2f13949dd960f5ffc1d5", "index": 7758, "step-1": "<mask token>\n", "step-2": "from arma_scipy.fit import fit, predict\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from dbmanager import DbManager from message import Message def list_returner(f): def wrapper(*args, **kwargs): result = f(*args, **kwargs) if result: return result else: return [dict()] return wrapper class Messenger: def __init__(self, messages_count=2...
normal
{ "blob_id": "4d1ea6522a01603f0159a1f27da70b65c4f387cb", "index": 7093, "step-1": "<mask token>\n\n\nclass Messenger:\n <mask token>\n\n def add_message(self, message):\n self.message_manager.add(message)\n\n @list_returner\n def get_room_messages(self):\n messages = []\n i = 6\n ...
[ 5, 7, 8, 9 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jan 17 22:28:30 2019 @author: donsdev """ arr = [] sub = [] n = int(input()) while n > 0: arr.append(n) n-=1 while len(arr) + len(sub) > 1: while len(arr) > 1: arr.pop() sub.append(arr.pop()) arr = sub[::-1] + arr su...
normal
{ "blob_id": "d5d31920f7fd4ed2913c5880dba61c2015181be9", "index": 5760, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile n > 0:\n arr.append(n)\n n -= 1\nwhile len(arr) + len(sub) > 1:\n while len(arr) > 1:\n arr.pop()\n sub.append(arr.pop())\n arr = sub[::-1] + arr\n sub ...
[ 0, 1, 2, 3 ]
from network import WLAN import machine import pycom import time import request def wifiConnect(): wlan = WLAN(mode=WLAN.STA) pycom.heartbeat(False) wlan.connect(ssid="telenet-4D87F74", auth=(WLAN.WPA2, "x2UcakjTsryz")) while not wlan.isconnected(): time.sleep(1) print("...
normal
{ "blob_id": "099396a75060ad0388f5a852c4c3cb148febd8a3", "index": 4048, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef wifiConnect():\n wlan = WLAN(mode=WLAN.STA)\n pycom.heartbeat(False)\n wlan.connect(ssid='telenet-4D87F74', auth=(WLAN.WPA2, 'x2UcakjTsryz'))\n while not wlan.isconnec...
[ 0, 1, 2, 3 ]
def best_rank_selection(generation): max_selected = len(generation) // 10 sorted_by_fitness = sorted(generation, key=lambda x: x.fitness, reverse =True) return sorted_by_fitness[:max_selected]
normal
{ "blob_id": "05a80a904548e90bea635469b94264f219062560", "index": 7968, "step-1": "<mask token>\n", "step-2": "def best_rank_selection(generation):\n max_selected = len(generation) // 10\n sorted_by_fitness = sorted(generation, key=lambda x: x.fitness, reverse\n =True)\n return sorted_by_fitness...
[ 0, 1 ]
import os from sources.lol.status import LOLServerStatusCollector from util.abstract.feed import Feed from util.abstract.handler import Handler from util.functions.load_json import load_json class LoLServerStatusHandler(Handler): def load_servers(self): servers_filepath = os.path.join(os.path.dirname(__f...
normal
{ "blob_id": "493552469943e9f9f0e57bf92b874c8b67943de5", "index": 6751, "step-1": "<mask token>\n\n\nclass LoLServerStatusHandler(Handler):\n\n def load_servers(self):\n servers_filepath = os.path.join(os.path.dirname(__file__),\n '../../data/lol/status.json')\n return load_json(server...
[ 3, 4, 5, 6 ]
from django.db import models from django.utils import timezone from django.utils.text import slugify from django.db.models.signals import pre_save from NetFlix.db.models import PublishStateOptions from NetFlix.db.receivers import publicado_stado_pre_save, slugify_pre_save class VideoQuerySet(models.QuerySet): def...
normal
{ "blob_id": "9c98ecde2e8aac00a33da7db6e5e6023519e4b84", "index": 7731, "step-1": "<mask token>\n\n\nclass Video(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 ...
[ 8, 14, 15, 16, 17 ]
import sys from google.appengine.ext import blobstore from google.appengine.ext.webapp import blobstore_handlers from google.appengine.ext import ndb from helpers import * def valid_pw(name, password, h): salt = h.split(',')[0] return h == make_pw_hash(name, password, salt) class CVEProfile(ndb.Model): profile_nam...
normal
{ "blob_id": "ac60fd79d7fb15624cf79adc7e456960e7523e2e", "index": 9131, "step-1": "<mask token>\n\n\nclass Graph(ndb.Model):\n name = ndb.StringProperty(required=True)\n graphID = ndb.IntegerProperty(required=True)\n owner_id = ndb.IntegerProperty(required=True)\n machines = ndb.StructuredProperty(Mac...
[ 38, 45, 49, 52, 53 ]
<|reserved_special_token_0|> class Motorcycle(GroundVehicle): pass class FlightVehicle(Vehicle): pass class Starship(FlightVehicle): pass class Airplane(FlightVehicle): pass <|reserved_special_token_1|> <|reserved_special_token_0|> class GroundVehicle(Vehicle): pass class Car(GroundVe...
flexible
{ "blob_id": "d7db617131bf6e72c7aa808030f7286ddb609cc2", "index": 4579, "step-1": "<mask token>\n\n\nclass Motorcycle(GroundVehicle):\n pass\n\n\nclass FlightVehicle(Vehicle):\n pass\n\n\nclass Starship(FlightVehicle):\n pass\n\n\nclass Airplane(FlightVehicle):\n pass\n", "step-2": "<mask token>\n\n...
[ 4, 6, 7, 8, 9 ]
import numpy as np def get_train_batches(data_dir='/home/yunhan/batchified'): """ return a list or generator of (large) ndarrays, in order to efficiently utilize GPU """ # todo: read in data that is preoprocessed # Use batch 1 - 52 as train (60%), 53 - 71 as validation (20%), 72 - 89 a...
normal
{ "blob_id": "c04c38d78144b6f5d3e5af4ebe9ce430e882a367", "index": 8014, "step-1": "<mask token>\n\n\ndef get_evaluate_batches(data_dir='/home/yunhan/batchified'):\n \"\"\"\n return a list or generator of (large) ndarrays,\n in order to efficiently utilize GPU\n \"\"\"\n n = 18\n idx = np...
[ 2, 4, 5, 6, 7 ]
import tkinter as tk from tkinter import ttk win = tk.Tk() win.title('Loop') ############ Time consuming : # nameLable1 = ttk.Label(win,text="Enter your name : ") # nameLable1.grid(row=0,column=0,sticky=tk.W) # ageLable1 = ttk.Label(win,text="Enter your age: ") # ageLable1.grid(row=1,column=0,sticky=tk.W) #...
normal
{ "blob_id": "2eb49d08136c3540e1305310f03255e2ecbf0c40", "index": 3175, "step-1": "<mask token>\n\n\ndef submitAction():\n for i in userDict:\n print(f'{userDict.get(i).get()}')\n exit()\n\n\n<mask token>\n", "step-2": "<mask token>\nwin.title('Loop')\n<mask token>\nfor i in range(len(labels)):\n ...
[ 1, 2, 3, 4, 5 ]
""" Tests for the Transformer RNNCell. """ import pytest import numpy as np import tensorflow as tf from .transformer import positional_encoding, transformer_layer from .cell import (LimitedTransformerCell, UnlimitedTransformerCell, inject_at_timestep, sequence_masks) def test_inject_at_timestep...
normal
{ "blob_id": "958f6e539f9f68892d77b6becc387581c6adfa16", "index": 3366, "step-1": "<mask token>\n\n\ndef test_inject_at_timestep():\n with tf.Graph().as_default():\n with tf.Session() as sess:\n in_seq = tf.constant(np.array([[[1, 2, 3, 4], [5, 6, 7, 8]], [[\n 9, 10, 11, 12], [...
[ 3, 4, 5, 6, 7 ]
../pyline/pyline.py
normal
{ "blob_id": "3fe98c865632c75c0ba0e1357379590f072bf662", "index": 7840, "step-1": "../pyline/pyline.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
''' BMI=weight*0.45259227/(hei*0.0254)** ''' wht=2 if wht==0: print("wht is",wht) else: print("whtsdsb") #今天也完成了100波比跳 wei=float(input("wei=")) hei=float(input("hei=")) bmi=(wei*0.45259227)/((hei*0.0254)**2) print("BMI=",bmi) if bmi<18.5: print("too light") elif bmi<25: print("normal") elif bmi<30: ...
normal
{ "blob_id": "48d0bfdc607a4605ef82f5c7dc7fd6fc85c4255f", "index": 377, "step-1": "<mask token>\n", "step-2": "<mask token>\nif wht == 0:\n print('wht is', wht)\nelse:\n print('whtsdsb')\n<mask token>\nprint('BMI=', bmi)\nif bmi < 18.5:\n print('too light')\nelif bmi < 25:\n print('normal')\nelif bmi...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Production(Config): <|reserved_special_token_0|> class Development(Config): DEBUG = True SQLALCHEMY_DATABASE_URI = 'postgresql://Nghi:nghi1996@localhost/postgres' SQLALCHEMY_ECHO = False JWT_SECRET_KEY = 'JWT_SECRET_NGHI!123' SECRET_KEY = 'SECRET_KEY_NGHI_A...
flexible
{ "blob_id": "e99d557808c7ae32ebfef7e7fb2fddb04f45b13a", "index": 6091, "step-1": "<mask token>\n\n\nclass Production(Config):\n <mask token>\n\n\nclass Development(Config):\n DEBUG = True\n SQLALCHEMY_DATABASE_URI = 'postgresql://Nghi:nghi1996@localhost/postgres'\n SQLALCHEMY_ECHO = False\n JWT_SE...
[ 5, 6, 7, 8, 9 ]
import os import math import shutil from evoplotter import utils from evoplotter.dims import * from evoplotter import printer import numpy as np CHECK_CORRECTNESS_OF_FILES = 1 STATUS_FILE_NAME = "results/status.txt" OPT_SOLUTIONS_FILE_NAME = "opt_solutions.txt" class TableGenerator: """Generates table from dat...
normal
{ "blob_id": "b3cb94a44f64091714650efb81c4cad27b211cef", "index": 8804, "step-1": "<mask token>\n\n\nclass TableGenerator:\n \"\"\"Generates table from data.\"\"\"\n\n def __init__(self, f_cell, dim_rows, dim_cols, headerRowNames, title='',\n color_scheme=None, table_postprocessor=None, vertical_bord...
[ 22, 30, 37, 44, 48 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def generate_modal(): return html.Div(id='markdown', className='modal', children=html.Div(id= 'markdown-container', className='markdown-container', children=[ html.Div(className='close-container', children=ht...
flexible
{ "blob_id": "f9dd20a3b72c0c8e72029459244486f31eaff536", "index": 9411, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef generate_modal():\n return html.Div(id='markdown', className='modal', children=html.Div(id=\n 'markdown-container', className='markdown-container', children=[\n h...
[ 0, 1, 2, 3, 4 ]
from .auth import Auth from .banDetection import BanDetectionThread from .botLogging import BotLoggingThread from .clientLauncher import ClientLauncher from .log import LogThread, Log from .mainThread import MainThread from .nexonServer import NexonServer from .tmLogging import TMLoggingThread from .worldCheckboxStatus...
normal
{ "blob_id": "b7038ad73bf0e284474f0d89d6c34967d39541c0", "index": 6566, "step-1": "<mask token>\n", "step-2": "from .auth import Auth\nfrom .banDetection import BanDetectionThread\nfrom .botLogging import BotLoggingThread\nfrom .clientLauncher import ClientLauncher\nfrom .log import LogThread, Log\nfrom .mainTh...
[ 0, 1 ]
from rest_framework import serializers from .models import data from django.contrib.auth.models import User class dataSerializer(serializers.ModelSerializer): class Meta: model = data fields = ['id', 'task', 'duedate', 'person', 'done', 'task_user'] class userSerializer(serializers.ModelSerial...
normal
{ "blob_id": "972c479ea40232e14fbf678ca2ccf9716e473fe8", "index": 9736, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass userSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = User\n fields = ['username', 'password', 'email']\n", "step-3": "<mask token>\n\n\ncl...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='sk_processor', packages=find_packages()) <|reserved_special_token_1|> from setuptools import setup, find_packages setup(name='sk_processor', packages=find_packages()) <|reserved_special_token_1|> from setuptools ...
flexible
{ "blob_id": "de884413dcbd0e89e8bfcf5657fe189156d9a661", "index": 1837, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='sk_processor', packages=find_packages())\n", "step-3": "from setuptools import setup, find_packages\nsetup(name='sk_processor', packages=find_packages())\n", "step-4": "fr...
[ 0, 1, 2, 3 ]
# Filename : var.py #整数 i = 5 print(i) i = i + 1 print(i) #浮点数 i = 1.1 print(i) #python的弱语言特性,可以随时改变变量的类型 i = 'change i to a string ' print(i) s = 'hello'#单引号 print(s) s = "hello"#双引号 print(s) #三引号为多行字符串 s = '''This is a "multi-line" string. This is the second line.''' print(s) s = '\''#斜杠用于转义 print(s) #r或R开头的字符...
normal
{ "blob_id": "bea7853d1f3eac50825bc6eb10438f3f656d6d04", "index": 1947, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(i)\n<mask token>\nprint(i)\n<mask token>\nprint(i)\n<mask token>\nprint(i)\n<mask token>\nprint(s)\n<mask token>\nprint(s)\n<mask token>\nprint(s)\n<mask token>\nprint(s)\n<mask tok...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def swapPairs(self, head: ListNode) ->ListNode: dummy_head = ListNode(0) dummy_head.next = head pre = dummy_head cur = head ...
flexible
{ "blob_id": "4afc2ceed860c20af071e1d9ccaca17973cb9a8e", "index": 7553, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def swapPairs(self, head: ListNode) ->ListNode:\n dummy_head = ListNode(0)\n dummy_head.next = head\n pre ...
[ 0, 1, 2, 3 ]
from flask import Flask import rq from redis import Redis from app.lib.job import Job from app.config import Config app = Flask(__name__) app.config.from_object(Config) app.redis = Redis.from_url('redis://') app.task_queue = rq.Queue('ocr-tasks', connection=app.redis, default_timeout=43200) app.task_queue.empty() a...
normal
{ "blob_id": "14e336005da1f1f3f54ea5f2892c27b58f2babf0", "index": 4794, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.config.from_object(Config)\n<mask token>\napp.task_queue.empty()\n<mask token>\napp.eval_queue.empty()\n<mask token>\napp.register_blueprint(api_bp, url_prefix='/api')\n", "step-3":...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 import os import subprocess import emailgen # # Header information # recipient = input("recipient: ") sender = input("sender: ") password = input("sender password: ") subject = "hdd temp alert" # # Get hdd temp, format for email # output = subprocess.check_output('sudo hddtemp /dev/sda /dev/sd...
normal
{ "blob_id": "26a6fe0b2a98aa77b63a336cd6c2afcfe81d9058", "index": 7680, "step-1": "<mask token>\n", "step-2": "<mask token>\ntext += '\\nHostname: ' + os.uname().nodename\nemailgen.sendAlert(recipient, subject, text, sender, password)\n", "step-3": "<mask token>\nrecipient = input('recipient: ')\nsender = inp...
[ 0, 1, 2, 3, 4 ]