index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
400
68f3d3fce52d08381adc522ee032ef3181aec82a
# Generated by Django 2.2.3 on 2019-07-27 10:41 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('beerFriends', '0006_auto_20190726_1504'), ] operations = [ migrations.AlterField( model_name='beer', name='rating', ...
[ "# Generated by Django 2.2.3 on 2019-07-27 10:41\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('beerFriends', '0006_auto_20190726_1504'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='beer',\n ...
false
401
4775bef3623497e9bbe79ca2d4e9e9da0422c450
# # # # ------------------------------------------------------------------------------------------------------------------------------ # # This program have been developed by Hamed Noori and with citiation of the related publicaitons # can be used without permission. # This program is for a novel architecture f...
[ "# \r\n#\r\n#\r\n# ------------------------------------------------------------------------------------------------------------------------------\r\n#\r\n# This program have been developed by Hamed Noori and with citiation of the related publicaitons\r\n# can be used without permission.\r\n# This program is for a n...
false
402
8102bdf4d29d2d3a1bdddbcfb6045b0660693996
import os import time import argparse import cPickle as pickle from definitions import OieFeatures from definitions.OieExample import OieExample class FeatureLexicon: """ A wrapper around various dictionaries storing the mined data. It holds 5 dictionaries in total. Two of them store mappings\n - str ...
[ "import os\nimport time\nimport argparse\nimport cPickle as pickle\nfrom definitions import OieFeatures\nfrom definitions.OieExample import OieExample\n\n\nclass FeatureLexicon:\n \"\"\"\n A wrapper around various dictionaries storing the mined data. It holds 5 dictionaries in total. Two of them store\n ma...
true
403
d82412055affc96d634957c953a35ea69b7e702f
'''Turning on or off, toggling and checking the status' of a specific relay''' #!/bin/env python3 from time import sleep from gpiozero import LED RELAYS = [ LED(23), LED(24), LED(25), LED(8), LED(7), LED(1), LED(12), LED(16) ] def on_action(relay_option, number): '''To turn on t...
[ "'''Turning on or off, toggling and checking the status' of a specific relay'''\n\n#!/bin/env python3\n\nfrom time import sleep\nfrom gpiozero import LED\n\nRELAYS = [\n LED(23),\n LED(24),\n LED(25),\n LED(8),\n LED(7),\n LED(1),\n LED(12),\n LED(16)\n]\n\n\ndef on_action(relay_option, numb...
false
404
862b529741d9c3e6cf7ca50272c8af724c56ac62
from wasserstoff.wasserstoff import Config, Environment __all__ = ['Config', 'Environment']
[ "from wasserstoff.wasserstoff import Config, Environment\n\n__all__ = ['Config', 'Environment']\n", "from wasserstoff.wasserstoff import Config, Environment\n__all__ = ['Config', 'Environment']\n", "<import token>\n__all__ = ['Config', 'Environment']\n", "<import token>\n<assignment token>\n" ]
false
405
6d25b0fedf0d5081a3a0a93ddacc49748464d9d0
# Required python libraries for attack.py import socket import os import sys from termcolor import colored import StringIO import time # need to find Python equivalent libraries for these import stdio import stdlib import unistd # need to find Python equivalent libraries for these import includes import killer impor...
[ "# Required python libraries for attack.py\nimport socket\nimport os\nimport sys\nfrom termcolor import colored\nimport StringIO\nimport time\n\n# need to find Python equivalent libraries for these\n\nimport stdio\nimport stdlib\nimport unistd\n# need to find Python equivalent libraries for these\n\nimport includes...
false
406
e57b30a7a1cf987918abfb3cb7d612bdead2ddcd
from django.db import models # Create your models here. class Airlines(models.Model): flight_number=models.CharField(max_length=8,unique=True) airlines_id=models.CharField(max_length=10) source=models.CharField(max_length=20) destination=models.CharField(max_length=20) departure=models.TimeField() arrival=models...
[ "from django.db import models\n\n# Create your models here.\nclass Airlines(models.Model):\n\tflight_number=models.CharField(max_length=8,unique=True)\n\tairlines_id=models.CharField(max_length=10)\n\tsource=models.CharField(max_length=20)\n\tdestination=models.CharField(max_length=20)\n\tdeparture=models.TimeField...
false
407
2827a56c12c1e15a6fe26ce182aa07d76735d77f
''' MDSANIMA Setup ''' import sys import pathlib from setuptools import setup, find_packages HERE = pathlib.Path(__file__).parent CURRENT_PYTHON = sys.version_info[:2] REQUIRED_PYTHON = (3, 6) # This check and everything above must remain compatible with Python 2.7. if CURRENT_PYTHON < REQUIRED_PYTHON: sys.stde...
[ "'''\nMDSANIMA Setup\n'''\n\nimport sys\nimport pathlib\nfrom setuptools import setup, find_packages\n\nHERE = pathlib.Path(__file__).parent\n\nCURRENT_PYTHON = sys.version_info[:2]\nREQUIRED_PYTHON = (3, 6)\n\n# This check and everything above must remain compatible with Python 2.7.\nif CURRENT_PYTHON < REQUIRED_P...
false
408
d4ac5c6f08e9baa458fbe0ca7aa90c4d9372844f
import h5py import numpy as np #import tracking dt = h5py.special_dtype(vlen=bytes) def stringDataset(group, name, data, system=None): dset = group.create_dataset(name, (1,), dtype=dt, data=data) if system: addSystemAttribute(dset, system) return dset def addStringAttribute(dset_or_group, name, d...
[ "import h5py\nimport numpy as np\n#import tracking\n\ndt = h5py.special_dtype(vlen=bytes)\n\ndef stringDataset(group, name, data, system=None):\n dset = group.create_dataset(name, (1,), dtype=dt, data=data)\n if system:\n addSystemAttribute(dset, system)\n return dset\n\ndef addStringAttribute(dset_...
false
409
4d388c912915c3f1f9e433f1342289f0864b3a11
#/usr/bin/python # File: UdpClient.py # Author: David Zemon # Project: Project1 # # Created with: PyCharm Community Edition """ @description: """ __author__ = 'david' import logging from src.UDP import UDPClient logging.basicConfig(level="DEBUG") serverName = '127.0.0.1' serverPort = 12000 client = UDPClient()...
[ "#/usr/bin/python\n# File: UdpClient.py\n# Author: David Zemon\n# Project: Project1\n#\n# Created with: PyCharm Community Edition\n\n\"\"\"\n@description:\n\"\"\"\n__author__ = 'david'\n\nimport logging\nfrom src.UDP import UDPClient\n\nlogging.basicConfig(level=\"DEBUG\")\n\nserverName = '127.0.0.1'\nserverPor...
false
410
cd5945631a9dd505bf67089bab8c5a37ad375129
import pandas as pd df1 = pd.read_csv("../final/your_no.tsv", '\t') df2 = pd.read_csv("../../Downloads/me.csv", '\t') final = pd.concat([df1, df2]) final.to_csv('../../Downloads/final_con_final.tsv', sep='\t', index=False)
[ "import pandas as pd \ndf1 = pd.read_csv(\"../final/your_no.tsv\", '\\t')\ndf2 = pd.read_csv(\"../../Downloads/me.csv\", '\\t')\nfinal = pd.concat([df1, df2])\nfinal.to_csv('../../Downloads/final_con_final.tsv', sep='\\t', index=False)\n", "import pandas as pd\ndf1 = pd.read_csv('../final/your_no.tsv', '\\t')\ndf...
false
411
16b425d7b8cde1aabe038ccae6922091afb84415
# coding: utf-8 # In[1]: import matplotlib.pyplot as plt import matplotlib import pandas as pd import numpy as np from pandas import DataFrame, Series import os, re # In[2]: OUTPUT_EXCEL = '월별원내약품사용현황.xlsx' # In[3]: # 데이타셋 준비 data_source_dir = '사용량월별통계/원내' dfs = [] for fname in os.listdir(data_source_dir): ...
[ "\n# coding: utf-8\n\n# In[1]:\n\nimport matplotlib.pyplot as plt\nimport matplotlib\nimport pandas as pd\nimport numpy as np\nfrom pandas import DataFrame, Series\nimport os, re\n\n\n# In[2]:\n\nOUTPUT_EXCEL = '월별원내약품사용현황.xlsx'\n\n\n# In[3]:\n\n# 데이타셋 준비\ndata_source_dir = '사용량월별통계/원내'\ndfs = []\nfor fname in os.l...
false
412
0eaaa81d3c8bc61368701e1916b42ede88b90d04
# EXERCISE: # Plotting distributions pairwise (2) # In this exercise, you will generate pairwise joint distributions again. This time, you will make two particular # additions: # - You will display regressions as well as scatter plots in the off-diagonal subplots. You will do this with the # argument kind='reg' (whe...
[ "# EXERCISE:\n\n# Plotting distributions pairwise (2)\n\n# In this exercise, you will generate pairwise joint distributions again. This time, you will make two particular\n# additions:\n\n# - You will display regressions as well as scatter plots in the off-diagonal subplots. You will do this with the\n# argument ki...
false
413
27e9635adf6109f3ab13b9d8dd5809973b61ca03
#Web Scraping #Make sure you have bs4, webbrowser and request installed as your third party modules import bs4, webbrowser, requests try: data = requests.get("http://en.wikipedia.org/wiki/Python") data.raise_for_status() my_data = bs4.BeautifulSoup(data.text, "lxml") print("List o...
[ "#Web Scraping\r\n#Make sure you have bs4, webbrowser and request installed as your third party modules\r\n\r\nimport bs4, webbrowser, requests\r\n\r\ntry:\r\n data = requests.get(\"http://en.wikipedia.org/wiki/Python\")\r\n data.raise_for_status()\r\n \r\n my_data = bs4.BeautifulSoup(data.text, \"lxml\...
false
414
f5f26819be4b98fab3d46e57e1a5431e54342aed
# coding: utf-8 """Supporting model logic for predicting emotional content of user input. """ import pandas as pd import gensim from sklearn.model_selection import train_test_split from sklearn.multiclass import OneVsRestClassifier from sklearn.svm import LinearSVC #load data for emo2vec loc = 'https://s3-us-west-1.a...
[ "\n# coding: utf-8\n\"\"\"Supporting model logic for predicting emotional content of user input.\n\"\"\"\nimport pandas as pd\nimport gensim\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.multiclass import OneVsRestClassifier\nfrom sklearn.svm import LinearSVC\n\n#load data for emo2vec\nloc = '...
false
415
d2e46944ab05c5e8c1979101728b7b25900be342
import pytest from time import sleep from timeflux.helpers.background import Task class DummyWorker(): def echo(self, message='hello', delay=0, fail=False): sleep(delay) if fail: raise Exception('failed') self.message = message return(self.message) def test_default(working_path): ...
[ "import pytest\nfrom time import sleep\nfrom timeflux.helpers.background import Task\n\nclass DummyWorker():\n def echo(self, message='hello', delay=0, fail=False):\n sleep(delay)\n if fail: raise Exception('failed')\n self.message = message\n return(self.message)\n\ndef test_default(...
false
416
b2f2f1e4b7070ac867b71e538f759e527eb1ffb9
from pymouse import PyMouse m = PyMouse() w,h = m.screen_size() class base_controller: def __init__(self): pass def move(self,xy:list): ''' 移动 ''' m.move(xy[0]*w,xy[1]*h) def click(self, xy:list): ''' 点击 ''' m.click(xy[0]*w,xy...
[ "from pymouse import PyMouse\nm = PyMouse()\nw,h = m.screen_size()\n\nclass base_controller:\n def __init__(self):\n pass\n\n def move(self,xy:list):\n '''\n 移动\n '''\n m.move(xy[0]*w,xy[1]*h)\n \n def click(self, xy:list):\n '''\n 点击\n '''\n ...
false
417
ec9efeca7eef7b8ee25c1e089e675bdb1e53413b
# -*- coding:utf-8 -*- # Author: washing # DateTime: 2022/5/18 10:28 # File: 0668.py # Desc: CV class Solution: def findKthNumber(self, m: int, n: int, k: int) -> int: return bisect_left(range(m * n), k, key=lambda x: x // n * n + sum(x // i for i in range(x // n + 1, m + 1)))
[ "# -*- coding:utf-8 -*-\r\n# Author: washing\r\n# DateTime: 2022/5/18 10:28\r\n# File: 0668.py\r\n# Desc: CV\r\n\r\nclass Solution:\r\n def findKthNumber(self, m: int, n: int, k: int) -> int:\r\n return bisect_left(range(m * n), k, key=lambda x: x // n * n + sum(x // i for i in range(x // n + 1, m + 1)))\...
false
418
13342922022f0a0e8928c81c1c4716125af0b2c4
import matplotlib.pyplot as plt import numpy as np plt.rcParams['savefig.dpi'] = 300 #图片像素 plt.rcParams['figure.dpi'] = 300 #分辨率 plt.rcParams['font.sans-serif']=['SimHei'] plt.rcParams['axes.unicode_minus'] = False x_axis = [20,40,60,80,100] rf = [184,174,166,159,157.5] anns = [186,179,170,164,161] adaboost = [187.5,1...
[ "import matplotlib.pyplot as plt\nimport numpy as np\nplt.rcParams['savefig.dpi'] = 300 #图片像素\nplt.rcParams['figure.dpi'] = 300 #分辨率\nplt.rcParams['font.sans-serif']=['SimHei']\nplt.rcParams['axes.unicode_minus'] = False\nx_axis = [20,40,60,80,100]\n\nrf = [184,174,166,159,157.5]\nanns = [186,179,170,164,161]\nadab...
false
419
cb08b95e3b9c80fb74d4415b3798ddbb36cd76e7
import unittest """ Find the largest 0 to 9 pandigital that can be formed by concatenating products Take the number 6 and multiply it by each of 1273 and 9854: 6 × 1273 = 7638 6 × 9854 = 59124 By concatenating these products we get the 1 to 9 pandigital 763859124. We will call 763859124 the "concatenated product of ...
[ "import unittest\n\n\"\"\"\nFind the largest 0 to 9 pandigital that can be formed by concatenating products\n\nTake the number 6 and multiply it by each of 1273 and 9854:\n6 × 1273 = 7638\n6 × 9854 = 59124\nBy concatenating these products we get the 1 to 9 pandigital 763859124. We will call 763859124 the \"concate...
false
420
63a40282f16a7f27c118594f1a9468749682594f
import requests import os from jpmesh import parse_mesh_code from tqdm import tqdm url_login='https://platform.openquake.org/account/login/' client = requests.session() client.get(url_login) # Identification for openquake platform login_data = {'username':'###','password':'###'} r1=client.post(url_login,data=login_dat...
[ "import requests\nimport os\nfrom jpmesh import parse_mesh_code\nfrom tqdm import tqdm\n\nurl_login='https://platform.openquake.org/account/login/'\nclient = requests.session()\nclient.get(url_login)\n# Identification for openquake platform\nlogin_data = {'username':'###','password':'###'}\nr1=client.post(url_login...
true
421
e695b9458c0e98521e560dbb291f6f05bda1549f
from savers.saver import SaverInterface import os from config import SaverConfig import mysql.connector import json import logging class SQLSaver(SaverInterface): # This class takes in json files and will interpret the jsons as follows. # {'tablename':[{'columnname01':'somevalue','columnname02':'somevalue'},{'columnana...
[ "from savers.saver import SaverInterface\nimport os\nfrom config import SaverConfig\nimport mysql.connector\nimport json\nimport logging\nclass SQLSaver(SaverInterface):\n# This class takes in json files and will interpret the jsons as follows.\n# {'tablename':[{'columnname01':'somevalue','columnname02':'somevalue'...
false
422
c55991e738c89ee09dabd79d514e710e0fcbac85
from splinter import Browser from time import sleep from datetime import datetime, timedelta import os, sys import urllib import cv2 import numpy as np from PIL import Image import imutils import csv class Scraper(): start_date = datetime(2018, 1, 8) url = 'http://spaceweather.com/' def scrape(self): ...
[ "from splinter import Browser\nfrom time import sleep\nfrom datetime import datetime, timedelta\nimport os, sys\nimport urllib\nimport cv2\nimport numpy as np\nfrom PIL import Image\nimport imutils\nimport csv\n\nclass Scraper():\n start_date = datetime(2018, 1, 8)\n url = 'http://spaceweather.com/'\n\n de...
false
423
b767519229058b50183d78bb97121f050e5b6bad
# defining private variables class Privacy: def __init__(self, val): self.__val = 900; print("Private data member =",self.__val,"\n") value = Privacy(800); print("Value not changable\n") value.__val;
[ "# defining private variables\r\nclass Privacy:\r\n def __init__(self, val):\r\n self.__val = 900; \r\n print(\"Private data member =\",self.__val,\"\\n\")\r\nvalue = Privacy(800);\r\nprint(\"Value not changable\\n\")\r\nvalue.__val;\r\n", "class Privacy:\n\n def __init__(self, val):\n ...
false
424
b679444fde7cd8eb819443922f37ee54c0f29de4
from pirates.teleport.AreaTeleportActor import AreaTeleportActor class DoorTeleportActor(AreaTeleportActor): pass
[ "from pirates.teleport.AreaTeleportActor import AreaTeleportActor\n\nclass DoorTeleportActor(AreaTeleportActor):\n pass\n", "from pirates.teleport.AreaTeleportActor import AreaTeleportActor\n\n\nclass DoorTeleportActor(AreaTeleportActor):\n pass\n", "<import token>\n\n\nclass DoorTeleportActor(AreaTelepor...
false
425
f714c7006f50379cc7508a13d710d902d38d2d1f
import torch import torch.nn as nn import torch.nn.functional as F # Const. low-rank version class xCNNlow(torch.nn.Module): def __init__(self, channels, filters, kernel_size, padding=0, stride=1, groups=1, rank=1, bias=True): super(xCNNlow, self).__init__() self.filters = filters self.time...
[ "import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\n\n# Const. low-rank version\nclass xCNNlow(torch.nn.Module):\n def __init__(self, channels, filters, kernel_size, padding=0, stride=1, groups=1, rank=1, bias=True):\n super(xCNNlow, self).__init__()\n self.filters = filters\n ...
false
426
726f133bcf592315c42f8701be8308422ffbf0d9
from flask import Flask, render_template from flask_ask import Ask, statement, question, session import reverse_geocoder as rg from geopy import distance from geopy.geocoders import Nominatim import requests import time ''' :::::::: ::::::::: ::: :::::::: :::::::::: ::: ::: ::: ::: ...
[ "\nfrom flask import Flask, render_template\nfrom flask_ask import Ask, statement, question, session\nimport reverse_geocoder as rg\nfrom geopy import distance\nfrom geopy.geocoders import Nominatim\nimport requests\nimport time\n\n\n'''\n :::::::: ::::::::: ::: :::::::: :::::::::: ::: ::: ...
false
427
cae49da8dd436fc51b472c4a88703d8bc6c79bda
import SCons.Util import xml.dom.minidom, re, os.path ################################################################################ # DocBook pseudobuilder # TODO: Only generate the output formats that are known ################################################################################ def generate(env) : ...
[ "import SCons.Util\nimport xml.dom.minidom, re, os.path\n\n################################################################################\n# DocBook pseudobuilder\n# TODO: Only generate the output formats that are known\n################################################################################\n\ndef gener...
false
428
c139cbc3e693d75ad196e10257ff3028aa835709
# Complete the hurdleRace function below. def hurdleRace(k, height): if k < max(height): return max(height) - k return 0 print(hurdleRace(2, [2,5,4,5,2]))
[ "# Complete the hurdleRace function below.\ndef hurdleRace(k, height):\n if k < max(height):\n return max(height) - k\n return 0\n\nprint(hurdleRace(2, [2,5,4,5,2]))\n", "def hurdleRace(k, height):\n if k < max(height):\n return max(height) - k\n return 0\n\n\nprint(hurdleRace(2, [2, 5, ...
false
429
77971b088a7e076e3bf6d7aa320981a50e7756ce
from flask import Flask from flask_ask import Ask, statement, question, session # import json, requests import random app = Flask(__name__) ask = Ask(app, "/") def get_cat_fact(): myFacts = [ "Cats should not be fed tuna exclusively, as it lacks taurine, an essential nutrient required for good feline hea...
[ "from flask import Flask\nfrom flask_ask import Ask, statement, question, session\n# import json, requests\nimport random\n\n\napp = Flask(__name__)\nask = Ask(app, \"/\")\n\ndef get_cat_fact():\n myFacts = [\n \"Cats should not be fed tuna exclusively, as it lacks taurine, an essential nutrient required ...
false
430
124d7da330aa7c869320e10f4f89cc1c872f85f2
import matplotlib.pyplot as plt import sys sys.path.append('coin_flipping_src') from monte_carlo import monte_carlo from probability import probability plt.style.use('bmh') x_coords = range(10) probablility_results = [probability(x,10) for x in x_coords] plt.plot(x_coords,probablility_results,linewidth = 2.5) # plt.plo...
[ "import matplotlib.pyplot as plt\nimport sys\nsys.path.append('coin_flipping_src')\nfrom monte_carlo import monte_carlo\nfrom probability import probability\nplt.style.use('bmh')\nx_coords = range(10)\nprobablility_results = [probability(x,10) for x in x_coords]\nplt.plot(x_coords,probablility_results,linewidth = 2...
false
431
502da0f0dafe42d3464fabb1d92ae1b0d7ef11f3
# Check given matrix is valid sudoku or Not.
[ "# Check given matrix is valid sudoku or Not.\n", "" ]
false
432
4e31c2a80bec77a1f5aafc8a91617fb4b2941788
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Author: André Pacheco E-mail: pacheco.comp@gmail.com This file implements the methods and functions to load the image as a PyTorch dataset If you find any bug or have some suggestion, please, email me. """ from PIL import Image from torch.utils import data import t...
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\"\"\"\nAuthor: André Pacheco\nE-mail: pacheco.comp@gmail.com\n\nThis file implements the methods and functions to load the image as a PyTorch dataset\n\nIf you find any bug or have some suggestion, please, email me.\n\"\"\"\n\nfrom PIL import Image\nfrom torch.ut...
false
433
6454790c98b254edeead4e68ef7f5760c9105a57
#!/usr/bin/python # # Dividend! # import os import sys import urllib2 import math import numpy from pylab import * # # Dividend adjusted! ...
[ "#!/usr/bin/python\n#\n# Dividend!\n#\n\nimport os\nimport sys\nimport urllib2\nimport math\nimport numpy\nfrom pylab import *\n\n# \n# Dividend adjusted! ...
true
434
75133dd924f8f3f028075c5d2109bb79ddc7fe87
import pymysql def testeSelect(db): #创建查询游标 cur1 = db.cursor() # 使用 execute() 方法执行 SQL 查询 cur1.execute("SELECT VERSION()") # 使用 fetchone() 方法获取单条数据. data = cur1.fetchone() print(dir(data)) print ("cur1 : %s " % cur1) print ("Database version : %s " % data) def dropTable(db): #创建查询游标 cur1 = db.curs...
[ "import pymysql\n\n\n\ndef testeSelect(db):\n\t#创建查询游标\n\tcur1 = db.cursor()\n\n\t# 使用 execute() 方法执行 SQL 查询 \n\tcur1.execute(\"SELECT VERSION()\")\n\t \n\t# 使用 fetchone() 方法获取单条数据.\n\tdata = cur1.fetchone()\n\tprint(dir(data))\n\tprint (\"cur1 : %s \" % cur1) \n\tprint (\"Database version : %s \" % data)\n\ndef d...
false
435
fcc73647a5e841bcb5ea4fcd06579cc6912cfe1e
#!/usr/bin/env python import os import re import pycolor import sys pyc = pycolor.pyColor() def decompile(mainapk): print pyc.Info("Decompiling apks...") os.system("bash apktool.sh d -f %s"%mainapk) os.system("bash apktool.sh d -f temp.apk") def inject(mainapk): print pyc.Info("Injecting payload...") mk = "mkd...
[ "#!/usr/bin/env python\n\nimport os\nimport re\nimport pycolor\nimport sys\n\npyc = pycolor.pyColor()\n\ndef decompile(mainapk):\n\tprint pyc.Info(\"Decompiling apks...\")\n\tos.system(\"bash apktool.sh d -f %s\"%mainapk)\n\tos.system(\"bash apktool.sh d -f temp.apk\")\n\ndef inject(mainapk):\n\tprint pyc.Info(\"In...
true
436
de347b41cd88947690cb42e043880a80d81e2c5c
# Generated by Django 3.2.7 on 2021-09-11 19:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('cryptocurrency', '0012_rename_cancel_exists_order_cancel_exist'), ] operations = [ migrations.AlterField( model_name='order', ...
[ "# Generated by Django 3.2.7 on 2021-09-11 19:38\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('cryptocurrency', '0012_rename_cancel_exists_order_cancel_exist'),\n ]\n\n operations = [\n migrations.AlterField(\n mode...
false
437
c26bdc3f47aa9ac0cda0334e97bdaf3f9d56eb6c
import re import os import base64 os.popen("tshark -r log.pcap -d 'tcp.port==57000,http' -d 'tcp.port==44322,http' -d 'tcp.port==44818,http' -Y 'data-text-lines' -Tfields -e http.file_data > request") def evals(text): template = "{}\['__doc__'\]\[\d+\]" keys = map(str, range(10)) keys += ['\[\]','\(\)',"'...
[ "import re\nimport os\nimport base64\n\nos.popen(\"tshark -r log.pcap -d 'tcp.port==57000,http' -d 'tcp.port==44322,http' -d 'tcp.port==44818,http' -Y 'data-text-lines' -Tfields -e http.file_data > request\")\n\ndef evals(text):\n template = \"{}\\['__doc__'\\]\\[\\d+\\]\"\n keys = map(str, range(10))\n ke...
true
438
8e85740123467889bdeb6b27d5eaa4b39df280ed
from .celery import app from home.models import Banner from settings.const import BANNER_COUNT from home.serializers import BannerModelSerializer from django.core.cache import cache from django.conf import settings @app.task def update_banner_list(): # 获取最新内容 banner_query = Banner.objects.filter(is_delete=Fals...
[ "from .celery import app\n\nfrom home.models import Banner\nfrom settings.const import BANNER_COUNT\nfrom home.serializers import BannerModelSerializer\nfrom django.core.cache import cache\nfrom django.conf import settings\n@app.task\ndef update_banner_list():\n # 获取最新内容\n banner_query = Banner.objects.filter...
false
439
a2421a8673a524c32539555596711a71a8e00dbf
import os import argparse import torch import model.model as module_arch from utils.util import remove_weight_norms from train import get_instance from librosa import load from librosa.output import write_wav from time import time def main(config, resume, infile, outfile, sigma, dur, half): # build model architec...
[ "import os\nimport argparse\nimport torch\nimport model.model as module_arch\nfrom utils.util import remove_weight_norms\nfrom train import get_instance\nfrom librosa import load\nfrom librosa.output import write_wav\nfrom time import time\n\n\ndef main(config, resume, infile, outfile, sigma, dur, half):\n # bui...
false
440
23a560c5f5553fc32329121ea47f8a7ae1196889
import requests import time while 1: r = requests.put("http://localhost:3000/api/4", data={"temperature": 24, "led": 1}) print r.text time.sleep(1)
[ "import requests\nimport time\n\nwhile 1:\n r = requests.put(\"http://localhost:3000/api/4\", data={\"temperature\": 24, \"led\": 1})\n print r.text\n time.sleep(1)" ]
true
441
6154979cd2853dd2bd26d1ae5df7365efa0141c2
from sqlalchemy import Column, MetaData, Table, BigInteger, String, DateTime, Integer from migrate import * meta = MetaData() table = Table( 'accesses', meta, Column('id', BigInteger, primary_key=True, nullable=False), Column('uuid', String(255), nullable=False), Column('created_at', DateTime), ) def...
[ "from sqlalchemy import Column, MetaData, Table, BigInteger, String, DateTime, Integer\nfrom migrate import *\n\nmeta = MetaData()\ntable = Table(\n 'accesses', meta,\n Column('id', BigInteger, primary_key=True, nullable=False),\n Column('uuid', String(255), nullable=False),\n Column('created_at', DateT...
false
442
813354c9c294c0323c1b54cda7074fbffa49cdb3
from django.utils import timezone from factory import DjangoModelFactory from djtriggers.tests.models import DummyTrigger class DummyTriggerFactory(DjangoModelFactory): class Meta: model = DummyTrigger trigger_type = 'dummy_trigger_test' source = 'tests' date_received = timezone.now() da...
[ "from django.utils import timezone\nfrom factory import DjangoModelFactory\n\nfrom djtriggers.tests.models import DummyTrigger\n\n\nclass DummyTriggerFactory(DjangoModelFactory):\n class Meta:\n model = DummyTrigger\n\n trigger_type = 'dummy_trigger_test'\n source = 'tests'\n date_received = time...
false
443
aebc918d6a1d1d2473f74d77b8a915ac25548e3a
import cachetools cache = cachetools.LRUCache(maxsize = 3) cache['PyCon'] = 'India' cache['year'] = '2017' print("Older: " + cache['year']) cache['year'] = '2018' print("Newer: " + cache['year']) print(cache) cache['sdate'] = '05/09/2018' print(cache) cache['edate'] = '09/09/2018' print(cache)
[ "import cachetools\n\ncache = cachetools.LRUCache(maxsize = 3)\ncache['PyCon'] = 'India'\ncache['year'] = '2017'\nprint(\"Older: \" + cache['year'])\n\ncache['year'] = '2018'\nprint(\"Newer: \" + cache['year'])\nprint(cache)\n\ncache['sdate'] = '05/09/2018'\nprint(cache)\n\ncache['edate'] = '09/09/2018'\nprint(cach...
false
444
d7ce6efa72c9b65d3dd3ce90f9d1f2dd8a889d26
''' syntax of if-elif-else if <condition> : code to be executed in this condition elif <new condition> : cdode tbd some code else : code runs in the else condigtion this can all be multiline code ''' a = 3 b = 2 if a == b : print "Values are equal" elif a < b : print "a is less than b" else: print "b...
[ "\n'''\nsyntax of if-elif-else\n\nif <condition> :\n\tcode to be\n\texecuted in\n\tthis condition\nelif <new condition> :\n\tcdode tbd\n\tsome code\nelse :\n\tcode runs in the else condigtion\n\tthis can all be multiline code\n\n'''\n\n\n\n\na = 3\nb = 2\n\n\nif a == b :\n\tprint \"Values are equal\"\nelif a < b :\...
true
445
cd234911c1f990b8029dfa792d132847bf39a6aa
import math def vol_shell(r1, r2): a=abs((4/3)*math.pi*((r1**3)-(r2**3))) return round(a,3) print(vol_shell(3,3))
[ "\nimport math\ndef vol_shell(r1, r2):\n a=abs((4/3)*math.pi*((r1**3)-(r2**3)))\n return round(a,3)\nprint(vol_shell(3,3))\n\n", "import math\n\n\ndef vol_shell(r1, r2):\n a = abs(4 / 3 * math.pi * (r1 ** 3 - r2 ** 3))\n return round(a, 3)\n\n\nprint(vol_shell(3, 3))\n", "<import token>\n\n\ndef v...
false
446
7b5713c9a5afa911df1c2939751de30412162f15
from collections import OrderedDict import copy import numpy as np from scipy.optimize import curve_fit from ... import Operation as opmod from ...Operation import Operation from ....tools import saxstools class SpectrumFit(Operation): """ Use a measured SAXS spectrum (I(q) vs. q), to optimize the param...
[ "from collections import OrderedDict\nimport copy\n\nimport numpy as np\nfrom scipy.optimize import curve_fit\n\nfrom ... import Operation as opmod \nfrom ...Operation import Operation\nfrom ....tools import saxstools\n\nclass SpectrumFit(Operation):\n \"\"\"\n Use a measured SAXS spectrum (I(q) vs. q),\n ...
false
447
595912753d778a0fa8332f0df00e06a9da5cde93
################################################################################ # # # This file is part of the Potato Engine (PE). # # ...
[ "################################################################################\r\n# #\r\n# This file is part of the Potato Engine (PE). #\r\n# ...
false
448
3b42e218acf1c93fab3a0893efa8bf32a274eb23
# Generated by Django 2.2.6 on 2019-11-13 13:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('interface', '0010_auto_20191104_2107'), ] operations = [ migrations.AlterField( model_name='submission', name='revie...
[ "# Generated by Django 2.2.6 on 2019-11-13 13:11\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('interface', '0010_auto_20191104_2107'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='submission',\n ...
false
449
13b69ec61d6b2129f1974ce7cae91c84100b3b58
import tensorflow.keras from PIL import Image, ImageOps from os import listdir from os.path import isfile, join import numpy as np import glob import cv2 np.set_printoptions(suppress = True) # Load the model model = tensorflow.keras.models.load_model('./converted_keras/keras_model.h5') # Create the array of the righ...
[ "import tensorflow.keras\nfrom PIL import Image, ImageOps\nfrom os import listdir\nfrom os.path import isfile, join\nimport numpy as np\nimport glob\nimport cv2\n\nnp.set_printoptions(suppress = True)\n\n# Load the model\nmodel = tensorflow.keras.models.load_model('./converted_keras/keras_model.h5')\n\n# Create the...
false
450
68d537cb8488ae4f2c8300e885be78540952dec0
#!/usr/bin/env python2 # coding=utf8 from __future__ import absolute_import, division, print_function from sqlalchemy import func from walis.model.walis import walis_session from walis.model.zeus import zeus_session, zeus_db_handler from walis.model.zeus.activity import ( SubsidyProcessRecord, SubsidyPayReco...
[ "#!/usr/bin/env python2\n# coding=utf8\n\nfrom __future__ import absolute_import, division, print_function\n\nfrom sqlalchemy import func\n\nfrom walis.model.walis import walis_session\nfrom walis.model.zeus import zeus_session, zeus_db_handler\nfrom walis.model.zeus.activity import (\n SubsidyProcessRecord,\n ...
false
451
a32fb683f8d46f901e8dcd2d075ace22ee81e076
import base64 import string def hexStringtoBytes(hexstring): byteArray = bytes.fromhex(hexstring) return byteArray def xorBytes(bytes1, bytes2): xored = bytes([x^bytes2[i] for i,x in enumerate(bytes1)]) return xored def xorAgainstCharacter(byteArray, character): str2 = [ord(character)] ...
[ "import base64\r\nimport string\r\ndef hexStringtoBytes(hexstring):\r\n byteArray = bytes.fromhex(hexstring)\r\n return byteArray\r\n\r\ndef xorBytes(bytes1, bytes2):\r\n xored = bytes([x^bytes2[i] for i,x in enumerate(bytes1)])\r\n return xored\r\n\r\ndef xorAgainstCharacter(byteArray, character):\r\n ...
false
452
b9c058bdb04df93beb379d05939b00f4db423cd3
import string import random import os from threading import Thread class Process(Thread): def __init__(self): Thread.__init__(self) def run(self): while True: prenom = id_generator(random.randint(4, 8)) nom = id_generator(random.randint(4, 8)) password = id_...
[ "import string\nimport random\nimport os\nfrom threading import Thread\n\nclass Process(Thread):\n def __init__(self):\n Thread.__init__(self)\n\n def run(self):\n while True:\n prenom = id_generator(random.randint(4, 8))\n nom = id_generator(random.randint(4, 8))\n ...
true
453
9b581df505765e895047584c5bb586faef95295f
import dash import dash_core_components as dcc import dash_html_components as html import dash_table as dt import plotly.express as px import pandas as pd import plotly.graph_objects as go import numpy as np from datetime import datetime as dat from sklearn.model_selection import train_test_split from sklearn...
[ "import dash\r\nimport dash_core_components as dcc\r\nimport dash_html_components as html\r\nimport dash_table as dt\r\nimport plotly.express as px\r\nimport pandas as pd\r\nimport plotly.graph_objects as go\r\nimport numpy as np\r\nfrom datetime import datetime as dat\r\nfrom sklearn.model_selection import train_t...
false
454
fdcee5b3f6b3ec170c9ef3017e0cc6c4b28cf22d
from django.contrib import admin from .models import Advert, Category, ImageAd @admin.register(Advert) class AdminAdvert(admin.ModelAdmin): filter_horizontal = "categories", @admin.register(Category) class AdminCategory(admin.ModelAdmin): pass @admin.register(ImageAd) class AdminImageAd(admin.ModelAdmin)...
[ "from django.contrib import admin\nfrom .models import Advert, Category, ImageAd\n\n\n@admin.register(Advert)\nclass AdminAdvert(admin.ModelAdmin):\n filter_horizontal = \"categories\",\n\n\n\n@admin.register(Category)\nclass AdminCategory(admin.ModelAdmin):\n pass\n\n\n@admin.register(ImageAd)\nclass AdminIm...
false
455
ae5f87f1c383478ea5f370af1c85d63a472a7788
#Array In Python from array import array numbers = array("i",[1,2,3]) numbers[0] = 0 print(list(numbers))
[ "#Array In Python\n\nfrom array import array\n\nnumbers = array(\"i\",[1,2,3])\nnumbers[0] = 0\nprint(list(numbers))\n", "from array import array\nnumbers = array('i', [1, 2, 3])\nnumbers[0] = 0\nprint(list(numbers))\n", "<import token>\nnumbers = array('i', [1, 2, 3])\nnumbers[0] = 0\nprint(list(numbers))\n", ...
false
456
9c05b39a12ab29db99397e62315efddd8cdf1df4
dict1 = [ {'a':1}, {'a':2}, {'a':3} ] a = dict1[1]['a'] # print(a) correlation_dict = {'${class_id}':123} data = {'token': '${self.token}', 'name': 'api测试','class_id': '${class_id}'} for k in data: for key in correlation_dict: if data[k] in key: data[k] = correlation_dict[key] pr...
[ "dict1 = [\n {'a':1},\n {'a':2},\n {'a':3}\n]\n\na = dict1[1]['a']\n# print(a)\n\ncorrelation_dict = {'${class_id}':123}\n\ndata = {'token': '${self.token}', 'name': 'api测试','class_id': '${class_id}'}\n\nfor k in data:\n for key in correlation_dict:\n if data[k] in key:\n data[k] = cor...
false
457
2467825d2cb01c86d3ba27562decc12551877af1
""" Script: coverage.py Identifies domains that only occur in multi-domain proteins. The main script is master. -------------------- Felix A Kruger momo.sander@ebi.ac.uk """ #### #### import modules. #### import queryDevice import operator import yaml import time #### #### Load parameters. ####...
[ "\"\"\"\n Script: coverage.py\n Identifies domains that only occur in multi-domain proteins. The main\n script is master.\n --------------------\n Felix A Kruger\n momo.sander@ebi.ac.uk\n\"\"\"\n####\n#### import modules.\n####\nimport queryDevice\nimport operator\nimport yaml\nimport time\n####\...
true
458
51af54c55834c4bdb8e1cbe4ac55b86bdc61bf4d
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.utils.timezone import utc import datetime class Migration(migrations.Migration): dependencies = [ ('notesapp', '0008_auto_20150819_1222'), ] operations = [ migrations.Ren...
[ "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\nfrom django.utils.timezone import utc\nimport datetime\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('notesapp', '0008_auto_20150819_1222'),\n ]\n\n operations = [\n ...
false
459
a8b1b218e6649545000803c91c803580cfdbd4f1
import random # Imports MongoClient for base level access to the local MongoDB from pymongo import MongoClient # Imports datetime class to create timestamp for weather data storage from datetime import datetime # Importing DailyReportModel class to use the implemented method to insert data into daily_report_model ...
[ "import random\r\n# Imports MongoClient for base level access to the local MongoDB\r\nfrom pymongo import MongoClient\r\n# Imports datetime class to create timestamp for weather data storage\r\nfrom datetime import datetime\r\n# Importing DailyReportModel class to use the implemented method to insert data into dail...
false
460
8cd582915c5abd96a4ef8a3a5309311f2a73a156
with open("file.txt", 'r') as fh: data = fh.readline() lis= data.split(' ') my_dict={} for key in lis: if key in my_dict.keys(): my_dict[key] += 1 else: my_dict[key] = 1 print(my_dict)
[ "\n\nwith open(\"file.txt\", 'r') as fh:\n data = fh.readline()\n\nlis= data.split(' ')\nmy_dict={}\n\nfor key in lis:\n if key in my_dict.keys():\n my_dict[key] += 1\n else:\n my_dict[key] = 1\n\nprint(my_dict)\n", "with open('file.txt', 'r') as fh:\n data = fh.readline()\nlis = data.sp...
false
461
f55b286448f114f3823f099a576af7bec1780a8c
# -*- coding: utf-8 -*- try: from greenlet import getcurrent as get_current_greenlet except ImportError: get_current_greenlet = int from thread import get_ident as get_current_thread from threading import Lock if get_current_greenlet is int: # Use thread get_ident = get_current_thread else: # Use gree...
[ "# -*- coding: utf-8 -*-\ntry:\n from greenlet import getcurrent as get_current_greenlet\nexcept ImportError:\n get_current_greenlet = int\n\nfrom thread import get_ident as get_current_thread\nfrom threading import Lock\n\n\nif get_current_greenlet is int: # Use thread\n get_ident = get_current_thread\ne...
false
462
e864dad3f46fc9c6c472823bd06ce74fb5cb3f41
#!/usr/bin/env python import rospy import cv2 import numpy as np from cv_bridge import CvBridge from matplotlib import pyplot as plt from sensor_msgs.msg import Image from drone_app_msgs.msg import BBox, Drone, DroneArray from rospy.numpy_msg import numpy_msg # --------------------------------------- # This is an impl...
[ "#!/usr/bin/env python\nimport rospy\nimport cv2\nimport numpy as np\nfrom cv_bridge import CvBridge\nfrom matplotlib import pyplot as plt\nfrom sensor_msgs.msg import Image\nfrom drone_app_msgs.msg import BBox, Drone, DroneArray\nfrom rospy.numpy_msg import numpy_msg\n\n# ---------------------------------------\n#...
false
463
f3a63a22f8746d4a1f127bfe9e8c9d822109ab3c
import logging import os import textwrap from urllib.request import urlopen from bs4 import BeautifulSoup from tqdm import tqdm from doc_curation import book_data from doc_curation.md import get_md_with_pandoc from doc_curation.md.file import MdFile from doc_curation.scraping.misc_sites import iitk from doc_curation....
[ "import logging\nimport os\nimport textwrap\nfrom urllib.request import urlopen\n\nfrom bs4 import BeautifulSoup\nfrom tqdm import tqdm\n\nfrom doc_curation import book_data\nfrom doc_curation.md import get_md_with_pandoc\nfrom doc_curation.md.file import MdFile\nfrom doc_curation.scraping.misc_sites import iitk\nf...
false
464
90bb70b0a97c7872c8581a176ebacc50df8e1f72
import datetime def year_choices(): return [(r,r) for r in range(1984, datetime.date.today().year + 1)] def current_year(): return datetime.date.today().year
[ "import datetime\n\n\ndef year_choices():\n return [(r,r) for r in range(1984, datetime.date.today().year + 1)]\n\n\ndef current_year():\n return datetime.date.today().year\n", "import datetime\n\n\ndef year_choices():\n return [(r, r) for r in range(1984, datetime.date.today().year + 1)]\n\n\ndef curren...
false
465
d1b2420778e788d78be2a12a27c80f5fa1b15a0f
import functools import re from pprint import pprint def heading(*, marker=''): ''' Add a new line with the same number of heading markers as the characters in the title Need to specify marker to one of the valid rst line markups ''' def wrapper_heading(func): @functools.wraps(func) ...
[ "import functools\nimport re\nfrom pprint import pprint\n\ndef heading(*, marker=''):\n '''\n Add a new line with the same number of heading markers as the characters in the title\n Need to specify marker to one of the valid rst line markups\n '''\n def wrapper_heading(func):\n @functools.wrap...
false
466
29bee4ef11281380aa05d22ef54cb76502ecd685
from enum import Enum class CellState(Enum): EMPTY = 1 DEAD = 2 ALIVE = 3 WAS_ALIVE = 4 def __str__(self): default_str = super(CellState, self).__str__() if default_str == "CellState.EMPTY": return "E" elif default_str == "CellState.DEAD": return "D" elif default_str...
[ "from enum import Enum\n\nclass CellState(Enum):\n EMPTY = 1\n DEAD = 2\n ALIVE = 3\n WAS_ALIVE = 4\n\n def __str__(self):\n default_str = super(CellState, self).__str__()\n if default_str == \"CellState.EMPTY\":\n return \"E\"\n elif default_str == \"CellState.DEAD\":\n return ...
false
467
b453006b4d4c5f17bb58110fe8197d7796ca0c6c
# -*- coding: utf-8 -*- __author__ = 'tqs' from win32com.client import Dispatch import win32com.client import time import os import re import win32api ''' windows操作部分说明: 考试波及知识点: 1.删除文件及文件夹 2.复制文件及文件夹 3.移动文件及文件夹 4.文件及文件夹改名 5.文件属性 考试样例: 1、在“蕨类植物”文件夹中,新建一个子文件夹“薄囊蕨类”。 2、将文件“淡水藻.ddd”移动到“藻类植物”文件夹中。 3、设置“螺旋藻.aaa”文件属性为“只读”...
[ "# -*- coding: utf-8 -*-\n__author__ = 'tqs'\nfrom win32com.client import Dispatch \nimport win32com.client \nimport time\nimport os\nimport re\nimport win32api\n'''\nwindows操作部分说明:\n考试波及知识点:\n1.删除文件及文件夹\n2.复制文件及文件夹\n3.移动文件及文件夹\n4.文件及文件夹改名\n5.文件属性\n考试样例:\n1、在“蕨类植物”文件夹中,新建一个子文件夹“薄囊蕨类”。\n2、将文件“淡水藻.ddd”移动到“藻类植物”文件夹中。...
false
468
170d0560c40f3f642f319f6113b68ab8a6bea9ef
import csv import matplotlib.pyplot as plt import numpy as np from scipy.optimize import curve_fit #funktion def func(w,rc): return 1/(np.sqrt(1+w**2*rc**2)) #daten einlesen with open('data/phase.csv' ) as csvfile: reader=csv.reader(csvfile, delimiter=',') header_row=next(reader) f, U, a,...
[ "import csv\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\nfrom scipy.optimize import curve_fit\r\n\r\n#funktion\r\ndef func(w,rc):\r\n return 1/(np.sqrt(1+w**2*rc**2))\r\n\r\n#daten einlesen\r\nwith open('data/phase.csv' ) as csvfile:\r\n reader=csv.reader(csvfile, delimiter=',')\r\n header_r...
false
469
c9cf65eeec49eba004312491cdd2321200fa6a61
import cv2 import pandas from sklearn import tree import pydotplus from sklearn.tree import DecisionTreeClassifier import matplotlib.pyplot as plt import matplotlib.image as pltimg df = pandas.read_csv("show.csv") d = {'UK': 0, 'USA': 1, 'N': 2} df['Nationality'] = df['Nationality'].map(d) d = {'YES': 1, 'NO': 0} df['...
[ "import cv2\nimport pandas\nfrom sklearn import tree\nimport pydotplus\nfrom sklearn.tree import DecisionTreeClassifier\nimport matplotlib.pyplot as plt\nimport matplotlib.image as pltimg\n\ndf = pandas.read_csv(\"show.csv\")\nd = {'UK': 0, 'USA': 1, 'N': 2}\ndf['Nationality'] = df['Nationality'].map(d)\nd = {'YES'...
false
470
c893095be88636e6cb06eb3b939d8106fbb7a8ca
#Arushi Patel (aruship) from tkinter import * import random ###################################### #images taken from wikipedia,pixabay, #trans americas, clipartpanda,pngimg, #findicons, microsoft word ###################################### #################################### # init #####################...
[ "#Arushi Patel (aruship)\r\nfrom tkinter import *\r\nimport random\r\n\r\n######################################\r\n#images taken from wikipedia,pixabay,\r\n#trans americas, clipartpanda,pngimg,\r\n#findicons, microsoft word\r\n######################################\r\n\r\n####################################\r\n# ...
false
471
d0448ca8e3fd2f3bb8a3a7ec052e29ab0be6351a
import matplotlib.pyplot as plt from sklearn.decomposition import PCA from sklearn.discriminant_analysis import LinearDiscriminantAnalysis import pandas as pd import numpy as np from sklearn import datasets from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split # a = pd....
[ "import matplotlib.pyplot as plt\nfrom sklearn.decomposition import PCA\nfrom sklearn.discriminant_analysis import LinearDiscriminantAnalysis\n\nimport pandas as pd\nimport numpy as np\nfrom sklearn import datasets\nfrom sklearn.datasets import make_classification\nfrom sklearn.model_selection import train_test_spl...
false
472
6d7db5b9a64ec25763f5af6ceec1a46d629d549c
import re import ngram import smoothedNgram def split_into_sentences(text): text = text.lower() sentences = re.split(r'(?<!\w\.\w.)(?<![A-Z][a-z]\.)(?<=\.|\?)\s', text) getSentences(sentences,text) return sentences def getTextWithoutSpaces(text): withoutLineBreaks = text.replace("\n", "") withoutS...
[ "import re\nimport ngram\nimport smoothedNgram\n\ndef split_into_sentences(text):\n text = text.lower()\n sentences = re.split(r'(?<!\\w\\.\\w.)(?<![A-Z][a-z]\\.)(?<=\\.|\\?)\\s', text)\n getSentences(sentences,text)\n return sentences\n\ndef getTextWithoutSpaces(text):\n withoutLineBreaks = text.replace...
false
473
654586443e96f84aae70b3ce3263b0458a27334b
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/ads/googleads_v1/proto/services/user_interest_service.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobu...
[ "# -*- coding: utf-8 -*-\n# Generated by the protocol buffer compiler. DO NOT EDIT!\n# source: google/ads/googleads_v1/proto/services/user_interest_service.proto\n\nimport sys\n_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))\nfrom google.protobuf import descriptor as _descriptor\nfrom go...
false
474
7bd2a29bff1e435cf813dd54109d7f4e17612425
#from tinyTensor.Node import Node import tinyTensor import plotly.plotly as py from graphviz import render #from tinyTensor.Operation import Operation def init(): global _default_graph _default_graph = None def postOrder(node): nodes_postorder = [] def recurse(node): if isinstan...
[ "#from tinyTensor.Node import Node\r\nimport tinyTensor\r\nimport plotly.plotly as py\r\nfrom graphviz import render\r\n#from tinyTensor.Operation import Operation\r\n\r\n\r\ndef init():\r\n global _default_graph\r\n _default_graph = None\r\n\r\ndef postOrder(node):\r\n nodes_postorder = []\r\n def recu...
false
475
22da05d9bf6139a0306bfb2d1df96e9e2cf6a0c6
# vim: tabstop=4 expandtab autoindent shiftwidth=4 fileencoding=utf-8 from django.contrib.auth.decorators import login_required from django.contrib.auth import models as auth_models from django.contrib.auth import forms as auth_forms from django.contrib.auth import authenticate, login from django.core.urlresolvers i...
[ "# vim: tabstop=4 expandtab autoindent shiftwidth=4 fileencoding=utf-8\n\nfrom django.contrib.auth.decorators import login_required\n\nfrom django.contrib.auth import models as auth_models\nfrom django.contrib.auth import forms as auth_forms\nfrom django.contrib.auth import authenticate, login\n\nfrom django.core.u...
false
476
40158bbfd9c95a8344f34431d0b0e98c4a1bf6ed
''' Code for mmDGM Author: Chongxuan Li (chongxuanli1991@gmail.com) Version = '1.0' ''' import gpulearn_mm_z_x import sys, os import time import color n_hidden = (500,500) if len(sys.argv) > 2: n_hidden = tuple([int(x) for x in sys.argv[2:]]) nz=500 if os.environ.has_key('nz'): nz = int(os.environ['nz']) if os.en...
[ "'''\nCode for mmDGM\nAuthor: Chongxuan Li (chongxuanli1991@gmail.com)\nVersion = '1.0'\n'''\n\nimport gpulearn_mm_z_x\nimport sys, os\nimport time\nimport color\n\nn_hidden = (500,500)\nif len(sys.argv) > 2:\n n_hidden = tuple([int(x) for x in sys.argv[2:]])\nnz=500\nif os.environ.has_key('nz'):\n nz = int(os.en...
false
477
e543c7f7f1b249e53b8ebf82641ec398abf557af
button6 = Button(tk,text=" ",font=('Times 26 bold'), heigh = 4, width = 8, command=lambda:checker(button6)) button6.grid(row=2, column=2,sticky = S+N+E+W) button7 = Button(tk,text=" ",font=('Times 26 bold'), heigh = 4, width = 8, command=lambda:checker(button7)) button7.grid(row=3, column=0,sticky = S+N+E+W) button8 = ...
[ "button6 = Button(tk,text=\" \",font=('Times 26 bold'), heigh = 4, width = 8, command=lambda:checker(button6))\nbutton6.grid(row=2, column=2,sticky = S+N+E+W)\nbutton7 = Button(tk,text=\" \",font=('Times 26 bold'), heigh = 4, width = 8, command=lambda:checker(button7))\nbutton7.grid(row=3, column=0,sticky = S+N+E+W...
false
478
647dde6e3288ded29336062b78baacc3a92908a7
import re import random import requests from bs4 import BeautifulSoup import js2py from fake_useragent import UserAgent def _get_request_key(session): res = session.post("https://spys.one/en/socks-proxy-list/") soup = BeautifulSoup(res.text, 'html.parser') return soup.find("input", {"name": "xx0"}).get("v...
[ "import re\nimport random\nimport requests\nfrom bs4 import BeautifulSoup\nimport js2py\nfrom fake_useragent import UserAgent\n\n\ndef _get_request_key(session):\n res = session.post(\"https://spys.one/en/socks-proxy-list/\")\n soup = BeautifulSoup(res.text, 'html.parser')\n return soup.find(\"input\", {\"...
false
479
aebc8665a97ab0a71b1d8a920b5cbf2643254883
from base_page import Base_Page import locators class Product_Object: "Page Object for the table" #locators def get_all_text(self): "Get the text within the table" table_text = [] row_doms = self.get_elements(self.rows_xpath) for index,row_dom in enumerate(row_doms): ...
[ "from base_page import Base_Page\nimport locators\n\n\nclass Product_Object:\n \"Page Object for the table\"\n \n #locators\n\n def get_all_text(self):\n \"Get the text within the table\"\n table_text = []\n row_doms = self.get_elements(self.rows_xpath)\n for index,row_dom in...
false
480
24290f3a6cf9a0a272186a505d31c62a6f278c86
#! /usr/bin/env python #printing the sum of the even Fibonacci numbers n= int(raw_input("enter your number")) sumeven=0 # Defining the Fibonacci function def fib(n): a,b = 0,1 #first numbers of the sequence while 1: yield a a,b = b,a+b #generator for the next number in the sequence a = fib(n) for i in range(n...
[ "#! /usr/bin/env python\n#printing the sum of the even Fibonacci numbers\n\nn= int(raw_input(\"enter your number\"))\nsumeven=0\n# Defining the Fibonacci function\ndef fib(n): \n\ta,b = 0,1 #first numbers of the sequence \n\twhile 1:\n\t\tyield a\n\t\ta,b = b,a+b #generator for the next number in the sequence\na = ...
true
481
1fbd4e45b061b4d6cefb46e3bc612533ec94250b
__author__ = 'sudab' """ Generate a grid world """ import os, sys, getopt, pdb, string import random import numpy as np import pygame from skimage import io import cv2 import pygame.locals as pgl class Gridworld(): # a gridworld with uneven terrain def __init__(self, filename=None, initial=0, nrows=8, ncols=8,...
[ "__author__ = 'sudab'\n\"\"\" Generate a grid world \"\"\"\nimport os, sys, getopt, pdb, string\nimport random\nimport numpy as np\nimport pygame\nfrom skimage import io\nimport cv2\nimport pygame.locals as pgl\n\nclass Gridworld():\n # a gridworld with uneven terrain\n def __init__(self, filename=None, initi...
true
482
759ff4cc123e85bdc8c1457bb521cd35841956cd
import numpy as np import cv2 face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml') img = cv2.imread('modi.jpg') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) faces = face_cascade.detectMultiScale(gray, 1.3, 5) #Write the for loop code h...
[ "import numpy as np\nimport cv2\n\nface_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')\neye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')\n\nimg = cv2.imread('modi.jpg')\ngray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\n\nfaces = face_cascade.detectMultiScale(gray, 1.3, 5)\n#Write the ...
false
483
1d524312cbd3b735850046131f31c03fdfa90bbc
my_dict = {'one': '1', 'two': '2'} for key in my_dict: print('{} - {}'.format(key, my_dict[key]))
[ "my_dict = {'one': '1', 'two': '2'}\nfor key in my_dict: \n\tprint('{} - {}'.format(key, my_dict[key]))", "my_dict = {'one': '1', 'two': '2'}\nfor key in my_dict:\n print('{} - {}'.format(key, my_dict[key]))\n", "<assignment token>\nfor key in my_dict:\n print('{} - {}'.format(key, my_dict[key]))\n", "...
false
484
add56d52f3c88f814a166d12c3bc5a5906268864
from django.conf.urls import url from . import views urlpatterns = [ url(r'^class/([^/]+)/?$', views.puppet_class, name='puppet-class'), url(r'^edit-host/(?P<fqdn>[^/]+)?/?$', views.edit_host, name='edit-host'), url(r'^add-host/(?P<fqdn>[^/]+)?/?$', views.add_host, name='add-host'), url(r'^delete/([^/...
[ "from django.conf.urls import url\n\nfrom . import views\n\nurlpatterns = [\n url(r'^class/([^/]+)/?$', views.puppet_class, name='puppet-class'),\n url(r'^edit-host/(?P<fqdn>[^/]+)?/?$', views.edit_host, name='edit-host'),\n url(r'^add-host/(?P<fqdn>[^/]+)?/?$', views.add_host, name='add-host'),\n url(r...
false
485
00e9872136e5753364117adbf60793e660c8bef0
from __future__ import annotations import pytest from pytest import param import ibis import ibis.expr.datatypes as dt from ibis.backends.base.sql.alchemy.geospatial import geospatial_supported DB_TYPES = [ # Exact numbers ("BIGINT", dt.int64), ("BIT", dt.boolean), ("DECIMAL", dt.Decimal(precision=18...
[ "from __future__ import annotations\n\nimport pytest\nfrom pytest import param\n\nimport ibis\nimport ibis.expr.datatypes as dt\nfrom ibis.backends.base.sql.alchemy.geospatial import geospatial_supported\n\nDB_TYPES = [\n # Exact numbers\n (\"BIGINT\", dt.int64),\n (\"BIT\", dt.boolean),\n (\"DECIMAL\",...
false
486
25aa0766505b22588107d44e15c3596e9383d4e9
import datetime from ..core.indicator import Indicator, IndicatorState from ..core.toolwindow import ToolWindow class HaakePhoenix(ToolWindow): required_devices = ['haakephoenix'] def __init__(self, *args, **wargs): self.indicators = {} super().__init__(*args, **wargs) def init_gui(self...
[ "import datetime\n\nfrom ..core.indicator import Indicator, IndicatorState\nfrom ..core.toolwindow import ToolWindow\n\n\nclass HaakePhoenix(ToolWindow):\n required_devices = ['haakephoenix']\n\n def __init__(self, *args, **wargs):\n self.indicators = {}\n super().__init__(*args, **wargs)\n\n ...
false
487
de6b9961e0572338c87802314e7ae3cded5168b4
import matplotlib.pyplot as plt import numpy as np import scipy.io as scio import estimateGaussian as eg import multivariateGaussian as mvg import visualizeFit as vf import selectThreshold as st plt.ion() # np.set_printoptions(formatter={'float': '{: 0.6f}'.format}) '''第1部分 加载示例数据集''' #先通过一个小数据集进行异常检测 便于可视化 # 数据集...
[ "import matplotlib.pyplot as plt\nimport numpy as np\nimport scipy.io as scio\n\nimport estimateGaussian as eg\nimport multivariateGaussian as mvg\nimport visualizeFit as vf\nimport selectThreshold as st\n\nplt.ion()\n# np.set_printoptions(formatter={'float': '{: 0.6f}'.format})\n\n'''第1部分 加载示例数据集'''\n\n#先通过一个小数据集进...
false
488
e37e468d8a41b8711fb0eb4ddec7db67691f9156
''' Created on 3 Jul 2009 @author: charanpal An abstract base class which represents a graph generator. The graph generator takes an existing empty graph and produces edges over it. ''' from apgl.util.Util import Util class AbstractGraphGenerator(object): def generate(self, graph): Util.abst...
[ "'''\r\nCreated on 3 Jul 2009\r\n\r\n@author: charanpal\r\n\r\nAn abstract base class which represents a graph generator. The graph generator\r\ntakes an existing empty graph and produces edges over it. \r\n'''\r\nfrom apgl.util.Util import Util\r\n\r\nclass AbstractGraphGenerator(object):\r\n def generate(self,...
false
489
dc226a646af32d052c6d51832b95a340d6986e08
print('\n') # Первый вариант def fn1(): print("One") def fn2(): print("Two") def fn3(): print("Three") fndict = {"A": fn1, "B": fn2, "C": fn3} keynames = ["A", "B", "C"] fndict[keynames[1]]() fndict['C']() # Второй вариант def add(one,two): c = one+two print(c) print(type(c)) def sub(one,two...
[ "\nprint('\\n')\n\n#\tПервый вариант\n\ndef fn1():\n print(\"One\")\n\ndef fn2():\n print(\"Two\")\n\ndef fn3():\n print(\"Three\")\n\nfndict = {\"A\": fn1, \"B\": fn2, \"C\": fn3}\n\nkeynames = [\"A\", \"B\", \"C\"]\n\nfndict[keynames[1]]()\nfndict['C']()\n\n\n#\t\tВторой вариант\n\ndef add(one,two):\n\tc...
false
490
a491772258a52bdfc93083343d2a2e48a240340d
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # # 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...
[ "# -*- coding:utf-8 -*-\n\n# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.\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/l...
false
491
2b8ca0c8c7878536da4f31652976988cdba62d89
from django.contrib import admin from main_app.models import sites, statuses, redirects # Register your models here. admin.site.register(statuses) admin.site.register(sites) admin.site.register(redirects)
[ "from django.contrib import admin\nfrom main_app.models import sites, statuses, redirects\n# Register your models here.\nadmin.site.register(statuses)\nadmin.site.register(sites)\nadmin.site.register(redirects)", "from django.contrib import admin\nfrom main_app.models import sites, statuses, redirects\nadmin.site...
false
492
19bb58ab440ca00bf6410a70a8b6bbc24eec96c1
from django.apps import AppConfig class MarketingemailsConfig(AppConfig): name = 'marketingemails'
[ "from django.apps import AppConfig\n\n\nclass MarketingemailsConfig(AppConfig):\n name = 'marketingemails'\n", "<import token>\n\n\nclass MarketingemailsConfig(AppConfig):\n name = 'marketingemails'\n", "<import token>\n\n\nclass MarketingemailsConfig(AppConfig):\n <assignment token>\n", "<import tok...
false
493
1614157c57b3d1b30087c42cb840d617dc91eecb
# Bengisu Ayan - 2236974 # Ceren Gürsoy - 2237485 import numpy as np import cv2 B1 = "THE3-Images/B1.jpg" B2 = "THE3-Images/B2.jpg" B3 = "THE3-Images/B3.jpg" B4 = "THE3-Images/B4.jpg" B5 = "THE3-Images/B5.jpg" def segmentation_function(image, name, blue_mask=False, white_mask=False, yellow_mask=False): # Smo...
[ "# Bengisu Ayan - 2236974\n# Ceren Gürsoy - 2237485\n\nimport numpy as np \nimport cv2 \n\nB1 = \"THE3-Images/B1.jpg\"\nB2 = \"THE3-Images/B2.jpg\"\nB3 = \"THE3-Images/B3.jpg\"\nB4 = \"THE3-Images/B4.jpg\"\nB5 = \"THE3-Images/B5.jpg\"\n\n\ndef segmentation_function(image, name, blue_mask=False, white_mask=False, y...
false
494
065a566b3e520c14f20d0d7d668ec58404d6e11b
# coding=utf-8 # Copyright 2016 Mystopia. from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from django.db.models.signals import m2m_changed, post_save from django.dispatch import receiver from dicpick.models import...
[ "# coding=utf-8\n# Copyright 2016 Mystopia.\n\nfrom __future__ import (absolute_import, division, generators, nested_scopes,\n print_function, unicode_literals, with_statement)\n\nfrom django.db.models.signals import m2m_changed, post_save\nfrom django.dispatch import receiver\n\nfrom dicpick...
false
495
dc88686d3cbb4223b4de6847bf4fc29b93054b00
#! /usr/bin/env python3 import EchooFunctions, cgi, MySQLdb, hashlib, time, requests, os print ('Content-type: text/html\n') form = cgi.FieldStorage() #database connection user = "i494f18_team34" db_pass = "my+sql=i494f18_team34" db_con = MySQLdb.connect(host="db.soic.indiana.edu", port = 3306, user=user, passwd=db_...
[ "#! /usr/bin/env python3\n\nimport EchooFunctions, cgi, MySQLdb, hashlib, time, requests, os\nprint ('Content-type: text/html\\n')\n\nform = cgi.FieldStorage()\n\n#database connection\nuser = \"i494f18_team34\"\ndb_pass = \"my+sql=i494f18_team34\"\ndb_con = MySQLdb.connect(host=\"db.soic.indiana.edu\", port = 3306,...
false
496
653e65281984ebb06467aeadb6f0e2b11f1bcb4d
#!/usr/bin/python3 def file_to_code(fname): mem = [] for line in open(fname,"r"): mem.extend([int(i) for i in line.split(",")]) return mem class Opcode(object): def __init__(self, mem, ptr, code, inc): """ >>> o = Opcode([1001, 2, 4, 1], 0, 1, 4) >>> o._Opcode__par_modes [0, 1] """ if mem[ptr]%100 !...
[ "#!/usr/bin/python3\n\ndef file_to_code(fname):\n\tmem = []\n\tfor line in open(fname,\"r\"):\n\t\tmem.extend([int(i) for i in line.split(\",\")])\n\treturn mem\n\nclass Opcode(object):\n\tdef __init__(self, mem, ptr, code, inc):\n\t\t\"\"\"\n\t\t>>> o = Opcode([1001, 2, 4, 1], 0, 1, 4)\n\t\t>>> o._Opcode__par_mode...
false
497
8d5b75dc945844d48f52159be08fc1e6aa51fdf5
# Takes in a word and makes a list containing individual characters def split(word): return [char for char in word] # Removes empty strings from a list def removeEmptyStrings(lst): while "" in lst: lst.remove("") ints = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] tokenList = [] class Token:...
[ "# Takes in a word and makes a list containing individual characters\ndef split(word): \n return [char for char in word]\n\n# Removes empty strings from a list\ndef removeEmptyStrings(lst):\n while \"\" in lst: \n lst.remove(\"\") \n\nints = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']\ntokenList...
false
498
20649decd3ff21b1aa814d0a04180195cac3629b
#loadconc.py - possibly these classes will be added to ajustador/loader.py when ready # -*- coding:utf-8 -*- from __future__ import print_function, division import numpy as np from ajustador import xml,nrd_fitness import glob import os import operator msec_per_sec=1000 nM_per_uM=1000 nM_per_mM=1e6 class trace(ob...
[ "#loadconc.py - possibly these classes will be added to ajustador/loader.py when ready\n# -*- coding:utf-8 -*-\n\nfrom __future__ import print_function, division\nimport numpy as np\nfrom ajustador import xml,nrd_fitness\nimport glob \nimport os\nimport operator\n\nmsec_per_sec=1000\nnM_per_uM=1000\nnM_per_mM=1e...
false
499
bb2c684fd5b962c97c033d4b4c2027d52b7371fd
import voldemort import time authorStore = voldemort.StoreClient('authorStore', [{'0', 6666}]) stack = [] components = [] index = 1 # Implementation of the Tarjan algorithm for the detection of strongly connected components. # Function collects all authors in the database and outputs them as strongly connected compon...
[ "import voldemort\nimport time\n\nauthorStore = voldemort.StoreClient('authorStore', [{'0', 6666}])\nstack = []\ncomponents = []\nindex = 1\n\n# Implementation of the Tarjan algorithm for the detection of strongly connected components.\n# Function collects all authors in the database and outputs them as strongly co...
false