index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
6,200
2790bd80949bafe4e98ab9aca9cf80a6a0f31490
import wx from six import print_ import os FONTSIZE = 10 class TextDocPrintout(wx.Printout): """ A printout class that is able to print simple text documents. Does not handle page numbers or titles, and it assumes that no lines are longer than what will fit within the page width. Those features a...
[ "import wx\nfrom six import print_\nimport os\n\nFONTSIZE = 10\n\nclass TextDocPrintout(wx.Printout):\n \"\"\"\n A printout class that is able to print simple text documents.\n Does not handle page numbers or titles, and it assumes that no\n lines are longer than what will fit within the page width. Th...
false
6,201
1476d4f488e6c55234a34dc5b6182e3b8ad4f702
from django.core import serializers from django.db import models from uuid import uuid4 from django.utils import timezone from django.contrib.auth.models import User class Message(models.Model): uuid=models.CharField(max_length=50) user=models.CharField(max_length=20) message=models.CharField(max_length=20...
[ "from django.core import serializers\nfrom django.db import models\nfrom uuid import uuid4\nfrom django.utils import timezone\nfrom django.contrib.auth.models import User\n\nclass Message(models.Model):\n uuid=models.CharField(max_length=50)\n user=models.CharField(max_length=20)\n message=models.CharField...
false
6,202
8adf25fbffc14d6927d665931e54a7d699a3b439
# -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph # Title: channel # Author: Maria Camila Herrera Ramos # Generated: Thu Aug 2 18:09:17 2018 ################################################## from gnuradio import analog from gnuradio import blocks from gnuradio ...
[ "# -*- coding: utf-8 -*-\n##################################################\n# GNU Radio Python Flow Graph\n# Title: channel\n# Author: Maria Camila Herrera Ramos\n# Generated: Thu Aug 2 18:09:17 2018\n##################################################\n\n\nfrom gnuradio import analog\nfrom gnuradio import blocks...
false
6,203
ac978accc821600ad8def04b9c7423fbe6759e43
import re import datetime as dt from datetime import datetime import time import random import json import sys import requests import os import pickle import cv2 import numpy as np import cPickle import multiprocessing as mp import math root = "/datasets/sagarj/instaSample6000/" # post_dir = root + "/" videos_dir = r...
[ "import re\nimport datetime as dt\nfrom datetime import datetime\nimport time\nimport random\nimport json\nimport sys\nimport requests\nimport os\nimport pickle\nimport cv2\nimport numpy as np\nimport cPickle\nimport multiprocessing as mp\nimport math\n\nroot = \"/datasets/sagarj/instaSample6000/\"\n\n# post_dir = ...
true
6,204
d975b74370acc72101f808e70bef64cee39a5ab8
from typing import Dict, List from .power_bi_querier import PowerBiQuerier class DeathsByEthnicity(PowerBiQuerier): def __init__(self) -> None: self.source = 'd' self.name = 'deaths by race' self.property = 'race' super().__init__() def _parse_data(self, response_json: Dict[str...
[ "from typing import Dict, List\nfrom .power_bi_querier import PowerBiQuerier\n\nclass DeathsByEthnicity(PowerBiQuerier):\n def __init__(self) -> None:\n self.source = 'd'\n self.name = 'deaths by race'\n self.property = 'race'\n super().__init__()\n\n def _parse_data(self, response...
false
6,205
d37187f067ddff94015e639a1759dddced817945
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import numpy as np import pandas as pd import lightgbm as lgb from typing import List, Text, Tuple, Union from ...model.base import ModelFT from ...data.dataset import DatasetH from ...data.dataset.handler import DataHandlerLP from ...model.inter...
[ "# Copyright (c) Microsoft Corporation.\n# Licensed under the MIT License.\n\nimport numpy as np\nimport pandas as pd\nimport lightgbm as lgb\nfrom typing import List, Text, Tuple, Union\nfrom ...model.base import ModelFT\nfrom ...data.dataset import DatasetH\nfrom ...data.dataset.handler import DataHandlerLP\nfrom...
false
6,206
09d13fe6b090850782feb601412cf135d497136f
from catalyst_rl.contrib.registry import ( Criterion, CRITERIONS, GRAD_CLIPPERS, Model, MODELS, Module, MODULES, Optimizer, OPTIMIZERS, Sampler, SAMPLERS, Scheduler, SCHEDULERS, Transform, TRANSFORMS ) from catalyst_rl.core.registry import Callback, CALLBACKS from catalyst_rl.utils.tools.registry import Reg...
[ "from catalyst_rl.contrib.registry import (\n Criterion, CRITERIONS, GRAD_CLIPPERS, Model, MODELS, Module, MODULES,\n Optimizer, OPTIMIZERS, Sampler, SAMPLERS, Scheduler, SCHEDULERS, Transform,\n TRANSFORMS\n)\nfrom catalyst_rl.core.registry import Callback, CALLBACKS\nfrom catalyst_rl.utils.tools.registry...
false
6,207
cb29ee8687b469923896ceb7d5a6cd7f54b2c34e
#!flask/bin/python import os, json import requests SENDGRID_API_KEY = os.environ.get('SENDGRID_API_KEY', default=None) FROM_EMAIL = os.environ.get('FROM_EMAIL', default=None) TO_EMAIL = os.environ.get('TO_EMAIL', default=None) if not SENDGRID_API_KEY: raise ValueError("Need to set Sendgrid API Key (SENDGRID_API_K...
[ "#!flask/bin/python\nimport os, json\nimport requests\n\nSENDGRID_API_KEY = os.environ.get('SENDGRID_API_KEY', default=None)\nFROM_EMAIL = os.environ.get('FROM_EMAIL', default=None)\nTO_EMAIL = os.environ.get('TO_EMAIL', default=None)\n\nif not SENDGRID_API_KEY:\n raise ValueError(\"Need to set Sendgrid API Key ...
false
6,208
cf07344808f2d91d8949cfc4beb9f923926e6851
import numpy as np import pickle as p from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt from numpy.random import randn from neural_network import network net = network([1,8,8,1], filename='./data/x', bias=True) # net.load_random() net.load() n = 32 x = np.array([[x] for x in np.linspace(0,1,n)]...
[ "import numpy as np\nimport pickle as p\nfrom mpl_toolkits.mplot3d import axes3d\nimport matplotlib.pyplot as plt\nfrom numpy.random import randn\nfrom neural_network import network\n\nnet = network([1,8,8,1], filename='./data/x', bias=True)\n# net.load_random()\nnet.load()\n\nn = 32\n\nx = np.array([[x] for x in n...
false
6,209
8fcbaf2663c22015a0c47f00c2d4fb8db6a5c308
# from models import dist_model # model = dist_model.DistModel() from os.path import join import models import util.util as util import matplotlib.pylab as plt use_gpu = True fig_outdir = r"C:\Users\ponce\OneDrive - Washington University in St. Louis\ImageDiffMetric" #%% net_name = 'squeeze' SpatialDist = models.Percep...
[ "# from models import dist_model\n# model = dist_model.DistModel()\nfrom os.path import join\nimport models\nimport util.util as util\nimport matplotlib.pylab as plt\nuse_gpu = True\nfig_outdir = r\"C:\\Users\\ponce\\OneDrive - Washington University in St. Louis\\ImageDiffMetric\"\n#%%\nnet_name = 'squeeze'\nSpatia...
false
6,210
4a2437d3d6ba549910bc30a67bf391b9bbafd25f
from django.shortcuts import render from django.http import HttpResponseRedirect from .forms import PostForm from django.contrib.auth.decorators import login_required from django.shortcuts import get_object_or_404 from .models import Post from django.contrib import messages # Create your views here. @login_required def...
[ "from django.shortcuts import render\nfrom django.http import HttpResponseRedirect\nfrom .forms import PostForm\nfrom django.contrib.auth.decorators import login_required\nfrom django.shortcuts import get_object_or_404\nfrom .models import Post\nfrom django.contrib import messages\n# Create your views here.\n@login...
false
6,211
dd59f3b1d8b17defe4e7f30fec594d01475319d2
# -*- coding: utf-8 -*- """ Created on Sat May 2 21:31:37 2020 @author: Emmanuel Torres Molina """ """ Ejercicio 10 del TP2 de Teoría de los Circuitos II: Un tono de 45 KHz y 200 mV de amplitud es distorsionada por un tono de 12 KHz y 2V de amplitud. Diseñar un filtro pasa altos que atenúe la señal inter...
[ "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Sat May 2 21:31:37 2020\r\n\r\n@author: Emmanuel Torres Molina\r\n\"\"\"\r\n\r\n\"\"\"\r\nEjercicio 10 del TP2 de Teoría de los Circuitos II:\r\nUn tono de 45 KHz y 200 mV de amplitud es distorsionada por un tono de 12 KHz \r\ny 2V de amplitud. Diseñar un filtro pas...
false
6,212
869bbc8da8cdb5de0bcaf5664b5482814daae53a
import requests import codecs import urllib.request import time from bs4 import BeautifulSoup from html.parser import HTMLParser import re import os #input Result_File="report.txt" #deleting result file if exists if os.path.exists(Result_File): os.remove(Result_File) #reading html file and parsing logic f=codecs.o...
[ "import requests\nimport codecs\nimport urllib.request\nimport time\nfrom bs4 import BeautifulSoup\nfrom html.parser import HTMLParser\nimport re\nimport os\n\n#input\nResult_File=\"report.txt\"\n\n#deleting result file if exists\nif os.path.exists(Result_File):\n os.remove(Result_File)\n\n#reading html file and p...
false
6,213
774e607c693fa2d5199582302e466674f65b6449
# 다이얼 dial = ['ABC', 'DEF', 'GHI','JKL','MNO','PQRS','TUV','WXYZ'] cha = input() num = 0 for i in range(len(cha)): for j in dial: if cha[i] in j: num = num + dial.index(j) + 3 print(num)
[ "# 다이얼\ndial = ['ABC', 'DEF', 'GHI','JKL','MNO','PQRS','TUV','WXYZ']\ncha = input()\n\nnum = 0\nfor i in range(len(cha)):\n for j in dial:\n if cha[i] in j:\n num = num + dial.index(j) + 3\nprint(num)", "dial = ['ABC', 'DEF', 'GHI', 'JKL', 'MNO', 'PQRS', 'TUV', 'WXYZ']\ncha = input()\nnum = 0...
false
6,214
0d6490ae5f60ef21ad344e20179bd1b0f6aa761e
n=int(input("n=")) x=int(input("x=")) natija=pow(n,x)+pow(6,x) print(natija)
[ "n=int(input(\"n=\"))\r\nx=int(input(\"x=\"))\r\nnatija=pow(n,x)+pow(6,x)\r\nprint(natija)", "n = int(input('n='))\nx = int(input('x='))\nnatija = pow(n, x) + pow(6, x)\nprint(natija)\n", "<assignment token>\nprint(natija)\n", "<assignment token>\n<code token>\n" ]
false
6,215
a1e54a0f593149c1d97e64342c99f0ab8aa28fa9
""" Guess the number! """ import random, generic def check_answer(player_guess, guess_value): """ Compares a player's guess and the number to guess Returns True if the player guessed correctly Returns False by default """ end_game = False if player_guess > guess_value: print('guess too high!') elif playe...
[ "\"\"\" Guess the number! \"\"\"\n\nimport random, generic\n\n\ndef check_answer(player_guess, guess_value):\n\t\"\"\"\n\tCompares a player's guess and the number to guess\n\tReturns True if the player guessed correctly\n\tReturns False by default\n\t\"\"\"\n\n\tend_game = False\n\n\tif player_guess > guess_value:\...
false
6,216
63e96b41906f49f557529a0815da7314d74f6c33
width,height = int(input("Width? ")), int(input("Height? ")) on_row = 0 while on_row <= height: if on_row == 0 or on_row == height: print("*"*width) else: stars = "*" + " "*(width-2) + "*" print(stars) on_row += 1 # height = 0 # width = 0 # while True: # try: # height...
[ "width,height = int(input(\"Width? \")), int(input(\"Height? \"))\n\non_row = 0\nwhile on_row <= height:\n if on_row == 0 or on_row == height:\n print(\"*\"*width)\n else:\n stars = \"*\" + \" \"*(width-2) + \"*\"\n print(stars)\n on_row += 1\n\n\n# height = 0\n# width = 0\n\n# while T...
false
6,217
aef45cb8ea9fcaeffcca147da7637536bcc4b226
from rest_framework import viewsets from recruitment.serializers.LocationSerializer import LocationSerializer from recruitment.models.Location import Location import django_filters class LocationViewSet(viewsets.ModelViewSet): queryset = Location.objects.all().filter(deleted=0) serializer_class = LocationSer...
[ "from rest_framework import viewsets\nfrom recruitment.serializers.LocationSerializer import LocationSerializer\nfrom recruitment.models.Location import Location\n\nimport django_filters\n\n\nclass LocationViewSet(viewsets.ModelViewSet):\n queryset = Location.objects.all().filter(deleted=0)\n serializer_class...
false
6,218
34ecf2bd9bc72a98aba4584880a198dd24899dbe
import os, re DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:' } } INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.admin', 'django.contrib.sessions', 'django.contrib.contenttypes', 'django.contrib.sites', 'maintenancemode'...
[ "import os, re\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n 'NAME': ':memory:'\n }\n}\n\nINSTALLED_APPS = (\n 'django.contrib.auth',\n 'django.contrib.admin',\n 'django.contrib.sessions',\n 'django.contrib.contenttypes',\n 'django.contrib.sites',\n\n...
false
6,219
3ac69068db94f45bc44a8295a10603126d004b34
t = int(input()) m = 0 while(m < t): n = int(input()) arr = list(map(int, input().strip().split(" "))) s = int(input()) hash_map = {} curr_sum = 0 count = 0 for i in range(len(arr)): curr_sum += arr[i] if curr_sum == s: count += 1 if curr_sum - s in hash_m...
[ "t = int(input())\nm = 0\nwhile(m < t):\n n = int(input())\n arr = list(map(int, input().strip().split(\" \")))\n s = int(input())\n hash_map = {}\n curr_sum = 0\n count = 0\n for i in range(len(arr)):\n curr_sum += arr[i]\n if curr_sum == s:\n count += 1\n if cu...
false
6,220
3da4896f368f067a339db5cc89201c93ba8166ce
from __future__ import annotations import asyncio import signal from functools import wraps from typing import TYPE_CHECKING, Awaitable, Callable import click from .utils import import_obj if TYPE_CHECKING: from donald.manager import Donald from .types import TV def import_manager(path: str) -> Donald: ...
[ "from __future__ import annotations\n\nimport asyncio\nimport signal\nfrom functools import wraps\nfrom typing import TYPE_CHECKING, Awaitable, Callable\n\nimport click\n\nfrom .utils import import_obj\n\nif TYPE_CHECKING:\n from donald.manager import Donald\n\n from .types import TV\n\n\ndef import_manager(p...
false
6,221
4c0c88f46c2d4607d9ac00755bf122e847ea2f6a
"""Datasets, Dataloaders, and utils for dataloading""" from enum import Enum import torch from torch.utils.data import Dataset class Partition(Enum): """Names of dataset partitions""" TRAIN = 'train' VAL = 'val' TEST = 'test' class RandomClassData(Dataset): """Standard normal distributed feature...
[ "\"\"\"Datasets, Dataloaders, and utils for dataloading\"\"\"\nfrom enum import Enum\nimport torch\nfrom torch.utils.data import Dataset\n\n\nclass Partition(Enum):\n \"\"\"Names of dataset partitions\"\"\"\n TRAIN = 'train'\n VAL = 'val'\n TEST = 'test'\n\n\nclass RandomClassData(Dataset):\n \"\"\"S...
false
6,222
fd7fe2e4ffaa4de913931e83fd1de40f79b08d98
from django.shortcuts import render from django.http import response, HttpResponse, Http404 from django.views.generic import TemplateView from django.db.models import Q # Create your views here. class Countries(TemplateView): template_name = 'home.html' def get_context_data(self, **kwargs): return Cou...
[ "from django.shortcuts import render\nfrom django.http import response, HttpResponse, Http404\nfrom django.views.generic import TemplateView\nfrom django.db.models import Q\n# Create your views here.\n\nclass Countries(TemplateView):\n template_name = 'home.html'\n\n def get_context_data(self, **kwargs):\n ...
false
6,223
4cd1e385d18086b1045b1149d5f4573eaf9270c3
''' leetcode 338. 比特位计数 给定一个非负整数 num。对于 0 ≤ i ≤ num 范围中的每个数字 i ,计算其二进制数中的 1 的数目并将它们作为数组返回。 ''' class Solution(object): def countBits(self, n): """ :type n: int :rtype: List[int] """ out = [0] * (n+1) for i in range(1,n+1,1): if i%2==1: out[i]=o...
[ "'''\r\nleetcode 338. 比特位计数\r\n给定一个非负整数 num。对于 0 ≤ i ≤ num 范围中的每个数字 i ,计算其二进制数中的 1 的数目并将它们作为数组返回。\r\n'''\r\nclass Solution(object):\r\n def countBits(self, n):\r\n \"\"\"\r\n :type n: int\r\n :rtype: List[int]\r\n \"\"\"\r\n out = [0] * (n+1)\r\n for i in range(1,n+1,1):...
false
6,224
28eb1d7a698480028fb64827746b3deec0f66a9a
def erato(n): m = int(n ** 0.5) sieve = [True for _ in range(n+1)] sieve[1] = False for i in range(2, m+1): if sieve[i]: for j in range(i+i, n+1, i): sieve[j] = False return sieve input() l = list(map(int, input().split())) max_n = max(l) prime_l = erato(max_n) ...
[ "def erato(n):\n m = int(n ** 0.5)\n sieve = [True for _ in range(n+1)]\n sieve[1] = False\n\n for i in range(2, m+1):\n if sieve[i]:\n for j in range(i+i, n+1, i):\n sieve[j] = False\n return sieve\n\ninput()\nl = list(map(int, input().split()))\nmax_n = max(l)\nprim...
false
6,225
82801ce564f4f29e084e6f842d7868eb60f582cb
from pymt_heat import Heatmodel heat = Heatmodel() n = heat.get_component_name() print(n)
[ "from pymt_heat import Heatmodel\n\n\nheat = Heatmodel()\nn = heat.get_component_name()\nprint(n)\n", "from pymt_heat import Heatmodel\nheat = Heatmodel()\nn = heat.get_component_name()\nprint(n)\n", "<import token>\nheat = Heatmodel()\nn = heat.get_component_name()\nprint(n)\n", "<import token>\n<assignment...
false
6,226
ff6b7e2097d78b013f8f5989adee47156579cb9e
from flask import Flask from flask import request from flask import session from flask import jsonify from flask import make_response import mariadb import datetime import json import scad_utils testing: bool = True if testing: fake_datetime = datetime.datetime(2020, 8, 7, 15, 10) app = Flask(__name__) app.confi...
[ "from flask import Flask\nfrom flask import request\nfrom flask import session\nfrom flask import jsonify\nfrom flask import make_response\nimport mariadb\nimport datetime\nimport json\nimport scad_utils\n\ntesting: bool = True\nif testing:\n fake_datetime = datetime.datetime(2020, 8, 7, 15, 10)\n\n\napp = Flask...
false
6,227
77b43d7d9cd6b912bcee471c564b47d7a7cdd552
from flask_wtf import FlaskForm from wtforms import StringField, SubmitField from wtforms.validators import DataRequired, Length from flask_ckeditor import CKEditorField class BoldifyEncryptForm(FlaskForm): boldMessage = StringField('Bolded Message: ', validators=[DataRequired()]) submi...
[ "from flask_wtf import FlaskForm\nfrom wtforms import StringField, SubmitField\nfrom wtforms.validators import DataRequired, Length\nfrom flask_ckeditor import CKEditorField\n\nclass BoldifyEncryptForm(FlaskForm):\n boldMessage = StringField('Bolded Message: ',\n validators=[DataRequired()...
false
6,228
cad00f80afa142b69ced880de000b6b5b230640c
import pandas as pd import numpy as np import random import csv import pprint import datamake import dafunc_H def simulation(cnt, a, b): df, df_collist = datamake.make_df( '/Users/masato/Desktop/UTTdata/prog/PyProgramming/DA_algorithm/Mavo/csvdata/sinhuri2018.csv' ) n, m, k = datamake.stu_num() ...
[ "import pandas as pd\nimport numpy as np\nimport random\nimport csv\nimport pprint\nimport datamake\nimport dafunc_H\n\n\ndef simulation(cnt, a, b):\n df, df_collist = datamake.make_df(\n '/Users/masato/Desktop/UTTdata/prog/PyProgramming/DA_algorithm/Mavo/csvdata/sinhuri2018.csv'\n )\n n, m, k = dat...
false
6,229
58c7b405096a5fdc5eeacb5e5f314f2d1bb85af6
#!/usr/bin/python import argparse import os import subprocess import batch vmc_dir = os.environ['VMCWORKDIR'] macro = os.path.join(vmc_dir, 'macro/koala/daq_tasks/export_ems.C') exec_bin = os.path.join(vmc_dir,'build/bin/koa_execute') # arguments definitions parser = argparse.ArgumentParser() parser.add_argument("in...
[ "#!/usr/bin/python\n\nimport argparse\nimport os\nimport subprocess\nimport batch\n\nvmc_dir = os.environ['VMCWORKDIR']\nmacro = os.path.join(vmc_dir, 'macro/koala/daq_tasks/export_ems.C')\nexec_bin = os.path.join(vmc_dir,'build/bin/koa_execute')\n\n# arguments definitions\nparser = argparse.ArgumentParser()\nparse...
false
6,230
86928f4358e4999a5cec8bfad1fe055c9a2778d1
""" Create all figures and Excel files that combine data from all embryos in a given genetic background Copyright (C) 2017 Ahmet Ay, Dong Mai, Soo Bin Kwon, Ha Vu This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software ...
[ "\"\"\"\nCreate all figures and Excel files that combine data from all embryos in a given genetic background\nCopyright (C) 2017 Ahmet Ay, Dong Mai, Soo Bin Kwon, Ha Vu\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe ...
false
6,231
378032a8d02bc49e5ed8ebccbeddfbb281c2cbd7
v0 = 5 g = 9.81 t = 0.6 y=v0*t - 0.5*g*t**2 print (y)
[ "v0 = 5\r\ng = 9.81\r\nt = 0.6\r\ny=v0*t - 0.5*g*t**2\r\nprint (y)", "v0 = 5\ng = 9.81\nt = 0.6\ny = v0 * t - 0.5 * g * t ** 2\nprint(y)\n", "<assignment token>\nprint(y)\n", "<assignment token>\n<code token>\n" ]
false
6,232
aebf1d64923c5f325c9d429be092deaa06f20963
#!/usr/bin/env python import sys def add_them(a, b): return a + b def main(): print add_them(10, 21) if __name__ == '__main__': sys.exit(main())
[ "#!/usr/bin/env python\n\nimport sys\n\ndef add_them(a, b):\n return a + b\n\ndef main():\n print add_them(10, 21)\n\nif __name__ == '__main__':\n sys.exit(main())\n" ]
true
6,233
81a53d08ab36e85dd49cf1f3d9c22c1f18605149
#!/usr/bin/python #encoding=utf8 import sys import tushare as ts def local_main(): if len(sys.argv) != 2: print sys.argv[0], " [stock id]" return stock_id = sys.argv[1] df = ts.get_hist_data(stock_id) df.to_excel(stock_id + '_his.xlsx', sheet_name = stock_id) if __name__ == '__main__...
[ "#!/usr/bin/python\n#encoding=utf8\n\nimport sys\nimport tushare as ts\n\ndef local_main():\n if len(sys.argv) != 2:\n print sys.argv[0], \" [stock id]\"\n return\n\n stock_id = sys.argv[1]\n df = ts.get_hist_data(stock_id)\n df.to_excel(stock_id + '_his.xlsx', sheet_name = stock_id)\n\nif...
true
6,234
e3de072d6bce2ecc105306c06b9a9aa0362130ff
""" Auxiliary functions for calculating the utility of achieving a certain data rate (for a UE). Attention: The absolute reward that's achieved with different utilities cannot be compared directly (diff ranges)! """ import numpy as np from deepcomp.util.constants import MIN_UTILITY, MAX_UTILITY def linear_clipped_ut...
[ "\"\"\"\nAuxiliary functions for calculating the utility of achieving a certain data rate (for a UE).\nAttention: The absolute reward that's achieved with different utilities cannot be compared directly (diff ranges)!\n\"\"\"\nimport numpy as np\n\nfrom deepcomp.util.constants import MIN_UTILITY, MAX_UTILITY\n\n\nd...
false
6,235
164665c7d037f1e4128d8227d5fc148940d5c2b8
#!/bin/python import sys arr = map(int, raw_input().strip().split(' ')) smallest = 1000000001 largest = 0 smi = -1 lri = -1 for i, num in enumerate(arr): if num < smallest: smallest = num smi = i if num > largest: largest = num lri = i smsum = 0 lrsum = 0 for i in range(len(a...
[ "#!/bin/python\n\nimport sys\n\narr = map(int, raw_input().strip().split(' '))\n\nsmallest = 1000000001\nlargest = 0\nsmi = -1\nlri = -1\nfor i, num in enumerate(arr):\n if num < smallest:\n smallest = num\n smi = i\n if num > largest:\n largest = num\n lri = i\n\nsmsum = 0\nlrsum ...
true
6,236
aebe749a20482636d7ed508f9cbd9cde56656b73
#!/usr/bin/env python # # This will take a snapshot and convert it into a volume. To create a volume # without any links to the old snapshot you need to convert it to a temporary # volume first, convert that into an image and convert the image back into # your final volume. Once this is all done, the temporary volume a...
[ "#!/usr/bin/env python\n#\n# This will take a snapshot and convert it into a volume. To create a volume\n# without any links to the old snapshot you need to convert it to a temporary\n# volume first, convert that into an image and convert the image back into\n# your final volume. Once this is all done, the temporar...
false
6,237
6f253da5dc1caa504a3a8aadae7bce6537b5c8c6
# Exercise 3: Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error message. # If the score is between 0.0 and 1.0, print a grade using the following table: # Score Grade # >= 0.9 A # >= 0.8 B # >= 0.7 C # >= 0.6 D # < 0.6 F # Vinayak Nayak # 27...
[ "# Exercise 3: Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error message.\n# If the score is between 0.0 and 1.0, print a grade using the following table:\n# Score Grade\n# >= 0.9 A\n# >= 0.8 B\n# >= 0.7 C\n# >= 0.6 D\n# < 0.6 F\n\n# Vina...
false
6,238
dfee0407eaed7b1ab96467874bbfe6463865bcb4
from __future__ import absolute_import, print_function, unicode_literals import six from six.moves import zip, filter, map, reduce, input, range import pathlib import unittest import networkx as nx import multiworm TEST_ROOT = pathlib.Path(__file__).parent.resolve() DATA_DIR = TEST_ROOT / 'data' SYNTH1 = DATA_DIR ...
[ "from __future__ import absolute_import, print_function, unicode_literals\nimport six\nfrom six.moves import zip, filter, map, reduce, input, range\n\nimport pathlib\nimport unittest\n\nimport networkx as nx\n\nimport multiworm\n\n\nTEST_ROOT = pathlib.Path(__file__).parent.resolve()\nDATA_DIR = TEST_ROOT / 'data'\...
false
6,239
4d4dd451d83d8d602c6264e77f52e5e143aef307
import tensorflow as tf import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' sess = tf.Session() # 1.one-shot iterator dataset = tf.data.Dataset.range(100) iterator = dataset.make_one_shot_iterator() next_element = iterator.get_next() for i in range(100): value = sess.run(next_element) # print(value) assert i == v...
[ "import tensorflow as tf\nimport os\nos.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'\n\nsess = tf.Session()\n# 1.one-shot iterator\ndataset = tf.data.Dataset.range(100)\niterator = dataset.make_one_shot_iterator()\nnext_element = iterator.get_next()\nfor i in range(100):\n value = sess.run(next_element)\n # print(value)...
false
6,240
ac35672661e1dd0b97567ae4335f537dc69f98f7
########################################################### # 2019-02-07: 删除了marginalized prior # ########################################################### import sys,os import numpy as np import matplotlib.pylab as plt from scipy.linalg import eig from scipy.stats import norm, kstest, normaltest # use default col...
[ "\n###########################################################\n# 2019-02-07: 删除了marginalized prior\n#\n###########################################################\n\nimport sys,os\nimport numpy as np\nimport matplotlib.pylab as plt\nfrom scipy.linalg import eig\nfrom scipy.stats import norm, kstest, normaltest\n\n...
false
6,241
deeba82536d0366b3793bcbe78f78e4cfeabb612
def solution(n, money): save = [0] * (n+1) save[0] = 1 for i in range(len(money)): for j in range(1, n+1): if j - money[i] >= 0: save[j] += (save[j - money[i]] % 1000000007) return save[n]
[ "def solution(n, money):\r\n save = [0] * (n+1)\r\n save[0] = 1\r\n for i in range(len(money)):\r\n for j in range(1, n+1):\r\n if j - money[i] >= 0:\r\n save[j] += (save[j - money[i]] % 1000000007)\r\n return save[n]", "def solution(n, money):\n save = [0] * (n + 1...
false
6,242
c24be05700e5ee043d09d6f2e78cb3de1e7088f1
#!/usr/bin/env python # vim: set fileencoding=utf-8 : # Andre Anjos <andre.anjos@idiap.ch> # Sat Dec 17 14:41:56 2011 +0100 # # Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland """Run tests on the libsvm machine infrastructure. """ import os import numpy import tempfile import pkg_resources imp...
[ "#!/usr/bin/env python\n# vim: set fileencoding=utf-8 :\n# Andre Anjos <andre.anjos@idiap.ch>\n# Sat Dec 17 14:41:56 2011 +0100\n#\n# Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland\n\n\"\"\"Run tests on the libsvm machine infrastructure.\n\"\"\"\n\nimport os\nimport numpy\nimport tempfile\n...
false
6,243
2ab6488276c74da8c3d9097d298fc53d1caf74b1
import numpy import numpy.fft import numpy.linalg import copy from astropy.io import fits from scipy.interpolate import RectBivariateSpline from scipy.signal import convolve import offset_index # some basic definitions psSize = 9 # psSize x psSize postage stamps of stars # zero padded RectBivariateSpline, if on def R...
[ "import numpy\nimport numpy.fft\nimport numpy.linalg\nimport copy\nfrom astropy.io import fits\nfrom scipy.interpolate import RectBivariateSpline\nfrom scipy.signal import convolve\nimport offset_index\n\n# some basic definitions\npsSize = 9 # psSize x psSize postage stamps of stars\n\n# zero padded RectBivariateSp...
false
6,244
050f060bb9d3d46f8b87c9802356bd0da8f926f8
with open('rosalind_ba3d.txt','r') as f: kmer_length = int(f.readline().strip()) seq = f.readline().strip() dict = {} for offset in range(len(seq)-kmer_length+1): prefix = seq[offset:offset+kmer_length-1] suffix = seq[offset+1:offset+kmer_length] if prefix in dict: dict[prefix].append(suffix) else: ...
[ "with open('rosalind_ba3d.txt','r') as f:\r\n\tkmer_length = int(f.readline().strip())\r\n\tseq = f.readline().strip()\r\n\r\ndict = {}\r\nfor offset in range(len(seq)-kmer_length+1):\r\n\tprefix = seq[offset:offset+kmer_length-1]\r\n\tsuffix = seq[offset+1:offset+kmer_length]\r\n\tif prefix in dict:\r\n\t\tdict[pr...
false
6,245
e50c1ef7368aabf53bc0cfd45e19101fa1519a1f
import os from typing import List from pypinyin import pinyin, lazy_pinyin # map vowel-number combination to unicode toneMap = { "d": ['ā', 'ē', 'ī', 'ō', 'ū', 'ǜ'], "f": ['á', 'é', 'í', 'ó', 'ú', 'ǘ'], "j": ['ǎ', 'ě', 'ǐ', 'ǒ', 'ǔ', 'ǚ'], "k": ['à', 'è', 'ì', 'ò', 'ù', 'ǜ'], } weightMap = {} def g...
[ "import os\nfrom typing import List\n\nfrom pypinyin import pinyin, lazy_pinyin\n\n# map vowel-number combination to unicode\ntoneMap = {\n \"d\": ['ā', 'ē', 'ī', 'ō', 'ū', 'ǜ'],\n \"f\": ['á', 'é', 'í', 'ó', 'ú', 'ǘ'],\n \"j\": ['ǎ', 'ě', 'ǐ', 'ǒ', 'ǔ', 'ǚ'],\n \"k\": ['à', 'è', 'ì', 'ò', 'ù', 'ǜ'],\n}...
false
6,246
71e7a209f928672dbf59054b120eed6a77522dde
from springframework.web.servlet import ModelAndView from springframework.web.servlet.HandlerAdapter import HandlerAdapter from springframework.web.servlet.mvc.Controller import Controller from springframework.web.servlet.mvc.LastModified import LastModified from springframework.utils.mock.inst import ( HttpServlet...
[ "from springframework.web.servlet import ModelAndView\nfrom springframework.web.servlet.HandlerAdapter import HandlerAdapter\nfrom springframework.web.servlet.mvc.Controller import Controller\nfrom springframework.web.servlet.mvc.LastModified import LastModified\nfrom springframework.utils.mock.inst import (\n H...
false
6,247
94a3a74260fac58b4cad7422608f91ae3a1a0272
from inotifier import Notifier from IPython.display import display, Audio, HTML import pkg_resources import time class AudioPopupNotifier(Notifier): """Play Sound and show Popup upon cell completion""" def __init__(self, message="Cell Completed", audio_file="pad_confirm.wav"): super(AudioPopupNotifi...
[ "from inotifier import Notifier\nfrom IPython.display import display, Audio, HTML\n\nimport pkg_resources\nimport time\n\n\nclass AudioPopupNotifier(Notifier):\n \"\"\"Play Sound and show Popup upon cell completion\"\"\"\n\n def __init__(self, message=\"Cell Completed\", audio_file=\"pad_confirm.wav\"):\n ...
false
6,248
3b71ef6c3681b8c5e6aadf2d125c35cbf3a12661
import loops class Card(): #to make a card you must type Card("Name of Card") def check_cat(self,string): if "Cat" in string: return True return False def __init__(self,string): self.type = string self.cat = self.check_cat(self.type) # self.ima...
[ "import loops\r\n\r\nclass Card():\r\n #to make a card you must type Card(\"Name of Card\")\r\n def check_cat(self,string):\r\n if \"Cat\" in string:\r\n return True\r\n return False\r\n def __init__(self,string):\r\n self.type = string\r\n self.cat = self.check_cat(s...
false
6,249
5762271de166994b2f56e8e09c3f7ca5245b7ce0
import binascii import collections import enum Balance = collections.namedtuple("Balance", ["total", "available", "reward"]) Balance.__doc__ = "Represents a balance of asset, including total, principal and reward" Balance.total.__doc__ = "The total balance" Balance.available.__doc__ = "The principal, i.e. the total m...
[ "import binascii\nimport collections\nimport enum\n\n\nBalance = collections.namedtuple(\"Balance\", [\"total\", \"available\", \"reward\"])\nBalance.__doc__ = \"Represents a balance of asset, including total, principal and reward\"\nBalance.total.__doc__ = \"The total balance\"\nBalance.available.__doc__ = \"The p...
false
6,250
f0a03f9a6dc78d01455913f7db3ab1948b19ea63
vocales = "aeiou" resultado = [] frase = input("Por favor ingrese la frase que desea verificar").lower() print(frase) for vocal in vocales: conteo_vocales = frase.count(vocal) mensaje = (f"En la frase hay {conteo_vocales} veces, la vocal{vocal}") resultado.append(mensaje) for elemento in resultado: p...
[ "vocales = \"aeiou\"\nresultado = []\n\nfrase = input(\"Por favor ingrese la frase que desea verificar\").lower()\nprint(frase)\n\nfor vocal in vocales:\n conteo_vocales = frase.count(vocal)\n mensaje = (f\"En la frase hay {conteo_vocales} veces, la vocal{vocal}\")\n resultado.append(mensaje)\n\nfor elemen...
false
6,251
73337246bd54df53842360510148f3a6f4763ace
from .net import *
[ "from .net import *", "from .net import *\n", "<import token>\n" ]
false
6,252
6dc7c7de972388f3984a1238a2d62e53c60c622e
from django.test import TestCase from student.forms import StudentForm class ModelTest(TestCase): def test_expense_form_valid_data(self): form = StudentForm(data={ 'student_id': 500, 'firstName': "Emre", 'lastName': "Tan", 'department': "Panama", ...
[ "from django.test import TestCase\nfrom student.forms import StudentForm\n\n\nclass ModelTest(TestCase):\n\n def test_expense_form_valid_data(self):\n form = StudentForm(data={\n 'student_id': 500,\n 'firstName': \"Emre\",\n 'lastName': \"Tan\",\n 'department': ...
false
6,253
18b10a68b2707b7bfeccbd31c5d15686453b3406
# Copyright (c) 2020 Hai Nguyen # # This software is released under the MIT License. # https://opensource.org/licenses/MIT import tensorflow.keras.backend as K def dice_coef(y_true, y_pred): smooth = 1. y_true_f = K.flatten(y_true) y_pred_f = K.flatten(y_pred) intersection = K.sum(y_true_f * y_pred_...
[ "# Copyright (c) 2020 Hai Nguyen\n# \n# This software is released under the MIT License.\n# https://opensource.org/licenses/MIT\n\nimport tensorflow.keras.backend as K\n\n\ndef dice_coef(y_true, y_pred):\n smooth = 1.\n y_true_f = K.flatten(y_true)\n y_pred_f = K.flatten(y_pred)\n intersection = K.sum(y...
false
6,254
08abb94424598cb54a6b16db68759b216682d866
#------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: legolas # # Created: 05.03.2015 # Copyright: (c) legolas 2015 # Licence: <your licence> #------------------------------------------------------------------------------- print "T...
[ "#-------------------------------------------------------------------------------\n# Name: module1\n# Purpose:\n#\n# Author: legolas\n#\n# Created: 05.03.2015\n# Copyright: (c) legolas 2015\n# Licence: <your licence>\n#---------------------------------------------------------------------------...
true
6,255
b46a14c821777873eb60df609d9f112c737a3635
__author__ = 'Erwin' class usuario: def __init__(self, nombre, user, pasw, permiso, foto): self.nombre = nombre self.login = user self.pasw = pasw self.permiso = permiso self.foto=foto self.database=True class medicamento: def __init__(self, nombre , descripcion...
[ "__author__ = 'Erwin'\n\nclass usuario:\n def __init__(self, nombre, user, pasw, permiso, foto):\n self.nombre = nombre\n self.login = user\n self.pasw = pasw\n self.permiso = permiso\n self.foto=foto\n self.database=True\n\nclass medicamento:\n def __init__(self, nom...
false
6,256
05052e9ccbd076e71e9ec6148887ce7b82ed316d
from flask import Flask, render_template, request from distance import get_distance app = Flask(__name__) @app.route('/hello') @app.route('/hello/<name>') def hello(name=None): name = "World" if not name else name return "Hello %s" % name @app.route('/') def index(): return render_template('index.html'...
[ "from flask import Flask, render_template, request\nfrom distance import get_distance\n\napp = Flask(__name__)\n\n\n@app.route('/hello')\n@app.route('/hello/<name>')\ndef hello(name=None):\n name = \"World\" if not name else name\n return \"Hello %s\" % name\n\n\n@app.route('/')\ndef index():\n return rend...
false
6,257
47c6f9767b97469fe7e97ab3b69650265a8021d8
import numpy as np np.set_printoptions(precision = 1) pi = np.pi def convertRadian(theta): radian = (theta) * (np.pi) / 180 return radian def mkMatrix(radian, alpha, dis): matrix = np.matrix([[np.cos(radian),(-1)*np.sin(radian)*np.cos(alpha), np.sin(radian)*np.sin(alpha), a1 * np.cos(radian)], ...
[ "import numpy as np\n\nnp.set_printoptions(precision = 1)\npi = np.pi\n\ndef convertRadian(theta):\n radian = (theta) * (np.pi) / 180\n return radian\n\ndef mkMatrix(radian, alpha, dis):\n matrix = np.matrix([[np.cos(radian),(-1)*np.sin(radian)*np.cos(alpha), np.sin(radian)*np.sin(alpha), a1 * np.cos(radia...
true
6,258
fa833e9cd1e624d9ecfb2fcc6d9e22955c9e4b1e
# -*- coding: utf-8 -*- """" Created on Saturday, January 18, 2020 @author: lieur This test case sets silver and gold to 0, which in most cases prevent the computer from buying provinces. This tests to see if the game ends when one more supply car hits 0 (since silver and gold are already at 0 and the game ends when...
[ "# -*- coding: utf-8 -*-\n\"\"\"\"\nCreated on Saturday, January 18, 2020\n\n@author: lieur\n\nThis test case sets silver and gold to 0, which in most cases prevent the computer from\nbuying provinces. This tests to see if the game ends when one more supply car hits 0 (since\nsilver and gold are already at 0 and t...
false
6,259
c3de9e6129bcafd863cd330ac281345fb563cc8c
"""The prediction classes. Instances of the class are returned by the recommender. """ class RelationshipPrediction(object): """The prediction of the predicted_relationship appearing between the given subject-object pair. @type subject: the domain-specific subject @ivar subject: the subject ...
[ "\"\"\"The prediction classes. Instances of the class are returned by \nthe recommender.\n\"\"\"\n\nclass RelationshipPrediction(object):\n \"\"\"The prediction of the predicted_relationship appearing between\n the given subject-object pair.\n \n @type subject: the domain-specific subject\n @ivar sub...
false
6,260
a520a93ed2dcd26b9470ed56e96b65a1b3550176
# -*- coding: utf-8 -*- ''' Created on 2014-03-25 @author: ZhaoJianning Modified by WangHairui on 2014-09-12 ''' import unittest import Stability import time import os,sys import runtests import re import android import datetime class TestCamera(unittest.TestCase): def setUp(self): ...
[ "# -*- coding: utf-8 -*-\r\n'''\r\nCreated on 2014-03-25\r\n\r\n@author: ZhaoJianning\r\nModified by WangHairui on 2014-09-12\r\n'''\r\n\r\nimport unittest\r\nimport Stability\r\nimport time\r\nimport os,sys\r\nimport runtests\r\nimport re\r\nimport android\r\nimport datetime\r\n\r\nclass TestCamera(unittest.TestCa...
true
6,261
2a95a68d8570a314b2b6e5731d7a695e5d7e7b30
#This program is a nice example of a core algorithm #Remove Individual Digits # To remove individual digits you use two operations # 1 MOD: # mod return the remainder after division. 5%2 = 1. # If we mod by 10 we get the units digit. 723%10 = 3 # 2 Integer Division: # Integer division is when we divide and remove de...
[ "#This program is a nice example of a core algorithm\n#Remove Individual Digits\n# To remove individual digits you use two operations\n# 1 MOD:\n\t# mod return the remainder after division. 5%2 = 1.\n\t# If we mod by 10 we get the units digit. 723%10 = 3\n# 2 Integer Division:\n#\tInteger division is when we divid...
false
6,262
6cb29ebd9c0f2660d0eb868bec87ffd97cf4d198
""" A set of constants to describe the package. Don't put any code in here, because it must be safe to execute in setup.py. """ __title__ = 'space_tracer' # => name in setup.py __version__ = '4.10.2' __author__ = "Don Kirkby" __author_email__ = "donkirkby@gmail.com" __description__ = "Trade time for space when debug...
[ "\"\"\" A set of constants to describe the package.\n\nDon't put any code in here, because it must be safe to execute in setup.py. \"\"\"\n\n__title__ = 'space_tracer' # => name in setup.py\n__version__ = '4.10.2'\n__author__ = \"Don Kirkby\"\n__author_email__ = \"donkirkby@gmail.com\"\n__description__ = \"Trade t...
false
6,263
51cd74bff5a0883a7bee2b61b152aecb2c5ccc66
import sys sys.path.append("/home/mccann/bin/python/obsolete") from minuit import * execfile("/home/mccann/antithesis/utilities.py") nobeam = getsb("cos") ebeam = getsb("bge") pbeam = getsb("bgp") import gbwkf import gbwkftau runstart = pickle.load(open("/home/mccann/antithesis/old_dotps/runstart.p")) runend = pickle....
[ "import sys\nsys.path.append(\"/home/mccann/bin/python/obsolete\")\n\nfrom minuit import *\nexecfile(\"/home/mccann/antithesis/utilities.py\")\nnobeam = getsb(\"cos\")\nebeam = getsb(\"bge\")\npbeam = getsb(\"bgp\")\nimport gbwkf\nimport gbwkftau\nrunstart = pickle.load(open(\"/home/mccann/antithesis/old_dotps/runs...
true
6,264
97ff8dae060475b0efbc8d39e9fc251be8ac091b
from __future__ import annotations import ibis from ibis import _ def test_format_sql_query_result(con, snapshot): t = con.table("airlines") query = """ SELECT carrier, mean(arrdelay) AS avg_arrdelay FROM airlines GROUP BY 1 ORDER BY 2 DESC """ schema = ibis.schema({"...
[ "from __future__ import annotations\n\nimport ibis\nfrom ibis import _\n\n\ndef test_format_sql_query_result(con, snapshot):\n t = con.table(\"airlines\")\n\n query = \"\"\"\n SELECT carrier, mean(arrdelay) AS avg_arrdelay\n FROM airlines\n GROUP BY 1\n ORDER BY 2 DESC\n \"\"\"\...
false
6,265
6f259210cbe8969046cba1031ab42d77e913abea
# -*- coding: utf-8 -*- from celery import shared_task from djcelery.models import PeriodicTask, CrontabSchedule import datetime from django.db.models import Max, Count from services import * # 测试任务 @shared_task() def excute_sql(x,y): print "%d * %d = %d" % (x, y, x * y) return x * y # 监控任务:查询数据库并进行告警 @sha...
[ "# -*- coding: utf-8 -*-\nfrom celery import shared_task\nfrom djcelery.models import PeriodicTask, CrontabSchedule\nimport datetime\nfrom django.db.models import Max, Count\n\nfrom services import *\n\n\n# 测试任务\n@shared_task()\ndef excute_sql(x,y):\n print \"%d * %d = %d\" % (x, y, x * y)\n return x * y\n\n\...
true
6,266
e52b01cc7363943f5f99b1fa74720c6447b1cfae
from setuptools import setup, find_packages __version__ = '2.0' setup( name='sgcharts-pointer-generator', version=__version__, python_requires='>=3.5.0', install_requires=[ 'tensorflow==1.10.0', 'pyrouge==0.1.3', 'spacy==2.0.12', 'en_core_web_sm==2.0.0', 'sgchar...
[ "from setuptools import setup, find_packages\n\n__version__ = '2.0'\n\nsetup(\n name='sgcharts-pointer-generator',\n version=__version__,\n python_requires='>=3.5.0',\n install_requires=[\n 'tensorflow==1.10.0',\n 'pyrouge==0.1.3',\n 'spacy==2.0.12',\n 'en_core_web_sm==2.0.0'...
false
6,267
88109909d0c80f25373f917426c3c3634bfc8114
import numpy as np from base_test import ArkoudaTest from context import arkouda as ak """ Encapsulates unit tests for the pdarrayclass module that provide summarized values via reduction methods """ class SummarizationTest(ArkoudaTest): def setUp(self): ArkoudaTest.setUp(self) self.na = np.linsp...
[ "import numpy as np\nfrom base_test import ArkoudaTest\nfrom context import arkouda as ak\n\n\"\"\"\nEncapsulates unit tests for the pdarrayclass module that provide\nsummarized values via reduction methods\n\"\"\"\n\n\nclass SummarizationTest(ArkoudaTest):\n def setUp(self):\n ArkoudaTest.setUp(self)\n ...
false
6,268
bd310ab0bc193410b8f93ad5516b0731d2eba54f
''' Various tools for cleaning out nulls and imputing '''
[ "'''\nVarious tools for cleaning out nulls and imputing \n'''\n", "<docstring token>\n" ]
false
6,269
33365d5ce5d2a7d28b76a7897de25e1f35d28855
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created for COMP5121 Lab on 2017 JUN 24 @author: King """ import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.svm import SVC import sklearn.metrics as metrics from sklearn.metrics import accuracy_score data = [[...
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated for COMP5121 Lab on 2017 JUN 24\n\n@author: King\n\"\"\"\n\nimport numpy as np\nimport pandas as pd\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.svm import SVC\nimport sklearn.metrics as metrics\nfrom sklearn.metrics import acc...
false
6,270
49d76458b8adcf6eea9db2ef127609ff96e03ad1
from django.contrib import admin from django.urls import path, include from serverside.router import router from rest_framework.authtoken import views as auth_views from . import views from .views import CustomObtainAuthToken urlpatterns = [ path('users/', views.UserCreateAPIView.as_view(), name='user-list'), ...
[ "from django.contrib import admin\nfrom django.urls import path, include\nfrom serverside.router import router\nfrom rest_framework.authtoken import views as auth_views\nfrom . import views\nfrom .views import CustomObtainAuthToken\n\nurlpatterns = [\n path('users/', views.UserCreateAPIView.as_view(), name='user...
false
6,271
db140bf66f3e3a84a60a6617ea4c03cc6a1bc56d
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Jan 31 13:42:47 2018 @author: zhan """ from scipy.spatial.distance import pdist, squareform, cdist import numpy as np import scipy.io as sci import os,sys import datetime ################################################################### # I_tr:featur...
[ "#!/usr/bin/env python2\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed Jan 31 13:42:47 2018\n\n@author: zhan\n\"\"\"\nfrom scipy.spatial.distance import pdist, squareform, cdist\nimport numpy as np\nimport scipy.io as sci\nimport os,sys\nimport datetime\n\n#########################################################...
true
6,272
b00c07ee3cdba55800c9701b7b8b0e3c9079e9f8
from util import * def K_step(x): if not x.shape: return S.One assert len(x.shape) == 1 n = x.shape[0] if n == 2: return x[1] return Piecewise((1, Equal(n, 1)), (x[1], Equal(n, 2)), (K(x[:n - 1]) * x[n - 1] + K(x[:n - 2]), True)) K = Fun...
[ "from util import *\n\n\n\ndef K_step(x):\n if not x.shape:\n return S.One\n assert len(x.shape) == 1\n n = x.shape[0]\n if n == 2:\n return x[1]\n return Piecewise((1, Equal(n, 1)),\n (x[1], Equal(n, 2)),\n (K(x[:n - 1]) * x[n - 1] + K(x[:n - 2])...
false
6,273
ad054febac3a04c625653a2f3864506eeb672d9e
... ... model = Sequential() model.add(Conv2D(32, kernel_size=3, input_shape=(256, 256, 3)) ... ...
[ "...\n...\nmodel = Sequential()\nmodel.add(Conv2D(32, kernel_size=3, input_shape=(256, 256, 3))\n...\n...\n" ]
true
6,274
939011fca968d5f9250beb29a0bb700200e637df
# coding: utf-8 """ Picarto.TV API Documentation The Picarto.TV API documentation Note, for fixed access tokens, the header that needs to be sent is of the format: `Authorization: Bearer yourTokenHere` This can be generated at https://oauth.picarto.tv/ For chat API, see https://docs.picarto.tv/chat/chat.pr...
[ "# coding: utf-8\n\n\"\"\"\n Picarto.TV API Documentation\n\n The Picarto.TV API documentation Note, for fixed access tokens, the header that needs to be sent is of the format: `Authorization: Bearer yourTokenHere` This can be generated at https://oauth.picarto.tv/ For chat API, see https://docs.picarto.tv...
false
6,275
025c740813f7eea37abadaa14ffe0d8c1bedc79d
""" Design and implement a TwoSum class. It should support the following operations: add and find. add - Add the number to an internal data structure. find - Find if there exists any pair of numbers which sum is equal to the value. Example 1: add(1); add(3); add(5); find(4) -> true find(7) -> false Example 2: add(3);...
[ "\"\"\"\nDesign and implement a TwoSum class. It should support the following operations: add and find.\nadd - Add the number to an internal data structure.\nfind - Find if there exists any pair of numbers which sum is equal to the value.\n\nExample 1:\nadd(1); add(3); add(5);\nfind(4) -> true\nfind(7) -> false\n\n...
false
6,276
760a5a168575a0ea12b93cb58c1e81e313704e35
# Generated by Django 2.2 on 2020-10-26 15:16 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('viajes', '0001_initial'), ] operations = [ migrations.AlterModelOptions( name='viajes', options={'verbose_name': 'Movilización...
[ "# Generated by Django 2.2 on 2020-10-26 15:16\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('viajes', '0001_initial'),\n ]\n\n operations = [\n migrations.AlterModelOptions(\n name='viajes',\n options={'verbose_n...
false
6,277
ee7efea569b685ad8d6922e403421227e9ea6922
from sklearn.linear_model import LinearRegression, LogisticRegression import numpy as np import pickle import os def Run(datasetFile): # Get file from user userFile = open(datasetFile, "r") # Starter list of all instances of the data file instanceList = [] instanceCount = 0 featureCou...
[ "from sklearn.linear_model import LinearRegression, LogisticRegression\nimport numpy as np\nimport pickle\nimport os\n\ndef Run(datasetFile):\n \n # Get file from user\n userFile = open(datasetFile, \"r\")\n \n # Starter list of all instances of the data file\n instanceList = []\n instanceCount...
false
6,278
659f45d2c6c7138f26b4a8d15d1710ae60450b08
from OTXv2 import OTXv2 from pandas.io.json import json_normalize from datetime import datetime, timedelta import getopt import sys from sendemail import sendemail from main import otx import csv import pandas as pd from pandas import read_csv import os.path def tools(): search = str(input('Please enter search: '...
[ "from OTXv2 import OTXv2\nfrom pandas.io.json import json_normalize\nfrom datetime import datetime, timedelta\nimport getopt\nimport sys\nfrom sendemail import sendemail\nfrom main import otx\nimport csv\nimport pandas as pd\nfrom pandas import read_csv\nimport os.path\n\ndef tools():\n\n search = str(input('Ple...
false
6,279
d5a5c6f9d483b2998cd0d9e47b37ab4499fa1c2a
import discord from discord.ext import commands class TestCommands(commands.Cog, description="Unstable test commands", command_attrs=dict(hidden=True, description="Can only be used by an Owner")): def __init__(self, bot): self.bot = bot self.hidden = True print("Loaded", __name__) as...
[ "import discord\nfrom discord.ext import commands\n\n\nclass TestCommands(commands.Cog, description=\"Unstable test commands\", command_attrs=dict(hidden=True, description=\"Can only be used by an Owner\")):\n def __init__(self, bot):\n self.bot = bot\n self.hidden = True\n print(\"Loaded\",...
false
6,280
818e6842d4a1f8978ec14bca06981ec933c00376
import os bind = "0.0.0.0:" + str(os.environ.get("MAESTRO_PORT", 5005)) workers = os.environ.get("MAESTRO_GWORKERS", 2)
[ "import os\n\nbind = \"0.0.0.0:\" + str(os.environ.get(\"MAESTRO_PORT\", 5005))\nworkers = os.environ.get(\"MAESTRO_GWORKERS\", 2)\n", "import os\nbind = '0.0.0.0:' + str(os.environ.get('MAESTRO_PORT', 5005))\nworkers = os.environ.get('MAESTRO_GWORKERS', 2)\n", "<import token>\nbind = '0.0.0.0:' + str(os.enviro...
false
6,281
ee03263d92372899ec1feaf3a8ea48677b053676
"""API - Files endpoints.""" import os import click import cloudsmith_api import requests from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor from .. import ratelimits from ..rest import create_requests_session from ..utils import calculate_file_md5 from .exceptions import ApiException, catch_rai...
[ "\"\"\"API - Files endpoints.\"\"\"\n\nimport os\n\nimport click\nimport cloudsmith_api\nimport requests\nfrom requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor\n\nfrom .. import ratelimits\nfrom ..rest import create_requests_session\nfrom ..utils import calculate_file_md5\nfrom .exceptions import ...
false
6,282
e0e00688a75021c2f8b608d4c942f5e68f6a6a48
# -*- coding:utf-8 -*- import re # 普通字符串 匹配本身 re_str = r'abc' result = re.fullmatch(re_str, 'abc') print(result) # 匹配任意字符 一个.只能匹配一个字符 re_str = r'a.c' result = re.fullmatch(re_str, 'abc') print(result) # \w匹配字母数字或下划线 # 匹配一个长度是5的字符串并且字符串的前两位是数字字母或者下划线后面是三个任意字符串 \w中文也能匹配 re_str = r'\w\w...' result = re.fullmatch(re_str, ...
[ "# -*- coding:utf-8 -*-\nimport re\n\n# 普通字符串 匹配本身\nre_str = r'abc'\nresult = re.fullmatch(re_str, 'abc')\nprint(result)\n# 匹配任意字符 一个.只能匹配一个字符\nre_str = r'a.c'\nresult = re.fullmatch(re_str, 'abc')\nprint(result)\n# \\w匹配字母数字或下划线\n# 匹配一个长度是5的字符串并且字符串的前两位是数字字母或者下划线后面是三个任意字符串 \\w中文也能匹配\nre_str = r'\\w\\w...'\nresult ...
false
6,283
4a8663531f303da29371078e34dc7224fc4580e3
# Author: Kenneth Lui <hkkenneth@gmail.com> # Last Updated on: 01-11-2012 ## Usage: python ~/code/python/001_Fastq_Trimming.py <FIRST BASE> <LAST BASE> <FASTQ FILES....> ## Bases are inclusive and 1-based #from Bio.SeqIO.QualityIO import FastqGeneralIterator #handle = open(sys.argv[2], 'w') #for title, seq, qual in Fa...
[ "# Author: Kenneth Lui <hkkenneth@gmail.com>\n# Last Updated on: 01-11-2012\n## Usage: python ~/code/python/001_Fastq_Trimming.py <FIRST BASE> <LAST BASE> <FASTQ FILES....>\n## Bases are inclusive and 1-based\n\n#from Bio.SeqIO.QualityIO import FastqGeneralIterator\n#handle = open(sys.argv[2], 'w')\n#for title, seq...
false
6,284
a2a94e87bb9af1ccaf516581d6662d776caf0b0d
""" Project: tomsim simulator Module: FunctionalUnit Course: CS2410 Author: Cyrus Ramavarapu Date: 19 November 2016 """ # DEFINES BUSY = 1 FREE = 0 class FunctionalUnit: """FunctionalUnit Class to encompass methods needed for Integer, Divide, Multipler, Load, Store Functional Units in tomsim ...
[ "\"\"\"\nProject: tomsim simulator\nModule: FunctionalUnit\nCourse: CS2410\nAuthor: Cyrus Ramavarapu\nDate: 19 November 2016\n\"\"\"\n\n# DEFINES\nBUSY = 1\nFREE = 0\n\n\nclass FunctionalUnit:\n \"\"\"FunctionalUnit Class to encompass methods needed for\n Integer, Divide, Multipler, Load, Store Functi...
false
6,285
549d7368d49cf2f4d2c6e83e300f31db981b62bd
#! import os import sys #get current working directory cwd = os.getcwd() ovjtools = os.getenv('OVJ_TOOLS') javaBinDir = os.path.join(ovjtools, 'java', 'bin') # get the envirionment env = Environment(ENV = {'JAVA_HOME' : javaBinDir, 'PATH' : javaBinDir + ':' + os.environ['PATH']}) env.Execut...
[ "#!\n\nimport os\nimport sys\n\n#get current working directory\ncwd = os.getcwd()\novjtools = os.getenv('OVJ_TOOLS')\njavaBinDir = os.path.join(ovjtools, 'java', 'bin')\n\n# get the envirionment\nenv = Environment(ENV = {'JAVA_HOME' : javaBinDir,\n 'PATH' : javaBinDir + ':' + os.environ['PAT...
false
6,286
b739a5d359b4d1c0323c7cd8234e4fe5eb9f3fcb
# -*- coding: utf-8 -*- import logging from django.contrib.auth import authenticate, login as django_login, logout as django_logout from django.contrib.auth.models import User from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.core.urlresolvers import reverse from django.db.utils imp...
[ "# -*- coding: utf-8 -*-\n\nimport logging\n\nfrom django.contrib.auth import authenticate, login as django_login, logout as django_logout\nfrom django.contrib.auth.models import User\nfrom django.core.paginator import Paginator, EmptyPage, PageNotAnInteger\nfrom django.core.urlresolvers import reverse\nfrom django...
false
6,287
2a83bc9157e2210da46e58c56fc0b7199856f4c0
msg = "eduardo foi a feira" if 'feira' in msg: print('Sim, foi a feira') else: print('não ele não foi a feira')
[ "msg = \"eduardo foi a feira\"\n\nif 'feira' in msg:\n print('Sim, foi a feira')\nelse:\n print('não ele não foi a feira')\n", "msg = 'eduardo foi a feira'\nif 'feira' in msg:\n print('Sim, foi a feira')\nelse:\n print('não ele não foi a feira')\n", "<assignment token>\nif 'feira' in msg:\n print...
false
6,288
adf8b52f6e71546b591ceb34a9425c28f74883fa
#!/usr/bin/env python # -*- coding: UTF-8 -*- """Project Euler: 0010 https://projecteuler.net/problem=10 Summation of primes The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. """ import math import sys PROBLEM = 10 SOLVED = True SPEED = 29.16 TAGS = ['primes']...
[ "#!/usr/bin/env python\n# -*- coding: UTF-8 -*-\n\"\"\"Project Euler: 0010\n\nhttps://projecteuler.net/problem=10\n\nSummation of primes\n\nThe sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.\n\nFind the sum of all the primes below two million.\n\"\"\"\n\nimport math\nimport sys\n\nPROBLEM = 10\nSOLVED = True\nSP...
true
6,289
4a892c3532a3e3ddcd54705336dce820ff49b91b
""" Copyright (c) 2018, salesforce.com, inc. All rights reserved. SPDX-License-Identifier: BSD-3-Clause For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause Graph Search Policy Network. """ from typing import List, NamedTuple, Union import torch import tor...
[ "\"\"\"\n Copyright (c) 2018, salesforce.com, inc.\n All rights reserved.\n SPDX-License-Identifier: BSD-3-Clause\n For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause\n \n Graph Search Policy Network.\n\"\"\"\nfrom typing import List, NamedTuple, Union\n\nim...
false
6,290
31b420adebbe0d3ee6da2ed8236ece1526bdb063
for _ in range(int(input())): n = int(input()) s = input() cur = 0 for i in s[::-1]: if i==')': cur+=1 else: break print("Yes") if cur>n//2 else print("No")
[ "for _ in range(int(input())):\r\n n = int(input())\r\n s = input()\r\n cur = 0\r\n for i in s[::-1]:\r\n if i==')':\r\n cur+=1\r\n else:\r\n break\r\n print(\"Yes\") if cur>n//2 else print(\"No\")\r\n", "for _ in range(int(input())):\n n = int(input())\n s...
false
6,291
c70b4ff26abe3d85e41bfc7a32cf6e1ce4c48d07
import pytest import torch from homura.utils.containers import Map, TensorTuple def test_map(): map = Map(a=1, b=2) map["c"] = 3 for k, v in map.items(): assert map[k] == getattr(map, k) for k in ["update", "keys", "items", "values", "clear", "copy", "get", "pop"]: with pytest.raises...
[ "import pytest\nimport torch\n\nfrom homura.utils.containers import Map, TensorTuple\n\n\ndef test_map():\n map = Map(a=1, b=2)\n map[\"c\"] = 3\n for k, v in map.items():\n assert map[k] == getattr(map, k)\n\n for k in [\"update\", \"keys\", \"items\", \"values\", \"clear\", \"copy\", \"get\", \...
false
6,292
9efd83524ebb598f30c8fb6c0f9f0c65333578e6
#implement variable! import numpy as np class Variable: def __init__(self, data): self.data = data class Function: ''' Base class specific functions are implemented in the inherited class ''' def __call__(self, input): x = input.data #data extract y = self.foward(x) ...
[ "#implement variable!\nimport numpy as np\n\nclass Variable:\n def __init__(self, data):\n self.data = data\n\nclass Function:\n '''\n Base class\n specific functions are implemented in the inherited class\n '''\n def __call__(self, input): \n x = input.data #data extract\n y ...
false
6,293
e8eac1e4433eee769d317de9ba81d5181168fdca
#!/usr/bin/python3 # -*- coding: utf-8 -*- """"""""""""""""""""""""""""""""""""""""""""""" " Filename: time.py " " Author: xss - callmexss@126.com " Description: Show local time " Create: 2018-07-02 20:20:17 """"""""""""""""""""""""""""""""""""""""""""""" from datetime import datetime print('''\...
[ "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\" Filename: time.py\n\"\n\" Author: xss - callmexss@126.com\n\" Description: Show local time\n\" Create: 2018-07-02 20:20:17\n\"\"\"\"\"\"\"\"\"\"\"\"\"...
false
6,294
9f86ff37d3a72364b5bd83e425d8151136c07dd3
#!/usr/bin/env python # -*- coding: UTF-8 -*- # from __future__ import absolute_import, division, print_function, unicode_literals from collections import defaultdict import os import torch import numpy as np import pickle from sklearn.linear_model import Ridge, Lasso from biplnn.log import getLogger from biplnn.utils...
[ "#!/usr/bin/env python\n# -*- coding: UTF-8 -*-\n#\n\nfrom __future__ import absolute_import, division, print_function, unicode_literals\nfrom collections import defaultdict\nimport os\nimport torch\nimport numpy as np\nimport pickle\nfrom sklearn.linear_model import Ridge, Lasso\nfrom biplnn.log import getLogger\n...
false
6,295
5a3b88f899cfb71ffbfac3a78d38b748bffb2e43
# coding=utf-8 import tensorflow as tf import numpy as np state = [[1.0000037e+00, 1.0000037e+00, 1.0000000e+00, 4.5852923e-01], [1.0000000e+00, 1.0000000e+00, 1.0000000e+00, 8.3596563e-01], [1.0000478e+00, 1.0000000e+00, 1.0000478e+00, 1.4663711e+00], [1.0000037e+00, 1.0000478e+00, 1.00000...
[ "# coding=utf-8\n\nimport tensorflow as tf\nimport numpy as np\n\nstate = [[1.0000037e+00, 1.0000037e+00, 1.0000000e+00, 4.5852923e-01],\n [1.0000000e+00, 1.0000000e+00, 1.0000000e+00, 8.3596563e-01],\n [1.0000478e+00, 1.0000000e+00, 1.0000478e+00, 1.4663711e+00],\n [1.0000037e+00, 1.0000478...
false
6,296
4d524bb4b88b571c9567c651be1b1f1f19fd3c0b
#Recursively parse a string for a pattern that can be either 1 or 2 characters long
[ "#Recursively parse a string for a pattern that can be either 1 or 2 characters long", "" ]
false
6,297
af217d0cc111f425282ee21bd47d9007a69a6239
import math print ("programa que calcula hipotenusa tomando el valor de los catetos en tipo double---") print ("------------------------------------------------------------------------") print (" ") catA = float(input("igrese el valor del cateto A")) catB = float(input("ingrese el valor del catebo B")) def calcularHi...
[ "import math\nprint (\"programa que calcula hipotenusa tomando el valor de los catetos en tipo double---\")\nprint (\"------------------------------------------------------------------------\")\nprint (\" \")\n\ncatA = float(input(\"igrese el valor del cateto A\"))\ncatB = float(input(\"ingrese el valor del catebo ...
false
6,298
fde62dd3f5ee3cc0a1568b037ada14835c327046
import tkinter as tk import tkinter.messagebox as tkmb import psutil import os import re import subprocess from subprocess import Popen, PIPE, STDOUT, DEVNULL import filecmp import re import time import threading import datetime import re debian = '/etc/debian_version' redhat = '/etc/redhat-release' def PrintaLog(tex...
[ "import tkinter as tk\nimport tkinter.messagebox as tkmb\nimport psutil\nimport os\nimport re\nimport subprocess\nfrom subprocess import Popen, PIPE, STDOUT, DEVNULL\nimport filecmp\nimport re\nimport time\nimport threading\nimport datetime\nimport re\n\ndebian = '/etc/debian_version'\nredhat = '/etc/redhat-release...
false
6,299
596814032218c3db746f67e54e4f1863753aea06
# -*- coding: utf-8 -*- # @Time : 2019/3/21 20:12 # @Author : for # @File : test01.py # @Software: PyCharm import socket s=socket.socket() host=socket.gethostname() port=3456 s.connect((host,port)) cmd=input(">>>") s.sendall(cmd.encode()) data=s.recv(1024) print(data.decode()) s.close()
[ "# -*- coding: utf-8 -*-\r\n# @Time : 2019/3/21 20:12\r\n# @Author : for \r\n# @File : test01.py\r\n# @Software: PyCharm\r\nimport socket\r\n\r\ns=socket.socket()\r\n\r\nhost=socket.gethostname()\r\nport=3456\r\ns.connect((host,port))\r\n\r\ncmd=input(\">>>\")\r\ns.sendall(cmd.encode())\r\ndata=s.recv(1024)\...
false