index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
10,300
c632f2f8b3fe7ab5f366a3f94b8dfa66c0ebf8cf
# Generated by Django 2.2.3 on 2019-08-10 16:13 from django.db import migrations import image_cropping.fields class Migration(migrations.Migration): dependencies = [ ('core', '0007_bannerimage_cropping'), ] operations = [ migrations.AddField( model_name='eventimage', ...
[ "# Generated by Django 2.2.3 on 2019-08-10 16:13\n\nfrom django.db import migrations\nimport image_cropping.fields\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('core', '0007_bannerimage_cropping'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='e...
false
10,301
4a0b0979038366a07d5b69344c96506fdfc58b55
import numpy as np def check_dim(X, dim): dimX = np.ndim(X) if(dimX != dim): raise ValueError("{0}d array is expected, but {1}d is given".format(dim, dimX))
[ "import numpy as np\n\ndef check_dim(X, dim):\n dimX = np.ndim(X)\n if(dimX != dim):\n raise ValueError(\"{0}d array is expected, but {1}d is given\".format(dim, dimX))\n", "import numpy as np\n\n\ndef check_dim(X, dim):\n dimX = np.ndim(X)\n if dimX != dim:\n raise ValueError('{0}d arra...
false
10,302
50e2d3baaf509d3b26bf4334b15e63266d497d4c
########################################### # Imports ########################################### import os, sys import math from collections import namedtuple, defaultdict from itertools import product, groupby, permutations, combinations rootRelativePath = '..' rootAbsolutePath = os.path.abspath(rootRelativePath) s...
[ "###########################################\n# Imports\n###########################################\n\nimport os, sys\nimport math\nfrom collections import namedtuple, defaultdict\nfrom itertools import product, groupby, permutations, combinations\n\nrootRelativePath = '..'\nrootAbsolutePath = os.path.abspath(root...
false
10,303
1c5bb1f97aebd71a12a5a0b7ff6eece6bcb49f2c
# Assignment 1 to print Hello World print("Hello world")
[ "# Assignment 1 to print Hello World\nprint(\"Hello world\")\n", "print('Hello world')\n", "<code token>\n" ]
false
10,304
070ad2a9aee634fc404f4767984d1a54a055a1c4
from django.contrib import admin from .models import Listing,Listing_Image,Review admin.site.register(Listing) admin.site.register(Listing_Image) admin.site.register(Review) # class Listing_ImageInline(admin.TabularInline): # model = Listing_Image # extra = 3 # # class ListingAdmin(admin.ModelAdmin): # ...
[ "from django.contrib import admin\n\nfrom .models import Listing,Listing_Image,Review\n\nadmin.site.register(Listing)\nadmin.site.register(Listing_Image)\nadmin.site.register(Review)\n\n\n\n# class Listing_ImageInline(admin.TabularInline):\n# model = Listing_Image\n# extra = 3\n#\n# class ListingAdmin(admin...
false
10,305
614e57c5c3456fb627b032c00bbb7c2959225b8d
"""Custom node groups""" import bpy from .node_arranger import tidy_tree # docs-special-members: __init__ # no-inherited-members class NodeGroup: """Generic Node Group""" TYPE = 'Compositor' def __init__(self, name: str, node_tree: bpy.types.NodeTree): """ A generic NodeGroup class :param name: Name of no...
[ "\"\"\"Custom node groups\"\"\"\nimport bpy\nfrom .node_arranger import tidy_tree\n\n# docs-special-members: __init__\n# no-inherited-members\n\n\nclass NodeGroup:\n\t\"\"\"Generic Node Group\"\"\"\n\tTYPE = 'Compositor'\n\n\tdef __init__(self, name: str, node_tree: bpy.types.NodeTree):\n\t\t\"\"\"\n\t\tA generic N...
false
10,306
850840b0e53a1f5a0d2b3b587db3ccca2f549a31
# range ile belirli araliktaki degerleri istedigimiz sekilde kullanabiliriz # python da ilk deger inclusive ikinci deger ise exclusive dir #yani ilk deger dahil ikinci deger ise dahil degildir for i in range(20): print("{}) {}".format(i,('*'*i)))
[ "# range ile belirli araliktaki degerleri istedigimiz sekilde kullanabiliriz\n\n# python da ilk deger inclusive ikinci deger ise exclusive dir\n#yani ilk deger dahil ikinci deger ise dahil degildir\n\nfor i in range(20):\n print(\"{}) {}\".format(i,('*'*i)))\n", "for i in range(20):\n print('{}) {}'.format(...
false
10,307
6523d2a3245119bd9cfec5d87fd3f71eb058736d
# coding=utf-8 ''' 给定一个二叉树,判断其是否是一个有效的二叉搜索树。 假设一个二叉搜索树具有如下特征: 节点的左子树只包含小于当前节点的数。 节点的右子树只包含大于当前节点的数。 所有左子树和右子树自身必须也是二叉搜索树。 示例 1: 输入: 2 / \ 1 3 输出: true 示例 2: 输入: 5 / \ 1 4   / \   3 6 输出: false ...
[ "# coding=utf-8\n'''\n 给定一个二叉树,判断其是否是一个有效的二叉搜索树。\n \n 假设一个二叉搜索树具有如下特征:\n \n 节点的左子树只包含小于当前节点的数。\n 节点的右子树只包含大于当前节点的数。\n 所有左子树和右子树自身必须也是二叉搜索树。\n 示例 1:\n \n 输入:\n 2\n / \\\n 1 3\n 输出: true\n 示例 2:\n \n 输入:\n 5\n / \\\n 1 4\n   / \\\...
false
10,308
b970b43ec2ed15f3352334da25960774ab99c60a
import numpy, h5py, matplotlib import matplotlib.pyplot as plt import os import scipy.signal as sp import numpy as np import bead_util as bu import os, re, time, glob startfile = 0 endfile = 200 path = r"C:\data\20170925\bead4_15um_QWP_NS\steps\DC" file_list = glob.glob(path+"\*.h5") def list_file_time_order(filel...
[ "import numpy, h5py, matplotlib\nimport matplotlib.pyplot as plt\nimport os\nimport scipy.signal as sp\nimport numpy as np\nimport bead_util as bu\nimport os, re, time, glob\n\n\nstartfile = 0\nendfile = 200\n\npath = r\"C:\\data\\20170925\\bead4_15um_QWP_NS\\steps\\DC\"\n\nfile_list = glob.glob(path+\"\\*.h5\")\n\...
true
10,309
3064aeed019a24409a9bf734bc8cc9b4dcab118b
cinsiyet=input("Cinsiyetiniz: (E/K)") if cinsiyet==("E"): print("Erkek") elif cinsiyet==("K"): print("Kadın") else : print("Hatalı seçim.")
[ "cinsiyet=input(\"Cinsiyetiniz: (E/K)\")\r\nif cinsiyet==(\"E\"):\r\n print(\"Erkek\")\r\nelif cinsiyet==(\"K\"):\r\n print(\"Kadın\")\r\nelse :\r\n print(\"Hatalı seçim.\")", "cinsiyet = input('Cinsiyetiniz: (E/K)')\nif cinsiyet == 'E':\n print('Erkek')\nelif cinsiyet == 'K':\n print('Kadın')\nels...
false
10,310
41086f5b9e74eeeadfe6d3ef42c65ff02a04f92c
""" Created on Oct 20, 2013 @author: Ofra """ from action import Action from actionLayer import ActionLayer from util import Pair from proposition import Proposition from propositionLayer import PropositionLayer class PlanGraphLevel(object): """ A class for representing a level in the plan graph. For each level...
[ "\"\"\"\nCreated on Oct 20, 2013\n\n@author: Ofra\n\"\"\"\nfrom action import Action\nfrom actionLayer import ActionLayer\nfrom util import Pair\nfrom proposition import Proposition\nfrom propositionLayer import PropositionLayer\n\nclass PlanGraphLevel(object):\n \"\"\"\n A class for representing a level in the p...
false
10,311
c511f17d734c3104c8e4cbc02ddb5757ddd58818
import numpy as np import matplotlib.pyplot as plt # Make a scatter plot by drawing 100 items from a mixture distribution # 0.3N((1,0)^T, (1 & 0.2 \\ 0.2 & 1)) + 0.7N((-1,0)^T,(1 & -0.2 \\ -0.2 & 1)). # mean vector and covariance matrix mu1 = np.array([1, 0]) Sigma1 = np.array([[1, 0.2], [0.2, 1]]) mu2 = np....
[ "import numpy as np\r\nimport matplotlib.pyplot as plt\r\n\r\n# Make a scatter plot by drawing 100 items from a mixture distribution\r\n# 0.3N((1,0)^T, (1 & 0.2 \\\\ 0.2 & 1)) + 0.7N((-1,0)^T,(1 & -0.2 \\\\ -0.2 & 1)).\r\n\r\n# mean vector and covariance matrix\r\nmu1 = np.array([1, 0])\r\nSigma1 = np.array([[1, 0....
false
10,312
f99afc8bcf0d26241644ca8510091779c82c1c5a
# coding:utf-8 import requests import re import urllib3 from bs4 import BeautifulSoup urllib3.disable_warnings() # 登陆拉勾网 s = requests.session() url1 = "https://passport.lagou.com/login/login.html" r1 = s.get(url1,verify=False) print(r1.status_code) # print(r1.content.decode("utf-8")) res = r1.content.decode("utf-8")...
[ "# coding:utf-8\nimport requests\nimport re\nimport urllib3\nfrom bs4 import BeautifulSoup\nurllib3.disable_warnings()\n\n# 登陆拉勾网\n\ns = requests.session()\nurl1 = \"https://passport.lagou.com/login/login.html\"\n\nr1 = s.get(url1,verify=False)\nprint(r1.status_code)\n# print(r1.content.decode(\"utf-8\"))\nres = r1...
false
10,313
99da42061e36a4e7d8d8bfe10663986181f5d5e1
class HiddenAnswer(object): def __init__(self, correct_answer): self.correct_answer = correct_answer self.hidden_answer = '_' * len(self.correct_answer) def reveal(self, guessed_letter): hidden = '' for position, letter in enumerate(self.correct_answer): if letter =...
[ "\nclass HiddenAnswer(object):\n def __init__(self, correct_answer):\n self.correct_answer = correct_answer\n self.hidden_answer = '_' * len(self.correct_answer)\n\n def reveal(self, guessed_letter):\n hidden = ''\n for position, letter in enumerate(self.correct_answer):\n ...
false
10,314
a366a87bc3ab931a4326c4e61c1af7d3ad1e2072
#!/opt/app/cacheDB/python/bin/python3 """ A script for getting data objects from Vertica References: Vertica Python - https://github.com/uber/vertica-python """ import vertica_python import logging # Set the logging level to DEBUG logging.basicConfig(level=logging.INFO) conn_info = {'host': 'stg-wavert01.bodc.att.com...
[ "#!/opt/app/cacheDB/python/bin/python3\n\"\"\"\nA script for getting data objects from Vertica\nReferences: Vertica Python - https://github.com/uber/vertica-python\n\"\"\"\nimport vertica_python\nimport logging\n\n# Set the logging level to DEBUG\nlogging.basicConfig(level=logging.INFO)\n\nconn_info = {'host': 'stg...
false
10,315
39e7eae39e10a72fafa6afab6e4ceeb8dce223a2
import re import hashlib import os import base64 import random def login(): while True: username = input("Username: ") if len(username) == 0: print("Username can not be empty") elif len(username) > 20: print("Username is too long") elif re.se...
[ "import re\r\nimport hashlib\r\nimport os\r\nimport base64\r\nimport random\r\n\r\n\r\n\r\ndef login():\r\n while True:\r\n username = input(\"Username: \")\r\n if len(username) == 0:\r\n print(\"Username can not be empty\")\r\n elif len(username) > 20:\r\n print(\"User...
false
10,316
beea8a00565174cc993dd9f134627aec1edc2bb4
import sys sys.setrecursionlimit(10000) n, m = map(int, sys.stdin.readline().split()) a = [[] for _ in range(n+1)] check = [False]*(n+1) for _ in range(m): u, v = map(int, sys.stdin.readline().split()) a[u].append(v) a[v].append(u) def dfs(now): check[now] = True for i in a[now]: if check[...
[ "import sys\nsys.setrecursionlimit(10000)\n\nn, m = map(int, sys.stdin.readline().split())\na = [[] for _ in range(n+1)]\ncheck = [False]*(n+1)\nfor _ in range(m):\n u, v = map(int, sys.stdin.readline().split())\n a[u].append(v)\n a[v].append(u)\n\ndef dfs(now):\n check[now] = True\n for i in a[now]:...
false
10,317
5ca187ae37972da2da99714cedcdcfb3671857fc
import fasttext import numpy as np class Classifier: def __init__(self): self.model_path = './model_cooking.bin' def train(self): model = fasttext.load_model(self.model_path) self._save(model) def predict(self, title, body): model = fasttext.load_model(self.model_path) ...
[ "import fasttext\nimport numpy as np\n\nclass Classifier:\n def __init__(self):\n self.model_path = './model_cooking.bin'\n\n def train(self):\n model = fasttext.load_model(self.model_path)\n self._save(model)\n\n def predict(self, title, body):\n model = fasttext.load_model(sel...
false
10,318
5f321d436bc4861bcf0f6df7e3a3e0edc839fb76
import pytest from voyage.exceptions import QueryException from voyage.models import Comment, Membership, Voyage from voyage.schema.queries import VoyageQuery def test_getting_all_voyages(db_voyage): voyages = VoyageQuery.resolve_voyages('root', 'info').all() assert voyages == [db_voyage] def test_getting_...
[ "import pytest\n\nfrom voyage.exceptions import QueryException\nfrom voyage.models import Comment, Membership, Voyage\nfrom voyage.schema.queries import VoyageQuery\n\n\ndef test_getting_all_voyages(db_voyage):\n voyages = VoyageQuery.resolve_voyages('root', 'info').all()\n assert voyages == [db_voyage]\n\n\n...
false
10,319
ddcaef981ec2d22e877718d03562abbdee86ada6
from xai.brain.wordbase.nouns._retrofit import _RETROFIT #calss header class _RETROFITTING(_RETROFIT, ): def __init__(self,): _RETROFIT.__init__(self) self.name = "RETROFITTING" self.specie = 'nouns' self.basic = "retrofit" self.jsondata = {}
[ "\n\nfrom xai.brain.wordbase.nouns._retrofit import _RETROFIT\n\n#calss header\nclass _RETROFITTING(_RETROFIT, ):\n\tdef __init__(self,): \n\t\t_RETROFIT.__init__(self)\n\t\tself.name = \"RETROFITTING\"\n\t\tself.specie = 'nouns'\n\t\tself.basic = \"retrofit\"\n\t\tself.jsondata = {}\n", "from xai.brain.wordbase....
false
10,320
bfefdf164b159135d6698981278e90e418c94e08
#!/bin/env python import math name = input("Name: ") description = input("Description: ") typename = input("Typename: ") category = input("Category: ") erosion_type = input("Erosion type: ") res_ = {} res_per_progress = {} while True: res = input("Resource: ") amount = input("Amount: ") if not...
[ "#!/bin/env python\n\nimport math\n\nname = input(\"Name: \")\ndescription = input(\"Description: \")\ntypename = input(\"Typename: \")\ncategory = input(\"Category: \")\nerosion_type = input(\"Erosion type: \")\n\nres_ = {}\nres_per_progress = {}\n\nwhile True:\n \n res = input(\"Resource: \")\n amount = ...
false
10,321
31621cf9a156fead21a71c136456361ea27b28b6
class Turtle: def __init__(self, x): self.num = x class Fish: def __init__(self, x): self.num = x class Pool: def __init__(self, x, y): self.turtle = Turtle(x).num self.fish = Fish(y).num def print_num(self): print('水池中乌龟%d只,小鱼%d条' % (self.turtle, self.fish)) pool = Pool(10, 100) poo...
[ "class Turtle:\n def __init__(self, x):\n self.num = x\n\nclass Fish:\n def __init__(self, x):\n self.num = x\n\nclass Pool:\n def __init__(self, x, y):\n self.turtle = Turtle(x).num\n self.fish = Fish(y).num \n\n def print_num(self):\n print('水池中乌龟%d只,小鱼%d条' % (self.turtle, self.fish))\n\npool...
false
10,322
79acaf993c08a2002ffcb060825225c45e2548a3
# Generated by Django 3.2.3 on 2021-05-21 08:17 from django.db import migrations, models import django.db.models.deletion import tinymce.models class Migration(migrations.Migration): dependencies = [ ('education', '0010_student'), ] operations = [ migrations.CreateModel( nam...
[ "# Generated by Django 3.2.3 on 2021-05-21 08:17\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\nimport tinymce.models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('education', '0010_student'),\n ]\n\n operations = [\n migrations.CreateMod...
false
10,323
7183346b0ba501b080f4596e260d4dda082d1d3f
""" CAD model for camera mounting posts. """ from py2scad import * from part import Part class Camera_Post(Part): def make(self): dxf_profile = self.params['dxf_profile'] length = self.params['length'] width = self.params['width'] part = Linear_DXF_Extrude(dxf_profile,height=length...
[ "\"\"\"\nCAD model for camera mounting posts.\n\"\"\"\nfrom py2scad import *\nfrom part import Part\n\nclass Camera_Post(Part):\n\n def make(self):\n dxf_profile = self.params['dxf_profile']\n length = self.params['length']\n width = self.params['width']\n part = Linear_DXF_Extrude(dx...
false
10,324
800bb4114af7a2c3161505c27f8d32928e7019bf
from reportlab.lib import utils from reportlab.pdfgen import canvas from reportlab.lib.units import cm from reportlab.lib.pagesizes import landscape, A4 from django.contrib.staticfiles.storage import staticfiles_storage PAGE_SIZE = landscape(A4) def render_pdf(session, fileobj): c = canvas.Canvas(fileobj, pagesi...
[ "from reportlab.lib import utils\nfrom reportlab.pdfgen import canvas\nfrom reportlab.lib.units import cm\nfrom reportlab.lib.pagesizes import landscape, A4\n\nfrom django.contrib.staticfiles.storage import staticfiles_storage\n\nPAGE_SIZE = landscape(A4)\n\ndef render_pdf(session, fileobj):\n c = canvas.Canvas(...
false
10,325
9bdd5fdbc78aaa1433fe29fb515fcfe3582e6bee
import random def checking(i): try: float(i) return True except ValueError: return False play = True proceed = False while True: rand = random.randint(1,9) guessCount = 0 userGuess = raw_input("Guess a number: ") if userGuess == "exit": quit() else: ...
[ "import random\n\ndef checking(i):\n try:\n float(i)\n return True\n except ValueError:\n return False\n\n\nplay = True\nproceed = False\n\n\nwhile True:\n rand = random.randint(1,9)\n guessCount = 0\n userGuess = raw_input(\"Guess a number: \")\n if userGuess == \"exit\":\n...
false
10,326
67196941bf8c17b30bb418b5614317d29aab67d1
# Generated by Django 3.0.4 on 2020-03-08 17:24 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("api", "0001_create_model_question"), ] operations = [ migrations.AlterField( model_name="question", name="answer_cor...
[ "# Generated by Django 3.0.4 on 2020-03-08 17:24\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n (\"api\", \"0001_create_model_question\"),\n ]\n\n operations = [\n migrations.AlterField(\n model_name=\"question\",\n ...
false
10,327
bedbce828e15d9d9cce130af40efb510f266dfd5
from django.urls import re_path, path from . import views # https://stackoverflow.com/a/59604748 urlpatterns = [ path('', views.index), re_path(r'^.*/$', views.index) ]
[ "from django.urls import re_path, path\nfrom . import views\n\n\n# https://stackoverflow.com/a/59604748\nurlpatterns = [\n\tpath('', views.index),\n\tre_path(r'^.*/$', views.index)\n]\n", "from django.urls import re_path, path\nfrom . import views\nurlpatterns = [path('', views.index), re_path('^.*/$', views.inde...
false
10,328
65d46feb6ac23ec715552fa718484606f925b84b
import pycountry from pycountry_convert.convert_country_alpha2_to_continent_code import country_alpha2_to_continent_code europe = [] for c in pycountry.countries: try: continent = country_alpha2_to_continent_code(c.alpha_2) except KeyError: continue if continent != "EU": continue...
[ "import pycountry\nfrom pycountry_convert.convert_country_alpha2_to_continent_code import country_alpha2_to_continent_code\n\n\neurope = []\n\n\nfor c in pycountry.countries:\n try:\n continent = country_alpha2_to_continent_code(c.alpha_2)\n except KeyError:\n continue\n if continent != \"EU\...
false
10,329
c35569cff725d433a4e35229fd9fd2ea3aadb512
import unittest import HW6 class TestHW6(unittest.TestCase): def test_111(self): self.assertEqual(HW6.solve([1,1,1,1,1,1]), 1) def test_123(self): self.assertEqual(HW6.solve([1,2,3]), 3) def test_2(self): self.assertEqual(HW6.solve([3,4,5,6]), 6) def test_3(self): sel...
[ "import unittest\nimport HW6\nclass TestHW6(unittest.TestCase):\n\n def test_111(self):\n self.assertEqual(HW6.solve([1,1,1,1,1,1]), 1)\n\n def test_123(self):\n self.assertEqual(HW6.solve([1,2,3]), 3)\n\n def test_2(self):\n self.assertEqual(HW6.solve([3,4,5,6]), 6)\n\n def test_3(...
false
10,330
a51dfa8ab8c344a7f1552a1759d3c1bc57b0dbe0
#External imports from flask import Flask from flask_restful import Resource, Api, reqparse import json #Import classes from task_service.task import Task, TaskList # Create an instance of Flask app = Flask(__name__) api = Api(app) api.add_resource(Task,'/tasks/<int:identifier>') api.add_resource(TaskList, '/tasks'...
[ "#External imports\nfrom flask import Flask\nfrom flask_restful import Resource, Api, reqparse\nimport json\n\n#Import classes\nfrom task_service.task import Task, TaskList\n\n\n# Create an instance of Flask\napp = Flask(__name__)\napi = Api(app)\n\napi.add_resource(Task,'/tasks/<int:identifier>')\napi.add_resource...
false
10,331
1b444c742fca9e13e1f0141ab675e4b7f1a68020
class Employee: company = "Bharat Gas" salary = 5600 salaryBonas = 500 # totalSalary = 6100 @property def totalSalary(self): return self.salary + self.salaryBonas @totalSalary.setter def totalSalary(self, val): self.salaryBonas = val - self.salary e = Employee() prin...
[ "class Employee:\n company = \"Bharat Gas\"\n salary = 5600\n salaryBonas = 500\n # totalSalary = 6100\n\n @property\n def totalSalary(self):\n return self.salary + self.salaryBonas\n\n @totalSalary.setter\n def totalSalary(self, val):\n self.salaryBonas = val - self.salary\n\n...
false
10,332
5e4608934d258a6c00770b88b9224e5a8ab8fedc
from pymysql import connect, cursors from pymysql.err import OperationalError import os import configparser _base_dir = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0] _db_config_file = 'db_config.ini' _cf = configparser.ConfigParser() _cf.read(os.path.join(_base_dir, _db_config_file)) host = _cf.get("...
[ "from pymysql import connect, cursors\nfrom pymysql.err import OperationalError\nimport os\nimport configparser\n\n\n_base_dir = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]\n_db_config_file = 'db_config.ini'\n\n_cf = configparser.ConfigParser()\n_cf.read(os.path.join(_base_dir, _db_config_file))\n\...
false
10,333
4745470ef771415383d1bbe6b9ab04e1f750d57d
# Generated by Django 3.1.2 on 2020-12-01 13:36 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), ('galleryview', '0004_remo...
[ "# Generated by Django 3.1.2 on 2020-12-01 13:36\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 ('galleryv...
false
10,334
68618de734696fd9a2c335031e96cf4171016186
from .abstractgameunit import AbstractGameUnit class OrcRider(AbstractGameUnit): def __init__(self, name = ''): super().__init__(name = name) self.max_hp = 30 self.health_meter = self.max_hp self.unit_type = 'enemy' self.hut_number = 0 def info(self): print("I'...
[ "from .abstractgameunit import AbstractGameUnit\n\nclass OrcRider(AbstractGameUnit):\n\n def __init__(self, name = ''):\n super().__init__(name = name)\n self.max_hp = 30\n self.health_meter = self.max_hp\n self.unit_type = 'enemy'\n self.hut_number = 0\n\n def info(self):\n...
false
10,335
8ea01c453590fbde8210bafa6601f597c80de5e8
def greet(name, age): message = "Your name is " + name + " and you are " + age + " years old." return message name = input("Enter your name: ") age = input("Enter your age: ") print(greet(name, age)) def add(a, b): return a + b def subtract(a, b): return a - b num_one = int(input("Enter a number: "...
[ "def greet(name, age):\n message = \"Your name is \" + name + \" and you are \" + age + \" years old.\"\n return message\n\nname = input(\"Enter your name: \")\nage = input(\"Enter your age: \")\n\nprint(greet(name, age))\n\ndef add(a, b):\n return a + b\n\ndef subtract(a, b):\n return a - b\n\nnum_one ...
false
10,336
97c6365f0109ba99c9526258c5a595e2c5cf524e
import pyodbc import pyzure def to_azure(result, all_batch_id, azure_instance): all_batch_id = ["'" + e + "'" for e in all_batch_id] azure_table = result["table_name"] print(azure_table) if all_batch_id: try: query = 'DELETE FROM ' + azure_table + ' WHERE batch_id IN ' + "(" + ","....
[ "import pyodbc\nimport pyzure\n\n\ndef to_azure(result, all_batch_id, azure_instance):\n all_batch_id = [\"'\" + e + \"'\" for e in all_batch_id]\n azure_table = result[\"table_name\"]\n print(azure_table)\n if all_batch_id:\n try:\n query = 'DELETE FROM ' + azure_table + ' WHERE batch...
false
10,337
fea43a3b50f59f4209fb8dbf1a1afd53050fd986
#Write a Python program to sum all the items in a list. def sum_list(inp_list): sum = 0 for item in inp_list: sum += item return sum def main(): inp_list = [1,2,3,4,5,6,7,8,9,10] print('The sum of all the elements of the list is:',sum_list(inp_list)) main()
[ "#Write a Python program to sum all the items in a list.\n\n\ndef sum_list(inp_list):\n sum = 0\n for item in inp_list:\n sum += item\n return sum\n\n\ndef main():\n inp_list = [1,2,3,4,5,6,7,8,9,10]\n print('The sum of all the elements of the list is:',sum_list(inp_list))\n\n\nmain()\n", "d...
false
10,338
1c22b822a30f860aeb818634e0dbffb995b4e3cc
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Apr 6 12:55:42 2018 @author: Yacong """ import glob,os import numpy as np import matplotlib.pyplot as plt import math type_lookup_file = 'id-type.tab' dump_file_head = 'dump.fc_0.' path_to_splitted_dump = './25GPa_threshold_0_ref/' bin_width = 0.1 # ...
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Fri Apr 6 12:55:42 2018\n\n@author: Yacong\n\"\"\"\n\nimport glob,os\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport math\n\ntype_lookup_file = 'id-type.tab'\ndump_file_head = 'dump.fc_0.'\npath_to_splitted_dump = './25GPa_threshold_...
false
10,339
6d26e21caf8b21124a243eadfa585571b7476620
import os from flask import Flask from flask_migrate import Migrate from app.config import DevelopmentConfig, app_config from app.models import db from app.controllers import stadium_groups_controller from app.controllers import stadiums_controller from app.controllers import stadium_controller from app.models.stadiu...
[ "import os\n\nfrom flask import Flask\nfrom flask_migrate import Migrate\n\nfrom app.config import DevelopmentConfig, app_config\nfrom app.models import db\nfrom app.controllers import stadium_groups_controller\nfrom app.controllers import stadiums_controller\nfrom app.controllers import stadium_controller\nfrom ap...
false
10,340
8b7c860597a9345dd7f274a3f9ce4a26db5ea125
''' Created on March 15, 2013 @author: nils ''' from django.contrib import admin from annotation_server.models import * admin.site.register(Taxon) admin.site.register(GenomeBuild)
[ "'''\nCreated on March 15, 2013\n\n@author: nils\n'''\n\nfrom django.contrib import admin\nfrom annotation_server.models import *\n\nadmin.site.register(Taxon)\nadmin.site.register(GenomeBuild)\n", "<docstring token>\nfrom django.contrib import admin\nfrom annotation_server.models import *\nadmin.site.register(Ta...
false
10,341
f1b18c9a0a75a074f0f318525d13fdabd54431b4
from sqlalchemy import ( Column, DateTime, ForeignKey, Integer, String, ) from sqlalchemy.orm import relationship from sqlalchemy.ext.associationproxy import association_proxy from clusterflunk.models.base import Base class Group(Base): __tablename__ = 'groups' name = Column(String(100))...
[ "from sqlalchemy import (\n Column,\n DateTime,\n ForeignKey,\n Integer,\n String,\n)\nfrom sqlalchemy.orm import relationship\nfrom sqlalchemy.ext.associationproxy import association_proxy\n\nfrom clusterflunk.models.base import Base\n\n\nclass Group(Base):\n __tablename__ = 'groups'\n\n name ...
false
10,342
724319362c76645e150ee1c37ed8e6dccb1732ef
# -*- coding: utf-8 -*- import math def _raise_dim_error(dim1, dim2): raise ValueError("Vector Operands have %d != %d Dims!" % (dim1, dim2)) def _raise_type_error(desc, wanted, got): raise TypeError("%s requires a %s, got a %s: %s" % (desc, wanted, type(got).__name__, str(got))) def un...
[ "# -*- coding: utf-8 -*-\nimport math\n\n\ndef _raise_dim_error(dim1, dim2):\n raise ValueError(\"Vector Operands have %d != %d Dims!\" % (dim1, dim2))\n\n\ndef _raise_type_error(desc, wanted, got):\n raise TypeError(\"%s requires a %s, got a %s: %s\"\n % (desc, wanted, type(got).__name__, ...
false
10,343
cf3cea841cd34533d939b0264fb071b70df3070f
#!/usr/bin/python def get_clustering(): f = open('clusterings.txt') cl = {} cli = {} for s in f: s = s.strip() topicid, clusterid, docs = s.split(' ', 2) docs = docs.split() key = "%s:%s" % (topicid, clusterid) cl[key] = docs for doc in docs: if not cli.has_key(doc): cli[doc] = key else:...
[ "#!/usr/bin/python\n\ndef get_clustering():\n\tf = open('clusterings.txt')\n\n\tcl = {}\n\tcli = {}\n\n\tfor s in f:\n\t\ts = s.strip()\n\t\ttopicid, clusterid, docs = s.split(' ', 2)\n\t\tdocs = docs.split()\n\t\n\t\tkey = \"%s:%s\" % (topicid, clusterid)\n\t\tcl[key] = docs\n\n\t\tfor doc in docs:\n\t\t\tif not c...
true
10,344
9b9d012e10333cce663aad0f1c5a5795d8529bcc
#!/usr/bin/env python3.5 ''' openlut: A package for managing and applying 1D and 3D LUTs. Color Management: openlut deals with the raw RGB values, does its work, then puts out images with correct raw RGB values - a no-op. Dependencies: -numpy: Like, everything. -wand: Saving/loading images. -PyOpenGL - For image ...
[ "#!/usr/bin/env python3.5\n\n'''\nopenlut: A package for managing and applying 1D and 3D LUTs.\n\nColor Management: openlut deals with the raw RGB values, does its work, then puts out images with correct raw RGB values - a no-op.\n\nDependencies:\n\t-numpy: Like, everything.\n\t-wand: Saving/loading images.\n\t-PyO...
false
10,345
f53a3c05ad8d04f2706c844bb63028d97bbe7b37
# Here we will read xml file using python. # Importing libraries/modules import os import codecs import csv import bz2 import time import json import logging import argparse class Requirements(): def __init__(self, args): dump_path = args.dump_path if dump_path is None: dump_path = os...
[ "# Here we will read xml file using python.\n\n# Importing libraries/modules\nimport os\nimport codecs\nimport csv\nimport bz2\nimport time\nimport json\nimport logging\nimport argparse\n\n\nclass Requirements():\n def __init__(self, args):\n dump_path = args.dump_path\n if dump_path is None:\n ...
false
10,346
13cfed24aa13e33bd0562ea0d5022d72aca0e5c6
# This Python file uses the following encoding: utf-8 """autogenerated by genpy from map_file/Lane.msg. Do not edit.""" import sys python3 = True if sys.hexversion > 0x03000000 else False import genpy import struct class Lane(genpy.Message): _md5sum = "14eee265f5c4b4e93a294e03e3451866" _type = "map_file/Lane" _...
[ "# This Python file uses the following encoding: utf-8\n\"\"\"autogenerated by genpy from map_file/Lane.msg. Do not edit.\"\"\"\nimport sys\npython3 = True if sys.hexversion > 0x03000000 else False\nimport genpy\nimport struct\n\n\nclass Lane(genpy.Message):\n _md5sum = \"14eee265f5c4b4e93a294e03e3451866\"\n _typ...
false
10,347
dcae57870138f70581d9d555558173263a8d4a59
__author__ = 'mithrawnuruodo' from Stepper import SoncebosStepper from DataModels import RawData, Data, PrintingTaskData
[ "__author__ = 'mithrawnuruodo'\n\nfrom Stepper import SoncebosStepper\nfrom DataModels import RawData, Data, PrintingTaskData", "__author__ = 'mithrawnuruodo'\nfrom Stepper import SoncebosStepper\nfrom DataModels import RawData, Data, PrintingTaskData\n", "__author__ = 'mithrawnuruodo'\n<import token>\n", "<a...
false
10,348
95309fa1a5a5288d32d870a9c6d1a034906f5c6d
# Generated by Django 2.0 on 2021-05-10 06:07 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('login', '0008_auto_20210510_1131'), ] operations = [ migrations.RemoveField( model_name='user', name='otp', ),...
[ "# Generated by Django 2.0 on 2021-05-10 06:07\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('login', '0008_auto_20210510_1131'),\n ]\n\n operations = [\n migrations.RemoveField(\n model_name='user',\n nam...
false
10,349
84d7c272e009fdf25f69ffdc8f15c42853d32e3e
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import logging import re class WikiPipeline(object): def process_item(self, item, spider): list_of_age = [] ...
[ "# -*- coding: utf-8 -*-\n\n# Define your item pipelines here\n#\n# Don't forget to add your pipeline to the ITEM_PIPELINES setting\n# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html\n\nimport logging\nimport re\n\nclass WikiPipeline(object):\n def process_item(self, item, spider):\n list_o...
false
10,350
bfba4caa5f13f30ba0d310c0e55d8ebd7bba728d
# -*- coding: utf-8 -*- """ fabrik.ext.npm ------------------------- """ from fabric.decorators import task from fabric.state import env def install(): env.run("npm install")
[ "# -*- coding: utf-8 -*-\n\n\"\"\"\nfabrik.ext.npm\n-------------------------\n\"\"\"\n\nfrom fabric.decorators import task\nfrom fabric.state import env\n\n\ndef install():\n env.run(\"npm install\")\n", "<docstring token>\nfrom fabric.decorators import task\nfrom fabric.state import env\n\n\ndef install():\n...
false
10,351
64f62b598b53c57fdc870e753bb2fb1594b0c3c9
from django.shortcuts import render, reverse, HttpResponseRedirect from django_mptt_hierarchy.models import File from django_mptt_hierarchy.forms import FileAddForm from django.views import View def homepage_view(request): return render(request, "homepage.html", {"files": File.objects.all()}) def file_add_view(...
[ "from django.shortcuts import render, reverse, HttpResponseRedirect\nfrom django_mptt_hierarchy.models import File\nfrom django_mptt_hierarchy.forms import FileAddForm\nfrom django.views import View\n\n\ndef homepage_view(request):\n return render(request, \"homepage.html\", {\"files\": File.objects.all()})\n\n\...
false
10,352
0d7c3f33c1d1a53905911ef255de12197de62ccd
# cython: language_level=3 from __future__ import absolute_import from .PyrexTypes import CType, CTypedefType, CStructOrUnionType import cython try: import pythran pythran_is_pre_0_9 = tuple(map(int, pythran.__version__.split('.')[0:2])) < (0, 9) pythran_is_pre_0_9_6 = tuple(map(int, pythran.__version__...
[ "# cython: language_level=3\n\nfrom __future__ import absolute_import\n\nfrom .PyrexTypes import CType, CTypedefType, CStructOrUnionType\n\nimport cython\n\ntry:\n import pythran\n pythran_is_pre_0_9 = tuple(map(int, pythran.__version__.split('.')[0:2])) < (0, 9)\n pythran_is_pre_0_9_6 = tuple(map(int, pyt...
false
10,353
9250e0b366c00826c2ffd9b36c3d6e0c97b57798
import pexpect import re import _thread import threading import json import math import time from queue import Queue from threading import Timer from time import sleep from videoplayer import VideoPlayer from gpiocontroller import GPIOController from datastore import DataStore from playlist import Playlist from link im...
[ "import pexpect\nimport re\nimport _thread\nimport threading\nimport json\nimport math\nimport time\nfrom queue import Queue\nfrom threading import Timer\nfrom time import sleep\nfrom videoplayer import VideoPlayer\nfrom gpiocontroller import GPIOController\nfrom datastore import DataStore\nfrom playlist import Pla...
false
10,354
9d9108b8e34005b0a218c63e0bff09bad8b0ac20
import re def hey(said): # if(any(x.isupper() for x in said[1:]) and '?' not in said): if said.isupper(): return 'Whoa, chill out!' elif len(said) > 0 and said[len(said)-1] == '?': return 'Sure.' elif re.search('[a-zA-Z0-9]', said) is None: return 'Fine. Be that way!' elif(len(said)>0): return 'Whatever.'...
[ "import re\n\ndef hey(said):\n\t# if(any(x.isupper() for x in said[1:]) and '?' not in said):\n\tif said.isupper():\n\t\treturn 'Whoa, chill out!'\n\telif len(said) > 0 and said[len(said)-1] == '?':\n\t\treturn 'Sure.'\n\telif re.search('[a-zA-Z0-9]', said) is None:\n\t\treturn 'Fine. Be that way!'\n\telif(len(said...
false
10,355
f9773711fb486582a61c605812563f5d907e02e3
from utils import * import matplotlib.pyplot as plt # ************************************* # Question 2 # ************************************* # Utilisation de la fonciton rand_gauss n=200 m=[1, 2] sigma=[0.1, 0.2] data = rand_gauss(n, m, sigma) plt.hist(data[:,0]) plt.hist(data[:,1]) plot_2d(data) # Utilisatio...
[ "from utils import *\nimport matplotlib.pyplot as plt\n\n# *************************************\n# Question 2\n# *************************************\n\n# Utilisation de la fonciton rand_gauss\n\nn=200\nm=[1, 2]\nsigma=[0.1, 0.2]\n\ndata = rand_gauss(n, m, sigma)\n\nplt.hist(data[:,0])\nplt.hist(data[:,1])\nplot_...
true
10,356
8bd097acf85b51e4e7c9cd5228c40a9ccd084f3d
import os import csv import torch from itertools import groupby from typing import List, Dict from torch.utils.data import DataLoader, RandomSampler, SequentialSampler from collections import Counter from sklearn.utils import shuffle def flatten(l): return [i for sublist in l for i in sublist] def save_predicti...
[ "import os\nimport csv\nimport torch\nfrom itertools import groupby\nfrom typing import List, Dict\nfrom torch.utils.data import DataLoader, RandomSampler, SequentialSampler\nfrom collections import Counter\nfrom sklearn.utils import shuffle\n\n\ndef flatten(l):\n return [i for sublist in l for i in sublist]\n\n...
false
10,357
ffe9e00143e1a9a0ef6ccb8e4e7bc8baaebd1c69
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # import os import argparse import subprocess import circling_r from circling_py.OBc import * levels = ["A","B","C","D","E*","E**","F"] def getOpt(): parser = argparse.ArgumentParser(description="Audit species barcodes from OBc pipeline", add_help=True) parse...
[ "#!/usr/bin/env python3\n\n# -*- coding: utf-8 -*- #\nimport os\nimport argparse\nimport subprocess\nimport circling_r\nfrom circling_py.OBc import *\n\n\nlevels = [\"A\",\"B\",\"C\",\"D\",\"E*\",\"E**\",\"F\"]\n\ndef getOpt():\n\n parser = argparse.ArgumentParser(description=\"Audit species barcodes from OBc pi...
false
10,358
38064f01b5d80fb3f95a8e35f35eb23201e45e49
from django.shortcuts import render # Create your views here. from django.http import HttpResponse def index(request): return HttpResponse("WELCOME RUCHI") def index1(request): return HttpResponse("helloooo")
[ "from django.shortcuts import render\n\n# Create your views here.\nfrom django.http import HttpResponse\n\ndef index(request):\n return HttpResponse(\"WELCOME RUCHI\")\ndef index1(request):\n return HttpResponse(\"helloooo\")\n\n", "from django.shortcuts import render\nfrom django.http import HttpResponse\n...
false
10,359
4e535457c809608ee0856f95584f95e54884559a
PlotGrid(2, 2, p1, p2 ,p3, p4) # PlotGrid object containing: # Plot[0]:Plot object containing: # [0]: cartesian line: x for x over (-5.0, 5.0) # [1]: cartesian line: x**2 for x over (-5.0, 5.0) # [2]: cartesian line: x**3 for x over (-5.0, 5.0) # Plot[1]:Plot object containing: # [0]: cartesian line: x**2 for x ...
[ "PlotGrid(2, 2, p1, p2 ,p3, p4)\r\n# PlotGrid object containing:\r\n# Plot[0]:Plot object containing:\r\n# [0]: cartesian line: x for x over (-5.0, 5.0)\r\n# [1]: cartesian line: x**2 for x over (-5.0, 5.0)\r\n# [2]: cartesian line: x**3 for x over (-5.0, 5.0)\r\n# Plot[1]:Plot object containing:\r\n# [0]: cartesia...
false
10,360
2b1f350da926bce0755f3823f2d4a2a099962c0a
"""Pilot Reports (PIREP) This module attempts to process and store atomic data from PIREPs. These are encoded products that look like so: UBUS01 KMSC 221700 EAU UA /OV EAU360030/TM 1715/FL350/TP B737/TB CONT LGT-MOD CHOP = EHY UA /OV MBW253036 /TM 1729 /FL105 /TP C206 /SK FEW250 /TA M06 /TB NEG /RM SMTH= Un...
[ "\"\"\"Pilot Reports (PIREP)\n\nThis module attempts to process and store atomic data from PIREPs. These are\nencoded products that look like so:\n\n UBUS01 KMSC 221700\n EAU UA /OV EAU360030/TM 1715/FL350/TP B737/TB CONT LGT-MOD CHOP =\n EHY UA /OV MBW253036 /TM 1729 /FL105 /TP C206 /SK FEW250 /TA M06\n /TB N...
false
10,361
a2e9b3f87dee7f32c0a2c79b203831942c3aa195
def solution(arr,sum): arr.sort() div = arr[len(arr)-1]-arr[0] if div>sum: return 1 return 0 nums = int(input()) for x in range(nums): arr = list(map(int,input().split())) num = int(input()) count=0 for i in range(0,len(arr)): for j in range(i+1,len(arr)): temp = solution([arr[x] for x in range(i,j+1)],...
[ "def solution(arr,sum):\n\tarr.sort()\n\tdiv = arr[len(arr)-1]-arr[0]\n\tif div>sum:\n\t\treturn 1\n\treturn 0\n\nnums = int(input())\nfor x in range(nums):\n\tarr = list(map(int,input().split()))\n\tnum = int(input())\n\tcount=0\n\tfor i in range(0,len(arr)):\n\t\tfor j in range(i+1,len(arr)):\n\t\t\ttemp = soluti...
false
10,362
a69b76d2906842d2264a6b7801e31aa5b8c28d4a
#!/usr/bin/env python3 # we're using python 3.x style print but want it to work in python 2.x, from __future__ import print_function import os import argparse import sys from collections import defaultdict try: # since gzip will only be needed if there are gzipped files, import gzip # accept failure to import it...
[ "#!/usr/bin/env python3\n\n# we're using python 3.x style print but want it to work in python 2.x,\nfrom __future__ import print_function\nimport os\nimport argparse\nimport sys\nfrom collections import defaultdict\ntry: # since gzip will only be needed if there are gzipped files,\n import gzip # accept failur...
false
10,363
fa5e337111e53cb5a5c6b0fde0214c8e67d167d4
# list of tuples with book names and links BOOKS = [("hp1_sorcerers_stone", "http://www.glozman.com/TextPages/Harry%20Potter%201%20-%20Sorcerer's%20Stone.txt", "txt"), ("hp2_chamber_of_secrets", "http://www.glozman.com/TextPages/Harry%20Potter%202%20-%20Chamber%20of%20Secrets.txt", "txt"), ("hp3_pri...
[ "# list of tuples with book names and links\nBOOKS = [(\"hp1_sorcerers_stone\", \"http://www.glozman.com/TextPages/Harry%20Potter%201%20-%20Sorcerer's%20Stone.txt\", \"txt\"), \n (\"hp2_chamber_of_secrets\", \"http://www.glozman.com/TextPages/Harry%20Potter%202%20-%20Chamber%20of%20Secrets.txt\", \"txt\"), ...
false
10,364
0cfe04596a2eb4f44f4425dbd9ebc5be78b4adcd
"""Reduce 操作""" # TO BE UPDATED from functools import partial from typing import Any, Callable, Generator, Iterable, Iterator from more_itertools import chunked, first, take from multiprocess import Process, Queue, cpu_count from pb import ProgressBar from .map import map def reduce( func: Callable[[Any, Any]...
[ "\"\"\"Reduce 操作\"\"\"\n\n# TO BE UPDATED\n\nfrom functools import partial\nfrom typing import Any, Callable, Generator, Iterable, Iterator\n\nfrom more_itertools import chunked, first, take\nfrom multiprocess import Process, Queue, cpu_count\nfrom pb import ProgressBar\n\nfrom .map import map\n\n\ndef reduce(\n ...
false
10,365
98568df731d9b9df37d7c0a8a60289abb8c8f309
class TeamsAsyncOperationStatus: def __init__(self): """Describes the current status of a teamsAsyncOperation.""" pass invalid = 0 """ Invalid value.""" notStarted = 1 """The operation has not started.""" inProgress = 2 """ The operation is running.""" succeeded = 3 ...
[ "class TeamsAsyncOperationStatus:\n\n def __init__(self):\n \"\"\"Describes the current status of a teamsAsyncOperation.\"\"\"\n pass\n\n invalid = 0\n \"\"\"\tInvalid value.\"\"\"\n\n notStarted = 1\n \"\"\"The operation has not started.\"\"\"\n\n inProgress = 2\n \"\"\"\tThe ope...
false
10,366
70bbbbaa44beb68125628ed22dd6e2c5e710b163
"""add event log event type idx. Revision ID: f4b6a4885876 Revises: 29a8e9d74220 Create Date: 2021-09-08 10:28:28.730620 """ from dagster._core.storage.migration.utils import create_event_log_event_idx # revision identifiers, used by Alembic. revision = "f4b6a4885876" down_revision = "29a8e9d74220" branch_labels = N...
[ "\"\"\"add event log event type idx.\n\nRevision ID: f4b6a4885876\nRevises: 29a8e9d74220\nCreate Date: 2021-09-08 10:28:28.730620\n\n\"\"\"\nfrom dagster._core.storage.migration.utils import create_event_log_event_idx\n\n# revision identifiers, used by Alembic.\nrevision = \"f4b6a4885876\"\ndown_revision = \"29a8e9...
false
10,367
1cfb8463c2b7e0b006bbad654851a73c5204abb7
#!/usr/bin/python #coding=utf-8 ''' @author: sheng @license: ''' SPELL=u'yíngxiāng' CN=u'迎香' NAME=u'yingxiang21' CHANNEL='largeintestine' CHANNEL_FULLNAME='LargeIntestineChannelofHand-Yangming' SEQ='LI20' if __name__ == '__main__': pass
[ "#!/usr/bin/python\n#coding=utf-8\n\n\n'''\n@author: sheng\n@license: \n'''\n\n\nSPELL=u'yíngxiāng'\nCN=u'迎香'\nNAME=u'yingxiang21'\nCHANNEL='largeintestine'\nCHANNEL_FULLNAME='LargeIntestineChannelofHand-Yangming'\nSEQ='LI20'\n\n\nif __name__ == '__main__':\n pass\n", "<docstring token>\nSPELL = u'yíngxiāng'\n...
false
10,368
1f432314f5ee55956fd28d6d5468eb95e22c4179
"""DICOM cardiac MRI image training pipeline. Usage: dicompipeline [--log <level>] (--data-dir <data_dir>) dicompipeline (-h | --help) dicompipeline --version Options: --log <level> Specify the log level to use, one of "info", "warning", or "debug". ...
[ "\"\"\"DICOM cardiac MRI image training pipeline.\n\nUsage:\n dicompipeline [--log <level>] (--data-dir <data_dir>) \n dicompipeline (-h | --help)\n dicompipeline --version\n\nOptions:\n --log <level> Specify the log level to use, one of \"info\",\n \"warning\", or \"debug\".\n ...
false
10,369
6a3c970560647dfeec6c4d4b3affc8294b4d015c
#Utilizando um arquivo de dados com varias colunas (por exemplo, o arquivo dados_alunos.txt), #faca um histograma com os dados de cada uma das colunas. #Dica: utilize o matplotlib para fazer os histogramas. import matplotlib.pyplot as plt fout = open('dados_alunos.txt', 'r') linhas = fout.readlines() lista_idade=[...
[ "#Utilizando um arquivo de dados com varias colunas (por exemplo, o arquivo dados_alunos.txt), \n#faca um histograma com os dados de cada uma das colunas. \n#Dica: utilize o matplotlib para fazer os histogramas.\nimport matplotlib.pyplot as plt\n\n\nfout = open('dados_alunos.txt', 'r')\nlinhas = fout.readlines()\n\...
false
10,370
e518ae7bd7ff3b7defdf5bacabfddb0b3b87d031
from generation import MarkovChains import re file = open("sonnets.txt") text = re.sub(r'\n.+\n', '', file.read()) markov = MarkovChains(";:.!?") markov.add_text(text) print(markov.generate_text(4))
[ "from generation import MarkovChains\r\nimport re\r\n\r\nfile = open(\"sonnets.txt\")\r\ntext = re.sub(r'\\n.+\\n', '', file.read())\r\n\r\nmarkov = MarkovChains(\";:.!?\")\r\nmarkov.add_text(text)\r\nprint(markov.generate_text(4))\r\n", "from generation import MarkovChains\nimport re\nfile = open('sonnets.txt')\...
false
10,371
ae37b54b6472a7989a5fccc1024b332277864ccf
import matplotlib.pyplot as plt import numpy as np import itertools """ Some helper function to plot data """ def plot_data(x, y, epochs): """ This function plots the model loss over the iterations. """ fig = plt.figure() ax = fig.gca() ax.set_ylim(0, int(np.max(y)+0.5)) ax.set_xlim(0,...
[ "import matplotlib.pyplot as plt\nimport numpy as np\nimport itertools\n\n\"\"\"\nSome helper function to plot data \n\"\"\"\n\n\ndef plot_data(x, y, epochs):\n \"\"\"\n This function plots the model loss over the iterations.\n \"\"\"\n\n fig = plt.figure()\n ax = fig.gca()\n\n ax.set_ylim(0, int(...
false
10,372
74bb1164b3633467a25e20ed683ec724c0c9f097
import numpy as np import matplotlib.pyplot as plt class Plotter: def __init__(self): pass def plotBarGraph(self, percent_correlation_r): ind = np.arange(7) width = 0.7 width = 0.7 test = tuple(percent_correlation_r[0.0]) p0 = plt.bar(ind, percent_correlation...
[ "import numpy as np\nimport matplotlib.pyplot as plt\n\nclass Plotter:\n\n def __init__(self):\n pass\n\n def plotBarGraph(self, percent_correlation_r):\n ind = np.arange(7)\n width = 0.7\n width = 0.7\n\n test = tuple(percent_correlation_r[0.0])\n\n p0 = plt.bar(ind,...
false
10,373
e820f647810a6d60e6f47e5be74bdf99e99bda55
from django.contrib import admin # Register your models here. from .models import Student class SignUpAdmin(admin.ModelAdmin): class Meta: model = Student admin.site.register(Student, SignUpAdmin)
[ "from django.contrib import admin\n\n# Register your models here.\nfrom .models import Student\n\nclass SignUpAdmin(admin.ModelAdmin):\n\tclass Meta:\n\t\tmodel = Student\n\nadmin.site.register(Student, SignUpAdmin)\n", "from django.contrib import admin\nfrom .models import Student\n\n\nclass SignUpAdmin(admin.Mo...
false
10,374
2a62f0b81a01278f14024366ae15b5ea50a13514
import sys from uploadFile import get_pred_files_names get_pred_files_names(sys.argv[1])
[ "import sys\nfrom uploadFile import get_pred_files_names\n\nget_pred_files_names(sys.argv[1])\n\n", "import sys\nfrom uploadFile import get_pred_files_names\nget_pred_files_names(sys.argv[1])\n", "<import token>\nget_pred_files_names(sys.argv[1])\n", "<import token>\n<code token>\n" ]
false
10,375
c93d1795a0afc792efb79df697776174e0b22d01
from Products.ProjectDatabase.reports.ProjectsAtRiskReportFactory \ import ProjectsAtRiskReportFactory from basereport import BaseReport from Products.CMFCore.utils import getToolByName class ProjectsAtRiskReport(BaseReport): def getReport(self): factory = ProjectsAtRiskReportFactory(self.context, proj...
[ "from Products.ProjectDatabase.reports.ProjectsAtRiskReportFactory \\\n import ProjectsAtRiskReportFactory\nfrom basereport import BaseReport\nfrom Products.CMFCore.utils import getToolByName\n\nclass ProjectsAtRiskReport(BaseReport):\n def getReport(self):\n factory = ProjectsAtRiskReportFactory(self....
false
10,376
c6cf924eeaab7d87240564e1f386acd6f4b2fbac
''' Simple Balanced Parentheses using stack ''' class Stack: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self): return self.items[len(self.items)-1] def size(self): re...
[ "'''\nSimple Balanced Parentheses using stack\n'''\n\nclass Stack:\n\tdef __init__(self):\n\t\tself.items = []\n\n\tdef isEmpty(self):\n\t\treturn self.items == []\n\n\tdef push(self, item):\n\t\tself.items.append(item)\n\n\tdef pop(self):\n\t\treturn self.items.pop()\n\n\tdef peek(self):\n\t\treturn self.items[len...
true
10,377
8aa370e39e796356a423f2a91cbb9e58617e854d
""" Copyright 2015 Rackspace 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, software dist...
[ "\"\"\"\nCopyright 2015 Rackspace\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in wri...
false
10,378
507c50b79710a1ad10754925c7e31d1924334001
import datetime from sqlalchemy import Column, Integer, String, Text, DateTime from sqlalchemy.types import DECIMAL from app.db.base_class import Base class Product(Base): id = Column(Integer, primary_key=True, index=True) name = Column(String, index=True) description = Column(Text, nullable=True) s...
[ "import datetime\n\nfrom sqlalchemy import Column, Integer, String, Text, DateTime\nfrom sqlalchemy.types import DECIMAL\n\nfrom app.db.base_class import Base\n\n\nclass Product(Base):\n id = Column(Integer, primary_key=True, index=True)\n name = Column(String, index=True)\n description = Column(Text, null...
false
10,379
8e5aeecd09ac2781faa17d7c079b928fba0594eb
import json import pytest from typing import ( TYPE_CHECKING, cast, ) from eth_typing import ( ChecksumAddress, ) from eth_utils import ( is_checksum_address, is_list_like, is_same_address, is_string, ) from hexbytes import ( HexBytes, ) from web3 import ( constants, ) from web3.da...
[ "import json\nimport pytest\nfrom typing import (\n TYPE_CHECKING,\n cast,\n)\n\nfrom eth_typing import (\n ChecksumAddress,\n)\nfrom eth_utils import (\n is_checksum_address,\n is_list_like,\n is_same_address,\n is_string,\n)\nfrom hexbytes import (\n HexBytes,\n)\n\nfrom web3 import (\n ...
false
10,380
7d24955d06eabb452218b9187089f5bf9b0b9860
try: import os import sys import difflib import hashlib from PyQt5 import QtCore, QtWidgets from PyQt5.QtGui import QColor except Exception as e: print('Error:', e) os.system("pause") sys.exit() IGNORE_FILES_EXTS = 'jpg', 'jpeg', 'png', 'ttf', 'mo', 'so', 'bin', 'cgi',...
[ "try:\r\n import os\r\n import sys\r\n import difflib\r\n import hashlib\r\n from PyQt5 import QtCore, QtWidgets\r\n from PyQt5.QtGui import QColor\r\nexcept Exception as e:\r\n print('Error:', e)\r\n os.system(\"pause\")\r\n sys.exit()\r\n\r\n\r\nIGNORE_FILES_EXTS = 'jpg', 'jpeg', 'png',...
false
10,381
f74ee2b88d89b83d93a0d45b5d30826f093e5c5a
import itertools import os import random import pytest from polyswarmd.utils.bloom import BloomFilter @pytest.fixture def log_entries(): def _mk_address(): return os.urandom(20) def _mk_topic(): return os.urandom(32) return [(_mk_address(), [_mk_topic() fo...
[ "import itertools\nimport os\nimport random\n\nimport pytest\n\nfrom polyswarmd.utils.bloom import BloomFilter\n\n\n@pytest.fixture\ndef log_entries():\n\n def _mk_address():\n return os.urandom(20)\n\n def _mk_topic():\n return os.urandom(32)\n\n return [(_mk_address(), [_mk_topic()\n ...
false
10,382
ec6bfb386f8c36a03d08e4c5117468bf318328e6
# Definition for binary tree with next pointer. # class TreeLinkNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # self.next = None class Solution: # @param root, a tree link node # @return nothing def connect(self, root): if r...
[ "# Definition for binary tree with next pointer.\n# class TreeLinkNode:\n# def __init__(self, x):\n# self.val = x\n# self.left = None\n# self.right = None\n# self.next = None\n\nclass Solution:\n # @param root, a tree link node\n # @return nothing\n def connect(self, roo...
false
10,383
9ef41c2ea05ebcfa5f20bb062e0248ed05f973d5
# File to scrape recipes from allrecipes.com from requests import get from requests.exceptions import RequestException from contextlib import closing from bs4 import BeautifulSoup # Attempts to get the content at the specified url def simple_get(url): try: with closing(get(url, stream = True)) as resp: if ...
[ "# File to scrape recipes from allrecipes.com\nfrom requests import get\nfrom requests.exceptions import RequestException\nfrom contextlib import closing\nfrom bs4 import BeautifulSoup\n\n# Attempts to get the content at the specified url\ndef simple_get(url):\n try:\n with closing(get(url, stream = True)) as r...
false
10,384
2e825df4c686ca657196cbf4d6e97081b61e3c39
import requests p = 12027524255478748885956220793734512128733387803682075433653899983955179850988797899869146900809131611153346817050832096022160146366346391812470987105415233 q = 1213107243921127189732367153161244042847242763370141092563454931230196437304208561932419736532241686654101705736136521417171171379797429933...
[ "import requests\n\np = 12027524255478748885956220793734512128733387803682075433653899983955179850988797899869146900809131611153346817050832096022160146366346391812470987105415233\nq = 12131072439211271897323671531612440428472427633701410925634549312301964373042085619324197365322416866541017057361365214171711713797...
false
10,385
8f91c57ad1047ad76a08f620f4f04014fb2671ef
import sys import os uttlst = file('lst/thu_ev.lst').readlines() for i in uttlst: each = i[:-1].split(' ') os.makedirs('data/'+each[0]) fout = file('data/'+each[0]+'/wav.scp','w') fout.write(i)
[ "import sys\nimport os\n\nuttlst = file('lst/thu_ev.lst').readlines()\n\nfor i in uttlst:\n\teach = i[:-1].split(' ')\n\tos.makedirs('data/'+each[0])\n\tfout = file('data/'+each[0]+'/wav.scp','w')\n\tfout.write(i)\n\n", "import sys\nimport os\nuttlst = file('lst/thu_ev.lst').readlines()\nfor i in uttlst:\n eac...
false
10,386
efdc92912cabf3f0f253fdf35e201fe0587100ff
#importing library import pandas as pd from keras import models from keras import layers from keras.datasets import boston_housing from keras.models import Model from sklearn.model_selection import cross_val_score from keras.layers import Input, SimpleRNN, Dense,LSTM,GRU from keras import optimizers from hyper...
[ "#importing library\r\nimport pandas as pd\r\nfrom keras import models\r\nfrom keras import layers\r\nfrom keras.datasets import boston_housing\r\nfrom keras.models import Model\r\nfrom sklearn.model_selection import cross_val_score\r\nfrom keras.layers import Input, SimpleRNN, Dense,LSTM,GRU\r\nfrom keras import o...
false
10,387
72bff87f8b35451e1b25dd5085dfff409389892c
# coding: UTF-8 from list import LinkedList ''' class SimpleStack: Stack with simple implementation(built-in arraylist). class ListStack: Pushdown Stack(linked-list implmentation). ''' class SimpleStack(object): ''' Stack with simple implementation(built-in arraylist). ------------- Stack(): init q...
[ "# coding: UTF-8\n\nfrom list import LinkedList\n\n'''\nclass SimpleStack: Stack with simple implementation(built-in arraylist).\nclass ListStack: Pushdown Stack(linked-list implmentation).\n'''\n\nclass SimpleStack(object):\n '''\n Stack with simple implementation(built-in arraylist).\n -------------\n ...
false
10,388
86c3ef73384556e9f63992b6bf2a1755149968bf
n=int(input()) b=[] s=0 for i in range(n): l=list(map(int,input().split())) b.append(l) for i in range(len(b)): s+=b[i][i] print(s)
[ "n=int(input())\nb=[]\ns=0\nfor i in range(n):\n l=list(map(int,input().split()))\n b.append(l)\nfor i in range(len(b)):\n s+=b[i][i]\nprint(s)\n", "n = int(input())\nb = []\ns = 0\nfor i in range(n):\n l = list(map(int, input().split()))\n b.append(l)\nfor i in range(len(b)):\n s += b[i][i]\nprint(s)...
false
10,389
71fc177d2880b159495e2759315df3bd0d9d7d6a
import jinja2 import markdown from schema import ( INDEX_FILES, INDEX_TITLE, INDEX_LINK, RESEARCH_FILES, RESEARCH_TITLE, RESEARCH_LINK, TEACHING_FILES, TEACHING_TITLE, TEACHING_LINK, PROGRAMMING_FILES, PROGRAMMING_TITLE, PROGRAMMING_LINK, ) def convert_file(fname): """ Convert markdown file `...
[ "import jinja2\nimport markdown\n\nfrom schema import (\n INDEX_FILES, INDEX_TITLE, INDEX_LINK,\n RESEARCH_FILES, RESEARCH_TITLE, RESEARCH_LINK,\n TEACHING_FILES, TEACHING_TITLE, TEACHING_LINK,\n PROGRAMMING_FILES, PROGRAMMING_TITLE, PROGRAMMING_LINK,\n)\n\n\ndef convert_file(fname):\n \"\"\"\n Co...
false
10,390
da55f20712cc1578a9535bcc2fe2e1334fd9f6b8
import json from datetime import datetime from pprint import pprint from typing import List, Dict import numpy as np import pandas as pd from spotify_api import SpotifyClient def _get_track(playlist_item): if "track" in playlist_item: return playlist_item["track"]["name"] else: return playlis...
[ "import json\nfrom datetime import datetime\nfrom pprint import pprint\nfrom typing import List, Dict\nimport numpy as np\nimport pandas as pd\n\nfrom spotify_api import SpotifyClient\n\n\ndef _get_track(playlist_item):\n if \"track\" in playlist_item:\n return playlist_item[\"track\"][\"name\"]\n else...
false
10,391
7be5056bd3b6f0838b032a0757b7ccd02285043c
# coding: utf-8 import glob from time import time from preprocess_text import corpus from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from sklearn.decomposition import NMF, LatentDirichletAllocation from nltk import word_tokenize from nltk.stem import WordNetLemmatizer import re ...
[ "# coding: utf-8\nimport glob\nfrom time import time\nfrom preprocess_text import corpus\nfrom sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer\nfrom sklearn.decomposition import NMF, LatentDirichletAllocation\nfrom nltk import word_tokenize \nfrom nltk.stem import WordNetLemmatizer ...
false
10,392
af9db97c3b3f2a8d21e4b76025497f20bba11a6f
#author: Riley Doyle #date: 7/16/20 #file: calc_CO2_loss_alk #status:working import numpy as np import matplotlib.pyplot as plt from calc_Ks import * from calc_alphas import * def calc_CO2_loss_alk (pK1, pK2, Kh, pH, d, PCO2, alkin, alkend, delalk, kLain, kLaend, delkLa): L = np.array(['-', '--', '-.', ':', '--'...
[ "#author: Riley Doyle\n#date: 7/16/20\n#file: calc_CO2_loss_alk\n#status:working\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom calc_Ks import *\nfrom calc_alphas import *\n\n\ndef calc_CO2_loss_alk (pK1, pK2, Kh, pH, d, PCO2, alkin, alkend, delalk, kLain, kLaend, delkLa):\n L = np.array(['-', '--'...
false
10,393
ebd97a9827cc878d1bc33144a955df5a3608c774
import numpy as np from matplotlib import pyplot as plt import cv2 def erode(a, b): # 结构元反射后再卷积,相当于直接求相关 # opencv中该函数其实是求的相关 dst = cv2.filter2D(a, -1, b, borderType=cv2.BORDER_CONSTANT) sum_b = np.sum(b) dst = np.where(dst == sum_b, 1, 0) return dst.astype(np.uint8) def dilate(a, b): # 结...
[ "import numpy as np\nfrom matplotlib import pyplot as plt\nimport cv2\n\n\ndef erode(a, b):\n # 结构元反射后再卷积,相当于直接求相关\n # opencv中该函数其实是求的相关\n dst = cv2.filter2D(a, -1, b, borderType=cv2.BORDER_CONSTANT)\n sum_b = np.sum(b)\n dst = np.where(dst == sum_b, 1, 0)\n return dst.astype(np.uint8)\n\n\ndef di...
false
10,394
6876e5d4c6f97dd89fa62af36f68c04dc324a006
from django import forms from django_grapesjs import settings from django_grapesjs.utils import get_render_html_value from django_grapesjs.utils.get_source import get_grapejs_assets __all__ = ( 'GrapesJsWidget', ) class GrapesJsWidget(forms.Textarea): """ Textarea form widget with support grapesjs. T...
[ "from django import forms\nfrom django_grapesjs import settings\nfrom django_grapesjs.utils import get_render_html_value\nfrom django_grapesjs.utils.get_source import get_grapejs_assets\n\n__all__ = (\n 'GrapesJsWidget',\n)\n\n\nclass GrapesJsWidget(forms.Textarea):\n \"\"\"\n Textarea form widget with sup...
false
10,395
1aa8c01e29a76fb784363e668a42228f67f326ff
from sys import argv script, filename = argv txt = open(filename) print "Here's your file %r:" % filename print txt.read() #We call a function on txt named read. #What you get back from open is a file, #and it also has commands you can give it. #You give a file a command by using the . (dot or period), #the name of...
[ "from sys import argv\nscript, filename = argv\ntxt = open(filename)\nprint \"Here's your file %r:\" % filename\nprint txt.read()\n#We call a function on txt named read. \n#What you get back from open is a file, \n#and it also has commands you can give it. \n#You give a file a command by using the . (dot or period)...
true
10,396
05ff6f4af7c7503d0c4aab453a157d667ddf62bd
#Simone and David import numpy as np import random import matplotlib.pyplot as plt from Config import Config import json DEBUG = False if DEBUG: def simulate_episode(population): #stupid function that only return the sum of all the elements of all the matrixes fit = [] for m in range(le...
[ "#Simone and David\r\nimport numpy as np\r\nimport random\r\nimport matplotlib.pyplot as plt\r\nfrom Config import Config\r\nimport json\r\n\r\nDEBUG = False\r\nif DEBUG:\r\n def simulate_episode(population): #stupid function that only return the sum of all the elements of all the matrixes\r\n fit = []\r\...
false
10,397
d91a64b5c101a2208b0a073d044f7056ee55e7cc
#!/usr/bin/python3 #-*-coding:utf-8-*- import os import time import string import re cf = { 'author':'Remilia Scarlet', 'header-img': "img/post-bg-2015.jpg" } def menuSelect(s,l): print(s) for i in range(0, len(l)): print('\t%d) %s' % (i+1,l[i])) i = input("layout:") if i == '': ...
[ "#!/usr/bin/python3\n#-*-coding:utf-8-*-\n\nimport os\nimport time\nimport string\nimport re\n\ncf = {\n 'author':'Remilia Scarlet',\n 'header-img': \"img/post-bg-2015.jpg\"\n}\n\ndef menuSelect(s,l):\n print(s)\n for i in range(0, len(l)):\n print('\\t%d) %s' % (i+1,l[i]))\n i = input(\"layou...
false
10,398
e358d21d574632acfb3f3f27bf3553387aeb9920
from django.contrib.auth import authenticate from rest_framework import serializers, status from rest_framework.response import Response from rest_framework_jwt.serializers import ( JSONWebTokenSerializer, jwt_payload_handler, jwt_encode_handler, ) class JWTLoginSerializer(JSONWebTokenSerializer): def...
[ "from django.contrib.auth import authenticate\nfrom rest_framework import serializers, status\nfrom rest_framework.response import Response\nfrom rest_framework_jwt.serializers import (\n JSONWebTokenSerializer,\n jwt_payload_handler,\n jwt_encode_handler,\n)\n\n\nclass JWTLoginSerializer(JSONWebTokenSeria...
false
10,399
c6bd402b9d09b13a73d21aa1b207012efc557f21
import numpy as np fileName = '/Users/shuruiz/Work/researchProjects/INTRUDE/data/PR_count.csv' list_repo = [] list_repo_1 = [] list_repo_2 = [] list_repo_3 = [] with open(fileName) as f: lineList = f.readlines() for line in lineList: repo, pr_num = line.split() if(repo == "repo"): continue ...
[ "import numpy as np\nfileName = '/Users/shuruiz/Work/researchProjects/INTRUDE/data/PR_count.csv'\nlist_repo = []\nlist_repo_1 = []\nlist_repo_2 = []\nlist_repo_3 = []\nwith open(fileName) as f:\n lineList = f.readlines()\n for line in lineList:\n repo, pr_num = line.split()\n if(repo == \"repo\"...
false