index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
6,900
f25d86e857970854b2239ce0ab5280132b89280e
# -*- coding: utf-8 -*- ''' 一球从100米高度自由落下 每次落地后反跳回原高度的一半;再落下,求它在第10次落地时,共经过多少米?第10次反弹多高? 求两个东西, 1是经过了多少米, 2是反弹多高 1: 100 100+50+50 100+50+50+25+25 2: 100 100/2=50 50/2=25 25/2=2 ''' import math start_height = 100 rebound_rate = 0.5 meter_list = [100] def rebound(time): m = start_height*(r...
[ "# -*- coding: utf-8 -*-\n'''\n 一球从100米高度自由落下\n 每次落地后反跳回原高度的一半;再落下,求它在第10次落地时,共经过多少米?第10次反弹多高?\n\n 求两个东西, 1是经过了多少米, 2是反弹多高\n 1: 100 100+50+50 100+50+50+25+25\n 2: 100 100/2=50 50/2=25 25/2=2\n'''\nimport math\n\nstart_height = 100\nrebound_rate = 0.5\nmeter_list = [100]\n\ndef rebound(time):\n ...
true
6,901
5bb894feaf9293bf70b3f831e33be555f74efde8
from django import forms from .models import File, Sample, Plate, Well, Machine, Project class MachineForm(forms.ModelForm): class Meta: model = Machine fields = ['name', 'author', 'status', 'comments'] class ProjectForm(forms.ModelForm): class Meta: model = Project fields = ...
[ "from django import forms\nfrom .models import File, Sample, Plate, Well, Machine, Project\n\n\nclass MachineForm(forms.ModelForm):\n class Meta:\n model = Machine\n fields = ['name', 'author', 'status', 'comments']\n\n\nclass ProjectForm(forms.ModelForm):\n class Meta:\n model = Project\...
false
6,902
fc06d8a26a99c16a4b38ad0b4bbb28a1dc522991
#This script reads through a Voyager import log and outputs duplicate bib IDs as well as the IDs of bibs, mfhds, and items created. #import regular expressions and openpyxl import re import openpyxl # prompt for file names fname = input("Enter input file, including extension: ") fout = input("Enter output file, witho...
[ "#This script reads through a Voyager import log and outputs duplicate bib IDs as well as the IDs of bibs, mfhds, and items created.\n\n#import regular expressions and openpyxl\nimport re\nimport openpyxl\n\n# prompt for file names\nfname = input(\"Enter input file, including extension: \")\nfout = input(\"Enter ou...
false
6,903
fca46c095972e8190ee9c93f3bddbb2a49363a7f
# coding: utf-8 """ Meme Meister API to create memes # noqa: E501 OpenAPI spec version: 0.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import swagger_client from swagger_client.api.default_api import DefaultA...
[ "# coding: utf-8\n\n\"\"\"\n Meme Meister\n\n API to create memes # noqa: E501\n\n OpenAPI spec version: 0.1.0\n \n Generated by: https://github.com/swagger-api/swagger-codegen.git\n\"\"\"\n\n\nfrom __future__ import absolute_import\n\nimport unittest\n\nimport swagger_client\nfrom swagger_client.ap...
false
6,904
0b7523035fdad74454e51dc9da9fc4e9bea2f6bf
import typing from rest_framework.exceptions import ValidationError from rest_framework.request import Request def extract_organization_id_from_request_query(request): return request.query_params.get('organization') or request.query_params.get('organization_id') def extract_organization_id_from_request_data(re...
[ "import typing\n\nfrom rest_framework.exceptions import ValidationError\nfrom rest_framework.request import Request\n\n\ndef extract_organization_id_from_request_query(request):\n return request.query_params.get('organization') or request.query_params.get('organization_id')\n\n\ndef extract_organization_id_from_...
false
6,905
378c07c512425cb6ac6c998eaaa86892b02a37b8
""" Like Places but possibly script based and temporary. Like a whisper command where is keeps tracks of participants. """
[ "\"\"\"\nLike Places but possibly script based and temporary.\nLike a whisper command where is keeps tracks of participants.\n\"\"\"", "<docstring token>\n" ]
false
6,906
ee161ff66a6fc651a03f725427c3731bdf4243eb
from django.shortcuts import render from django.http import HttpResponse # # Create your views here. # def Login_Form(request): # return render(request, 'Login.html')
[ "from django.shortcuts import render\r\nfrom django.http import HttpResponse\r\n\r\n\r\n\r\n# # Create your views here.\r\n# def Login_Form(request):\r\n# return render(request, 'Login.html')", "from django.shortcuts import render\nfrom django.http import HttpResponse\n", "<import token>\n" ]
false
6,907
83a92c0b645b9a2a483a01c19a47ab5c296ccbd9
import numpy as np import sys import os import os.path import json import optparse import time import pandas as pd #Randomize and split the inference set according to hor_pred #Generate .npy file for each hp selected #Coge valores aleatorios de la columna de etiquetas en función del horizonte de predicció...
[ "import numpy as np\nimport sys\nimport os\nimport os.path\nimport json\nimport optparse\nimport time\nimport pandas as pd\n\n #Randomize and split the inference set according to hor_pred\n #Generate .npy file for each hp selected\n\n #Coge valores aleatorios de la columna de etiquetas en función del horiz...
false
6,908
3d854c83488eeafa035ccf5d333eeeae63505255
thisdict = {"brand": "ford", "model": "Mustang", "year": 1964} module = thisdict["modal"] print("model:", module) thisdict = {"brand": "ford", "model": "Mustang", "year": 1964} module = thisdict.get["modal"] print("model:", module)
[ "thisdict = {\"brand\": \"ford\", \"model\": \"Mustang\", \"year\": 1964}\nmodule = thisdict[\"modal\"]\nprint(\"model:\", module)\n\nthisdict = {\"brand\": \"ford\", \"model\": \"Mustang\", \"year\": 1964}\nmodule = thisdict.get[\"modal\"]\nprint(\"model:\", module)", "thisdict = {'brand': 'ford', 'model': 'Must...
false
6,909
c024e12fe06e47187c25a9f384ceed566bf94645
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Module that defines a controller for database's operations over business rules """ # built-in dependencies import functools import typing # external dependencies import sqlalchemy from sqlalchemy.orm import sessionmaker # project dependencies from database.table im...
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\"\"\"\nModule that defines a controller for database's operations over business rules\n\"\"\"\n\n# built-in dependencies\nimport functools\nimport typing\n\n# external dependencies\nimport sqlalchemy\nfrom sqlalchemy.orm import sessionmaker\n\n# project dependenc...
false
6,910
d82b68d5c83ae538d7a8b5ae5547b43ac4e8a3d4
from models.readingtip import ReadingTip from database import db class ReadingTipRepository: def __init__(self): pass def get_tips(self, user, tag="all"): if tag == "all": return ReadingTip.query.filter_by(user=user).all() else: return ReadingTip.query.filter_by...
[ "from models.readingtip import ReadingTip\nfrom database import db\n\nclass ReadingTipRepository:\n def __init__(self):\n pass\n\n def get_tips(self, user, tag=\"all\"):\n if tag == \"all\":\n return ReadingTip.query.filter_by(user=user).all()\n else:\n return Readin...
false
6,911
8535020e7157699310b3412fe6c5a28ee8e61f49
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import _ut...
[ "# coding=utf-8\n# *** WARNING: this file was generated by the Pulumi SDK Generator. ***\n# *** Do not edit by hand unless you're certain you know what you are doing! ***\n\nimport copy\nimport warnings\nimport pulumi\nimport pulumi.runtime\nfrom typing import Any, Mapping, Optional, Sequence, Union, overload\nfrom...
false
6,912
8474205d49aef2d18755fc1a25a82718962f4120
times = np.linspace(0.0, 10.0, 100) result = mesolve(H, psi0, times, [np.sqrt(0.05) * sigmax()], [sigmaz(), sigmay()]) fig, ax = plt.subplots() ax.plot(times, result.expect[0]) # doctest: +SKIP ax.plot(times, result.expect[1]) # doctest: +SKIP ax.set_xlabel('Time') # doctest: +SKIP ax.set_ylabel('Expectation values') #...
[ "times = np.linspace(0.0, 10.0, 100)\nresult = mesolve(H, psi0, times, [np.sqrt(0.05) * sigmax()], [sigmaz(), sigmay()])\nfig, ax = plt.subplots()\nax.plot(times, result.expect[0]) # doctest: +SKIP\nax.plot(times, result.expect[1]) # doctest: +SKIP\nax.set_xlabel('Time') # doctest: +SKIP\nax.set_ylabel('Expectation...
false
6,913
dfe79d2f4bf4abc1d04035cf4556237a53c01122
import bisect import sys input = sys.stdin.readline N = int(input()) A = [int(input()) for _ in range(N)] dp = [float('inf')]*(N+1) for a in A[::-1]: idx = bisect.bisect_right(dp, a) dp[idx] = a ans = 0 for n in dp: if n != float('inf'): ans += 1 print(ans)
[ "import bisect\nimport sys\ninput = sys.stdin.readline\nN = int(input())\nA = [int(input()) for _ in range(N)]\n\ndp = [float('inf')]*(N+1)\nfor a in A[::-1]:\n idx = bisect.bisect_right(dp, a)\n dp[idx] = a\n\nans = 0\nfor n in dp:\n if n != float('inf'):\n ans += 1\nprint(ans)", "import bisect\nimport sys...
false
6,914
aa0a69e3286934fcfdf31bd713eca1e8dd90aeaa
from omt.gui.abstract_panel import AbstractPanel class SourcePanel(AbstractPanel): def __init__(self): super(SourcePanel, self).__init__() def packagePath(self): """ This file holds the link to the active panels. The structure is a dictionary, the key is the class name ...
[ "from omt.gui.abstract_panel import AbstractPanel\n\n\nclass SourcePanel(AbstractPanel):\n\n def __init__(self):\n super(SourcePanel, self).__init__()\n\n def packagePath(self):\n \"\"\"\n This file holds the link to the active panels.\n The structure is a dictionary, the key is th...
false
6,915
44c04cf79d02823318b06f02af13973960413bea
#!/usr/bin/env python import os, glob, sys, math, time, argparse import ROOT from ROOT import TFile, TTree, TH2D def main(): parser = argparse.ArgumentParser(description='Program that takes as an argument a pattern of LEAF rootfiles (* wildcards work) enclosed by quotation marks ("<pattern>") and creates a root...
[ "#!/usr/bin/env python\n\nimport os, glob, sys, math, time, argparse\nimport ROOT\nfrom ROOT import TFile, TTree, TH2D\n\n\n\ndef main():\n parser = argparse.ArgumentParser(description='Program that takes as an argument a pattern of LEAF rootfiles (* wildcards work) enclosed by quotation marks (\"<pattern>\") an...
true
6,916
a9876c61578a53f29865062c0915db622aaaba72
from PIL import Image from pdf2image import convert_from_path import glob from pathlib import Path import shutil, os from docx import Document import fnmatch import re import shutil def find_files_ignore_case(which, where='.'): '''Returns list of filenames from `where` path matched by 'which' shell patter...
[ "from PIL import Image\nfrom pdf2image import convert_from_path\nimport glob \nfrom pathlib import Path\nimport shutil, os\nfrom docx import Document\nimport fnmatch\nimport re\nimport shutil\n\n\ndef find_files_ignore_case(which, where='.'):\n '''Returns list of filenames from `where` path matched by 'which'\n ...
false
6,917
6a8007e44d2c4b56426cd49772cbc23df2eca49c
#program_skeleton.py #import load_json_files as bm import write import merge as m import load_df as ldf import load_vars as lv import log as log import clean_df as clean import download as dl import gc import confirm_drcts as cfs import fix_files as ff import readwrite as rw import df_filter as df_f import realtor_scr...
[ "#program_skeleton.py\n#import load_json_files as bm\n\nimport write\nimport merge as m\nimport load_df as ldf\nimport load_vars as lv\nimport log as log\nimport clean_df as clean\nimport download as dl\nimport gc\nimport confirm_drcts as cfs\nimport fix_files as ff\nimport readwrite as rw\nimport df_filter as df_f...
false
6,918
78ddae64cc576ebaf7f2cfaa4553bddbabe474b7
from django.db import models from orders.constants import OrderStatus from subscriptions.models import Subscription class Order(models.Model): subscription = models.OneToOneField( Subscription, on_delete=models.CASCADE, related_name='order', ) order_status = models.CharField( ...
[ "from django.db import models\n\nfrom orders.constants import OrderStatus\nfrom subscriptions.models import Subscription\n\n\nclass Order(models.Model):\n subscription = models.OneToOneField(\n Subscription,\n on_delete=models.CASCADE,\n related_name='order',\n )\n order_status = model...
false
6,919
5cd767564e8a261561e141abeebb5221cb3ef2c2
# Generated by Django 2.2.1 on 2019-05-23 14:07 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('presentes', '0015_caso_lugar_del_hecho'), ] operations = [ migrations.AddField( model_name='organizacion', name='des...
[ "# Generated by Django 2.2.1 on 2019-05-23 14:07\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('presentes', '0015_caso_lugar_del_hecho'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='organizacion',\n ...
false
6,920
4d722975b4ffc1bbfe7591e6ceccc758f67a5599
# Multiple Linear Regression # To set the working directory save this .py file where we have the Data.csv file # and then press the Run button. This will automatically set the working directory. # Importing the data from preprocessing data import numpy as np import matplotlib.pyplot as plt import pandas as pd d...
[ "# Multiple Linear Regression\n# To set the working directory save this .py file where we have the Data.csv file \n# and then press the Run button. This will automatically set the working directory.\n# Importing the data from preprocessing data\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport panda...
false
6,921
253d37f29e33f61d7e1a5ec2f9a1d6307a2ae108
""" Tests for parsers.py @author Kevin Wilson <khwilson@gmail.com> """ import crisis.parsers as undertest import datetime import unittest class TestParsers(unittest.TestCase): def test_parse_date(self): date = '8/5/2013 16:14' self.assertEqual(datetime.datetime(2013, 8, 5, 16, 14), undertest.parse_date(da...
[ "\"\"\"\nTests for parsers.py\n\n@author Kevin Wilson <khwilson@gmail.com>\n\"\"\"\nimport crisis.parsers as undertest\n\nimport datetime\nimport unittest\n\nclass TestParsers(unittest.TestCase):\n\tdef test_parse_date(self):\n\t\tdate = '8/5/2013 16:14'\n\t\tself.assertEqual(datetime.datetime(2013, 8, 5, 16, 14),\...
false
6,922
23ba9e498dd153be408e973253d5f2a858d4771b
"""Module just for fun game""" # -*- coding: utf-8 -*- from __future__ import print_function from itertools import chain import tabulate import numpy class Game(object): """Класс игры""" def __init__(self): self.field = numpy.array([(-10, -10, -10), (-10, -10, -10), (-10, -10, -10)]) self.rende...
[ "\"\"\"Module just for fun game\"\"\"\n# -*- coding: utf-8 -*-\nfrom __future__ import print_function\nfrom itertools import chain\nimport tabulate\nimport numpy\n\nclass Game(object):\n \"\"\"Класс игры\"\"\"\n def __init__(self):\n self.field = numpy.array([(-10, -10, -10), (-10, -10, -10), (-10, -10...
false
6,923
e60fcf19560b4826577797c8ae8b626ff984dcfd
from pynput import keyboard # list of chars entered by the user list = [] number_of_chars = 0 # if entered chars go above MAX LENGTH they will be written inside a file MAX_LENGTH = 300 def on_press(key): global number_of_chars global list list.append(key) number_of_chars+=1 if number_of_cha...
[ "from pynput import keyboard\n\n# list of chars entered by the user\nlist = []\nnumber_of_chars = 0\n# if entered chars go above MAX LENGTH they will be written inside a file\nMAX_LENGTH = 300\n\ndef on_press(key):\n global number_of_chars\n global list\n \n list.append(key)\n number_of_chars+=1\n\n\...
false
6,924
ffd11d49f8499b4bfec8f17d07b66d899dd23d2e
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-02-26 20:13 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Cbrowser', '0002_links_l_title'), ] operations = [ migrations.AddField( ...
[ "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-02-26 20:13\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('Cbrowser', '0002_links_l_title'),\n ]\n\n operations = [\n migra...
false
6,925
5bcfb0d4fd371a0882dd47814935700eed7885ec
import sys def main(stream=sys.stdin): """ Input, output, and parsing, etc. Yeah. """ num_cases = int(stream.readline().strip()) for i in xrange(num_cases): rows, cols = map(int, stream.readline().strip().split()) board = [] for r in xrange(rows): board = board +...
[ "import sys\n\ndef main(stream=sys.stdin):\n \"\"\"\n Input, output, and parsing, etc. Yeah.\n \"\"\"\n num_cases = int(stream.readline().strip())\n for i in xrange(num_cases):\n rows, cols = map(int, stream.readline().strip().split())\n board = []\n for r in xrange(rows):\n ...
true
6,926
f8bb2851192a53e94e503c0c63b17477878ad9a7
import os import pandas as pd from sklearn.decomposition import PCA import matplotlib.pyplot as plt name="/home/t3cms/thessel/Workflow1.5/stop_data/stop_train_sig_wc.csv" name_bkg="/home/t3cms/thessel/Workflow1.5/stop_data/stop_train_bkg_wc.csv" drop_cols=[0,1,2,15] names = [i for i in range(16)] #columns=[]...
[ "import os\r\nimport pandas as pd\r\nfrom sklearn.decomposition import PCA\r\nimport matplotlib.pyplot as plt \r\n\r\nname=\"/home/t3cms/thessel/Workflow1.5/stop_data/stop_train_sig_wc.csv\"\r\nname_bkg=\"/home/t3cms/thessel/Workflow1.5/stop_data/stop_train_bkg_wc.csv\"\r\ndrop_cols=[0,1,2,15]\r\nnames = [i for i i...
false
6,927
46aa795bb72db0fcd588b1747e3559b8828be17c
#!/usr/bin/env python3.7 import Adafruit_GPIO import Adafruit_GPIO.I2C as I2C import time import sys import argparse import os argparser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter, description="Select I2C channel multiplexed by TCA9548A") argparser.add_argument...
[ "#!/usr/bin/env python3.7\r\nimport Adafruit_GPIO\r\nimport Adafruit_GPIO.I2C as I2C\r\nimport time\r\nimport sys\r\nimport argparse\r\nimport os\r\n\r\nargparser = argparse.ArgumentParser(\r\n formatter_class=argparse.ArgumentDefaultsHelpFormatter,\r\n description=\"Select I2C channel multiplexed by TCA9548A...
false
6,928
d211594a034489d36a5648bf0b926fbd734fd0df
import xdrlib,sys import xlrd def open_excel(file='D:\基金公司\数据库-制表符\资产组合-基金公司维度.xlsx'): try: data=xlrd.open_workbook('D:\基金公司\数据库-制表符\资产组合-基金公司维度.xlsx') return data except Exception as e: print (str(e)) def excel_table_byindex(file='D:\基金公司\数据库-制表符\资产组合-基金公司维度.xlsx',colnameindex=0,by_inde...
[ "import xdrlib,sys\nimport xlrd\ndef open_excel(file='D:\\基金公司\\数据库-制表符\\资产组合-基金公司维度.xlsx'):\n try:\n data=xlrd.open_workbook('D:\\基金公司\\数据库-制表符\\资产组合-基金公司维度.xlsx')\n return data\n except Exception as e:\n print (str(e))\ndef excel_table_byindex(file='D:\\基金公司\\数据库-制表符\\资产组合-基金公司维度.xlsx',...
false
6,929
f37d016dc49820239eb42198ca922e8681a2e0a6
import simplejson as json json_list = [ "/content/squash-generation/squash/final/Custom.json", "/content/squash-generation/squash/temp/Custom/final_qa_set.json", "/content/squash-generation/squash/temp/Custom/generated_questions.json", "/content/squash-generation/squash...
[ "import simplejson as json\n\njson_list = [ \"/content/squash-generation/squash/final/Custom.json\",\n \"/content/squash-generation/squash/temp/Custom/final_qa_set.json\", \n \"/content/squash-generation/squash/temp/Custom/generated_questions.json\",\n \"/content/squash-...
false
6,930
c700af6d44cd036212c9e4ae4932bc60630f961e
#!/usr/bin/env python3 import os import fileinput project = input("Enter short project name: ") if os.path.isdir(project): print("ERROR: Project exists") exit() os.mkdir(project) os.chdir(project) cmd = "virtualenv env -p `which python3` --prompt=[django-" + project + "]" os.system(cmd) # Install django wi...
[ "#!/usr/bin/env python3\n\nimport os\nimport fileinput\n\nproject = input(\"Enter short project name: \")\n\nif os.path.isdir(project):\n print(\"ERROR: Project exists\")\n exit()\n\nos.mkdir(project)\nos.chdir(project)\ncmd = \"virtualenv env -p `which python3` --prompt=[django-\" + project + \"]\"\nos.syste...
false
6,931
a3ccd526b70db2061566274852a7fc0c249c165a
class Solution(object): def rotate(self, nums, k): """ :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. """ ln=len(nums) k=k%ln nums[:]=nums+nums[:ln-k] del nums[0:ln-k] #menthod 2自己输入[1,2],k=...
[ "class Solution(object):\n def rotate(self, nums, k):\n \"\"\"\n :type nums: List[int]\n :type k: int\n :rtype: void Do not return anything, modify nums in-place instead.\n \"\"\"\n ln=len(nums)\n k=k%ln\n nums[:]=nums+nums[:ln-k]\n \tdel nums[0:ln-k]\n\...
true
6,932
475cc5130e847b1a74a33bfa5cbc202a6bf31621
from codar.cheetah import Campaign from codar.cheetah import parameters as p from codar.savanna.machines import SummitNode import copy def get_shared_node_layout (n_writers, n_readers): nc = SummitNode() for i in range(n_writers): nc.cpu[i] = "writer:{}".format(i) for i in range(n_readers): ...
[ "from codar.cheetah import Campaign\nfrom codar.cheetah import parameters as p\nfrom codar.savanna.machines import SummitNode\nimport copy\n\ndef get_shared_node_layout (n_writers, n_readers):\n nc = SummitNode()\n for i in range(n_writers):\n nc.cpu[i] = \"writer:{}\".format(i)\n for i in range(n_r...
false
6,933
4c927f14065d0557dbe7b371002e133c351d3478
import collections import itertools from . import stats __all__ = [ 'Party', 'HoR', 'Coalition' ] Party = collections.namedtuple('Party', 'name,votes,seats') class HoR(object): """House of Representatives""" def __init__(self, parties, name='HoR'): self.name = name self._parties...
[ "import collections\nimport itertools\nfrom . import stats\n\n__all__ = [\n 'Party',\n 'HoR',\n 'Coalition'\n]\n\nParty = collections.namedtuple('Party', 'name,votes,seats')\n\n\nclass HoR(object):\n \"\"\"House of Representatives\"\"\"\n\n def __init__(self, parties, name='HoR'):\n self.name ...
false
6,934
44274446673225c769f63191d43e4747d8ddfbf7
# =================================================================== # Setup # =================================================================== from time import sleep import sys, termios, tty, os, pygame, threading # =================================================================== # Functions # ================...
[ "# ===================================================================\n# Setup\n# ===================================================================\nfrom time import sleep\nimport sys, termios, tty, os, pygame, threading\n\n# ===================================================================\n# Functions\n# ===...
false
6,935
e47e614c88c78fb6e8ff4098ea2b89d21bfa9684
import numpy as np from .metrics import r2_score class LinearRegression: def __init__(self): self.coef_ = None # 系数 self.interception_ = None # 截距 self._theta = None def fit_normal(self, X_train, y_train): assert X_train.shape[0] == y_train.shape[0], "" #!!!impor...
[ "import numpy as np\nfrom .metrics import r2_score\n\nclass LinearRegression:\n\n def __init__(self):\n self.coef_ = None # 系数\n self.interception_ = None # 截距\n self._theta = None\n\n def fit_normal(self, X_train, y_train):\n assert X_train.shape[0] == y_train.shape[0], \"\"\...
false
6,936
c70681f5ff8d49a243b7d26164aa5430739354f4
# Uses python3 from decimal import Decimal def gcd_naive(a, b): x = 5 while x > 1: if a % b != 0: c = a % b a = b b = c else: x = 1 return b there = input() store = there.split() a = int(max(store)) b = int(min(store)) factor = gcd_naive(a,b) ...
[ "# Uses python3\nfrom decimal import Decimal\ndef gcd_naive(a, b):\n x = 5\n while x > 1:\n if a % b != 0:\n c = a % b\n a = b\n b = c\n else:\n x = 1\n return b\n\nthere = input()\nstore = there.split()\na = int(max(store))\nb = int(min(store))\nfa...
false
6,937
7539042b92a5188a11f625cdfc0f341941f751f0
# -*- coding:utf-8 -*- import requests from lxml import etree import codecs from transfrom import del_extra import re MODIFIED_TEXT = [r'一秒记住.*?。', r'(看书.*?)', r'纯文字.*?问', r'热门.*?>', r'最新章节.*?新', r'は防§.*?e', r'&.*?>', r'r.*?>', r'c.*?>', r'复制.*?>', r'字-符.*?>', r'最新最快,无.*?。', ...
[ "# -*- coding:utf-8 -*-\n\nimport requests\nfrom lxml import etree\nimport codecs\nfrom transfrom import del_extra\nimport re\n\nMODIFIED_TEXT = [r'一秒记住.*?。', r'(看书.*?)', r'纯文字.*?问', r'热门.*?>', r'最新章节.*?新',\n r'は防§.*?e', r'&.*?>', r'r.*?>', r'c.*?>',\n r'复制.*?>', r'字-符.*?>', r'最新最快,无...
false
6,938
3fdf67c3e0e4c3aa8a3fed09102aca0272b5ff4f
from django.db.models import Exists from django.db.models import OuterRef from django.db.models import QuerySet from django.utils import timezone class ProductQuerySet(QuerySet): def available(self): return self.filter(available_in__contains=timezone.now(), category__public=True) def annotate_subprod...
[ "from django.db.models import Exists\nfrom django.db.models import OuterRef\nfrom django.db.models import QuerySet\nfrom django.utils import timezone\n\n\nclass ProductQuerySet(QuerySet):\n def available(self):\n return self.filter(available_in__contains=timezone.now(), category__public=True)\n\n def a...
false
6,939
47476fbb78ca8ce14d30bf226795bbd85b5bae45
import os import numpy as np import matplotlib.pyplot as plt from scipy.spatial import distance with open('input.txt', 'r') as f: data = f.read() res = [i for i in data.splitlines()] print(res) newHold = [] for line in res: newHold.append((tuple(int(i) for i in line.split(', ')))) print(newHold) mapper = np....
[ "import os\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom scipy.spatial import distance\n\nwith open('input.txt', 'r') as f:\n data = f.read()\n\nres = [i for i in data.splitlines()]\nprint(res)\n\nnewHold = []\nfor line in res:\n newHold.append((tuple(int(i) for i in line.split(', '))))\nprint(ne...
false
6,940
dc2c429bae10ee14737583a3726eff8fde8306c7
from src import npyscreen from src.MainForm import MainForm from src.ContactsForm import ContactsForm from src.SendFileForm import SendFileForm from src.MessageInfoForm import MessageInfoForm from src.ForwardMessageForm import ForwardMessageForm from src.RemoveMessageForm import RemoveMessageForm class App(npyscreen....
[ "from src import npyscreen\nfrom src.MainForm import MainForm\nfrom src.ContactsForm import ContactsForm\nfrom src.SendFileForm import SendFileForm\nfrom src.MessageInfoForm import MessageInfoForm\nfrom src.ForwardMessageForm import ForwardMessageForm\nfrom src.RemoveMessageForm import RemoveMessageForm\n\n\nclass ...
false
6,941
98841630964dd9513e51c3f13bfdb0719600712d
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)
[ "from flask import Flask, render_template, request, jsonify, make_response\napp = Flask(__name__)\n\n\n@app.route(\"/\")\ndef hello():\n # return render_template('chat.html')\n return make_response(render_template('chat.html'),200)\n\n\nif __name__ == \"__main__\":\n app.run(debug=True)", "from flask imp...
false
6,942
32c62bb8b6e4559bb7dfc67f4311bc8e71e549c9
s = 'Daum KaKao' # s_split = s.split() # s = s_split[1] + ' ' + s_split[0] s = s[5:] + ' ' + s[:4] print(s)
[ "s = 'Daum KaKao'\n# s_split = s.split()\n# s = s_split[1] + ' ' + s_split[0]\ns = s[5:] + ' ' + s[:4]\nprint(s)", "s = 'Daum KaKao'\ns = s[5:] + ' ' + s[:4]\nprint(s)\n", "<assignment token>\nprint(s)\n", "<assignment token>\n<code token>\n" ]
false
6,943
3346ca7cdcfe9d9627bfe08be2b282897b3c319c
import os from pathlib import Path from sphinx_testing import with_app @with_app(buildername="html", srcdir="doc_test/doc_role_need_max_title_length_unlimited") def test_max_title_length_unlimited(app, status, warning): os.environ["MAX_TITLE_LENGTH"] = "-1" app.build() html = Path(app.outdir, "index.htm...
[ "import os\nfrom pathlib import Path\n\nfrom sphinx_testing import with_app\n\n\n@with_app(buildername=\"html\", srcdir=\"doc_test/doc_role_need_max_title_length_unlimited\")\ndef test_max_title_length_unlimited(app, status, warning):\n\n os.environ[\"MAX_TITLE_LENGTH\"] = \"-1\"\n app.build()\n html = Pat...
false
6,944
d3425017d4e604a8940997afd0c35a4f7eac1170
from django import forms from .models import Appointment, Prescription from account.models import User class AppointmentForm(forms.ModelForm): class Meta: model = Appointment fields = '__all__' widgets = { 'date': forms.DateInput(attrs={'type': 'date'}), 'time': for...
[ "from django import forms\nfrom .models import Appointment, Prescription\nfrom account.models import User\n\n\nclass AppointmentForm(forms.ModelForm):\n class Meta:\n model = Appointment\n fields = '__all__'\n widgets = {\n 'date': forms.DateInput(attrs={'type': 'date'}),\n ...
false
6,945
fd564d09d7320fd444ed6eec7e51afa4d065ec4d
import os, time def counter(count): # run in new process for i in range(count): time.sleep(1) # simulate real work print('[%s] => %s' % (os.getpid(), i)) import pdb;pdb.set_trace() for i in range(5): pid= os.fork() if pid !...
[ "import os, time\ndef counter(count): # run in new process\n for i in range(count):\n time.sleep(1) # simulate real work\n print('[%s] => %s' % (os.getpid(), i))\n\nimport pdb;pdb.set_trace()\nfor i in range(5):\n pid= os.fork()...
false
6,946
63d9aa55463123f32fd608ada83e555be4b5fe2c
from tkinter import * import psycopg2 import sys import pprint import Base_de_datos import MergeSort class Cliente: def __init__(self,id=None,nombre=None): self.id=id self.nombre=nombre def ingresar(self): self.ventanaIngresar= Toplevel() self.ventanaIngresa...
[ "from tkinter import *\r\nimport psycopg2\r\nimport sys\r\nimport pprint\r\nimport Base_de_datos\r\nimport MergeSort\r\n\r\nclass Cliente:\r\n def __init__(self,id=None,nombre=None):\r\n self.id=id\r\n self.nombre=nombre\r\n def ingresar(self):\r\n self.ventanaIngresar= Toplevel()...
false
6,947
a25fb9b59d86de5a3180e4257c4e398f22cdbb05
#!/usr/bin/python import os from nao.tactics import Tactic from nao.inspector import Inspector def test_file(): print("\n[*] === file ===") name_libmagic_so = 'libmagic.so.1' inspector = Inspector("./sample/file", debug=True) # find_addr = 0x1742D # ret block of is_tar find_addr = 0x173F8 # return ...
[ "#!/usr/bin/python\nimport os\nfrom nao.tactics import Tactic\nfrom nao.inspector import Inspector\n\ndef test_file():\n print(\"\\n[*] === file ===\")\n name_libmagic_so = 'libmagic.so.1'\n inspector = Inspector(\"./sample/file\", debug=True)\n # find_addr = 0x1742D # ret block of is_tar\n find_addr...
false
6,948
d73832d3f0adf22085a207ab223854e11fffa2e8
""" """ import json import logging import re import asyncio from typing import Optional import discord from discord.ext import commands import utils logging.basicConfig(level=logging.INFO, format="[%(asctime)s] [%(name)s] [%(levelname)s] %(message)s") log = logging.getLogger("YTEmbedFixer") client = commands.Bot...
[ "\"\"\"\n\n\"\"\"\n\nimport json\nimport logging\nimport re\nimport asyncio\nfrom typing import Optional\n\nimport discord\nfrom discord.ext import commands\nimport utils\n\n\nlogging.basicConfig(level=logging.INFO, format=\"[%(asctime)s] [%(name)s] [%(levelname)s] %(message)s\")\nlog = logging.getLogger(\"YTEmbedF...
false
6,949
56a681015ea27e2c8e00ab8bcc8019d5987c4ee1
import os f_s_list = [2, 1.5, 1, 0.5, 0.2] g_end_list = [500, 1000, 2000, 5000, 10000, 20000, 60000] h_i_list = [(10000 * i, 10000 * (i + 1)) for i in range(6)] i_seed_list = [1, 12, 123, 1234, 12345, 123456] for s in f_s_list: os.system("python SKs_model.py " + str(s) + " 0 10000 0 relu") for train_end in g_...
[ "import os\n\nf_s_list = [2, 1.5, 1, 0.5, 0.2]\n\ng_end_list = [500, 1000, 2000, 5000, 10000, 20000, 60000]\n\nh_i_list = [(10000 * i, 10000 * (i + 1)) for i in range(6)]\n\ni_seed_list = [1, 12, 123, 1234, 12345, 123456]\n\nfor s in f_s_list:\n os.system(\"python SKs_model.py \" + str(s) + \" 0 10000 0 relu\")\...
false
6,950
f8f538773693b9d9530775094d9948626247a3bb
import cv2 import numpy as np import os from tqdm import tqdm DIR = '/home/nghiatruong/Desktop' INPUT_1 = os.path.join(DIR, 'GOPR1806.MP4') INPUT_2 = os.path.join(DIR, '20190715_180940.mp4') INPUT_3 = os.path.join(DIR, '20190715_181200.mp4') RIGHT_SYNC_1 = 1965 LEFT_SYNC_1 = 1700 RIGHT_SYNC_2 = 5765 LEFT_SYNC_2 = 128...
[ "import cv2\nimport numpy as np\nimport os\nfrom tqdm import tqdm\n\n\nDIR = '/home/nghiatruong/Desktop'\nINPUT_1 = os.path.join(DIR, 'GOPR1806.MP4')\nINPUT_2 = os.path.join(DIR, '20190715_180940.mp4')\nINPUT_3 = os.path.join(DIR, '20190715_181200.mp4')\nRIGHT_SYNC_1 = 1965\nLEFT_SYNC_1 = 1700\nRIGHT_SYNC_2 = 5765\...
false
6,951
20722cf82371d176942e068e91b8fb38b4db61fd
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...
[ "from scipy.optimize import newton\nfrom math import sqrt\nimport time\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)*(1-sqrt(2*Ri/(Rf+Ri)))-DV\n\n return newton(f,Ri)\n\nif __name__ == '__main__':\n starttime = time.time()\n print(GetRadius(100...
false
6,952
616ff35f818130ebf54bd33f67df79857cd45965
../testing.py
[ "../testing.py" ]
true
6,953
77884dd72f5efe91fccad27e6328c4ad34378be2
import os import logging from datetime import datetime import torch from naruto_skills.training_checker import TrainingChecker from data_for_train import is_question as my_dataset from model_def.lstm_attention import LSTMAttention from utils import pytorch_utils from train.new_trainer import TrainingLoop, TrainingLog...
[ "import os\nimport logging\nfrom datetime import datetime\n\nimport torch\nfrom naruto_skills.training_checker import TrainingChecker\n\nfrom data_for_train import is_question as my_dataset\nfrom model_def.lstm_attention import LSTMAttention\nfrom utils import pytorch_utils\nfrom train.new_trainer import TrainingLo...
false
6,954
328c483bf59c6b84090e6bef8814e829398c5a56
#!/usr/bin/env python from lemonpie import lemonpie from flask_debugtoolbar import DebugToolbarExtension def main(): lemonpie.debug = True lemonpie.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False toolbar = DebugToolbarExtension(lemonpie) lemonpie.run('0.0.0.0') if __name__ == '__main__': main()
[ "#!/usr/bin/env python\nfrom lemonpie import lemonpie\nfrom flask_debugtoolbar import DebugToolbarExtension\n\ndef main():\n lemonpie.debug = True\n lemonpie.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False\n toolbar = DebugToolbarExtension(lemonpie)\n lemonpie.run('0.0.0.0')\n\nif __name__ == '__main__':...
false
6,955
28978bc75cb8c5585fd0d145fe0d0c0c5456ad2e
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from django.contrib.auth.models import User class Tweet(models.Model): owner = models.ForeignKey(User, related_name='tweets') content = models.CharField(max_length=255) when_created = models.DateTimeField(auto_no...
[ "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models\nfrom django.contrib.auth.models import User\n\n\nclass Tweet(models.Model):\n owner = models.ForeignKey(User, related_name='tweets')\n content = models.CharField(max_length=255)\n when_created = models.DateTi...
false
6,956
de4c31ad474b7ce75631214aceafbe4d7334f14b
import testTemplate def getTests(): tests = [] suite=testTemplate.testSuite("Sample Test Cases") testcase = testTemplate.testInstance("3\n1 1 1\n1 1 1\n1 1 1" , "6" , "Sample #1") suite.add(testcase) testcase = testTemplate.testInstance("11\n1 0 0 1 0 0 0 0 0 1 1 \n1 1 1 1 1 0 1 0 1 0 0 \n1 0 0 1 0 0 1 1 0 1 0 ...
[ "import testTemplate \ndef getTests():\n\ttests = []\n\t\n\tsuite=testTemplate.testSuite(\"Sample Test Cases\")\n\ttestcase = testTemplate.testInstance(\"3\\n1 1 1\\n1 1 1\\n1 1 1\" , \"6\" , \"Sample #1\")\n\tsuite.add(testcase)\n\ttestcase = testTemplate.testInstance(\"11\\n1 0 0 1 0 0 0 0 0 1 1 \\n1 1 1 1 1 0 1 ...
false
6,957
84b98ebf6e44d03d16f792f3586be1248c1d0221
# Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE.md file. { 'variables': { 'mac_asan_dylib': '<(PRODUCT_DIR)/libclang_rt.asan_osx_dynamic.dylib', }, ...
[ "# Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file\n# for details. All rights reserved. Use of this source code is governed by a\n# BSD-style license that can be found in the LICENSE.md file.\n\n{\n 'variables': {\n 'mac_asan_dylib': '<(PRODUCT_DIR)/libclang_rt.asan_osx_dynamic.dylib...
false
6,958
24f3284a7a994951a1f0a4ef64c951499bbba1b4
""" pytest.mark.parametrize(“变量参数名称”,变量数据列表[‘123’,‘34’,‘567’,‘78’]) 上面的变量个数有4个,测试用例传入变量名称后,会依序4次使用变量的数据,执行4次测试用例 def test001(self,"变量参数名称") assert 变量名称 """
[ "\"\"\"\n pytest.mark.parametrize(“变量参数名称”,变量数据列表[‘123’,‘34’,‘567’,‘78’])\n 上面的变量个数有4个,测试用例传入变量名称后,会依序4次使用变量的数据,执行4次测试用例\n def test001(self,\"变量参数名称\")\n assert 变量名称\n\n\"\"\"", "<docstring token>\n" ]
false
6,959
cd564ebb51cf91993d2ed1810707aead44c19a6b
#! /usr/bin/env python # -*- conding:utf-8 -*- import MySQLdb import os import commands from common import logger_init from logging import getLogger import re from db import VlanInfo,Session,WafBridge def getVlan(): # get vlan data from t_vlan session=Session() vlanport=[] for info in session.query(VlanIn...
[ "#! /usr/bin/env python\n# -*- conding:utf-8 -*-\nimport MySQLdb\nimport os\nimport commands\nfrom common import logger_init\nfrom logging import getLogger\nimport re\nfrom db import VlanInfo,Session,WafBridge\n\n\ndef getVlan(): # get vlan data from t_vlan\n session=Session()\n vlanport=[]\n for info in s...
false
6,960
5eee3953193e0fc9f44b81059ce66997c22bc8f1
# Make an array of dictionaries. Each dictionary should have keys: # # lat: the latitude # lon: the longitude # name: the waypoint name # # Make up three entries of various values. waypoints = [ { 'lat': 106.72888 }, { 'lon': 0.69622 }, { 'name': 'Kepulauan Riau' } ] # Write a loop that prints out all the...
[ "# Make an array of dictionaries. Each dictionary should have keys:\n#\n# lat: the latitude\n# lon: the longitude\n# name: the waypoint name\n#\n# Make up three entries of various values.\n\nwaypoints = [\n { 'lat': 106.72888 },\n { 'lon': 0.69622 },\n { 'name': 'Kepulauan Riau' }\n]\n\n# Write a loop that...
false
6,961
b1573f80395d31017ceacbb998e421daf20ab75f
# class Mob: # def __init__(self, name, health=10): # self.name = name # self.health = health # def get_hit(self, power): # self.health -= power # print( # f"I, {self.name} was hit for {power} points. {self.health} pts remaining") # hero = Mob("Sir Barks-alot", 30)...
[ "# class Mob:\n# def __init__(self, name, health=10):\n# self.name = name\n# self.health = health\n\n# def get_hit(self, power):\n# self.health -= power\n# print(\n# f\"I, {self.name} was hit for {power} points. {self.health} pts remaining\")\n\n\n# hero = Mob(\"S...
false
6,962
fa511411e59880fd80fba0ccc49c95d42cb4b78d
import requests from requests.auth import HTTPBasicAuth def __run_query(self, query): URL = 'https://api.github.com/graphql' request = requests.post(URL, json=query,auth=HTTPBasicAuth('gleisonbt', 'Aleister93')) if request.status_code == 200: return request.json() else: ...
[ "import requests\nfrom requests.auth import HTTPBasicAuth\n\ndef __run_query(self, query):\n URL = 'https://api.github.com/graphql'\n\n request = requests.post(URL, json=query,auth=HTTPBasicAuth('gleisonbt', 'Aleister93'))\n\n if request.status_code == 200:\n return request.json()\n ...
false
6,963
4d5b2ed016cfc6740c3ee5397c894fabc1bec73f
class CustomPrinter(object): def __init__(self, val): self.val = val def to_string(self): res = "{" for m in xrange(64): res += hex(int(self.val[m])) if m != 63: res += ", " res += " }" return res def lookup_type(val): if str...
[ "class CustomPrinter(object):\n def __init__(self, val):\n self.val = val\n\n def to_string(self):\n res = \"{\"\n for m in xrange(64):\n res += hex(int(self.val[m]))\n if m != 63:\n res += \", \"\n res += \" }\"\n return res\n\n\ndef loo...
false
6,964
fd52379d125d6215fe12b6e01aa568949511549d
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime class Migration(migrations.Migration): dependencies = [ ('products', '0007_auto_20150904_1320'), ] operations = [ migrations.AddField( model_name='custome...
[ "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nimport datetime\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('products', '0007_auto_20150904_1320'),\n ]\n\n operations = [\n migrations.AddField(\n ...
false
6,965
b63221af86748241fdce34052819569a06d37afe
# this is for the 12/30/2015 experiments # varied over 1, 10, 25, 50, 100 repeat particles per particle # 10000 particles total per filter # bias is at 0.8 in both the "real" world (realWorld.cpp) files = ['data0Tue_Dec_30_20_37_34_2014.txt', 'data0Tue_Dec_30_20_37_49_2014.txt', 'data0Tue_Dec_30_20_38_04_2014.txt', 'd...
[ "# this is for the 12/30/2015 experiments\n# varied over 1, 10, 25, 50, 100 repeat particles per particle\n# 10000 particles total per filter\n# bias is at 0.8 in both the \"real\" world (realWorld.cpp)\n\nfiles = ['data0Tue_Dec_30_20_37_34_2014.txt',\n'data0Tue_Dec_30_20_37_49_2014.txt',\n'data0Tue_Dec_30_20_38_04...
false
6,966
778ee9a0ea7f57535b4de88a38cd741f2d46e092
txt = './KF_neko.txt.mecab' mapData = {} listData = [] with open('./KF31.txt', 'w') as writeFile: with open(txt, 'r') as readFile: for text in readFile: # print(text) # \tで区切って先頭だけ見る listData = text.split('\t') # 表層形 surface = listData[0] ...
[ "txt = './KF_neko.txt.mecab'\nmapData = {}\nlistData = []\nwith open('./KF31.txt', 'w') as writeFile:\n with open(txt, 'r') as readFile:\n for text in readFile:\n # print(text)\n # \\tで区切って先頭だけ見る\n listData = text.split('\\t')\n # 表層形\n surface = list...
false
6,967
c0216dbd52be134eb417c20ed80b398b22e5d844
from sklearn.cluster import MeanShift from sklearn.datasets.samples_generator import make_blobs import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import style style.use('ggplot') # Create random data points whose centers are the following centers = [[20, 0, 0], [0, 20, 0], [0, 0...
[ "from sklearn.cluster import MeanShift\nfrom sklearn.datasets.samples_generator import make_blobs\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.mplot3d import Axes3D\nfrom matplotlib import style\n\nstyle.use('ggplot')\n\n\n# Create random data points whose centers are the following\ncenters = [[20, 0, 0], [0...
false
6,968
d13b402b90bb948e5722f45096a8c0a33e4cac67
import cv2 cam = cv2.VideoCapture("./bebop.sdp") while True: ret, frame = cam.read() cv2.imshow("frame", frame) cv2.waitKey(1)
[ "import cv2\n\ncam = cv2.VideoCapture(\"./bebop.sdp\")\n\nwhile True:\n ret, frame = cam.read()\n cv2.imshow(\"frame\", frame)\n cv2.waitKey(1)\n\n", "import cv2\ncam = cv2.VideoCapture('./bebop.sdp')\nwhile True:\n ret, frame = cam.read()\n cv2.imshow('frame', frame)\n cv2.waitKey(1)\n", "<im...
false
6,969
c3bfcb971a6b08cdf98200bd2b2a8fe6ac2dd083
from partyparrot import convert_with_alphabet_emojis, convert def test_convert_char_to_alphabet(): assert convert_with_alphabet_emojis("") == "" assert convert_with_alphabet_emojis(" ") == " " assert convert_with_alphabet_emojis("\n") == "\n" assert ( convert_with_alphabet_emojis(" one two")...
[ "from partyparrot import convert_with_alphabet_emojis, convert\n\n\ndef test_convert_char_to_alphabet():\n assert convert_with_alphabet_emojis(\"\") == \"\"\n assert convert_with_alphabet_emojis(\" \") == \" \"\n assert convert_with_alphabet_emojis(\"\\n\") == \"\\n\"\n assert (\n convert_with_...
false
6,970
7245d4db6440d38b9302907a6203c1507c373112
from django.http import HttpResponse from django.views.decorators.http import require_http_methods from django.shortcuts import render, redirect from app.models import PaidTimeOff, Schedule from django.utils import timezone from django.contrib import messages from app.decorators import user_is_authenticated from app....
[ "\n\nfrom django.http import HttpResponse\nfrom django.views.decorators.http import require_http_methods\nfrom django.shortcuts import render, redirect\nfrom app.models import PaidTimeOff, Schedule\nfrom django.utils import timezone\nfrom django.contrib import messages\nfrom app.decorators import user_is_authentica...
false
6,971
2a5c6f442e6e6cec6c4663b764c8a9a15aec8c40
import hashlib import json #import logger import Login.loger as logger #configurations import Configurations.config as config def generate_data(*args): #add data into seperate variables try: station_data = args[0] except KeyError as e: logger.log(log_type=config.log_error,params=e) ...
[ "import hashlib\nimport json\n#import logger \nimport Login.loger as logger\n#configurations\nimport Configurations.config as config\n\ndef generate_data(*args):\n #add data into seperate variables\n try:\n station_data = args[0]\n except KeyError as e:\n logger.log(log_type=config.log_error,...
false
6,972
179a9cf0713001e361f39aa30192618b392c78c7
pal = [] for i in range(100, 1000): for j in range( 100, 1000): s = str(i*j) if s[::-1] == s: pal.append(int(s)) print(max(pal))
[ "pal = []\n\nfor i in range(100, 1000):\n\tfor j in range( 100, 1000):\n\t\ts = str(i*j)\n\t\tif s[::-1] == s:\n\t\t\tpal.append(int(s))\n\n\nprint(max(pal))", "pal = []\nfor i in range(100, 1000):\n for j in range(100, 1000):\n s = str(i * j)\n if s[::-1] == s:\n pal.append(int(s))\np...
false
6,973
88a469eba61fb6968db8cc5e1f93f12093b7f128
from api.decidim_connector import DecidimConnector from api.participatory_processes_reader import ParticipatoryProcessesReader from api.version_reader import VersionReader API_URL = "https://meta.decidim.org/api" decidim_connector = DecidimConnector(API_URL) version_reader = VersionReader(decidim_connector) version = ...
[ "from api.decidim_connector import DecidimConnector\nfrom api.participatory_processes_reader import ParticipatoryProcessesReader\nfrom api.version_reader import VersionReader\n\nAPI_URL = \"https://meta.decidim.org/api\"\ndecidim_connector = DecidimConnector(API_URL)\nversion_reader = VersionReader(decidim_connecto...
false
6,974
1cca94040cdd8db9d98f587c62eff7c58eae7535
from mathmodule import * import sys print("Welcome to my basic \'Calculator\'") print("Please choose your best option (+, -, *, /) ") # user input part while True: try: A = int(input("Now Enter your first Value=")) break except: print("Oops!", sys.exc_info()[0], "occurred.") while True: mathoparet...
[ "from mathmodule import *\nimport sys\n\nprint(\"Welcome to my basic \\'Calculator\\'\")\n\nprint(\"Please choose your best option (+, -, *, /) \")\n\n# user input part \nwhile True:\n try:\n A = int(input(\"Now Enter your first Value=\"))\n break\n except:\n print(\"Oops!\", sys.exc_info()[0], \"occurre...
false
6,975
427d3d386d4b8a998a0b61b8c59984c6003f5d7b
import subprocess as sp from .dummy_qsub import dummy_qsub from os.path import exists from os import makedirs from os import remove from os.path import dirname QUEUE_NAME = 'fact_medium' def qsub(job, exe_path, queue=QUEUE_NAME): o_path = job['o_path'] if job['o_path'] is not None else '/dev/null' e_path = ...
[ "import subprocess as sp\nfrom .dummy_qsub import dummy_qsub\nfrom os.path import exists\nfrom os import makedirs\nfrom os import remove\nfrom os.path import dirname\n\nQUEUE_NAME = 'fact_medium'\n\n\ndef qsub(job, exe_path, queue=QUEUE_NAME):\n\n o_path = job['o_path'] if job['o_path'] is not None else '/dev/nu...
false
6,976
6ab5ac0caa44366268bb8b70ac044376d9c062f0
# Code By it4min # t.me/it4min # t.me/LinuxArmy # -- Combo List Maker v1 -- import time, os os.system("clear") banner = ''' \033[92m .o88b. .d88b. .88b d88. d8888b. .d88b. d8P Y8 .8P Y8. 88'YbdP`88 88 `8D .8P Y8. 8P 88 88 88 88 88 88oooY' 88 88 8b 88 88 88 88 88 88~~~b. 88 88 Y8b...
[ "# Code By it4min\n# t.me/it4min\n# t.me/LinuxArmy\n# -- Combo List Maker v1 --\nimport time, os\n\nos.system(\"clear\")\nbanner = '''\n\\033[92m .o88b. .d88b. .88b d88. d8888b. .d88b. \nd8P Y8 .8P Y8. 88'YbdP`88 88 `8D .8P Y8. \n8P 88 88 88 88 88 88oooY' 88 88 \n8b 88 88 88 88 88 88...
false
6,977
9d8d8e97f7d3dbbb47dc6d4105f0f1ffb358fd2f
from enum import Enum import os from pathlib import Path from typing import Optional from loguru import logger import pandas as pd from pydantic.class_validators import root_validator, validator from tqdm import tqdm from zamba.data.video import VideoLoaderConfig from zamba.models.config import ( ZambaBaseModel, ...
[ "from enum import Enum\nimport os\nfrom pathlib import Path\nfrom typing import Optional\n\nfrom loguru import logger\nimport pandas as pd\nfrom pydantic.class_validators import root_validator, validator\nfrom tqdm import tqdm\n\nfrom zamba.data.video import VideoLoaderConfig\nfrom zamba.models.config import (\n ...
false
6,978
210fcb497334ad8bf5433b917fc199c3e22f0f6e
# -*- coding: utf-8 -*- #COMECE AQUI ABAIXO p1=float(input('digite o p1:')) c1=float(input('digite o c1:')) p2=float(input('digite o p2:')) c2=float(input('digite o c2:')) if p1*c1=p2*c2: print('O') if pi*c1>p2*c2: print('-1') else: print('1')
[ "# -*- coding: utf-8 -*-\n#COMECE AQUI ABAIXO\n\np1=float(input('digite o p1:'))\nc1=float(input('digite o c1:'))\np2=float(input('digite o p2:'))\nc2=float(input('digite o c2:'))\n\nif p1*c1=p2*c2:\n print('O')\n\nif pi*c1>p2*c2:\n print('-1')\n\nelse:\n print('1')" ]
true
6,979
7b2ad0b4eca7b31b314e32ad57d51be82f0eaf61
from bs4 import BeautifulSoup from aiounfurl.parsers import oembed def test_oembed_not_match(oembed_providers): oembed_url_extractor = oembed.OEmbedURLExtractor(oembed_providers) url = 'http://test.com' assert oembed_url_extractor.get_oembed_url(url) is None def test_oembed_founded(oembed_providers): ...
[ "from bs4 import BeautifulSoup\nfrom aiounfurl.parsers import oembed\n\n\ndef test_oembed_not_match(oembed_providers):\n oembed_url_extractor = oembed.OEmbedURLExtractor(oembed_providers)\n url = 'http://test.com'\n assert oembed_url_extractor.get_oembed_url(url) is None\n\n\ndef test_oembed_founded(oembed...
false
6,980
5ee2a51ea981f0feab688d9c571620a95d89a422
__author__ = 'anderson' from pyramid.security import Everyone, Allow, ALL_PERMISSIONS class Root(object): #Access Control List __acl__ = [(Allow, Everyone, 'view'), (Allow, 'role_admin', ALL_PERMISSIONS), (Allow, 'role_usuario', 'comum')] def __init__(self, request): ...
[ "__author__ = 'anderson'\nfrom pyramid.security import Everyone, Allow, ALL_PERMISSIONS\n\n\nclass Root(object):\n #Access Control List\n __acl__ = [(Allow, Everyone, 'view'),\n (Allow, 'role_admin', ALL_PERMISSIONS),\n (Allow, 'role_usuario', 'comum')]\n\n def __init__(self, re...
false
6,981
36a7d3ed28348e56e54ce4bfa937363a64ee718f
A, B = map(int, input().split()) K = (B ** 2 - A ** 2) / (2 * A - 2 * B) print(int(abs(K))) if K.is_integer() else print('IMPOSSIBLE')
[ "A, B = map(int, input().split())\nK = (B ** 2 - A ** 2) / (2 * A - 2 * B)\nprint(int(abs(K))) if K.is_integer() else print('IMPOSSIBLE')\n", "<assignment token>\nprint(int(abs(K))) if K.is_integer() else print('IMPOSSIBLE')\n", "<assignment token>\n<code token>\n" ]
false
6,982
5186400c9b3463d6be19e73de665f8792d8d68c7
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import tornado.web from sqlalchemy import desc from sqlalchemy.orm import contains_eager from main_app.models.post import Post from main_app.models.thread import PostThread, User2Thread from main_app.handlers.base_handler import BaseHandler class API_Comments(BaseHan...
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport tornado.web\n\nfrom sqlalchemy import desc\nfrom sqlalchemy.orm import contains_eager\n\nfrom main_app.models.post import Post\nfrom main_app.models.thread import PostThread, User2Thread\n\nfrom main_app.handlers.base_handler import BaseHandler\n\n\nclass A...
true
6,983
f93b7f2939bbee9b0cb5402d3e5f5d6c482d37c4
import pandas as pd import sweetviz as sv b = pd.read_csv("final_cricket_players.csv", low_memory=False) b = b.replace(to_replace="-",value="") b = b.replace(to_replace="[]",value="") b = b.replace(to_replace="{}",value="") b.drop(b.columns[b.columns.str.contains('unnamed',case = False)],axis = 1, inplace = Tru...
[ "import pandas as pd\r\nimport sweetviz as sv\r\nb = pd.read_csv(\"final_cricket_players.csv\", low_memory=False)\r\nb = b.replace(to_replace=\"-\",value=\"\")\r\nb = b.replace(to_replace=\"[]\",value=\"\")\r\nb = b.replace(to_replace=\"{}\",value=\"\")\r\n\r\nb.drop(b.columns[b.columns.str.contains('unnamed',case ...
false
6,984
3b613ec75088d6d9a645443df2bbc2f33b80000b
#!/usr/bin/env python # Creates a new task from a given task definition json and starts on # all instances in the given cluster name # USAGE: # python ecs-tasker.py <task_definition_json_filename> <cluster_name> # EXAMPLE: # python ecs-tasker.py ecs-task-stage.json cops-cluster import boto3 import json import sys im...
[ "#!/usr/bin/env python\n# Creates a new task from a given task definition json and starts on\n# all instances in the given cluster name\n# USAGE:\n# python ecs-tasker.py <task_definition_json_filename> <cluster_name>\n# EXAMPLE:\n# python ecs-tasker.py ecs-task-stage.json cops-cluster\n\nimport boto3\nimport json...
true
6,985
4ae24d1e39bdcde3313a8a0c8029a331864ba40e
from tkinter import * janela = Tk() janela.title("Teste de frame") janela.geometry("800x600") frame = Frame(janela, width = 300, height = 300, bg = 'red').grid(row = 0, column = 0) #frames servem para caso queira colocar labels e butoes dentro de uma area especifica #assim deve se declarar o frame como pai no inicio ...
[ "from tkinter import *\n\njanela = Tk()\njanela.title(\"Teste de frame\")\njanela.geometry(\"800x600\")\n\nframe = Frame(janela, width = 300, height = 300, bg = 'red').grid(row = 0, column = 0)\n#frames servem para caso queira colocar labels e butoes dentro de uma area especifica\n#assim deve se declarar o frame co...
false
6,986
388772386f25d6c2f9cc8778b7ce1b2ad0920851
# Generated by Django 2.2 on 2021-01-31 14:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0004_product_pr_number'), ] operations = [ migrations.RemoveField( model_name='payment', name='PA_id', ...
[ "# Generated by Django 2.2 on 2021-01-31 14:11\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('app', '0004_product_pr_number'),\n ]\n\n operations = [\n migrations.RemoveField(\n model_name='payment',\n nam...
false
6,987
b47f15a79f7a82304c2be6af00a5854ff0f6ad3e
import csv import json from urllib import request from urllib.error import HTTPError from urllib.parse import urljoin, urlparse, quote_plus from optparse import OptionParser HEADER = ["id", "module", "channel", "type", "value", "datetime"] def parse_options(): parser = OptionParser() parser.add_option("-H", "...
[ "import csv\nimport json\nfrom urllib import request\nfrom urllib.error import HTTPError\nfrom urllib.parse import urljoin, urlparse, quote_plus\nfrom optparse import OptionParser\n\nHEADER = [\"id\", \"module\", \"channel\", \"type\", \"value\", \"datetime\"]\n\ndef parse_options():\n parser = OptionParser()\n ...
false
6,988
b76c868a29b5edd07d0da60b1a13ddb4ac3e2913
class Config(object): DEBUG = False TESTING = False class ProductionConfig(Config): CORS_ALLOWED_ORIGINS = "productionexample.com" class DevelopmentConfig(Config): DEBUG = True CORS_ALLOWED_ORIGINS = "developmentexample.com" class TestingConfig(Config): TESTING = True
[ "class Config(object):\n DEBUG = False\n TESTING = False\n\n\nclass ProductionConfig(Config):\n CORS_ALLOWED_ORIGINS = \"productionexample.com\"\n\n\nclass DevelopmentConfig(Config):\n DEBUG = True\n CORS_ALLOWED_ORIGINS = \"developmentexample.com\"\n\n\nclass TestingConfig(Config):\n TESTING = Tr...
false
6,989
a38a5010c9edbed0929da225b4288396bb0d814e
# # Copyright (c) 2018 Intel Corporation # # 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 to...
[ "#\n# Copyright (c) 2018 Intel Corporation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable ...
false
6,990
9dd59fee46bd4bec87cc8c40099110b483ad0496
import ambulance_game as abg import numpy as np import sympy as sym from sympy.abc import a, b, c, d, e, f, g, h, i, j def get_symbolic_pi(num_of_servers, threshold, system_capacity, buffer_capacity): Q_sym = abg.markov.get_symbolic_transition_matrix( num_of_servers=num_of_servers, threshold=thres...
[ "import ambulance_game as abg\nimport numpy as np\nimport sympy as sym\nfrom sympy.abc import a, b, c, d, e, f, g, h, i, j\n\n\ndef get_symbolic_pi(num_of_servers, threshold, system_capacity, buffer_capacity):\n Q_sym = abg.markov.get_symbolic_transition_matrix(\n num_of_servers=num_of_servers,\n t...
false
6,991
b58cc08f8f10220373fa78f5d7249bc883b447bf
from mathgraph3D.core.plot import * from mathgraph3D.core.functions import *
[ "from mathgraph3D.core.plot import *\nfrom mathgraph3D.core.functions import *\n", "<import token>\n" ]
false
6,992
43eb221758ebcf1f01851fc6cda67b72f32a73c7
#!/usr/bin/python if __name__ == '__main__': import sys import os sys.path.insert(0, os.path.abspath('config')) import configure configure_options = [ 'CC=icc', 'CXX=icpc', 'FC=ifort', '--with-blas-lapack-dir=/soft/com/packages/intel/13/update5/mkl/', '--with-mkl_pardiso-dir=/soft/com/pack...
[ "#!/usr/bin/python\nif __name__ == '__main__':\n import sys\n import os\n sys.path.insert(0, os.path.abspath('config'))\n import configure\n configure_options = [\n 'CC=icc',\n 'CXX=icpc',\n 'FC=ifort',\n '--with-blas-lapack-dir=/soft/com/packages/intel/13/update5/mkl/',\n '--with-mkl_pardiso-di...
false
6,993
11259c92b005a66e5f3c9592875f478df199c813
# Name: Calvin Liew # Date: 2021-01-29 # Purpose: Video game final project, Tic-Tac-Toe 15 by Calvin Liew. import random # Function that reminds the users of the game rules and other instructions. def intro(): print("""\n####### ####### ####### # ...
[ "# Name: Calvin Liew\r\n# Date: 2021-01-29\r\n# Purpose: Video game final project, Tic-Tac-Toe 15 by Calvin Liew.\r\n\r\nimport random\r\n\r\n\r\n# Function that reminds the users of the game rules and other instructions.\r\n\r\ndef intro():\r\n print(\"\"\"\\n####### ####### #...
false
6,994
007caece16f641947043faa94b8a074efe8ebadb
#!/usr/bin/env python import rospy from std_msgs.msg import * __print__ = '' def Print(msg): global __print__ target = int(msg.data.split(';')[0]) * 2 if target == 0: __print__ = msg.data.split(';')[-1] + '\n' + '\n'.join(__print__.split('\n')[1:]) else: __print__ = '\n'.join(__print...
[ "#!/usr/bin/env python\n\nimport rospy\nfrom std_msgs.msg import *\n\n__print__ = ''\n\ndef Print(msg):\n global __print__\n\n target = int(msg.data.split(';')[0]) * 2\n if target == 0:\n __print__ = msg.data.split(';')[-1] + '\\n' + '\\n'.join(__print__.split('\\n')[1:])\n else:\n __print...
true
6,995
227b71cb6d4cde8f498ad19c1c5f95f7fc572752
from collections import defaultdict, Counter import numpy as np import sys import re def parseFile(file, frequency_tree): readnumber = re.compile('[r]+\d+') line_spliter = re.compile('\t+') colon_spliter = re.compile(':') forward_reads = 0 reverse_reads = 0 unmatched_reads = 0 read_position...
[ "from collections import defaultdict, Counter\nimport numpy as np\nimport sys\nimport re\n\ndef parseFile(file, frequency_tree):\n readnumber = re.compile('[r]+\\d+')\n line_spliter = re.compile('\\t+')\n colon_spliter = re.compile(':')\n forward_reads = 0\n reverse_reads = 0\n unmatched_reads = 0...
false
6,996
ea0a59953f2571f36e65f8f958774074b39a9ae5
''' ''' import numpy as np from scipy.spatial import distance def synonym_filter(WordVectors_npArray, WordLabels_npArray): ''' ''' pass def synonym_alternatives_range(WordVectors_npArray, AlternativesVectorOne_npArray, Alternati...
[ "'''\n'''\n\nimport numpy as np\n\nfrom scipy.spatial import distance\n\n\ndef synonym_filter(WordVectors_npArray, WordLabels_npArray):\n '''\n '''\n \n \n pass\n\ndef synonym_alternatives_range(WordVectors_npArray, \n AlternativesVectorOne_npArray,\n ...
false
6,997
50b2b9d1edc8eaa44050e2b3b2375e966f16e10c
''' -Medium- *BFS* You are given a 0-indexed integer array nums containing distinct numbers, an integer start, and an integer goal. There is an integer x that is initially set to start, and you want to perform operations on x such that it is converted to goal. You can perform the following operation repeatedly on the ...
[ "'''\n-Medium-\n*BFS*\n\nYou are given a 0-indexed integer array nums containing distinct numbers, an integer start, and an integer goal. There is an integer x that is initially set to start, and you want to perform operations on x such that it is converted to goal. You can perform the following operation repeatedl...
false
6,998
8240e6483f47abbe12e7bef02493bd147ad3fec6
from flask import Flask, render_template, flash, request import pandas as pd from wtforms import Form, TextField, TextAreaField, validators, StringField, SubmitField df = pd.read_csv('data1.csv') try: row = df[df['District'] == 'Delhi'].index[0] except: print("now city found") DEBUG = True app = Flask(__name_...
[ "from flask import Flask, render_template, flash, request\nimport pandas as pd\nfrom wtforms import Form, TextField, TextAreaField, validators, StringField, SubmitField\n\ndf = pd.read_csv('data1.csv')\ntry:\n row = df[df['District'] == 'Delhi'].index[0]\nexcept:\n print(\"now city found\")\n\nDEBUG = True\na...
true
6,999
b8f9633ab3110d00b2f0b82c78ad047fca0d3eee
import discord from app.vars.client import client from app.helpers import delete, getUser, getGuild @client.command() async def inviteInfo(ctx, link): try: await delete.byContext(ctx) except: pass linkData = await client.fetch_invite(url=link) if (linkData.inviter): inviterData...
[ "import discord\nfrom app.vars.client import client\nfrom app.helpers import delete, getUser, getGuild\n\n@client.command()\nasync def inviteInfo(ctx, link):\n try:\n await delete.byContext(ctx)\n except:\n pass\n\n linkData = await client.fetch_invite(url=link)\n if (linkData.inviter):\n ...
false