index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
6,700
e81373c7b9c43b178f0f12382501be8899189660
# # Standard tests on the standard set of model outputs # import pybamm import numpy as np class StandardOutputTests(object): """Calls all the tests on the standard output variables.""" def __init__(self, model, parameter_values, disc, solution): # Assign attributes self.model = model ...
[ "#\n# Standard tests on the standard set of model outputs\n#\nimport pybamm\nimport numpy as np\n\n\nclass StandardOutputTests(object):\n \"\"\"Calls all the tests on the standard output variables.\"\"\"\n\n def __init__(self, model, parameter_values, disc, solution):\n # Assign attributes\n sel...
false
6,701
54e5feee3c8bb35c351361fd3ed4b5e237e5973d
highscores = [] scores = [] while True: user = input('> ').split(' ') score = int(user[0]) name = user[1] scores.append( [score, name] ) scores.sort(reverse=True) if len(scores) < 3: highscores = scores else: highscores = scores[:3] print(highscores)
[ "highscores = []\nscores = []\n\nwhile True:\n user = input('> ').split(' ')\n score = int(user[0])\n name = user[1]\n\n scores.append( [score, name] )\n scores.sort(reverse=True)\n\n if len(scores) < 3:\n highscores = scores\n else:\n highscores = scores[:3]\n\n print(highscor...
false
6,702
533d0b883a0bbbb148f04826e4c0a2bcc31732e9
#! /usr/bin/env python3 # -*- coding: utf-8 -*- """ DIM Station Test ~~~~~~~~~~~~~~~~ Unit test for DIM Station """ import unittest from dimp import ID, NetworkID class StationTestCase(unittest.TestCase): def test_identifier(self): print('\n---------------- %s' % self) str1 = 'gsp...
[ "#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n\"\"\"\n DIM Station Test\n ~~~~~~~~~~~~~~~~\n\n Unit test for DIM Station\n\"\"\"\n\nimport unittest\n\nfrom dimp import ID, NetworkID\n\n\nclass StationTestCase(unittest.TestCase):\n\n def test_identifier(self):\n print('\\n---------------- %...
false
6,703
0438f92aa9a36eaf1059244ec3be4397381f7a86
import pyodbc print("Primera consulta SQL Server") servidor="LOCALHOST\SQLEXPRESS" bbdd="HOSPITAL" usuario="SA" password="azure" #CADENA CONEXION CON SEGURIDAD SQL SERVER (REMOTO) cadenaconexion=("DRIVER={ODBC Driver 17 for SQL Server};SERVER=" + servidor + "; DATABASE=" + bbdd + "; UID=" + usuario + "; PWD=" + passw...
[ "import pyodbc\n\nprint(\"Primera consulta SQL Server\")\nservidor=\"LOCALHOST\\SQLEXPRESS\"\nbbdd=\"HOSPITAL\"\nusuario=\"SA\"\npassword=\"azure\"\n\n#CADENA CONEXION CON SEGURIDAD SQL SERVER (REMOTO)\ncadenaconexion=(\"DRIVER={ODBC Driver 17 for SQL Server};SERVER=\" + servidor\n+ \"; DATABASE=\" + bbdd + \"; UID...
false
6,704
82083f16c18db35193fa2aa45bc28c5201962f90
import re match = re.search(r'pi+', 'piiig') print 'found', match.group() == "piii"
[ "\n\nimport re\n\n\nmatch = re.search(r'pi+', 'piiig')\nprint 'found', match.group() == \"piii\"\n" ]
true
6,705
f73a3bd7665ac9cc90085fcac2530c93bef69d3d
# coding: utf-8 import sys #from operator import itemgetter sysread = sys.stdin.readline read = sys.stdin.read from heapq import heappop, heappush from collections import defaultdict sys.setrecursionlimit(10**7) import math #from itertools import product#accumulate, combinations, product #import bisect# lower_bound etc...
[ "# coding: utf-8\nimport sys\n#from operator import itemgetter\nsysread = sys.stdin.readline\nread = sys.stdin.read\nfrom heapq import heappop, heappush\nfrom collections import defaultdict\nsys.setrecursionlimit(10**7)\nimport math\n#from itertools import product#accumulate, combinations, product\n#import bisect# ...
false
6,706
808fe8f106eaff00cf0080edb1d8189455c4054b
import numpy as np def find_saddle_points(A): B = [] for i in range(A.shape[0]): min_r = np.min(A[i]) ind_r = 0 max_c = 0 ind_c = 0 for j in range(A.shape[1]): if (A[i][j] == min_r): min_r = A[i][j] ind_r = j for k in range(A.shape[0]): if (A[k][ind_r] >= max_c): max_c = A[k][ind_...
[ "import numpy as np\n\ndef find_saddle_points(A):\n\tB = []\n\tfor i in range(A.shape[0]):\n\t\tmin_r = np.min(A[i])\n\t\tind_r = 0\n\t\tmax_c = 0\n\t\tind_c = 0\n\t\tfor j in range(A.shape[1]):\n\t\t\tif (A[i][j] == min_r):\n\t\t\t\tmin_r = A[i][j]\n\t\t\t\tind_r = j\n\t\t\t\tfor k in range(A.shape[0]):\n\t\t\t\t\...
false
6,707
586d39556d2922a288a2bef3bcffbc6f9e3dc39d
import os import random import cv2 import numpy as np from keras.preprocessing.image import img_to_array import numpy as np import keras from scipy import ndimage, misc def preprocess_image(img): img = img.astype(np.uint8) (channel_b, channel_g, channel_r) = cv2.split(img) result = ndimage.maximum_filter(...
[ "import os\nimport random\nimport cv2\nimport numpy as np\nfrom keras.preprocessing.image import img_to_array\nimport numpy as np\nimport keras\nfrom scipy import ndimage, misc\n\ndef preprocess_image(img):\n img = img.astype(np.uint8)\n (channel_b, channel_g, channel_r) = cv2.split(img)\n\n result = ndima...
false
6,708
7620d76afc65ceb3b478f0b05339ace1f1531f7d
def strictly_greater_than(value): if value : # Change this line return "Greater than 100" elif value : # Change this line return "Greater than 10" else: return "10 or less" # Change the value 1 below to experiment with different values print(strictly_greater_than(1))
[ "def strictly_greater_than(value):\n if value : # Change this line\n return \"Greater than 100\"\n elif value : # Change this line\n return \"Greater than 10\"\n else:\n return \"10 or less\"\n\n# Change the value 1 below to experiment with different values\nprint(strictly_greater_th...
false
6,709
c95eaa09241428f725d4162e0e9f6ed3ce6f8fdd
# -*- coding: utf-8 -*- from django.contrib.auth.models import User from django.contrib.auth.admin import UserAdmin from django.contrib import admin from accounts.models import (UserProfile) admin.site.register(UserProfile) admin.site.unregister(User) class CustomUserAdmin(UserAdmin): list_display = ('username', ...
[ "# -*- coding: utf-8 -*-\nfrom django.contrib.auth.models import User\nfrom django.contrib.auth.admin import UserAdmin\nfrom django.contrib import admin\nfrom accounts.models import (UserProfile)\n\nadmin.site.register(UserProfile)\nadmin.site.unregister(User)\n\nclass CustomUserAdmin(UserAdmin):\n list_display ...
false
6,710
9db4bca3e907d70d9696f98506efb6d6042b5723
from mcse.core.driver import BaseDriver_ class DimerGridSearch(BaseDriver_): """ Generates all dimer structures that should be considered for a grid search to find the best dimer arangements. Grid search is performed over all x,y,z positions for the COM and all orientations of the molecule. Only ...
[ "\n\nfrom mcse.core.driver import BaseDriver_\n\n\n\nclass DimerGridSearch(BaseDriver_):\n \"\"\"\n Generates all dimer structures that should be considered for a grid search\n to find the best dimer arangements. Grid search is performed over all \n x,y,z positions for the COM and all orientations of th...
false
6,711
f4094a81f90cafc9ae76b8cf902221cbdbc4871a
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'MainMenu.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_MainWindow(object): def setupUi(self, MainWindow): MainWind...
[ "# -*- coding: utf-8 -*-\n\n# Form implementation generated from reading ui file 'MainMenu.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_MainWindow(object):\n def setupUi(self, MainWindow):\...
false
6,712
bf05a096956ca4f256832e2fc6659d42c5611796
# Generated by Django 3.1.2 on 2021-02-13 14:40 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('post', '0014_profilepic_user'), ] operations = [ migrations.CreateModel( name='profile_pic', fields=[ ...
[ "# Generated by Django 3.1.2 on 2021-02-13 14:40\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('post', '0014_profilepic_user'),\n ]\n\n operations = [\n migrations.CreateModel(\n name='profile_pic',\n fiel...
false
6,713
b7721e95cfb509a7c0c6ccdffa3a8ca2c6bd6033
from numpy import array, sum def comp_point_ref(self, is_set=False): """Compute the point ref of the Surface Parameters ---------- self : SurfLine A SurfLine object is_set: bool True to update the point_ref property Returns ------- point_ref : complex the refe...
[ "from numpy import array, sum\n\n\ndef comp_point_ref(self, is_set=False):\n \"\"\"Compute the point ref of the Surface\n\n Parameters\n ----------\n self : SurfLine\n A SurfLine object\n is_set: bool\n True to update the point_ref property\n\n Returns\n -------\n point_ref : c...
false
6,714
95ab8fce573ef959946d50d9af6e893cb8798917
"""Functions for updating and performing bulk inference using an Keras MPNN model""" from typing import List, Dict, Tuple import numpy as np import tensorflow as tf from molgym.mpnn.data import convert_nx_to_dict from molgym.mpnn.layers import custom_objects from molgym.utils.conversions import convert_smiles_to_nx ...
[ "\"\"\"Functions for updating and performing bulk inference using an Keras MPNN model\"\"\"\nfrom typing import List, Dict, Tuple\n\nimport numpy as np\nimport tensorflow as tf\nfrom molgym.mpnn.data import convert_nx_to_dict\nfrom molgym.mpnn.layers import custom_objects\nfrom molgym.utils.conversions import conve...
false
6,715
daf070291bbf59a7a06b129bbde5fd79b5cd46ad
''' Created on Mar 19, 2019 @author: malte ''' import gc import pickle from hyperopt import tpe, hp from hyperopt.base import Trials from hyperopt.fmin import fmin from config.globals import BASE_PATH from domain.features import FEATURES from evaluate import evaluate from featuregen.create_set import create_set fro...
[ "'''\nCreated on Mar 19, 2019\n\n@author: malte\n'''\n\nimport gc\nimport pickle\n\nfrom hyperopt import tpe, hp\nfrom hyperopt.base import Trials\nfrom hyperopt.fmin import fmin\n\nfrom config.globals import BASE_PATH\nfrom domain.features import FEATURES\nfrom evaluate import evaluate\nfrom featuregen.create_set ...
false
6,716
515967656feea176e966de89207f043f9cc20c61
"""Config flow for Philips TV integration.""" from __future__ import annotations from collections.abc import Mapping import platform from typing import Any from haphilipsjs import ConnectionFailure, PairingFailure, PhilipsTV import voluptuous as vol from homeassistant import config_entries, core from homeassistant.c...
[ "\"\"\"Config flow for Philips TV integration.\"\"\"\nfrom __future__ import annotations\n\nfrom collections.abc import Mapping\nimport platform\nfrom typing import Any\n\nfrom haphilipsjs import ConnectionFailure, PairingFailure, PhilipsTV\nimport voluptuous as vol\n\nfrom homeassistant import config_entries, core...
false
6,717
87c27711c0089ca2c7e5c7d0e9edb51b9d4008d9
# -*- coding: utf-8 -*- import requests import csv from lxml import html import json class ycombinatorParser(): siteurl = 'https://news.ycombinator.com/' def getNextPage(pageurl): response = requests.get(pageurl) parsed_body = html.fromstring(response.text) nextpage=parsed_body.xpa...
[ "# -*- coding: utf-8 -*-\nimport requests\nimport csv\nfrom lxml import html\nimport json\n\nclass ycombinatorParser():\n siteurl = 'https://news.ycombinator.com/' \n\n def getNextPage(pageurl):\n response = requests.get(pageurl)\n parsed_body = html.fromstring(response.text)\n nextpag...
false
6,718
eb50f50e3c072c2f6e74ff9ef8c2fa2eef782aae
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
[ "# Copyright 2020 Huawei Technologies Co., Ltd\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable l...
false
6,719
d442d5c7afd32dd149bb47fc9c4355409c53dab8
import array as arr # from array import * # To remove use of 'arr' everytime. studentMarks = arr.array('i', [2,30,45,50,90]) # i represnts datatype of array which is int here. # accessing array print(studentMarks[3]) studentMarks.append(95) # using for loop for i in studentMarks: print(i) # usin...
[ "import array as arr\r\n# from array import * # To remove use of 'arr' everytime.\r\n\r\nstudentMarks = arr.array('i', [2,30,45,50,90]) # i represnts datatype of array which is int here.\r\n\r\n# accessing array\r\nprint(studentMarks[3])\r\n\r\nstudentMarks.append(95)\r\n\r\n# using for loop\r\nfor i in studentMar...
false
6,720
8da775bd87bfeab5e30956e62bcdba6c04e26b27
import json # numbers=[2,3,5,7,11,13] filename='numbers.json' with open(filename) as f: numbers=json.load(f) print(numbers)
[ "import json\n\n# numbers=[2,3,5,7,11,13]\n\nfilename='numbers.json'\n\nwith open(filename) as f:\n numbers=json.load(f)\n\nprint(numbers)", "import json\nfilename = 'numbers.json'\nwith open(filename) as f:\n numbers = json.load(f)\nprint(numbers)\n", "<import token>\nfilename = 'numbers.json'\nwith open...
false
6,721
ea696329a0cfd558fb592ffaf6339a35e8950a3c
class Solution: def commonFactors(self, a: int, b: int) -> int: gcd = math.gcd(a, b) return sum(a % i == 0 and b % i == 0 for i in range(1, gcd + 1))
[ "class Solution:\n def commonFactors(self, a: int, b: int) -> int:\n gcd = math.gcd(a, b)\n return sum(a % i == 0 and b % i == 0\n for i in range(1, gcd + 1))\n ", "class Solution:\n\n def commonFactors(self, a: int, b: int) ->int:\n gcd = math.gcd(a, b)\n return sum(a % i =...
false
6,722
4a4745f202275e45fd78c12431e355fd59ac964a
class SlackEvent: @property def client_msg_id(self): pass @property def type(self): pass @property def subtype(self): pass @property def text(self): pass @property def time_stamp(self): pass @property def ...
[ "class SlackEvent:\r\n @property\r\n def client_msg_id(self):\r\n pass\r\n\r\n @property\r\n def type(self):\r\n pass\r\n\r\n @property\r\n def subtype(self):\r\n pass\r\n\r\n @property\r\n def text(self):\r\n pass\r\n\r\n @property\r\n def time_stamp(self):...
false
6,723
d1b025ddbf7d0ad48ff92a098d074820a3eb35ed
#!/usr/bin/python # encoding:utf-8 from selenium.webdriver.common.by import By import random import basePage # 门店入库button stock_in = (By.XPATH, "//android.widget.TextView[contains(@text,'门店入库')]") # 调拨入库button transfer_in = (By.XPATH, "//android.widget.TextView[contains(@text,'调拨入库')]") # 确认签收button take_receive = (By...
[ "#!/usr/bin/python\n# encoding:utf-8\nfrom selenium.webdriver.common.by import By\nimport random\nimport basePage\n\n# 门店入库button\nstock_in = (By.XPATH, \"//android.widget.TextView[contains(@text,'门店入库')]\")\n# 调拨入库button\ntransfer_in = (By.XPATH, \"//android.widget.TextView[contains(@text,'调拨入库')]\")\n# 确认签收button...
false
6,724
7262d7a82834b38762616a30d4eac38078e4b616
# 遍历(循环) 出字符串中的每一个元素 str01 = "大发放而非asdfasfasdfa,,,,aadfa阿斯顿发水电费&&" # ----->字符串中的元素都是有索引的,根据索引可以得到对应的元素 # 而---3 a = str01[3] print(str01[3]) # 发---1 print(str01[1]) #---->计算字符串的长度 # 这个字符串中 有 35个元素 ,长度是35 l01 = len(str01) print(l01) str01 = "大放而非asdfasfasdfa,,,,aadfa阿斯顿发水电费&&" # 最后一个元素的索引:字符串...
[ "# 遍历(循环) 出字符串中的每一个元素\r\nstr01 = \"大发放而非asdfasfasdfa,,,,aadfa阿斯顿发水电费&&\"\r\n\r\n\r\n# ----->字符串中的元素都是有索引的,根据索引可以得到对应的元素\r\n# 而---3\r\na = str01[3]\r\nprint(str01[3])\r\n\r\n# 发---1\r\nprint(str01[1])\r\n\r\n#---->计算字符串的长度\r\n# 这个字符串中 有 35个元素 ,长度是35\r\nl01 = len(str01)\r\nprint(l01)\r\n\r\n\r\n\r\nstr01 = \"大放而非as...
false
6,725
4af05a13264c249be69071447101d684ff97063e
import sys import numpy as np import math import matplotlib.pyplot as plt import random def load_files(training, testing): tr_feat = np.genfromtxt(training, usecols=range(256), delimiter=",") tr_feat /= 255.0 tr_feat = np.insert(tr_feat, 0, 0, axis=1) tr_exp = np.genfromtxt(training, usecols=range(-1)...
[ "import sys\nimport numpy as np\nimport math\nimport matplotlib.pyplot as plt\nimport random\n\n\ndef load_files(training, testing):\n tr_feat = np.genfromtxt(training, usecols=range(256), delimiter=\",\")\n tr_feat /= 255.0\n tr_feat = np.insert(tr_feat, 0, 0, axis=1)\n tr_exp = np.genfromtxt(training,...
false
6,726
b49e5b40ce1e16f1b7c0bd9509daf94f36c51256
from app.api import app def main(): app.run(host='0.0.0.0', port=5001) if __name__ == '__main__': main()
[ "from app.api import app\n\n\ndef main():\n app.run(host='0.0.0.0', port=5001)\n\n\nif __name__ == '__main__':\n main()\n", "<import token>\n\n\ndef main():\n app.run(host='0.0.0.0', port=5001)\n\n\nif __name__ == '__main__':\n main()\n", "<import token>\n\n\ndef main():\n app.run(host='0.0.0.0',...
false
6,727
4cc6a9c48e174b33ed93d7bda159fcc3a7b59d4c
from django.contrib import admin from .models import Profile, Address admin.site.register(Profile) admin.site.register(Address)
[ "from django.contrib import admin\n\nfrom .models import Profile, Address\n\n\nadmin.site.register(Profile)\nadmin.site.register(Address)\n", "from django.contrib import admin\nfrom .models import Profile, Address\nadmin.site.register(Profile)\nadmin.site.register(Address)\n", "<import token>\nadmin.site.regist...
false
6,728
5e78992df94cbbe441495b7d8fb80104ec000748
#!/usr/bin/python2 import md5 from pwn import * import time LIMIT = 500 TARGET = "shell2017.picoctf.com" PORT = 46290 FILE = "hash.txt" def generate_hashes(seed): a = [] current_hash = seed for i in range(1000): current_hash = md5.new(current_hash).hexdigest() a.append(current_hash)...
[ "#!/usr/bin/python2\nimport md5 \nfrom pwn import *\nimport time\n\nLIMIT = 500\nTARGET = \"shell2017.picoctf.com\"\nPORT = 46290\nFILE = \"hash.txt\"\n\ndef generate_hashes(seed):\n a = []\n current_hash = seed\n \n for i in range(1000): \n current_hash = md5.new(current_hash).hexdigest()\n ...
false
6,729
84a13e3dea885d6c4a5f195dfac51c7110102fc2
#!/usr/bin/env python3 from ev3dev2.sensor import INPUT_1, INPUT_2, INPUT_3, INPUT_4 from ev3dev2.sensor.lego import ColorSensor, UltrasonicSensor from ev3dev2.power import PowerSupply # initiate color sensors # the colour sensor needs to be between 1-2 cm away from the surface you are trying to measure. (color mode) ...
[ "#!/usr/bin/env python3\nfrom ev3dev2.sensor import INPUT_1, INPUT_2, INPUT_3, INPUT_4\nfrom ev3dev2.sensor.lego import ColorSensor, UltrasonicSensor\nfrom ev3dev2.power import PowerSupply\n\n# initiate color sensors\n# the colour sensor needs to be between 1-2 cm away from the surface you are trying to measure. (c...
false
6,730
787397473c431d2560bf8c488af58e976c1864d0
# -*- coding: utf-8 -*- # Generated by Django 1.11.17 on 2021-04-09 06:08 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('lkft', '0021_reportjob_finished_successfully'), ] operations = [ migration...
[ "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.17 on 2021-04-09 06:08\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('lkft', '0021_reportjob_finished_successfully'),\n ]\n\n operations = [...
false
6,731
b39c783cbaff2915c8864ce0b081b5bf052baee5
from django.urls import path from .views import * urlpatterns = [ path('country',Country_Data,name='country_data'), path('tours',Scrape_Data, name='scrape_data'), path('draws', Draw_Data, name='Draw_data') ]
[ "from django.urls import path\nfrom .views import *\n\nurlpatterns = [\n path('country',Country_Data,name='country_data'),\n path('tours',Scrape_Data, name='scrape_data'),\n path('draws', Draw_Data, name='Draw_data')\n]\n", "from django.urls import path\nfrom .views import *\nurlpatterns = [path('country...
false
6,732
4f21fb4168ed29b9540d3ca2b8cf6ef746c30831
#!/usr/bin/python # -*- coding: utf-8 -*- # http://stackoverflow.com/questions/5276967/python-in-xcode-4 """tv_write_xyzt2matlab.py: TremVibe Write Accelerometer XYZ and Timestamp to .m file""" __author__ = "Salvador Aguinaga" import sys import MySQLdb import math from itertools import groupby import csv ##########...
[ "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n# http://stackoverflow.com/questions/5276967/python-in-xcode-4\n\n\"\"\"tv_write_xyzt2matlab.py: TremVibe Write Accelerometer XYZ and Timestamp to .m file\"\"\"\n__author__ = \"Salvador Aguinaga\"\n\nimport sys\nimport MySQLdb\nimport math\nfrom itertools import groupby...
true
6,733
db341c3686c53f1cd9fe98c532f17e872952cbba
# -*- coding: utf-8 -*- """ Created on Thu Feb 15 17:28:48 2018 @author: otalabay """ LOCAL_INFO = 1 LSM = 2 TLS = 3 TLS_STOP = 4 DANGER = 5 STOP_DANGER = 6 PM = 7 PM_STOP = 8
[ "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Thu Feb 15 17:28:48 2018\r\n\r\n@author: otalabay\r\n\"\"\"\r\n\r\nLOCAL_INFO = 1\r\nLSM = 2\r\nTLS = 3\r\nTLS_STOP = 4\r\nDANGER = 5\r\nSTOP_DANGER = 6\r\nPM = 7\r\nPM_STOP = 8", "<docstring token>\nLOCAL_INFO = 1\nLSM = 2\nTLS = 3\nTLS_STOP = 4\nDANGER = 5\nSTOP_...
false
6,734
56640454efce16e0c873d557ac130775a4a2ad8d
n,m=map(int,input().split()) l=list(map(int,input().split())) t=0 result=[0 for i in range(0,n)] result.insert(0,1) while(t<m): #print(t) for i in range(l[t],n+1): result[i]=result[i]+result[i-l[t]] t=t+1 print(result[-1]) 0 1 2 3 4 1 [1,1,1,1,1] 2 [1 1 2 2 3] 3 [...
[ "n,m=map(int,input().split())\r\nl=list(map(int,input().split()))\r\nt=0\r\nresult=[0 for i in range(0,n)]\r\nresult.insert(0,1)\r\nwhile(t<m):\r\n #print(t)\r\n for i in range(l[t],n+1):\r\n result[i]=result[i]+result[i-l[t]] \r\n t=t+1\r\nprint(result[-1])\r\n \r\n 0 1 2 3 4\r\n1 [1,1...
true
6,735
9f2105d188ac32a9eef31b21065e9bda13a02995
# -*- coding: utf-8 -*- # @COPYRIGHT_begin # # Copyright [2015] Michał Szczygieł, M4GiK Software # # 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...
[ "# -*- coding: utf-8 -*-\n# @COPYRIGHT_begin\n#\n# Copyright [2015] Michał Szczygieł, M4GiK Software\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/lice...
false
6,736
34db3c9998e1d7647dd954e82e18147504cc74fc
""" @version: author:yunnaidan @time: 2019/07/22 @file: download_mseed.py @function: """ from obspy.clients.fdsn import Client from obspy.core import UTCDateTime import numpy as np import obspy import os import re import time import glob import shutil import platform import subprocess import multiprocessing def load_...
[ "\"\"\"\n@version:\nauthor:yunnaidan\n@time: 2019/07/22\n@file: download_mseed.py\n@function:\n\"\"\"\nfrom obspy.clients.fdsn import Client\nfrom obspy.core import UTCDateTime\nimport numpy as np\nimport obspy\nimport os\nimport re\nimport time\nimport glob\nimport shutil\nimport platform\nimport subprocess\nimpor...
false
6,737
7da8a074704b1851ac352477ef72a4c11cea1a0b
#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-# # PROJECT : RegCEl - Registro para el Consumo Eléctrico # # VERSION : 1.2 ...
[ "#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-#\n# PROJECT : RegCEl - Registro para el Consumo Eléctrico #\n# VERSION : 1.2 ...
false
6,738
168a76fd3bb43afe26a6a217e90f48704b4f2042
#!/usr/bin/env python3 import os import requests # This is the main url of the BSE API # THIS WILL CHANGE TO HTTPS IN THE FUTURE # HTTPS IS RECOMMENDED main_bse_url = "http://basissetexchange.org" # This allows for overriding the URL via an environment variable # Feel free to just use the base_url below base_url = o...
[ "#!/usr/bin/env python3\n\nimport os\nimport requests\n\n# This is the main url of the BSE API\n# THIS WILL CHANGE TO HTTPS IN THE FUTURE\n# HTTPS IS RECOMMENDED\nmain_bse_url = \"http://basissetexchange.org\"\n\n# This allows for overriding the URL via an environment variable\n# Feel free to just use the base_url ...
false
6,739
ac31cba94ee8ff7a2903a675954c937c567b5a56
def encrypt(key,plaintext): ciphertext="" for i in plaintext: if i.isalpha(): alphabet = ord(i)+key if alphabet > ord("Z"): alphabet -= 26 letter = chr(alphabet) ciphertext+=letter return ciphertext def decrypt(key,ciphertext): plaintext="" for i i...
[ "\ndef encrypt(key,plaintext):\n ciphertext=\"\"\n\n for i in plaintext:\n if i.isalpha():\n alphabet = ord(i)+key\n if alphabet > ord(\"Z\"):\n alphabet -= 26\n letter = chr(alphabet)\n ciphertext+=letter\n\n return ciphertext\n\ndef decrypt(key,ciphertext):\n ...
false
6,740
f15f49a29f91181d0aaf66b19ce9616dc7576be8
# Generated by Django 3.1.7 on 2021-04-16 05:56 from django.db import migrations import django.db.models.manager class Migration(migrations.Migration): dependencies = [ ('Checkbook', '0002_auto_20210415_2250'), ] operations = [ migrations.AlterModelManagers( name='transactio...
[ "# Generated by Django 3.1.7 on 2021-04-16 05:56\n\nfrom django.db import migrations\nimport django.db.models.manager\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('Checkbook', '0002_auto_20210415_2250'),\n ]\n\n operations = [\n migrations.AlterModelManagers(\n ...
false
6,741
46cdea08cab620ea099ad7fa200782717249b91b
# # PySNMP MIB module SYSLOG-TC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SYSLOG-TC-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:31:53 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
[ "#\n# PySNMP MIB module SYSLOG-TC-MIB (http://snmplabs.com/pysmi)\n# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SYSLOG-TC-MIB\n# Produced by pysmi-0.3.4 at Mon Apr 29 20:31:53 2019\n# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4\n# Using Python version 3.7.3 (default, ...
false
6,742
6e0d09bd0c9d1d272f727817cec65b81f83d02f5
containerized: "docker://quay.io/snakemake/containerize-testimage:1.0" rule a: output: "test.out" conda: "env.yaml" shell: "bcftools 2> {output} || true"
[ "containerized: \"docker://quay.io/snakemake/containerize-testimage:1.0\"\n\nrule a:\n output:\n \"test.out\"\n conda:\n \"env.yaml\"\n shell:\n \"bcftools 2> {output} || true\"\n" ]
true
6,743
54d714d1e4d52911bcadf3800e7afcc2c9a615a5
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 7 03:41:18 2020 @author: owlthekasra """ import methods as md import add_label as al import numpy as np import pandas as pd import random sb_rd_1 = '/Users/owlthekasra/Documents/Code/Python/AudioStimulus/data/sine_bass/trials_2' sb_rd_2 = '/Users...
[ "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Thu May 7 03:41:18 2020\n\n@author: owlthekasra\n\"\"\"\n\nimport methods as md\nimport add_label as al\nimport numpy as np\nimport pandas as pd\nimport random\n\nsb_rd_1 = '/Users/owlthekasra/Documents/Code/Python/AudioStimulus/data/sine_bass/tr...
false
6,744
8a848eece6a3ed07889ba208068de4bfa0ad0bbf
# Copyright 2014 The Oppia Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
[ "# Copyright 2014 The Oppia Authors. 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/licenses/LICENSE-2.0\n#\n# Unless required...
true
6,745
4d066a189bf5151534e0227e67cdc2eed5cd387c
#!/usr/bin/python # view_rows.py - Fetch and display the rows from a MySQL database query # import the MySQLdb and sys modules # katja seltmann April 16, 2013 to run on arthropod data in scan symbiota database import MySQLdb import sys #connection information from mysql #test database connect = MySQLdb.connect("", u...
[ "#!/usr/bin/python\n# view_rows.py - Fetch and display the rows from a MySQL database query\n# import the MySQLdb and sys modules\n# katja seltmann April 16, 2013 to run on arthropod data in scan symbiota database\n\nimport MySQLdb\nimport sys\n\n#connection information from mysql\n\n#test database\nconnect = MySQL...
true
6,746
e810cde7f77d36c6a43f8c277b66d038b143aae6
""" Base cache mechanism """ import time import string import codecs import pickle from functools import wraps from abc import ABCMeta, abstractmethod from asyncio import iscoroutinefunction class BaseCache(metaclass=ABCMeta): """Base cache class.""" @abstractmethod def __init__(self, kvstore, makekey, li...
[ "\"\"\"\nBase cache mechanism\n\"\"\"\nimport time\nimport string\nimport codecs\nimport pickle\nfrom functools import wraps\nfrom abc import ABCMeta, abstractmethod\nfrom asyncio import iscoroutinefunction\n\n\nclass BaseCache(metaclass=ABCMeta):\n \"\"\"Base cache class.\"\"\"\n @abstractmethod\n def __i...
false
6,747
0656c3e1d8f84cfb33c4531e41efb4a349d08aac
from pathlib import Path from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, Session # SQLALCHEMY_DATABASE_URL = "postgresql://user:password@postgresserver/db" SQLALCHEMY_DATABASE_URL = f"sqlite:///{Path(__name__).parent.absolute()}/sql_...
[ "from pathlib import Path\nfrom sqlalchemy import create_engine\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy.orm import sessionmaker, Session\n\n# SQLALCHEMY_DATABASE_URL = \"postgresql://user:password@postgresserver/db\"\nSQLALCHEMY_DATABASE_URL = f\"sqlite:///{Path(__name__).parent.ab...
false
6,748
d56fa4ea999d8af887e5f68296bfb20ad535e6ad
# 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
6,749
ae45a4967a8ee63c27124d345ad4dc0c01033c0e
from mikeio.spatial import GeometryPoint2D, GeometryPoint3D # https://www.ogc.org/standard/sfa/ def test_point2d_wkt(): p = GeometryPoint2D(10, 20) assert p.wkt == "POINT (10 20)" p = GeometryPoint2D(x=-5642.5, y=120.1) assert p.wkt == "POINT (-5642.5 120.1)" def test_point3d_wkt(): p = Geomet...
[ "from mikeio.spatial import GeometryPoint2D, GeometryPoint3D\n\n# https://www.ogc.org/standard/sfa/\n\n\ndef test_point2d_wkt():\n p = GeometryPoint2D(10, 20)\n assert p.wkt == \"POINT (10 20)\"\n\n p = GeometryPoint2D(x=-5642.5, y=120.1)\n assert p.wkt == \"POINT (-5642.5 120.1)\"\n\n\ndef test_point3d...
false
6,750
0584ff5cb252fba0fe1fc350a5fb023ab5cbb02b
from django.db import models class Category(models.Model): name = models.CharField(max_length=50, unique=True) created_at = models.DateTimeField(auto_now_add=True) def __str__(self): return self.name class Meta: verbose_name = 'Categoria' class Books(models.Model): name = model...
[ "from django.db import models\n\n\nclass Category(models.Model):\n name = models.CharField(max_length=50, unique=True)\n created_at = models.DateTimeField(auto_now_add=True)\n\n def __str__(self):\n return self.name\n\n class Meta:\n verbose_name = 'Categoria'\n\n\nclass Books(models.Model...
false
6,751
493552469943e9f9f0e57bf92b874c8b67943de5
import os from sources.lol.status import LOLServerStatusCollector from util.abstract.feed import Feed from util.abstract.handler import Handler from util.functions.load_json import load_json class LoLServerStatusHandler(Handler): def load_servers(self): servers_filepath = os.path.join(os.path.dirname(__...
[ "import os\n\nfrom sources.lol.status import LOLServerStatusCollector\nfrom util.abstract.feed import Feed\nfrom util.abstract.handler import Handler\nfrom util.functions.load_json import load_json\n\n\nclass LoLServerStatusHandler(Handler):\n\n def load_servers(self):\n servers_filepath = os.path.join(os...
false
6,752
ceca1be15aded0a842c5f2c6183e4f54aba4fd24
v = 426 # print 'Yeah!' if dividable by 4 but print 'End of program' after regardless if (v%4) == 0: print ("Yeah!") else: print ("End of the program")
[ "v = 426\n# print 'Yeah!' if dividable by 4 but print 'End of program' after regardless\n\nif (v%4) == 0:\n print (\"Yeah!\")\nelse:\n print (\"End of the program\")\n", "v = 426\nif v % 4 == 0:\n print('Yeah!')\nelse:\n print('End of the program')\n", "<assignment token>\nif v % 4 == 0:\n print(...
false
6,753
af9430caff843242381d7c99d76ff3c964915700
import os from flask import Flask,render_template,request,redirect,url_for from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session,sessionmaker app = Flask(__name__) engine = create_engine("postgres://lkghylsqhggivp:d827f6dc5637928e95e060761de590b7d9514e9463c5241ed3d652d777a4a3a9@ec2-5...
[ "import os\r\n\r\nfrom flask import Flask,render_template,request,redirect,url_for\r\nfrom sqlalchemy import create_engine\r\nfrom sqlalchemy.orm import scoped_session,sessionmaker\r\n\r\napp = Flask(__name__)\r\n\r\nengine = create_engine(\"postgres://lkghylsqhggivp:d827f6dc5637928e95e060761de590b7d9514e9463c5241e...
false
6,754
4c66ab6110e81bb88fc6916a1695e0f23e6e0e9d
from timeit import default_timer as timer import numpy as np bets1 = [ # lowest config possible 0.00000001, 0.00000004, 0.0000001, 0.0000005, 0.00000150, 0.00000500, 0.00001000 ] bets2 = [ # 2 is 10x 1 0.0000001, 0.0000004, 0.000001, 0.000005, 0.0000150, 0.0000500,...
[ "from timeit import default_timer as timer\nimport numpy as np\n\nbets1 = [ # lowest config possible\n 0.00000001,\n 0.00000004,\n 0.0000001,\n 0.0000005,\n 0.00000150,\n 0.00000500,\n 0.00001000\n]\nbets2 = [ # 2 is 10x 1\n 0.0000001,\n 0.0000004,\n 0.000001,\n 0.000005,\n 0.0...
false
6,755
9087a7bf42070fdb8639c616fdf7f09ad3903656
from .chair_model import run_chair_simulation, init_omega_t, \ JumpingModel, H_to_L from .utils import load_hcp_peaks, Condition, average_peak_counts
[ "from .chair_model import run_chair_simulation, init_omega_t, \\\n JumpingModel, H_to_L\nfrom .utils import load_hcp_peaks, Condition, average_peak_counts\n", "from .chair_model import run_chair_simulation, init_omega_t, JumpingModel, H_to_L\nfrom .utils import load_hcp_peaks, Condition, average_peak_count...
false
6,756
24ad62342fb9e7759be8561eaf0292736c7dcb6d
import sys def tackle_mandragora(health): health.sort() # for all tipping points, where we change over from eating to defeating defeating = defeating_cost_precompute(health) opt = 0 for i in range(0, len(health) + 1): opt = max(opt, defeating_cost(i, defeating)) return opt def defe...
[ "import sys\n\n\ndef tackle_mandragora(health):\n health.sort()\n # for all tipping points, where we change over from eating to defeating\n defeating = defeating_cost_precompute(health)\n\n opt = 0\n for i in range(0, len(health) + 1):\n opt = max(opt, defeating_cost(i, defeating))\n\n retu...
false
6,757
2fd490ca54f5d038997cec59a3e07c3f2c2d2538
from django.urls import path from . import views urlpatterns = [ path('', views.home, name ='park-home'), path('login/', views.login, name ='park-login'), ]
[ "from django.urls import path\nfrom . import views\n\n\nurlpatterns = [\n path('', views.home, name ='park-home'), \n path('login/', views.login, name ='park-login'), \n]", "from django.urls import path\nfrom . import views\nurlpatterns = [path('', views.home, name='park-home'), path('login/', vie...
false
6,758
359f4fa75379cc2dd80d372144ced08b8d15e0a4
def rank_and_file(l): dict = {} final_list = [] for each in l: for num in each: dict[num] = dict[num] + 1 if num in dict else 1 for key in dict: if dict[key] % 2 != 0: final_list.append(key) final_list = sorted(final_list) return " ".join(map(str, final_list)) f = open('B-large.in.txt', 'r') f2 = open(...
[ "def rank_and_file(l):\n\tdict = {}\n\tfinal_list = []\n\tfor each in l:\n\t\tfor num in each:\n\t\t\tdict[num] = dict[num] + 1 if num in dict else 1\n\tfor key in dict:\n\t\tif dict[key] % 2 != 0:\n\t\t\tfinal_list.append(key)\n\tfinal_list = sorted(final_list)\n\treturn \" \".join(map(str, final_list))\n\nf = ope...
false
6,759
40f57ccb1e36d307b11e367a2fb2f6c97051c65b
# @Time : 2019/6/2 8:42 # @Author : Xu Huipeng # @Blog : https://brycexxx.github.io/ class Solution: def isPalindrome(self, x: int) -> bool: num_str = str(x) i, j = 0, len(num_str) - 1 while i < j: if num_str[i] == num_str[j]: i += 1 j -= 1...
[ "# @Time : 2019/6/2 8:42\n# @Author : Xu Huipeng\n# @Blog : https://brycexxx.github.io/\n\nclass Solution:\n def isPalindrome(self, x: int) -> bool:\n num_str = str(x)\n i, j = 0, len(num_str) - 1\n while i < j:\n if num_str[i] == num_str[j]:\n i += 1\n ...
false
6,760
789f098fe9186d2fbda5417e9938930c44761b83
# Unsolved:Didn't try coz of this warning: # If you use Python, then submit solutions on PyPy. Try to write an efficient solution. from sys import stdin from collections import defaultdict t = int(input()) for _ in range(t): n = int(input()) arr = list(map(int, stdin.readline().strip().split())) d...
[ "# Unsolved:Didn't try coz of this warning:\r\n# If you use Python, then submit solutions on PyPy. Try to write an efficient solution.\r\nfrom sys import stdin\r\nfrom collections import defaultdict\r\nt = int(input())\r\nfor _ in range(t):\r\n n = int(input())\r\n arr = list(map(int, stdin.readline().strip()...
false
6,761
2180146da7ea745f5917ee66fd8c467437b5af4c
# Time :O(N) space: O(1) def swap(arr, start, end): while start < end: arr[start], arr[end] = arr[end], arr[start] start += 1 end -= 1 def rotation(arr, k, n): k = k % n swap(arr, 0, k-1) print(arr) swap(arr, k, n-1) print(arr) swap(arr, 0, n-1) print(arr) if _...
[ "# Time :O(N) space: O(1)\ndef swap(arr, start, end):\n while start < end:\n arr[start], arr[end] = arr[end], arr[start]\n start += 1\n end -= 1\n\ndef rotation(arr, k, n):\n k = k % n\n swap(arr, 0, k-1)\n print(arr)\n swap(arr, k, n-1)\n print(arr)\n swap(arr, 0, n-1)\n ...
false
6,762
cfdfc490396546b7af732417b506100357cd9a1f
#!/usr/bin/python3 # -*- coding: UTF-8 -*- import RPi.GPIO as gpio # 导入Rpi.GPIO库函数命名为GPIO import time gpio.setmode(gpio.BOARD) #将GPIO编程方式设置为BOARD模式 pin = 40 gpio.setup(pin, gpio.OUT) #控制pin号引脚 gpio.output(pin, gpio.HIGH) #11号引脚输出高电平 time.sleep(5) #计时0.5秒 gpio.output(pin, gpio.LOW) #11号引脚输出低电平 time.sleep(1) #计时1秒 ...
[ "#!/usr/bin/python3\n# -*- coding: UTF-8 -*-\n\nimport RPi.GPIO as gpio # 导入Rpi.GPIO库函数命名为GPIO\nimport time\n\ngpio.setmode(gpio.BOARD) #将GPIO编程方式设置为BOARD模式\n\npin = 40\n\ngpio.setup(pin, gpio.OUT) #控制pin号引脚\n\ngpio.output(pin, gpio.HIGH) #11号引脚输出高电平\ntime.sleep(5) #计时0.5秒\ngpio.output(pin, gpio.LOW) #11号引脚输出低电平\nt...
false
6,763
4af72cab6444922ca66641a08d45bcfe5a689844
from models import Cell,Board import random from pdb import set_trace as bp status={'end':-1} game=None class Game_Service(object): def __init__(self,row_num,col_num): self._row_num=row_num self._col_num=col_num mine_percent=0.3 self._mine_num=int(mine_percent*float(self._row_nu...
[ "\nfrom models import Cell,Board\nimport random\nfrom pdb import set_trace as bp\n\n\nstatus={'end':-1}\ngame=None\n\nclass Game_Service(object):\n\n def __init__(self,row_num,col_num):\n self._row_num=row_num\n self._col_num=col_num\n mine_percent=0.3\n self._mine_num=int(mine_percen...
false
6,764
4e202cf7d7da865498ef5f65efdf5851c62082ff
def decimal_to_binary(num): if num == 0: return '0' binary = '' while num != 0: binary = str(num % 2) + binary num = num // 2 return binary def modulo(numerator, exp, denominator): binary = decimal_to_binary(exp) prev_result = numerator result = 1 for i in range(len(bi...
[ "def decimal_to_binary(num):\n if num == 0: return '0'\n\n binary = ''\n while num != 0:\n binary = str(num % 2) + binary\n num = num // 2\n return binary\n\ndef modulo(numerator, exp, denominator):\n binary = decimal_to_binary(exp)\n\n prev_result = numerator\n result = 1\n fo...
false
6,765
382597628b999f2984dba09405d9ff3dd2f35872
#! /usr/bin/env python import RPIO import sys RPIO.setwarnings(False) gpio = int(sys.argv[1]) RPIO.setup(gpio, RPIO.OUT) input_value = RPIO.input(gpio) print input_value
[ "#! /usr/bin/env python\n\nimport RPIO\nimport sys\n\nRPIO.setwarnings(False)\n\ngpio = int(sys.argv[1])\n\nRPIO.setup(gpio, RPIO.OUT)\ninput_value = RPIO.input(gpio)\n\nprint input_value" ]
true
6,766
c5f0b1dde320d0042a1bf4de31c308e18b53cbeb
version https://git-lfs.github.com/spec/v1 oid sha256:0c22c74b2d9d62e2162d2b121742b7f94d5b1407ca5e2c6a2733bfd7f02e3baa size 5016
[ "version https://git-lfs.github.com/spec/v1\noid sha256:0c22c74b2d9d62e2162d2b121742b7f94d5b1407ca5e2c6a2733bfd7f02e3baa\nsize 5016\n" ]
true
6,767
886024a528112520948f1fb976aa7cb187a1da46
import json parsed = {} with open('/Users/danluu/dev/dump/terra/filtered_events.json','r') as f: # with open('/Users/danluu/dev/dump/terra/game-data/2017-05.json','r') as f: # with open('/Users/danluu/dev/dump/terra/ratings.json','r') as f: parsed = json.load(f) # print(json.dumps(parsed, indent=2)) print(js...
[ "import json\n\nparsed = {}\n\nwith open('/Users/danluu/dev/dump/terra/filtered_events.json','r') as f:\n# with open('/Users/danluu/dev/dump/terra/game-data/2017-05.json','r') as f:\n# with open('/Users/danluu/dev/dump/terra/ratings.json','r') as f:\n parsed = json.load(f)\n # print(json.dumps(parsed, indent=...
false
6,768
5c20eefe8111d44a36e69b873a71377ee7bfa23d
import os, datetime import urllib from flask import (Flask, flash, json, jsonify, redirect, render_template, request, session, url_for) import util.database as db template_path=os.path.dirname(__file__)+"/templates" file="" if template_path!="/templates": app = Flask("__main__",tem...
[ "import os, datetime\r\nimport urllib\r\n\r\nfrom flask import (Flask, flash, json, jsonify, redirect, render_template,\r\n request, session, url_for)\r\n\r\nimport util.database as db\r\n\r\ntemplate_path=os.path.dirname(__file__)+\"/templates\"\r\nfile=\"\"\r\nif template_path!=\"/templates\":\...
false
6,769
eeb588a162fa222c0f70eb832a0026d0d8adbe9b
import sys import os.path root_dir = os.path.dirname(os.path.dirname(__file__)) jsondb_dir = os.path.join(root_dir, 'jsondb') sys.path.append(jsondb_dir)
[ "import sys\nimport os.path\n\nroot_dir = os.path.dirname(os.path.dirname(__file__))\njsondb_dir = os.path.join(root_dir, 'jsondb')\nsys.path.append(jsondb_dir)\n", "import sys\nimport os.path\nroot_dir = os.path.dirname(os.path.dirname(__file__))\njsondb_dir = os.path.join(root_dir, 'jsondb')\nsys.path.append(js...
false
6,770
deaa458e51a7a53dd954d772f9e3b1734508cf28
''' REFERENCE a table with a FOREIGN KEY In your database, you want the professors table to reference the universities table. You can do that by specifying a column in professors table that references a column in the universities table. As just shown in the video, the syntax for that looks like this: ALTER TABLE a A...
[ "'''\nREFERENCE a table with a FOREIGN KEY\n\nIn your database, you want the professors table to reference the universities table. You can do that by specifying a column in professors table that references a column in the universities table.\n\nAs just shown in the video, the syntax for that looks like this:\n\nALT...
true
6,771
2d5e7c57f58f189e8d0c7d703c1672ea3586e4ac
""" Simple neural network using pytorch """ import torch import torch.nn as nn # Prepare the data # X represents the amount of hours studied and how much time students spent sleeping X = torch.tensor(([2, 9], [1, 5], [3, 6]), dtype=torch.float) # 3 X 2 tensor # y represent grades. y = torch.tensor(([92], [100], [89]...
[ "\"\"\"\nSimple neural network using pytorch\n\"\"\"\nimport torch\nimport torch.nn as nn\n\n# Prepare the data\n\n# X represents the amount of hours studied and how much time students spent sleeping\nX = torch.tensor(([2, 9], [1, 5], [3, 6]), dtype=torch.float) # 3 X 2 tensor\n# y represent grades. \ny = torch.ten...
false
6,772
2c2b075f9ea9e8d6559e44ad09d3e7767c48205e
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import numpy as np def weight_init(layers): for layer in layers: if isinstance(layer, nn.BatchNorm1d): layer.weight.data.fill_(1) layer.bias.data.zero_() elif isinstance(layer, nn.Lin...
[ "import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport torch.utils.data\n\nimport numpy as np\n\ndef weight_init(layers):\n for layer in layers:\n if isinstance(layer, nn.BatchNorm1d):\n layer.weight.data.fill_(1)\n layer.bias.data.zero_()\n elif isinsta...
false
6,773
1f21fdc9a198b31bb0d5bd6dd8f46a1b3b28ec94
import kwic mystr = "hello world\nmy test\napples oranges" #asseirt(kwic0.kwic(mystr) == []) #assert(kwic1.kwic(mystr) == [mystr]) #assert(len(kwic3.kwic(mystr))==2) assert len(kwic.kwic(mystr)) == 3
[ "import kwic\n\n\nmystr = \"hello world\\nmy test\\napples oranges\"\n#asseirt(kwic0.kwic(mystr) == [])\n#assert(kwic1.kwic(mystr) == [mystr])\n#assert(len(kwic3.kwic(mystr))==2)\nassert len(kwic.kwic(mystr)) == 3\n", "import kwic\nmystr = \"\"\"hello world\nmy test\napples oranges\"\"\"\nassert len(kwic.kwic(mys...
false
6,774
8fe9d21bb65b795a6633ab390f7f5d24a90146d5
x = '我是一个字符串' y = "我也是一个字符串" z = """我还是一个字符串""" #字符串str用单引号(' ')或双引号(" ")括起来 #使用反斜杠(\)转义特殊字符。 s = 'Yes,he doesn\'t' #如果你不想让反斜杠发生转义, #可以在字符串前面添加一个r,表示原始字符串 print('C:\some\name') print('C:\\some\\name') print(r'C:\some\name') #反斜杠可以作为续行符,表示下一行是上一行的延续。 s = "abcd\ efg" print(s) #还可以使用"""...""...
[ "x = '我是一个字符串'\r\ny = \"我也是一个字符串\"\r\nz = \"\"\"我还是一个字符串\"\"\"\r\n\r\n\r\n#字符串str用单引号(' ')或双引号(\" \")括起来\r\n\r\n#使用反斜杠(\\)转义特殊字符。\r\ns = 'Yes,he doesn\\'t'\r\n\r\n#如果你不想让反斜杠发生转义,\r\n#可以在字符串前面添加一个r,表示原始字符串\r\nprint('C:\\some\\name')\r\n\r\nprint('C:\\\\some\\\\name')\r\n\r\nprint(r'C:\\some\\name')\r\n\r\n#反斜杠可以作为续行...
false
6,775
bc0bfb0ff8eaf21b15b06eea2ea333381c70bc75
__author__='rhyschris' """ Defines the set of actions. This functions exactly the same as Actions.cs in the Unity game. """ from enum import Enum class Actions(Enum): doNothing = 0 crouch = 1 jump = 3 walkTowards = 0x1 << 2 runTowards = 0x2 << 2 moveAway = 0x3 << 2 blockUp = 0x1 ...
[ "__author__='rhyschris'\n\n\"\"\" Defines the set of actions.\n This functions exactly the same as \n Actions.cs in the Unity game.\n\"\"\"\nfrom enum import Enum\n\n\nclass Actions(Enum):\n doNothing = 0\n crouch = 1\n jump = 3\n walkTowards = 0x1 << 2\n runTowards = 0x2 << 2\n moveAway = 0...
true
6,776
bff9fb50f1901094c9ab3d61566509835c774f21
import time import os import random def generate_sequence(difficulty): print("Try to remember the numbers! : ") random_list = random.sample(range(1, 101), difficulty) time.sleep(2) print(random_list) time.sleep(0.7) os.system('cls') time.sleep(3) return random_list def get_list_from_...
[ "import time\nimport os\nimport random\n\n\ndef generate_sequence(difficulty):\n print(\"Try to remember the numbers! : \")\n random_list = random.sample(range(1, 101), difficulty)\n time.sleep(2)\n print(random_list)\n time.sleep(0.7)\n os.system('cls')\n time.sleep(3)\n return random_list\...
false
6,777
2ed0ae48e8fec2c92effcbb3e495a1a9f4636c27
import flask import flask_sqlalchemy app = flask.Flask(__name__) app.config.from_pyfile('settings.py') db = flask_sqlalchemy.SQLAlchemy(app)
[ "import flask\nimport flask_sqlalchemy\n\napp = flask.Flask(__name__)\napp.config.from_pyfile('settings.py')\ndb = flask_sqlalchemy.SQLAlchemy(app)\n", "import flask\nimport flask_sqlalchemy\napp = flask.Flask(__name__)\napp.config.from_pyfile('settings.py')\ndb = flask_sqlalchemy.SQLAlchemy(app)\n", "<import t...
false
6,778
8f57e120a1a84eb0b9918128580c152aabc6a724
from django.db import models class UserData(models.Model): username = models.CharField(max_length=24) email = models.EmailField(max_length=32, blank=True, null=True) password = models.CharField(max_length=32) created_data = models.DateTimeField() email_is_confirm = models.CharField(max_length=20, ...
[ "from django.db import models\n\n\nclass UserData(models.Model):\n username = models.CharField(max_length=24)\n email = models.EmailField(max_length=32, blank=True, null=True)\n password = models.CharField(max_length=32)\n created_data = models.DateTimeField()\n email_is_confirm = models.CharField(ma...
false
6,779
033973ddc81a5fdf0e40009c4f321215fe3f4217
class Solution(object): def checkSubarraySum(self, nums, k): if not nums or len(nums) == 1: return False sum_array = [0]*(len(nums)+1) for i, num in enumerate(nums): sum_array[i+1] = sum_array[i]+num if k == 0: if sum_array[-1] == 0: ...
[ "class Solution(object):\r\n def checkSubarraySum(self, nums, k):\r\n if not nums or len(nums) == 1:\r\n return False\r\n sum_array = [0]*(len(nums)+1)\r\n for i, num in enumerate(nums):\r\n sum_array[i+1] = sum_array[i]+num\r\n if k == 0:\r\n if sum_a...
false
6,780
f531af47431055866db72f6a7181580da461853d
#!/usr/bin/python from setuptools import setup, find_packages import os EXTRAS_REQUIRES = dict( test=[ 'pytest>=2.2.4', 'mock>=0.8.0', 'tempdirs>=0.0.8', ], dev=[ 'ipython>=0.13', ], ) # Tests always depend on all other requirements, except dev for k,v in EX...
[ "#!/usr/bin/python\nfrom setuptools import setup, find_packages\nimport os\n\nEXTRAS_REQUIRES = dict(\n test=[\n 'pytest>=2.2.4',\n 'mock>=0.8.0',\n 'tempdirs>=0.0.8',\n ],\n dev=[\n 'ipython>=0.13',\n ],\n )\n\n# Tests always depend on all other requirements, exce...
false
6,781
ec200ee66e3c4a93bbd8e75f0e8b715f54b5479d
# # In development by Jihye Sofia Seo https://www.linkedin.com/in/jihyeseo # forked from the code of Al Sweigart # http://inventwithpython.com/pygame/chapter10.html # whose books are very helpful for learning Python and PyGame. Many thanks! # Main change is that his version uses flood fill algorithm, which coul...
[ "#\r\n# In development by Jihye Sofia Seo https://www.linkedin.com/in/jihyeseo\r\n# forked from the code of Al Sweigart \r\n# http://inventwithpython.com/pygame/chapter10.html \r\n# whose books are very helpful for learning Python and PyGame. Many thanks!\r\n# Main change is that his version uses flood fill algori...
false
6,782
424a0e8a7a80e24aec4bdb9b8c84fd9a5e6090c6
import logging import time import random import pickle import os from sys import maxsize import torch from tensorboardX import SummaryWriter from baselines.common.schedules import LinearSchedule from abp.utils import clear_summary_path from abp.models.feature_q_model import feature_q_model from abp.adaptives.common.p...
[ "import logging\nimport time\nimport random\nimport pickle\nimport os\nfrom sys import maxsize\n\nimport torch\nfrom tensorboardX import SummaryWriter\nfrom baselines.common.schedules import LinearSchedule\n\nfrom abp.utils import clear_summary_path\nfrom abp.models.feature_q_model import feature_q_model\nfrom abp....
false
6,783
f44a8837056eb77fbf0ff37b9c57891cc3a3d6b2
import logging from datetime import datetime from preprocessing import death_preprocessing from preprocessing_three_month import death_preprocessing_three_month from death_rule_first_55 import death_rule_first_55 from death_rule_second import death_rule_second_new from death_escalation import death_escalation if __n...
[ "import logging\nfrom datetime import datetime\n\nfrom preprocessing import death_preprocessing\nfrom preprocessing_three_month import death_preprocessing_three_month\nfrom death_rule_first_55 import death_rule_first_55\nfrom death_rule_second import death_rule_second_new\nfrom death_escalation import death_escalat...
false
6,784
cc58e3944ee2bfb55cc2867395782a94c196e635
######################################################################################################################## # DEVELOPER README: # # This is the main script, where the GUI is initialised from. All of the main ...
[ "########################################################################################################################\n# DEVELOPER README: #\n# This is the main script, where the GUI is initialised from. All of th...
true
6,785
178f9dcd9cbea140abebd509b56979417b5d7503
# Python implementation of Bubble Sort def bubbleSort(arr): k = len(arr) # Traverse through all elements for i in range(k): # Last i elements are already in correct place for j in range(0, k - i - 1): # Swap if element is greater than next element if arr[j] > arr[j ...
[ "# Python implementation of Bubble Sort\n\n\ndef bubbleSort(arr):\n k = len(arr)\n # Traverse through all elements\n for i in range(k):\n # Last i elements are already in correct place\n for j in range(0, k - i - 1):\n # Swap if element is greater than next element\n if ...
false
6,786
4436fa36ec21edb3be467f74d8b9705780535f22
from common.utils import create_brokers from Bot import DataGatherBot, ArbitrageBot import api_config as config ### PAPER 이라고 정의한 # brokers = create_brokers('PAPER', config.CURRENCIES, config.EXCHANGES) # bot = ArbitrageBot(config, brokers) # brokers = create_brokers('BACKTEST', config.CURRENCIES, config.EXCHANGES) #...
[ "from common.utils import create_brokers\nfrom Bot import DataGatherBot, ArbitrageBot\nimport api_config as config\n\n### PAPER 이라고 정의한\n# brokers = create_brokers('PAPER', config.CURRENCIES, config.EXCHANGES)\n# bot = ArbitrageBot(config, brokers)\n\n# brokers = create_brokers('BACKTEST', config.CURRENCIES, config...
false
6,787
05186093820dffd047b0e7b5a69eb33f94f78b80
#!/usr/bin/env python ''' @author : Mitchell Van Braeckel @id : 1002297 @date : 10/10/2020 @version : python 3.8-32 / python 3.8.5 @course : CIS*4010 Cloud Computing @brief : A1 Part 2 - AWS DynamoDB ; Q2 - Query OECD @note : Description: There are many CSV files containing info from the OECD about agricultural p...
[ "#!/usr/bin/env python\n\n'''\n@author : Mitchell Van Braeckel\n@id : 1002297\n@date : 10/10/2020\n@version : python 3.8-32 / python 3.8.5\n@course : CIS*4010 Cloud Computing\n@brief : A1 Part 2 - AWS DynamoDB ; Q2 - Query OECD\n\n@note :\n Description: There are many CSV files containing info from the OECD abou...
false
6,788
e5bf4518f3834c73c3743d4c711a8d1a4ce3b944
# Generated by Django 3.2.5 on 2021-08-05 23:59 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('lectures', '0003_auto_20210805_1954'), ] operations = [ migrations.RenameField( model_name='lecture', old_name='is_requird',...
[ "# Generated by Django 3.2.5 on 2021-08-05 23:59\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('lectures', '0003_auto_20210805_1954'),\n ]\n\n operations = [\n migrations.RenameField(\n model_name='lecture',\n old...
false
6,789
a8106c8f14e15706b12e6d157b889288b85bc277
import random import datetime import userval import file from getpass import getpass #SORRY FOR THE REDUNDANT CODE, I RAN OUT OF OPTIONS def register(): global first,last,email,pin,password,accountName #prepared_user_details first=input("input firstname:") last=input("input lastname:") ...
[ "import random\nimport datetime \nimport userval\nimport file\nfrom getpass import getpass\n#SORRY FOR THE REDUNDANT CODE, I RAN OUT OF OPTIONS\n\n\ndef register():\n global first,last,email,pin,password,accountName #prepared_user_details\n first=input(\"input firstname:\")\n last=input(\"input...
false
6,790
8030bdb6c9f0b7114916d7abc245ff680d1fc917
workdir = './model/adamW-BCE/model_seresnext50_32x4d_i768_runmila_2fold_50ep' seed = 300 n_fold = 2 epoch = 50 resume_from = None batch_size = 32 num_workers = 32 imgsize = (768, 768) #(height, width) loss = dict( name='BCEWithLogitsLoss', params=dict(), ) optim = dict( name='AdamW', params=dict( ...
[ "workdir = './model/adamW-BCE/model_seresnext50_32x4d_i768_runmila_2fold_50ep'\nseed = 300\n\nn_fold = 2\nepoch = 50\nresume_from = None\n\nbatch_size = 32\nnum_workers = 32\nimgsize = (768, 768) #(height, width)\n\nloss = dict(\n name='BCEWithLogitsLoss',\n params=dict(),\n)\n\noptim = dict(\n name='AdamW...
false
6,791
804c75b3ab0b115e5187d44e4d139cfb553269a9
from django import template from ..models import Article # 得到django 负责管理标签和过滤器的类 register = template.Library() @register.simple_tag def getlatestarticle(): latearticle = Article.objects.all().order_by("-atime") return latearticle
[ "from django import template\nfrom ..models import Article\n# 得到django 负责管理标签和过滤器的类\nregister = template.Library()\n\n@register.simple_tag\ndef getlatestarticle():\n latearticle = Article.objects.all().order_by(\"-atime\")\n return latearticle", "from django import template\nfrom ..models import Article\nre...
false
6,792
52f3000514fd39083daa6316d551f1685c7cea23
from random import randint class Game(object): def __init__(self, players): if len(players) < 2: raise ValueError('Number of player must be at least 2') self.play_order = players self.player_data = {} for player in self.play_order: # ...
[ "from random import randint\n\n\nclass Game(object):\n def __init__(self, players):\n if len(players) < 2:\n raise ValueError('Number of player must be at least 2')\n\n self.play_order = players\n\n self.player_data = {}\n for player in self.play_order:\n # ...
false
6,793
7e33475a6ab7ad0d1e9d7d00b8443329e265fe69
def printPar(): for i in range(len(par)): print "par[{0:d}] = {1:d}".format(i,par[i]) def printImpar(): for i in range(len(impar)): print "impar[{0:d}] = {1:d}".format(i,impar[i]) par = [] impar = [] for i in range(15): n= int(raw_input()) if n%2 == 0: if len(par)<4: ...
[ "def printPar():\n for i in range(len(par)):\n print \"par[{0:d}] = {1:d}\".format(i,par[i])\ndef printImpar():\n for i in range(len(impar)):\n print \"impar[{0:d}] = {1:d}\".format(i,impar[i])\npar = []\nimpar = []\n\nfor i in range(15):\n n= int(raw_input())\n if n%2 == 0:\n if le...
true
6,794
430dff54da986df4e3a68018d930735c757d49d0
import time import json from threading import Thread try: with open('file.json') as f: name = json.load(f) except: f = open("file.json", "w+") name = {} def create(k, v, t='0'): if k in name: print("ERROR:The data already exists") else: if k.isalpha(): ...
[ "import time\r\nimport json\r\nfrom threading import Thread\r\n\r\n\r\ntry:\r\n with open('file.json') as f:\r\n name = json.load(f)\r\nexcept:\r\n f = open(\"file.json\", \"w+\")\r\n name = {}\r\n\r\n\r\ndef create(k, v, t='0'):\r\n if k in name:\r\n print(\"ERROR:The data already exists\...
false
6,795
76382f353c47747ee730d83c2d3990049c4b0d98
## ## Copyright (C) by Argonne National Laboratory ## See COPYRIGHT in top-level directory ## import re import os class G: pmi_vers = [] cmd_list = [] cmd_hash = {} class RE: m = None def match(pat, str, flags=0): RE.m = re.match(pat, str, flags) return RE.m def search(pat...
[ "##\n## Copyright (C) by Argonne National Laboratory\n## See COPYRIGHT in top-level directory\n##\n\nimport re\nimport os\n\nclass G:\n pmi_vers = []\n cmd_list = []\n cmd_hash = {}\n\nclass RE:\n m = None\n def match(pat, str, flags=0):\n RE.m = re.match(pat, str, flags)\n return R...
false
6,796
06caee24b9d0bb78e646f27486b9a3a0ed5f2502
#ribbon_a and ribbon_b are the two important variables here ribbon_a=None ribbon_b=None #Notes: # - As it turns out, the internal ADC in the Teensy is NOT very susceptible to fluctuations in the Neopixels' current...BUT...the ADS1115 IS. # Therefore, I think a better model would ditch the ADS1115 alltogether ...
[ "#ribbon_a and ribbon_b are the two important variables here\nribbon_a=None\nribbon_b=None\n\n#Notes:\n# - As it turns out, the internal ADC in the Teensy is NOT very susceptible to fluctuations in the Neopixels' current...BUT...the ADS1115 IS. \n# Therefore, I think a better model would ditch the ADS1115 a...
false
6,797
2e744c0cbddf64a9c538c9f33fa19ff78c515012
""" Stores custom FASTA sequences under a uuid in the database. Part of the tables used for custom jobs. """ import uuid from pred.webserver.errors import ClientException, ErrorType, raise_on_too_big_uploaded_data from pred.queries.dbutil import update_database, read_database from Bio import SeqIO from io import String...
[ "\"\"\"\nStores custom FASTA sequences under a uuid in the database.\nPart of the tables used for custom jobs.\n\"\"\"\nimport uuid\nfrom pred.webserver.errors import ClientException, ErrorType, raise_on_too_big_uploaded_data\nfrom pred.queries.dbutil import update_database, read_database\nfrom Bio import SeqIO\nfr...
false
6,798
5d8715dd02feff4e13919858051abeb5b6828011
# Imports import numpy as np from ctf.functions2d.function2d import Function2D # Problem class StyblinskiTang(Function2D): """ Styblinski-Tang Function. """ def __init__(self): """ Constructor. """ # Information self.min = np.array([-2.903534, -2.903534]) self.value = -39.16...
[ "# Imports\nimport numpy as np\n\nfrom ctf.functions2d.function2d import Function2D\n\n\n\n# Problem\nclass StyblinskiTang(Function2D):\n \"\"\" Styblinski-Tang Function. \"\"\"\n\n def __init__(self):\n \"\"\" Constructor. \"\"\"\n # Information\n self.min = np.array([-2.903534, -2.90353...
false
6,799
0dbdd7f7adffed850f126a2054c764b421c6ab84
from nltk.tokenize import sent_tokenize, word_tokenize from nltk.corpus import stopwords from nltk.stem import PorterStemmer from nltk.classify import NaiveBayesClassifier from nltk.probability import FreqDist import csv f = open('trolls.csv', 'r') file = csv.reader(f) sentences=[] remarks=[] psObject = PorterStemmer(...
[ "from nltk.tokenize import sent_tokenize, word_tokenize\nfrom nltk.corpus import stopwords\nfrom nltk.stem import PorterStemmer\nfrom nltk.classify import NaiveBayesClassifier\nfrom nltk.probability import FreqDist\nimport csv\n\nf = open('trolls.csv', 'r')\nfile = csv.reader(f)\nsentences=[]\nremarks=[]\npsObject ...
false