index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
5,800
30e7fc169eceb3d8cc1a4fa6bb65d81a4403f2c7
from selenium import webdriver from time import sleep import os.path import time import datetime driver =webdriver.Chrome(executable_path=r'C:/Users/Pathak/Downloads/chromedriver_win32/chromedriver.exe') counter=0 while True : driver.get("https://www.google.co.in/maps/@18.9967228,73.118955,21z/data=!5m1!...
[ "from selenium import webdriver\r\nfrom time import sleep\r\nimport os.path\r\nimport time\r\nimport datetime\r\ndriver =webdriver.Chrome(executable_path=r'C:/Users/Pathak/Downloads/chromedriver_win32/chromedriver.exe')\r\ncounter=0\r\nwhile True :\r\n\t\r\n\r\n\tdriver.get(\"https://www.google.co.in/maps/@18.9967...
false
5,801
3b11d514b15775e4c818a7a2adf9a80e89dca968
import requests from bs4 import BeautifulSoup from urllib.request import urlretrieve import json import time #功能一:下载单一歌曲、歌词 def single_song(song_id,path,song_name): #下载单一歌曲,输入为歌曲id,保存路径,歌曲名称 song_url = "http://music.163.com/song/media/outer/url?id=%s" % song_id down_path = path +'...
[ "import requests\r\nfrom bs4 import BeautifulSoup\r\nfrom urllib.request import urlretrieve\r\nimport json\r\nimport time\r\n\r\n#功能一:下载单一歌曲、歌词\r\n\r\ndef single_song(song_id,path,song_name): #下载单一歌曲,输入为歌曲id,保存路径,歌曲名称\r\n song_url = \"http://music.163.com/song/media/outer/url?id=%s\" % song_id...
false
5,802
807e19f09f4a46b6c39457b8916714e2c54c3e8d
# -*- coding:utf-8 -*- ''' @author:oldwai ''' # email: frankandrew@163.com def multipliers(): return lab1(x) def lab1(x): list1 = [] for i in range(4): sum = x*i list1.append(sum) return list1 #print ([m(2) for m in multipliers()]) def func1(x): list2 = [] ...
[ "# -*- coding:utf-8 -*-\r\n'''\r\n@author:oldwai\r\n'''\r\n# email: frankandrew@163.com\r\n\r\n\r\ndef multipliers():\r\n return lab1(x)\r\n\r\n\r\ndef lab1(x):\r\n list1 = []\r\n for i in range(4):\r\n sum = x*i\r\n list1.append(sum)\r\n return list1\r\n\r\n#print ([m(2) for m in multiplier...
false
5,803
676caabb103f67c631bc191b11ab0d2d8ab25d1e
import json from django.core.management import call_command from django.http import JsonResponse from django.test import TestCase from django.urls import reverse URLS = ['api_v1:categories', 'api_v1:main_categories', 'api_v1:articles'] class GetJsonData(TestCase): def test_post_not_login_no_pk(self): f...
[ "import json\n\nfrom django.core.management import call_command\nfrom django.http import JsonResponse\nfrom django.test import TestCase\nfrom django.urls import reverse\n\n\nURLS = ['api_v1:categories', 'api_v1:main_categories', 'api_v1:articles']\n\n\nclass GetJsonData(TestCase):\n def test_post_not_login_no_pk...
false
5,804
2bf057621df3b860c8f677baf54673d2da8c2bd1
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
[ "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# 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 to in writing, software\n# distr...
false
5,805
c585b1439217fff42945eeb9e02512d73f8ba19f
import DB as db import os from Chart import Chart import matplotlib.pyplot as plt import numpy as np table = db.get_researcher_copy() chart_path = '../charts/discipline ' def get_discipline_with_more_female(): docs = table.aggregate([ {'$match':{'gender':{'$exists':1}}}, {'$unwind':'$labels'}, {'$group':{'_id'...
[ "import DB as db\nimport os\nfrom Chart import Chart\nimport matplotlib.pyplot as plt\nimport numpy as np\ntable = db.get_researcher_copy()\nchart_path = '../charts/discipline '\n\n\ndef get_discipline_with_more_female():\n\tdocs = table.aggregate([\n\t\t{'$match':{'gender':{'$exists':1}}},\n\t\t{'$unwind':'$labels...
false
5,806
c69c8ba218935e5bb065b3b925cc7c5f1aa2957b
import matplotlib.pyplot as plt import numpy as np x = [1, 2, 2.5, 3, 4] # x-coordinates for graph y = [1, 4, 7, 9, 15] # y-coordinates plt.axis([0, 6, 0, 20]) # creating my x and y axis range. 0-6 is x, 0-20 is y plt.plot(x, y, 'ro') # can see graph has a linear correspondence, therefore, can use linear regression ...
[ "\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nx = [1, 2, 2.5, 3, 4] # x-coordinates for graph\ny = [1, 4, 7, 9, 15] # y-coordinates\nplt.axis([0, 6, 0, 20]) # creating my x and y axis range. 0-6 is x, 0-20 is y\n\nplt.plot(x, y, 'ro')\n# can see graph has a linear correspondence, therefore, can use line...
false
5,807
f0fa85f240b74b003ade767ffe8642feacdfaa32
import argparse from train import train from test import infer if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--mode', type=str, default='train', help='could be either infer or train') parser.add_argument('--model_dir', type=str, default='model', ...
[ "import argparse\nfrom train import train\nfrom test import infer\n\nif __name__ == '__main__':\n parser = argparse.ArgumentParser()\n parser.add_argument('--mode', type=str, default='train',\n help='could be either infer or train')\n parser.add_argument('--model_dir', type=str, defa...
false
5,808
2ccc5e01a3b47a77abcb32160dee74a6a74fcfbb
import socket import sys from datetime import datetime from threading import Thread import logging class RRConnection(): def __init__(self): self._listenerSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self._inSock = None self._inThread = Thread(target=self.inLoop) self...
[ "import socket\nimport sys\nfrom datetime import datetime\nfrom threading import Thread\nimport logging\n\n\nclass RRConnection():\n def __init__(self):\n self._listenerSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n self._inSock = None\n self._inThread = Thread(target=self.inLo...
false
5,809
9f1cbc655a5d8f14fa45cf977bb2dcee4874b188
# -*- coding: utf-8 -*- """ Created on Tue Jan 23 20:44:38 2018 @author: user """ import fitbit import gather_keys_oauth2 as Oauth2 import pandas as pd import datetime as dt from config import CLIENT_ID, CLIENT_SECRET #Establish connection to Fitbit API server = Oauth2.OAuth2Server(CLIENT_ID, CLIENT_SECRET) server...
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Jan 23 20:44:38 2018\n\n@author: user\n\"\"\"\n\nimport fitbit\nimport gather_keys_oauth2 as Oauth2\nimport pandas as pd \nimport datetime as dt\nfrom config import CLIENT_ID, CLIENT_SECRET\n\n\n#Establish connection to Fitbit API\nserver = Oauth2.OAuth2Server(CLIENT...
false
5,810
72bbd100a37a86dec7684257f2bec85d7367c009
from rest_framework import serializers from .models import * class VisitaSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Visita fields = ('id', 'usuario', 'lugar', 'fecha_visita', 'hora_visita')
[ "from rest_framework import serializers\nfrom .models import *\n\n\nclass VisitaSerializer(serializers.HyperlinkedModelSerializer):\n class Meta:\n model = Visita\n fields = ('id', 'usuario', 'lugar', 'fecha_visita', 'hora_visita')", "from rest_framework import serializers\nfrom .models import *\...
false
5,811
c9f29a92ec8627593b54f7d9569dcfd589fa7fff
''' Binary_to_C Converts any binary data to an array of 'char' type to be used inside of a C program. The reason to want to do that, is to emulate a 'Windows Resource System' on Linux. Linux does not allow inclusion of binary data in application (I am OK with that, I like that actually). Windows, however, does. On...
[ "'''\nBinary_to_C\n\tConverts any binary data to an array of 'char' type to be used inside of a C program.\n\tThe reason to want to do that, is to emulate a 'Windows Resource System' on Linux.\n\tLinux does not allow inclusion of binary data in application (I am OK with that, I like that actually).\n\tWindows, howe...
true
5,812
9d6516ea099e035fb97e5165071103698a7ec140
# Generated by Django 2.2.8 on 2019-12-10 10:28 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fieldsapp', '0003_pole_avatar'), ] operations = [ migrations.AddField( model_name='pole', name='email', ...
[ "# Generated by Django 2.2.8 on 2019-12-10 10:28\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('fieldsapp', '0003_pole_avatar'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='pole',\n name='e...
false
5,813
6a9e18cde94258b01a37f459eceaac58118b4976
NUM_CLASSES = 31 AUDIO_SR = 16000 AUDIO_LENGTH = 16000 LIBROSA_AUDIO_LENGTH = 22050 EPOCHS = 25 categories = { 'stop': 0, 'nine': 1, 'off': 2, 'four': 3, 'right': 4, 'eight': 5, 'one': 6, 'bird': 7, 'dog': 8, 'no': 9, 'on': 10, 'seven': 11, 'cat': 12, 'left': 1...
[ "NUM_CLASSES = 31\n\nAUDIO_SR = 16000\nAUDIO_LENGTH = 16000\nLIBROSA_AUDIO_LENGTH = 22050\n\nEPOCHS = 25\n\ncategories = {\n 'stop': 0,\n 'nine': 1,\n 'off': 2,\n 'four': 3,\n 'right': 4,\n 'eight': 5,\n 'one': 6,\n 'bird': 7,\n 'dog': 8,\n 'no': 9,\n 'on': 10,\n 'seven': 11,\n ...
false
5,814
f49c15dca26d987e1d578790e077501a504e560b
#!/usr/bin/env python # -*- coding: utf-8 -*- import pytest class TestMark: @pytest.mark.demo1 def test_case1(self): print("testcase1") @pytest.mark.demo1 def test_case2(self): print("testcase1") @pytest.mark.demo2 def test_case3(self): print("testcase1") @pytest...
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport pytest\n\n\nclass TestMark:\n @pytest.mark.demo1\n def test_case1(self):\n print(\"testcase1\")\n\n @pytest.mark.demo1\n def test_case2(self):\n print(\"testcase1\")\n\n @pytest.mark.demo2\n def test_case3(self):\n print(...
false
5,815
6d80a89a47b68fd8d81739787897355671ca94e9
''' Функція replace() може використовуватися для заміни будь-якого слова у рядку іншим словом. Прочитайте кожен рядок зі створеного у попередньому завданні файлу learning_python.txt і замініть слово Python назвою іншої мови, наприклад C при виведенні на екран. Це завдання написати в окремій функції. ''' def reader():...
[ "'''\nФункція replace() може використовуватися для заміни будь-якого слова у рядку іншим словом.\nПрочитайте кожен рядок зі створеного у попередньому завданні файлу learning_python.txt і замініть слово Python назвою іншої мови,\nнаприклад C при виведенні на екран. Це завдання написати в окремій функції.\n'''\n\n\nd...
false
5,816
629353392e3a4f346f734543ae3f2b8dc616a6c3
#https://docs.python.org/3.4/library/itertools.html#module-itertools l = [(1, 2, 9), (1, 3, 12), (2, 3, 8), (2, 4, 4), (2, 5, 7), (3, 5, 5), (3, 6, 2), (4, 5, 2), (4, 7, 10), (5, 6, 11), (5, 7, 2), (6, 8, 4), (7, 8, 4), (7, 9, 3), (8, 9, 13)] b = ['America', 'Sudan', 'Srilanka', 'Pakistan', 'Nepal', 'India'...
[ "#https://docs.python.org/3.4/library/itertools.html#module-itertools\n\n\nl = [(1, 2, 9), (1, 3, 12), (2, 3, 8), (2, 4, 4), (2, 5, 7), (3, 5, 5), (3, 6, 2), (4, 5, 2), (4, 7, 10),\n (5, 6, 11), (5, 7, 2), (6, 8, 4), (7, 8, 4), (7, 9, 3), (8, 9, 13)]\n\nb = ['America', 'Sudan', 'Srilanka', 'Pakistan', 'Nepa...
false
5,817
b3ce17401476afe2edfda3011d5602ba492cd705
import matplotlib.pyplot as pt import numpy as np from scipy.optimize import leastsq #################################### # Setting up test data def norm(x, media, sd): norm = [] for i in range(x.size): norm += [1.0/(sd*np.sqrt(2*np.pi))*np.exp(-(x[i] - media)**2/(2*sd**2))] return np.array(norm)...
[ "import matplotlib.pyplot as pt\nimport numpy as np\nfrom scipy.optimize import leastsq\n\n####################################\n# Setting up test data\n\ndef norm(x, media, sd):\n norm = []\n\n for i in range(x.size):\n norm += [1.0/(sd*np.sqrt(2*np.pi))*np.exp(-(x[i] - media)**2/(2*sd**2))]\n retu...
false
5,818
ee22d6226f734c67be91a3ccf1c8c0024bb7dc08
import numpy as np from board_specs import * from board_components import * import constants import board_test # List of resources available to be distributed on the board RESOURCE_NAMES = constants.RESOURCE_NAMES # Create a dictionary of each resource and a corresponding number id res_dict = dict(zip(RESOURCE_NAMES,...
[ "import numpy as np\nfrom board_specs import *\nfrom board_components import *\nimport constants\nimport board_test\n\n\n# List of resources available to be distributed on the board\nRESOURCE_NAMES = constants.RESOURCE_NAMES\n# Create a dictionary of each resource and a corresponding number id\nres_dict = dict(zip(...
false
5,819
d3f80deb72ca2bd91fc09b49ad644f54d339f962
#! /home/joreyna/anaconda2/envs/hla/bin/python import argparse import os import sys import time import numpy as np import copy import subprocess import math project_dir = os.path.join(sys.argv[0], '../../') project_dir = os.path.abspath(project_dir) output_dir = os.path.join(project_dir, 'output/', 'pipeline/', 'sa...
[ "#! /home/joreyna/anaconda2/envs/hla/bin/python \nimport argparse \nimport os\nimport sys\nimport time \nimport numpy as np\nimport copy\nimport subprocess\nimport math\n\nproject_dir = os.path.join(sys.argv[0], '../../')\nproject_dir = os.path.abspath(project_dir)\noutput_dir = os.path.join(project_dir, 'output/',...
false
5,820
0ac99e2b33f676a99674c9a8e5d9d47c5bce084b
plik=open("nowy_zad_84.txt", "w") print(" Podaj 5 imion") for i in range(1,6): imie=input(f" Podaj imie nr {i} ") # plik.write(imie) # plik.write("\n") plik.write(f" {imie} \n") plik.close() plik=open("nowy_zad_84.txt", "a") for i in range(1,101): plik.write(str(i)) plik.w...
[ "\r\n\r\nplik=open(\"nowy_zad_84.txt\", \"w\")\r\n\r\nprint(\" Podaj 5 imion\")\r\nfor i in range(1,6):\r\n imie=input(f\" Podaj imie nr {i} \")\r\n # plik.write(imie)\r\n # plik.write(\"\\n\")\r\n plik.write(f\" {imie} \\n\")\r\n\r\nplik.close()\r\n\r\nplik=open(\"nowy_zad_84.txt\", \"a\")\r\n\r\nfor i...
false
5,821
f7d0d7dda955acd07b6da010d21dc5f02254e1ed
from django.conf.urls import patterns, include, url from django.views.generic import TemplateView from . import views app_name = 'produce' urlpatterns = [ # Inbound SMS view: url(r'^sms/$', views.sms, name='sms'), # List and Detail Views: url(r'^list/', views.SeasonalView.as_view(), name='list'), url(r'^(?P<pk...
[ "from django.conf.urls import patterns, include, url\nfrom django.views.generic import TemplateView\n\nfrom . import views\n\napp_name = 'produce'\n\nurlpatterns = [\n\t# Inbound SMS view:\n\turl(r'^sms/$', views.sms, name='sms'),\n\n\t# List and Detail Views:\n\turl(r'^list/', views.SeasonalView.as_view(), name='l...
false
5,822
00228facd19c72bebd9afbbe52597e390233d41e
import requests import logging import json class Handler(object): def __init__(self): """ This class is used to handle interaction towards coffee interface. """ super(Handler, self).__init__() logging.warning('Initializing coffeeHandler....') # get an active token ...
[ "import requests\nimport logging\nimport json\n\n\nclass Handler(object):\n def __init__(self):\n \"\"\"\n This class is used to handle interaction towards coffee interface.\n \"\"\"\n super(Handler, self).__init__()\n logging.warning('Initializing coffeeHandler....')\n\n ...
false
5,823
890841c8892e89375bb022f0d469fefc27414a2b
from abc import abstractmethod from anoncreds.protocol.repo.public_repo import PublicRepo from anoncreds.protocol.types import ClaimDefinition, PublicKey, SecretKey, ID, \ RevocationPublicKey, AccumulatorPublicKey, Accumulator, TailsType, \ RevocationSecretKey, AccumulatorSecretKey, \ TimestampType from an...
[ "from abc import abstractmethod\n\nfrom anoncreds.protocol.repo.public_repo import PublicRepo\nfrom anoncreds.protocol.types import ClaimDefinition, PublicKey, SecretKey, ID, \\\n RevocationPublicKey, AccumulatorPublicKey, Accumulator, TailsType, \\\n RevocationSecretKey, AccumulatorSecretKey, \\\n Timesta...
false
5,824
ac0f0fbb9bcb450ac24198069ef8bea8b049ef47
''' 删除排序数组中的重复项: 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。 示例 1: 给定数组 nums = [1,1,2], 函数应该返回新的长度 2, 并且原数组 nums 的前两个元素被修改为 1, 2。 你不需要考虑数组中超出新长度后面的元素。 示例 2: 给定 nums = [0,0,1,1,1,2,2,3,3,4], 函数应该返回新的长度 5, 并且原数组 nums 的前五个元素被修改为 0, 1, 2, 3, 4。 你不需要考虑数组中超出新长度后...
[ "'''\n 删除排序数组中的重复项:\n\n给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。\n\n不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。\n\n示例 1:\n\n给定数组 nums = [1,1,2],\n\n函数应该返回新的长度 2, 并且原数组 nums 的前两个元素被修改为 1, 2。\n\n你不需要考虑数组中超出新长度后面的元素。\n示例 2:\n\n给定 nums = [0,0,1,1,1,2,2,3,3,4],\n\n函数应该返回新的长度 5, 并且原数组 nums 的前五个元素被修改为 0, 1, 2,...
false
5,825
386e491f6b10ca27f513d678c632571c29093ad2
# -*- coding: utf-8 -*- import numpy as np from . import BOID_NOSE_LEN from .utils import normalize_angle, unit_vector class Individual: def __init__(self, color, pos, ror, roo, roa, angle=0, speed=1.0, turning_rate=0.2): """Constructor of Individual. Args: color (Color): color for ...
[ "# -*- coding: utf-8 -*-\n\nimport numpy as np\n\nfrom . import BOID_NOSE_LEN\nfrom .utils import normalize_angle, unit_vector\n\n\nclass Individual:\n def __init__(self, color, pos, ror, roo, roa, angle=0, speed=1.0, turning_rate=0.2):\n \"\"\"Constructor of Individual.\n\n Args:\n colo...
false
5,826
3ec858c04a7622ae621bf322730b6b3ba9f4d07e
import datetime from httpx import AsyncClient from testing.conftest import (LESSONS_PATH, REVIEWS_PATH, pytestmark, register_and_get_token) class TestReview: async def test_review_add_get(self, ac, fill_db): # Creating users first token = await register_and_get_tok...
[ "import datetime\n\nfrom httpx import AsyncClient\n\nfrom testing.conftest import (LESSONS_PATH, REVIEWS_PATH, pytestmark,\n register_and_get_token)\n\n\nclass TestReview:\n async def test_review_add_get(self, ac, fill_db):\n\n # Creating users first\n token = await reg...
false
5,827
047b3b25cb064115a46cde1f1480ce55a1256bc1
N = int(input()) StopPoint = N cycle = 0 ten = 0 one = 0 new_N = 0 while True: ten = N//10 one = N%10 total = ten + one new_N = one*10 + total%10 cycle += 1 N = new_N if new_N == StopPoint: break print(cycle)
[ "N = int(input())\nStopPoint = N\ncycle = 0\nten = 0\none = 0\nnew_N = 0\nwhile True:\n ten = N//10\n one = N%10\n total = ten + one\n new_N = one*10 + total%10\n cycle += 1\n N = new_N\n if new_N == StopPoint:\n break\nprint(cycle)", "N = int(input())\nStopPoint = N\ncycle = 0\nten = ...
false
5,828
d55043c2a18b935478d9be442aaf7305231edc7d
from os.path import dirname import binwalk from nose.tools import eq_, ok_ def test_firmware_squashfs(): ''' Test: Open hello-world.srec, scan for signatures verify that only one signature is returned verify that the only signature returned is Motorola S-rec data-signature ''' expected_result...
[ "from os.path import dirname\n\nimport binwalk\nfrom nose.tools import eq_, ok_\n\n\ndef test_firmware_squashfs():\n '''\n Test: Open hello-world.srec, scan for signatures\n verify that only one signature is returned\n verify that the only signature returned is Motorola S-rec data-signature\n '''\n ...
false
5,829
778ef68b5270657f75185b27dc8219b35847afa1
import cv2 import sys import online as API def demo(myAPI): myAPI.setAttr() video_capture = cv2.VideoCapture(0) print("Press q to quit: ") while True: # Capture frame-by-frame ret, frame = video_capture.read() #np.array frame = cv2.resize(frame, (320, 240)) key = cv2.w...
[ "import cv2\nimport sys\nimport online as API\n\ndef demo(myAPI):\n myAPI.setAttr()\n video_capture = cv2.VideoCapture(0)\n print(\"Press q to quit: \")\n while True:\n # Capture frame-by-frame\n ret, frame = video_capture.read() #np.array\n\n frame = cv2.resize(frame, (320, 240))\n...
false
5,830
4c752c96b7e503ae5c9bc87a038fcf6dc176b776
def TriSelection(S): """ Tri par sélection Le tableau est constitué de deux parties : la 1ère constituée des éléments triés (initialisée avec seulement le 1er élément) et la seconde constituée des éléments non triés (initialisée du 2ème au dernier élément) """ for i in range(0, len(S)-1): ...
[ "def TriSelection(S):\r\n \"\"\" Tri par sélection\r\n\r\n Le tableau est constitué de deux parties : la 1ère constituée des éléments triés\r\n (initialisée avec seulement le 1er élément) et la seconde constituée des éléments\r\n non triés (initialisée du 2ème au dernier élément) \"\"\"\r\n\r\n for ...
true
5,831
48affa1b823a2543b6bbda615247324f5c249a69
onfiguration name="test3" type="PythonConfigurationType" factoryName="Python" temporary="true"> <module name="hori_check" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> <envs> <env name="PYTHONUNBUFFERED" value="1" /> </envs> <opt...
[ "onfiguration name=\"test3\" type=\"PythonConfigurationType\" factoryName=\"Python\" temporary=\"true\">\n <module name=\"hori_check\" />\n <option name=\"INTERPRETER_OPTIONS\" value=\"\" />\n <option name=\"PARENT_ENVS\" value=\"true\" />\n <envs>\n <env name=\"PYTHONUNBUFFERED\" value=\...
true
5,832
39197b3f9f85d94457584d7e488ca376e52207f1
from operator import itemgetter import math def get_tf_idf_map(document, max_freq, n_docs, index): tf_idf_map = {} for term in document: tf = 0 idf = math.log(n_docs) if term in index and term not in tf_idf_map: posting_list = index[term] freq_term = sum([p...
[ "from operator import itemgetter\nimport math\n\ndef get_tf_idf_map(document, max_freq, n_docs, index):\n tf_idf_map = {}\n \n for term in document:\n tf = 0\n idf = math.log(n_docs)\n if term in index and term not in tf_idf_map: \n posting_list = index[term]\n fr...
false
5,833
ff331dc0c72378222db9195cce7c794f93799401
from matplotlib import pyplot as plt import pandas as pd import numpy as np from sklearn.cluster import KMeans cols = ['Clump Thickness', 'Uniformity of Cell Size', 'Uniformity of Cell Shape', 'Marginal Adhesion', 'Single Epithelial Cell Size', 'Bare Nuclei', 'Bland Chromatin', ...
[ "from matplotlib import pyplot as plt\nimport pandas as pd\nimport numpy as np\n\nfrom sklearn.cluster import KMeans\n\ncols = ['Clump Thickness', 'Uniformity of Cell Size', 'Uniformity of Cell Shape',\n 'Marginal Adhesion', 'Single Epithelial Cell Size', 'Bare Nuclei', 'Bland Chromatin',\n ...
false
5,834
c33d625ebd6a40551d2ce0393fd78619601ea7ae
# This module is used to load pascalvoc datasets (2007 or 2012) import os import tensorflow as tf from configs.config_common import * from configs.config_train import * from configs.config_test import * import sys import random import numpy as np import xml.etree.ElementTree as ET # Original dataset organisation. DIR...
[ "\n# This module is used to load pascalvoc datasets (2007 or 2012)\nimport os\nimport tensorflow as tf\nfrom configs.config_common import *\nfrom configs.config_train import *\nfrom configs.config_test import *\nimport sys\nimport random\nimport numpy as np\nimport xml.etree.ElementTree as ET\n\n# Original dataset ...
false
5,835
edc7c74a19a272bdd6da81b3ce2d214a2b613984
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
[ "#\n# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regarding copyright ownership.\n# The ASF licenses this file to You under the Apache License, Version 2.0\n# (the \"License\"); yo...
false
5,836
a5dcc66ece4e58995fe86c3a399c45975a596b1a
from utilities import SumOneToN, RSS, MSE, R2Score import numpy as np import scipy.stats as st class RidgeLinearModel: covariance_matrix = None # covariance matrix of the model coefficients covariance_matrix_updated = False beta = None # coefficients of the modelfunction var_vector = None var_vecto...
[ "from utilities import SumOneToN, RSS, MSE, R2Score\nimport numpy as np\nimport scipy.stats as st\n\nclass RidgeLinearModel:\n covariance_matrix = None # covariance matrix of the model coefficients\n covariance_matrix_updated = False\n beta = None # coefficients of the modelfunction\n var_vector = None\...
false
5,837
885e02cbf78412d77bd17eba64a8a1a52aaed0df
from slacker import Slacker import vk_api import time import logging from settings import SLACK_TOKEN, VK_LOGIN, VK_PASSWORD, GROUP_ID, TOPIC_ID, ICON_URL slack = Slacker(SLACK_TOKEN) class Vts: def __init__(self): self.last_comment_id = 0 self.vk = None def update_vk(self): if s...
[ "from slacker import Slacker\n\nimport vk_api\n\nimport time\n\nimport logging\n\nfrom settings import SLACK_TOKEN, VK_LOGIN, VK_PASSWORD, GROUP_ID, TOPIC_ID, ICON_URL\n\nslack = Slacker(SLACK_TOKEN)\n\n\nclass Vts:\n def __init__(self):\n self.last_comment_id = 0\n self.vk = None\n\n def update...
false
5,838
b051a3dbe1c695fda9a0488dd8986d587bbb24a6
from math import log from collections import Counter import copy import csv import carTreePlotter import re def calEntropy(dataSet): """ 输入:二维数据集 输出:二维数据集标签的熵 描述: 计算数据集的标签的香农熵;香农熵越大,数据集越混乱; 在计算 splitinfo 和通过计算熵减选择信息增益最大的属性时可以用到 """ entryNum = len(dataSet) labelsCount...
[ "from math import log\r\nfrom collections import Counter\r\nimport copy\r\nimport csv\r\nimport carTreePlotter\r\nimport re\r\n\r\ndef calEntropy(dataSet):\r\n \"\"\"\r\n 输入:二维数据集\r\n 输出:二维数据集标签的熵\r\n 描述:\r\n 计算数据集的标签的香农熵;香农熵越大,数据集越混乱;\r\n 在计算 splitinfo 和通过计算熵减选择信息增益最大的属性时可以用到\r\n \"\"\"\r\n ...
false
5,839
56cae7b7a0338bd4a405cdc3cdcd9945a9df8823
a = 2 while a == 1: b = source() c=function(b)
[ "a = 2\nwhile a == 1:\n b = source()\nc=function(b)\n", "a = 2\nwhile a == 1:\n b = source()\nc = function(b)\n", "<assignment token>\nwhile a == 1:\n b = source()\n<assignment token>\n", "<assignment token>\n<code token>\n<assignment token>\n" ]
false
5,840
6306acd1508698687842ba6b55a839743af420cc
from extras.plugins import PluginConfig from .version import __version__ class QRCodeConfig(PluginConfig): name = 'netbox_qrcode' verbose_name = 'qrcode' description = 'Generate QR codes for the objects' version = __version__ author = 'Nikolay Yuzefovich' author_email = 'mgk.kolek@gmail.com' ...
[ "from extras.plugins import PluginConfig\nfrom .version import __version__\n\n\nclass QRCodeConfig(PluginConfig):\n name = 'netbox_qrcode'\n verbose_name = 'qrcode'\n description = 'Generate QR codes for the objects'\n version = __version__\n author = 'Nikolay Yuzefovich'\n author_email = 'mgk.kol...
false
5,841
111186f1d45b9cf3bf9065c7fa83a8f3f796bbe1
# -*- coding: utf-8 -*- """Labeled entry widget. The goal of these widgets is twofold: to make it easier for developers to implement dialogs with compound widgets, and to naturally standardize the user interface presented to the user. """ import logging import seamm_widgets as sw import tkinter as tk import tkinter....
[ "# -*- coding: utf-8 -*-\n\n\"\"\"Labeled entry widget.\n\nThe goal of these widgets is twofold: to make it easier for developers\nto implement dialogs with compound widgets, and to naturally\nstandardize the user interface presented to the user.\n\"\"\"\n\nimport logging\nimport seamm_widgets as sw\nimport tkinter...
false
5,842
33938a28aad29e996255827825a0cdb1db6b70b7
import tkinter as tk import random root = tk.Tk() main_frame = tk.Frame(root) var = tk.StringVar() ch = [ "hello world" , "HI Pyton", "Mar Java", "Mit Java", "Lut Java" ] var.set("Hello world I am a Label") label = tk.Label(main_frame,textvariable=var, bg="black",fg="white",font=("Times New Roman",24,"bold")) ...
[ "import tkinter as tk \nimport random\nroot = tk.Tk()\nmain_frame = tk.Frame(root)\nvar = tk.StringVar()\nch = [ \"hello world\" , \"HI Pyton\", \"Mar Java\", \"Mit Java\", \"Lut Java\" ]\nvar.set(\"Hello world I am a Label\")\nlabel = tk.Label(main_frame,textvariable=var,\n bg=\"black\",fg=\"white\",font=(\...
false
5,843
547844eca9eab097b814b0daa5da96d6a8ccee55
import numpy as np import xgboost as xgb from sklearn.grid_search import GridSearchCV #Performing grid search import generateVector from sklearn.model_selection import GroupKFold from sklearn import preprocessing as pr positiveFile="../dataset/full_data/positive.csv" negativeFile="../dataset/full_data/negative.csv" ...
[ "import numpy as np\nimport xgboost as xgb\nfrom sklearn.grid_search import GridSearchCV #Performing grid search\nimport generateVector\nfrom sklearn.model_selection import GroupKFold\nfrom sklearn import preprocessing as pr\n\npositiveFile=\"../dataset/full_data/positive.csv\"\nnegativeFile=\"../dataset/full_dat...
true
5,844
4a546222082e2a25296e31f715baf594c974b7ad
#!/usr/bin/env python #coding=UTF8 ''' @author: devin @time: 2013-11-23 @desc: timer ''' import threading import time class Timer(threading.Thread): ''' 每隔一段时间执行一遍任务 ''' def __init__(self, seconds, fun, **kwargs): ''' seconds为间隔时间,单位为秒 fun为定时执行的任务...
[ "#!/usr/bin/env python\n#coding=UTF8\n'''\n @author: devin\n @time: 2013-11-23\n @desc:\n timer\n'''\nimport threading\nimport time\n\nclass Timer(threading.Thread):\n '''\n 每隔一段时间执行一遍任务\n '''\n def __init__(self, seconds, fun, **kwargs):\n '''\n seconds为间隔时间,单位为秒\n...
true
5,845
774f5d01cd274755626989c2b58bde68df349d8e
class Solution: def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool: h = len(matrix) w = len(matrix[0]) for curRow in range(h) : val = matrix[curRow][0] i = 0 while i < h-curRow and i < w : # print(curRow+i,i) if mat...
[ "class Solution:\n def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool:\n h = len(matrix)\n w = len(matrix[0])\n for curRow in range(h) :\n val = matrix[curRow][0]\n i = 0\n while i < h-curRow and i < w :\n # print(curRow+i,i)\n ...
false
5,846
25b7af2a8036f35a0bca665867d1729b7c9c113c
from ._monitor import TMonitor as TMonitor, TqdmSynchronisationWarning as TqdmSynchronisationWarning from ._tqdm_pandas import tqdm_pandas as tqdm_pandas from .cli import main as main from .gui import tqdm as tqdm_gui, trange as tgrange from .std import TqdmDeprecationWarning as TqdmDeprecationWarning, TqdmExperimental...
[ "from ._monitor import TMonitor as TMonitor, TqdmSynchronisationWarning as TqdmSynchronisationWarning\nfrom ._tqdm_pandas import tqdm_pandas as tqdm_pandas\nfrom .cli import main as main\nfrom .gui import tqdm as tqdm_gui, trange as tgrange\nfrom .std import TqdmDeprecationWarning as TqdmDeprecationWarning, TqdmExp...
false
5,847
a1ebb00d7cda65cb528b2253e817d925214cdce3
# 1.闭包 # 2.装饰圈初识 # 3.标准版装饰器
[ "# 1.闭包\n# 2.装饰圈初识\n# 3.标准版装饰器", "" ]
false
5,848
c907f6b954aa3eae21a54eba9d54c116576bd40a
""" Constants to be used throughout this program stored here. """ ROOT_URL = "https://api.twitter.com" UPLOAD_URL = "https://upload.twitter.com" REQUEST_TOKEN_URL = f'{ROOT_URL}/oauth/request_token' AUTHENTICATE_URL = f'{ROOT_URL}/oauth/authenticate' ACCESS_TOKEN_URL = f'{ROOT_URL}/oauth/access_token' VERSION = '1.1'...
[ "\"\"\"\nConstants to be used throughout this program\nstored here.\n\"\"\"\nROOT_URL = \"https://api.twitter.com\"\nUPLOAD_URL = \"https://upload.twitter.com\"\n\nREQUEST_TOKEN_URL = f'{ROOT_URL}/oauth/request_token'\nAUTHENTICATE_URL = f'{ROOT_URL}/oauth/authenticate'\nACCESS_TOKEN_URL = f'{ROOT_URL}/oauth/access...
false
5,849
223413918ba2a49cd13a34026d39b17fb5944572
from selenium import webdriver driver = webdriver.Chrome(executable_path=r'D:\Naveen\Selenium\chromedriver_win32\chromedriver.exe') driver.maximize_window() driver.get('http://zero.webappsecurity.com/') parent_window_handle = driver.current_window_handle driver.find_element_by_xpath("(//a[contains(text(),'privacy')])...
[ "from selenium import webdriver\n\ndriver = webdriver.Chrome(executable_path=r'D:\\Naveen\\Selenium\\chromedriver_win32\\chromedriver.exe')\ndriver.maximize_window()\ndriver.get('http://zero.webappsecurity.com/')\n\nparent_window_handle = driver.current_window_handle\ndriver.find_element_by_xpath(\"(//a[contains(te...
false
5,850
4bd928c16cd0f06931aad5a478f8a911c5a7108b
#source: https://www.pyimagesearch.com/2015/05/25/basic-motion-detection-and-tracking-with-python-and-opencv/ from imutils.video import VideoStream import argparse import datetime import imutils import time import cv2 #capture the video file b="blood.mp4" c="Center.avi" d="Deformed.avi" i="Inlet.avi" ...
[ "#source: https://www.pyimagesearch.com/2015/05/25/basic-motion-detection-and-tracking-with-python-and-opencv/\r\n\r\nfrom imutils.video import VideoStream\r\nimport argparse\r\nimport datetime\r\nimport imutils\r\nimport time\r\nimport cv2\r\n\r\n\r\n#capture the video file\r\nb=\"blood.mp4\"\r\nc=\"Center.avi\"\r...
false
5,851
65b30bbe737b331447235b5c640e9c3f7f6d6f8c
def slope_distance(baseElev, elv2, dist_betwn_baseElev_elv2, projectedDistance): # Calculate the slope and distance between two Cartesian points. # # Input: # For 2-D graphs, # dist_betwn_baseElev_elv2, Distance between two elevation points (FLOAT) # baseElev, Elevation of first ...
[ "def slope_distance(baseElev, elv2, dist_betwn_baseElev_elv2, projectedDistance):\n\n # Calculate the slope and distance between two Cartesian points.\n #\n # Input:\n # For 2-D graphs,\n # dist_betwn_baseElev_elv2, Distance between two elevation points (FLOAT)\n # baseElev, Elevati...
false
5,852
a283fd1e4098ea8bb3cc3580438c90e5932ba22f
#!/usr/bin/env python from __future__ import print_function from __future__ import division from __future__ import absolute_import # Workaround for segmentation fault for some versions when ndimage is imported after tensorflow. import scipy.ndimage as nd import argparse import numpy as np from pybh import tensorpack...
[ "#!/usr/bin/env python\n\nfrom __future__ import print_function\nfrom __future__ import division\nfrom __future__ import absolute_import\n\n# Workaround for segmentation fault for some versions when ndimage is imported after tensorflow.\nimport scipy.ndimage as nd\n\nimport argparse\nimport numpy as np\nfrom pybh i...
false
5,853
198beb5a17575d781f7bce1ab36a6213ad7331b3
import pandas as pd import numpy as np import inspect from script.data_handler.Base.df_plotterMixIn import df_plotterMixIn from script.util.MixIn import LoggerMixIn from script.util.PlotTools import PlotTools DF = pd.DataFrame Series = pd.Series class null_clean_methodMixIn: @staticmethod def drop_col(df: D...
[ "import pandas as pd\nimport numpy as np\nimport inspect\n\nfrom script.data_handler.Base.df_plotterMixIn import df_plotterMixIn\nfrom script.util.MixIn import LoggerMixIn\nfrom script.util.PlotTools import PlotTools\n\nDF = pd.DataFrame\nSeries = pd.Series\n\n\nclass null_clean_methodMixIn:\n @staticmethod\n ...
false
5,854
e9ea48dec40e75f2fc73f8dcb3b5b975065cf8af
class Solution: def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]: def convert(word): table = {} count, converted = 0, '' for w in word: if w in table: converted += table[w] else: ...
[ "class Solution:\n def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]:\n def convert(word):\n table = {}\n count, converted = 0, ''\n \n for w in word:\n if w in table:\n converted += table[w]\n ...
false
5,855
399a22450d215638051a7d643fb6d391156779c5
/home/khang/anaconda3/lib/python3.6/tempfile.py
[ "/home/khang/anaconda3/lib/python3.6/tempfile.py" ]
true
5,856
91959f6621f05b1b814a025f0b95c55cf683ded3
from pyparsing import ParseException from pytest import raises from easymql.expressions import Expression as exp class TestComparisonExpression: def test_cmp(self): assert exp.parse('CMP(1, 2)') == {'$cmp': [1, 2]} with raises(ParseException): exp.parse('CMP(1)') with raises(P...
[ "from pyparsing import ParseException\nfrom pytest import raises\n\nfrom easymql.expressions import Expression as exp\n\n\nclass TestComparisonExpression:\n def test_cmp(self):\n assert exp.parse('CMP(1, 2)') == {'$cmp': [1, 2]}\n with raises(ParseException):\n exp.parse('CMP(1)')\n ...
false
5,857
f9dd21aac7915b9bbf91eeffb5fd58ffdb43c6c3
''' Unit test for `redi.create_summary_report()` ''' import unittest import os import sys from lxml import etree from StringIO import StringIO import time import redi file_dir = os.path.dirname(os.path.realpath(__file__)) goal_dir = os.path.join(file_dir, "../") proj_root = os.path.abspath(goal_dir)+'/' DEFAULT_DATA_...
[ "'''\nUnit test for `redi.create_summary_report()`\n'''\nimport unittest\nimport os\nimport sys\nfrom lxml import etree\nfrom StringIO import StringIO\nimport time\nimport redi\n\nfile_dir = os.path.dirname(os.path.realpath(__file__))\ngoal_dir = os.path.join(file_dir, \"../\")\nproj_root = os.path.abspath(goal_dir...
false
5,858
aa15d51760c16181907994d329fb7ceede6a539b
import re text = "Python is an interpreted high-level general-purpose programming language." fiveWord = re.findall(r"\b\w{5}\b", text) print("Following are the words with five Letters:") for strWord in fiveWord: print(strWord)
[ "import re\r\ntext = \"Python is an interpreted high-level general-purpose programming language.\"\r\nfiveWord = re.findall(r\"\\b\\w{5}\\b\", text)\r\nprint(\"Following are the words with five Letters:\")\r\nfor strWord in fiveWord:\r\n print(strWord)\r\n", "import re\ntext = (\n 'Python is an interpreted hi...
false
5,859
d077f32061b87a4bfd6a0ac226730957a4000804
### ### Copyright 2009 The Chicago Independent Radio Project ### 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/LICENS...
[ "###\n### Copyright 2009 The Chicago Independent Radio Project\n### 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/...
false
5,860
f882b73645c6a280a17f40b27c01ecad7e4d85ae
import logging from datetime import datetime import boto3 from pytz import timezone from mliyweb.api.v1.api_session_limiter import session_is_okay from mliyweb.api.v1.json_view import JsonView from mliyweb.dns import deleteDnsEntry from mliyweb.models import Cluster from mliyweb.resources.clusters import ClusterServi...
[ "import logging\nfrom datetime import datetime\n\nimport boto3\nfrom pytz import timezone\n\nfrom mliyweb.api.v1.api_session_limiter import session_is_okay\nfrom mliyweb.api.v1.json_view import JsonView\nfrom mliyweb.dns import deleteDnsEntry\nfrom mliyweb.models import Cluster\nfrom mliyweb.resources.clusters impo...
false
5,861
c80ae9d2eb07fd716a80a5e2d7b5237925fda02c
# Pose estimation and object detection: OpenCV DNN, ImageAI, YOLO, mpi, caffemodel, tensorflow # Authors: # Tutorial by: https://learnopencv.com/deep-learning-based-human-pose-estimation-using-opencv-cpp-python/ # Model file links collection (replace .sh script): Twenkid # http://posefs1.perception.cs.cmu.edu/OpenPose/...
[ "# Pose estimation and object detection: OpenCV DNN, ImageAI, YOLO, mpi, caffemodel, tensorflow\n# Authors:\n# Tutorial by: https://learnopencv.com/deep-learning-based-human-pose-estimation-using-opencv-cpp-python/\n# Model file links collection (replace .sh script): Twenkid\n# http://posefs1.perception.cs.cmu.edu/...
false
5,862
7d2335c956776fc5890a727d22540eabf2ea4b94
umur = raw_input("Berapakah umurmu?") tinggi = raw_input("Berapakah tinggimu?") berat = raw_input("Berapa beratmu?") print "Jadi, umurmu adalah %r, tinggumu %r, dan beratmu %r." % (umur, tinggi, berat)
[ "umur = raw_input(\"Berapakah umurmu?\")\ntinggi = raw_input(\"Berapakah tinggimu?\")\nberat = raw_input(\"Berapa beratmu?\")\n\nprint \"Jadi, umurmu adalah %r, tinggumu %r, dan beratmu %r.\" % (umur, tinggi, berat)\n" ]
true
5,863
84d154afe206fd2c7381a2203affc162c28e21c1
import sqlite3 from flask_restful import Resource, reqparse from flask_jwt import JWT, jwt_required #import base64 import datetime import psycopg2 class User: def __init__(self, _id, username, password, user_name, address, contact): self.id = _id self.username = username self.password =...
[ "import sqlite3\nfrom flask_restful import Resource, reqparse\nfrom flask_jwt import JWT, jwt_required\n#import base64\nimport datetime\nimport psycopg2\n\n\n\n\nclass User:\n def __init__(self, _id, username, password, user_name, address, contact):\n self.id = _id\n self.username = username\n ...
false
5,864
3bf1b4cfce55820605653d9dc57bab839f2dea55
#!/usr/bin/env python ############################################################################### # \file # # $Id:$ # # Copyright (C) Brno University of Technology # # This file is part of software developed by Robo@FIT group. # # Author: Tomas Lokaj # Supervised by: Michal Spanel (spanel@fit.vutbr.cz) # Date: 12/...
[ "#!/usr/bin/env python\n###############################################################################\n# \\file\n#\n# $Id:$\n#\n# Copyright (C) Brno University of Technology\n#\n# This file is part of software developed by Robo@FIT group.\n# \n# Author: Tomas Lokaj\n# Supervised by: Michal Spanel (spanel@fit.vutb...
true
5,865
3f3ed40bf800eddb2722171d5fd94f6c292162de
#!/usr/bin/env python import sys def trim_reads(fastq, selection, extra_cut, orientation, output, outputType, seqLen, trim): # Store all read/sequence ids that did not match with KoRV ids = [] with open(selection, 'r') as f: for line in f: ids.append(line.strip()) ...
[ "#!/usr/bin/env python\nimport sys\n\n\ndef trim_reads(fastq, selection, extra_cut, orientation, output, outputType,\n seqLen, trim):\n\n # Store all read/sequence ids that did not match with KoRV\n ids = []\n with open(selection, 'r') as f:\n for line in f:\n ids.append(lin...
false
5,866
8ec257d5dfe84e363e3c3aa5adee3470c20d1765
import sys import time import numpy as np import vii import cnn from cnn._utils import (FLOAT_DTYPE, _multi_convolve_image, _opencl_multi_convolve_image, _relu_max_pool_image, _opencl_relu_max_pool_image) GROUPS = 25, 20...
[ "import sys\nimport time\nimport numpy as np\n\nimport vii\n\nimport cnn\nfrom cnn._utils import (FLOAT_DTYPE,\n _multi_convolve_image,\n _opencl_multi_convolve_image,\n _relu_max_pool_image,\n _opencl_relu_max_pool_image)\n...
false
5,867
539431649e54469ddbe44fdbd17031b4449abdd9
import boto3 import os from trustedadvisor import authenticate_support accountnumber = os.environ['Account_Number'] rolename = os.environ['Role_Name'] rolesession = accountnumber + rolename def lambda_handler(event, context): sts_client = boto3.client('sts') assumerole = sts_client.assume_role( Role...
[ "import boto3\nimport os\n\nfrom trustedadvisor import authenticate_support\n\naccountnumber = os.environ['Account_Number']\nrolename = os.environ['Role_Name']\nrolesession = accountnumber + rolename\n\n\ndef lambda_handler(event, context):\n sts_client = boto3.client('sts')\n assumerole = sts_client.assume_r...
false
5,868
75c00eec7eacd37ff0b37d26163c2304620bb9db
from django.contrib.auth.hashers import make_password from django.core import mail from rest_framework import status from django.contrib.auth.models import User import time from api.tests.api_test_case import CustomAPITestCase from core.models import Member, Community, LocalCommunity, TransportCommunity, Profile, Noti...
[ "from django.contrib.auth.hashers import make_password\nfrom django.core import mail\nfrom rest_framework import status\nfrom django.contrib.auth.models import User\nimport time\n\nfrom api.tests.api_test_case import CustomAPITestCase\nfrom core.models import Member, Community, LocalCommunity, TransportCommunity, P...
false
5,869
e09f914f00e59124ef7d8a8f183bff3f7f74b826
#!/usr/bin/python # -*- coding: utf-8 -*- import asyncio from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from myshell.environment import Environment from myshell.job import Job, JobState class JobManager: """事务管理器,用以调度前台和后台事务""" def __init__(self, environment: "Environment"): self...
[ "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport asyncio\nfrom typing import TYPE_CHECKING, Optional\n\nif TYPE_CHECKING:\n from myshell.environment import Environment\n\nfrom myshell.job import Job, JobState\n\n\nclass JobManager:\n \"\"\"事务管理器,用以调度前台和后台事务\"\"\"\n\n def __init__(self, environment: \"...
false
5,870
6e7cca4f766ca89d2e2f82a73f22742b0e8f92a8
from .ros_publisher import *
[ "from .ros_publisher import *\n", "<import token>\n" ]
false
5,871
2269e74c006833976c3a28cd52c238e2dde20051
from .__main__ import datajson_write, datajson_read
[ "from .__main__ import datajson_write, datajson_read\n", "<import token>\n" ]
false
5,872
0ff96b2314927d7b3e763242e554fd561f3c9343
#!/usr/bin/env python3 # coding=utf-8 import fire import json import os import time import requests import time import hashlib import random root_path, file_name = os.path.split(os.path.realpath(__file__)) ip_list_path = ''.join([root_path, os.path.sep, 'ip_list.json']) class ProxySwift(object): ...
[ "#!/usr/bin/env python3\r\n# coding=utf-8\r\nimport fire\r\nimport json\r\nimport os\r\nimport time\r\nimport requests\r\nimport time\r\nimport hashlib\r\nimport random\r\n\r\nroot_path, file_name = os.path.split(os.path.realpath(__file__))\r\nip_list_path = ''.join([root_path, os.path.sep, 'ip_list.json'])\r\n\r\n...
false
5,873
8dbc0b9b80aae4cb5c4101007afc50ac54f7a7e7
#!/usr/bin/python def sumbelow(n): multiples_of_3 = set(range(0,n,3)) multiples_of_5 = set(range(0,n,5)) return sum(multiples_of_3.union(multiples_of_5)) #one linear: # return sum(set(range(0,n,3)).union(set(range(0,n,5)))), # or rather, # return sum(set(range(0,n,3) + range(0,n,5))) if __name__ == '__ma...
[ "#!/usr/bin/python\n\ndef sumbelow(n):\n multiples_of_3 = set(range(0,n,3))\n multiples_of_5 = set(range(0,n,5))\n return sum(multiples_of_3.union(multiples_of_5))\n\n#one linear:\n# return sum(set(range(0,n,3)).union(set(range(0,n,5)))),\n# or rather,\n# return sum(set(range(0,n,3) + range(0,n,5)))\n\nif ...
true
5,874
7a69a9fd6ee5de704a580e4515586a1c1d2b8017
# (C) Datadog, Inc. 2018 # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) from .agent import agent from .clean import clean from .config import config from .create import create from .dep import dep from .env import env from .meta import meta from .release import release from .run impor...
[ "# (C) Datadog, Inc. 2018\n# All rights reserved\n# Licensed under a 3-clause BSD style license (see LICENSE)\nfrom .agent import agent\nfrom .clean import clean\nfrom .config import config\nfrom .create import create\nfrom .dep import dep\nfrom .env import env\nfrom .meta import meta\nfrom .release import release\...
false
5,875
199872ea459a9dba9975c6531034bdbc1e77f1db
# -*- coding: utf-8 -*- # caixinjun import argparse from sklearn import metrics import datetime import jieba from sklearn.feature_extraction.text import TfidfVectorizer import pickle from sklearn import svm import os import warnings warnings.filterwarnings('ignore') def get_data(train_file): targ...
[ "# -*- coding: utf-8 -*-\r\n# caixinjun\r\n\r\nimport argparse\r\nfrom sklearn import metrics\r\nimport datetime\r\nimport jieba\r\nfrom sklearn.feature_extraction.text import TfidfVectorizer\r\nimport pickle\r\nfrom sklearn import svm\r\nimport os\r\nimport warnings\r\nwarnings.filterwarnings('ignore')\r\n\r\n\r\n...
false
5,876
a8341bf422a4d31a83ff412c6aac75e5cb8c5e0f
# Задание 1 # Выучите основные стандартные исключения, которые перечислены в данном уроке. # Задание 2 # Напишите программу-калькулятор, которая поддерживает следующие операции: сложение, вычитание, # умножение, деление и возведение в степень. Программа должна выдавать сообщения об ошибке и # продолжать работу при ввод...
[ "# Задание 1\n# Выучите основные стандартные исключения, которые перечислены в данном уроке.\n# Задание 2\n# Напишите программу-калькулятор, которая поддерживает следующие операции: сложение, вычитание,\n# умножение, деление и возведение в степень. Программа должна выдавать сообщения об ошибке и\n# продолжать работ...
false
5,877
26fb607623fda333c37e254470ca6d07708671a8
from app.request import send_tor_signal from app.utils.session_utils import generate_user_keys from app.utils.gen_ddg_bangs import gen_bangs_json from flask import Flask from flask_session import Session import json import os from stem import Signal app = Flask(__name__, static_folder=os.path.dirname( os...
[ "from app.request import send_tor_signal\r\nfrom app.utils.session_utils import generate_user_keys\r\nfrom app.utils.gen_ddg_bangs import gen_bangs_json\r\nfrom flask import Flask\r\nfrom flask_session import Session\r\nimport json\r\nimport os\r\nfrom stem import Signal\r\n\r\napp = Flask(__name__, static_folder=o...
false
5,878
d429f03c0f0c241166d6c0a5a45dc1101bcaec16
#!/usr/bin/env python3 import matplotlib from matplotlib.colors import to_hex from matplotlib import cm import matplotlib.pyplot as plt import numpy as np import itertools as it from pathlib import Path import subprocess from tqdm import tqdm from koala import plotting as pl from koala import phase_diagrams as pd fr...
[ "#!/usr/bin/env python3\n\nimport matplotlib\nfrom matplotlib.colors import to_hex\nfrom matplotlib import cm\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport itertools as it\nfrom pathlib import Path\nimport subprocess\nfrom tqdm import tqdm\n\nfrom koala import plotting as pl\nfrom koala import phas...
false
5,879
6c6026a7ff0345c37e62de7c0aac0ee3bcde2c82
import pymongo myclient = pymongo.MongoClient('mongodb://localhost:27017/') #We create the database object mydb = myclient['mydatabase'] #Create a database mycol = mydb['customers'] #Create a collection into my mydatabase mydict = [{"name": "Eric", "address": "Highway 37"}, {"name": "Albert", "address": "Highway 37...
[ "import pymongo\n\nmyclient = pymongo.MongoClient('mongodb://localhost:27017/') #We create the database object\n\nmydb = myclient['mydatabase'] #Create a database\n\nmycol = mydb['customers'] #Create a collection into my mydatabase\n\nmydict = [{\"name\": \"Eric\", \"address\": \"Highway 37\"}, {\"name\": \"Albert\...
false
5,880
fb1974ad7ac9ae54344812814cb95a7fccfefc66
# - Generated by tools/entrypoint_compiler.py: do not edit by hand """ NGramHash """ import numbers from ..utils.entrypoints import Component from ..utils.utils import try_set def n_gram_hash( hash_bits=16, ngram_length=1, skip_length=0, all_lengths=True, seed=314489979, ...
[ "# - Generated by tools/entrypoint_compiler.py: do not edit by hand\n\"\"\"\nNGramHash\n\"\"\"\n\nimport numbers\n\nfrom ..utils.entrypoints import Component\nfrom ..utils.utils import try_set\n\n\ndef n_gram_hash(\n hash_bits=16,\n ngram_length=1,\n skip_length=0,\n all_lengths=True,\n ...
false
5,881
1af6e66c19078a9ee971f608daa93247911d8406
from tensorflow.keras.applications.resnet50 import ResNet50 from tensorflow.keras.preprocessing import image from tensorflow.keras.applications.resnet50 import preprocess_input, decode_predictions import numpy as np model = ResNet50(weights='imagenet', # Learned weights on imagenet include_top=True) ...
[ "from tensorflow.keras.applications.resnet50 import ResNet50\nfrom tensorflow.keras.preprocessing import image\nfrom tensorflow.keras.applications.resnet50 import preprocess_input, decode_predictions\nimport numpy as np\n\nmodel = ResNet50(weights='imagenet', # Learned weights on imagenet\n include...
false
5,882
6edb1f99ca9af01f28322cbaf13f278e79b94e92
# -*- coding: utf-8 -*- c = int(input()) t = input() m = [] for i in range(12): aux = [] for j in range(12): aux.append(float(input())) m.append(aux) aux = [] soma = 0 for i in range(12): soma += m[i][c] resultado = soma / (t == 'S' and 1 or 12) print('%.1f' % resultado)
[ "# -*- coding: utf-8 -*-\n\nc = int(input())\nt = input()\nm = []\n\nfor i in range(12):\n aux = []\n for j in range(12):\n aux.append(float(input()))\n m.append(aux)\n aux = []\n\nsoma = 0\nfor i in range(12):\n soma += m[i][c]\n\nresultado = soma / (t == 'S' and 1 or 12)\nprint('%.1f' % resu...
false
5,883
9baf55eb2fb70e9fa0d92df22d307962b8d6c6d4
#!/usr/bin/python # -*- coding: utf-8 -*- import json import urllib2 #this is executed by a cron job on the pi inside the pooltable secret ='secret' baseurl='https://pooltable.mysite.com/' url = baseurl + 'gettrans.php?secret=' + secret req = urllib2.Request(url) f = urllib2.urlopen(req) response = f.read()...
[ "#!/usr/bin/python\r\n# -*- coding: utf-8 -*-\r\n\r\nimport json\r\nimport urllib2\r\n#this is executed by a cron job on the pi inside the pooltable\r\nsecret ='secret'\r\nbaseurl='https://pooltable.mysite.com/'\r\nurl = baseurl + 'gettrans.php?secret=' + secret\r\nreq = urllib2.Request(url)\r\nf = urllib2.urlopen(...
true
5,884
9f3ca0d5a10a27d926a0f306665889418f8d6a0c
from src.produtos import * class Estoque(object): def __init__(self): self.categorias = [] self.subcategorias = [] self.produtos = [] self.menu_estoque() def save_categoria(self, categoria): pass def save_subcategorias(self, subcategoria): pa...
[ "from src.produtos import *\r\n\r\n\r\nclass Estoque(object):\r\n def __init__(self):\r\n self.categorias = []\r\n self.subcategorias = []\r\n self.produtos = []\r\n self.menu_estoque()\r\n\r\n def save_categoria(self, categoria):\r\n pass\r\n\r\n def save_subcategorias(s...
false
5,885
6fa9dfadc60108e1718c6688f07de877b0ac0afd
#!usr/bin/python # -*- coding:UTF-8 -*- ''' Introduction: Implementation of Stack Created on: Oct 28, 2014 @author: ICY ''' #-------------------------FUNCTION---------------------------# class Stack(object): def __init__(self): self.items = [] def is_empty(self): return self.items == [] ...
[ "#!usr/bin/python\n# -*- coding:UTF-8 -*-\n\n'''\nIntroduction: \nImplementation of Stack \n\nCreated on: Oct 28, 2014\n\n@author: ICY\n'''\n\n#-------------------------FUNCTION---------------------------#\n\nclass Stack(object):\n def __init__(self):\n self.items = []\n\n def is_empty(self):\n ...
false
5,886
4f87c2602e3233889888e419296f67fe40a2db0f
#!/usr/bin/python #========================================================================== # # Copyright Insight Software Consortium # # 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...
[ "#!/usr/bin/python\n#==========================================================================\n#\n# Copyright Insight Software Consortium\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 ...
true
5,887
8c4006ed8f4b1744f0316a61d95458b227653fee
/Users/AbbyPennington/anaconda/lib/python3.5/os.py
[ "/Users/AbbyPennington/anaconda/lib/python3.5/os.py" ]
true
5,888
2a6ae615b427a7c970aacf9804865ea7952d065f
# -*- coding: utf-8 -*- """ Created on Sun Dec 20 14:48:56 2020 @author: dhk1349 """ n = int(input()) #목표채널 m = int(input()) broken=[int(i) for i in input().split()] #망가진 버튼 normal=[i for i in range(10)] #사용가능한 버튼 ans=abs(n-100) #시작 시 정답 for i in broken: normal.remove(i) tempnum=0 iternum=1 def solve(ls...
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun Dec 20 14:48:56 2020\n\n@author: dhk1349\n\"\"\"\n\nn = int(input()) #목표채널 \nm = int(input())\nbroken=[int(i) for i in input().split()] #망가진 버튼 \nnormal=[i for i in range(10)] #사용가능한 버튼 \nans=abs(n-100) #시작 시 정답 \n\n\nfor i in broken:\n normal.remove(i)\n\n\ntemp...
true
5,889
8a04166e091e2da348928598b2356c8ad75dd831
#usage: #crawl raw weibo text data from sina weibo users(my followees) #in total, there are 20080 weibo tweets, because there is uplimit for crawler # -*- coding: utf-8 -*- import weibo APP_KEY = 'your app_key' APP_SECRET = 'your app_secret' CALL_BACK = 'your call back url' def run(): token = "your access token got...
[ "#usage:\n#crawl raw weibo text data from sina weibo users(my followees)\n#in total, there are 20080 weibo tweets, because there is uplimit for crawler\n\n# -*- coding: utf-8 -*-\nimport weibo\n\nAPP_KEY = 'your app_key'\nAPP_SECRET = 'your app_secret'\nCALL_BACK = 'your call back url'\n\ndef run():\n\ttoken = \"yo...
true
5,890
b86dedad42d092ae97eb21227034e306ca640912
class mySeq: def __init__(self): self.mseq = ['I','II','III','IV'] def __len__(self): return len(self.mseq) def __getitem__(self,key): if 0 <= key < 4 : return self.mseq[key] if __name__ == '__main__': m = mySeq() print('Len of mySeq : ',len(m)) for i in range(len(m.mseq)): print(m.mseq[i])
[ "class mySeq:\n\tdef __init__(self):\n\t\tself.mseq = ['I','II','III','IV']\n\n\tdef __len__(self):\n\t\treturn len(self.mseq)\n\n\tdef __getitem__(self,key):\n\t\tif 0 <= key < 4 :\n\t\t\treturn self.mseq[key]\n\nif __name__ == '__main__':\n\tm = mySeq()\n\tprint('Len of mySeq : ',len(m))\n\tfor i in range(len(m.m...
false
5,891
38184ed4117b1b7dcf9e135ce8612fa13c44a99c
i = 0 while i >= 0: a=input("Name is: ") print(a) if a == "Zeal": print("""Name_Zeal. Age_16. Interested in Programming.""") elif a=="HanZaw": print("""Name_Han Zaw. Age_18. Studying Code at Green Hacker.""") elif a == "Murphy": print("""Name_Murphy. ...
[ "i = 0\nwhile i >= 0: \n a=input(\"Name is: \")\n print(a)\n if a == \"Zeal\":\n print(\"\"\"Name_Zeal.\n Age_16.\n Interested in Programming.\"\"\")\n elif a==\"HanZaw\":\n print(\"\"\"Name_Han Zaw.\n Age_18.\n Studying Code at Green Hacker.\"\"\")\n elif a == \"Murphy\": ...
false
5,892
f39945f35b13c0918c3ef06224bca65ae6166ebc
import numpy as np a=np.array([1,2,3]) b=np.r_[np.repeat(a,3),np.tile(a,3)] print(b)
[ "import numpy as np\na=np.array([1,2,3])\nb=np.r_[np.repeat(a,3),np.tile(a,3)]\nprint(b)\n", "import numpy as np\na = np.array([1, 2, 3])\nb = np.r_[np.repeat(a, 3), np.tile(a, 3)]\nprint(b)\n", "<import token>\na = np.array([1, 2, 3])\nb = np.r_[np.repeat(a, 3), np.tile(a, 3)]\nprint(b)\n", "<import token>\n...
false
5,893
87a62f76027e0653f6966f76a42def2ce2a26ba3
#! /usr/bin/python3 print("content-type: text/html") print() import cgi import subprocess as sp import requests import xmltodict import json db = cgi.FieldStorage() ch=db.getvalue("ch") url =("http://www.regcheck.org.uk/api/reg.asmx/CheckIndia?RegistrationNumber={}&username=<username>" .format(ch)) u...
[ "#! /usr/bin/python3\r\n\r\nprint(\"content-type: text/html\")\r\nprint()\r\n\r\n\r\nimport cgi\r\nimport subprocess as sp\r\nimport requests\r\nimport xmltodict\r\nimport json\r\n\r\ndb = cgi.FieldStorage()\r\nch=db.getvalue(\"ch\")\r\nurl =(\"http://www.regcheck.org.uk/api/reg.asmx/CheckIndia?RegistrationNumber={...
false
5,894
1c6e6394a6bd26b152b2f5ec87eb181a3387f794
#!/usr/bin/python # Find minimal distances between clouds in one bin, average these per bin # Compute geometric and arithmetical mean between all clouds per bin from netCDF4 import Dataset as NetCDFFile from matplotlib import pyplot as plt import numpy as np from numpy import ma from scipy import stats from haversin...
[ "#!/usr/bin/python\n\n# Find minimal distances between clouds in one bin, average these per bin\n# Compute geometric and arithmetical mean between all clouds per bin\n\nfrom netCDF4 import Dataset as NetCDFFile\nfrom matplotlib import pyplot as plt\nimport numpy as np\nfrom numpy import ma\nfrom scipy import stats ...
true
5,895
1f0680c45afb36439c56a1d202537261df5f9afc
from eventnotipy import app import json json_data = open('eventnotipy/config.json') data = json.load(json_data) json_data.close() username = data['dbuser'] password = data['password'] host = data['dbhost'] db_name = data['database'] email_host = data['email_host'] email_localhost = data['email_localhost'] sms_host =...
[ "from eventnotipy import app\nimport json\n\njson_data = open('eventnotipy/config.json')\ndata = json.load(json_data)\njson_data.close()\n\nusername = data['dbuser']\npassword = data['password']\nhost = data['dbhost']\ndb_name = data['database']\n\nemail_host = data['email_host']\nemail_localhost = data['email_loca...
false
5,896
90324392e763ac6ea78c77b909c4bea667d45e6c
from admin_tools.dashboard.modules import DashboardModule from nodes.models import Node from slices.models import Slice class MyThingsDashboardModule(DashboardModule): """ Controller dashboard module to provide an overview to the user of the nodes and slices of its groups. """ title="My Things" ...
[ "from admin_tools.dashboard.modules import DashboardModule\n\nfrom nodes.models import Node\nfrom slices.models import Slice\n\nclass MyThingsDashboardModule(DashboardModule):\n \"\"\"\n Controller dashboard module to provide an overview to\n the user of the nodes and slices of its groups.\n \"\"\"\n ...
false
5,897
14e1af3d60efef842c72bf9b55143d0e14f3a7b8
import asyncio import json from functools import lru_cache from pyrogram import Client SETTINGS_FILE = "/src/settings.json" CONN_FILE = "/src/conn.json" def load_setting(setting: str): with open(SETTINGS_FILE) as f: return json.load(f)[setting] @lru_cache() def get_bot_name(): return load_setting(...
[ "import asyncio\nimport json\nfrom functools import lru_cache\n\nfrom pyrogram import Client\n\n\nSETTINGS_FILE = \"/src/settings.json\"\nCONN_FILE = \"/src/conn.json\"\n\ndef load_setting(setting: str):\n with open(SETTINGS_FILE) as f:\n return json.load(f)[setting]\n\n\n@lru_cache()\ndef get_bot_name():...
false
5,898
bf40b516e202af14469cd4012597ba412e663f56
import nltk import A from collections import defaultdict from nltk.align import Alignment, AlignedSent class BerkeleyAligner(): def __init__(self, align_sents, num_iter): self.t, self.q = self.train(align_sents, num_iter) # TODO: Computes the alignments for align_sent, using this model's parameters. Return...
[ "import nltk\nimport A\nfrom collections import defaultdict\nfrom nltk.align import Alignment, AlignedSent\n\nclass BerkeleyAligner():\n\n def __init__(self, align_sents, num_iter):\n\tself.t, self.q = self.train(align_sents, num_iter)\n\t\n # TODO: Computes the alignments for align_sent, using this model's p...
true
5,899
fbd7868a37a2270e5dc86843adff50a94436404d
from openvino.inference_engine import IENetwork, IECore import numpy as np import time from datetime import datetime import sys import os import cv2 class MotionDetect: # Klasse zur Erkennung von Bewegung def __init__(self): self.static_back = None def detect_motion(self, frame, reset=False): ...
[ "from openvino.inference_engine import IENetwork, IECore\nimport numpy as np\nimport time\nfrom datetime import datetime\nimport sys\nimport os\nimport cv2\n\n\nclass MotionDetect:\n # Klasse zur Erkennung von Bewegung\n def __init__(self):\n self.static_back = None\n\n def detect_motion(self, frame...
false