index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
6,000
ff3f6d50498f58f3a340e2d690165efcc1a5fb1d
class User: account = [] def __init__(self,balance,int_rate): self.balance = balance self.int_rate = int_rate User.account.append(self) def dep(self,amount): self.balance += amount return self def make_withdrawal(self,amount): if(self.balance-amount) >= 0...
[ "class User:\n account = []\n def __init__(self,balance,int_rate):\n self.balance = balance\n self.int_rate = int_rate\n User.account.append(self)\n def dep(self,amount):\n self.balance += amount\n return self\n\n def make_withdrawal(self,amount):\n if(self.bala...
false
6,001
72c1226d40b3cdce29ef28493344c3cf68892149
# Generated by Django 3.0.4 on 2020-03-29 19:51 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('index', '0003_auto_20200330_0444'), ] operations = [ migrations.AlterField( model_name='information', name='comment'...
[ "# Generated by Django 3.0.4 on 2020-03-29 19:51\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('index', '0003_auto_20200330_0444'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='information',\n ...
false
6,002
780dc49c3eaef3fb25ca0aac760326b1c3adc633
#!/usr/bin/env python # Copyright (C) 2014 Open Data ("Open Data" refers to # one or more of the following companies: Open Data Partners LLC, # Open Data Research LLC, or Open Data Capital LLC.) # # This file is part of Hadrian. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this...
[ "#!/usr/bin/env python\n\n# Copyright (C) 2014 Open Data (\"Open Data\" refers to\n# one or more of the following companies: Open Data Partners LLC,\n# Open Data Research LLC, or Open Data Capital LLC.)\n# \n# This file is part of Hadrian.\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you...
false
6,003
699410536c9a195024c5abbcccc88c17e8e095e3
############################################################ # Hierarchical Reinforcement Learning for Relation Extraction # Multiprocessing with CUDA # Require: PyTorch 0.3.0 # Author: Tianyang Zhang, Ryuichi Takanobu # E-mail: keavilzhangzty@gmail.com, truthless11@gmail.com ###########################################...
[ "############################################################\n# Hierarchical Reinforcement Learning for Relation Extraction\n# Multiprocessing with CUDA\n# Require: PyTorch 0.3.0\n# Author: Tianyang Zhang, Ryuichi Takanobu\n# E-mail: keavilzhangzty@gmail.com, truthless11@gmail.com\n################################...
false
6,004
a89724be31b4ccc1a3d83305509d9624da364a0c
import sys def solution(input): k = 1 for v in sorted(input): if v >= k: k += 1 return k - 1 testcase = sys.stdin.readline() for i in range(int(testcase)): sys.stdin.readline() line1 = sys.stdin.readline().rstrip('\n') line2 = sys.stdin.readline().rstrip('\n') ans = sol...
[ "import sys\n\ndef solution(input):\n k = 1\n for v in sorted(input):\n if v >= k:\n k += 1\n return k - 1\n\ntestcase = sys.stdin.readline()\nfor i in range(int(testcase)):\n sys.stdin.readline()\n line1 = sys.stdin.readline().rstrip('\\n')\n line2 = sys.stdin.readline().rstrip(...
false
6,005
21c8078a18ee4579fa9b4b1b667d6ea0c1ce99b3
# Generated by Django 2.1.3 on 2019-04-10 11:04 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog', '0014_auto_20190409_1917'), ] operations = [ migrations.AlterField( model_name='article', name='estArchive', ...
[ "# Generated by Django 2.1.3 on 2019-04-10 11:04\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('blog', '0014_auto_20190409_1917'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='article',\n ...
false
6,006
e08ab06be0957e5e173df798742abc493eac84d0
import time import numpy as np import matplotlib.pyplot as plt import cv2 import matplotlib.image as mpimg import random import skimage import scipy from PIL import Image def readimg(dirs, imgname): img = cv2.imread(dirs + imgname) img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) return img def readimg_color(d...
[ "import time\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport cv2\nimport matplotlib.image as mpimg\nimport random\nimport skimage\nimport scipy\nfrom PIL import Image\n\ndef readimg(dirs, imgname):\n img = cv2.imread(dirs + imgname)\n img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)\n return img\n\...
false
6,007
c77db71844c65eb96946ac0cc384de43ad49ca99
import math def math_builtins(): assert abs(-123) == 123 assert abs(-123.456) == 123.456 assert abs(2+3j) == math.sqrt(2**2 + 3**2) assert divmod(5, 2) == (2, 1) assert max(1, 2, 3, 4) == 4 assert min(1, 2, 3, 4) == 1 a = 2 b = 3 c = 7 assert pow(a, b) == a ** b assert po...
[ "import math\n\n\ndef math_builtins():\n assert abs(-123) == 123\n assert abs(-123.456) == 123.456\n assert abs(2+3j) == math.sqrt(2**2 + 3**2)\n\n assert divmod(5, 2) == (2, 1)\n assert max(1, 2, 3, 4) == 4\n assert min(1, 2, 3, 4) == 1\n\n a = 2\n b = 3\n c = 7\n assert pow(a, b) == ...
false
6,008
f69544a9123f1738cd7d21c1b4fc02dd73fb9d1b
'''Module main''' import argparse import api import quoridor import quoridorx def analyser_commande(): '''Analyseur de ligne de commande.''' parser = argparse.ArgumentParser(description='Jeu Quoridor - phase 3') parser.add_argument("idul", help="IDUL du joueur.") parser.add_argument("-l", '--lister'...
[ "'''Module main'''\nimport argparse\nimport api\nimport quoridor\nimport quoridorx\n\n\ndef analyser_commande():\n '''Analyseur de ligne de commande.'''\n parser = argparse.ArgumentParser(description='Jeu Quoridor - phase 3')\n\n parser.add_argument(\"idul\", help=\"IDUL du joueur.\")\n\n parser.add_arg...
false
6,009
ef3fa538828315845de5e2f7d4949f690e44276e
""" Flask app for testing the OpenID Connect extension. """ import json from unittest.mock import MagicMock, Mock from flask import Flask, g import flask_oidc from tests.json_snippets import * oidc = None def index(): return "too many secrets", 200, { 'Content-Type': 'text/plain; charset=utf-8' } ...
[ "\"\"\"\nFlask app for testing the OpenID Connect extension.\n\"\"\"\n\nimport json\nfrom unittest.mock import MagicMock, Mock\n\nfrom flask import Flask, g\nimport flask_oidc\nfrom tests.json_snippets import *\n\noidc = None\n\n\ndef index():\n return \"too many secrets\", 200, {\n 'Content-Type': 'text/...
false
6,010
9dfc8414628a8b09de3c24c504dd4163efdd3d35
# This is main file where we create the instances of Movie class # and run the file to view the movie website page # we have to import media where class Movie is defined and # fresh_tomatoes python files import fresh_tomatoes import media # Each instance has 8 arguments: Title, story line, poster image, # trailer url...
[ "# This is main file where we create the instances of Movie class\n# and run the file to view the movie website page\n\n# we have to import media where class Movie is defined and\n# fresh_tomatoes python files\nimport fresh_tomatoes\nimport media\n\n# Each instance has 8 arguments: Title, story line, poster image,\...
false
6,011
83733e707a1be131335c4980cdf4beed365eb530
from simulating_blobs_of_fluid.simulation import Simulation from simulating_blobs_of_fluid.fluid_renderer import FluidRenderer import arcade def main(): simulation = Simulation(particle_count=50, dt=0.016, box_width=250) FluidRenderer(simulation.box_width, 800, simulation) arcade.run() if __name__ == ...
[ "from simulating_blobs_of_fluid.simulation import Simulation\nfrom simulating_blobs_of_fluid.fluid_renderer import FluidRenderer\n\nimport arcade\n\n\ndef main():\n simulation = Simulation(particle_count=50, dt=0.016, box_width=250)\n FluidRenderer(simulation.box_width, 800, simulation)\n\n arcade.run()\n\...
false
6,012
a4492af775899ec2dcc0cac44b2740edd8422273
import copy import random def parse_arrow(string): return tuple(string.split(' -> ')) def parse_sig(string, vals=None): parts = string.split() if len(parts) == 1: return resolve(parts[0], vals) elif parts[1] == 'AND': return resolve(parts[0], vals) & resolve(parts[2], vals) elif ...
[ "import copy\nimport random\n\n\ndef parse_arrow(string):\n return tuple(string.split(' -> '))\n\n\ndef parse_sig(string, vals=None):\n parts = string.split()\n if len(parts) == 1:\n return resolve(parts[0], vals)\n elif parts[1] == 'AND':\n return resolve(parts[0], vals) & resolve(parts[2...
true
6,013
918db455fc50b49ca2b40dd78cecdec4ba08dcb8
import math # 计算像素点属于哪个中心点 from utils.util import distance def attenuation(color, last_mean): return 1 - math.exp(((distance(color, last_mean) / 80) ** 2) * -1) def get_Count_By_distance(centers, pixel_use,d): # d_min设置过低会产生多的中心点,许多很相似但是没有归到一类中 # d_min设置过高产生少的中心点,不相似的归到一类中 d_min = 1; d_b = d; ...
[ "import math\n\n# 计算像素点属于哪个中心点\nfrom utils.util import distance\n\n\ndef attenuation(color, last_mean):\n return 1 - math.exp(((distance(color, last_mean) / 80) ** 2) * -1)\ndef get_Count_By_distance(centers, pixel_use,d):\n\n # d_min设置过低会产生多的中心点,许多很相似但是没有归到一类中\n # d_min设置过高产生少的中心点,不相似的归到一类中\n d_min = 1...
false
6,014
b66f588149d160c119f9cc24af3acb9f64432d6e
import dash import dash_html_components as html app = dash.Dash(__name__) app.layout = html.H1("Hello dashboard") if __name__ == "__main__": app.run_server(debug=False, port=8080, host="127.0.0.1")
[ "import dash\nimport dash_html_components as html\n\napp = dash.Dash(__name__)\napp.layout = html.H1(\"Hello dashboard\")\n\nif __name__ == \"__main__\":\n app.run_server(debug=False, port=8080, host=\"127.0.0.1\")\n", "import dash\nimport dash_html_components as html\napp = dash.Dash(__name__)\napp.layout = h...
false
6,015
10bf7959f178d3b5c0ce6e97253e665d32363af7
#!/usr/bin/env python # KMeans # 参考 https://qiita.com/g-k/items/0d5d22a12a4507ecbf11 # # データを適当なクラスタに分けた後、クラスタの平均を用いてうまい具合にデータがわかれるように調整させていくアルゴリズム # 任意の指定のk個のクラスタを作成するアルゴリズムであることから、k-means法(k点平均法と呼ばれている) # k-meansの初期値選択の弱点を解消したのが、k-means++ # k-means++では、中心点が互いに遠いところに配置されるような確率が高くなるように操作する。 # 教師なし学習のアルゴ...
[ "#!/usr/bin/env python\r\n\r\n# KMeans\r\n# 参考 https://qiita.com/g-k/items/0d5d22a12a4507ecbf11\r\n# \r\n# データを適当なクラスタに分けた後、クラスタの平均を用いてうまい具合にデータがわかれるように調整させていくアルゴリズム\r\n# 任意の指定のk個のクラスタを作成するアルゴリズムであることから、k-means法(k点平均法と呼ばれている)\r\n\r\n# k-meansの初期値選択の弱点を解消したのが、k-means++\r\n# k-means++では、中心点が互いに遠いところに配置されるような確率が高くなるよ...
false
6,016
16cc85324b555f0cfec8d577b776b86872578822
# Given an array of integers, return indices of the two numbers such that they add up to a specific target. # You may assume that each input would have exactly one solution, and you may not use the same element twice. # Example: # Given nums = [2, 7, 11, 15], target = 9, # Because nums[0] + nums[1] = 2 + 7 = 9, # retu...
[ "# Given an array of integers, return indices of the two numbers such that they add up to a specific target.\n# You may assume that each input would have exactly one solution, and you may not use the same element twice.\n\n# Example:\n# Given nums = [2, 7, 11, 15], target = 9,\n# Because nums[0] + nums[1] = 2 + 7 =...
false
6,017
f98d6dd9ac4714c24ce070a1a81dc4610d04b97e
# -*- coding: UTF-8 -*- # File Name: ll.py # Author: Sam # mail: samyunwei@163.com # Created Time: 2016年03月09日 星期三 19时18分02秒 ######################################################################### #!/usr/bin/env python def checkmark(marks): if not isinstance(marks,list): return 'marks Error' else: ...
[ "# -*- coding: UTF-8 -*- \n# File Name: ll.py\n# Author: Sam\n# mail: samyunwei@163.com\n# Created Time: 2016年03月09日 星期三 19时18分02秒\n#########################################################################\n#!/usr/bin/env python\ndef checkmark(marks):\n if not isinstance(marks,list):\n return 'marks Error...
true
6,018
8b2911586e21162bec074732216c410c591f18a8
from django.shortcuts import render from django.http import HttpResponse from django.contrib.auth.models import User from .models import Museo, Distrito, Comentario, Favorito, Like, Titulo, Letra, Color from django.views.decorators.csrf import csrf_exempt from django.contrib.auth import authenticate, login from django....
[ "from django.shortcuts import render\nfrom django.http import HttpResponse\nfrom django.contrib.auth.models import User\nfrom .models import Museo, Distrito, Comentario, Favorito, Like, Titulo, Letra, Color\nfrom django.views.decorators.csrf import csrf_exempt\nfrom django.contrib.auth import authenticate, login\nf...
false
6,019
f76185095ebb1adbf7ae22ffb500ffc3d6b0a30d
#!/usr/bin/env python3 """ This file contains all the required methods for the street prediction utilizing the Hough transform. """ import numpy as np import scipy.ndimage as ndi from skimage.draw import polygon from skimage.transform import hough_line def draw_roads(roads, shape): """ Creates an image wit...
[ "#!/usr/bin/env python3\n\n\"\"\"\nThis file contains all the required methods for the street prediction utilizing\nthe Hough transform.\n\"\"\"\n\nimport numpy as np\nimport scipy.ndimage as ndi\n\nfrom skimage.draw import polygon\nfrom skimage.transform import hough_line\n\n\ndef draw_roads(roads, shape):\n \"...
false
6,020
c5f41b69ac215bd661ee39bdc8c3119db9606ca8
import os, json, locale, requests, dash, dash_table, copy, time, flask, base64 import dash_core_components as dcc import dash_html_components as html import plotly.graph_objects as go import pandas as pd from os import listdir import plotly.figure_factory as ff from concurrent.futures import ThreadPoolExecutor, Process...
[ "import os, json, locale, requests, dash, dash_table, copy, time, flask, base64\nimport dash_core_components as dcc\nimport dash_html_components as html\nimport plotly.graph_objects as go\nimport pandas as pd\nfrom os import listdir\nimport plotly.figure_factory as ff\nfrom concurrent.futures import ThreadPoolExecu...
false
6,021
95163a28a35cc88240d9d6edc2e9b416e5493909
import json import sys with open(sys.argv[1], 'r') as f: x = json.load(f) with open('my_wire_to_quartus_wire.json', 'r') as f: wirenamemap = json.load(f) print("----- There are {} muxes in the database".format(len(x))) print("----- There are {} routing pairs in the database".format(sum((len(v) for k, v in x.i...
[ "import json\nimport sys\n\nwith open(sys.argv[1], 'r') as f:\n x = json.load(f)\nwith open('my_wire_to_quartus_wire.json', 'r') as f:\n wirenamemap = json.load(f)\n\nprint(\"----- There are {} muxes in the database\".format(len(x)))\nprint(\"----- There are {} routing pairs in the database\".format(sum((len(...
false
6,022
f5a953d91e95d82e84e3e6d18ee89d28ba1b1515
import asyncio import multiprocessing from concurrent.futures import ProcessPoolExecutor from apscheduler.schedulers.asyncio import AsyncIOScheduler from datetime import datetime import time from apscheduler.schedulers.blocking import BlockingScheduler from apscheduler.triggers.combining import OrTrigger from apschedu...
[ "import asyncio\nimport multiprocessing\nfrom concurrent.futures import ProcessPoolExecutor\nfrom apscheduler.schedulers.asyncio import AsyncIOScheduler\nfrom datetime import datetime\nimport time\n\nfrom apscheduler.schedulers.blocking import BlockingScheduler\nfrom apscheduler.triggers.combining import OrTrigger\...
true
6,023
ca0aedcfb997299240870649823fb872e0d9f99a
from accessor import * from order import Order from copy import deepcopy import pandas as pd import numpy as np import util class Broker: def __init__(self, equity): self.execute = Execute(equity) # Execute def make_order(self, unit, limit_price, stop_loss, stop_profit): ord...
[ "from accessor import *\r\nfrom order import Order\r\nfrom copy import deepcopy\r\nimport pandas as pd\r\nimport numpy as np\r\nimport util\r\n\r\n\r\nclass Broker:\r\n def __init__(self, equity):\r\n\r\n self.execute = Execute(equity) # Execute\r\n\r\n def make_order(self, unit, limit_price, stop_los...
false
6,024
4156b003210a41d6ec8f30e2d20adfb1f4b3deb0
import torch from torchvision import datasets, transforms from torch.utils.data import Dataset, DataLoader # load the data Set from torch.utils.data import random_split from torchvision.datasets import ImageFolder batch_size = 256 data_dir = 'nut_snacks/dataset/' data_transforms = transfor...
[ "import torch\nfrom torchvision import datasets, transforms\nfrom torch.utils.data import Dataset, DataLoader\n # load the data Set\n\nfrom torch.utils.data import random_split\nfrom torchvision.datasets import ImageFolder\n\n\nbatch_size = 256\ndata_dir = 'nut_snacks/dataset/'\n\ndata_tran...
false
6,025
9bd63181de024c2f4517defa9ed51bdbc8d610d2
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from urllib import request,parse # req = request.Request('https://api.douban.com/v2/book/2129650') # req.add_header('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36') # with request.urlopen(req) as f:...
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nfrom urllib import request,parse\n\n# req = request.Request('https://api.douban.com/v2/book/2129650')\n# req.add_header('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36')\n# with request.urlope...
false
6,026
3605e8b8b2f8f49cc7c40fc436c147578b12091c
from . import metrics from . import matrices from .pairwise import apply_pairwise_rect, apply_pairwise_sparse, apply_running_rect from . import numba_tools as nb_tools from . import running_metrics as running __all__ = ['metrics', 'apply_pairwise_rect', 'apply_pairwise_sparse', 'apply_...
[ "from . import metrics\nfrom . import matrices\nfrom .pairwise import apply_pairwise_rect, apply_pairwise_sparse, apply_running_rect\nfrom . import numba_tools as nb_tools\nfrom . import running_metrics as running\n\n__all__ = ['metrics',\n 'apply_pairwise_rect',\n 'apply_pairwise_sparse',\n ...
false
6,027
1dd223854c10e69a397098511eab50b9ebd347c8
# My Godzilla Hat Code - @alt_bier from adafruit_circuitplayground.express import cpx import random #cpx.pixels.brightness = 0.5 # 50 pct cpx.pixels.fill((0, 0, 0)) # Turn off the NeoPixels if they're on! # Function to give us a nice color swirl on the built in NeoPixel (R,G,B) def wheeln(pos, sft): if (pos + sf...
[ "# My Godzilla Hat Code - @alt_bier\nfrom adafruit_circuitplayground.express import cpx\nimport random\n\n#cpx.pixels.brightness = 0.5 # 50 pct\ncpx.pixels.fill((0, 0, 0)) # Turn off the NeoPixels if they're on!\n\n# Function to give us a nice color swirl on the built in NeoPixel (R,G,B)\ndef wheeln(pos, sft):\n ...
false
6,028
ecbc1da3efb39300b60aeb47897fb01b6bd7af31
import code2 print ("Main en code1: %s\n" % __name__)
[ "\nimport code2\nprint (\"Main en code1: %s\\n\" % __name__)\n", "import code2\nprint('Main en code1: %s\\n' % __name__)\n", "<import token>\nprint('Main en code1: %s\\n' % __name__)\n", "<import token>\n<code token>\n" ]
false
6,029
4d9064add28302fe173a8b0a81ee7d187db8aead
from typing import Any from typing import List from xsdata.codegen.mixins import RelativeHandlerInterface from xsdata.codegen.models import Attr from xsdata.codegen.models import Class from xsdata.models.enums import Tag from xsdata.utils.namespaces import build_qname class ClassEnumerationHandler(RelativeHandlerInt...
[ "from typing import Any\nfrom typing import List\n\nfrom xsdata.codegen.mixins import RelativeHandlerInterface\nfrom xsdata.codegen.models import Attr\nfrom xsdata.codegen.models import Class\nfrom xsdata.models.enums import Tag\nfrom xsdata.utils.namespaces import build_qname\n\n\nclass ClassEnumerationHandler(Rel...
false
6,030
bc8bc5c3b6954302d005fe618827c644f93ad14e
### 15/04/2020 ### Author: Omer Goder ### Looping through a list months = ['january','fabruary','march','april','may','june','july','august','september','october','november','december'] # Using a for loop to print a list for month in months: print("The next month is:\t" + month) print('\n') print("\nEnd ...
[ "### 15/04/2020\r\n### Author: Omer Goder\r\n### Looping through a list\r\n\r\nmonths = ['january','fabruary','march','april','may','june','july','august','september','october','november','december']\r\n\r\n# Using a for loop to print a list\r\nfor month in months:\r\n\tprint(\"The next month is:\\t\" + month)\r\n...
false
6,031
2464da1c4d2ddab3a053f0a14e3cc9a8beabe031
from MyFeistel import MyFeistel, LengthPreservingCipher import pytest import base64 import os class TestMyFeistel: def test_Functionality(self): key = base64.urlsafe_b64encode(os.urandom(16)) feistel = MyFeistel(key, 10) # decrypt(encrypt(msg)) == msg for i in xrange(20): ...
[ "from MyFeistel import MyFeistel, LengthPreservingCipher\nimport pytest\nimport base64\nimport os\n\nclass TestMyFeistel:\n def test_Functionality(self):\n key = base64.urlsafe_b64encode(os.urandom(16))\n feistel = MyFeistel(key, 10)\n\n # decrypt(encrypt(msg)) == msg\n for i in xrang...
false
6,032
e0075e4afafba9da70bbcb2ee073b5c1f7782d7d
import numpy as np import scipy.signal as sp from common import * class Processor: def __init__(self, sr, **kwargs): self.samprate = float(sr) self.hopSize = kwargs.get("hopSize", roundUpToPowerOf2(self.samprate * 0.005)) self.olaFac = int(kwargs.get("olaFac", 2)) def analyze(self, x)...
[ "import numpy as np\nimport scipy.signal as sp\n\nfrom common import *\n\nclass Processor:\n def __init__(self, sr, **kwargs):\n self.samprate = float(sr)\n self.hopSize = kwargs.get(\"hopSize\", roundUpToPowerOf2(self.samprate * 0.005))\n self.olaFac = int(kwargs.get(\"olaFac\", 2))\n\n ...
false
6,033
8b4bc312bf4b64f98c4f84f4bf89984291be0428
# Generated by Django 3.1.7 on 2021-03-19 14:38 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('news', '0002_auto_202103...
[ "# Generated by Django 3.1.7 on 2021-03-19 14:38\n\nfrom django.conf import settings\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n migrations.swappable_dependency(settings.AUTH_USER_MODEL),\n ('news', '...
false
6,034
75741d11bebcd74b790efe7e5633d4507e65a25f
class HashTable: def __init__(self): self.size = 11 self.slots = [None] * self.size self.data = [None] * self.size def put(self, key, data): # there are three situations, #1. the hashvalue returned by hashfunction of the slot is empty, just put the key in that slot, and the data in the datalist hashvalu...
[ "class HashTable:\n\tdef __init__(self):\n\t\tself.size = 11\n\t\tself.slots = [None] * self.size\n\t\tself.data = [None] * self.size\n\t\n\tdef put(self, key, data):\n\t\t# there are three situations,\n\t\t#1. the hashvalue returned by hashfunction of the slot is empty, just put the key in that slot, and the data ...
false
6,035
12f05f42c9ed56d6a2c95fb56a8619fae47a2f1a
/home/runner/.cache/pip/pool/9b/88/a0/f20a7b2f367cd365add3353eba0cf34569d5f62a33587f96cebe6d4360
[ "/home/runner/.cache/pip/pool/9b/88/a0/f20a7b2f367cd365add3353eba0cf34569d5f62a33587f96cebe6d4360" ]
true
6,036
e11c479a99ab68755de8ab565e3d360d557129cf
# Copyright 2010 Google Inc. # # 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 in writing,...
[ "# Copyright 2010 Google Inc.\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 law or agreed...
true
6,037
0b7bba826b82c3751c072395431e17bc1dc9bb90
import numpy as np from scipy import fft import math from sklearn import svm from activity_recognition import WiiGesture class WiiGestureClassifier(): """ This class uses the FFT on the average of all three sensor values to provide the training data for the SVM Three good distinguishable gestures are...
[ "import numpy as np\nfrom scipy import fft\nimport math\nfrom sklearn import svm\nfrom activity_recognition import WiiGesture\n\n\nclass WiiGestureClassifier():\n \"\"\"\n This class uses the FFT on the average of all three sensor values\n to provide the training data for the SVM\n\n Three good distingu...
false
6,038
3218a9e82cd19bab1680079aee5f09a97992629e
from flask import Flask app = Flask(__name__) import orderapi, views, models, processing if __name__=="__main__": orderapi.app.debug = True orderapi.app.run(host='0.0.0.0', port=34203) views.app.debug = True views.app.run(host='0.0.0.0', port=42720)
[ "from flask import Flask\napp = Flask(__name__)\nimport orderapi, views, models, processing\n\nif __name__==\"__main__\":\n orderapi.app.debug = True\n orderapi.app.run(host='0.0.0.0', port=34203)\n views.app.debug = True\n views.app.run(host='0.0.0.0', port=42720)\n", "from flask import Flask\napp =...
false
6,039
ade300f2921ca860bbe92aa351df2c88238b7996
import sys, string, math s = input() print(ord(s))
[ "import sys, string, math\ns = input()\nprint(ord(s))\n", "<import token>\ns = input()\nprint(ord(s))\n", "<import token>\n<assignment token>\nprint(ord(s))\n", "<import token>\n<assignment token>\n<code token>\n" ]
false
6,040
848374ea7d706bbd2ef5a76489cabeff998acb82
# Generated by Django 3.1.5 on 2021-05-30 14:27 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('fuser', '0009_movement_type'), ] operations = [ migrations.AlterField( model_name='movementpass...
[ "# Generated by Django 3.1.5 on 2021-05-30 14:27\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('fuser', '0009_movement_type'),\n ]\n\n operations = [\n migrations.AlterField(\n model...
false
6,041
6e6f153857879da625f57f0382f1997fcae4f6c8
from django.db import models from django.contrib.auth.models import User, Group from userena.models import UserenaBaseProfile from django.db.models.signals import post_save from tastypie.models import create_api_key class UserProfile(UserenaBaseProfile): # user reference user = models.OneToOneField(User) ...
[ "from django.db import models\nfrom django.contrib.auth.models import User, Group\nfrom userena.models import UserenaBaseProfile\nfrom django.db.models.signals import post_save\nfrom tastypie.models import create_api_key\n\nclass UserProfile(UserenaBaseProfile):\n # user reference\n user = models.OneToOneFiel...
false
6,042
7b7705cdaa8483f6abbc3f4fb3fa1ca506742da8
import math,random,numpy as np def myt(): x=[0]*10 y=[] for i in range(100000): tmp = int(random.random()*10) x[tmp] = x[tmp]+1 tmpy=[0]*10 tmpy[tmp] = 1 for j in range(10): tmpy[j] = tmpy[j] + np.random.laplace(0,2,None) y.append(tmpy) result...
[ "import math,random,numpy as np\n\ndef myt():\n x=[0]*10\n y=[]\n for i in range(100000):\n tmp = int(random.random()*10)\n x[tmp] = x[tmp]+1\n tmpy=[0]*10\n tmpy[tmp] = 1\n for j in range(10):\n tmpy[j] = tmpy[j] + np.random.laplace(0,2,None)\n y.append...
true
6,043
31a2fa5b2febc2ef80b57e45c2ebb662b886c4b7
'''Чи можна в квадратному залі площею S помістити круглу сцену радіусом R так, щоб від стіни до сцени був прохід не менше K?''' from math import sqrt s = int(input('Input your area of square (S): ')) r = int(input('Input your radius of scene (R): ')) k = int(input('Input your width of passage (K): ')) k2 = sqrt...
[ "'''Чи можна в квадратному залі площею S помістити круглу сцену радіусом R так,\r\nщоб від стіни до сцени був прохід не менше K?'''\r\nfrom math import sqrt\r\n\r\ns = int(input('Input your area of square (S): '))\r\nr = int(input('Input your radius of scene (R): '))\r\nk = int(input('Input your width of passage (K...
false
6,044
286801b69546046853d123c5708f24eaaa2e8cec
from __future__ import annotations from collections import Counter from distribution import Distribution, Normal class GoodKind: """ The definition of a kind of good. "Vegtable" is a kind of good, as is "Iron Ore", "Rocket Fuel", and "Electic Motor" """ def __init__(self, name: str): as...
[ "from __future__ import annotations\nfrom collections import Counter\nfrom distribution import Distribution, Normal\n\n\nclass GoodKind:\n \"\"\"\n The definition of a kind of good. \"Vegtable\" is a kind of good, as is \n \"Iron Ore\", \"Rocket Fuel\", and \"Electic Motor\"\n \"\"\"\n\n def __init_...
false
6,045
9a183b1f81681b3dec1132a27b17e389438ab725
""" Copyright (c) 2017 - Philip Paquette Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribu...
[ "\"\"\"\nCopyright (c) 2017 - Philip Paquette\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, p...
false
6,046
02a28b61ad9d664c89829df019f4887c2c869f91
import input_data import tensorflow as tf from infogan import InfoGAN if __name__ == '__main__': # get input data mnist_data = input_data.load_mnist_dataset('../../dataset/mnist_data', one_hot=True) num_sample = mnist_data.train.num_examples dataset = 'mnist' if dataset == 'mnist': input_di...
[ "import input_data\nimport tensorflow as tf\nfrom infogan import InfoGAN\n\nif __name__ == '__main__':\n # get input data\n mnist_data = input_data.load_mnist_dataset('../../dataset/mnist_data', one_hot=True)\n num_sample = mnist_data.train.num_examples\n dataset = 'mnist'\n if dataset == 'mnist':\n ...
false
6,047
3abeac4fb80244d2da14e14a6048c09b0c0c1393
""" You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums2. The Next Greater Number of a number x in nums1 is the first greater number to its right in nums2. If it does not exi...
[ "\"\"\"\nYou are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums2.\n\nThe Next Greater Number of a number x in nums1 is the first greater number to its right in nums2. If it d...
false
6,048
58d144b2c6c307719cef0b5097945c8206135ccf
"""CPU functionality.""" import sys HLT = 0b00000001 LDI = 0b10000010 PRN = 0b01000111 MUL = 0b10100010 PUSH = 0b01000101 POP = 0b01000110 CMP = 0b10100111 CALL = 0b01010000 RET = 0b00010001 ADD = 0b10100000 CMP = 0b10100111 JMP = 0b01010100 JEQ = 0b01010101 JNE = 0b01010110 AND = 0b10101000 NOT = 0b01101001 OR = 0b10...
[ "\"\"\"CPU functionality.\"\"\"\n\nimport sys\nHLT = 0b00000001\nLDI = 0b10000010\nPRN = 0b01000111\nMUL = 0b10100010\nPUSH = 0b01000101\nPOP = 0b01000110\nCMP = 0b10100111\nCALL = 0b01010000\nRET = 0b00010001\nADD = 0b10100000\nCMP = 0b10100111\nJMP = 0b01010100\nJEQ = 0b01010101\nJNE = 0b01010110\nAND = 0b1010100...
false
6,049
0054921928838d9aee63cf58f50a0a01ee12635d
from django.db import models class crontab(models.Model): name = models.CharField(max_length=20) class converter(models.Model): name = models.CharField(max_length=20) class MainTable(models.Model): rank = models.IntegerField(null=True) coinid = models.CharField(max_length=30,null=True) symbol = ...
[ "from django.db import models\n\nclass crontab(models.Model):\n name = models.CharField(max_length=20)\n\n\nclass converter(models.Model):\n name = models.CharField(max_length=20)\n\nclass MainTable(models.Model):\n rank = models.IntegerField(null=True)\n coinid = models.CharField(max_length=30,null=Tru...
false
6,050
ea12ede51881f6e826a044df5d7aba457c434658
""" Problem Link: https://practice.geeksforgeeks.org/problems/palindrome/0 Given an integer, check whether it is a palindrome or not. Input: The first line of input contains an integer T denoting the number of test cases. For each test case there will be single line containing single integer N. Output: Print "Yes" ...
[ "\"\"\"\nProblem Link: https://practice.geeksforgeeks.org/problems/palindrome/0\n\nGiven an integer, check whether it is a palindrome or not.\n\nInput:\nThe first line of input contains an integer T denoting the number of test cases. \nFor each test case there will be single line containing single integer N.\n\nOut...
false
6,051
25b3defc8410c72c7c6f25288af91bd0c826f2ed
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ui/about.ui' # # Created by: PyQt5 UI code generator 5.15.4 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 import QtCore, QtG...
[ "# -*- coding: utf-8 -*-\n\n# Form implementation generated from reading ui file 'ui/about.ui'\n#\n# Created by: PyQt5 UI code generator 5.15.4\n#\n# WARNING: Any manual changes made to this file will be lost when pyuic5 is\n# run again. Do not edit this file unless you know what you are doing.\n\n\nfrom PyQt5 imp...
false
6,052
ac0e301e58ea64465ccd4b2b9aa4ae69283d6d0c
import FWCore.ParameterSet.Config as cms process = cms.Process("GeometryInfo") # minimum of logs process.MessageLogger = cms.Service("MessageLogger", cerr = cms.untracked.PSet( enable = cms.untracked.bool(False) ), cout = cms.untracked.PSet( enable = cms.untracked.bool(True), thresh...
[ "import FWCore.ParameterSet.Config as cms\nprocess = cms.Process(\"GeometryInfo\")\n\n# minimum of logs\nprocess.MessageLogger = cms.Service(\"MessageLogger\",\n cerr = cms.untracked.PSet(\n enable = cms.untracked.bool(False)\n ),\n cout = cms.untracked.PSet(\n enable = cms.untracked.bool(Tru...
false
6,053
64ac007faeebe0e71ba0060e74fa07154e6291e2
from django.urls import path from .views import PollsList, SinglePollsView, PollsCreate, PollsAnswer app_name = "authors" # app_name will help us do a reverse look-up latter. urlpatterns = [ path('polls/', PollsList.as_view()), path('polls/create', PollsCreate.as_view()), path('polls/<int:pk>', SinglePollsV...
[ "from django.urls import path\nfrom .views import PollsList, SinglePollsView, PollsCreate, PollsAnswer\napp_name = \"authors\"\n# app_name will help us do a reverse look-up latter.\nurlpatterns = [\n path('polls/', PollsList.as_view()),\n path('polls/create', PollsCreate.as_view()),\n path('polls/<int:pk>'...
false
6,054
2a5f69fbb26bd1f94c10ff0da687391bf5bd3c23
import fs gInfo = { 'obj': g2.go(capUrl), 'Headers-C-T': g2.response.headers['Content-Type'], 'url': g2.response.url, 'urlDetails': g2.response.url_details() } capHtml = capHtml = gInfo['obj'].unicode_body(ignore_errors=True, fix_special_entities=True) b64cap = re.findall(r'base64,(.*?)\\" id=', capHtml, re.DO...
[ "import fs\n\n\ngInfo = {\n\n'obj': g2.go(capUrl),\n\n'Headers-C-T': g2.response.headers['Content-Type'],\n\n'url': g2.response.url,\n\n'urlDetails': g2.response.url_details()\n\n}\n\ncapHtml = capHtml = gInfo['obj'].unicode_body(ignore_errors=True, fix_special_entities=True)\n\nb64cap = re.findall(r'base64,(.*?)\\...
false
6,055
1145050d82e614d5c248fc7e6a71720e6ff72414
# -*- coding: utf-8 -*- """ # @Time : 2018/6/11 下午6:45 # @Author : zhanzecheng # @File : 542.01矩阵1.py # @Software: PyCharm """ # 一个简单的循环方式来解决这个问题 # 这一题的思路不错,用多次循环来计数 # TODO: check 1 class Solution: def updateMatrix(self, matrix): """ :type matrix: List[List[int]] :rtype: List[List[in...
[ "# -*- coding: utf-8 -*-\n\"\"\"\n# @Time : 2018/6/11 下午6:45\n# @Author : zhanzecheng\n# @File : 542.01矩阵1.py\n# @Software: PyCharm\n\"\"\"\n\n# 一个简单的循环方式来解决这个问题\n# 这一题的思路不错,用多次循环来计数\n# TODO: check 1\nclass Solution:\n def updateMatrix(self, matrix):\n \"\"\"\n :type matrix: List[List[int]]\...
false
6,056
96708216c5ffa56a60475b295c21b18225e6eed9
from django.urls import path from rest_framework.routers import DefaultRouter from . import views app_name = "rooms" router = DefaultRouter() router.register("", views.RoomViewSet) urlpatterns = router.urls # # urlpatterns = [ # # path("list/", views.ListRoomsView.as_view()), # # path("list/", views.rooms_vie...
[ "from django.urls import path\nfrom rest_framework.routers import DefaultRouter\nfrom . import views\n\napp_name = \"rooms\"\nrouter = DefaultRouter()\nrouter.register(\"\", views.RoomViewSet)\n\nurlpatterns = router.urls\n#\n# urlpatterns = [\n# # path(\"list/\", views.ListRoomsView.as_view()),\n# # path(\...
false
6,057
a74f2050a057f579a8a8b77ac04ef09073cdb6cf
import matplotlib.pyplot as plt import numpy as np import random plt.ion() def draw_board(grid_size, hole_pos,wall_pos): board = np.ones((grid_size,grid_size)) board[wall_pos] = 10 board[hole_pos] = 0 return board class Game(): """ A class which implements the Gobble game. Initializes with a ...
[ "import matplotlib.pyplot as plt\nimport numpy as np\nimport random\n\nplt.ion()\n\ndef draw_board(grid_size, hole_pos,wall_pos):\n board = np.ones((grid_size,grid_size))\n board[wall_pos] = 10\n board[hole_pos] = 0\n return board\n\nclass Game():\n \"\"\"\n A class which implements the Gobble gam...
false
6,058
1935cab249bf559aeadf785ce7abcecb03344c04
from .signals import get_restaurant_coordinates, count_average_price, count_total_calories from .dish import Dish from .ingredients import Ingredient from .restaurants import Restaurant
[ "from .signals import get_restaurant_coordinates, count_average_price, count_total_calories\nfrom .dish import Dish\nfrom .ingredients import Ingredient\nfrom .restaurants import Restaurant\n", "<import token>\n" ]
false
6,059
81ae5bbc8e3e712ee4f54656bc28f385a0b4a29f
# -*- coding: utf-8 -*- """ Created on Thu Jun 18 23:54:17 2015 @author: rein @license: MIT @version: 0.1 """ from __future__ import print_function import numpy as np import footballpy.processing.ragged_array as ra """ Ranking dictionary necessary to determine the column number of each player. The type ...
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Thu Jun 18 23:54:17 2015\n\n@author: rein\n@license: MIT\n@version: 0.1\n\"\"\"\n\nfrom __future__ import print_function\nimport numpy as np\nimport footballpy.processing.ragged_array as ra\n\n\"\"\" Ranking dictionary necessary to determine the column number\n of eac...
false
6,060
3e7d2bacb15c39658ef5044685b73068deb1c145
from math import pi from root_regula_falsi import * r = 1.0 ρs = 200.0 ρw = 1000.0 def f(h): Vw = 4*pi*r**3/3 - pi*h**2/3*(3*r - h) # displaced volume of water Vs = 4*pi*r**3/3 return ρw*Vw - ρs*Vs xr = root_regula_falsi(f, 0.0, 2*r)
[ "from math import pi\nfrom root_regula_falsi import *\n\nr = 1.0\nρs = 200.0\nρw = 1000.0\n\ndef f(h):\n Vw = 4*pi*r**3/3 - pi*h**2/3*(3*r - h) # displaced volume of water\n Vs = 4*pi*r**3/3\n return ρw*Vw - ρs*Vs\n\n\nxr = root_regula_falsi(f, 0.0, 2*r)", "from math import pi\nfrom root_regula_falsi imp...
false
6,061
7f21fcc1265be8b3263971a4e76470616459f433
from django.core.exceptions import ObjectDoesNotExist from django.shortcuts import render, HttpResponseRedirect, Http404 from django.contrib.auth import authenticate, login, logout from accounts.forms import RegistrationForm, LoginForm, StudentDetailsForm, companyDetailsForm, SocietyDetailsForm from accounts.models im...
[ "from django.core.exceptions import ObjectDoesNotExist\nfrom django.shortcuts import render, HttpResponseRedirect, Http404\nfrom django.contrib.auth import authenticate, login, logout\n\nfrom accounts.forms import RegistrationForm, LoginForm, StudentDetailsForm, companyDetailsForm, SocietyDetailsForm\nfrom accounts...
true
6,062
61484d9a08f2e3fcd15573ce89be4118a442dc2e
# Generated by Django 3.1 on 2020-09-26 03:46 import datetime from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('bcs', '0002_auto_20200915_2245'), ] operations = [ migrations.AddField( model_name='s...
[ "# Generated by Django 3.1 on 2020-09-26 03:46\n\nimport datetime\nfrom django.db import migrations, models\nimport django.utils.timezone\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('bcs', '0002_auto_20200915_2245'),\n ]\n\n operations = [\n migrations.AddField(\n ...
false
6,063
1ccb23435d8501ed82debf91bd6bf856830d01cb
from flask import Blueprint, render_template, request, session, url_for, redirect from flask_socketio import join_room, leave_room, send, emit from models.game.game import Game from models.games.games import Games from decorators.req_login import requires_login game_blueprint = Blueprint('game', __name__) @game_bl...
[ "from flask import Blueprint, render_template, request, session, url_for, redirect\nfrom flask_socketio import join_room, leave_room, send, emit\nfrom models.game.game import Game\n\nfrom models.games.games import Games\nfrom decorators.req_login import requires_login\n\n\ngame_blueprint = Blueprint('game', __name_...
false
6,064
0d18272f8056f37eddabb024dd769a2793f88c24
#!/usr/bin/env python import argparse import xml.etree.cElementTree as ET from datetime import datetime, timedelta from requests import codes as requests_codes from requests_futures.sessions import FuturesSession from xml.etree import ElementTree as ET parser = argparse.ArgumentParser(description='Fetch dqm images')...
[ "#!/usr/bin/env python\n\nimport argparse\nimport xml.etree.cElementTree as ET\n\nfrom datetime import datetime, timedelta\nfrom requests import codes as requests_codes\nfrom requests_futures.sessions import FuturesSession\nfrom xml.etree import ElementTree as ET\n\nparser = argparse.ArgumentParser(description='Fet...
true
6,065
7cc77de31adff5b4a394f117fc743cd6dd4bc06c
import base import telebot import markups from starter import start_bot, bot @bot.message_handler(commands=['start']) def start(message): chat = message.chat # welcome(msg) msg = bot.send_message(chat.id, "Select a language in the list", reply_markup=markups.language()) bot.register_next_step_handler(...
[ "import base\nimport telebot\nimport markups\nfrom starter import start_bot, bot\n\n\n@bot.message_handler(commands=['start'])\ndef start(message):\n chat = message.chat\n # welcome(msg)\n msg = bot.send_message(chat.id, \"Select a language in the list\", reply_markup=markups.language())\n bot.register_...
false
6,066
42371760d691eac9c3dfe5693b03cbecc13fd94d
__source__ = 'https://leetcode.com/problems/merge-two-binary-trees/' # Time: O(n) # Space: O(n) # # Description: Leetcode # 617. Merge Two Binary Trees # # Given two binary trees and imagine that when you put one of them to cover the other, # some nodes of the two trees are overlapped while the others are not. # # You...
[ "__source__ = 'https://leetcode.com/problems/merge-two-binary-trees/'\n# Time: O(n)\n# Space: O(n)\n#\n# Description: Leetcode # 617. Merge Two Binary Trees\n#\n# Given two binary trees and imagine that when you put one of them to cover the other,\n# some nodes of the two trees are overlapped while the others are ...
false
6,067
dafefc65335a0d7e27057f51b43e52b286f5bc6b
from haven import haven_utils as hu import itertools, copy EXP_GROUPS = {} EXP_GROUPS['starter_issam'] = hu.cartesian_exp_group({ 'batch_size': 32, 'opt': {'name': 'adamW', 'lr': 0.0001, 'wd': 1e-6}, 'model': {'name': 'resnext50_32x4d_ssl'}, ...
[ "from haven import haven_utils as hu\nimport itertools, copy\n\nEXP_GROUPS = {}\n\n\nEXP_GROUPS['starter_issam'] = hu.cartesian_exp_group({\n 'batch_size': 32,\n 'opt': {'name': 'adamW', 'lr': 0.0001, 'wd': 1e-6},\n 'model': {'name': 'resnext50_32...
false
6,068
67b1cdfa514aac4fdac3804285ec8d0aebce944d
from Bio.PDB import * import urllib.request import numpy as np import pandas as pd from math import sqrt import time import os import heapq from datetime import datetime dir_path = os.getcwd() peptidasesList = pd.read_csv("./MCSA_EC3.4_peptidases.csv") peptidasesList = peptidasesList[peptidasesList.iloc[:, 4] == "res...
[ "from Bio.PDB import *\nimport urllib.request\nimport numpy as np\nimport pandas as pd\nfrom math import sqrt\nimport time\nimport os\nimport heapq\nfrom datetime import datetime\n\ndir_path = os.getcwd()\n\npeptidasesList = pd.read_csv(\"./MCSA_EC3.4_peptidases.csv\")\npeptidasesList = peptidasesList[peptidasesLis...
false
6,069
1f01989f10be5404d415d4abd1ef9ab6c8695aba
from valuate.predict import * def get_profit_rate(intent, popularity): """ 获取畅销系数 """ # 按畅销程度分级,各交易方式相比于标价的固定比例 profits = gl.PROFITS profit = profits[popularity] # 计算各交易方式的价格相比于标价的固定比例 if intent == 'sell': # 商家收购价相比加权平均价的比例 profit_rate = 1 - profit[0] - profit[1] el...
[ "from valuate.predict import *\n\n\ndef get_profit_rate(intent, popularity):\n \"\"\"\n 获取畅销系数\n \"\"\"\n # 按畅销程度分级,各交易方式相比于标价的固定比例\n profits = gl.PROFITS\n profit = profits[popularity]\n # 计算各交易方式的价格相比于标价的固定比例\n if intent == 'sell':\n # 商家收购价相比加权平均价的比例\n profit_rate = 1 - prof...
false
6,070
70c9d75dabfa9eac23e34f94f34d39c08e21b3c0
import rospy #: the parameter namespace for the arni_countermeasure node ARNI_CTM_NS = "arni/countermeasure/" #: the parameter namespace for configuration files #: of the arni_countermeasure node ARNI_CTM_CFG_NS = ARNI_CTM_NS + "config/" def get_param_num(param): #dummy val value = 1 try: value...
[ "import rospy\n\n#: the parameter namespace for the arni_countermeasure node\nARNI_CTM_NS = \"arni/countermeasure/\"\n\n#: the parameter namespace for configuration files\n#: of the arni_countermeasure node\nARNI_CTM_CFG_NS = ARNI_CTM_NS + \"config/\"\n\n\ndef get_param_num(param):\n\n #dummy val\n value = 1\...
false
6,071
5e68233fde741c0d2a94bf099afb6a91c08e2a29
def test_corr_callable_method(self, datetime_series): my_corr = (lambda a, b: (1.0 if (a == b).all() else 0.0)) s1 = Series([1, 2, 3, 4, 5]) s2 = Series([5, 4, 3, 2, 1]) expected = 0 tm.assert_almost_equal(s1.corr(s2, method=my_corr), expected) tm.assert_almost_equal(datetime_series.corr(datetim...
[ "def test_corr_callable_method(self, datetime_series):\n my_corr = (lambda a, b: (1.0 if (a == b).all() else 0.0))\n s1 = Series([1, 2, 3, 4, 5])\n s2 = Series([5, 4, 3, 2, 1])\n expected = 0\n tm.assert_almost_equal(s1.corr(s2, method=my_corr), expected)\n tm.assert_almost_equal(datetime_series.c...
false
6,072
49a9fb43f3651d28d3ffac5e33d10c428afd08fd
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def calcLuckyNumber(x): resultSet = set() for i in range(30): for j in range(30): for k in range(30): number = pow(3, i) * pow(5, j) * pow(7, k) if number > 1 and number <= x: resultSet.add(nu...
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\ndef calcLuckyNumber(x):\n resultSet = set()\n for i in range(30):\n for j in range(30):\n for k in range(30):\n number = pow(3, i) * pow(5, j) * pow(7, k)\n if number > 1 and number <= x:\n r...
false
6,073
4bf140ae01f2eaa0c67f667766c3ec921d552066
import pulumi import pulumi_aws as aws bar = aws.elasticache.get_replication_group(replication_group_id="example")
[ "import pulumi\nimport pulumi_aws as aws\n\nbar = aws.elasticache.get_replication_group(replication_group_id=\"example\")\n\n", "import pulumi\nimport pulumi_aws as aws\nbar = aws.elasticache.get_replication_group(replication_group_id='example')\n", "<import token>\nbar = aws.elasticache.get_replication_group(r...
false
6,074
7254e74ff3f562613cc610e4816a2d92b6b1cd4c
name = 'Ледяная скорбь' description = 'Тот кто держит этот клинок, должен обладать бесконечной силой. Подобно тому, как он разрывает плоть, он разрывает души.' price = 3000 fightable = True def fight_use(user, reply, room): return 200
[ "name = 'Ледяная скорбь'\ndescription = 'Тот кто держит этот клинок, должен обладать бесконечной силой. Подобно тому, как он разрывает плоть, он разрывает души.'\nprice = 3000\n\nfightable = True\n\ndef fight_use(user, reply, room):\n\treturn 200", "name = 'Ледяная скорбь'\ndescription = (\n 'Тот кто держит эт...
false
6,075
79a8ff0000f3be79a62d693ed6bae7480673d970
import argparse from ray.tune.config_parser import make_parser from ray.tune.result import DEFAULT_RESULTS_DIR EXAMPLE_USAGE = """ Training example: python ./train.py --run DQN --env CartPole-v0 --no-log-flatland-stats Training with Config: python ./train.py -f experiments/flatland_random_sparse_small/global...
[ "import argparse\n\nfrom ray.tune.config_parser import make_parser\nfrom ray.tune.result import DEFAULT_RESULTS_DIR\n\nEXAMPLE_USAGE = \"\"\"\nTraining example:\n python ./train.py --run DQN --env CartPole-v0 --no-log-flatland-stats\n\nTraining with Config:\n python ./train.py -f experiments/flatland_random_s...
false
6,076
ff959a388438a6d9c6d418e28c676ec3fd196ea0
from django.conf.urls import url, include from api.resources import PlayerResource, GameResource from . import views player_resource = PlayerResource() game_resource = GameResource() urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^api/', include(player_resource.urls)), url(r'^api/', include(...
[ "from django.conf.urls import url, include\nfrom api.resources import PlayerResource, GameResource\nfrom . import views\n\nplayer_resource = PlayerResource()\ngame_resource = GameResource()\n\nurlpatterns = [\n url(r'^$', views.index, name='index'),\n url(r'^api/', include(player_resource.urls)),\n url(r'^...
false
6,077
e5b5a0c8c0cbe4862243548b3661057240e9d8fd
# -*- coding: utf-8 -*- import numpy as np import pandas as pd import pandas import numpy import json import torch.utils.data as data import os import torch def load_json(file): with open(file) as json_file: data = json.load(json_file) return data class VideoDataSet(data.Dataset): def __init_...
[ "# -*- coding: utf-8 -*-\nimport numpy as np\nimport pandas as pd\nimport pandas\nimport numpy\nimport json\nimport torch.utils.data as data\nimport os\nimport torch\n\ndef load_json(file):\n with open(file) as json_file:\n data = json.load(json_file)\n return data\n\n\nclass VideoDataSet(data.Data...
false
6,078
f08677430e54822abbce61d0cac5a6fea14d3872
from a10sdk.common.A10BaseClass import A10BaseClass class MacAgeTime(A10BaseClass): """Class Description:: Set Aging period for all MAC Interfaces. Class mac-age-time supports CRUD Operations and inherits from `common/A10BaseClass`. This class is the `"PARENT"` class for this module.` :para...
[ "from a10sdk.common.A10BaseClass import A10BaseClass\n\n\nclass MacAgeTime(A10BaseClass):\n \n \"\"\"Class Description::\n Set Aging period for all MAC Interfaces.\n\n Class mac-age-time supports CRUD Operations and inherits from `common/A10BaseClass`.\n This class is the `\"PARENT\"` class for this ...
false
6,079
e55115a65ebee5d41dcd01a5cbabc328acf152da
from flask import Flask from flask import request, redirect, render_template from flask_bootstrap import Bootstrap import urllib.request import urllib.parse import json import uuid import yaml import hashlib from Crypto import Random from Crypto.Cipher import AES import base64 app = Flask(__name__) Bootstrap(app) ...
[ "from flask import Flask\nfrom flask import request, redirect, render_template\nfrom flask_bootstrap import Bootstrap\nimport urllib.request\nimport urllib.parse\nimport json\nimport uuid\nimport yaml\nimport hashlib\nfrom Crypto import Random\nfrom Crypto.Cipher import AES\nimport base64\n\n\n\n\napp = Flask(__nam...
false
6,080
a5a764586faabb5af58f4649cdd20b6b18236a99
import numpy as np class Layer: def __init__(self): pass @property def need_update(self): return False class FC(Layer): def __init__(self, W, b, lr, decay, epoch_drop, l2=0): self.W = W.copy() self.b = b.copy() self.alpha_0 = lr self.decay = decay ...
[ "import numpy as np\n\n\nclass Layer:\n def __init__(self):\n pass\n\n @property\n def need_update(self):\n return False\n\n\nclass FC(Layer):\n def __init__(self, W, b, lr, decay, epoch_drop, l2=0):\n self.W = W.copy()\n self.b = b.copy()\n self.alpha_0 = lr\n ...
false
6,081
d867d17b2873de7c63d0ff29eb585cce1a68dda6
import sys pdb = open(sys.argv[1]) name = sys.argv[2] res = [] resid = None for l in pdb: if not l.startswith("ATOM"): continue if int(l[22:26]) != resid: res.append([]) resid = int(l[22:26]) res[-1].append(l) for i in range(len(res)-2): outp = open("%s%d-%dr.pdb"%(name,i+1,i+...
[ "import sys\n\npdb = open(sys.argv[1])\nname = sys.argv[2]\n\nres = []\nresid = None\nfor l in pdb:\n if not l.startswith(\"ATOM\"):\n continue\n if int(l[22:26]) != resid:\n res.append([])\n resid = int(l[22:26])\n res[-1].append(l)\n\nfor i in range(len(res)-2):\n outp = open(\"%s...
false
6,082
7ed6d475bfe36fdd0b6cd2f0902a0bccb22f7f60
# -*- coding: utf-8 -*- """ 项目:爬取思否网站首页推荐文章 作者:cho 时间:2019.9.23 """ import json import parsel import scrapy from scrapy import Request from SF.items import SfItem class SfCrawlSpider(scrapy.Spider): name = 'sf_crawl' allowed_domains = ['segmentfault.com'] header = { 'user-agent': 'Mozilla/5.0 (W...
[ "# -*- coding: utf-8 -*-\n\"\"\"\n项目:爬取思否网站首页推荐文章\n作者:cho\n时间:2019.9.23\n\"\"\"\nimport json\n\nimport parsel\nimport scrapy\nfrom scrapy import Request\n\nfrom SF.items import SfItem\n\n\nclass SfCrawlSpider(scrapy.Spider):\n name = 'sf_crawl'\n allowed_domains = ['segmentfault.com']\n header = {\n ...
false
6,083
14b6dc403be76abef5fde2cca5d773c88faa4b40
#!usr/bin/python #--*--coding:utf-8--*-- import sys import re if __name__ == '__main__': category = re.compile('\[\[Category\:.*\]\]')#.は改行以外の任意の文字列にマッチ for line in open(sys.argv[1]): if category.search(line) is not None:#比較にはisを用いなければならない print line.strip()
[ "#!usr/bin/python\n#--*--coding:utf-8--*--\n\nimport sys\nimport re\n\nif __name__ == '__main__':\n category = re.compile('\\[\\[Category\\:.*\\]\\]')#.は改行以外の任意の文字列にマッチ\n for line in open(sys.argv[1]):\n if category.search(line) is not None:#比較にはisを用いなければならない\n print line.strip()" ]
true
6,084
f0b98a3d6015d57a49e315ac984cac1cccf0b382
import sys def input(_type=str): return _type(sys.stdin.readline().strip()) def main(): N, K, D = map(int, input().split()) rules = [tuple(map(int, input().split())) for _ in range(K)] minv, maxv = min([r[0] for r in rules]), max([r[1] for r in rules]) while minv + 1 < maxv: midv = (minv + maxv)//2 cnt, max_...
[ "import sys\ndef input(_type=str):\n\treturn _type(sys.stdin.readline().strip())\n\ndef main():\n\tN, K, D = map(int, input().split())\n\trules = [tuple(map(int, input().split())) for _ in range(K)]\n\tminv, maxv = min([r[0] for r in rules]), max([r[1] for r in rules])\n\twhile minv + 1 < maxv:\n\t\tmidv = (minv + ...
false
6,085
4276fd61ad48b325961cd45be68eea6eab51f916
import os os.environ['CITY_CONF']='/opt/ris-web/city/duisburg.py' from webapp import app app.run(debug=True, host='0.0.0.0')
[ "import os\nos.environ['CITY_CONF']='/opt/ris-web/city/duisburg.py'\n\nfrom webapp import app\n\napp.run(debug=True, host='0.0.0.0')\n", "import os\nos.environ['CITY_CONF'] = '/opt/ris-web/city/duisburg.py'\nfrom webapp import app\napp.run(debug=True, host='0.0.0.0')\n", "<import token>\nos.environ['CITY_CONF']...
false
6,086
ade4d797a83eaa06e8bde90972a56376d7e0f55a
import pprint class ErrorResponseCollection(object): def __init__(self, status, message, param = "message"): self.status = status self.message = message self.param = param def as_md(self): return '\n\n> **%s**\n\n```\n{\n\n\t"%s": "%s"\n\n}\n\n```' % \ ...
[ "import pprint\r\n\r\nclass ErrorResponseCollection(object):\r\n def __init__(self, status, message, param = \"message\"):\r\n self.status = status\r\n self.message = message\r\n self.param = param\r\n\r\n def as_md(self):\r\n return '\\n\\n> **%s**\\n\\n```\\n{\\n\\n\\t\"%s\": \"%...
false
6,087
092c6d637fe85136b4184d05f0ac7db17a8efb3b
# -*- coding:utf-8 -*- import time from abc import ABCMeta, abstractmethod from xlreportform.worksheet import WorkSheet __author__ = "Andy Yang" class Bases(metaclass=ABCMeta): def __init__(self): pass @abstractmethod def set_style(self): """set workshet's style, indent,bor...
[ "# -*- coding:utf-8 -*-\r\nimport time\r\nfrom abc import ABCMeta, abstractmethod\r\nfrom xlreportform.worksheet import WorkSheet\r\n\r\n__author__ = \"Andy Yang\"\r\n\r\n\r\nclass Bases(metaclass=ABCMeta):\r\n def __init__(self):\r\n pass\r\n\r\n @abstractmethod\r\n def set_style(self):\r\n ...
false
6,088
c9b1956d66f0b8ae8a7ce7e509259747c8b7709e
#program, ktory zisti, ci zadany rok je prestupny rok=input("Zadaj rok: ") rok_int= int(rok) if rok_int% 4==0: if rok_int % 100 != 0: if rok_int % 400: print(f'Rok {rok_int} je priestupny') else: print("rok je neprestupny") else: print("rok je prestupny") else: ...
[ "#program, ktory zisti, ci zadany rok je prestupny\nrok=input(\"Zadaj rok: \")\nrok_int= int(rok)\nif rok_int% 4==0:\n if rok_int % 100 != 0:\n if rok_int % 400:\n print(f'Rok {rok_int} je priestupny')\n else:\n print(\"rok je neprestupny\")\n else:\n print(\"rok je...
false
6,089
7ba8f0bd962413f6ff825df27330447b11360f10
from .base import BaseLevel from map_objects import DefinedMap from entity.monster import Daemon from entity.weapons import Axe class FinalLevel(BaseLevel): def __init__(self): lvl_map = DefinedMap('levels/demon_lair.xp') super().__init__(lvl_map.width, lvl_map.height) self.map = lvl_...
[ "from .base import BaseLevel\nfrom map_objects import DefinedMap\nfrom entity.monster import Daemon\n\nfrom entity.weapons import Axe\n\nclass FinalLevel(BaseLevel):\n \n def __init__(self):\n lvl_map = DefinedMap('levels/demon_lair.xp')\n super().__init__(lvl_map.width, lvl_map.height)\n ...
false
6,090
dc261b29c1c11bb8449ff20a7f2fd120bef9efca
#颜色选择对话框 import tkinter import tkinter.colorchooser root = tkinter.Tk() root.minsize(300,300) #添加颜色选择按钮 def select(): #打开颜色选择器 result = tkinter.colorchooser.askcolor(title = '内裤颜色种类',initialcolor = 'purple') print(result) #改变按钮颜色 btn1['bg'] = result[1] btn1 = tkinter.Button(root,text = '请选择你的内裤颜色...
[ "#颜色选择对话框\nimport tkinter\nimport tkinter.colorchooser\n\nroot = tkinter.Tk()\nroot.minsize(300,300)\n\n#添加颜色选择按钮\ndef select():\n #打开颜色选择器\n result = tkinter.colorchooser.askcolor(title = '内裤颜色种类',initialcolor = 'purple')\n print(result)\n #改变按钮颜色\n btn1['bg'] = result[1]\n\nbtn1 = tkinter.Button(ro...
false
6,091
e99d557808c7ae32ebfef7e7fb2fddb04f45b13a
class Config(object): DEBUG = False TESTING = False SQLALCHEMY_TRACK_MODIFICATIONS = False class Production(Config): SQLALCHEMY_DATABASE_URI = '<Production DB URL>' class Development(Config): # psql postgresql://Nghi:nghi1996@localhost/postgres DEBUG = True SQLALCHEMY_DATABASE_URI = 'pos...
[ "class Config(object):\n DEBUG = False\n TESTING = False\n SQLALCHEMY_TRACK_MODIFICATIONS = False\n\n\nclass Production(Config):\n SQLALCHEMY_DATABASE_URI = '<Production DB URL>'\n\n\nclass Development(Config):\n # psql postgresql://Nghi:nghi1996@localhost/postgres\n DEBUG = True\n SQLALCHEMY_D...
false
6,092
6b0b60ec571cf026d0f0cff3d9517362c16b459b
import re from collections import OrderedDict OPENING_TAG = '<{}>' CLOSING_TAG= '</{}>' U_LIST = '<ul>{}</ul>' LIST_ITEM = '<li>{}</li>' STRONG = '<strong>{}</strong>' ITALIC = '<em>{}</em>' PARAGRAPH = '<p>{}</p>' HEADERS = OrderedDict({'######': 'h6', '#####': 'h5', '###...
[ "import re\nfrom collections import OrderedDict\n\nOPENING_TAG = '<{}>'\nCLOSING_TAG= '</{}>'\nU_LIST = '<ul>{}</ul>'\nLIST_ITEM = '<li>{}</li>'\nSTRONG = '<strong>{}</strong>'\nITALIC = '<em>{}</em>'\nPARAGRAPH = '<p>{}</p>'\nHEADERS = OrderedDict({'######': 'h6',\n '#####': 'h5',\n ...
false
6,093
43792a647243b9d667d6d98b62a086d742e8e910
from datetime import timedelta from django import template from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse from django.utils import timezone from api.analysis import * from api.models import Service register = template.Library() # ...
[ "from datetime import timedelta\n\nfrom django import template\nfrom django.conf import settings\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.core.urlresolvers import reverse\nfrom django.utils import timezone\n\nfrom api.analysis import *\nfrom api.models import Service\n\nregister = templat...
false
6,094
e7b1ccbcbb81ff02561d858a4db54d49a2aa0f8a
from django import forms from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm from .models import Upload class DocumentForm(forms.ModelForm): class Meta: model = Upload fields = ('document',)
[ "from django import forms\nfrom django.contrib.auth.models import User\nfrom django.contrib.auth.forms import UserCreationForm\nfrom .models import Upload\n\nclass DocumentForm(forms.ModelForm):\n class Meta:\n model = Upload\n fields = ('document',)\n", "from django import forms\nfrom django.con...
false
6,095
cbbb314a3262713f6cb2bb2dd90709d7bf1ca8eb
# i have created this file-hitu from django.http import HttpResponse from django.shortcuts import render from .forms import Sign_Up, Login from .models import Student # render is used to create and impot the templates # render takes first arg = request, 2nd arg = name of the file you want to import, 3rd arg = parame...
[ "# i have created this file-hitu\nfrom django.http import HttpResponse\nfrom django.shortcuts import render\nfrom .forms import Sign_Up, Login\nfrom .models import Student\n\n\n# render is used to create and impot the templates\n# render takes first arg = request, 2nd arg = name of the file you want to import, 3rd...
false
6,096
4a8e8994ec8734664a5965b81da9d146d8504f8d
import weakref from soma.controller import Controller from soma.functiontools import SomaPartial from traits.api import File, Undefined, Instance class MatlabConfig(Controller): executable = File(Undefined, output=False, desc='Full path of the matlab executable') def load_module(capsul_...
[ "import weakref\n\nfrom soma.controller import Controller\nfrom soma.functiontools import SomaPartial\nfrom traits.api import File, Undefined, Instance\n\nclass MatlabConfig(Controller):\n executable = File(Undefined, output=False,\n desc='Full path of the matlab executable')\n \ndef load...
false
6,097
d549303228e860ae278a5a9497a4a3a68989aeca
from packer.utils import hello_world
[ "from packer.utils import hello_world\n", "<import token>\n" ]
false
6,098
4c63072b6242507c9b869c7fd38228488fda2771
"""Test that Chopsticks remote processes can launch tunnels.""" from unittest import TestCase from chopsticks.helpers import output_lines from chopsticks.tunnel import Local, Docker, RemoteException from chopsticks.facts import python_version def ping_docker(): """Start a docker container and read out its Python ...
[ "\"\"\"Test that Chopsticks remote processes can launch tunnels.\"\"\"\nfrom unittest import TestCase\nfrom chopsticks.helpers import output_lines\nfrom chopsticks.tunnel import Local, Docker, RemoteException\nfrom chopsticks.facts import python_version\n\n\ndef ping_docker():\n \"\"\"Start a docker container an...
false
6,099
4736f4e06f166b3c3fd8379a2021eb84a34fcbd3
import socket import threading import os import time import psutil import shutil class server: def __init__(self): self.commandSock = socket.socket() self.commandPort = 8080 self.transferSock = socket.socket() self.transferPort = 8088 self.chatSock=socket.socket() ...
[ "import socket\nimport threading\nimport os\nimport time\nimport psutil\nimport shutil\n\n\n\nclass server:\n def __init__(self):\n self.commandSock = socket.socket()\n self.commandPort = 8080\n self.transferSock = socket.socket()\n self.transferPort = 8088\n self.chatSock=sock...
false