index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
8,600
e9659555938211d067919ee5e0083efb29d42d7b
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-05-22 00:19 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('classroom', '0003_remove_anouncements_classroom'), ] ...
[ "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-05-22 00:19\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('classroom', '0003_remove_anouncements_class...
false
8,601
2432e2b4da8af284055e7edf6e0bd94b7b293f0b
from __future__ import annotations from .base import * # noqa SECRET_KEY = "django-insecure-usp0sg081f=9+_j95j@-k^sfp+9c*!qrwh-m17%=_9^xot#9fn" DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql", "NAME": "puka-test", "USER": "jeff", "PASSWORD": "", "HOST...
[ "from __future__ import annotations\n\nfrom .base import * # noqa\n\nSECRET_KEY = \"django-insecure-usp0sg081f=9+_j95j@-k^sfp+9c*!qrwh-m17%=_9^xot#9fn\"\n\nDATABASES = {\n \"default\": {\n \"ENGINE\": \"django.db.backends.postgresql\",\n \"NAME\": \"puka-test\",\n \"USER\": \"jeff\",\n ...
false
8,602
7727896d4e1b2b415c398b206f9fb7e228e6f26d
# DO NOT EDIT THIS FILE! # # Python module managedElementManager generated by omniidl import omniORB omniORB.updateModule("managedElementManager") # ** 1. Stub files contributing to this module import managedElementManager_idl # ** 2. Sub-modules # ** 3. End
[ "# DO NOT EDIT THIS FILE!\n#\n# Python module managedElementManager generated by omniidl\n\nimport omniORB\nomniORB.updateModule(\"managedElementManager\")\n\n# ** 1. Stub files contributing to this module\nimport managedElementManager_idl\n\n# ** 2. Sub-modules\n\n# ** 3. End\n", "import omniORB\nomniORB.updateM...
false
8,603
9447d0d0481df3d0ee4273256d02977bc8044e4e
# -*- coding: utf-8 -*- """ python3 description :Fingerprint image enhancement by using gabor """ import os import cv2 import math import scipy import numpy as np from scipy import signal def normalise(img): normed = (img - np.mean(img)) / (np.std(img)) return normed def ridge_segment(im, blksze, thresh): ...
[ "# -*- coding: utf-8 -*-\n\"\"\"\npython3\ndescription :Fingerprint image enhancement by using gabor\n\"\"\"\nimport os\nimport cv2\nimport math\nimport scipy\nimport numpy as np\nfrom scipy import signal\n\n\ndef normalise(img):\n normed = (img - np.mean(img)) / (np.std(img))\n return normed\n\n\ndef ridge_s...
false
8,604
3b7c30718838a164eaf3aa12cd7b6a68930346f8
'''Mock classes that imitate idlelib modules or classes. Attributes and methods will be added as needed for tests. ''' from idlelib.idle_test.mock_tk import Text class Editor: '''Minimally imitate EditorWindow.EditorWindow class. ''' def __init__(self, flist=None, filename=None, key=None, root=None): ...
[ "'''Mock classes that imitate idlelib modules or classes.\n\nAttributes and methods will be added as needed for tests.\n'''\n\nfrom idlelib.idle_test.mock_tk import Text\n\nclass Editor:\n '''Minimally imitate EditorWindow.EditorWindow class.\n '''\n def __init__(self, flist=None, filename=None, key=None, ...
false
8,605
fc2748d766ebce8c9577f1eebc8435e2aa58ae25
import numpy as np import random import argparse import networkx as nx from gensim.models import Word2Vec from utils import read_node_label, plot_embeddings class node2vec_walk(): def __init__(self, nx_G, is_directed, p, q): self.G = nx_G self.is_directed = is_directed self.p = p ...
[ "\n\nimport numpy as np\nimport random\n\nimport argparse\nimport networkx as nx\nfrom gensim.models import Word2Vec\n\nfrom utils import read_node_label, plot_embeddings\n\nclass node2vec_walk():\n\n def __init__(self, nx_G, is_directed, p, q):\n self.G = nx_G\n self.is_directed = is_directed\n ...
false
8,606
3c8352ff2fc92ada1b58603df2a1a402e57842be
# coding: utf-8 from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Chrome() driver.get("https://www.baidu.com") elem = driver.find_element_by_xpath('//*[@id="kw"]') elem.send_keys("python selenium", Keys.ENTER) print(driver.page_source)
[ "# coding: utf-8\r\n\r\n\r\nfrom selenium import webdriver\r\nfrom selenium.webdriver.common.keys import Keys\r\n\r\ndriver = webdriver.Chrome()\r\ndriver.get(\"https://www.baidu.com\")\r\n\r\nelem = driver.find_element_by_xpath('//*[@id=\"kw\"]')\r\nelem.send_keys(\"python selenium\", Keys.ENTER)\r\n\r\nprint(driv...
false
8,607
7f62af951b49c3d1796c2811527ceb30ca931632
import pandas as pd from datetime import datetime from iFinDPy import * thsLogin = THS_iFinDLogin("iFind账号","iFind账号密码") index_list = ['000001.SH','399001.SZ','399006.SZ'] result = pd.DataFrame() today =datetime.today().strftime('%Y-%m-%d') for index in index_list: data_js = THS_DateSerial(index,'ths_pre_clo...
[ "import pandas as pd\nfrom datetime import datetime\nfrom iFinDPy import *\n\n\n\nthsLogin = THS_iFinDLogin(\"iFind账号\",\"iFind账号密码\")\n\n\nindex_list = ['000001.SH','399001.SZ','399006.SZ']\nresult = pd.DataFrame()\ntoday =datetime.today().strftime('%Y-%m-%d')\n\nfor index in index_list: \n data_js = THS_DateSe...
false
8,608
465d5baae8d5be77fbf3d550d10667da420a8fbe
import sys sys.path.append("../") import numpy as np import tensorflow as tf from utils import eval_accuracy_main_cdan from models import mnist2mnistm_shared_discrepancy, mnist2mnistm_predictor_discrepancy import keras import argparse import pickle as pkl parser = argparse.ArgumentParser(description='Traini...
[ "import sys\r\nsys.path.append(\"../\")\r\nimport numpy as np\r\nimport tensorflow as tf\r\nfrom utils import eval_accuracy_main_cdan\r\nfrom models import mnist2mnistm_shared_discrepancy, mnist2mnistm_predictor_discrepancy\r\nimport keras\r\nimport argparse\r\nimport pickle as pkl \r\n\r\nparser = argparse.Argumen...
false
8,609
09905d4b5ad2e59578d874db171aafb6c42db105
# Given an unsorted integer array nums, find the smallest missing positive integer. class Solution: def firstMissingPositive(self, nums: List[int]) -> int: # if nums is emtpy, first pos int is 1 if not nums: return 1 maxnum = max(nums) # for speed we assign max of nums to var max...
[ "# Given an unsorted integer array nums, find the smallest missing positive integer.\nclass Solution:\n def firstMissingPositive(self, nums: List[int]) -> int:\n # if nums is emtpy, first pos int is 1\n if not nums:\n return 1\n maxnum = max(nums) # for speed we assign max of nums...
false
8,610
45d57f8392b89776f9349c32b4bb2fa71a4aaa83
# -*- coding: utf-8 -*- """ A customised logger for this project for logging to the file and console Created on 29/07/2022 @author: PNimbhore """ # imports import os import logging class Logger: """ A custom logger which will take care of logging to console and file. """ def __init__(self, filepat...
[ "# -*- coding: utf-8 -*-\n\"\"\"\nA customised logger for this project for logging to the file and console\nCreated on 29/07/2022\n@author: PNimbhore\n\"\"\"\n# imports\nimport os\nimport logging\n\n\nclass Logger:\n \"\"\"\n A custom logger which will take care\n of logging to console and file.\n \"\"\...
false
8,611
530ec3df27cc4c8f0798566f0c66cfbffe510786
import os import subprocess import sys import time # print sys.argv start = time.time() subprocess.call(sys.argv[1:], shell=True) stop = time.time() print "\nTook %.1f seconds" % (stop - start)
[ "import os\r\nimport subprocess\r\nimport sys\r\nimport time\r\n\r\n# print sys.argv\r\nstart = time.time()\r\nsubprocess.call(sys.argv[1:], shell=True)\r\nstop = time.time()\r\nprint \"\\nTook %.1f seconds\" % (stop - start)\r\n" ]
true
8,612
02c32cf04529ff8b5edddf4e4117f8c4fdf27da9
class Formater(): def clean_number (posible_number): sanitize_number = posible_number.replace(' ', '') number_of_dots = sanitize_number.count('.') if number_of_dots > 1: return None if number_of_dots == 1: dot_position = sanitize_number.index('.') ...
[ "class Formater():\n def clean_number (posible_number):\n sanitize_number = posible_number.replace(' ', '')\n number_of_dots = sanitize_number.count('.')\n\n if number_of_dots > 1:\n return None\n if number_of_dots == 1:\n dot_position = sanitize_number.index('.'...
false
8,613
2ccc3bb63445572610f6dbdfe5b1cbeef506c9a9
from pygraphblas.matrix import Matrix from pygraphblas.types import BOOL from pyformlang.regular_expression import Regex class Graph: def __init__(self): self.n_vertices = 0 self.label_matrices = dict() self.start_vertices = set() self.final_vertices = set() def from_trans(self...
[ "from pygraphblas.matrix import Matrix\nfrom pygraphblas.types import BOOL\nfrom pyformlang.regular_expression import Regex\n\nclass Graph:\n def __init__(self):\n self.n_vertices = 0\n self.label_matrices = dict()\n self.start_vertices = set()\n self.final_vertices = set()\n\n def...
false
8,614
55acae8129ddaba9a860d5d356e91f40607ac95a
def func(n): return n*2 def my_map(f, seq): return [f(item) for item in seq] def main(): numbers = [1, 2, 3, 4] result = list(map(func, numbers)) print(result) result = [func(item) for item in numbers] print(result) if __name__ == '__main__': main()
[ "def func(n):\n return n*2\n\ndef my_map(f, seq):\n return [f(item) for item in seq]\n\ndef main():\n numbers = [1, 2, 3, 4]\n result = list(map(func, numbers))\n print(result)\n\n result = [func(item) for item in numbers]\n print(result)\n\n\nif __name__ == '__main__':\n main()\n", "def f...
false
8,615
acd2d84529e197d6f9d134e8d7e25a51a442f3ae
# MÁSTER EN BIG DATA Y BUSINESS ANALYTICS # MOD 1 - FINAL EVALUATION - EX. 2: dado un archivo que contiene en cada línea # una palabra o conjunto de palabras seguido de un valor numérico denominado # “sentimiento” y un conjunto de tweets, se pide calcular el sentimiento de # aquellas palabras o conjunto de palabras que...
[ "# MÁSTER EN BIG DATA Y BUSINESS ANALYTICS\n# MOD 1 - FINAL EVALUATION - EX. 2: dado un archivo que contiene en cada línea\n# una palabra o conjunto de palabras seguido de un valor numérico denominado\n# “sentimiento” y un conjunto de tweets, se pide calcular el sentimiento de\n# aquellas palabras o conjunto de pal...
false
8,616
c485466a736fa0a4f183092e561a27005c01316d
import pylab,numpy as np from numpy import sin from matplotlib.patches import FancyArrowPatch fig=pylab.figure() w=1 h=1 th=3.14159/25. x=np.r_[0,0,w,w,0] y=np.r_[0,h,h-w*sin(th),0-w*sin(th),0] pylab.plot(x,y) x=np.r_[0,0,w/2.0,w/2.0,0] y=np.r_[0,h/6.0,h/6.0-w/2.0*sin(th),0-w/2.0*sin(th),0] pylab.plot(x...
[ "import pylab,numpy as np\r\nfrom numpy import sin\r\nfrom matplotlib.patches import FancyArrowPatch\r\n\r\nfig=pylab.figure()\r\nw=1\r\nh=1\r\nth=3.14159/25.\r\nx=np.r_[0,0,w,w,0]\r\ny=np.r_[0,h,h-w*sin(th),0-w*sin(th),0]\r\npylab.plot(x,y)\r\n\r\nx=np.r_[0,0,w/2.0,w/2.0,0]\r\ny=np.r_[0,h/6.0,h/6.0-w/2.0*sin(th),0...
false
8,617
4e6e4917aee2385fe118d6e58c359a4c9fc50943
# -*- coding: utf-8 -*- ''' File Name: bubustatus/utils.py Author: JackeyGao mail: junqi.gao@shuyun.com Created Time: 一 9/14 12:51:37 2015 ''' from rest_framework.views import exception_handler def custom_exception_handler(exc, context): # Call REST framework's default exception handler first, # to get the st...
[ "# -*- coding: utf-8 -*-\n'''\nFile Name: bubustatus/utils.py\nAuthor: JackeyGao\nmail: junqi.gao@shuyun.com\nCreated Time: 一 9/14 12:51:37 2015\n'''\nfrom rest_framework.views import exception_handler\n\ndef custom_exception_handler(exc, context):\n # Call REST framework's default exception handler first,\n ...
false
8,618
c65969bba72142f4a328f978d78e0235cd56e393
from huobi import RequestClient from huobi.constant.test import * request_client = RequestClient(api_key=g_api_key, secret_key=g_secret_key) obj_list = request_client.get_cross_margin_loan_orders() if len(obj_list): for obj in obj_list: obj.print_object() print() ...
[ "from huobi import RequestClient\r\nfrom huobi.constant.test import *\r\n\r\n\r\nrequest_client = RequestClient(api_key=g_api_key, secret_key=g_secret_key)\r\nobj_list = request_client.get_cross_margin_loan_orders()\r\nif len(obj_list):\r\n for obj in obj_list:\r\n obj.print_object()\r\n print()\r\...
false
8,619
4e538251dedfe0b9ffb68de2de7dc50681320f1f
# # @lc app=leetcode id=267 lang=python3 # # [267] Palindrome Permutation II # # https://leetcode.com/problems/palindrome-permutation-ii/description/ # # algorithms # Medium (33.28%) # Total Accepted: 24.8K # Total Submissions: 74.4K # Testcase Example: '"aabb"' # # Given a string s, return all the palindromic perm...
[ "#\n# @lc app=leetcode id=267 lang=python3\n#\n# [267] Palindrome Permutation II\n#\n# https://leetcode.com/problems/palindrome-permutation-ii/description/\n#\n# algorithms\n# Medium (33.28%)\n# Total Accepted: 24.8K\n# Total Submissions: 74.4K\n# Testcase Example: '\"aabb\"'\n#\n# Given a string s, return all ...
true
8,620
1b71789ba7c2191b433a405723fe6c985c926610
# Generated by Django 2.2.6 on 2020-04-06 16:47 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='User', fie...
[ "# Generated by Django 2.2.6 on 2020-04-06 16:47\r\n\r\nfrom django.db import migrations, models\r\nimport django.db.models.deletion\r\n\r\n\r\nclass Migration(migrations.Migration):\r\n\r\n initial = True\r\n\r\n dependencies = [\r\n ]\r\n\r\n operations = [\r\n migrations.CreateModel(\r\n ...
false
8,621
dfe7f0e25f340601886334c61a50806491a4ae2b
"""Tests for our `neo login` subcommand.""" import pytest import os from neo.libs import login from neo.libs import utils class TestAuth: @pytest.mark.run(order=0) def test_do_login(self, monkeypatch): login.load_env_file() username = os.environ.get('OS_USERNAME') passwd = os.environ.g...
[ "\"\"\"Tests for our `neo login` subcommand.\"\"\"\n\nimport pytest\nimport os\nfrom neo.libs import login\nfrom neo.libs import utils\n\nclass TestAuth:\n @pytest.mark.run(order=0)\n def test_do_login(self, monkeypatch):\n login.load_env_file()\n username = os.environ.get('OS_USERNAME')\n ...
false
8,622
a4eca0f5b7d5a03ca3600554ae3fe3b94c59fc68
from os import environ from process import process from s3Service import put_object environ['ACCESS_KEY'] = '1234567890' environ['SECRET_KEY'] = '1234567890' environ['ENDPOINT_URL'] = 'http://localhost:4566' environ['REGION'] = 'us-east-1' environ['BUCKET_GLOBAL'] = 'fl2-statement-global' environ['BUCKET_GLOBAL_BACKUP...
[ "from os import environ\nfrom process import process\nfrom s3Service import put_object\n\nenviron['ACCESS_KEY'] = '1234567890'\nenviron['SECRET_KEY'] = '1234567890'\nenviron['ENDPOINT_URL'] = 'http://localhost:4566'\nenviron['REGION'] = 'us-east-1'\nenviron['BUCKET_GLOBAL'] = 'fl2-statement-global'\nenviron['BUCKET...
false
8,623
09b2c1e69203f440754e82506b42e7856c94639a
from robotcar import RobotCar import pdb class RobotCar_Stub(RobotCar): def forward(self): print("Forward") def backward(self): print("Backward") def left(self): print("Left") def right(self): print("Right") def stop(self): print("Stop") if __name__ == '__main__': ...
[ "from robotcar import RobotCar\nimport pdb\n\nclass RobotCar_Stub(RobotCar):\n\n def forward(self):\n print(\"Forward\")\n \n def backward(self):\n print(\"Backward\")\n \n def left(self):\n print(\"Left\")\n \n def right(self):\n print(\"Right\")\n \n def stop(self):\n print(\"Stop\...
false
8,624
27e66b2a03bc626d5babd804e736a4652ba030d5
#!/usr/bin/python2 import unittest import luna_utils as luna import time API_URL = "com.webos.service.videooutput/" VERBOSE_LOG = True SUPPORT_REGISTER = False SINK_MAIN = "MAIN" SINK_SUB = "SUB0" #TODO(ekwang): If you connect SUB, HAL error occurs. Just test MAIN in the current state #SINK_LIST = [SINK_MAIN, SINK_...
[ "#!/usr/bin/python2\nimport unittest\nimport luna_utils as luna\nimport time\n\nAPI_URL = \"com.webos.service.videooutput/\"\n\nVERBOSE_LOG = True\nSUPPORT_REGISTER = False\n\nSINK_MAIN = \"MAIN\"\nSINK_SUB = \"SUB0\"\n\n#TODO(ekwang): If you connect SUB, HAL error occurs. Just test MAIN in the current state\n#SINK...
false
8,625
49b007b723b9c43fb79d5dffa2546c856faf4937
# _*_ coding:utf-8 _*_ from __future__ import unicode_literals from django.db import models from django.core.urlresolvers import reverse # Create your models here. # 本文件中,用__unicode__代替了__str__,以免在admin界面中显示中文而引发错误。 # 参考:http://blog.csdn.net/jiangnanandi/article/details/3574007 # 或者另一个解决方案:http://blog.sina.com.cn/s...
[ "# _*_ coding:utf-8 _*_\nfrom __future__ import unicode_literals\n\nfrom django.db import models\nfrom django.core.urlresolvers import reverse \n# Create your models here.\n\n\n# 本文件中,用__unicode__代替了__str__,以免在admin界面中显示中文而引发错误。\n# 参考:http://blog.csdn.net/jiangnanandi/article/details/3574007\n# 或者另一个解决方案:http://blo...
false
8,626
45b2b611a80b93c9a7d8ec8a09e5838147e1ea76
# Generated by Django 3.0.2 on 2020-08-27 16:03 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('info', '0010_auto_20200808_2117'), ] operations = [ migrations.AddField( model_name='profile', name='annual_income',...
[ "# Generated by Django 3.0.2 on 2020-08-27 16:03\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('info', '0010_auto_20200808_2117'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='profile',\n na...
false
8,627
5fe4f2738285d2f4b8bbfee2c4c6d15665737ea4
from django.urls import path from .views import * urlpatterns = [ path('', ListUser.as_view() , name = 'list'), path('register/', UserRegister.as_view() , name = 'register'), path('login/', UserLogin.as_view() , name = 'login'), path('delete/' , UserDelete.as_view() , name ='delete'), path('update/...
[ "from django.urls import path\nfrom .views import *\n\nurlpatterns = [\n path('', ListUser.as_view() , name = 'list'),\n path('register/', UserRegister.as_view() , name = 'register'),\n path('login/', UserLogin.as_view() , name = 'login'),\n path('delete/' , UserDelete.as_view() , name ='delete'),\n ...
false
8,628
d3b6a105b14d9c3485a71058391a03c2f4aa5c10
import pickle as pickle import os import pandas as pd import torch import numpy as np import random from sklearn.metrics import accuracy_score from transformers import XLMRobertaTokenizer, XLMRobertaForSequenceClassification, Trainer, TrainingArguments, XLMRobertaConfig, ElectraForSequenceClassification, Electra...
[ "import pickle as pickle\r\nimport os\r\nimport pandas as pd\r\nimport torch\r\nimport numpy as np\r\nimport random\r\nfrom sklearn.metrics import accuracy_score\r\nfrom transformers import XLMRobertaTokenizer, XLMRobertaForSequenceClassification, Trainer, TrainingArguments, XLMRobertaConfig, ElectraForSequenceClas...
false
8,629
5f56838ad0717c4f7a2da6b53f586a88b0166113
from django.urls import path from . import apiviews from rest_framework.authtoken.views import obtain_auth_token urlpatterns = [ path('contacts', apiviews.ContactsView.as_view(), name='contacts'), path('contact/<int:pk>', apiviews.ContactView.as_view(), name='contact'), path('signup', apiviews.create_user...
[ "from django.urls import path\nfrom . import apiviews\nfrom rest_framework.authtoken.views import obtain_auth_token\n\n\nurlpatterns = [\n path('contacts', apiviews.ContactsView.as_view(), name='contacts'),\n path('contact/<int:pk>', apiviews.ContactView.as_view(), name='contact'),\n path('signup', apiview...
false
8,630
fa5cbbd03641d2937e4502ce459d64d20b5ee227
import matplotlib.pyplot as plt import numpy as np from tti_explorer.contacts import he_infection_profile plt.style.use('default') loc = 0 # taken from He et al gamma_params = { 'a': 2.11, 'loc': loc, 'scale': 1/0.69 } t = 10 days = np.arange(t) mass = he_infection_profile(t, gamma_params) fig, ax = pl...
[ "\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom tti_explorer.contacts import he_infection_profile\n\nplt.style.use('default')\nloc = 0\n# taken from He et al\ngamma_params = {\n 'a': 2.11,\n 'loc': loc,\n 'scale': 1/0.69\n}\nt = 10\ndays = np.arange(t)\n\nmass = he_infection_profile(t, gamma...
false
8,631
9a62a57f6d9af7ef09c8ed6e78a100df7978da6e
ID = '113' TITLE = 'Path Sum II' DIFFICULTY = 'Medium' URL = 'https://oj.leetcode.com/problems/path-sum-ii/' BOOK = False PROBLEM = r"""Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and `sum = 22`, ...
[ "ID = '113'\nTITLE = 'Path Sum II'\nDIFFICULTY = 'Medium'\nURL = 'https://oj.leetcode.com/problems/path-sum-ii/'\nBOOK = False\nPROBLEM = r\"\"\"Given a binary tree and a sum, find all root-to-leaf paths where each path's\nsum equals the given sum.\n\nFor example: \nGiven the below binary tree and `sum = 22`,\n\n ...
false
8,632
492c416becc44deaafef519eae8c9a82ac00cc0e
#!/usr/bin/python import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) ledPin = 4 pinOn = False GPIO.setup(ledPin, GPIO.OUT) GPIO.output(ledPin, GPIO.LOW) def print_pin_status(pin_number): GPIO.setup(pin_number, GPIO.IN) value = GPIO.input(pin_number) print(f'Current Value of {pin_number} is {value}') G...
[ "#!/usr/bin/python\n\nimport RPi.GPIO as GPIO\n\nGPIO.setmode(GPIO.BCM)\n\nledPin = 4\npinOn = False\n\nGPIO.setup(ledPin, GPIO.OUT)\nGPIO.output(ledPin, GPIO.LOW)\n\n\ndef print_pin_status(pin_number):\n GPIO.setup(pin_number, GPIO.IN)\n value = GPIO.input(pin_number)\n print(f'Current Value of {pin_numbe...
false
8,633
61232ec951cf378798220c00280ef2d351088d06
import random #liste de choix possibles liste = ["rock", "paper", "scissors"] #si le joueur veut jouer il répond y answer = "y" while answer == "y": #choix du joueur user_choice = input("rock,paper,scissors ?") #verifie si le joueur a mis la réponse correcte if user_choice in liste : #choix d...
[ "import random\n\n#liste de choix possibles\nliste = [\"rock\", \"paper\", \"scissors\"]\n\n#si le joueur veut jouer il répond y\nanswer = \"y\"\nwhile answer == \"y\":\n #choix du joueur\n user_choice = input(\"rock,paper,scissors ?\")\n\n #verifie si le joueur a mis la réponse correcte\n if user_choic...
false
8,634
bf7676dc2c47d9cd2f1ce2d436202ae2c5061265
from .base import GnuRecipe class CAresRecipe(GnuRecipe): def __init__(self, *args, **kwargs): super(CAresRecipe, self).__init__(*args, **kwargs) self.sha256 = '45d3c1fd29263ceec2afc8ff9cd06d5f' \ '8f889636eb4e80ce3cc7f0eaf7aadc6e' self.name = 'c-ares' self.ve...
[ "from .base import GnuRecipe\n\n\nclass CAresRecipe(GnuRecipe):\n def __init__(self, *args, **kwargs):\n super(CAresRecipe, self).__init__(*args, **kwargs)\n self.sha256 = '45d3c1fd29263ceec2afc8ff9cd06d5f' \\\n '8f889636eb4e80ce3cc7f0eaf7aadc6e'\n self.name = 'c-ares'\n...
false
8,635
f28222625e28939b34b1b5c21d28dbf9c49c6374
import knn datingDataMat,datingLabels = knn.file2matrix('datingTestSet2.txt') normMat,ranges,minVals = knn.autoNorm(datingDataMat) print normMat print ranges print minVals
[ "import knn\n\ndatingDataMat,datingLabels = knn.file2matrix('datingTestSet2.txt')\nnormMat,ranges,minVals = knn.autoNorm(datingDataMat)\n\nprint normMat\nprint ranges\nprint minVals" ]
true
8,636
e01b1f57a572571619d6c0981370030dc6105fd2
import urllib.request import urllib.parse import json content = input("请输入需要翻译的内容:") url = 'http://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule' data = {} data['action'] = 'FY_BY_CLICKBUTTION' data['bv'] = '1ca13a5465c2ab126e616ee8d6720cc3' data['client'] = 'fanyideskweb' data['doctype'] = 'json' dat...
[ "import urllib.request\nimport urllib.parse\nimport json\n\ncontent = input(\"请输入需要翻译的内容:\")\n\nurl = 'http://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule'\n\ndata = {}\ndata['action'] = 'FY_BY_CLICKBUTTION'\ndata['bv'] = '1ca13a5465c2ab126e616ee8d6720cc3'\ndata['client'] = 'fanyideskweb'\ndata['doc...
false
8,637
c34ff2bbb0ba743268ace77c110ce0b283a25eba
f=open('p102_triangles.txt') def cross(a,b,c): t1=b[0]-a[0] t2=b[1]-a[1] t3=c[0]-a[0] t4=c[1]-a[1] return t1*t4-t2*t3 x=[0,0] y=[0,0] z=[0,0] origin=(0,0) ans=0 for i in f.xreadlines(): x[0],x[1],y[0],y[1],z[0],z[1]=map(int,i.split(',')) area1=abs(cross(x,y,z)) area2=abs(cross(x,y,orig...
[ "f=open('p102_triangles.txt')\n\ndef cross(a,b,c):\n t1=b[0]-a[0]\n t2=b[1]-a[1]\n t3=c[0]-a[0]\n t4=c[1]-a[1]\n return t1*t4-t2*t3\n\nx=[0,0]\ny=[0,0]\nz=[0,0]\norigin=(0,0)\nans=0\nfor i in f.xreadlines():\n x[0],x[1],y[0],y[1],z[0],z[1]=map(int,i.split(','))\n area1=abs(cross(x,y,z))\n ar...
true
8,638
47587cce572807922344523d8c5fefb09552fe34
import urllib, json from PyQt4.QtCore import QRectF, Qt from PyQt4.Qt import QPrinter, QPainter, QFont, QBrush, QColor, QPen, QImage from PyQt4.QtGui import QApplication # bkgimg = QImage() # bkgimg.load("KosyMost.jpg", format = "jpg") # # print bkgimg # exit() def background(painter, bkgimg): maxx = painter.d...
[ "import urllib, json\nfrom PyQt4.QtCore import QRectF, Qt\nfrom PyQt4.Qt import QPrinter, QPainter, QFont, QBrush, QColor, QPen, QImage\nfrom PyQt4.QtGui import QApplication\n\n\n# bkgimg = QImage()\n# bkgimg.load(\"KosyMost.jpg\", format = \"jpg\")\n# \n# print bkgimg\n# exit()\n\ndef background(painter, bkgimg):...
true
8,639
75833617996549167fa157ff78cc1a11f870784f
import os import sys import glob import shutil import json import codecs from collections import OrderedDict def getRegionClass(image_path, data_id, imgName): region_class = ['nosmoke_background', 'nosmoke_face', 'nosmoke_suspect', 'nosmoke_cover', 'smoke_hand', 'smoke_nohand', 'smoke_hard'] label_class = ['nosmok...
[ "import os\nimport sys\nimport glob\nimport shutil\nimport json\nimport codecs\nfrom collections import OrderedDict\n\ndef getRegionClass(image_path, data_id, imgName):\n region_class = ['nosmoke_background', 'nosmoke_face', 'nosmoke_suspect', 'nosmoke_cover', 'smoke_hand', 'smoke_nohand', 'smoke_hard']\n label_c...
false
8,640
894d8d00fd05bf8648f1b95ecf30b70e7b4e841b
#Copyright [2017] [Mauro Riva <lemariva@mail.com> <lemariva.com>] #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 ...
[ "#Copyright [2017] [Mauro Riva <lemariva@mail.com> <lemariva.com>]\n\n#Licensed under the Apache License, Version 2.0 (the \"License\");\n#you may not use this file except in compliance with the License.\n#You may obtain a copy of the License at\n\n#http://www.apache.org/licenses/LICENSE-2.0\n\n#Unless required by ...
false
8,641
8f17c1ed0cb273a88b986cd7fe7a45439211d536
### Global parameters ### seconds_per_unit_time = 0.01 ######################### pars_spont = { "tau_p": 2.5, "tau_d": 5.0, "amp_p": 0.08, "amp_d": -0.0533, "rho": 0.0015, "N": 50, "w_max": 0.05, "mu": 0.07, "seed": None, "tend": 50_000_000, "r_in": 0.04, "w_in": 0.05,...
[ "### Global parameters ###\n\nseconds_per_unit_time = 0.01\n\n#########################\n\npars_spont = {\n \"tau_p\": 2.5,\n \"tau_d\": 5.0,\n \"amp_p\": 0.08,\n \"amp_d\": -0.0533,\n \"rho\": 0.0015,\n \"N\": 50,\n \"w_max\": 0.05,\n \"mu\": 0.07,\n \"seed\": None,\n \"tend\": 50_000...
false
8,642
7b5a16fdc536eb4ae3fdc08f827663613560187a
import subprocess from whoosh.index import create_in from whoosh.fields import * import os import codecs from whoosh.qparser import QueryParser import whoosh.index as index import json from autosub.autosub import autosub from azure.storage.blob import AppendBlobService vedio_formats = ['mp4','avi','wmv','mov'] # 1 aud...
[ "import subprocess\nfrom whoosh.index import create_in\nfrom whoosh.fields import *\nimport os\nimport codecs\nfrom whoosh.qparser import QueryParser\nimport whoosh.index as index\nimport json\nfrom autosub.autosub import autosub\nfrom azure.storage.blob import AppendBlobService\n\nvedio_formats = ['mp4','avi','wmv...
true
8,643
b1b9840fabc96c901e5ed45e22ee63af2f3550cb
from os import listdir from os.path import isfile, join import sys cat_list = dict(); def onImport(): mypath = "../../data/roget_processed"; onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]; for f_name in onlyfiles: f_temp = open(mypath + "/" + f_name); f_lines = f_temp.readlines(); for l...
[ "\nfrom os import listdir\nfrom os.path import isfile, join\nimport sys\n\ncat_list = dict();\n\ndef onImport():\n\tmypath = \"../../data/roget_processed\";\n\tonlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))];\n\tfor f_name in onlyfiles:\n\t\tf_temp = open(mypath + \"/\" + f_name);\n\t\tf_lines =...
false
8,644
85bc304c69dac8bb570f920f9f12f558f4844c49
listtuple = [(1,2), (2,3), (3,4), (4,5)] dictn = dict(listtuple) print(dictn)
[ "listtuple = [(1,2), (2,3), (3,4), (4,5)]\ndictn = dict(listtuple)\nprint(dictn)", "listtuple = [(1, 2), (2, 3), (3, 4), (4, 5)]\ndictn = dict(listtuple)\nprint(dictn)\n", "<assignment token>\nprint(dictn)\n", "<assignment token>\n<code token>\n" ]
false
8,645
dce6ef64cf1a758ed25e11f626ce31206d18f960
import os from matplotlib import pyplot as plt from matplotlib import colors import numpy as np class figure: def __init__(self, dire, dpi, span, data, CIM, learn_loss=None, eval_loss=None, different_dir_app=True, reference_steps=0, reveal_trend=1): self.dire = self.new_num_directory(di...
[ "import os\nfrom matplotlib import pyplot as plt\nfrom matplotlib import colors\nimport numpy as np\n\n\nclass figure:\n\n def __init__(self, dire, dpi, span, data, CIM,\n learn_loss=None, eval_loss=None, different_dir_app=True, reference_steps=0, reveal_trend=1):\n\n self.dire = self.new_...
false
8,646
4e31619efcaf6eeab3b32116b21e71de8202aee2
from framework import * from pebble_game import * from constructive_pebble_game import * from nose.tools import ok_ import numpy as np # initialise the seed for reproducibility np.random.seed(102) fw_2d = create_framework([0,1,2,3], [(0,1), (0,3), (1,2), (1,3), (2,3)], [(2,3), (4,4), (5,2), (1,1)]) # a 3d fw constric...
[ "from framework import *\nfrom pebble_game import *\nfrom constructive_pebble_game import *\nfrom nose.tools import ok_\nimport numpy as np\n\n# initialise the seed for reproducibility np.random.seed(102)\n\nfw_2d = create_framework([0,1,2,3], [(0,1), (0,3), (1,2), (1,3), (2,3)], [(2,3), (4,4), (5,2), (1,1)])\n# a ...
false
8,647
24274dddbeb1be743cfcac331ee688d48c9a46dd
import requests from bs4 import BeautifulSoup ''' OCWから学院一覧を取得するスクリプト(6個くらいだから必要ない気もする) gakuinListの各要素は次のような辞書に鳴っている { 'name' : 学院名, 'url' : その学院の授業の一覧のurl, } ''' def getGakuinList(): url = "http://www.ocw.titech.ac.jp/" response = requests.get(url) soup = BeautifulSoup(response.content,"lxml") topMainNav = sou...
[ "import requests\nfrom bs4 import BeautifulSoup\n\n'''\nOCWから学院一覧を取得するスクリプト(6個くらいだから必要ない気もする)\ngakuinListの各要素は次のような辞書に鳴っている\n{\n\t'name' : 学院名,\n\t'url' : その学院の授業の一覧のurl,\n}\n'''\ndef getGakuinList():\n\turl = \"http://www.ocw.titech.ac.jp/\"\n\tresponse = requests.get(url)\n\tsoup = BeautifulSoup(response.content,...
false
8,648
4293ad0b2a4a352d6bdc4b860448c4a3b14ca629
import torch from torchvision import transforms from torch.autograd import Variable class NormalizeImageDict(object): """ Normalize image in dictionary normalize range is True, the image is divided by 255 """ def __init__(self,image_keys, normalizeRange=True): self.image_keys = image_keys ...
[ "import torch\nfrom torchvision import transforms\nfrom torch.autograd import Variable\n\nclass NormalizeImageDict(object):\n \"\"\"\n Normalize image in dictionary\n normalize range is True, the image is divided by 255\n \"\"\"\n def __init__(self,image_keys, normalizeRange=True):\n self.imag...
false
8,649
b1dce573e6da81c688b338277af214838bbab9dd
def simple_formatter(zipcode: str, address: str) -> str: return f'{zipcode}は「{address}」です'
[ "def simple_formatter(zipcode: str, address: str) -> str:\n\n return f'{zipcode}は「{address}」です'\n\n\n", "def simple_formatter(zipcode: str, address: str) ->str:\n return f'{zipcode}は「{address}」です'\n", "<function token>\n" ]
false
8,650
16dd73f2c85eff8d62cf0e605489d0db1616e36e
# Copyright The Linux Foundation and each contributor to CommunityBridge. # SPDX-License-Identifier: MIT """ Holds the AWS SNS email service that can be used to send emails. """ import boto3 import os import cla import uuid import json import datetime from cla.models import email_service_interface region = os.enviro...
[ "# Copyright The Linux Foundation and each contributor to CommunityBridge.\n# SPDX-License-Identifier: MIT\n\n\"\"\"\nHolds the AWS SNS email service that can be used to send emails.\n\"\"\"\n\nimport boto3\nimport os\nimport cla\nimport uuid\nimport json\nimport datetime\nfrom cla.models import email_service_inter...
false
8,651
d508cb0a8d4291f1c8e76d9d720be352c05ef146
""" Given a list of partitioned and sentiment-analyzed tweets, run several trials to guess who won the election """ import json import math import sys import pprint import feature_vector def positive_volume(f): return f['relative_volume'] * f['positive_percent'] def inv_negative_volume(f): return 1.0 - f['r...
[ "\"\"\"\nGiven a list of partitioned and sentiment-analyzed tweets, run several trials\nto guess who won the election\n\"\"\"\n\nimport json\nimport math\nimport sys\nimport pprint\n\nimport feature_vector\n\ndef positive_volume(f):\n return f['relative_volume'] * f['positive_percent']\n\ndef inv_negative_volume...
false
8,652
2b3a42fed98b43cdd78edd751b306ba25328061a
import PyPDF2 from pathlib import Path def get_filenames(): """ Get PDF files not yet reordered in the current directory :return: list of PDF file names """ filenames = [] for filename in Path('.').glob('*.pdf'): if 'reordered' not in filename.stem: filenames.append(filenam...
[ "import PyPDF2\nfrom pathlib import Path\n\n\ndef get_filenames():\n \"\"\"\n Get PDF files not yet reordered in the current directory\n :return: list of PDF file names\n \"\"\"\n filenames = []\n for filename in Path('.').glob('*.pdf'):\n if 'reordered' not in filename.stem:\n f...
false
8,653
f0c082968e26d414b0dbb679d4e5077056e99979
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import xmlrunner import os import sys import glob import yaml ASSETS_DIR = "" class GenerateMachineConfig(unittest.TestCase): def setUp(self): self.machine_configs = [] for machine_config_path in glob.glob( f'{ASSETS_D...
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport unittest\nimport xmlrunner\n\nimport os\nimport sys\nimport glob\nimport yaml\n\nASSETS_DIR = \"\"\n\nclass GenerateMachineConfig(unittest.TestCase):\n def setUp(self):\n self.machine_configs = []\n for machine_config_path in glob.glob(\n ...
false
8,654
c5bdbcc8ba38b02e5e5cf8b53362e87ba761443d
from django.db import models # Create your models here. class Advertisement(models.Model): title = models.CharField(max_length=1500, db_index=True, verbose_name='Заголовок') description = models.TextField(blank=True) created_at = models.DateTimeField(auto_now_add=True) update_at = models.DateTimeFiel...
[ "from django.db import models\n\n# Create your models here.\n\n\nclass Advertisement(models.Model):\n title = models.CharField(max_length=1500, db_index=True, verbose_name='Заголовок')\n description = models.TextField(blank=True)\n created_at = models.DateTimeField(auto_now_add=True)\n update_at = model...
false
8,655
b84b3206e87176feee2c39fc0866ada994c9ac7a
from django.shortcuts import render from PIL import Image from django.views.decorators import csrf import numpy as np import re import sys import os from .utils import * from django.http import JsonResponse from django.views.decorators.csrf import csrf_exempt import base64 sys.path.append(os.path.abspath("./models")) O...
[ "from django.shortcuts import render\nfrom PIL import Image\nfrom django.views.decorators import csrf\nimport numpy as np\nimport re\nimport sys\nimport os\nfrom .utils import *\nfrom django.http import JsonResponse\nfrom django.views.decorators.csrf import csrf_exempt\nimport base64\nsys.path.append(os.path.abspat...
false
8,656
19962e94afdd3edf298b28b9954f479fefa3bba8
#1. Create a greeting for your program. print("Welcome to the Band Name Generator") #2. Ask the user for the city that they grew up in. city = input("Which city did you grew up in?\n") #3. Ask the user for the name of a pet. pet = input("What is the name of the pet?\n") #4. Combine the name of their city and pet an...
[ "#1. Create a greeting for your program.\nprint(\"Welcome to the Band Name Generator\")\n\n#2. Ask the user for the city that they grew up in.\ncity = input(\"Which city did you grew up in?\\n\")\n\n#3. Ask the user for the name of a pet.\npet = input(\"What is the name of the pet?\\n\")\n\n#4. Combine the name of...
false
8,657
129df937d7d295bae2009cfb65b2f85228206698
# !/usr/bin/env python3 # -*- coding: UTF-8 -*- # Copyright (c) 2021 Baidu, Inc. 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/LI...
[ "# !/usr/bin/env python3\n# -*- coding: UTF-8 -*-\n# Copyright (c) 2021 Baidu, Inc. 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....
false
8,658
bb6d6061365fad809448d09a1c031b984423b5e0
__author__ = 'liwenchang' #-*- coding:utf-8 -*- import os import time import win32api, win32pdhutil, win32con, win32com.client import win32pdh, string def check_exsit(process_name): WMI = win32com.client.GetObject('winmgmts:') processCodeCov = WMI.ExecQuery('select * from Win32_Process where Name="%s"' % pro...
[ "__author__ = 'liwenchang'\n #-*- coding:utf-8 -*-\nimport os\nimport time\nimport win32api, win32pdhutil, win32con, win32com.client\nimport win32pdh, string\n\n\ndef check_exsit(process_name):\n WMI = win32com.client.GetObject('winmgmts:')\n processCodeCov = WMI.ExecQuery('select * from Win32_Process where N...
false
8,659
2286aa1581ca7d6282b35847505a904980da275e
import cv2 import numpy as np kernel = np.ones((3, 3), np.uint8) def mask(image): # define region of interest green_frame = image[50:350, 50:350] cv2.rectangle(image, (50, 50), (350, 350), (0, 255, 0), 0) hsv = cv2.cvtColor(green_frame, cv2.COLOR_BGR2HSV) # define range of skin color in HSV lowe...
[ "import cv2\nimport numpy as np\nkernel = np.ones((3, 3), np.uint8)\ndef mask(image):\n # define region of interest\n green_frame = image[50:350, 50:350]\n cv2.rectangle(image, (50, 50), (350, 350), (0, 255, 0), 0)\n hsv = cv2.cvtColor(green_frame, cv2.COLOR_BGR2HSV)\n # define range of skin color in...
false
8,660
687ab41e9ce94c8d14154a941504845a8fa9f2d9
def test_number(): pass
[ "def test_number():\n pass\n", "<function token>\n" ]
false
8,661
e6d506dd45e72ee7f0162a884981ee1156153d3d
import json import os from lib.create import create_server, create_user os.chdir(r'/home/niko/data/Marvin') def edit_user_stats(server_id: str, user_id: str, stat: str, datas): create_user(server_id, user_id) if os.path.isfile("Server/{}/user.json".format(server_id)): with open("Server/{}...
[ "import json\r\nimport os\r\n\r\nfrom lib.create import create_server, create_user\r\n\r\nos.chdir(r'/home/niko/data/Marvin')\r\n\r\n\r\ndef edit_user_stats(server_id: str, user_id: str, stat: str, datas):\r\n create_user(server_id, user_id)\r\n if os.path.isfile(\"Server/{}/user.json\".format(server_id)):\r\...
false
8,662
e44c4b2c3b60d34d4540ec2d3a782c777c52fbc0
name = input("Введите ваше имя ") print("Добрый день,", name)
[ "name = input(\"Введите ваше имя \")\nprint(\"Добрый день,\", name)\n", "name = input('Введите ваше имя ')\nprint('Добрый день,', name)\n", "<assignment token>\nprint('Добрый день,', name)\n", "<assignment token>\n<code token>\n" ]
false
8,663
ddb81e3ce0df44ee503c558b68b41c35935358a0
#!/usr/bin/env python """Server that accepts and executes control-type commands on the bot.""" import sys import os from inspect import getmembers, ismethod from simplejson.decoder import JSONDecodeError import zmq import signal # This is required to make imports work sys.path = [os.getcwd()] + sys.path import bot.l...
[ "#!/usr/bin/env python\n\"\"\"Server that accepts and executes control-type commands on the bot.\"\"\"\n\nimport sys\nimport os\nfrom inspect import getmembers, ismethod\nfrom simplejson.decoder import JSONDecodeError\nimport zmq\nimport signal\n\n# This is required to make imports work\nsys.path = [os.getcwd()] + ...
false
8,664
3fed96e9bedb157a14cf9c441de5aae8b4f6edc8
import sys import os # Module "sys" # # See docs for the sys module: https://docs.python.org/3.7/library/sys.html # Print out the command line arguments in sys.argv, one per line: # Print out the plaform from sys: # for arg in sys.argv: # print(arg) # Print out the Python version from sys:print(sys.platform) ...
[ "import sys\nimport os\n\n# Module \"sys\"\n#\n# See docs for the sys module: https://docs.python.org/3.7/library/sys.html\n\n# Print out the command line arguments in sys.argv, one per line:\n\n\n# Print out the plaform from sys:\n# for arg in sys.argv:\n# print(arg)\n\n\n# Print out the Python version from sy...
false
8,665
0279057b3962e4b9839a86fc2e2683ac1da11b1a
from amqpstorm import management if __name__ == '__main__': # If using a self-signed certificate, change verify=True to point at your CA bundle. # You can disable certificate verification for testing by passing in verify=False. API = management.ManagementApi('https://rmq.amqpstorm.io:15671', 'guest', ...
[ "from amqpstorm import management\n\nif __name__ == '__main__':\n # If using a self-signed certificate, change verify=True to point at your CA bundle.\n # You can disable certificate verification for testing by passing in verify=False.\n API = management.ManagementApi('https://rmq.amqpstorm.io:15671', 'gue...
false
8,666
03a13037a9a102397c8be4d9f0f4c5e150965808
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'mapGraph.ui' # # Created by: PyQt5 UI code generator 5.9.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MapGraphTab(object): def setupUi(self, MapGraphTab): MapGra...
[ "# -*- coding: utf-8 -*-\n\n# Form implementation generated from reading ui file 'mapGraph.ui'\n#\n# Created by: PyQt5 UI code generator 5.9.2\n#\n# WARNING! All changes made in this file will be lost!\n\nfrom PyQt5 import QtCore, QtGui, QtWidgets\n\nclass Ui_MapGraphTab(object):\n def setupUi(self, MapGraphTab)...
false
8,667
2611d7dd364f6a027da29c005754ac2465faa8be
from numpy import pi,sqrt,cross,dot,zeros,linalg from defs import * ##from numba import njit, prange ## ##@njit(parallel=True) def engparallelb2(MU,NU,b1,b2,x1,x2,y1,y2,eta,a): #For use in enginteract below #HL p.154 Eq.(6-45) b1x=b1[0] b1y=b1[1] b1z=b1[2] b2x=b2[0] b2y=b2[1] b2z=b2[2] ...
[ "from numpy import pi,sqrt,cross,dot,zeros,linalg\n\nfrom defs import *\n##from numba import njit, prange\n##\n##@njit(parallel=True)\n\n\ndef engparallelb2(MU,NU,b1,b2,x1,x2,y1,y2,eta,a):\n\n#For use in enginteract below\n#HL p.154 Eq.(6-45)\n\n b1x=b1[0]\n b1y=b1[1]\n b1z=b1[2]\n\n b2x=b2[0]\n b2y=...
false
8,668
2350c2ab05499f1b40ba61f2101c51d9581d57f6
def addnumber(i,j): sum= i+j print(sum) num1 = int(input("Enter 1st number")) num2 = int(input("Enter 2nd number")) z = addnumber(num1,num2)
[ "\n\n\ndef addnumber(i,j):\n sum= i+j\n print(sum)\n\nnum1 = int(input(\"Enter 1st number\"))\nnum2 = int(input(\"Enter 2nd number\"))\nz = addnumber(num1,num2)\n\n\n", "def addnumber(i, j):\n sum = i + j\n print(sum)\n\n\nnum1 = int(input('Enter 1st number'))\nnum2 = int(input('Enter 2nd number'))\nz...
false
8,669
5f8303ce91c5de779bbddbaafb3fb828596babe5
# orm/relationships.py # Copyright (C) 2005-2023 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: https://www.opensource.org/licenses/mit-license.php """Heuristics related to join conditions as used in :func:`_orm.relationship`....
[ "# orm/relationships.py\n# Copyright (C) 2005-2023 the SQLAlchemy authors and contributors\n# <see AUTHORS file>\n#\n# This module is part of SQLAlchemy and is released under\n# the MIT License: https://www.opensource.org/licenses/mit-license.php\n\n\"\"\"Heuristics related to join conditions as used in\n:func:`_or...
false
8,670
e486e0ab91a8f5671435f5bbcf5340a62a970d3a
class SmartChineseAnalyzer: def __init__(self): pass def create_components(self, filename): #tokenizer = SentenceTokenize(filename) #result = WordTokenFilter(tokenizer) #result = PorterStemFilter(result) if self.stopwords: result = StopFilter(result,...
[ "class SmartChineseAnalyzer:\n def __init__(self):\n pass\n\n def create_components(self, filename):\n #tokenizer = SentenceTokenize(filename)\n #result = WordTokenFilter(tokenizer)\n #result = PorterStemFilter(result)\n \n if self.stopwords:\n result = Sto...
false
8,671
ef5c51a5c706387b62ef3f40c7cadf7dbef6d082
from flask_minify.utils import get_optimized_hashing class MemoryCache: def __init__(self, store_key_getter=None, limit=0): self.store_key_getter = store_key_getter self.limit = limit self._cache = {} self.hashing = get_optimized_hashing() @property def store(self): ...
[ "from flask_minify.utils import get_optimized_hashing\n\n\nclass MemoryCache:\n def __init__(self, store_key_getter=None, limit=0):\n self.store_key_getter = store_key_getter\n self.limit = limit\n self._cache = {}\n self.hashing = get_optimized_hashing()\n\n @property\n def sto...
false
8,672
42187f460a64572d2581ed5baec41eaff47466f8
version https://git-lfs.github.com/spec/v1 oid sha256:91f725dc0dba902c5c2c91c065346ab402c8bdbf4b5b13bdaec6773df5d06e49 size 964
[ "version https://git-lfs.github.com/spec/v1\noid sha256:91f725dc0dba902c5c2c91c065346ab402c8bdbf4b5b13bdaec6773df5d06e49\nsize 964\n" ]
true
8,673
83be35b79dcaa34f9273281976ebb71e81c58cdd
import logging import os import time from datetime import datetime from pathlib import Path from configargparse import ArgumentParser from cryptography import x509 from cryptography.hazmat.backends import default_backend from cryptography.x509.oid import ExtensionOID from cryptography.x509.extensions import ExtensionN...
[ "import logging\nimport os\nimport time\nfrom datetime import datetime\nfrom pathlib import Path\n\nfrom configargparse import ArgumentParser\nfrom cryptography import x509\nfrom cryptography.hazmat.backends import default_backend\nfrom cryptography.x509.oid import ExtensionOID\nfrom cryptography.x509.extensions im...
false
8,674
dac8dbb0eba78d4f8dfbe3284325735324a87dc2
""" 时间最优 思路: 将和为目标值的那 两个 整数定义为 num1 和 num2 创建一个新字典,内容存在数组中的数字及索引 将数组nums转换为字典, 遍历字典, num1为字典中的元素(其实与数组总的元素一样), num2 为 target减去num1, 判定num2是否在字典中,如果存在,返回字典中num2的值(也就是在数组nums中的下标)和 i(也就是num1在数组中的下标) 如果不存在,设置字典num1的值为i """ def two_sum(nums, target): dct = {} for i, num1 in enumerate(nums): ...
[ "\"\"\"\r\n时间最优\r\n\r\n思路:\r\n将和为目标值的那 两个 整数定义为 num1 和 num2\r\n创建一个新字典,内容存在数组中的数字及索引\r\n将数组nums转换为字典,\r\n遍历字典, num1为字典中的元素(其实与数组总的元素一样),\r\nnum2 为 target减去num1, 判定num2是否在字典中,如果存在,返回字典中num2的值(也就是在数组nums中的下标)和 i(也就是num1在数组中的下标)\r\n如果不存在,设置字典num1的值为i\r\n\"\"\"\r\n\r\ndef two_sum(nums, target):\r\n dct = {}\r\n f...
false
8,675
60d8276a5715899823b12ffdf132925c6f2693bd
from __future__ import annotations from typing import TYPE_CHECKING from datetime import datetime from sqlalchemy import Column, ForeignKey, String, DateTime, Float, Integer from sqlalchemy.orm import relationship from app.db.base_class import Base if TYPE_CHECKING: from .account import Account # noqa: F401 ...
[ "from __future__ import annotations\n\n\nfrom typing import TYPE_CHECKING\nfrom datetime import datetime\n\nfrom sqlalchemy import Column, ForeignKey, String, DateTime, Float, Integer\nfrom sqlalchemy.orm import relationship\n\nfrom app.db.base_class import Base\n\nif TYPE_CHECKING:\n from .account import Accoun...
false
8,676
c87ede0e3c6d4cc305450f68b4cf61fb63986760
import uvicore from uvicore.support import module from uvicore.typing import Dict, List from uvicore.support.dumper import dump, dd from uvicore.contracts import Email @uvicore.service() class Mail: def __init__(self, *, mailer: str = None, mailer_options: Dict = None, to: List = [], ...
[ "import uvicore\nfrom uvicore.support import module\nfrom uvicore.typing import Dict, List\nfrom uvicore.support.dumper import dump, dd\nfrom uvicore.contracts import Email\n\n\n@uvicore.service()\nclass Mail:\n\n def __init__(self, *,\n mailer: str = None,\n mailer_options: Dict = None,\n t...
false
8,677
4a8a733a965e25ad7ef53600fad6dd47343655b0
# -*- coding: utf-8 -*- """ Created on Wed Apr 12 16:38:22 2017 @author: secoder """ import io import random import nltk from nltk.tokenize import RegexpTokenizer from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from collections import Ordered...
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed Apr 12 16:38:22 2017\n\n@author: secoder\n\"\"\"\nimport io\nimport random\nimport nltk\nfrom nltk.tokenize import RegexpTokenizer\n\n\nfrom sklearn.feature_extraction.text import CountVectorizer\nfrom sklearn.feature_extraction.text import TfidfTransformer\n\n\nfrom...
false
8,678
74028a7b317c02c90603ad24c1ddb35a1d5d0e9d
student = [] while True: name = str(input('Name: ')).capitalize().strip() grade1 = float(input('Grade 1: ')) grade2 = float(input('Grade 2: ')) avgrade = (grade1 + grade2) / 2 student.append([name, [grade1, grade2], avgrade]) resp = ' ' while resp not in 'NnYy': resp = str(input('Ano...
[ "student = []\nwhile True:\n name = str(input('Name: ')).capitalize().strip()\n grade1 = float(input('Grade 1: '))\n grade2 = float(input('Grade 2: '))\n avgrade = (grade1 + grade2) / 2\n student.append([name, [grade1, grade2], avgrade])\n resp = ' '\n while resp not in 'NnYy':\n resp = ...
false
8,679
606abf8501d85c29051df4bf0276ed5b098ee6c5
from django.contrib import admin from search.models import PrimaryCategory,PlaceCategory class PrimaryCategoryAdmin(admin.ModelAdmin): list_display = ('primary_name','is_active','description','image',) actions = None def has_delete_permission(self,request,obj=None): return False ...
[ "from django.contrib import admin\nfrom search.models import PrimaryCategory,PlaceCategory\n\nclass PrimaryCategoryAdmin(admin.ModelAdmin):\n \n list_display = ('primary_name','is_active','description','image',)\n actions = None\n \n def has_delete_permission(self,request,obj=None):\n return F...
false
8,680
932502c93dd7dfc095adfe2ab88b4404396d9845
# 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 # d...
[ "# 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, so...
false
8,681
7c6ada250770e04b395dda774a78042da69e2854
from collections import Counter def main(): N = int(input()) A = tuple(map(int, input().split())) c = Counter(A).most_common() if c[0][0] == 0 and c[0][1] == N: print("Yes") elif len(c) == 2 and c[0][1] == 2*N//3 and c[1][0] == 0 and c[1][1] == N//3: print("Yes") elif ...
[ "from collections import Counter\n\ndef main():\n N = int(input())\n A = tuple(map(int, input().split()))\n \n c = Counter(A).most_common()\n \n if c[0][0] == 0 and c[0][1] == N:\n print(\"Yes\")\n elif len(c) == 2 and c[0][1] == 2*N//3 and c[1][0] == 0 and c[1][1] == N//3:\n prin...
false
8,682
130581ddb0394dcceabc316468385d4e21959b63
import unittest from domain.Activity import Activity from domain.NABException import NABException from domain.Person import Person from domain.ActivityValidator import ActivityValidator from repository.PersonRepository import PersonRepository from repository.PersonFileRepository import PersonFileRepository from reposit...
[ "import unittest\nfrom domain.Activity import Activity\nfrom domain.NABException import NABException\nfrom domain.Person import Person\nfrom domain.ActivityValidator import ActivityValidator\nfrom repository.PersonRepository import PersonRepository\nfrom repository.PersonFileRepository import PersonFileRepository\n...
false
8,683
e7d63c3b56459297eb67c56e93a3c640d93e5f6d
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import tensorflow from pyspark.sql.functions import split from pyspark.ml.fpm import FPGrowth from pyspark.sql import SparkSession from pyspark import SparkConf from pyspark.sql.functions import udf, array import re from pyspark.sql.types import * import pyspark.sql.functi...
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\nimport tensorflow\nfrom pyspark.sql.functions import split\nfrom pyspark.ml.fpm import FPGrowth\nfrom pyspark.sql import SparkSession\nfrom pyspark import SparkConf\nfrom pyspark.sql.functions import udf, array\nimport re\nfrom pyspark.sql.types import *\nimport pys...
false
8,684
e403be68894ba283d71a0b71bb0bfd0adfab8c41
import logging def log_func(handler): if handler.get_status() < 400: log_method = logging.info elif handler.get_status() < 500: log_method = logging.warning else: log_method = logging.error request_time = 1000.0 * handler.request.request_time() log_method("%d %s %s (%s) %s ...
[ "import logging\n\n\ndef log_func(handler):\n if handler.get_status() < 400:\n log_method = logging.info\n elif handler.get_status() < 500:\n log_method = logging.warning\n else:\n log_method = logging.error\n request_time = 1000.0 * handler.request.request_time()\n log_method(\"...
false
8,685
5c179752f4c4e1d693346c6edddd79211a895735
valor1=input("Ingrese Primera Cantidad ") valor2=input("Ingrese Segunda Cantidad ") Total = valor1 + valor2 print "El total es: " + str(Total)
[ "valor1=input(\"Ingrese Primera Cantidad \")\nvalor2=input(\"Ingrese Segunda Cantidad \")\nTotal = valor1 + valor2\nprint \"El total es: \" + str(Total)\n" ]
true
8,686
ec2d3bbfce06c498790afd491931df3f391dafbe
../PyFoam/bin/pyFoamPlotWatcher.py
[ "../PyFoam/bin/pyFoamPlotWatcher.py" ]
true
8,687
022f588455d8624d0b0107180417f65816254cb1
class car: def info(self): print(self.speed,self. color,self.model) def increment(self): print('increment') def decrement(self): print ('decrement') BMW = car() BMW.speed = 320 BMW.color = 'red' BMW.model = 1982 BMW.info() Camry = car() Camry.speed = 220 Camry.col...
[ "class car:\r\n\r\n def info(self):\r\n print(self.speed,self. color,self.model)\r\n def increment(self):\r\n print('increment')\r\n def decrement(self):\r\n print ('decrement')\r\n\r\nBMW = car()\r\nBMW.speed = 320\r\nBMW.color = 'red'\r\nBMW.model = 1982\r\nBMW.info()\r\n\r\nCamry = ...
false
8,688
a494b3469682a909b76e67e1b78ad25affe99f24
# Your code here d = dict() count = 0 fave_fast_food = input("Fave fast food restaurant: ") for i in range(1, 11): if fave_fast_food in d: d[fave_fast_food] += 1 else: d[fave_fast_food] = 1 count+= 1 fave_fast_food = input("Fave fast food restaurant: ") for k,v in d.items(): print('Fast Food R...
[ "# Your code here\nd = dict()\ncount = 0\nfave_fast_food = input(\"Fave fast food restaurant: \")\n\nfor i in range(1, 11):\n if fave_fast_food in d:\n d[fave_fast_food] += 1\n else:\n d[fave_fast_food] = 1\n count+= 1\n fave_fast_food = input(\"Fave fast food restaurant: \")\n\nfor k,v in d.items():\...
false
8,689
a87ab07bb1502a75a7e705cd5c92db829ebdd966
#!/usr/bin/python # -*- coding: utf-8 -*- import json from flask import jsonify from flask import make_response from MultipleInterfaceManager.settings import STATUS_CODE def _render(resp): response = make_response(jsonify(resp)) # response.headers["Access-Control-Allow-Origin"] = "*" return ...
[ "#!/usr/bin/python\r\n# -*- coding: utf-8 -*-\r\n\r\nimport json\r\n\r\nfrom flask import jsonify\r\nfrom flask import make_response\r\nfrom MultipleInterfaceManager.settings import STATUS_CODE\r\n\r\n\r\ndef _render(resp):\r\n response = make_response(jsonify(resp))\r\n# response.headers[\"Access-Control-All...
false
8,690
24891cdefcd061f04e7b7768b1bde4e32b78adcc
import heapq from util import edit_distance def autocomplete(suggest_tree, bktree, prefix, count=5): """Suggest top completions for a prefix given a SuggestTree and BKTree. Completions for a given prefix are weighted primarily by their weight in the suggest tree, and secondarily by their Levenshtein...
[ "import heapq\nfrom util import edit_distance\n\n\ndef autocomplete(suggest_tree, bktree, prefix, count=5):\n \"\"\"Suggest top completions for a prefix given a SuggestTree and BKTree.\n \n Completions for a given prefix are weighted primarily by their weight in the \n suggest tree, and secondarily by t...
false
8,691
b934770e9e57a0ead124e245f394433ce853dec9
import time import machine from machine import Timer import network import onewire, ds18x20 import ujson import ubinascii from umqtt.simple import MQTTClient import ntptime import errno #Thrown if an error that is fatal occurs, #stop measurement cycle. class Error(Exception): pass #Thrown if an error that is not ...
[ "import time\nimport machine\nfrom machine import Timer\nimport network\nimport onewire, ds18x20\nimport ujson\nimport ubinascii\nfrom umqtt.simple import MQTTClient\nimport ntptime\nimport errno\n\n#Thrown if an error that is fatal occurs,\n#stop measurement cycle.\nclass Error(Exception):\n pass\n\n#Thrown if ...
false
8,692
5d3b9005b8924da36a5885201339aa41082034cd
from selenium.webdriver.common.by import By class BasePageLocators: LOGIN_LINK = (By.CSS_SELECTOR, "#login_link") BASKET_LINK = (By.CSS_SELECTOR, '[class="btn btn-default"]:nth-child(1)') USER_ICON = (By.CSS_SELECTOR, ".icon-user") class LoginPageLocators: LOG_IN_FORM = (By.CSS_SELECTOR, "#login_for...
[ "from selenium.webdriver.common.by import By\n\n\nclass BasePageLocators:\n LOGIN_LINK = (By.CSS_SELECTOR, \"#login_link\")\n BASKET_LINK = (By.CSS_SELECTOR, '[class=\"btn btn-default\"]:nth-child(1)')\n USER_ICON = (By.CSS_SELECTOR, \".icon-user\")\n\n\nclass LoginPageLocators:\n LOG_IN_FORM = (By.CSS_...
false
8,693
252a6b97f108b7fdc165ccb2a7f61ce31f129d3d
import sys from collections import namedtuple from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, \ QHBoxLayout, QStackedWidget, QListWidget, QListWidgetItem from PyQt5.QtCore import Qt, QSize from runWidget import RunWidget from recordWidget import RecordWidget def QListWidget_qss(): return ...
[ "import sys\nfrom collections import namedtuple\nfrom PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, \\\n QHBoxLayout, QStackedWidget, QListWidget, QListWidgetItem\nfrom PyQt5.QtCore import Qt, QSize\n\nfrom runWidget import RunWidget\nfrom recordWidget import RecordWidget\n\n\ndef QListWidget_qs...
false
8,694
57bc34c6a23c98fd031ea6634441d4d135c06590
import sys sys.path.append("./") from torchtext.datasets import Multi30k from torchtext.data import Field from torchtext import data import pickle import models.transformer as h import torch from datasets import load_dataset from torch.utils.data import DataLoader from metrics.metrics import bleu import numpy as np fro...
[ "import sys\nsys.path.append(\"./\")\nfrom torchtext.datasets import Multi30k\nfrom torchtext.data import Field\nfrom torchtext import data\nimport pickle\nimport models.transformer as h\nimport torch\nfrom datasets import load_dataset\nfrom torch.utils.data import DataLoader\nfrom metrics.metrics import bleu\nimpo...
false
8,695
f6401eca2dc0ea86a934e859c35fa2d6c85a61b3
import turtle hexagon = turtle.Turtle() for i in range (6): hexagon.forward(100) hexagon.left(60)
[ "import turtle\r\nhexagon = turtle.Turtle()\r\nfor i in range (6):\r\n hexagon.forward(100)\r\n hexagon.left(60)\r\n ", "import turtle\nhexagon = turtle.Turtle()\nfor i in range(6):\n hexagon.forward(100)\n hexagon.left(60)\n", "<import token>\nhexagon = turtle.Turtle()\nfor i in range(6):\n ...
false
8,696
4932a357cfd60cb65630345e75794ebf58b82c82
import matplotlib; matplotlib.use('agg') import matplotlib.pyplot as plt import numpy as np from scipy.optimize import curve_fit from uncertainties import ufloat #Holt Werte aus Textdatei I, U = np.genfromtxt('werte2.txt', unpack=True) #Definiert Funktion mit der ihr fitten wollt (hier eine Gerade) def f(x,...
[ "import matplotlib; matplotlib.use('agg')\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\nfrom scipy.optimize import curve_fit\r\nfrom uncertainties import ufloat\r\n\r\n#Holt Werte aus Textdatei\r\nI, U = np.genfromtxt('werte2.txt', unpack=True)\r\n\r\n#Definiert Funktion mit der ihr fitten wollt (hier...
false
8,697
641cbe2f35925d070249820a2e3a4f1cdd1cf642
# -*- coding: utf-8 -*- """ app definition """ from django.apps import AppConfig class CoopHtmlEditorAppConfig(AppConfig): name = 'coop_html_editor' verbose_name = "Html Editor"
[ "# -*- coding: utf-8 -*-\n\"\"\"\napp definition\n\"\"\"\n\nfrom django.apps import AppConfig\n\n\nclass CoopHtmlEditorAppConfig(AppConfig):\n name = 'coop_html_editor'\n verbose_name = \"Html Editor\"\n", "<docstring token>\nfrom django.apps import AppConfig\n\n\nclass CoopHtmlEditorAppConfig(AppConfig):\n...
false
8,698
3164eab8dc221149c9f865645edf9991d810d2ac
import numpy as np import matplotlib.pyplot as plt import networkx as nx import time import sys class ConsensusSimulation: """Class to model a general consensus problem see DOI: 10.1109/JPROC.2006.887293""" def __init__(self, topology, dynamics, dynami...
[ "import numpy as np\nimport matplotlib.pyplot as plt\nimport networkx as nx\nimport time\nimport sys\n\nclass ConsensusSimulation:\n \"\"\"Class to model a general consensus problem\n see DOI: 10.1109/JPROC.2006.887293\"\"\"\n def __init__(self,\n topology,\n dynamics,\n...
false
8,699
5ccfad17ede9f685ea9ef9c514c0108a61c2dfd6
# -*- coding: utf-8 -*- """ Created on Tue Jul 18 13:39:05 2017 @author: jaredhaeme15 """ import cv2 import numpy as np from collections import deque import imutils import misc_image_tools frameFileName = r"H:\Summer Research 2017\Whirligig Beetle pictures and videos\large1.mp4" cap = cv2.VideoCapture(r"H:\Summer ...
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Jul 18 13:39:05 2017\n\n@author: jaredhaeme15\n\"\"\"\n\n\nimport cv2\nimport numpy as np\nfrom collections import deque\nimport imutils\nimport misc_image_tools \n\nframeFileName = r\"H:\\Summer Research 2017\\Whirligig Beetle pictures and videos\\large1.mp4\"\ncap ...
false