index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
9,100
73a778c6e4216c23ac8d82eef96ce7b73b18f661
"""This is the body of the low-level worker tool. A worker is intended to run as a process that imports a module, mutates it in one location with one operator, runs the tests, reports the results, and dies. """ import difflib import importlib import inspect import json import logging import subprocess import sys impo...
[ "\"\"\"This is the body of the low-level worker tool.\n\nA worker is intended to run as a process that imports a module, mutates it in\none location with one operator, runs the tests, reports the results, and dies.\n\"\"\"\n\nimport difflib\nimport importlib\nimport inspect\nimport json\nimport logging\nimport subp...
false
9,101
c6a6b8f2485528af479fadbdf286e82f10a11de8
import collect_from_webapi.api_public_data as pdapi from collect_from_webapi import pd_fetch_tourspot_visitor # url = pdapi.pd_gen_url("http://openapi.tour.go.kr/openapi/serviceTourismResourceStatsService/getPchrgTrrsrtVisitorList", # YM='{0:04d}{1:02d}'.format(2017, 1), # ...
[ "import collect_from_webapi.api_public_data as pdapi\nfrom collect_from_webapi import pd_fetch_tourspot_visitor\n\n# url = pdapi.pd_gen_url(\"http://openapi.tour.go.kr/openapi/serviceTourismResourceStatsService/getPchrgTrrsrtVisitorList\",\n# YM='{0:04d}{1:02d}'.format(2017, 1),\n# ...
false
9,102
99f50d393e750bd8fa5bee21d99f08d20b9f5fe9
from covid import FuzzyNet import numpy as np import time if __name__ == '__main__': # mx1,mx2,mx3,my1,my2,my3, dx1,dx2,dx3,dy1,dy2,dy3, p1,p2,p3,p4,p5,p6,p7,p8,p9, q1,q2,q3,q4,q5,q6,q7,q8,q9, r1,r2,r3,r4,r5,r6,r7,r8,r9 generations = 100 for generation in range(generations): population = np.rando...
[ "from covid import FuzzyNet\nimport numpy as np\nimport time\n\n\nif __name__ == '__main__':\n # mx1,mx2,mx3,my1,my2,my3, dx1,dx2,dx3,dy1,dy2,dy3, p1,p2,p3,p4,p5,p6,p7,p8,p9, q1,q2,q3,q4,q5,q6,q7,q8,q9, r1,r2,r3,r4,r5,r6,r7,r8,r9\n generations = 100\n\n for generation in range(generations):\n popula...
false
9,103
010f78d952657b3d7c11fbf8e46912d0294f6cc1
# python imports import re # django imports from django.core.management.base import BaseCommand # module level imports from utils.spells import SPELLS from spells.models import Spell SPELL_SCHOOL = { 'Abjuration': 'Abjuration', 'Conjuration': 'Conjuration', 'Divination': 'Divination', ...
[ "# python imports\nimport re\n\n# django imports\nfrom django.core.management.base import BaseCommand\n\n# module level imports\nfrom utils.spells import SPELLS\nfrom spells.models import Spell\n\nSPELL_SCHOOL = {\n 'Abjuration': 'Abjuration',\n 'Conjuration': 'Conjuration',\n 'Divination': 'Di...
false
9,104
e1448e62020f87e315d219be97d9af84607441df
"""SamsungTV Encrypted.""" import aiohttp from aioresponses import aioresponses import pytest from yarl import URL from samsungtvws.encrypted.authenticator import SamsungTVEncryptedWSAsyncAuthenticator @pytest.mark.asyncio async def test_authenticator(aioresponse: aioresponses) -> None: with open("tests/fixtures...
[ "\"\"\"SamsungTV Encrypted.\"\"\"\nimport aiohttp\nfrom aioresponses import aioresponses\nimport pytest\nfrom yarl import URL\n\nfrom samsungtvws.encrypted.authenticator import SamsungTVEncryptedWSAsyncAuthenticator\n\n\n@pytest.mark.asyncio\nasync def test_authenticator(aioresponse: aioresponses) -> None:\n wit...
false
9,105
21fec6d307b928a295f2ffbf267456f9cd9ea722
import os import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import cv2 import color_to_gray_operations VIZ_PATH = '../output_data/visualizations/gray_intensities/' def visualize_grayscale_intensities(img, out_path): img_x, img_y = np.mgrid[0: img.shape[0], 0: img.shape...
[ "import os\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.mplot3d import Axes3D\nimport cv2\n\nimport color_to_gray_operations\n\n\nVIZ_PATH = '../output_data/visualizations/gray_intensities/'\n\n\ndef visualize_grayscale_intensities(img, out_path):\n img_x, img_y = np.mgrid[0: img.sha...
false
9,106
31416f1ba9f3c44a7aa740365e05b5db49e70444
#! /usr/bin/env python3 from PIL import Image from imtools import * import os cwd = os.getcwd() filelist = get_imlist(os.getcwd()) print(filelist) for infile in filelist: outfile = os.path.splitext(infile)[0] + ".jpg" if infile != outfile: try: Image.open(infile).save(outfile) except IOError: print("ca...
[ "#! /usr/bin/env python3\n\nfrom PIL import Image\nfrom imtools import *\nimport os\n\ncwd = os.getcwd()\n\nfilelist = get_imlist(os.getcwd())\n\nprint(filelist)\n\nfor infile in filelist:\n\toutfile = os.path.splitext(infile)[0] + \".jpg\"\n\tif infile != outfile:\n\t\ttry:\n\t\t\tImage.open(infile).save(outfile)\...
false
9,107
3eaa898d1428e48aeb0449c7216d0a994262f76a
"""Plotting functionality for ab_test_model.""" import matplotlib.pyplot as plt import numpy as np import seaborn as sns from itertools import combinations from ._ab_test_model_utils import _ab_test_utils # pylint: disable=no-member class _ab_test_plotting(_ab_test_utils): """Provide Funcs for class to plot Baye...
[ "\"\"\"Plotting functionality for ab_test_model.\"\"\"\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport seaborn as sns\nfrom itertools import combinations\nfrom ._ab_test_model_utils import _ab_test_utils\n# pylint: disable=no-member\n\n\nclass _ab_test_plotting(_ab_test_utils):\n \"\"\"Provide Fun...
false
9,108
bd96b31c5de2f0ad4bbc28c876b86ec238db3184
n = int(input("Please input the number of 1's and 0's you want to print:")) for i in range (1, n+1): if i%2 == 1: print ("1 ", end = "") else: print ("0 ", end = "")
[ "n = int(input(\"Please input the number of 1's and 0's you want to print:\"))\n\nfor i in range (1, n+1):\n if i%2 == 1:\n print (\"1 \", end = \"\")\n else:\n print (\"0 \", end = \"\")", "n = int(input(\"Please input the number of 1's and 0's you want to print:\"))\nfor i in range(1, n + 1)...
false
9,109
22f7f725d89db354b2e66ff145550192826af5ea
/opt/python3.7/lib/python3.7/_weakrefset.py
[ "/opt/python3.7/lib/python3.7/_weakrefset.py" ]
true
9,110
687f7f4908e8a5448335f636edf74a627f03c306
from typing import Tuple, Union from webdnn.graph.graph import Graph from webdnn.graph.operators.zero_padding_2d import ZeroPadding2D from webdnn.graph.operators.convolution2d import Convolution2D from webdnn.graph.operators.max_pooling_2d import MaxPooling2D from webdnn.graph.operators.average_pooling_2d import Avera...
[ "from typing import Tuple, Union\n\nfrom webdnn.graph.graph import Graph\nfrom webdnn.graph.operators.zero_padding_2d import ZeroPadding2D\nfrom webdnn.graph.operators.convolution2d import Convolution2D\nfrom webdnn.graph.operators.max_pooling_2d import MaxPooling2D\nfrom webdnn.graph.operators.average_pooling_2d i...
false
9,111
4048d7bfc7922ef76d98d43e1ea266e732e0982e
import requests # qq推送 申请参考https://cp.xuthus.cc/ key = '' def main(): try: api = 'http://t.weather.itboy.net/api/weather/city/' # API地址,必须配合城市代码使用 city_code = '101070201' # 进入https://where.heweather.com/index.html查询你的城市代码 tqurl = api + city_code response = requests.get(tqurl) ...
[ "\nimport requests\n# qq推送 申请参考https://cp.xuthus.cc/\nkey = ''\ndef main():\n try:\n api = 'http://t.weather.itboy.net/api/weather/city/' # API地址,必须配合城市代码使用\n city_code = '101070201' # 进入https://where.heweather.com/index.html查询你的城市代码\n tqurl = api + city_code\n response = requests.g...
false
9,112
f24075ea70851ce95bb6b3cd87b6417f8141d546
import unittest import hospital.employee.nurse as n class TestNurse(unittest.TestCase): @classmethod def setUpClass(cls): print('Start testing nurse') def setUp(self): self.n1 = n.Nurse('Tess',18,"5436890982",3200,25) self.n2 = n.Nurse('Melissa',40,"8920953924",9000,5) def...
[ "import unittest\nimport hospital.employee.nurse as n\n\nclass TestNurse(unittest.TestCase):\n @classmethod\n def setUpClass(cls):\n print('Start testing nurse')\n \n def setUp(self):\n self.n1 = n.Nurse('Tess',18,\"5436890982\",3200,25)\n self.n2 = n.Nurse('Melissa',40,\"8920953924...
false
9,113
7ea6fefa75d36ff45dcea49919fdc632e378a73f
from sqlalchemy import create_engine from sqlalchemy import Table,Column,Integer,String,MetaData,ForeignKey from sqlalchemy.sql import select from sqlalchemy import text #Creating a database 'college.db' engine = create_engine('sqlite:///college.db', echo=True) meta = MetaData() #Creating a Students table s...
[ "from sqlalchemy import create_engine\r\nfrom sqlalchemy import Table,Column,Integer,String,MetaData,ForeignKey\r\nfrom sqlalchemy.sql import select\r\nfrom sqlalchemy import text\r\n\r\n#Creating a database 'college.db'\r\nengine = create_engine('sqlite:///college.db', echo=True)\r\nmeta = MetaData()\r\n\r\n#Creat...
false
9,114
8f7ecbe03e9a7a1d9df8cbe4596456e21b84653b
from base64 import b64encode from configparser import ConfigParser import functools from flask import ( Blueprint, flash, redirect, render_template, request, session, url_for, app ) from requests.exceptions import SSLError import spotipy from spotipy import oauth2 bp = Blueprint('auth', __name__, url_prefix='/auth...
[ "from base64 import b64encode\nfrom configparser import ConfigParser\nimport functools\nfrom flask import (\n Blueprint, flash, redirect, render_template, request, session, url_for, app\n)\nfrom requests.exceptions import SSLError\nimport spotipy\nfrom spotipy import oauth2\n\nbp = Blueprint('auth', __name__, ur...
false
9,115
51848a64102f7fe8272fcf56a9792ed50c430538
import random def patternToNumber(pattern): if len(pattern) == 0: return 0 return 4 * patternToNumber(pattern[0:-1]) + symbolToNumber(pattern[-1:]) def symbolToNumber(symbol): if symbol == "A": return 0 if symbol == "C": return 1 if symbol == "G": return 2 if sy...
[ "import random\n\ndef patternToNumber(pattern):\n if len(pattern) == 0:\n return 0\n return 4 * patternToNumber(pattern[0:-1]) + symbolToNumber(pattern[-1:])\n\ndef symbolToNumber(symbol):\n if symbol == \"A\":\n return 0\n if symbol == \"C\":\n return 1\n if symbol == \"G\":\n ...
false
9,116
a724b49c4d86400b632c02236ceca58e62ba6c86
import json import datetime import string import random import logging import jwt from main import db from main.config import config def execute_sql_from_file(filename): # Open and read the file as a single buffer fd = open(filename, 'r') sql_file = fd.read() fd.close() # All SQL commands (spli...
[ "import json\nimport datetime\nimport string\nimport random\nimport logging\n\nimport jwt\n\nfrom main import db\nfrom main.config import config\n\n\ndef execute_sql_from_file(filename):\n # Open and read the file as a single buffer\n fd = open(filename, 'r')\n sql_file = fd.read()\n fd.close()\n\n #...
true
9,117
889fdca3f92f218e6d6fd3d02d49483f16a64899
new_tuple = (11,12,13,14,15,16,17) new_list = ['one' ,12,'three' ,14,'five'] print("Tuple: ",new_tuple) print("List: ", new_list) tuple_2= tuple (new_list) print("Converted tuple from the list : ", tuple_2)
[ "new_tuple = (11,12,13,14,15,16,17)\nnew_list = ['one' ,12,'three' ,14,'five'] \nprint(\"Tuple: \",new_tuple)\nprint(\"List: \", new_list)\ntuple_2= tuple (new_list)\nprint(\"Converted tuple from the list : \", tuple_2)", "new_tuple = 11, 12, 13, 14, 15, 16, 17\nnew_list = ['one', 12, 'three', 14, 'five']\nprint(...
false
9,118
e8ea307352805bf0b5129e2ad7f7b68c44e78fc9
import src.engine.functions.root_analyzer.main as main from src.engine.functions.function import Function class GetRootData(Function): def __init__(self, data_display): self.data_display = data_display def call(self, args): image_folder_path = args[0] output_path = args[1] sel...
[ "import src.engine.functions.root_analyzer.main as main\nfrom src.engine.functions.function import Function\n\nclass GetRootData(Function):\n\n def __init__(self, data_display):\n self.data_display = data_display\n\n def call(self, args):\n image_folder_path = args[0]\n output_path = args...
false
9,119
d8e9b9f7a8d5ec2a72f083ec2283e8c0724dbe0d
#coding=utf-8 import urllib.parse import json '''转化从charles复制下来的字串,转为json格式''' def to_str(body_str): '''检查需要转化的str是否符合标准''' if not body_str == '': par = body_str.split("&") # print(par) _temp = [] try: for each in par: if "=" not in each: ...
[ "#coding=utf-8\nimport urllib.parse\nimport json\n'''转化从charles复制下来的字串,转为json格式'''\ndef to_str(body_str):\n '''检查需要转化的str是否符合标准'''\n if not body_str == '':\n par = body_str.split(\"&\")\n # print(par)\n _temp = []\n try:\n for each in par:\n if \"=\" not i...
false
9,120
5d988d159902e4a4cb17ee0ec61153de2dda4691
try: from setuptools import setup from setuptools import find_packages has_setup_tools = true except ImportError: from distutils.core import setup has_setup_tools = false with open("README.md", "r") as fh: long_description = fh.read() if has_setup_tools is True: packages = setuptools.find_...
[ "try:\n from setuptools import setup\n from setuptools import find_packages\n has_setup_tools = true\nexcept ImportError:\n from distutils.core import setup\n has_setup_tools = false\n\nwith open(\"README.md\", \"r\") as fh:\n long_description = fh.read()\n\nif has_setup_tools is True:\n packag...
false
9,121
bb9ff561ff94bbe4d20f14287ba313386ea78609
import openpyxl from openpyxl import Workbook import openpyxl as openpyxl from openpyxl.chart import BarChart wb = openpyxl.load_workbook('/Users/mac/Desktop/stu_scores _Grade 2.xlsx') sheet = wb['stu_scores_01'] data = openpyxl.chart.Reference(sheet, min_col=3, min_row=34, max_row=34,max_col=7) cat = openpyxl.chart....
[ "import openpyxl\nfrom openpyxl import Workbook\nimport openpyxl as openpyxl\nfrom openpyxl.chart import BarChart\n\nwb = openpyxl.load_workbook('/Users/mac/Desktop/stu_scores _Grade 2.xlsx')\nsheet = wb['stu_scores_01']\n\ndata = openpyxl.chart.Reference(sheet, min_col=3, min_row=34, max_row=34,max_col=7)\ncat = o...
false
9,122
b39403171ed264c8fae5ea4ae9d17f77cfcab497
import unittest import sys import os #Add project root to path sys.path.append('../..') from speckle.SpeckleClient import SpeckleApiClient class TestSpeckleStream(unittest.TestCase): def setUp(self): self.s = SpeckleApiClient() self.user = {'email':'testuser@arup.com','password':'testpassword',...
[ "import unittest\nimport sys\nimport os\n#Add project root to path\nsys.path.append('../..')\n\nfrom speckle.SpeckleClient import SpeckleApiClient\n\n\nclass TestSpeckleStream(unittest.TestCase):\n\n def setUp(self):\n\n self.s = SpeckleApiClient()\n self.user = {'email':'testuser@arup.com','passwo...
false
9,123
906b7f02d6a7968bbf4780e682d4f9a92526326a
# Taken from: https://github.com/flyyufelix/cnn_finetune/blob/master/vgg16.py # based on: https://gist.github.com/baraldilorenzo/07d7802847aaad0a35d3 # -*- coding: utf-8 -*- import keras import itertools import sys from sklearn.metrics import confusion_matrix import numpy as np import matplotlib import ma...
[ "\r\n# Taken from: https://github.com/flyyufelix/cnn_finetune/blob/master/vgg16.py \r\n# based on: https://gist.github.com/baraldilorenzo/07d7802847aaad0a35d3\r\n\r\n# -*- coding: utf-8 -*-\r\nimport keras\r\nimport itertools\r\nimport sys\r\nfrom sklearn.metrics import confusion_matrix\r\nimport numpy as np\r\nimp...
true
9,124
0c0fb3bfb81be5ef6a60584eafeefec61f171679
import pytest import json import os.path import importlib import jsonpickle from fixture.application import Application fixture = None config = None @pytest.fixture def app(request): global fixture global config browser = request.config.getoption("--browser") if config is None: conf_file_pat...
[ "import pytest\nimport json\nimport os.path\nimport importlib\nimport jsonpickle\nfrom fixture.application import Application\n\n\nfixture = None\nconfig = None\n\n\n@pytest.fixture\ndef app(request):\n global fixture\n global config\n browser = request.config.getoption(\"--browser\")\n if config is Non...
false
9,125
ccc74f58eff3bb00f0be8c2c963de4208b7f0933
from math import ceil, log2, sqrt def constructST(s, start, end, st, i): if start == end: st[i] = 0 openst[i] = 1 if s[start] == '(' else 0 closedst[i] = 1 if s[start] == ')' else 0 return st[i], openst[i], closedst[i] else: mid = (start+end)//2 st[i], openst[i], closedst[i] = constructST(s, ...
[ "from math import ceil, log2, sqrt\r\n\r\ndef constructST(s, start, end, st, i):\r\n\tif start == end:\r\n\t\tst[i] = 0\r\n\t\topenst[i] = 1 if s[start] == '(' else 0\r\n\t\tclosedst[i] = 1 if s[start] == ')' else 0\r\n\t\treturn st[i], openst[i], closedst[i]\r\n\r\n\telse:\r\n\t\tmid = (start+end)//2\r\n\t\tst[i],...
false
9,126
aa55f1dd4f363e07d5f9104346efaa24c0457d45
from .sgd import StochasticGradientDescent from .momentum import Momentum
[ "from .sgd import StochasticGradientDescent\nfrom .momentum import Momentum\n", "<import token>\n" ]
false
9,127
e99e558ebf5938a90f00df6593c9f75a18affcb8
import sqlparse f = open("parse.sql") go = open("struct.go", "w+") dictiony = { "uuid": "string", "varchar": "string", "timestamp": "time.Time", "int": "int", "text": "string", "dbname": "IndividualContrAgent", "interface": "IndividualContrAgentI", "ica":"ica" } #package go.write("packa...
[ "import sqlparse\n\nf = open(\"parse.sql\")\ngo = open(\"struct.go\", \"w+\")\ndictiony = {\n \"uuid\": \"string\",\n \"varchar\": \"string\",\n \"timestamp\": \"time.Time\",\n \"int\": \"int\",\n \"text\": \"string\",\n \"dbname\": \"IndividualContrAgent\",\n \"interface\": \"IndividualContrAg...
false
9,128
d5d12e2269b343dde78534eddf2cce06759eb264
# Copyright 2017 Klarna AB # # 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, s...
[ "# Copyright 2017 Klarna AB\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed t...
false
9,129
b9c8689dbdf451e6a981f1abdae55771266fe231
import json import os from flask import Flask, request, url_for from flask_cors import CORS from werkzeug.utils import secure_filename from service.Binarizacion import Binarizacion UPLOAD_FOLDER = './public/files' app = Flask(__name__) app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER CORS(app) @app.route('/') def hell...
[ "import json\nimport os\n\nfrom flask import Flask, request, url_for\nfrom flask_cors import CORS\nfrom werkzeug.utils import secure_filename\n\nfrom service.Binarizacion import Binarizacion\n\nUPLOAD_FOLDER = './public/files'\n\napp = Flask(__name__)\napp.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER\n\nCORS(app)\n\n@ap...
false
9,130
dcc1b0decf2fca6309dbb60faebd3f0a6944cd7d
#!/usr/local/bin/python i = 0 while i == 0: try: print("Let's divide some numbers!") a1 = input("Enter numerator: ") b1 = input("Enter denominator: ") a = int(a1) b = int(b1) print(a1 + " divied by " + b1 + " equals: " + str(a/b)) i += 1 except...
[ "#!/usr/local/bin/python\n\ni = 0\nwhile i == 0:\n\n try:\n print(\"Let's divide some numbers!\")\n a1 = input(\"Enter numerator: \")\n b1 = input(\"Enter denominator: \")\n a = int(a1)\n b = int(b1)\n \n print(a1 + \" divied by \" + b1 + \" equals: \" + str(a/b))\n ...
false
9,131
ac60fd79d7fb15624cf79adc7e456960e7523e2e
import sys from google.appengine.ext import blobstore from google.appengine.ext.webapp import blobstore_handlers from google.appengine.ext import ndb from helpers import * def valid_pw(name, password, h): salt = h.split(',')[0] return h == make_pw_hash(name, password, salt) class CVEProfile(ndb.Model): profile_nam...
[ "import sys\nfrom google.appengine.ext import blobstore\nfrom google.appengine.ext.webapp import blobstore_handlers\nfrom google.appengine.ext import ndb\nfrom helpers import *\n\ndef valid_pw(name, password, h):\n\tsalt = h.split(',')[0]\n\treturn h == make_pw_hash(name, password, salt)\n\nclass CVEProfile(ndb.Mod...
false
9,132
06cb832c3adae95fcd1d1d2d0663641d3ac671ef
def main(): x = float(input("Coordenada x: ")) y = float(input("Coordenada y: ")) if 1 <= y <= 2 and -3 <= x <= 3: print("dentro") elif (4 <= y <= 5 or 6 <= x <= 7) and ( -4 <= x <= -3 or -2 <= x <= -1 or 1 <= x <= 2 or 3 <= x <= 4): print("dentro") e...
[ "def main():\r\n x = float(input(\"Coordenada x: \"))\r\n y = float(input(\"Coordenada y: \"))\r\n \r\n if 1 <= y <= 2 and -3 <= x <= 3:\r\n print(\"dentro\")\r\n \r\n elif (4 <= y <= 5 or 6 <= x <= 7) and ( -4 <= x <= -3 or -2 <= x <= -1 or 1 <= x <= 2 or 3 <= x <= 4):\r\n ...
false
9,133
0a90f29a4e18c2aed23cb31b4239d44d23526327
from telegram.ext import Updater, Filters, MessageHandler, PicklePersistence import telegram import logging logging.basicConfig(format='%(asctime)s %(message)s\n', level=logging.INFO,filename='log.json') logger = logging.getLogger(__name__) def main(): # my_persistence = PicklePersistence(...
[ "from telegram.ext import Updater, Filters, MessageHandler, PicklePersistence\nimport telegram\nimport logging\n\n\nlogging.basicConfig(format='%(asctime)s %(message)s\\n',\n level=logging.INFO,filename='log.json')\n\nlogger = logging.getLogger(__name__)\n\n\ndef main():\n\n # my_persistence =...
false
9,134
002cced6d24a4790d29f195355c795d609f744a7
n = int(input()) m = int(input()) x = int(input()) y = int(input()) if m<n: if m-x < x: x = m-x if n-y < y: y = n-y else: if n-x <x: x=n-x if m-y <y: y=m-y if x<y: print(x) else: print(y)
[ "n = int(input())\r\nm = int(input())\r\nx = int(input())\r\ny = int(input())\r\n\r\nif m<n:\r\n if m-x < x:\r\n x = m-x\r\n if n-y < y:\r\n y = n-y\r\nelse:\r\n if n-x <x:\r\n x=n-x\r\n if m-y <y:\r\n y=m-y\r\nif x<y:\r\n print(x)\r\nelse:\r\n print(y)\r\n\r\n\r\n", ...
false
9,135
dcbbc7098410d771a7151af7c43ac4d0e4d46f18
########################################################################## # # Draw a 2-D plot for student registration number and the marks secured using gnuplot # ########################################################################## import Gnuplot # create lists to store student marks and regno student_reg=[...
[ "##########################################################################\n#\n# Draw a 2-D plot for student registration number and the marks secured using gnuplot \n#\n##########################################################################\n\n\nimport Gnuplot\n\n# create lists to store student marks and regno...
false
9,136
783326ccec31dc7a0ff46c5e4b69806e99aeda57
# template for "Guess the number" mini-project # input will come from buttons and an input field # all output for the game will be printed in the console import simplegui import random import math # initialize global variables used in your code range = 100 guesses_made = 0 guesses_remaining = 0 highest_guess = 0 lowes...
[ "# template for \"Guess the number\" mini-project\n# input will come from buttons and an input field\n# all output for the game will be printed in the console\nimport simplegui\nimport random\nimport math\n\n# initialize global variables used in your code\nrange = 100\nguesses_made = 0\nguesses_remaining = 0\nhighe...
true
9,137
c812419e7e024b0bb1207832b2b4a726ef61b272
class FieldDesigner: """ Designs a field for BattleShips, accepts field height and width """ def __init__( self, ): self.field = [] def design_field( self, height, width, ): self.field = [[ '~' for __ ...
[ "class FieldDesigner:\n \"\"\"\n Designs a field for BattleShips, accepts field height and width\n \"\"\"\n def __init__(\n self,\n ):\n self.field = []\n\n def design_field(\n self,\n height,\n width,\n ):\n\n self.field = [[\n ...
false
9,138
a14a1803a0bae755803c471b12035398de262dbc
import re def molecule_to_list(molecule: str) -> list: """Splits up a molucule into elements and amount in order of appearance Args: molecule (str): The molecule to split up Raises: ValueError: If molecule starts with a lower case letter ValueError: If molecule contains a non-alp...
[ "import re\n\n\ndef molecule_to_list(molecule: str) -> list:\n \"\"\"Splits up a molucule into elements and amount in order of appearance\n\n Args:\n molecule (str): The molecule to split up\n\n Raises:\n ValueError: If molecule starts with a lower case letter\n ValueError: If molecule...
false
9,139
753c87a3d22aeca1001eb770831b846b175d873e
from hops import constants class Cluster(object): """ Represents a Cluster in Cluster Analysis computed for a featuregroup or training dataset in the featurestore """ def __init__(self, cluster_json): """ Initialize the cluster object from JSON payload Args: :clust...
[ "from hops import constants\n\nclass Cluster(object):\n \"\"\"\n Represents a Cluster in Cluster Analysis computed for a featuregroup or training dataset in the featurestore\n \"\"\"\n\n def __init__(self, cluster_json):\n \"\"\"\n Initialize the cluster object from JSON payload\n\n ...
false
9,140
63bfaa6e191e6090060877e737f4b003bed559cf
#! /usr/local/bin/python3 # -*- coding: utf-8 -*- from requests_oauthlib import OAuth1Session BASEURL = 'https://api.twitter.com/1.1/' CK = '3rJOl1ODzm9yZy63FACdg' CS = '5jPoQ5kQvMJFDYRNE8bQ4rHuds4xJqhvgNJM4awaE8' AT = '333312023-6dTniMxvwlQG8bATKNYWBXaQkftz9t4ZjRBt7BWk' AS = 'LQ8xXBTTN8F8CHQv9oDAqsGJFeexdnFf2DFzn3E...
[ "#! /usr/local/bin/python3\n# -*- coding: utf-8 -*-\n\nfrom requests_oauthlib import OAuth1Session\n\nBASEURL = 'https://api.twitter.com/1.1/'\n\nCK = '3rJOl1ODzm9yZy63FACdg'\nCS = '5jPoQ5kQvMJFDYRNE8bQ4rHuds4xJqhvgNJM4awaE8'\nAT = '333312023-6dTniMxvwlQG8bATKNYWBXaQkftz9t4ZjRBt7BWk'\nAS = 'LQ8xXBTTN8F8CHQv9oDAqsGJ...
false
9,141
89ba805e47a9727573e1e25371a70fb887ee170d
import datetime import operator import geopy from django.db import models from django.db.models import Q from django.db.models.query import QuerySet from django.db.models import permalink from django.contrib.auth.models import User geocoder = geopy.geocoders.Google() class City(models.Model): name = models.C...
[ "import datetime\nimport operator\n\nimport geopy\n\nfrom django.db import models\nfrom django.db.models import Q\nfrom django.db.models.query import QuerySet\nfrom django.db.models import permalink\nfrom django.contrib.auth.models import User\n\n\ngeocoder = geopy.geocoders.Google()\n\n\nclass City(models.Model):\...
false
9,142
9b3040fa02cf8f039bac146f8a73384731c56722
#While Loop count = 0 while count<9: print("Number:",count) count = count+1 print("Good Bye") #For Loop fruits = ['Mango','Grapes','Apple'] for fruit in fruits: print("current fruits:",fruit) print("Good bye")
[ "#While Loop\ncount = 0\nwhile count<9:\n print(\"Number:\",count)\n count = count+1\n\nprint(\"Good Bye\") \n\n#For Loop \nfruits = ['Mango','Grapes','Apple']\n\nfor fruit in fruits:\n print(\"current fruits:\",fruit)\n\nprint(\"Good bye\")\n\n", "count = 0\nwhile count < 9:\n print('Number:', count)\n ...
false
9,143
01de85b0d480c105c8cc1a8154c3de936ab3226d
#!/usr/bin/env python # -*- coding: utf-8 -*- # File: wenshu/actions.py # Author: Carolusian <https://github.com/carolusian> # Date: 22.09.2018 # Last Modified Date: 22.09.2018 # # Copyright 2018 Carolusian import time import itertools import re import requests import json import os from random import randint from se...
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# File: wenshu/actions.py\n# Author: Carolusian <https://github.com/carolusian>\n# Date: 22.09.2018\n# Last Modified Date: 22.09.2018\n#\n# Copyright 2018 Carolusian\n\nimport time\nimport itertools\nimport re\nimport requests\nimport json\nimport os\nfrom random i...
false
9,144
a826f33361ec59824f3c4a83d01e94c6b307b0a9
import os #defaults = {"N":20, "K":3, "POP_SIZE":200, "MUT_RATE":.05, "TOURNAMENT_SIZE":2, "SELECTION":0, "CHANGE_RATE":100000, "MAX_GENS": 5000, "FILTER_LENGTH":50} defaults = {"N":20, "K":3, "POP_SIZE":200, "MUT_RATE":.05, "TOURNAMENT_SIZE":2, "SELECTION":0, "CHANGE_RATE":100000, "MAX_GENS": 5000, "FILTER_LENGTH":"...
[ "import os\n\n\n#defaults = {\"N\":20, \"K\":3, \"POP_SIZE\":200, \"MUT_RATE\":.05, \"TOURNAMENT_SIZE\":2, \"SELECTION\":0, \"CHANGE_RATE\":100000, \"MAX_GENS\": 5000, \"FILTER_LENGTH\":50}\ndefaults = {\"N\":20, \"K\":3, \"POP_SIZE\":200, \"MUT_RATE\":.05, \"TOURNAMENT_SIZE\":2, \"SELECTION\":0, \"CHANGE_RATE\":10...
false
9,145
19126e5041841ab1320730ae82d66c6900cf31bd
import sys, os sys.path.insert(0, os.path.abspath("adjust_schedule_function"))
[ "import sys, os\n\nsys.path.insert(0, os.path.abspath(\"adjust_schedule_function\"))\n", "import sys, os\nsys.path.insert(0, os.path.abspath('adjust_schedule_function'))\n", "<import token>\nsys.path.insert(0, os.path.abspath('adjust_schedule_function'))\n", "<import token>\n<code token>\n" ]
false
9,146
3458e1efdc492a08d8272469aa9e3f0ca72c7ba3
import h5py import sys f = h5py.File(sys.argv[1], 'r+') try: del f['optimizer_weights'] except: print "done" f.close()
[ "import h5py\nimport sys\nf = h5py.File(sys.argv[1], 'r+')\ntry:\n\tdel f['optimizer_weights']\nexcept:\n\tprint \"done\"\nf.close()" ]
true
9,147
84ece5d1a9e38b83a5b60052fc3ab089c498d2fc
from django.contrib import admin from get_my_tweets.models import username admin.site.register(username)
[ "from django.contrib import admin\nfrom get_my_tweets.models import username\n\nadmin.site.register(username)\n", "from django.contrib import admin\nfrom get_my_tweets.models import username\nadmin.site.register(username)\n", "<import token>\nadmin.site.register(username)\n", "<import token>\n<code token>\n" ...
false
9,148
0ed0fb6f9bcc768bb005222c9ae9b454f6d962ec
#!/usr/bin/env python from __future__ import print_function import weechat import sys import pickle import json import math import os.path from datetime import datetime from datetime import date from datetime import timedelta from dateutil.parser import parse as datetime_parse from os.path import expanduser from goog...
[ "#!/usr/bin/env python\n\nfrom __future__ import print_function\nimport weechat\nimport sys\nimport pickle\nimport json\nimport math\nimport os.path\nfrom datetime import datetime\nfrom datetime import date\nfrom datetime import timedelta\nfrom dateutil.parser import parse as datetime_parse\nfrom os.path import exp...
false
9,149
3fadb91bd2367819a540f687530f4b48ed878423
#!/usr/bin/env python # -*- coding: utf-8 -*- help_txt = """ :help, show this help menu. :help [command] for detail :dict [word], only find translation on dict.cn :google [sentence], only find translation on google api :lan2lan [sentence], translate from one language to another language :add [word], add new word to yo...
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nhelp_txt = \"\"\"\n:help, show this help menu. :help [command] for detail\n:dict [word], only find translation on dict.cn\n:google [sentence], only find translation on google api\n:lan2lan [sentence], translate from one language to another language\n:add [word], ad...
false
9,150
f97150f60dfb3924cda2c969141d5bfe675725ef
#!env/bin/python3 from app import app from config import config as cfg app.run(debug=True, host=cfg.APP_HOST, port=cfg.APP_PORT)
[ "#!env/bin/python3\nfrom app import app\nfrom config import config as cfg\napp.run(debug=True, host=cfg.APP_HOST, port=cfg.APP_PORT)\n", "from app import app\nfrom config import config as cfg\napp.run(debug=True, host=cfg.APP_HOST, port=cfg.APP_PORT)\n", "<import token>\napp.run(debug=True, host=cfg.APP_HOST, p...
false
9,151
bd2edd5139a9c5050c582a54cdacca2b0739f333
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import warnings from functools import wraps import re import logging import pandas as pd import requests def return_df(field="data"): """return DataFrame data""" def decorator(func): @wraps(func) def wrapper(self, *args, **kwargs):...
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport datetime\nimport warnings\nfrom functools import wraps\nimport re\nimport logging\nimport pandas as pd\nimport requests\n\n\ndef return_df(field=\"data\"):\n \"\"\"return DataFrame data\"\"\"\n\n def decorator(func):\n @wraps(func)\n def wr...
false
9,152
ff26a2c2d8427f1ad4617669e701ea88b34616cd
#! /usr/bin/env python # coding: utf-8 ''' Author: xiezhw3@163.com @contact: xiezhw3@163.com @version: $Id$ Last modified: 2016-01-17 FileName: consumer.py Description: 从 rabbitmq 拿到消息并存储到数据库 ''' import pika import json import logging import pymongo import traceback from conf import config from code.modules.db_proce...
[ "#! /usr/bin/env python\n# coding: utf-8\n\n'''\nAuthor: xiezhw3@163.com\n@contact: xiezhw3@163.com\n@version: $Id$\nLast modified: 2016-01-17\nFileName: consumer.py\nDescription: 从 rabbitmq 拿到消息并存储到数据库\n'''\n\nimport pika\nimport json\nimport logging\nimport pymongo\nimport traceback\n\nfrom conf import config\nfr...
false
9,153
3c053bf1b572759eddcd310d185f7e44d82171a5
#coding:utf-8 x = '上' res = x.encode('gbk') print(res, type(res)) print(res.decode('gbk'))
[ "#coding:utf-8\n\nx = '上'\nres = x.encode('gbk')\nprint(res, type(res))\nprint(res.decode('gbk'))\n\n", "x = '上'\nres = x.encode('gbk')\nprint(res, type(res))\nprint(res.decode('gbk'))\n", "<assignment token>\nprint(res, type(res))\nprint(res.decode('gbk'))\n", "<assignment token>\n<code token>\n" ]
false
9,154
1edb92a4905048f3961e3067c67ef892d7b8a034
# Imports import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.utils import data from torch.utils.data import DataLoader import torchvision.datasets as datasets import torchvision.transforms as transforms # Create Fully Connected Network class NN(nn.Module): def...
[ "# Imports\nimport torch\nimport torch.nn as nn\nimport torch.optim as optim\nimport torch.nn.functional as F\nfrom torch.utils import data\nfrom torch.utils.data import DataLoader\nimport torchvision.datasets as datasets\nimport torchvision.transforms as transforms\n\n# Create Fully Connected Network\nclass NN(nn....
false
9,155
fc6c220f8a3a0e9dd1d6e6e1ca131136db8f8a58
# -*- coding: utf-8 -*- """ Created on Mon Nov 11 18:50:46 2019 @author: kanfar """ import numpy as np import timeit import matplotlib.pyplot as plt from numpy import expand_dims, zeros, ones from numpy.random import randn, randint from keras.models import load_model from keras.optimizers import Adam from keras.model...
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Nov 11 18:50:46 2019\n\n@author: kanfar\n\"\"\"\n\nimport numpy as np\nimport timeit\nimport matplotlib.pyplot as plt\nfrom numpy import expand_dims, zeros, ones\nfrom numpy.random import randn, randint\nfrom keras.models import load_model\nfrom keras.optimizers impo...
false
9,156
4dae34b7c90f52314aac5e457addb3700ffcbd28
import sys sys.path.append("..\\Pole_IA_Systemes_Experts") from tkinter import * from Knowledge_base.Facts import Fact from Knowledge_base.Rules import Rule from Backward.Explanation_tree import * def ask_about_fact(fact: Fact): """ Asks the user about whether a fact is true or false threw an interface provi...
[ "import sys\n\nsys.path.append(\"..\\\\Pole_IA_Systemes_Experts\")\nfrom tkinter import *\nfrom Knowledge_base.Facts import Fact\nfrom Knowledge_base.Rules import Rule\nfrom Backward.Explanation_tree import *\n\n\ndef ask_about_fact(fact: Fact):\n \"\"\"\n Asks the user about whether a fact is true or false t...
false
9,157
9515dcdfc0ece1a6740d6e7075bbcd1c20977590
#! /usr/bin/env python2 ############################################################ # Program is part of PySAR v1.2 # # Copyright(c) 2015, Heresh Fattahi, Zhang Yunjun # # Author: Heresh Fattahi, Zhang Yunjun # ####################################################...
[ "#! /usr/bin/env python2\n############################################################\n# Program is part of PySAR v1.2 #\n# Copyright(c) 2015, Heresh Fattahi, Zhang Yunjun #\n# Author: Heresh Fattahi, Zhang Yunjun #\n##########################################...
true
9,158
13b2e05f12c6d0cd91e89f01e7eef610b1e99856
# from __future__ import annotations from typing import List,Union,Tuple,Dict,Set import sys input = sys.stdin.readline # from collections import defaultdict,deque # from itertools import permutations,combinations # from bisect import bisect_left,bisect_right import heapq # sys.setrecursionlimit(10**5) # class UnionFi...
[ "# from __future__ import annotations\nfrom typing import List,Union,Tuple,Dict,Set\nimport sys\ninput = sys.stdin.readline\n# from collections import defaultdict,deque\n# from itertools import permutations,combinations\n# from bisect import bisect_left,bisect_right\nimport heapq\n# sys.setrecursionlimit(10**5)\n\n...
false
9,159
6990b5f34af654b4e1a39c3d73b6822fa48e4835
import requests import re import time import os import argparse import json url = "https://contactform7.com/captcha/" headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Safari/605.1.15', 'Content-Type': "multipart/form-data; boun...
[ "import requests\nimport re\nimport time\nimport os\nimport argparse\nimport json\n\nurl = \"https://contactform7.com/captcha/\"\nheaders = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Safari/605.1.15',\n 'Content-Type': \"multipar...
false
9,160
387c48fcf00480a820fb407f5bad1d9f41b28e7a
#!/usr/bin/python # coding=utf-8 import re str1 = 'http://www.chinapesticide.org.cn/myquery/querydetail?pdno=' str2 = '&pdrgno=' f = open('aaa.txt', 'r') source = f.read() rr = re.compile(r'open[(\'](.*)[\']') s=rr.findall(source) for line in s: temps = line.split(',') a = temps[0] b = temps[1] print ...
[ "#!/usr/bin/python\n# coding=utf-8\n\nimport re\n\nstr1 = 'http://www.chinapesticide.org.cn/myquery/querydetail?pdno='\nstr2 = '&pdrgno='\nf = open('aaa.txt', 'r')\nsource = f.read()\nrr = re.compile(r'open[(\\'](.*)[\\']')\ns=rr.findall(source)\nfor line in s:\n temps = line.split(',')\n a = temps[0]\n b ...
true
9,161
00ec56420831d8f4ab14259c7b07f1be0bcb7d78
# -*- coding: utf-8 -*- # @Time : 2018/12/13 21:32 # @Author : sundongjian # @Email : xiaobomentu@163.com # @File : __init__.py.py # @Software: PyCharm
[ "# -*- coding: utf-8 -*-\r\n# @Time : 2018/12/13 21:32\r\n# @Author : sundongjian\r\n# @Email : xiaobomentu@163.com\r\n# @File : __init__.py.py\r\n# @Software: PyCharm", "" ]
false
9,162
fef1cf75de8358807f29cd06d2338e087d6f2d23
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """The GIFT module provides basic functions for interfacing with some of the GIFT tools. In order to use the standalone MCR version of GIFT, you need to ensure that the following commands are executed at ...
[ "# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-\n# vi: set ft=python sts=4 ts=4 sw=4 et:\n\"\"\"The GIFT module provides basic functions for interfacing with some of the GIFT tools.\n\nIn order to use the standalone MCR version of GIFT, you need to ensure that\nthe following commands are...
false
9,163
88e4e6647d4720d1c99f3e3438100790903921b5
import os import click import csv import sqlite3 from sqlite3.dbapi2 import Connection import requests import mimetypes from urllib.parse import urljoin, urlparse from lxml.html.soupparser import fromstring from lxml import etree from lxml.etree import tostring from analysis import lmdict, tone_count_with_negation_chec...
[ "import os\nimport click\nimport csv\nimport sqlite3\nfrom sqlite3.dbapi2 import Connection\nimport requests\nimport mimetypes\nfrom urllib.parse import urljoin, urlparse\nfrom lxml.html.soupparser import fromstring\nfrom lxml import etree\nfrom lxml.etree import tostring\nfrom analysis import lmdict, tone_count_wi...
false
9,164
79c6b7c3d23248f249b55af1d097a66a78a2c22f
x = int(input("Enter number:")) y = x/2 print(y) for i in
[ "x = int(input(\"Enter number:\"))\ny = x/2\nprint(y)\n\nfor i in \n" ]
true
9,165
379c666f19537b513169c6b30e0c669dda6e372c
ii = [('CoolWHM2.py', 73), ('MarrFDI3.py', 2), ('IrviWVD.py', 2), ('CoolWHM3.py', 8), ('LewiMJW.py', 1), ('JacoWHI2.py', 4), ('EvarJSP.py', 1)]
[ "ii = [('CoolWHM2.py', 73), ('MarrFDI3.py', 2), ('IrviWVD.py', 2), ('CoolWHM3.py', 8), ('LewiMJW.py', 1), ('JacoWHI2.py', 4), ('EvarJSP.py', 1)]", "ii = [('CoolWHM2.py', 73), ('MarrFDI3.py', 2), ('IrviWVD.py', 2), (\n 'CoolWHM3.py', 8), ('LewiMJW.py', 1), ('JacoWHI2.py', 4), ('EvarJSP.py', 1)\n ]\n", "<as...
false
9,166
a8bed0b5a6a95d67b5602b395f1d0ea12cd53fb0
#!/usr/bin/env python s = '''Вбс лче ,мтс ооепта т.сбзек о ып гоэятмв,те гоктеивеысокячел–аонкы оах ннлнисьрнксе ьрм отаб тёьдр ннласааосд це аЧиу нвыанзи еслкмиетл,леево ннлтпо еик:ыаырялньб пнм би на це азоватоша Вепьлаяокеолвоытрх еытодрпьтае,кллгфм ытитослРянозит нсонунс.р лунттаё ооиВяе зн етвйеетелттв еСлл...
[ "#!/usr/bin/env python\ns = '''Вбс лче ,мтс ооепта т.сбзек о ып гоэятмв,те гоктеивеысокячел–аонкы оах ннлнисьрнксе ьрм отаб тёьдр ннласааосд це аЧиу нвыанзи еслкмиетл,леево ннлтпо еик:ыаырялньб пнм би на це азоватоша Вепьлаяокеолвоытрх еытодрпьтае,кллгфм ытитослРянозит нсонунс.р лунттаё ооиВяе зн етвйеетелтт...
false
9,167
6ff300bbd7866466d1992445e46c5ee54f73d0d7
# -*- encoding: utf-8 -*- # @Version : 1.0 # @Time : 2018/8/29 9:59 # @Author : wanghuodong # @note : 生成一个简单窗口 import sys from PyQt5.QtWidgets import QApplication, QWidget if __name__ == '__main__': '''所有的PyQt5应用必须创建一个应用(Application)对象。sys.argv参数是一个来自命令行的参数列表。Python脚本可以在shell中运行''' app = QApplic...
[ "# -*- encoding: utf-8 -*-\n# @Version : 1.0 \n# @Time : 2018/8/29 9:59\n# @Author : wanghuodong \n# @note : 生成一个简单窗口\n\nimport sys\nfrom PyQt5.QtWidgets import QApplication, QWidget\n\n\nif __name__ == '__main__':\n\n '''所有的PyQt5应用必须创建一个应用(Application)对象。sys.argv参数是一个来自命令行的参数列表。Python脚本可以在shell中运行'''\...
false
9,168
f840624ec11679d576fbb80f8e753c59663a7ee2
#!/usr/bin/env python # USAGE: day_22_01.py # Michael Chambers, 2017 class Grid: def __init__(self, startFile): # Load initial infected sites # Origin is top-left of input file self.infected = set() posx = 0 with open(startFile, 'r') as fo: for i, line in enumerate(fo): line = line.rstrip() posx...
[ "#!/usr/bin/env python\n\n# USAGE: day_22_01.py\n# Michael Chambers, 2017\n\nclass Grid:\n\tdef __init__(self, startFile):\n\t\t# Load initial infected sites\n\t\t# Origin is top-left of input file\n\t\tself.infected = set()\n\t\tposx = 0\n\t\twith open(startFile, 'r') as fo:\n\t\t\tfor i, line in enumerate(fo):\n\...
false
9,169
b717abaeecea2e97c6ec78d3e0e4c97a8de5eec3
"""Implementation of the Brainpool standard, see https://tools.ietf.org/pdf/rfc5639.pdf#15 """ from sage.all import ZZ, GF, EllipticCurve from utils import increment_seed, embedding_degree, find_integer, SimulatedCurves, VerifiableCurve, \ class_number_check CHECK_CLASS_NUMBER = False def gen_brainpool_prime...
[ "\"\"\"Implementation of the Brainpool standard, see\n https://tools.ietf.org/pdf/rfc5639.pdf#15\n\"\"\"\nfrom sage.all import ZZ, GF, EllipticCurve\nfrom utils import increment_seed, embedding_degree, find_integer, SimulatedCurves, VerifiableCurve, \\\n class_number_check\n\nCHECK_CLASS_NUMBER = False\n\n\nd...
false
9,170
9dc8449bcc0c6c6ffb5ced5724ca632b6578bf1b
from flask import Flask, render_template, request import matplotlib.pyplot as plt import numpy as np import sympy from DerivTest import diff, diff2, trapz from sympy.parsing.sympy_parser import parse_expr from sympy import Symbol #from ParsingClass import Parser #from scitools.StringFunction import StringFunction #from...
[ "from flask import Flask, render_template, request\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport sympy\nfrom DerivTest import diff, diff2, trapz\nfrom sympy.parsing.sympy_parser import parse_expr\nfrom sympy import Symbol\n#from ParsingClass import Parser\n#from scitools.StringFunction import StringF...
false
9,171
feac1092d1aaf70eb4d4df919e434cdc1aa9c826
import numpy as np from scipy import stats from statarray import statdat #a2a1 = np.loadtxt('a2a1_130707_2300.dat') #a2a1 = np.concatenate( (a2a1, np.loadtxt('a2a1_130708_1223.dat')), axis=0 ) #a2a1 = np.loadtxt('a2a1_130708_1654.dat') #a2a1 = np.loadtxt('a2a1_130709_0030.dat') import matplotlib.pyplot as plt impo...
[ "\nimport numpy as np\nfrom scipy import stats\nfrom statarray import statdat\n\n#a2a1 = np.loadtxt('a2a1_130707_2300.dat')\n#a2a1 = np.concatenate( (a2a1, np.loadtxt('a2a1_130708_1223.dat')), axis=0 )\n\n#a2a1 = np.loadtxt('a2a1_130708_1654.dat')\n#a2a1 = np.loadtxt('a2a1_130709_0030.dat')\n\n\nimport matplotlib.p...
false
9,172
6efe3975f4d5d9f431391b3560c37a3e89e27f3d
# (c) 2019, Ansible by Red Hat, inc # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # from __future__ import absolute_import, division, print_function __metaclass__ = type from ansible_collections.arista.eos.tests.unit.compat.mock import patch from ansible_collections.ari...
[ "# (c) 2019, Ansible by Red Hat, inc\n# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)\n#\n\nfrom __future__ import absolute_import, division, print_function\n\n__metaclass__ = type\n\nfrom ansible_collections.arista.eos.tests.unit.compat.mock import patch\nfrom ansible_c...
false
9,173
0aa95b6a72472e8e260c07f4c42a327384ca0da4
from Psql_Database_Setup import * import requests, json engine = create_engine('postgresql://myuser:mypass@localhost:5432/mydb') Base.metadata.bind = engine DBSession = sessionmaker(bind=engine) session = DBSession() response = requests.get("https://api.github.com/emojis") response = json.loads(response.te...
[ "from Psql_Database_Setup import *\r\nimport requests, json\r\n\r\nengine = create_engine('postgresql://myuser:mypass@localhost:5432/mydb')\r\nBase.metadata.bind = engine\r\n\r\nDBSession = sessionmaker(bind=engine)\r\nsession = DBSession()\r\n\r\nresponse = requests.get(\"https://api.github.com/emojis\")\r\nrespon...
false
9,174
f51a21ed71ede4e7462d9c77cb932a5f05b09e71
# import core modules and community packages import sys, math, random import pygame # import configuration settings from src.config import * from src.board.levels import LEVEL_1 # import game elements from src.pucman import Pucman from src.ghast import Ghast from src.board.board import Board class Session(): def...
[ "# import core modules and community packages\nimport sys, math, random\nimport pygame\n\n# import configuration settings\nfrom src.config import *\nfrom src.board.levels import LEVEL_1\n\n# import game elements\nfrom src.pucman import Pucman\nfrom src.ghast import Ghast\nfrom src.board.board import Board\n\nclass ...
false
9,175
33b68246dd3da9561c1d4adb5a3403cba656dcee
from django.conf.urls import url from . import views urlpatterns = [ url(r'^stats/$', views.get_stats, name='stats'), url(r'^follow/me/$', views.follow_me, name='follow_me'), url(r'^follower/confirm/$', views.confirm_follower, name='follower_confirm'), url(r'^execute/', views.execute, name='executed')...
[ "from django.conf.urls import url\n\nfrom . import views\n\nurlpatterns = [\n url(r'^stats/$', views.get_stats, name='stats'),\n url(r'^follow/me/$', views.follow_me, name='follow_me'),\n url(r'^follower/confirm/$', views.confirm_follower, name='follower_confirm'),\n url(r'^execute/', views.execute, nam...
false
9,176
5bfaadcd54aaf239d0d89158bfb723c0174c56b1
import sys from elftools.elf.elffile import ELFFile from capstone import * def process_file(filename): with open(filename, 'rb') as f: elffile = ELFFile(f) code = elffile.get_section_by_name('.text') rodata = elffile.get_section_by_name('.rodata') plt = elffile.get_section_by_name('...
[ "import sys\nfrom elftools.elf.elffile import ELFFile\nfrom capstone import *\n\ndef process_file(filename):\n with open(filename, 'rb') as f:\n elffile = ELFFile(f)\n code = elffile.get_section_by_name('.text')\n rodata = elffile.get_section_by_name('.rodata')\n plt = elffile.get_sec...
true
9,177
2985360c1e2d03c619ea2994c609fdf8c033bebd
#!/usr/bin/env python import rospy import numpy as np import time import RPi.GPIO as GPIO from ccn_raspicar_ros.msg import RaspiCarWheel from ccn_raspicar_ros.msg import RaspiCarWheelControl from ccn_raspicar_ros.srv import RaspiCarMotorControl class MotorControl(object): def __init__(self, control_pin=[16, 18,...
[ "#!/usr/bin/env python\n\nimport rospy\nimport numpy as np\nimport time\nimport RPi.GPIO as GPIO\n\nfrom ccn_raspicar_ros.msg import RaspiCarWheel\nfrom ccn_raspicar_ros.msg import RaspiCarWheelControl\nfrom ccn_raspicar_ros.srv import RaspiCarMotorControl\n\n\nclass MotorControl(object):\n def __init__(self, co...
false
9,178
2bc9c0711831d9ed9009d0f9600153709bbcd6da
''' Created on Sep 4, 2014 @author: Jay <smile665@gmail.com> ''' import socket def ip_validation(ip): ''' check if the ip address is in a valid format. ''' try: socket.inet_aton(ip) return True except socket.error: return False def connection_validation(ip, port): '...
[ "'''\nCreated on Sep 4, 2014\n\n@author: Jay <smile665@gmail.com>\n'''\n\nimport socket\n\n\ndef ip_validation(ip):\n '''\n check if the ip address is in a valid format.\n '''\n try:\n socket.inet_aton(ip)\n return True\n except socket.error:\n return False\n\n\ndef connection_va...
true
9,179
fc8b9029955de6b11cbfe8e24107c687f49685c1
from rest_framework import serializers from .models import Good, Favorite, Comment class GoodSerializer(serializers.ModelSerializer): class Meta: model = Good fields = ('user', 'article', 'created_at') class FavoriteSerializer(serializers.ModelSerializer): class Meta: model = Favori...
[ "from rest_framework import serializers\n\nfrom .models import Good, Favorite, Comment\n\n\nclass GoodSerializer(serializers.ModelSerializer):\n class Meta:\n model = Good\n fields = ('user', 'article', 'created_at')\n\n\nclass FavoriteSerializer(serializers.ModelSerializer):\n class Meta:\n ...
false
9,180
e0fd9663a5635873f4ffc0f73aff5106c0933781
from django import forms from .models import Note class NoteForm(forms.ModelForm): class Meta: model = Note fields = ['title','text'] class NoteFullForm(NoteForm): note_id = forms.IntegerField(required=False) images = forms.FileField(widget=forms.ClearableFileInput(attrs={'multiple': True}...
[ "from django import forms\nfrom .models import Note\n\nclass NoteForm(forms.ModelForm):\n class Meta:\n model = Note\n fields = ['title','text']\n\nclass NoteFullForm(NoteForm):\n note_id = forms.IntegerField(required=False)\n images = forms.FileField(widget=forms.ClearableFileInput(attrs={'m...
false
9,181
a33ddb999f7bb50688b33946046ba460cbbbd172
from backend.personal.models import User, UserState from rest_framework import status from rest_framework.decorators import api_view from rest_framework.response import Response from backend.personal.views import produceRetCode, authenticated from backend.utils.fetch.fetch import fetch_curriculum from backend.univinfo....
[ "from backend.personal.models import User, UserState\nfrom rest_framework import status\nfrom rest_framework.decorators import api_view\nfrom rest_framework.response import Response\nfrom backend.personal.views import produceRetCode, authenticated\nfrom backend.utils.fetch.fetch import fetch_curriculum\nfrom backen...
false
9,182
79e4e37fc17462508abf259e3a7861bd76797280
import unittest import BasicVmLifecycleTestBase class testVmIsAccessibleViaSsh(BasicVmLifecycleTestBase.VmIsAccessibleViaSshTestBase): vmName = 'cernvm' timeout = 20*60 sshTimeout = 5*60 def suite(): return unittest.TestLoader().loadTestsFromTestCase(testVmIsAccessibleViaSsh)
[ "\nimport unittest\n\nimport BasicVmLifecycleTestBase\n\n\nclass testVmIsAccessibleViaSsh(BasicVmLifecycleTestBase.VmIsAccessibleViaSshTestBase):\n vmName = 'cernvm'\n timeout = 20*60\n sshTimeout = 5*60\n\n\ndef suite():\n return unittest.TestLoader().loadTestsFromTestCase(testVmIsAccessibleViaSsh)\n",...
false
9,183
4b773fbf45d15dff27dc7bd51d6636c5f783477b
from pyspark import SparkContext, SparkConf import time # Create a basic configuration conf = SparkConf().setAppName("myTestCopyApp") # Create a SparkContext using the configuration sc = SparkContext(conf=conf) print("START") time.sleep(30) print("END")
[ "\n\nfrom pyspark import SparkContext, SparkConf\nimport time \n\n# Create a basic configuration\nconf = SparkConf().setAppName(\"myTestCopyApp\")\n\n# Create a SparkContext using the configuration\nsc = SparkContext(conf=conf)\n\nprint(\"START\")\n\ntime.sleep(30)\n\nprint(\"END\")\n", "from pyspark import Spark...
false
9,184
a61bc654eecb4e44dce3e62df752f80559a2d055
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2014 Vincent Celis # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the righ...
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright (c) 2014 Vincent Celis\n# \n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limit...
false
9,185
31e5b249516f4e9d57d8fd82713966a69e0516b4
from django.urls import path from .consumers import NotificationsConsumer websocket_urlpatterns = [ path('ws/notifications', NotificationsConsumer), ]
[ "from django.urls import path\n\nfrom .consumers import NotificationsConsumer\n\nwebsocket_urlpatterns = [\n path('ws/notifications', NotificationsConsumer),\n]\n", "from django.urls import path\nfrom .consumers import NotificationsConsumer\nwebsocket_urlpatterns = [path('ws/notifications', NotificationsConsum...
false
9,186
5dc6b54357df87077d8159192cd52697b2616db8
from django.test import TestCase, SimpleTestCase from django.urls import reverse, resolve from .views import profile, order_history """ Url Testing """ class TestUrls(SimpleTestCase): def test_profile_resolves(self): url = reverse('profile') self.assertEqual(resolve(url).func, profile) def t...
[ "from django.test import TestCase, SimpleTestCase\nfrom django.urls import reverse, resolve\nfrom .views import profile, order_history\n\n\"\"\" Url Testing \"\"\"\n\nclass TestUrls(SimpleTestCase):\n\n def test_profile_resolves(self):\n url = reverse('profile')\n self.assertEqual(resolve(url).func...
false
9,187
ee10bca1126b20378c4e9cea4d2dc7ed6a2044ab
from flask import Blueprint, render_template from bashtube import cache singlevideos = Blueprint('singlevideos',__name__,template_folder='templates') @singlevideos.route('/') def index(): return render_template('singlevideos/single.html')
[ "from flask import Blueprint, render_template\n\nfrom bashtube import cache\n\nsinglevideos = Blueprint('singlevideos',__name__,template_folder='templates')\n\n\n@singlevideos.route('/')\n\ndef index():\n return render_template('singlevideos/single.html')\n\n\n", "from flask import Blueprint, render_template\n...
false
9,188
178570047458eb3eeda00f9153ef2159eb4cbef3
from svjesus.ffz import genContent from svjesus.elements.Base import Element class Descriptive(Element): def __init__(self): self.allowedChildren = () # TODO: Check what's allowed # Descriptive elements class Desc(Descriptive): name = "desc" attrs = () class Metadata(Descriptive): name = "metadata" attrs = ()...
[ "from svjesus.ffz import genContent\nfrom svjesus.elements.Base import Element\n\nclass Descriptive(Element):\n\tdef __init__(self):\n\t\tself.allowedChildren = () # TODO: Check what's allowed\n\n# Descriptive elements\nclass Desc(Descriptive):\n\tname = \"desc\"\n\tattrs = ()\n\nclass Metadata(Descriptive):\n\tnam...
false
9,189
8cbe78863de535a5b83eacebe67402569b4015fa
A,B=map(str,input().split()) if(A>B): print(A) elif(B>A): print(B) else: print(AorB)
[ "A,B=map(str,input().split())\nif(A>B):\n\tprint(A)\nelif(B>A):\n\tprint(B)\nelse:\n\tprint(AorB)\n", "A, B = map(str, input().split())\nif A > B:\n print(A)\nelif B > A:\n print(B)\nelse:\n print(AorB)\n", "<assignment token>\nif A > B:\n print(A)\nelif B > A:\n print(B)\nelse:\n print(AorB)\...
false
9,190
7c2897dcb732e75d7328e8c0484d5bd7f3b56e6f
""" Given a string s. Return all the words vertically in the same order in which they appear in s. Words are returned as a list of strings, complete with spaces when is necessary. (Trailing spaces are not allowed). Each word would be put on only one column and that in one column there will...
[ "\"\"\"\r\n Given a string s. Return all the words vertically in the same\r\n order in which they appear in s.\r\n Words are returned as a list of strings, complete with spaces\r\n when is necessary. (Trailing spaces are not allowed).\r\n Each word would be put on only one column and that in one colu...
false
9,191
e85d3660968410b83b14ba610150c0c8cc880119
import datetime # to add timestamps on every block in blockchain import hashlib # library that is ued to hash the block import json # to communicate in json data # Flask to implement webservices jsonify to see the jsop message/response # request help us to connect all the nodes of the blockchain together froming the...
[ "import datetime # to add timestamps on every block in blockchain\nimport hashlib # library that is ued to hash the block\nimport json # to communicate in json data\n# Flask to implement webservices jsonify to see the jsop message/response\n# request help us to connect all the nodes of the blockchain together fr...
false
9,192
d9b405d5159a153fb8d2f1991ceb3dc47f98bcbc
from app.View.view import View class GameController: instance = None @staticmethod def get_instance(): if GameController.instance is None: GameController() return GameController.instance def __init__(self): if GameController.instance is not None: raise...
[ "from app.View.view import View\n\n\nclass GameController:\n instance = None\n\n @staticmethod\n def get_instance():\n if GameController.instance is None:\n GameController()\n return GameController.instance\n\n def __init__(self):\n if GameController.instance is not None:...
false
9,193
845d1251497df61dd2c23241016a049c695ad940
#!/usr/bin/env python3 #coding=utf-8 import sys import os import tool class BrandRegBasic(object): def __init__(self, base_folder, log_instance): if not os.path.exists(base_folder): raise Exception("%s does not exists!" % base_folder) self._real_brand_p = base_folder + "/real_brand.txt...
[ "#!/usr/bin/env python3\n#coding=utf-8\n\nimport sys\nimport os\nimport tool\n\nclass BrandRegBasic(object):\n def __init__(self, base_folder, log_instance):\n if not os.path.exists(base_folder):\n raise Exception(\"%s does not exists!\" % base_folder)\n self._real_brand_p = base_folder ...
false
9,194
32f10c3e73a3d792416f6b2841a80f8b3c390e8c
# Copyright 2023 Sony Group Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
[ "# Copyright 2023 Sony Group Corporation.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable la...
false
9,195
2f0aa1f294f34a4f3ffb47c15ab74fc792765f10
from MultisizerReader import MultiSizerReader import os import matplotlib.pyplot as plt #Get all spread sheet files in fodler and create multisizer files for each folder = "./Data_Organised/DilutionTestingLowOD" allFiles = os.listdir(folder) multiSizerFiles = [allFiles[i] for i in range(len(allFiles)) if allFiles[i].e...
[ "from MultisizerReader import MultiSizerReader\nimport os\nimport matplotlib.pyplot as plt\n\n#Get all spread sheet files in fodler and create multisizer files for each\nfolder = \"./Data_Organised/DilutionTestingLowOD\"\nallFiles = os.listdir(folder)\nmultiSizerFiles = [allFiles[i] for i in range(len(allFiles)) if...
false
9,196
5c908697000247056bb63a443f837eef88b4c957
positivo = float(1.0000001) negativo = float(-1.000001) print(negativo, positivo) b_pos = bin(positivo) b_neg = bin(negativo) print(b_neg, b_pos)
[ "positivo = float(1.0000001)\nnegativo = float(-1.000001)\n\nprint(negativo, positivo)\nb_pos = bin(positivo)\nb_neg = bin(negativo)\n\nprint(b_neg, b_pos)\n\n", "positivo = float(1.0000001)\nnegativo = float(-1.000001)\nprint(negativo, positivo)\nb_pos = bin(positivo)\nb_neg = bin(negativo)\nprint(b_neg, b_pos)\...
false
9,197
3bb50b61c7a3e98ede0a31e574f39b4ea7f22de5
""" corner cases like: word[!?',;.] word[!?',;.]word[!?',;.]word so don't consider the punctuation will only exist after one word, and followed by a whitespace use re for regular expression match, replace or punctuations, and split words """ class Solution: def mostCommonWord(self, paragraph, banned): ...
[ "\"\"\"\ncorner cases like:\n\nword[!?',;.]\nword[!?',;.]word[!?',;.]word\n\n\nso don't consider the punctuation will only exist after one word, and followed by a whitespace\n\nuse re for regular expression match,\nreplace or punctuations, and split words\n\n\"\"\"\n\n\nclass Solution:\n def mostCommonWord(self,...
false
9,198
63c0786d277c5576822d6e521f65850762ab5eb0
"""insta URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based v...
[ "\"\"\"insta URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/2.0/topics/http/urls/\nExamples:\nFunction views\n 1. Add an import: from my_app import views\n 2. Add a URL to urlpatterns: path('', views.home, name='home'...
false
9,199
3c31e3f2a6f320bc5ae33f0ba1d234a089371899
import os, argparse,collections defaults ={'color':'red','user':'guest'} parser=argparse.ArgumentParser() parser.add_argument('-u','--user') parser.add_argument('-c','--color') #a simple Namespace object will be built up from attributes parsed out of the command lin namespace= parser.parse_args() command_line_args= ...
[ "import os, argparse,collections\n\ndefaults ={'color':'red','user':'guest'}\nparser=argparse.ArgumentParser()\nparser.add_argument('-u','--user')\nparser.add_argument('-c','--color')\n\n#a simple Namespace object will be built up from attributes parsed out of the command lin\n\nnamespace= parser.parse_args()\ncomm...
false