index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
1,000
153a33b85cf8b3ef9c742f05b460e94e0c684682
#Author: AKHILESH #This program illustrates the advanced concepts of inheritance #Python looks up for method in following order: Instance attributes, class attributes and the #from the base class #mro: Method Resolution order class Data(object): def __init__(self, data): self.data = data def getData(s...
[ "#Author: AKHILESH\n#This program illustrates the advanced concepts of inheritance\n#Python looks up for method in following order: Instance attributes, class attributes and the\n#from the base class\n#mro: Method Resolution order\n\nclass Data(object):\n def __init__(self, data):\n self.data = data\n\n ...
false
1,001
e207063eb3eb1929e0e24b62e6b77a8924a80489
# -*- coding: utf-8 -*- """ Created on Sat Jul 18 20:24:53 2020 @author: filip """ import re texto = "Muito além, nos confins inexplorados da região mais brega da Borda Ocidental desta Galáxia, há um pequeno sol amarelo e esquecido. Girando em torno deste sol, a uma distancia de cerca de 148 milhões de quil...
[ "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Sat Jul 18 20:24:53 2020\r\n\r\n@author: filip\r\n\"\"\"\r\n\r\nimport re\r\n\r\ntexto = \"Muito além, nos confins inexplorados da região mais brega da Borda Ocidental desta Galáxia, há um pequeno sol amarelo e esquecido. Girando em torno deste sol, a uma distancia d...
false
1,002
5d7080f2778133d1938853512ca038edcf7c0dc4
from Products.CMFPlone.utils import getFSVersionTuple from bda.plone.ticketshop.interfaces import ITicketShopExtensionLayer from plone.app.robotframework.testing import MOCK_MAILHOST_FIXTURE from plone.app.testing import FunctionalTesting from plone.app.testing import IntegrationTesting from plone.app.testing import PL...
[ "from Products.CMFPlone.utils import getFSVersionTuple\nfrom bda.plone.ticketshop.interfaces import ITicketShopExtensionLayer\nfrom plone.app.robotframework.testing import MOCK_MAILHOST_FIXTURE\nfrom plone.app.testing import FunctionalTesting\nfrom plone.app.testing import IntegrationTesting\nfrom plone.app.testing...
false
1,003
646f6a0afc3dc129250c26270dda4355b8cea080
#!/usr/local/bin/python3.3 ''' http://projecteuler.net/problem=127() abc-hits Problem 127 The radical of n, rad(n), is the product of distinct prime factors of n. For example, 504 = 23 × 32 × 7, so rad(504) = 2 × 3 × 7 = 42. We shall define the triplet of positive integers (a, b, c) to be an abc-hit if: GCD(a, b) = ...
[ "#!/usr/local/bin/python3.3\n\n'''\nhttp://projecteuler.net/problem=127()\nabc-hits\nProblem 127\nThe radical of n, rad(n), is the product of distinct prime factors of n. For example, 504 = 23 × 32 × 7, so rad(504) = 2 × 3 × 7 = 42.\n\nWe shall define the triplet of positive integers (a, b, c) to be an abc-hit if:\...
false
1,004
3079fdbe6319454ad166d06bda5670554a5746ee
# len(): tamanho da string # count(): conta quantas vezes um caractere aparece # lower(), upper() # replace(): substitui as letras por outra # split(): quebra uma string a partir dos espacos em branco a = len('Karen') print(a) b = 'Rainha Elizabeth'.count('a') print(b) c = 'karen nayara'.replace('a','@') print(c) d = ...
[ "# len(): tamanho da string\n# count(): conta quantas vezes um caractere aparece\n# lower(), upper()\n# replace(): substitui as letras por outra\n# split(): quebra uma string a partir dos espacos em branco\n\na = len('Karen')\nprint(a)\nb = 'Rainha Elizabeth'.count('a')\nprint(b)\nc = 'karen nayara'.replace('a','@'...
false
1,005
2cdcd6976a1ec99b927adcedc48c36bbda1b4e18
""" Generate test pads for padder. """ # usage: python gen.py > pads.txt import random pad = "" count = 0 # The pad chars MUST match the character set used by padder. # See the 'characters' variable in 'main.hpp' for more # information. chars = "abcdefghijklmnopqrstuvwxyz0123456789-" print "#", "Pad" while count...
[ "\"\"\" Generate test pads for padder. \"\"\"\n\n# usage: python gen.py > pads.txt\n\nimport random\n\npad = \"\"\ncount = 0\n\n# The pad chars MUST match the character set used by padder.\n# See the 'characters' variable in 'main.hpp' for more\n# information.\nchars = \"abcdefghijklmnopqrstuvwxyz0123456789-\"\n\...
true
1,006
d68bd9c90a106a9eac767607ad77bdd84d0f18d2
#-*- coding = utf-8-*- #@Time : 2020/6/26 11:02 #@Author :Ella #@File :app.py #@Software : PyCharm import time import datetime from flask import Flask,render_template,request #render_template渲染模板 app = Flask(__name__) #初始化的对象 #路由解析,通过用户访问的路径,匹配想要的函数 @app.route('/') def hello_world(): return '你好' #通过访问路径,获取用户的...
[ "#-*- coding = utf-8-*-\n#@Time : 2020/6/26 11:02\n#@Author :Ella\n#@File :app.py\n#@Software : PyCharm\n\nimport time\nimport datetime\n\nfrom flask import Flask,render_template,request #render_template渲染模板\napp = Flask(__name__) #初始化的对象\n\n#路由解析,通过用户访问的路径,匹配想要的函数\n@app.route('/')\ndef hello_world():\n return...
false
1,007
6da828a797efac7c37723db96a2682e960c317b5
from setuptools import setup def readme(): with open('README.rst') as f: return f.read() setup(name = "keputils", version = "0.2.1", description = "Basic module for interaction with KOI and Kepler-stellar tables.", long_description = readme(), author = "Timothy D. Morton", author_email...
[ "from setuptools import setup\n\ndef readme():\n with open('README.rst') as f:\n return f.read()\n\nsetup(name = \"keputils\",\n version = \"0.2.1\",\n description = \"Basic module for interaction with KOI and Kepler-stellar tables.\",\n long_description = readme(),\n author = \"Timothy D. Mor...
false
1,008
9c6bb885c05ee13a283b09861a5aa7c5e62677cb
#!/usr/bin/python def check(n): if n == 0 : print "neither Positive nor Negative" if n < 0 : print "Negative" if n > 0 : print "Positive" print "10 is ", check(10) print "-5 is ", check(-5) print "0 is ", check(0)
[ "#!/usr/bin/python\ndef check(n):\n if n == 0 :\n print \"neither Positive nor Negative\"\n if n < 0 :\n print \"Negative\"\n if n > 0 :\n print \"Positive\"\n\n\n\nprint \"10 is \", check(10)\nprint \"-5 is \", check(-5)\nprint \"0 is \", check(0)" ]
true
1,009
93e8e9fc4f0503dfc3243bef5ab8261a4cdfc296
#!/usr/bin/env python # encoding: UTF-8 ''' Script to select current version for a given soft (python, ruby or java). ''' import os import re import sys import glob import getopt # fix input in Python 2 and 3 try: input = raw_input # pylint: disable=redefined-builtin,invalid-name except NameError: pass cl...
[ "#!/usr/bin/env python\n# encoding: UTF-8\n\n'''\nScript to select current version for a given soft (python, ruby or java).\n'''\n\nimport os\nimport re\nimport sys\nimport glob\nimport getopt\n\n\n# fix input in Python 2 and 3\ntry:\n input = raw_input # pylint: disable=redefined-builtin,invalid-name\nexcept Na...
false
1,010
55c2bf914a77c573d1b6835f54c82921d9fa6ad6
from ED63RDScenarioHelper import * def main(): SetCodePage("ms932") CreateScenaFile( FileName = 'C2219 ._SN', MapName = 'Ruan', Location = 'C2219.x', MapIndex = 84, MapDefaultBGM = "ed60015", Flags ...
[ "from ED63RDScenarioHelper import *\n\ndef main():\n SetCodePage(\"ms932\")\n\n CreateScenaFile(\n FileName = 'C2219 ._SN',\n MapName = 'Ruan',\n Location = 'C2219.x',\n MapIndex = 84,\n MapDefaultBGM = \"ed60015\",\n ...
false
1,011
ecbca04a58c19469e63ee2310e2b2f6b86c41199
# -*- coding: utf-8 -*- """ Created on Wed May 8 15:05:51 2019 @author: Brian Heckman and Kyle Oprisko """ import csv """this file opens a csv file created in the csv creator class. The main purpose of this class is to normalize the data in the csv file, so that it can be read by the neural network. """ ...
[ "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Wed May 8 15:05:51 2019\r\n\r\n@author: Brian Heckman and Kyle Oprisko\r\n\"\"\"\r\nimport csv\r\n\r\n\"\"\"this file opens a csv file created in the csv creator class. The main purpose of this class is to \r\nnormalize the data in the csv file, so that it can be re...
false
1,012
9a7994a1e51c9cf7fe7d8b50ab26fa3d789fc8e5
# # tests/middleware/test_static.py # import pytest import growler from pathlib import Path from unittest import mock from sys import version_info from growler.middleware.static import Static @pytest.fixture def static(tmpdir): return Static(str(tmpdir)) def test_static_fixture(static, tmpdir): assert isin...
[ "#\n# tests/middleware/test_static.py\n#\n\nimport pytest\nimport growler\nfrom pathlib import Path\nfrom unittest import mock\nfrom sys import version_info\nfrom growler.middleware.static import Static\n\n\n@pytest.fixture\ndef static(tmpdir):\n return Static(str(tmpdir))\n\n\ndef test_static_fixture(static, tm...
false
1,013
a319ebb05e9034f19aef39bd46830c8a607ed121
animals = ['bear', 'python', 'peacock', 'kangaroo', 'whale', 'platypus'] The animal at 1. The third (3rd) animal. The first (1st) animal. The animal at 3. The fifth (5th) animal. The animal at 2. The sixth (6th) animal. The animal at 4.
[ "animals = ['bear', 'python', 'peacock', 'kangaroo', 'whale', 'platypus']\nThe animal at 1.\nThe third (3rd) animal.\nThe first (1st) animal.\nThe animal at 3.\nThe fifth (5th) animal.\nThe animal at 2.\nThe sixth (6th) animal.\nThe animal at 4.\n\n" ]
true
1,014
cc6cef70381bb08247720ec32b7e8fe79ed7123d
#!/usr/bin/python import sys OPEN_BRACES = ['{', '(', '['] CLOSE_BRACES = ['}', ')', ']'] def match_paranthesis (s, pos): stack = [] for i,c in enumerate(s): if not c in OPEN_BRACES and not c in CLOSE_BRACES: continue if c in OPEN_BRACES: stack.append((i, c)) ...
[ "#!/usr/bin/python\n\nimport sys\n\nOPEN_BRACES = ['{', '(', '[']\nCLOSE_BRACES = ['}', ')', ']']\n\ndef match_paranthesis (s, pos):\n stack = []\n\n for i,c in enumerate(s):\n if not c in OPEN_BRACES and not c in CLOSE_BRACES:\n continue\n\n if c in OPEN_BRACES:\n stack.ap...
true
1,015
ddaba7a8b53072da36224dd4618696ebf0e9a4e4
from __future__ import print_function import os import shutil import pymake import flopy # set up paths dstpth = os.path.join('temp') if not os.path.exists(dstpth): os.makedirs(dstpth) mp6pth = os.path.join(dstpth, 'Modpath_7_1_000') expth = os.path.join(mp6pth, 'examples') exe_name = 'mp7' srcpth = os.path.join(...
[ "from __future__ import print_function\nimport os\nimport shutil\nimport pymake\nimport flopy\n\n# set up paths\ndstpth = os.path.join('temp')\nif not os.path.exists(dstpth):\n os.makedirs(dstpth)\nmp6pth = os.path.join(dstpth, 'Modpath_7_1_000')\nexpth = os.path.join(mp6pth, 'examples')\n\nexe_name = 'mp7'\nsrc...
false
1,016
da3be0d3b815e11d292a7c7e8f5ce32b35580f98
# Let's look at the lowercase letters. import string alphabet = " " + string.ascii_lowercase
[ "# Let's look at the lowercase letters.\nimport string\nalphabet = \" \" + string.ascii_lowercase\n", "import string\nalphabet = ' ' + string.ascii_lowercase\n", "<import token>\nalphabet = ' ' + string.ascii_lowercase\n", "<import token>\n<assignment token>\n" ]
false
1,017
299432b095f16c3cb4949319705800d06f534cf9
from __future__ import with_statement # this is to work with python2.5 from pyps import workspace, module def invoke_function(fu, ws): return fu._get_code(activate = module.print_code_out_regions) if __name__=="__main__": workspace.delete('paws_out_regions') with workspace('paws_out_regions.c',name='paws_ou...
[ "from __future__ import with_statement # this is to work with python2.5\nfrom pyps import workspace, module\n\ndef invoke_function(fu, ws):\n return fu._get_code(activate = module.print_code_out_regions)\n\nif __name__==\"__main__\":\n\tworkspace.delete('paws_out_regions')\n\twith workspace('paws_out_regions...
true
1,018
c1bb7b579e6b251ddce41384aef1243e411c5d0e
# coding: utf-8 # ## Estimating Travel Time # # # The objective of this document is proposing a prediction model for estimating the travel time of two # specified locations at a given departure time. The main idea here is predicting the velocity of the trip. Given the distance between starting and ending point of t...
[ "\n# coding: utf-8\n\n# ## Estimating Travel Time\n# \n# \n# The objective of this document is proposing a prediction model for estimating the travel time of two\n# specified locations at a given departure time. The main idea here is predicting the velocity of the trip. Given the distance between starting and endin...
false
1,019
ae84b449c8919f14954633b14993e6291501bc24
import requests def login(username, password): data = {'login':username,'pwd':password,'lang':''} r = requests.post('http://dms-pit.htb/seeddms51x/seeddms/op/op.Login.php', data=data, allow_redirects=False) if r.headers['Location'] == '../out/out.Login.php?msg=Error+signing+in.+User+ID+or+password+incorrec...
[ "import requests\n\ndef login(username, password):\n data = {'login':username,'pwd':password,'lang':''}\n r = requests.post('http://dms-pit.htb/seeddms51x/seeddms/op/op.Login.php', data=data, allow_redirects=False)\n if r.headers['Location'] == '../out/out.Login.php?msg=Error+signing+in.+User+ID+or+passwor...
false
1,020
9aa54f1259aceb052cfba74cedcfadfe68778ebd
from IPython import embed from selenium import webdriver b = webdriver.Firefox() embed()
[ "from IPython import embed\nfrom selenium import webdriver\n\nb = webdriver.Firefox()\nembed()\n", "from IPython import embed\nfrom selenium import webdriver\nb = webdriver.Firefox()\nembed()\n", "<import token>\nb = webdriver.Firefox()\nembed()\n", "<import token>\n<assignment token>\nembed()\n", "<import ...
false
1,021
0bfb089556bfa253bf139f03cd3079ced962d858
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from sbpy.data import Phys from sbpy import bib @pytest.mark.remote_data def test_from_sbdb(): """ test from_horizons method""" # query one object data = Phys.from_sbdb('Ceres') assert len(data.table) == 1 # query se...
[ "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nimport pytest\n\nfrom sbpy.data import Phys\nfrom sbpy import bib\n\n\n@pytest.mark.remote_data\ndef test_from_sbdb():\n \"\"\" test from_horizons method\"\"\"\n\n # query one object\n data = Phys.from_sbdb('Ceres')\n assert len(data.ta...
false
1,022
368151a134f987ed78c8048521137672530b5cce
# KeyLogger.py # show a character key when pressed without using Enter key # hide the Tkinter GUI window, only console shows import Tkinter as tk def key(event): if event.keysym == 'Escape': root.destroy() print event.char, event.keysym root = tk.Tk() print "Press a key (Escape key to exit):" root.bi...
[ "# KeyLogger.py\n# show a character key when pressed without using Enter key\n# hide the Tkinter GUI window, only console shows\n\nimport Tkinter as tk\n\ndef key(event):\n if event.keysym == 'Escape':\n root.destroy()\n print event.char, event.keysym\n\nroot = tk.Tk()\nprint \"Press a key (Escape key ...
true
1,023
70aba6c94b7050113adf7ae48bd4e13aa9a34587
import typ @typ.typ(items=[int]) def gnome_sort(items): """ >>> gnome_sort([]) [] >>> gnome_sort([1]) [1] >>> gnome_sort([2,1]) [1, 2] >>> gnome_sort([1,2]) [1, 2] >>> gnome_sort([1,2,2]) [1, 2, 2] """ i = 0 n = len(items) while i < n: if i and items[i] < items[i-1]: items[i], i...
[ "import typ\n\n@typ.typ(items=[int])\ndef gnome_sort(items):\n \"\"\"\n >>> gnome_sort([])\n []\n >>> gnome_sort([1])\n [1]\n >>> gnome_sort([2,1])\n [1, 2]\n >>> gnome_sort([1,2])\n [1, 2]\n >>> gnome_sort([1,2,2])\n [1, 2, 2]\n \"\"\"\n i = 0\n n = len(items)\n while i < n:\n if i and items[i] <...
false
1,024
1ead23c6ea4e66b24e60598ae20606e24fa41482
# SPDX-FileCopyrightText: 2019-2021 Python201 Contributors # SPDX-License-Identifier: MIT # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path ...
[ "# SPDX-FileCopyrightText: 2019-2021 Python201 Contributors\n# SPDX-License-Identifier: MIT\n#\n# Configuration file for the Sphinx documentation builder.\n#\n# This file does only contain a selection of the most common options. For a\n# full list see the documentation:\n# http://www.sphinx-doc.org/en/master/config...
false
1,025
8fee548466abf6d35ea180f8de4e52a9b8902d3f
import os import math from collections import defaultdict __author__ = 'steven' question='qb' fs={'t1','small.in','large'} def getmincost(n,c,f,x): t=0.0 for i in range(0,n): t+=1/(2+f*i) t=t*c t+=x/(2+f*n) ct=getmincostnshift(n,c,f,x) return min(t,ct); def getmincostnshift(n,c,f,x): ...
[ "import os\nimport math\nfrom collections import defaultdict\n__author__ = 'steven'\n\nquestion='qb'\nfs={'t1','small.in','large'}\ndef getmincost(n,c,f,x):\n t=0.0\n\n for i in range(0,n):\n t+=1/(2+f*i)\n t=t*c\n t+=x/(2+f*n)\n ct=getmincostnshift(n,c,f,x)\n return min(t,ct);\n\ndef getmi...
true
1,026
f2e6d23e6d8c5aa6e80a652dc6cb8bda45824d0c
"""Code for constructing and executing Tasks""" from bcipy.tasks.rsvp.calibration.alert_tone_calibration import RSVPAlertToneCalibrationTask from bcipy.tasks.rsvp.calibration.inter_sequence_feedback_calibration import ( RSVPInterSequenceFeedbackCalibration ) from bcipy.tasks.rsvp.calibration.calibration import RSVP...
[ "\"\"\"Code for constructing and executing Tasks\"\"\"\nfrom bcipy.tasks.rsvp.calibration.alert_tone_calibration import RSVPAlertToneCalibrationTask\nfrom bcipy.tasks.rsvp.calibration.inter_sequence_feedback_calibration import (\n RSVPInterSequenceFeedbackCalibration\n)\nfrom bcipy.tasks.rsvp.calibration.calibra...
false
1,027
e59e60b0a4b7deca9c510bd6b9c58636c6d34c80
l={1,2,3,4} try: print(l) s=len(l) if s>5: raise TypeError print(d[2]) except TypeError: print("Error!!!length should be less than or equals to 5") except NameError: print("index out of range") else: for i in l: print(i) finally: print("execution done!!!!!!")
[ "\nl={1,2,3,4}\ntry:\n\tprint(l)\n\ts=len(l)\n\tif s>5:\n\t\traise TypeError\n\tprint(d[2])\n\nexcept TypeError:\n\tprint(\"Error!!!length should be less than or equals to 5\")\nexcept NameError:\n\tprint(\"index out of range\")\nelse:\n\tfor i in l:\n\t\tprint(i)\nfinally:\n\tprint(\"execution done!!!!!!\")", "l...
false
1,028
c0503536672aa824eaf0d19b9d4b5431ef910432
#!/usr/bin/env python # encoding: utf-8 import os import argparse import coaddBatchCutout as cbc def run(args): min = -0.0 max = 0.5 Q = 10 if os.path.isfile(args.incat): cbc.coaddBatchCutFull(args.root, args.incat, filter=args.filter, ...
[ "#!/usr/bin/env python\n# encoding: utf-8\n\nimport os\nimport argparse\nimport coaddBatchCutout as cbc\n\n\ndef run(args):\n\n min = -0.0\n max = 0.5\n Q = 10\n\n if os.path.isfile(args.incat):\n\n cbc.coaddBatchCutFull(args.root, args.incat,\n filter=args.filter,\n ...
false
1,029
2e140d1174e0b2d8a97df880b1bffdf84dc0d236
from helper.logger_helper import Log from helper.mail_helper import MailHelper import spider.spider as spider from configuration.configuration_handler import Configuration from configuration.products_handler import ProductsHandler if __name__ == "__main__": logger = Log() conf = Configuration('configuration/co...
[ "from helper.logger_helper import Log\nfrom helper.mail_helper import MailHelper\nimport spider.spider as spider\nfrom configuration.configuration_handler import Configuration\nfrom configuration.products_handler import ProductsHandler\n\nif __name__ == \"__main__\":\n logger = Log()\n conf = Configuration('c...
false
1,030
dbb66930edd70729e4df7d3023e83a6eae65cccd
#!/usr/bin/env python def main(): import sys from pyramid.paster import get_appsettings from sqlalchemy import engine_from_config from pyvideohub.models import ScopedSession, Base config_file = sys.argv[1] settings = get_appsettings(config_file) engine = engine_from_config(settings, 's...
[ "#!/usr/bin/env python\n\ndef main():\n import sys\n from pyramid.paster import get_appsettings\n from sqlalchemy import engine_from_config\n from pyvideohub.models import ScopedSession, Base\n \n config_file = sys.argv[1]\n settings = get_appsettings(config_file)\n engine = engine_from_conf...
false
1,031
e288403cb310bb7241b25e74d1b5bcc63967128c
"""Note: AWS Glue split from spark since it requires different test dependencies.""" from tests.integration.backend_dependencies import BackendDependencies from tests.integration.integration_test_fixture import IntegrationTestFixture aws_glue_integration_tests = [] deployment_patterns = [ # TODO: The AWS_GLUE dep...
[ "\"\"\"Note: AWS Glue split from spark since it requires different test dependencies.\"\"\"\nfrom tests.integration.backend_dependencies import BackendDependencies\nfrom tests.integration.integration_test_fixture import IntegrationTestFixture\n\naws_glue_integration_tests = []\n\ndeployment_patterns = [\n # TODO...
false
1,032
8fd74287fbc653ea3ed4aa76a272486aa29185cf
# !/usr/bin/python # sudo mn --custom _mininet_topo.py --topo mytopo,5 # sudo mn --custom _mininet_topo.py --topo mytopo,3 --test simpletest # or just run this python file from mininet.topo import Topo from mininet.net import Mininet from mininet.util import dumpNodeConnections from mininet.log import setLogLevel fro...
[ "# !/usr/bin/python\n\n# sudo mn --custom _mininet_topo.py --topo mytopo,5\n# sudo mn --custom _mininet_topo.py --topo mytopo,3 --test simpletest\n# or just run this python file\n\nfrom mininet.topo import Topo\nfrom mininet.net import Mininet\nfrom mininet.util import dumpNodeConnections\nfrom mininet.log import s...
true
1,033
0e112ecfd4ccf762234dff564dd6f3987418dedd
# Start the HTML and Javascript code print ''' <html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["treemap"]}); google.setOnLoadCallback(drawChart); function drawChart() { ''' ...
[ "# Start the HTML and Javascript code\nprint '''\n<html>\n <head>\n <script type=\"text/javascript\" src=\"https://www.google.com/jsapi\"></script>\n <script type=\"text/javascript\">\n google.load(\"visualization\", \"1\", {packages:[\"treemap\"]});\n google.setOnLoadCallback(drawChart);\n fu...
true
1,034
ed66e8028d653cf6b7ea4703fef5a658665c48db
# -*- coding: utf-8 -*- # DATE 2018-08-21 # AUTHER = tongzz # import MySQLdb from Elements.LoginElements import * import datetime import sys class Tradepasswd(): def __init__(self): self.db_config={ 'host': '172.28.38.59', 'usr': 'mysqladmin', 'passwd': '12...
[ "# -*- coding: utf-8 -*-\r\n# DATE 2018-08-21\r\n# AUTHER = tongzz\r\n#\r\n\r\nimport MySQLdb\r\nfrom Elements.LoginElements import *\r\nimport datetime\r\nimport sys\r\nclass Tradepasswd():\r\n def __init__(self):\r\n self.db_config={\r\n 'host': '172.28.38.59',\r\n 'usr': 'mysqladm...
true
1,035
81a1fbd13b06e4470bfbaa0d1716d5301e1a4b36
def readint(): return int(raw_input()) T = readint() for t in xrange(T): N = int(raw_input()) res = 0 sum = 0 min = 1000000 for i in raw_input().split(): r = int(i) res ^= r sum += r if min > r: min = r if res == 0: sum -= min print "Case #%d: %s" % (t + 1, sum) else: print "Case ...
[ "def readint(): return int(raw_input())\r\n\r\nT = readint()\r\nfor t in xrange(T):\r\n\tN = int(raw_input())\r\n\tres = 0\r\n\tsum = 0\r\n\tmin = 1000000\r\n\tfor i in raw_input().split():\r\n\t\tr = int(i)\r\n\t\tres ^= r\r\n\t\tsum += r\r\n\t\tif min > r: min = r\r\n\tif res == 0:\r\n\t\tsum -= min\r\n\t\tprint ...
true
1,036
90fc6e37e3988a2014c66913db61749509db2d53
import os class Idea: def __init__(self, folder): self.folder = folder def name(self): return "jetbrains-idea" def cmd(self): return "intellij-idea-ultimate-edition %s" % self.folder
[ "import os\n\nclass Idea:\n def __init__(self, folder):\n self.folder = folder\n\n def name(self):\n return \"jetbrains-idea\"\n\n def cmd(self):\n return \"intellij-idea-ultimate-edition %s\" % self.folder\n", "import os\n\n\nclass Idea:\n\n def __init__(self, folder):\n s...
false
1,037
d2e3ac490ce5fdc20976567fa320a9e6a53cbe34
# -*- coding: utf-8 -*- """ =================================== Demo of DBSCAN clustering algorithm =================================== Finds core samples of high density and expands clusters from them. """ import scipy as sp import numpy as np from scipy import spatial print(__doc__) from sklearn.cluster import D...
[ "# -*- coding: utf-8 -*-\n\"\"\"\n===================================\nDemo of DBSCAN clustering algorithm\n===================================\n\nFinds core samples of high density and expands clusters from them.\n\n\"\"\"\nimport scipy as sp\nimport numpy as np\n\nfrom scipy import spatial\nprint(__doc__)\n\n\nfr...
false
1,038
166a1dfbd3baf766230080361d98648ec0a64455
#coding=utf8 """ Created on Thu Feb 20 00:53:28 2020 @author: Neal LONG """ import json import requests fake_header = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36", "Accept":"text/html,application/xhtml+xml,...
[ "#coding=utf8\r\n\"\"\"\r\nCreated on Thu Feb 20 00:53:28 2020\r\n\r\n@author: Neal LONG\r\n\"\"\"\r\n\r\nimport json\r\nimport requests\r\nfake_header = { \"user-agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36\",\r\n \"Accep...
false
1,039
9ef5d57d536f5c88f705b1032cc0936e2d4cd565
from Shapes import * c1 = Circle(5) r1 = Rectangle(3,2) c2 = Circle(3) c3 = Circle(1) r2 = Rectangle(1,1) listShapes = [c1,r1,c2,c3,r2] for item in listShapes: print(item.toString()) print("Area: " + str(item.area())) print("Perimeter: " + str(item.perimeter()))
[ "from Shapes import *\n\nc1 = Circle(5)\nr1 = Rectangle(3,2)\nc2 = Circle(3)\nc3 = Circle(1)\nr2 = Rectangle(1,1)\n\nlistShapes = [c1,r1,c2,c3,r2]\n\nfor item in listShapes:\n\tprint(item.toString())\n\tprint(\"Area: \" + str(item.area()))\n\tprint(\"Perimeter: \" + str(item.perimeter()))\n" ]
true
1,040
813d27e8f9c1a416dab2f891dd71e4791bb92dbb
import sys import pytest from presidio_evaluator.evaluation import Evaluator from tests.conftest import assert_model_results_gt from presidio_evaluator.models.flair_model import FlairModel @pytest.mark.slow @pytest.mark.skipif("flair" not in sys.modules, reason="requires the Flair library") def test_flair_simple(sm...
[ "import sys\n\nimport pytest\n\nfrom presidio_evaluator.evaluation import Evaluator\nfrom tests.conftest import assert_model_results_gt\nfrom presidio_evaluator.models.flair_model import FlairModel\n\n\n@pytest.mark.slow\n@pytest.mark.skipif(\"flair\" not in sys.modules, reason=\"requires the Flair library\")\ndef ...
false
1,041
cceda9a8a0188499ae0aa588701bb8104b5ed313
from pymongo import MongoClient, GEOSPHERE, GEO2D import os, sys, json, pprint sys.path.insert(0, '../utils') import path_functions client = MongoClient( 'localhost', 27017 ) db = client[ 'nfcdata' ] json_files_path_list = path_functions.get_json_files('../../ftp-data/geojson-files/quikscat-l2b12') for json_fil...
[ "\nfrom pymongo import MongoClient, GEOSPHERE, GEO2D\n\nimport os, sys, json, pprint\nsys.path.insert(0, '../utils') \nimport path_functions \n\n\nclient = MongoClient( 'localhost', 27017 )\ndb = client[ 'nfcdata' ]\n\njson_files_path_list = path_functions.get_json_files('../../ftp-data/geojson-files/quikscat-l2b12...
false
1,042
65d5cee6899b0b75474e3898459bf2cfa8b3635b
def solve(bt): if len(bt) == n: print(*bt, sep="") exit() for i in [1, 2, 3]: if is_good(bt + [i]): solve(bt + [i]) def is_good(arr): for i in range(1, len(arr)//2+1): if arr[-i:] == arr[-(i*2):-i]: return False return True if __name__ == "__main__": n = int(input()) sol...
[ "def solve(bt):\n if len(bt) == n:\n print(*bt, sep=\"\")\n exit()\n\n for i in [1, 2, 3]:\n if is_good(bt + [i]):\n solve(bt + [i])\n\n\ndef is_good(arr):\n for i in range(1, len(arr)//2+1):\n if arr[-i:] == arr[-(i*2):-i]:\n return False\n return True\n\nif __name__ == \"__main__\":\n ...
false
1,043
6be285f9c48a20934c1846785232a73373c7d547
##armstrong number## ##n= int(input('enter a number ')) ##a=n ##s=0 ## ##while n>0: ## rem= n%10 ## s= s+rem*rem*rem ## n= n//10 ##if a==s: ## print(a,' is an armstrong number') ##else: ## print(a,' is not an armstrong number') ##palindrome or not## ##n= int(input('enter a number ...
[ "##armstrong number##\r\n##n= int(input('enter a number '))\r\n##a=n\r\n##s=0\r\n##\r\n##while n>0:\r\n## rem= n%10\r\n## s= s+rem*rem*rem\r\n## n= n//10\r\n##if a==s:\r\n## print(a,' is an armstrong number')\r\n##else:\r\n## print(a,' is not an armstrong number')\r\n\r\n\r\n\r\n\r\n\r\n##palindrome ...
false
1,044
3908d303d0e41677aae332fbdbe9b681bffe5391
import os from datetime import timedelta ROOT_PATH = os.path.split(os.path.abspath(__name__))[0] DEBUG = True JWT_SECRET_KEY = 'shop' # SQLALCHEMY_DATABASE_URI = 'sqlite:///{}'.format( # os.path.join(ROOT_PATH, 's_shop_flask.db')) SQLALCHEMY_TRACK_MODIFICATIONS = False user = 'shop' passwd = 'shopadmin' db = 'shop...
[ "import os\nfrom datetime import timedelta\n\nROOT_PATH = os.path.split(os.path.abspath(__name__))[0]\n\nDEBUG = True\nJWT_SECRET_KEY = 'shop'\n# SQLALCHEMY_DATABASE_URI = 'sqlite:///{}'.format(\n# os.path.join(ROOT_PATH, 's_shop_flask.db'))\nSQLALCHEMY_TRACK_MODIFICATIONS = False\nuser = 'shop'\npasswd = 'shopa...
false
1,045
874b87ca20385aa15cc7299707c9c1c0360ace43
from PyQt4 import QtCore SceneName = "sphere" DefaultColor = QtCore.Qt.yellow
[ "from PyQt4 import QtCore\r\n\r\n\r\nSceneName = \"sphere\"\r\nDefaultColor = QtCore.Qt.yellow\r\n", "from PyQt4 import QtCore\nSceneName = 'sphere'\nDefaultColor = QtCore.Qt.yellow\n", "<import token>\nSceneName = 'sphere'\nDefaultColor = QtCore.Qt.yellow\n", "<import token>\n<assignment token>\n" ]
false
1,046
86fdea2ae8e253aa4639bb3114de70c693536760
from django.db import models from django.contrib import admin from django.utils import timezone class Libros(models.Model): ISBN = models.CharField(max_length=13,primary_key=True) Titulo = models.CharField(max_length=15) # Portada = models.ImageField(upload_to='imagen/') Autor = models.CharField(max_le...
[ "from django.db import models\nfrom django.contrib import admin\nfrom django.utils import timezone\n\nclass Libros(models.Model):\n ISBN = models.CharField(max_length=13,primary_key=True)\n Titulo = models.CharField(max_length=15)\n # Portada = models.ImageField(upload_to='imagen/')\n Autor = models.Cha...
false
1,047
ca6b064dbd8200c49665eaa944fdf1fc80c25726
import pandas as pd import numpy as np import matplotlib.pyplot as plt data=pd.read_csv('regression.csv') print(data) x=data.iloc[:,0] y=data.iloc[:,1] mx=data['X1'].mean() my=data['Y'].mean() print(mx,my) num, den = 0,0 for i in range(len(x)): num += (x[i] - mx)*(y[i]-my) den += (x[i]-mx)**2 be...
[ "import pandas as pd\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\ndata=pd.read_csv('regression.csv')\r\nprint(data)\r\nx=data.iloc[:,0]\r\ny=data.iloc[:,1]\r\nmx=data['X1'].mean()\r\nmy=data['Y'].mean()\r\nprint(mx,my)\r\n\r\nnum, den = 0,0\r\nfor i in range(len(x)):\r\n num += (x[i] - mx)*(y[i]-m...
false
1,048
5c415d5bf9d6952863a662d300cb1f706ef02a8f
import openerp from openerp import pooler from openerp.report import report_sxw import xlwt from openerp.addons.report_xls.report_xls import report_xls from openerp.tools.translate import _ class openacademy_course_xls_parser(report_sxw.rml_parse): def __init__(self, cursor, uid, name, context): super(openacademy_c...
[ "import openerp\nfrom openerp import pooler\nfrom openerp.report import report_sxw\nimport xlwt\nfrom openerp.addons.report_xls.report_xls import report_xls\nfrom openerp.tools.translate import _\n\nclass openacademy_course_xls_parser(report_sxw.rml_parse):\n\tdef __init__(self, cursor, uid, name, context):\n\t\tsu...
false
1,049
88590aef975f7e473ef964ee0c4004cff7e24b07
#!/usr/bin/env python3 import optparse from bs4 import BeautifulSoup import re import jieba import pickle import requests import asyncio if __name__ == '__main__': # 读取10000个关键词 fs = open("./src/keywords.txt", "rb") keywords = fs.read().decode("utf-8").split(",") fs.close() # 找出特征 def find_f...
[ "#!/usr/bin/env python3\n\nimport optparse\nfrom bs4 import BeautifulSoup\nimport re\nimport jieba\nimport pickle\nimport requests\nimport asyncio\n\nif __name__ == '__main__':\n\n # 读取10000个关键词\n fs = open(\"./src/keywords.txt\", \"rb\")\n keywords = fs.read().decode(\"utf-8\").split(\",\")\n fs.close(...
false
1,050
7fe7ea89908f9d233dbdb9e46bf2d677406ab324
import networkx as nx import pytest from caldera.utils.nx import nx_copy def add_data(g): g.add_node(1) g.add_node(2, x=5) g.add_edge(1, 2, y=6) g.add_edge(2, 3, z=[]) def assert_graph_data(g1, g2): assert g1 is not g2 assert g2.nodes[1] == {} assert g2.nodes[2] == {"x": 5} assert g...
[ "import networkx as nx\nimport pytest\n\nfrom caldera.utils.nx import nx_copy\n\n\ndef add_data(g):\n g.add_node(1)\n g.add_node(2, x=5)\n g.add_edge(1, 2, y=6)\n g.add_edge(2, 3, z=[])\n\n\ndef assert_graph_data(g1, g2):\n assert g1 is not g2\n assert g2.nodes[1] == {}\n assert g2.nodes[2] == ...
false
1,051
7cb75195df567a5b65fe2385423b0082f3b9de4b
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = "Brateaqu, Farolflu" __copyright__ = "Copyright 2019" __credits__ = ["Quentin BRATEAU", "Luca FAROLFI"] __license__ = "GPL" __version__ = "1.0" __email__ = ["quentin.brateau@ensta-bretagne.org", "luca.farolfi@ensta-bretagne.org"] # Importing modules import...
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\n__author__ = \"Brateaqu, Farolflu\"\n__copyright__ = \"Copyright 2019\"\n__credits__ = [\"Quentin BRATEAU\", \"Luca FAROLFI\"]\n\n__license__ = \"GPL\"\n__version__ = \"1.0\"\n__email__ = [\"quentin.brateau@ensta-bretagne.org\", \"luca.farolfi@ensta-bretagne.org\...
false
1,052
fecaf41152e8c98784585abfdb3777fc0a4824f3
string1 = "Vegetable" #string2 = "Fruit" string2 = "vegetable" print(string1 == string2) print(string1 != string2) if string1.lower() == string2.lower(): print("The strings are equal") else: print("The strings are not equal") number1 = 25 number2 = 30 # == # != # > # < # >= # <= if number1 <...
[ "\nstring1 = \"Vegetable\"\n#string2 = \"Fruit\"\nstring2 = \"vegetable\"\n\nprint(string1 == string2)\n\nprint(string1 != string2)\n\n\nif string1.lower() == string2.lower():\n print(\"The strings are equal\")\nelse:\n print(\"The strings are not equal\")\n\nnumber1 = 25\nnumber2 = 30\n\n# ==\n# !=\n# ...
false
1,053
6bc400896c004f0fdddbbd3dd73ef9aaa19eb4db
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Customer', fields=[ ('id', models.AutoField(ver...
[ "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ]\n\n operations = [\n migrations.CreateModel(\n name='Customer',\n fields=[\n ('id', ...
false
1,054
513a2bbcf7a63baf900b73b18cf25618937dc7d0
""" Prog: helloworld.py Name: Samuel doyle Date: 18/04/18 Desc: My first program! """ print('Hello, world!')
[ "\"\"\"\nProg: helloworld.py\nName: Samuel doyle\nDate: 18/04/18\nDesc: My first program!\n\"\"\"\n\nprint('Hello, world!')\n", "<docstring token>\nprint('Hello, world!')\n", "<docstring token>\n<code token>\n" ]
false
1,055
a21ac29911931bb71460175cba584e0011fa2ece
import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart import base64 import configobj import datetime import os config = configobj.ConfigObj('.env') port = 2525 smtp_server = "smtp.mailtrap.io" login = config['SMTP_USERNAME'] password = config['SMTP_PASSWORD'] sender_email...
[ "import smtplib\nfrom email.mime.text import MIMEText\nfrom email.mime.multipart import MIMEMultipart\nimport base64\nimport configobj\nimport datetime\nimport os\nconfig = configobj.ConfigObj('.env')\nport = 2525\nsmtp_server = \"smtp.mailtrap.io\"\nlogin = config['SMTP_USERNAME'] \npassword = config['SMTP_PASSWOR...
false
1,056
562b2c3567e42699cfd0804a5780af7ede142e13
## Filename: name.py # Author: Marcelo Feitoza Parisi # # Description: Report the objects # on the bucket sorted by name. # # ########################### # # DISCLAIMER - IMPORTANT! # # ########################### # # Stuff found here was built as a # Proof-Of-Concept or Study material # and should not b...
[ "## Filename: name.py\n # Author: Marcelo Feitoza Parisi\n # \n # Description: Report the objects\n # on the bucket sorted by name.\n # \n # ###########################\n # # DISCLAIMER - IMPORTANT! #\n # ###########################\n # \n # Stuff found here was built as a\n # Proof-Of-Concept or Study material\n #...
false
1,057
358879d83ed3058530031d50fb69e3ce11fbd524
print(60*60) seconds_per_hour=60*60 print(24*seconds_per_hour) seconds_per_day=24*seconds_per_hour print(seconds_per_day/seconds_per_hour) print(seconds_per_day//seconds_per_hour)
[ "print(60*60)\r\n\r\nseconds_per_hour=60*60\r\n\r\nprint(24*seconds_per_hour)\r\n\r\nseconds_per_day=24*seconds_per_hour\r\n\r\nprint(seconds_per_day/seconds_per_hour)\r\n\r\nprint(seconds_per_day//seconds_per_hour)\r\n", "print(60 * 60)\nseconds_per_hour = 60 * 60\nprint(24 * seconds_per_hour)\nseconds_per_day =...
false
1,058
5c1d81c973487f1b091e58a6ccf5947c3f2a7e6d
import unittest from nldata.corpora import Telegram import os class TestTelegram(unittest.TestCase): def test_export_iter(self): pass # telegram = Telegram(data_dir) # it = telegram.split("train", n=20) # samples = [s for s in it] # self.assertEqual(len(samples), 20) ...
[ "import unittest\nfrom nldata.corpora import Telegram\nimport os\n\n\nclass TestTelegram(unittest.TestCase):\n def test_export_iter(self):\n pass\n # telegram = Telegram(data_dir)\n # it = telegram.split(\"train\", n=20)\n # samples = [s for s in it]\n # self.assertEqual(len(sa...
false
1,059
03629e62b11e66eeb0e111fee551c75c8463cbb8
from compas.geometry import Line # This import is use to test __repr__. from compas.geometry import Point # noqa: F401 def test_line(): p1 = [0, 0, 0] p2 = [1, 0, 0] line = Line(p1, p2) assert line.start == p1 assert line.end == p2 def test_equality(): p1 = [0, 0, 0] p2 = [1, 0, 0] ...
[ "from compas.geometry import Line\n\n# This import is use to test __repr__.\nfrom compas.geometry import Point # noqa: F401\n\n\ndef test_line():\n p1 = [0, 0, 0]\n p2 = [1, 0, 0]\n line = Line(p1, p2)\n assert line.start == p1\n assert line.end == p2\n\n\ndef test_equality():\n p1 = [0, 0, 0]\n ...
false
1,060
9bb6fd6fbe212bdc29e2d1ec37fa6ec6ca9a9469
#!/usr/bin/env python # encoding: utf-8 import multiprocessing import time import sys def daemon(): p = multiprocessing.current_process() print('Starting:', p.name, p.pid) sys.stdout.flush() time.sleep(2) print('Exiting :', p.name, p.pid) sys.stdout.flush() def non_daemon(): p = multipr...
[ "#!/usr/bin/env python\n# encoding: utf-8\n\nimport multiprocessing\nimport time\nimport sys\n\n\ndef daemon():\n p = multiprocessing.current_process()\n print('Starting:', p.name, p.pid)\n sys.stdout.flush()\n time.sleep(2)\n print('Exiting :', p.name, p.pid)\n sys.stdout.flush()\n\n\ndef non_dae...
false
1,061
267cb37f2ccad5b02a809d9b85327eacd9a49515
from flask import Flask, jsonify, request import requests, json, random from bs4 import BeautifulSoup import gspread import pandas as pd import dataservices as dss from oauth2client.service_account import ServiceAccountCredentials # page = requests.get("https://www.worldometers.info/coronavirus/") # soup = BeautifulSou...
[ "from flask import Flask, jsonify, request\nimport requests, json, random\nfrom bs4 import BeautifulSoup\nimport gspread\nimport pandas as pd\nimport dataservices as dss\nfrom oauth2client.service_account import ServiceAccountCredentials\n# page = requests.get(\"https://www.worldometers.info/coronavirus/\")\n# soup...
false
1,062
0555c577a8fb746cf2debb929d02b46cd3be4d7b
from typing import List def uppercase_first_letter(string: str) -> str: return string[0:1].upper() + string[1:] string_list: List[str] = input('Please, input string: ').split(' ') result: str = '' for i, value in enumerate(string_list): result += (lambda index: '' if index == 0 else ' ')(i) + uppercase_fir...
[ "from typing import List\n\n\ndef uppercase_first_letter(string: str) -> str:\n return string[0:1].upper() + string[1:]\n\n\nstring_list: List[str] = input('Please, input string: ').split(' ')\nresult: str = ''\n\nfor i, value in enumerate(string_list):\n result += (lambda index: '' if index == 0 else ' ')(i)...
false
1,063
8355faf7c0d3742be34a56ddc982cb389c80d0a9
import unittest from traceback import print_tb from ml_base.utilities.model_manager import ModelManager from tests.mocks import MLModelMock class ModelManagerTests(unittest.TestCase): def test_model_manager_will_return_same_instance_when_instantiated_many_times(self): """Testing that the ModelManager wi...
[ "import unittest\nfrom traceback import print_tb\n\nfrom ml_base.utilities.model_manager import ModelManager\nfrom tests.mocks import MLModelMock\n\n\nclass ModelManagerTests(unittest.TestCase):\n\n def test_model_manager_will_return_same_instance_when_instantiated_many_times(self):\n \"\"\"Testing that t...
false
1,064
8ec18e259af1123fad7563aee3a363e095e30e8e
from django.db import models from albums.models import Albums class Song(models.Model): name = models.CharField(max_length=255) filename = models.FileField(upload_to='canciones/') album = models.ForeignKey(Albums) def __unicode__(self,): return self.name
[ "from django.db import models\n\nfrom albums.models import Albums\n\nclass Song(models.Model):\n name = models.CharField(max_length=255)\n filename = models.FileField(upload_to='canciones/')\n album = models.ForeignKey(Albums)\n\n def __unicode__(self,):\n return self.name\n", "from django.db i...
false
1,065
f7d3096d669946e13186a893ffc53067e0fd0a0a
# -*- coding: utf-8 -*- """Digital Forensics Virtual File System (dfVFS). dfVFS, or Digital Forensics Virtual File System, is a Python module that provides read-only access to file-system objects from various storage media types and file formats. """
[ "# -*- coding: utf-8 -*-\n\"\"\"Digital Forensics Virtual File System (dfVFS).\n\ndfVFS, or Digital Forensics Virtual File System, is a Python module\nthat provides read-only access to file-system objects from various\nstorage media types and file formats.\n\"\"\"\n", "<docstring token>\n" ]
false
1,066
84980b8923fa25664833f810a906d27531145141
import cv2, os, fitz, shutil import numpy as np from PIL import Image from pytesseract import pytesseract from PIL import UnidentifiedImageError pytesseract.tesseract_cmd = 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe' config = r'--oem 3 --psm' # Возвращает путь к картинке, созданной на основе 1 ...
[ "import cv2, os, fitz, shutil\r\nimport numpy as np\r\nfrom PIL import Image\r\nfrom pytesseract import pytesseract\r\nfrom PIL import UnidentifiedImageError\r\n\r\npytesseract.tesseract_cmd = 'C:\\\\Program Files (x86)\\\\Tesseract-OCR\\\\tesseract.exe'\r\nconfig = r'--oem 3 --psm'\r\n\r\n\r\n# Возвращает путь к к...
false
1,067
bb208d40ce098b05594aaf9c579f64b909738d52
#!/usr/bin/python import os; import math; # os.chdir('data/postgres/linux.env') os.chdir('data/mysql/linux.env') # os.chdir('data/mongo/linux.env') col_time = 0; col_read_ops = 1 col_read_err = 2 col_write_ops = 3 col_write_err = 4 class ColumnData: def __init__(self, chart, title, data): self.chart = ...
[ "#!/usr/bin/python\n\nimport os;\nimport math;\n\n# os.chdir('data/postgres/linux.env')\nos.chdir('data/mysql/linux.env')\n# os.chdir('data/mongo/linux.env')\n\ncol_time = 0;\ncol_read_ops = 1\ncol_read_err = 2\ncol_write_ops = 3\ncol_write_err = 4\n\n\nclass ColumnData:\n def __init__(self, chart, title, data):...
true
1,068
84515ef6879b54b333f9afd48c6c4b7c43ff6957
class Solution(object): def minimumTotal(self, triangle): """ :type triangle: List[List[int]] :rtype: int """ t = triangle if len(t) == 1: return t[0][0] ret = [0] * len(t) ret[0] = t[0][0] for i in range(1, len(t)): fo...
[ "class Solution(object):\n\n def minimumTotal(self, triangle):\n \"\"\"\n :type triangle: List[List[int]]\n :rtype: int\n \"\"\"\n t = triangle\n if len(t) == 1:\n return t[0][0]\n ret = [0] * len(t)\n ret[0] = t[0][0]\n for i in range(1, ...
false
1,069
1bbadf02c4b9ca22a0099bcc09fa4c62c9901c39
from django.conf import settings from django.db import models def get_image_filename(instance, filename): a = f'post_images/{instance.post.title}.svg' return a def get_main_image_filename(instance, filename): a = f'post_images/{instance.title}_main.svg' return a # Create your models here. class Po...
[ "from django.conf import settings\nfrom django.db import models\n\n\ndef get_image_filename(instance, filename):\n a = f'post_images/{instance.post.title}.svg'\n return a\n\n\ndef get_main_image_filename(instance, filename):\n a = f'post_images/{instance.title}_main.svg'\n return a\n\n\n# Create your mo...
false
1,070
1ea71f7b17809189eeacf19a6b7c4c7d88a5022c
from dataloaders.datasets import caltech, embedding from torch.utils.data import DataLoader def make_data_loader(args, **kwargs): if args.dataset == 'caltech101': train_set = caltech.caltech101Classification(args, split='train') val_set = caltech.caltech101Classification(args, split='val') test_set = caltech.c...
[ "from dataloaders.datasets import caltech, embedding\nfrom torch.utils.data import DataLoader\n\ndef make_data_loader(args, **kwargs):\n\n\tif args.dataset == 'caltech101':\n\t\ttrain_set = caltech.caltech101Classification(args, split='train')\n\t\tval_set = caltech.caltech101Classification(args, split='val')\n\t\t...
false
1,071
2ca1b603b18316bc1d970b5e32389e10e4b532e2
import configure import connectify import userlog import dirlog import time def getUser(sock): try: userinfo = userlog.getInfo() except: userinfo = configure.init(sock) userinfo = userinfo.split('^')[0] # print userinfo return userinfo if __name__=="__main__": sock = connectify.createCon() userinfo = get...
[ "import configure\nimport connectify\nimport userlog\nimport dirlog\nimport time\n\n\ndef getUser(sock):\n\ttry:\n\t\tuserinfo = userlog.getInfo()\n\texcept:\t\n\t\tuserinfo = configure.init(sock)\n\tuserinfo = userinfo.split('^')[0]\n#\tprint userinfo\n\treturn userinfo\n\nif __name__==\"__main__\":\t\n\tsock = co...
true
1,072
07544d1eb039da0081716aa489fc1a0a5a200145
from peewee import * db = PostgresqlDatabase('contacts', user='postgres', password='', host='localhost', port=5432) intro_question = input("What would you like to do with Contacts? Create? Read? Find? Delete? Update? ") def read_contact(): contacts = Contact.select() for contact in c...
[ "from peewee import *\n\ndb = PostgresqlDatabase('contacts', user='postgres', password='',\n host='localhost', port=5432)\n\nintro_question = input(\"What would you like to do with Contacts? Create? Read? Find? Delete? Update? \")\n\n\ndef read_contact():\n contacts = Contact.select()\n ...
false
1,073
289aa48b4433be533c3916dd039136df45e0ac0b
# Generated by Django 2.2.5 on 2019-10-24 05:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('student', '0008_studentbasic_stu_class_num'), ] operations = [ migrations.AlterModelOptions( name='onduty', options=...
[ "# Generated by Django 2.2.5 on 2019-10-24 05:11\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('student', '0008_studentbasic_stu_class_num'),\n ]\n\n operations = [\n migrations.AlterModelOptions(\n name='onduty',\n ...
false
1,074
03062ea08bd6ad88376f7c2aa2c89d2194ed8b2e
''' fibonacci(6) => [1, 1, 2, 3, 5, 8] fibonacci(7) => [1, 1, 2, 3, 5, 8, 13] ''' def fibonacci(n): if n == 0: return [] elif n == 1: return [1] elif n == 2: return [1, 1] else: lista = fibonacci(n-1) suma = lista[len(lista)-1] + lista[len(lista)-2] lista...
[ "'''\nfibonacci(6) => [1, 1, 2, 3, 5, 8]\nfibonacci(7) => [1, 1, 2, 3, 5, 8, 13]\n'''\n\ndef fibonacci(n):\n if n == 0:\n return []\n elif n == 1:\n return [1]\n elif n == 2:\n return [1, 1]\n else:\n lista = fibonacci(n-1)\n suma = lista[len(lista)-1] + lista[len(list...
false
1,075
af668751074df6f182c7121821587270734ea5af
# -*- coding: utf-8 -*- import scrapy import os from topdb.items import BiqugeItem class NovelsSpider(scrapy.Spider): name = 'novels' allowed_domains = ['xbiquge.la'] start_urls = ['http://www.xbiquge.la/xiaoshuodaquan/'] def parse(self, response): # 小说分类 path = '/Users/qx/Documents...
[ "# -*- coding: utf-8 -*-\nimport scrapy\n\nimport os\nfrom topdb.items import BiqugeItem\n\nclass NovelsSpider(scrapy.Spider):\n name = 'novels'\n allowed_domains = ['xbiquge.la']\n start_urls = ['http://www.xbiquge.la/xiaoshuodaquan/']\n\n def parse(self, response):\n # 小说分类\n path = '/...
false
1,076
06f961c07695d1c312cb943afbfa64508a709c7e
from alive_progress import alive_bar from time import sleep with alive_bar(100) as bar: # default setting for i in range(100): sleep(0.03) bar() # call after consuming one item # using bubble bar and notes spinner with alive_bar(200, bar='bubbles', spinner=...
[ "from alive_progress import alive_bar\nfrom time import sleep\n\nwith alive_bar(100) as bar: # default setting\n for i in range(100):\n sleep(0.03)\n bar() # call after consuming one item\n\n # using bubble bar and notes spinner\n with alive_bar(200, bar='bubb...
false
1,077
1fafbc1e415b5089afcd2976d4f0dc2aa1c5a144
def maxProduct(self, A): size= len(A) if size==1: return A[0] Max=[A[0]] Min=[A[0]] for i in range(1,size): Max.append(max(max(Max[i-1]*A[i],Min[i-1]*A[i]),A[i])) Min.append(min(min(Max[i-1]*A[i],Min[i-1]*A[i]),A[i])) tmax=Max[0] ...
[ " def maxProduct(self, A):\n size= len(A)\n if size==1:\n return A[0]\n Max=[A[0]]\n Min=[A[0]]\n for i in range(1,size):\n Max.append(max(max(Max[i-1]*A[i],Min[i-1]*A[i]),A[i]))\n Min.append(min(min(Max[i-1]*A[i],Min[i-1]*A[i]),A[i]))\n ...
true
1,078
9a6ceeb286bb6c3d5923fe3b53be90a097e16ef5
''' Create a dictionary of fasttext embedding, stored locally fasttext import. This will hopefully make it easier to load and train data. This will also be used to store the Steps to clean scripts (codify): 1) copy direct from website (space-delimited text) 2) remove actions in ...
[ "'''\n Create a dictionary of fasttext embedding, stored locally\n fasttext import. This will hopefully make it easier to load\n and train data.\n\n This will also be used to store the\n Steps to clean scripts (codify): \n 1) copy direct from website (space-delimited text) \n 2) remov...
false
1,079
618aa64c08ebf8d9a0bc9662195ece2bbd485c17
dic = {} try: print(dic[55]) except Exception as err: print('Mensagem: ',err)
[ "dic = {}\n\ntry:\n print(dic[55])\nexcept Exception as err:\n print('Mensagem: ',err)\n", "dic = {}\ntry:\n print(dic[55])\nexcept Exception as err:\n print('Mensagem: ', err)\n", "<assignment token>\ntry:\n print(dic[55])\nexcept Exception as err:\n print('Mensagem: ', err)\n", "<assignmen...
false
1,080
8f5d9918260e2f50fb229a7067f820a186101b99
import numpy as np from scipy import stats from scipy import interpolate from math import factorial from scipy import signal """ A continuous wavelet transform based peak finder. Tested exclusively on Raman spectra, however, it should work for most datasets. Parameters ---------- lowerBound: The lowest value of the...
[ "import numpy as np\nfrom scipy import stats\nfrom scipy import interpolate\nfrom math import factorial\nfrom scipy import signal\n\n\"\"\"\n\nA continuous wavelet transform based peak finder. Tested exclusively on Raman spectra, however,\nit should work for most datasets.\n\nParameters\n----------\n\nlowerBound: T...
false
1,081
e51c0d8c6430603d989d55a64fdf77f9e1a2397b
""" Tests of neo.io.exampleio """ import pathlib import unittest from neo.io.exampleio import ExampleIO # , HAVE_SCIPY from neo.test.iotest.common_io_test import BaseTestIO from neo.test.iotest.tools import get_test_file_full_path from neo.io.proxyobjects import (AnalogSignalProxy, SpikeTrainProxy, E...
[ "\"\"\"\nTests of neo.io.exampleio\n\"\"\"\n\nimport pathlib\nimport unittest\n\nfrom neo.io.exampleio import ExampleIO # , HAVE_SCIPY\nfrom neo.test.iotest.common_io_test import BaseTestIO\nfrom neo.test.iotest.tools import get_test_file_full_path\nfrom neo.io.proxyobjects import (AnalogSignalProxy,\n ...
false
1,082
57b51ea36e9e2a095cf7e9646db2cc400cc72b83
from mesa.visualization.modules import CanvasGrid from mesa.visualization.ModularVisualization import ModularServer from mesa.visualization.modules import ChartModule from mesa.batchrunner import BatchRunner from agentPortrayal import agent_portrayal import metrics from matplotlib import pyplot as plt from Architecture...
[ "from mesa.visualization.modules import CanvasGrid\nfrom mesa.visualization.ModularVisualization import ModularServer\nfrom mesa.visualization.modules import ChartModule\nfrom mesa.batchrunner import BatchRunner\nfrom agentPortrayal import agent_portrayal\nimport metrics\nfrom matplotlib import pyplot as plt\nfrom ...
false
1,083
f5dffa3c22bb35ed07cb5ca28f2ba02ea3c07dda
import math import random import pygame pygame.init() SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT)) clock = pygame.time.Clock() pygame.display.set_caption('space invaders') background = pygame.image.load('background.png') score = 0 previous_score = 0 score...
[ "import math\nimport random\n\nimport pygame\n\npygame.init()\n\nSCREEN_WIDTH = 800\nSCREEN_HEIGHT = 600\nscreen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))\n\nclock = pygame.time.Clock()\n\npygame.display.set_caption('space invaders')\n\nbackground = pygame.image.load('background.png')\n\nscore = 0\np...
false
1,084
e2e4adaa8f7f62662e0c2915faff1bed72986351
from django.contrib import admin from .models import Hash admin.site.register(Hash)
[ "from django.contrib import admin\nfrom .models import Hash\nadmin.site.register(Hash)\n", "<import token>\nadmin.site.register(Hash)\n", "<import token>\n<code token>\n" ]
false
1,085
d8af43d24a2f2b99bc8b5098f251e017852d6d86
import subprocess class BaseExecution: def __init__(self, flag, parser): self.flag = flag self.parser = parser def execute(self): process = subprocess.Popen(f'df {self.flag}', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, err = process.communicate() ...
[ "import subprocess\n\n\nclass BaseExecution:\n def __init__(self, flag, parser):\n self.flag = flag\n self.parser = parser\n\n def execute(self):\n process = subprocess.Popen(f'df {self.flag}', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n output, err = process.comm...
false
1,086
2f2030107f3a23c0d2f404a838eaccc8b35ac410
fahrenheit = float(input("Enter a fahrenheit degree: ")) celcius = ((fahrenheit - 32) * 5) / 9 print("From fahrenheit to celcius", celcius)
[ "fahrenheit = float(input(\"Enter a fahrenheit degree: \"))\ncelcius = ((fahrenheit - 32) * 5) / 9\nprint(\"From fahrenheit to celcius\", celcius)", "fahrenheit = float(input('Enter a fahrenheit degree: '))\ncelcius = (fahrenheit - 32) * 5 / 9\nprint('From fahrenheit to celcius', celcius)\n", "<assignment token...
false
1,087
c4fbf206482a04f3e2d2aa98a0dbf525a176c4e7
__author__ = 'Joe' import sys sys.path.insert(0,'../src/') import grocery_functions import unittest class TestGroceryFuncs(unittest.TestCase): def test_getRecipeNames(self): recipe_names = grocery_functions.get_recipe_names("test-recipes") self.assertTrue(recipe_names[0] == "Cajun Chicken & Rice"...
[ "__author__ = 'Joe'\nimport sys\nsys.path.insert(0,'../src/')\n\nimport grocery_functions\nimport unittest\n\nclass TestGroceryFuncs(unittest.TestCase):\n\n def test_getRecipeNames(self):\n recipe_names = grocery_functions.get_recipe_names(\"test-recipes\")\n self.assertTrue(recipe_names[0] == \"Ca...
false
1,088
a7db627c49b53cd3a073d866a0373336a46b4053
from graphviz import Digraph dot = Digraph() dot.edge("BaseException", "SystemExit") dot.edge("BaseException", "KeyboardInterrupt") dot.edge("BaseException", "GeneratorExit") dot.edge("BaseException", "Exception") dot.edge("Exception", "StopIteration") dot.edge("Exception", "StopAsyncIteration") dot.edge("Exception",...
[ "from graphviz import Digraph\n\ndot = Digraph()\n\ndot.edge(\"BaseException\", \"SystemExit\")\ndot.edge(\"BaseException\", \"KeyboardInterrupt\")\ndot.edge(\"BaseException\", \"GeneratorExit\")\ndot.edge(\"BaseException\", \"Exception\")\ndot.edge(\"Exception\", \"StopIteration\")\ndot.edge(\"Exception\", \"StopA...
false
1,089
438efbaf35401a29ea5408fee3b49b85f237760e
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-05-12 20:48 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('home', '0010_auto_20170512_2248'), ] o...
[ "# -*- coding: utf-8 -*-\r\n# Generated by Django 1.11 on 2017-05-12 20:48\r\nfrom __future__ import unicode_literals\r\n\r\nfrom django.db import migrations, models\r\nimport django.db.models.deletion\r\n\r\n\r\nclass Migration(migrations.Migration):\r\n\r\n dependencies = [\r\n ('home', '0010_auto_20170...
false
1,090
22523304c9e2ce1339a7527cdbd67a81c780d806
""" We have created mash sketches of the GPDB database, the MGV database, and the SDSU phage, and this will figure out the top hits and summarize their familes. """ import os import sys import argparse def best_hits(distf, maxscore, verbose=False): """ Find the best hits """ bh = {} allph = set()...
[ "\"\"\"\nWe have created mash sketches of the GPDB database, the MGV database, and the SDSU phage, and\nthis will figure out the top hits and summarize their familes.\n\"\"\"\n\nimport os\nimport sys\nimport argparse\n\n\ndef best_hits(distf, maxscore, verbose=False):\n \"\"\"\n Find the best hits\n \"\"\"...
false
1,091
669eb2e898c3a127ae01e0ee3020a3674e5e340d
from yoloPydarknet import pydarknetYOLO import cv2 import imutils import time yolo = pydarknetYOLO(obdata="../darknet/cfg/coco.data", weights="yolov3.weights", cfg="../darknet/cfg/yolov3.cfg") video_out = "yolo_output.avi" start_time = time.time() if __name__ == "__main__": VIDEO_IN = cv2.VideoCapture(0) ...
[ "from yoloPydarknet import pydarknetYOLO\nimport cv2\nimport imutils\nimport time\n\nyolo = pydarknetYOLO(obdata=\"../darknet/cfg/coco.data\", weights=\"yolov3.weights\", \n cfg=\"../darknet/cfg/yolov3.cfg\")\nvideo_out = \"yolo_output.avi\"\n\nstart_time = time.time()\n\nif __name__ == \"__main__\":\n\n VIDE...
true
1,092
6b55a9061bb118558e9077c77e18cfc81f3fa034
# # @lc app=leetcode id=1121 lang=python3 # # [1121] Divide Array Into Increasing Sequences # # https://leetcode.com/problems/divide-array-into-increasing-sequences/description/ # # algorithms # Hard (53.30%) # Likes: 32 # Dislikes: 11 # Total Accepted: 1.7K # Total Submissions: 3.2K # Testcase Example: '[1,2,2,...
[ "#\n# @lc app=leetcode id=1121 lang=python3\n#\n# [1121] Divide Array Into Increasing Sequences\n#\n# https://leetcode.com/problems/divide-array-into-increasing-sequences/description/\n#\n# algorithms\n# Hard (53.30%)\n# Likes: 32\n# Dislikes: 11\n# Total Accepted: 1.7K\n# Total Submissions: 3.2K\n# Testcase ...
false
1,093
d7524a455e62594e321b67f0a32a5c3a7437c1d6
# 引入基础的工作表 from openpyxl import Workbook # 引入增强的修改功能 from openpyxl.styles import Font,Alignment,Border,Side,PatternFill,colors # import openpyxl def make_example(): # 设定文件目录 addr = './example.xlsx' # 初始化文件,切换到活动的工作表 work_book = Workbook() # 读取文件采用 # work_book = openpyxl.load_workbook...
[ "# 引入基础的工作表\r\nfrom openpyxl import Workbook \r\n# 引入增强的修改功能\r\nfrom openpyxl.styles import Font,Alignment,Border,Side,PatternFill,colors\r\n# import openpyxl\r\ndef make_example():\r\n # 设定文件目录\r\n addr = './example.xlsx'\r\n # 初始化文件,切换到活动的工作表\r\n work_book = Workbook()\r\n # 读取文件采用\r\n # work_bo...
false
1,094
9fc9d766915bcefde4f0ba5c24cb83e33fc66272
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() import dbindexer dbindexer.autodiscover() #This needs to happen before anything else, hence strange import ordering urlpatterns = patterns('harvester.views'...
[ "from django.conf.urls import patterns, include, url\n\n# Uncomment the next two lines to enable the admin:\n# from django.contrib import admin\n# admin.autodiscover()\nimport dbindexer\ndbindexer.autodiscover() #This needs to happen before anything else, hence strange import ordering\n\nurlpatterns = patterns('har...
false
1,095
c88e2336432f93d95b4e2285aa532b673a4a410b
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.package import * class RDt(RPackage): """A Wrapper of the JavaScript Library 'DataTables'. Data obje...
[ "# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other\n# Spack Project Developers. See the top-level COPYRIGHT file for details.\n#\n# SPDX-License-Identifier: (Apache-2.0 OR MIT)\n\nfrom spack.package import *\n\n\nclass RDt(RPackage):\n \"\"\"A Wrapper of the JavaScript Library 'DataTables...
false
1,096
6b597f1570c022d17e4476e2ab8817e724a166a7
class Solution: def evalRPN(self, tokens: List[str]) -> int: def operation(op1,op2,op): if op == "+": return op1 + op2 if op == "-": return op1 - op2 if op == "*": return op1 * op2 if op == "/": ...
[ "class Solution:\r\n def evalRPN(self, tokens: List[str]) -> int:\r\n def operation(op1,op2,op):\r\n if op == \"+\":\r\n return op1 + op2\r\n if op == \"-\":\r\n return op1 - op2\r\n if op == \"*\":\r\n return op1 * op2\r\n ...
false
1,097
09c3a10230e7d0b3b893ccf236c39fc2dc12b2c6
dic = {'name': 'Eric', 'age': '25'} # 딕셔너리 형태 print(dic['name'])
[ "dic = {'name': 'Eric', 'age': '25'} # 딕셔너리 형태\n\n\nprint(dic['name'])\n", "dic = {'name': 'Eric', 'age': '25'}\nprint(dic['name'])\n", "<assignment token>\nprint(dic['name'])\n", "<assignment token>\n<code token>\n" ]
false
1,098
ecdc8f5f76b92c3c9dcf2a12b3d9452166fcb706
""" Config module for storage read only disks """ from rhevmtests.storage.config import * # flake8: noqa TEST_NAME = "read_only" VM_NAME = "{0}_vm_%s".format(TEST_NAME) VM_COUNT = 2 DISK_NAMES = dict() # dictionary with storage type as key DISK_TIMEOUT = 600 # allocation policies SPARSE = True DIRECT_LUNS = UNUSE...
[ "\"\"\"\nConfig module for storage read only disks\n\"\"\"\nfrom rhevmtests.storage.config import * # flake8: noqa\n\nTEST_NAME = \"read_only\"\nVM_NAME = \"{0}_vm_%s\".format(TEST_NAME)\n\nVM_COUNT = 2\n\nDISK_NAMES = dict() # dictionary with storage type as key\nDISK_TIMEOUT = 600\n\n# allocation policies\nSPAR...
false
1,099
a55024f0e5edec22125ce53ef54ee364be185cb8
"""Test the init file of Mailgun.""" import hashlib import hmac import pytest from homeassistant import config_entries, data_entry_flow from homeassistant.components import mailgun, webhook from homeassistant.config import async_process_ha_core_config from homeassistant.const import CONF_API_KEY, CONF_DOMAIN from hom...
[ "\"\"\"Test the init file of Mailgun.\"\"\"\nimport hashlib\nimport hmac\n\nimport pytest\n\nfrom homeassistant import config_entries, data_entry_flow\nfrom homeassistant.components import mailgun, webhook\nfrom homeassistant.config import async_process_ha_core_config\nfrom homeassistant.const import CONF_API_KEY, ...
false