index
int64
0
100k
blob_id
stringlengths
40
40
code
stringlengths
7
7.27M
steps
listlengths
1
1.25k
error
bool
2 classes
3,400
3df57059539e5e3579c6dbee6be288e04b5f93b5
import boto3 import jinja2 import markdown # Instantiate S3 client s3_client = boto3.client('s3') # HTML style template TEMPLATE = """<!DOCTYPE html> <html> <head> <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css" rel="stylesheet"> <style> body { ...
[ "import boto3\nimport jinja2\nimport markdown\n\n# Instantiate S3 client\ns3_client = boto3.client('s3')\n\n# HTML style template\nTEMPLATE = \"\"\"<!DOCTYPE html>\n<html>\n<head>\n <link href=\"http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css\" rel=\"stylesheet\">\n <styl...
false
3,401
2ed9eafb6e26971f642d1e33cbb3d1f3df34990a
from gurobipy import * import math # params.NonConvex = 2 # K = 5 # R = {0: 1000, 1: 5000, 2: 10000, 3: 20000, 4: 69354} # imbalanced # R = {0: 50, 1: 100, 2: 150, 3: 84, 4: 400} # imbalanced # R = {0: 100, 1: 200, 2: 484} # imbalanced # R = {0: 10, 1: 20, 2: 30, 3: 50, 4: 100} # imbalanced # R = {0...
[ "from gurobipy import *\r\nimport math\r\n\r\n# params.NonConvex = 2\r\n# K = 5\r\n# R = {0: 1000, 1: 5000, 2: 10000, 3: 20000, 4: 69354} # imbalanced\r\n\r\n# R = {0: 50, 1: 100, 2: 150, 3: 84, 4: 400} # imbalanced\r\n\r\n# R = {0: 100, 1: 200, 2: 484} # imbalanced\r\n\r\n# R = {0: 10, 1: 20, 2: 30, 3: 50, 4: 1...
false
3,402
f125269d5b52da41734ce94683139c44f0c4a66a
""" Implements Single Instance Learning SVM From https://github.com/garydoranjr/misvm/blob/master/misvm/sil.py Modified by Nicolas """ from __future__ import print_function, division import numpy as np import inspect from sklearn.svm import LinearSVC as SVM from milsvm.util import slices class SIL(SVM): """ S...
[ "\"\"\"\nImplements Single Instance Learning SVM\nFrom https://github.com/garydoranjr/misvm/blob/master/misvm/sil.py\nModified by Nicolas\n\"\"\"\nfrom __future__ import print_function, division\nimport numpy as np\nimport inspect\nfrom sklearn.svm import LinearSVC as SVM\nfrom milsvm.util import slices\n\n\nclass ...
false
3,403
545053bc2b7c8687622d747673f2ad37b978014c
# Converts text to speech in different accents. Requires pip3 install gTTS from gtts import gTTS import os language_code = """ Language Code -------- ---- Afrikaans af Albanian sq Arabic ar Belarusian be Bulgarian bg Catalan ca Chinese Simplified zh-CN Chinese Traditional zh-T...
[ "# Converts text to speech in different accents. Requires pip3 install gTTS\nfrom gtts import gTTS\nimport os\n\nlanguage_code = \"\"\"\nLanguage Code\n-------- ----\nAfrikaans af\nAlbanian sq\nArabic ar\nBelarusian be\nBulgarian bg\nCatalan ca\nChinese Simplified zh-CN\nChines...
false
3,404
1deb070dd91c01190b70fa678add31ecb82f34fa
#Creating function def name_of_function(): ''' Docstring explains function. ''' return "Hello" #use return instead of print since return can be stored as a variable. #Simple example def dog_check(mystring): if 'dog' in mystring.lower(): return True else: return False #This is a beginner mo...
[ "#Creating function\n\ndef name_of_function():\n '''\n Docstring explains function.\n '''\n return \"Hello\" #use return instead of print since return can be stored as a variable.\n \n \n#Simple example\n\ndef dog_check(mystring):\n if 'dog' in mystring.lower():\n return True\n else:\n return False\...
false
3,405
4fbf5b4520aa4dca4c7cc80d56ba00f634d184bf
# -*- coding: utf-8 -*- # упражнение выполнено на Python 3 manual_calc = 53 + 1.0/3 def trapezoidal(f, a, b, n): h = float(b - a)/n result = 0.5*(f(a) + f(b)) for i in range(1, n): result += f(a + i*h) result *= h return result def rectangular(f, a, b, n): h = float(b - a)/n result = f(a+0.5*h) for ...
[ "# -*- coding: utf-8 -*-\n# упражнение выполнено на Python 3\n\n\nmanual_calc = 53 + 1.0/3\n\n\ndef trapezoidal(f, a, b, n):\n\t\n\th = float(b - a)/n\n\tresult = 0.5*(f(a) + f(b))\n\tfor i in range(1, n):\n\t\tresult += f(a + i*h)\n\tresult *= h\n\treturn result\n\n\ndef rectangular(f, a, b, n):\n\t\n\th = float(b...
false
3,406
995dc34ea32de4566e2804b6797d9b551b733ff3
forbidden = [ 'Key.esc', 'Key.cmd', 'Key.cmd_r', 'Key.menu', 'Key.pause', 'Key.scroll_lock', 'Key.print_screen', 'Key.enter', 'Key.space', 'Key.backspace', 'Key.ctrl_l', 'Key.ctrl_r', 'Key.alt_l', 'Key.alt_gr', 'Key.caps_lock', 'Key.num_lock', 'Key.tab', 'Key.shift', 'Key.shift_r', 'K...
[ "\r\nforbidden = [\r\n 'Key.esc', 'Key.cmd', 'Key.cmd_r', 'Key.menu', \r\n 'Key.pause', 'Key.scroll_lock', 'Key.print_screen', \r\n 'Key.enter', 'Key.space', 'Key.backspace', 'Key.ctrl_l', \r\n 'Key.ctrl_r', 'Key.alt_l', 'Key.alt_gr', 'Key.caps_lock',\r\n 'Key.num_lock', 'Key.tab', 'Key.shift', 'Key....
false
3,407
153d37b58a10847aae1fa7dbec4c7576c3d97fb2
import random # library to create window in the terminal import curses # initialized curses by returning a window object stdscr = curses.initscr() curses.noecho() curses.cbreak() stdscr.keypad(True) curses.curs_set(0) height, width = stdscr.getmaxyx() # create a new window of a given size window = cur...
[ "import random\r\n\r\n# library to create window in the terminal\r\nimport curses \r\n\r\n# initialized curses by returning a window object\r\nstdscr = curses.initscr()\r\ncurses.noecho()\r\ncurses.cbreak()\r\nstdscr.keypad(True)\r\ncurses.curs_set(0)\r\nheight, width = stdscr.getmaxyx()\r\n\r\n# create a new windo...
false
3,408
afb0359f4cdf5ed32bb785d969e9bf8919bb6add
import os import json import csv import re import requests import spacy import nltk from nltk.parse import CoreNLPParser from nltk.corpus import stopwords from nltk.stem import PorterStemmer stemmer = PorterStemmer() from time import time nlp = spacy.load('es_core_news_sm') from modules_api import conts_log sw_spanish=...
[ "import os\nimport json\nimport csv\nimport re\nimport requests\nimport spacy\nimport nltk\nfrom nltk.parse import CoreNLPParser\nfrom nltk.corpus import stopwords\nfrom nltk.stem import PorterStemmer\nstemmer = PorterStemmer()\nfrom time import time\nnlp = spacy.load('es_core_news_sm')\nfrom modules_api import con...
false
3,409
77e985d94d3b47539f046a3a46cb1a197cef86f4
############################################################################### # Programming Essentials B8IT102 Assessment # # Student: Barry Sheppard ID: 10387786 # # Problem 1 # ...
[ "###############################################################################\n# Programming Essentials B8IT102 Assessment #\n# Student: Barry Sheppard ID: 10387786 #\n# Problem 1 ...
false
3,410
3fed8723d215bce3cf391752e07ca85b2d6701a3
# Generated by Django 2.1.7 on 2019-04-01 14:37 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('submissions', '0004_auto_20190401_1834'), ] operations = [ migrations.AlterField( model_name='mainsubmission', name=...
[ "# Generated by Django 2.1.7 on 2019-04-01 14:37\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('submissions', '0004_auto_20190401_1834'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='mainsubmission',...
false
3,411
f8b473451a15e42319b60f44a527d715c0032614
n = int(input()) s = "" for i in range(n): l = list(map(lambda x:x*x,map(int, input().split()))) l.sort() if l[0] + l[1] == l[2]: s += "YES\n" else: s += "NO\n" print(s,end="")
[ "n = int(input())\ns = \"\"\nfor i in range(n):\n l = list(map(lambda x:x*x,map(int, input().split())))\n l.sort()\n if l[0] + l[1] == l[2]:\n s += \"YES\\n\"\n else:\n s += \"NO\\n\"\n\nprint(s,end=\"\")", "n = int(input())\ns = ''\nfor i in range(n):\n l = list(map(lambda x: x * x, map(int, inp...
false
3,412
915d6547057f43c1cc5d96d9cb4529c56bc85559
#"countinu" example : repeat printing "Too small" or "Input is..." according to input's lenth while True: s=raw_input('Enter something: ') if s == 'quit' : break if len(s) <3: print 'Too small' continue #continue : not exc...
[ "#\"countinu\" example : repeat printing \"Too small\" or \"Input is...\" according to input's lenth\r\n\r\nwhile True:\r\n s=raw_input('Enter something: ')\r\n if s == 'quit' :\r\n break\r\n if len(s) <3:\r\n print 'Too small'\r\n continue\r\n ...
true
3,413
78e72bf3ac73113e2c71caf5aed70b53cafa9c46
#题目014:将一个正整数分解质因数 #【编程思路】类似手算分解质因数的过程,找出因数后,原数字缩小 ''' 找出质因数并不难,把他们打印出来有点小烦 ''' num = int(input('请输入一个整数:')) original=num a= [] while num > 1: for i in range(2,num+1): if num%i == 0: a.append(i) num = num//i break print("%d ="%(original),end='') for i...
[ "#题目014:将一个正整数分解质因数\r\n#【编程思路】类似手算分解质因数的过程,找出因数后,原数字缩小\r\n'''\r\n找出质因数并不难,把他们打印出来有点小烦\r\n'''\r\n\r\nnum = int(input('请输入一个整数:'))\r\noriginal=num\r\n\r\na= []\r\nwhile num > 1:\r\n for i in range(2,num+1):\r\n if num%i == 0:\r\n a.append(i)\r\n num = num//i\r\n break\r\n\r\...
false
3,414
1aa2bff245322a34438cc836e23f430926dfac6c
import pymysql db = pymysql.connect( "localhost", "root", "", "order_db", use_unicode=True, charset="utf8") cursor = db.cursor() sql = "DROP TABLE custdetail" cursor.execute(sql) db.close()
[ "import pymysql\ndb = pymysql.connect( \"localhost\", \"root\", \"\", \"order_db\",\n use_unicode=True, charset=\"utf8\") \ncursor = db.cursor()\nsql = \"DROP TABLE custdetail\"\ncursor.execute(sql)\ndb.close()\n", "import pymysql\ndb = pymysql.connect('localhost', 'root', '', 'order_...
false
3,415
2e794e281c6f34858cd32725cdc454eb18c28892
import sys V, E = map(int, sys.stdin.readline().split()) node = [] graphs = [] for i in range(V+1): node.append(i) for _ in range(E): graphs.append((list(map(int, sys.stdin.readline().split())))) graph = sorted(graphs, key=lambda x: x[2]) def get_parent(parent, x): if parent[x] == x: return x ...
[ "import sys\n\nV, E = map(int, sys.stdin.readline().split())\n\nnode = []\ngraphs = []\nfor i in range(V+1):\n node.append(i)\n\nfor _ in range(E):\n graphs.append((list(map(int, sys.stdin.readline().split()))))\n\ngraph = sorted(graphs, key=lambda x: x[2])\n\n\ndef get_parent(parent, x):\n if parent[x] ==...
false
3,416
3ac30240577eda08343796abbd051d5d3b45beaf
import numpy as np import cv2 import matplotlib.pyplot as plt import matplotlib.image as mpimg from glob import glob from moviepy.editor import VideoFileClip output_images_dir = './output_images/' test_images_dir = './test_images/' output_video_file = 'output.mp4' mtx = None dist = None def load_image(filename): ...
[ "import numpy as np\nimport cv2\nimport matplotlib.pyplot as plt\nimport matplotlib.image as mpimg\nfrom glob import glob\nfrom moviepy.editor import VideoFileClip\n\noutput_images_dir = './output_images/'\ntest_images_dir = './test_images/'\noutput_video_file = 'output.mp4'\n\nmtx = None\ndist = None\n\ndef load_i...
false
3,417
644b4a2f0e8ce95e669c9c01df111c943e0c4af2
#!/usr/bin/env python # -*- coding:utf-8 -*- """ Module test_measured_model - Contains the unit tests for the classes in the datamodels.miri_measured_model module. :History: 15 Jan 2013: Created. 21 Jan 2013: Warning messages controlled with Python warnings module. 05 Feb 2013: File closing problem solved by using ...
[ "#!/usr/bin/env python\n# -*- coding:utf-8 -*-\n\n\"\"\"\n\nModule test_measured_model - Contains the unit tests for the classes\nin the datamodels.miri_measured_model module.\n\n:History:\n\n15 Jan 2013: Created.\n21 Jan 2013: Warning messages controlled with Python warnings module.\n05 Feb 2013: File closing prob...
false
3,418
4a0213351f8e9dcb2c6e71317a5ff1064974652e
class Solution: def divide(self, dividend, divisor): """ :type dividend: int :type divisor: int :rtype: int """ negative = (dividend < 0) ^ (divisor < 0) dividend, divisor = abs(dividend), abs(divisor) result = 0 while dividend >= divisor: ...
[ "class Solution:\n def divide(self, dividend, divisor):\n \"\"\"\n :type dividend: int\n :type divisor: int\n :rtype: int\n \"\"\"\n negative = (dividend < 0) ^ (divisor < 0)\n dividend, divisor = abs(dividend), abs(divisor)\n\n result = 0\n while di...
false
3,419
14b98186fbc9c275cea3c042cdb4899f6d0c54c6
#!/usr/bin/python #_*_coding:utf-8_*_ import random def main(): source = "I couldn't believe that I could actually understand what I was reading : the phenomenal power of the human mind ." words = source.strip().split(" ") new_str = list() for word in words: if len(word) > 4: shuff...
[ "#!/usr/bin/python\n#_*_coding:utf-8_*_\n\nimport random\n\ndef main():\n source = \"I couldn't believe that I could actually understand what I was reading : the phenomenal power of the human mind .\"\n words = source.strip().split(\" \")\n new_str = list()\n for word in words:\n if len(word) > 4...
true
3,420
89b03bb5ca86e426459e23866f86f8770e4a1613
from collections import defaultdict def solve(n, seq): flag = True # slot = [0] * (n + 10) freq = defaultdict() # refer to next free slot i = 1 p = len(seq) j = 0 while j < p: c = seq[j] if i > n: flag = False break if c in freq.keys(): ...
[ "from collections import defaultdict\n\ndef solve(n, seq):\n flag = True\n # slot = [0] * (n + 10)\n freq = defaultdict()\n\n # refer to next free slot\n i = 1\n p = len(seq)\n j = 0\n\n while j < p:\n c = seq[j]\n if i > n:\n flag = False\n break\n ...
false
3,421
1355c3abfd2683f6dc869703fdb79a04e264099c
"""For logging training information to files.""" import os def delete_log(file_path): """Delete a log file. Args: file_path: String, the full path to the log file. Raises: ValueError: if file not found. """ if os.path.exists(file_path): print('Deleting log %s...' % file_path)...
[ "\"\"\"For logging training information to files.\"\"\"\nimport os\n\n\ndef delete_log(file_path):\n \"\"\"Delete a log file.\n\n Args:\n file_path: String, the full path to the log file.\n\n Raises:\n ValueError: if file not found.\n \"\"\"\n if os.path.exists(file_path):\n print('D...
false
3,422
d98db745be2ab9c506a98539b25e9b46e4997136
# -*- coding: utf-8 -*- """ Created on Thu Jun 28 16:36:56 2018 @author: Alex """ #%% Import packages import pickle import numpy as np import matplotlib.pyplot as plt import networkx as nx import os os.chdir('C:\\Users\\Alex\\Documents\\GitHub\\insight-articles-project\\src\\topic modeling\\') from plotly_network ...
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Thu Jun 28 16:36:56 2018\n\n@author: Alex\n\"\"\"\n\n#%% Import packages \nimport pickle \nimport numpy as np\nimport matplotlib.pyplot as plt\nimport networkx as nx\nimport os \nos.chdir('C:\\\\Users\\\\Alex\\\\Documents\\\\GitHub\\\\insight-articles-project\\\\src\\\\t...
false
3,423
18d1722529a63f9a1696b09c40dabb1c68ed55f4
import subprocess from flask import Flask, render_template, request from subprocess import Popen, PIPE, check_output def toggle_relay(value): session = subprocess.Popen("./relay " + value, stdout=PIPE, stderr=PIPE, shell=True) stdout, stderr = session.communicate() if stderr: raise Exception("Error...
[ "import subprocess\nfrom flask import Flask, render_template, request\nfrom subprocess import Popen, PIPE, check_output\n\ndef toggle_relay(value):\n session = subprocess.Popen(\"./relay \" + value, stdout=PIPE, stderr=PIPE, shell=True)\n stdout, stderr = session.communicate()\n if stderr:\n raise E...
false
3,424
3a3400426b054b2fc3d060141a1f84e5db553e59
import deform import deform.widget from deform import (widget) # decorator, default_renderer, field, form, import colander # import htmllaundry # from htmllaundry import sanitize from validators import (cyber_validator, phone_validator, stor_validator, ...
[ "import deform\nimport deform.widget\nfrom deform import (widget) # decorator, default_renderer, field, form,\nimport colander\n# import htmllaundry\n# from htmllaundry import sanitize\n\nfrom validators import (cyber_validator,\n phone_validator,\n stor_validator,\n ...
false
3,425
234112ec16af39b79849dd08769597771fa2c38f
#! /usr/bin/env python from taskHandler import Location, Task, TaskFactory import roslib; roslib.load_manifest('smart_stool') import rospy from geometry_msgs.msg import PoseStamped, Twist, Vector3 from nav_msgs.msg import Odometry from kobuki_msgs.msg import BumperEvent from move_base_msgs.msg import MoveBaseActionRes...
[ "#! /usr/bin/env python\n\nfrom taskHandler import Location, Task, TaskFactory\nimport roslib; roslib.load_manifest('smart_stool')\nimport rospy\nfrom geometry_msgs.msg import PoseStamped, Twist, Vector3\nfrom nav_msgs.msg import Odometry\nfrom kobuki_msgs.msg import BumperEvent\nfrom move_base_msgs.msg import Move...
true
3,426
f781377a52400abd617e7f0c5529726120b78476
import random import time from typing import Dict, List, Optional from bemani.client.base import BaseClient from bemani.protocol import Node class ReflecBeatColette(BaseClient): NAME = 'TEST' def verify_pcb_boot(self, loc: str) -> None: call = self.call_node() pcb = Node.void('pcb') ...
[ "import random\nimport time\nfrom typing import Dict, List, Optional\n\nfrom bemani.client.base import BaseClient\nfrom bemani.protocol import Node\n\n\nclass ReflecBeatColette(BaseClient):\n NAME = 'TEST'\n\n def verify_pcb_boot(self, loc: str) -> None:\n call = self.call_node()\n\n pcb = Node....
false
3,427
ec9a152e39a0c51319e4db58eea4496cff5b2fd6
import numpy from nn_functor import functions class Linear(functions.Learn): def implement(self, a, p): x = a[0] w, b0 = p return w.dot(x) + b0 def update(self, a, b, p): i = self.implement(a, p) x = a[0] w, b0 = p u_w = w - self.eps * (i - b)[:, N...
[ "import numpy\n\nfrom nn_functor import functions\n\n\nclass Linear(functions.Learn):\n\n def implement(self, a, p):\n x = a[0]\n w, b0 = p\n\n return w.dot(x) + b0\n\n def update(self, a, b, p):\n i = self.implement(a, p)\n\n x = a[0]\n w, b0 = p\n\n u_w = w -...
false
3,428
ac1ac80739bed0cebf7a89a7d55e1b4fa6c68cdf
from django.shortcuts import render from django.http import HttpResponse # Create your views here. def index(request): #return HttpRequest("Hi This is SAU5081 page.") return render(request, "sau5081/sau5081.html")
[ "from django.shortcuts import render\nfrom django.http import HttpResponse\n\n\n# Create your views here.\ndef index(request):\n #return HttpRequest(\"Hi This is SAU5081 page.\")\n return render(request, \"sau5081/sau5081.html\")", "from django.shortcuts import render\nfrom django.http import HttpResponse\n...
false
3,429
4a9c42727a28e19cf1eebcf72784b85bbae695bf
#1.25.2019 - shashi #Program that accepts an array of different elements #And moves all the integer 0s to the end of it. String 0s like "0" or "0.0" remain untouched. def shiftZeroesToEnd(myArray): #function starts here zeroCounter = 0 #counter to keep track of how many 0s exist. shiftedArray = [] #array to h...
[ "#1.25.2019 - shashi\n#Program that accepts an array of different elements\n#And moves all the integer 0s to the end of it. String 0s like \"0\" or \"0.0\" remain untouched.\n\n\ndef shiftZeroesToEnd(myArray): #function starts here\n zeroCounter = 0 #counter to keep track of how many 0s exist.\n shiftedArray ...
false
3,430
cee9deeeabfec46ee5c132704e8fd653e55987f3
# coding: utf-8 import logging def __gen_logger(): result = logging.getLogger('superslick') return result logger = __gen_logger()
[ "# coding: utf-8\n\nimport logging\n\ndef __gen_logger():\n result = logging.getLogger('superslick')\n return result\n\nlogger = __gen_logger()", "import logging\n\n\ndef __gen_logger():\n result = logging.getLogger('superslick')\n return result\n\n\nlogger = __gen_logger()\n", "<import token>\n\n\n...
false
3,431
c74fc99bf8582fd83c312f27dfffbe894a2c8c1b
import os import sqlite3 import operator from collections import OrderedDict import matplotlib.pyplot as plt def parse(url): try: parsed_url_components = url.split('//') sublevel_split = parsed_url_components[1].split('/', 1) domain = sublevel_split[0].replace("www.", "") return domain except IndexError: p...
[ "import os\nimport sqlite3\nimport operator\nfrom collections import OrderedDict\nimport matplotlib.pyplot as plt\n\ndef parse(url):\n\ttry:\n\t\tparsed_url_components = url.split('//')\n\t\tsublevel_split = parsed_url_components[1].split('/', 1)\n\t\tdomain = sublevel_split[0].replace(\"www.\", \"\")\n\t\treturn d...
false
3,432
af7a124c873dda02ba2a78e85965aa243d791863
# -*- coding: utf-8 -*- import os from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore class Config: SECRET_KEY = os.environ.get('SECRET_KEY') # github GITHUB_OAUTH2 = { #github上获取 'client_id': '', 'client_secret': '', 'callback_url': '', 'scope': 'user'...
[ "# -*- coding: utf-8 -*-\nimport os\nfrom apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore\n\n\nclass Config:\n SECRET_KEY = os.environ.get('SECRET_KEY')\n # github\n GITHUB_OAUTH2 = {\n #github上获取\n 'client_id': '',\n 'client_secret': '',\n 'callback_url': '',\n ...
true
3,433
cdb49af584ae7befcaebfd9bb303073c8229667e
#!/usr/bin/python import os import psycopg2 import datetime import time import json import decimal import requests import csv import asyncio from config import get_connection, get_db_sql, get_sql_record_count, CORP_TYPES_IN_SCOPE, corp_num_with_prefix, bare_corp_num from orgbook_data_load import ( get_orgbook_all...
[ "#!/usr/bin/python\nimport os \nimport psycopg2\nimport datetime\nimport time\nimport json\nimport decimal\nimport requests\nimport csv\nimport asyncio\n\nfrom config import get_connection, get_db_sql, get_sql_record_count, CORP_TYPES_IN_SCOPE, corp_num_with_prefix, bare_corp_num\nfrom orgbook_data_load import (\n ...
false
3,434
306240db8a1652fe7cd79808c40e4354c3158d3e
import json import sys import time # boardName pageNum indexNewest # Baseball 5000 5183 # Elephants 3500 3558 # Monkeys 3500 3672 # Lions 3300 3381 # Guardians 3500 3542 boardNameList = ["Baseball", "Elephants", "Monkeys", "Lions", "Guardians"] def loadData(filename): _data = json.loads(open(filename).read()) return...
[ "import json\nimport sys\nimport time\n# boardName\tpageNum\tindexNewest\n# Baseball\t5000\t5183\n# Elephants\t3500\t3558\n# Monkeys\t3500\t3672\n# Lions\t3300\t3381\n# Guardians\t3500\t3542\n\nboardNameList = [\"Baseball\", \"Elephants\", \"Monkeys\", \"Lions\", \"Guardians\"]\ndef loadData(filename):\n\t_data = j...
false
3,435
c66b07c45f4a675a6c7fcec82048a3197910d0d8
marks = { "S":"subject", "O":"object", "A":"attribute", "C":"clause", } marks_reverse = { "subject":"S", "object":"O", "attribute":"A", "clause":"C", }
[ "marks = {\n \"S\":\"subject\",\n \"O\":\"object\",\n \"A\":\"attribute\",\n \"C\":\"clause\",\n}\nmarks_reverse = {\n \"subject\":\"S\",\n \"object\":\"O\",\n \"attribute\":\"A\",\n \"clause\":\"C\",\n}\n", "marks = {'S': 'subject', 'O': 'object', 'A': 'attribute', 'C': 'clause'}\nmarks_r...
false
3,436
cbbe273a19a4e60b760e35aeb8d43972a46760f5
import tensorflow as tf from models.base_model import BaseModel from utils.im_utils import batch_convert_2_int from datasets.single_dataset import SingleDataset from datasets.unpaired_dataset import UnpairedDataset from models.generators.maskshadowgan_generators import Generator from models.discriminators.maskshadowgan...
[ "import tensorflow as tf\nfrom models.base_model import BaseModel\nfrom utils.im_utils import batch_convert_2_int\nfrom datasets.single_dataset import SingleDataset\nfrom datasets.unpaired_dataset import UnpairedDataset\nfrom models.generators.maskshadowgan_generators import Generator\nfrom models.discriminators.ma...
false
3,437
6334a8a052d72b0f13395b301bd5a766acf4399b
from utils import create_data_lists if __name__ == '__main__': create_data_lists( ICDAR_path='../ICDAR_Dataset/0325updated.task1train(626p)', output_folder='../ICDAR_Dataset/0325updated.task1train(626p)')
[ "from utils import create_data_lists\n\nif __name__ == '__main__':\n create_data_lists(\n ICDAR_path='../ICDAR_Dataset/0325updated.task1train(626p)',\n output_folder='../ICDAR_Dataset/0325updated.task1train(626p)')\n", "from utils import create_data_lists\nif __name__ == '__main__':\n create_d...
false
3,438
c846c33ef13795d51c6d23ffa5a6b564b66e6a3c
from pathlib import Path from build_midi.appenders import * from build_midi.converters import Converter from build_midi.melody_builder import MelodyBuilder from build_midi.sequences import * from build_midi.tracks import * from music_rules.instruments import Instruments from music_rules.music_scale import MusicScale f...
[ "from pathlib import Path\n\nfrom build_midi.appenders import *\nfrom build_midi.converters import Converter\nfrom build_midi.melody_builder import MelodyBuilder\nfrom build_midi.sequences import *\nfrom build_midi.tracks import *\nfrom music_rules.instruments import Instruments\nfrom music_rules.music_scale import...
false
3,439
0c736bb5c88a8d7ee359e05fe12f0b77d83146c8
#!/usr/bin/python2.7 # # Assignment2 Interface # import psycopg2 import os import sys import Assignment1 as a # Donot close the connection inside this file i.e. do not perform openconnection.close() #range__metadata = RangeRatingsMetadata #roundR_metadata = RoundRobinRatingsMetadata #rangetablepartition = rangeratings...
[ "#!/usr/bin/python2.7\n#\n# Assignment2 Interface\n#\n\nimport psycopg2\nimport os\nimport sys\nimport Assignment1 as a\n# Donot close the connection inside this file i.e. do not perform openconnection.close()\n#range__metadata = RangeRatingsMetadata\n#roundR_metadata = RoundRobinRatingsMetadata\n#rangetablepartiti...
true
3,440
da0076ab18531e5b8a1de909cb9178de6327d6b0
""" The MIT License (MIT) Copyright (c) 2015 Tommy Carpenter Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, mer...
[ "\"\"\"\nThe MIT License (MIT)\n\nCopyright (c) 2015 Tommy Carpenter\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use,...
false
3,441
a96761fc483c0883b058c2b045b038522c23d426
T = int(input()) for i in range(T): start, end = map(int, input().split()) between = end-start flag = 0 num =1 while between>0: if flag%2==1: between-=num num+=1 flag+=1 else: between-=num flag+=1 print(flag) ...
[ "T = int(input())\nfor i in range(T):\n start, end = map(int, input().split())\n between = end-start\n flag = 0\n num =1\n while between>0:\n \n if flag%2==1:\n between-=num\n num+=1\n flag+=1\n else:\n between-=num\n flag+=1\n ...
false
3,442
d66945add0726c85b8ac29056269ed55c6eb9369
# Copyright 2020 Google LLC. # 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, softw...
[ "# Copyright 2020 Google LLC.\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# Unless required by applicable law or agreed to in ...
false
3,443
632b90ea5a2ac35539e589af297c04b31bbf02d0
import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output from app import app layout = html.Div([ html.H3('Node 6'), dcc.Dropdown( id='node-6-dropdown', options=[ {'label': 'Node 6 - {}'.format(i), 'value': i} for ...
[ "import dash_core_components as dcc\r\nimport dash_html_components as html\r\nfrom dash.dependencies import Input, Output\r\n\r\nfrom app import app\r\n\r\nlayout = html.Div([\r\n html.H3('Node 6'),\r\n dcc.Dropdown(\r\n id='node-6-dropdown',\r\n options=[\r\n {'label': 'Node 6 - {}'....
false
3,444
290b8b4c3aeafc84b1e9cce7e6d2a5e770bd8716
cadena = input("Introduzca su cadena: ") separador = input("Introduzca el separador: ") print(cadena.replace(" ", separador))
[ "cadena = input(\"Introduzca su cadena: \")\nseparador = input(\"Introduzca el separador: \")\nprint(cadena.replace(\" \", separador))", "cadena = input('Introduzca su cadena: ')\nseparador = input('Introduzca el separador: ')\nprint(cadena.replace(' ', separador))\n", "<assignment token>\nprint(cadena.replace(...
false
3,445
32c28c7a1e1572744387b509fc6a448554ed565e
# Generated by Django 2.2.5 on 2019-10-28 08:45 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('user', '0001_initial'), ] operations = [ migrations.AddField( model_name='user', name='my_resume', field...
[ "# Generated by Django 2.2.5 on 2019-10-28 08:45\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('user', '0001_initial'),\n ]\n\n operations = [\n migrations.AddField(\n model_name='user',\n name='my_resume'...
false
3,446
d5c2b73c202c9944cd64798ef5ddc08ce68a4a9a
import os.path from flask import url_for from sqlalchemy import Column, Integer, String, Sequence, ForeignKey from sqlalchemy.orm import relationship from tuneful import app from .database import Base, engine, session class Song(Base): __tablename__ = 'songs' id = Column(Integer, primary_key=True) file_i...
[ "import os.path\n\nfrom flask import url_for\nfrom sqlalchemy import Column, Integer, String, Sequence, ForeignKey\nfrom sqlalchemy.orm import relationship\n\nfrom tuneful import app\nfrom .database import Base, engine, session\n\nclass Song(Base):\n __tablename__ = 'songs'\n id = Column(Integer, primary_key=...
false
3,447
856e62cf4cd443c7b3397e926f8fc4fece145f5b
# coding=utf-8 class Movie: def __init__(self,movieid,moviename,score,poster): self.movieid=movieid self.moviename=moviename self.score=score self.poster=poster for i in range(1,32): print("<option value =\""+str(i)+"\">"+str(i)+"</option>")
[ "# coding=utf-8\r\nclass Movie:\r\n def __init__(self,movieid,moviename,score,poster):\r\n self.movieid=movieid\r\n self.moviename=moviename\r\n self.score=score\r\n self.poster=poster\r\n\r\nfor i in range(1,32):\r\n print(\"<option value =\\\"\"+str(i)+\"\\\">\"+str(i)+\"</option...
false
3,448
691075aa5c629e2d0c486ec288cd39bc142cdc7a
# Simple read based on the py _sql context from pyspark.sql import SQLContext sqlContext = SQLContext(sc) flow_data = sc._jvm.com.tetration.apps.IO.read(sqlContext._ssql_ctx, "/tetration/flows/", "PARQUET", "LASTHOUR") flow_data.registerTempTable("flowtab") # show the unique src_address and dst_address pairs df = sq...
[ "# Simple read based on the py _sql context\nfrom pyspark.sql import SQLContext\nsqlContext = SQLContext(sc)\n\n\nflow_data = sc._jvm.com.tetration.apps.IO.read(sqlContext._ssql_ctx, \"/tetration/flows/\", \"PARQUET\", \"LASTHOUR\")\nflow_data.registerTempTable(\"flowtab\")\n\n# show the unique src_address and dst_...
false
3,449
23e673909b2f1eb9a265ce84ad63464e20e99c6a
# coding=utf-8 import pyautogui from xpinyin import Pinyin rubbish_dic=1 if rubbish_dic==0: chinese_rubbish=( u"草泥马", u"你妈死了", u"你是不是", u"低能", u"人话都听不懂", u"没家教的狗东西", ) elif rubbish_dic==1: rubbish_file=open("rubbish_dic.txt") chinese_rubbish=rubbish_file.read().splitlines() ...
[ "# coding=utf-8\nimport pyautogui\nfrom xpinyin import Pinyin\n\nrubbish_dic=1\n\nif rubbish_dic==0:\n chinese_rubbish=(\n u\"草泥马\",\n u\"你妈死了\",\n u\"你是不是\",\n u\"低能\",\n u\"人话都听不懂\",\n u\"没家教的狗东西\", \n )\nelif rubbish_dic==1:\n rubbish_file=open(\"rubbish_dic.txt\")\n chinese_rubbi...
false
3,450
49e1dc98ecc2e5c12c6e520721a6c0a7c2665cca
from flask import Flask, jsonify, make_response, request app = Flask(__name__) VERSION = (0, 1, 0) VERSION_STRING = "{}.{}.{}".format(*VERSION) LANG_ID = "lang.natural.english" @app.errorhandler(404) def not_found(error): return make_response(jsonify({'error': 'Not found'}), 404) @app.route("/") def entry()...
[ "from flask import Flask, jsonify, make_response, request\n\n\napp = Flask(__name__)\n\nVERSION = (0, 1, 0)\nVERSION_STRING = \"{}.{}.{}\".format(*VERSION)\n\nLANG_ID = \"lang.natural.english\"\n\n\n@app.errorhandler(404)\ndef not_found(error):\n return make_response(jsonify({'error': 'Not found'}), 404)\n\n\n@a...
false
3,451
5cdf8cd4bfebb9aab2e8f421047fc1ba3190d566
## #Author: Stephen ## import socket import select import sys, os from contextlib import contextmanager hostip = 'localhost' hostport = 8089 def connect(hostip=hostip,hostport=hostport): server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) IP_address = hostip Port = hostport server.connect((IP_a...
[ "##\n#Author: Stephen\n##\nimport socket\nimport select\nimport sys, os\nfrom contextlib import contextmanager\n\nhostip = 'localhost'\nhostport = 8089\n\ndef connect(hostip=hostip,hostport=hostport):\n server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n IP_address = hostip\n Port = hostport\n ...
false
3,452
15105e22b3c1860735f282a2247ab41b138d75cf
import matplotlib.pyplot as plt w1 = [(1, 2, 7), (1, 8, 1), (1, 7, 5), (1, 6, 3), (1, 7, 8), (1, 5, 9), (1, 4, 5)] w2 = [(-1, -4, -2), (-1, 1, 1), (-1, -1, -3), (-1, -3, 2), (-1, -5, -3.25), (-1, -2, -4), (-1, -7, -1)] dataset = [(1, 2, 7), (1, 8, 1), (1, 7, 5), (1, 6, 3)...
[ "import matplotlib.pyplot as plt\n\nw1 = [(1, 2, 7), (1, 8, 1),\n (1, 7, 5), (1, 6, 3),\n (1, 7, 8), (1, 5, 9),\n (1, 4, 5)]\nw2 = [(-1, -4, -2), (-1, 1, 1),\n (-1, -1, -3), (-1, -3, 2),\n (-1, -5, -3.25), (-1, -2, -4),\n (-1, -7, -1)]\ndataset = [(1, 2, 7), (1, 8, 1),\n (1, ...
true
3,453
4f54f3e306df3b861124adb4fe544089446e8021
import unittest import sys import matplotlib.pyplot as plotter import numpy sys.path.append("/home/adityas/UGA/SensorWeb/scripts/Summer2018/code") from simulator.component import CPU, DiskIO, Network class TestComponents(unittest.TestCase): def setUp(self): self.cpu = CPU(cycles=5) self.disk = ...
[ "import unittest\nimport sys\nimport matplotlib.pyplot as plotter\nimport numpy\n\nsys.path.append(\"/home/adityas/UGA/SensorWeb/scripts/Summer2018/code\")\n\nfrom simulator.component import CPU, DiskIO, Network\n\n\nclass TestComponents(unittest.TestCase):\n\n def setUp(self):\n self.cpu = CPU(cycles=5)\...
false
3,454
0d6177660a9b9c22bcf6eb11763e7fe1ee03b46a
#!/usr/bin/env python # Copyright (c) 2018, University of Stuttgart # All rights reserved. # # Permission to use, copy, modify, and distribute this software for any purpose # with or without fee is hereby granted, provided that the above copyright # notice and this permission notice appear in all copies. # # THE ...
[ "#!/usr/bin/env python\n\n# Copyright (c) 2018, University of Stuttgart\n# All rights reserved.\n#\n# Permission to use, copy, modify, and distribute this software for any purpose\n# with or without fee is hereby granted, provided that the above copyright\n# notice and this permission notice appear in all copi...
false
3,455
3d1f2130043613dc8d5bbd773edd96c87c355de9
import rambench rambench.perform_benchmark()
[ "import rambench\n\nrambench.perform_benchmark()\n", "import rambench\nrambench.perform_benchmark()\n", "<import token>\nrambench.perform_benchmark()\n", "<import token>\n<code token>\n" ]
false
3,456
8010c0d53af6d428f29ff3ce63bcd6b5b811b051
$ pip install "<package_name> >= 1.1"
[ "$ pip install \"<package_name> >= 1.1\"\n\n" ]
true
3,457
72286078841c7fe5b297767576741dbbd0a80411
import pytest import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) import extract_tables_columns def test_get_tables(): sql_str = "SELECT * FROM table1, table2 WHERE table1.column1 = table2.column1;" assert(extract_tables_columns.get_tables(sql_str)) == [('TA...
[ "import pytest\nimport os\nimport sys\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))\n\nimport extract_tables_columns\n\ndef test_get_tables():\n sql_str = \"SELECT * FROM table1, table2 WHERE table1.column1 = table2.column1;\"\n assert(extract_tables_columns.get_tables(sq...
false
3,458
8a21a7005fb17cc82759079022b540cf4fd062c5
def search4vowels(word): """ Return sny vowels founded in a supplied word.""" vowels = set('aeiou') found = vowels.intersection(set(word)) #return found for vowels in found: print(vowels)
[ "def search4vowels(word):\n \"\"\" Return sny vowels founded in a supplied word.\"\"\"\n vowels = set('aeiou')\n found = vowels.intersection(set(word))\n #return found\n for vowels in found:\n print(vowels)\n", "def search4vowels(word):\n \"\"\" Return sny vowels founded in a supplied w...
false
3,459
cf3b4e2c76091f95d24e8a987a63ece46503d6e8
import numpy as np import time import uuid from datetime import datetime log_host = "agent1" class State: def __init__(self, path, iterations): self.path = path self.iterations = iterations def run(self): assert 0, "run not implemented" class BruteForceAttackState(State): def ...
[ "import numpy as np\nimport time\nimport uuid\nfrom datetime import datetime\n\n\nlog_host = \"agent1\"\n\n\nclass State:\n def __init__(self, path, iterations):\n self.path = path\n self.iterations = iterations\n\n def run(self):\n assert 0, \"run not implemented\"\n\n\nclass BruteForceA...
false
3,460
3e0bc91b81d0f503b78c9ac685b05b7ecb754e28
# dealing with the packet fragments and their reconsttruction import logging # shut up scapy logging.getLogger("scapy.runtime").setLevel(logging.ERROR) from scapy.all import * conf.verb=0 from collections import OrderedDict pkt_frag_loads = OrderedDict() def get_load(pkt): ack = str(pkt[TCP].ack) seq = str...
[ "# dealing with the packet fragments and their reconsttruction \n\nimport logging\n# shut up scapy\nlogging.getLogger(\"scapy.runtime\").setLevel(logging.ERROR)\nfrom scapy.all import *\nconf.verb=0\nfrom collections import OrderedDict\n\n\npkt_frag_loads = OrderedDict()\n\ndef get_load(pkt):\n ack = str(pkt[TCP...
false
3,461
5b894eac93bff44931df4ef8d845c23071a03227
import requests import pandas as pd import time def job_spider(jid="1913e38066dd3c8e1Hd40t--FVE~", ka="search_list_1", i=0): # request info. job_url = "https://www.zhipin.com/job_detail/" + jid + ".html" headers = { 'cache-control': "no-cache", 'user-agent': 'Mozilla/5.0 (Windows NT 10.0;...
[ "import requests\nimport pandas as pd\nimport time\n\n\ndef job_spider(jid=\"1913e38066dd3c8e1Hd40t--FVE~\", ka=\"search_list_1\", i=0):\n # request info.\n job_url = \"https://www.zhipin.com/job_detail/\" + jid + \".html\"\n\n headers = {\n 'cache-control': \"no-cache\",\n 'user-agent': 'Moz...
false
3,462
e434d5519e3ba4255ed928769070de391cb0955b
import glob import html import os import re import sys import textwrap from pathlib import Path from typing import Any, Dict, List, Optional, Tuple, Union import pycountry import requests from pyd2v import D2V from pymediainfo import MediaInfo, Track from pynfogen.formatter import CustomFormats class NFO: AUDIO...
[ "import glob\nimport html\nimport os\nimport re\nimport sys\nimport textwrap\nfrom pathlib import Path\nfrom typing import Any, Dict, List, Optional, Tuple, Union\n\nimport pycountry\nimport requests\nfrom pyd2v import D2V\nfrom pymediainfo import MediaInfo, Track\n\nfrom pynfogen.formatter import CustomFormats\n\n...
false
3,463
bbbbf0e1bbd7ead034d8cd88ee6a09a61cde7803
#!/usr/bin/env python import pyaudio import wave import winshell """ This script accesses the Laptop's microphone using the library pyaudio and opens a stream to record the voice and writes it to an mp3 file """ def start(): try: CHUNK = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 2 RA...
[ "#!/usr/bin/env python\nimport pyaudio\nimport wave\nimport winshell\n\n\"\"\"\nThis script accesses the Laptop's microphone using the library pyaudio and opens a stream to record the voice\nand writes it to an mp3 file\n\"\"\"\ndef start():\n try:\n CHUNK = 1024\n FORMAT = pyaudio.paInt16\n ...
false
3,464
4a0cbd59ffae4fb5ba6e3bd871231e37065d1aed
#!/usr/bin/env python # -*- coding: utf-8 -*- """ created by gjwei on 3/26/17 """ class ListNode(object): def __init__(self, x): self.val = x self.next = None a = ListNode(1) a.next = ListNode(3) a.next = None print a.val print a.next def main(): print "hello" a = [] for i in r...
[ "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\" \n created by gjwei on 3/26/17\n \n\"\"\"\nclass ListNode(object):\n def __init__(self, x):\n self.val = x\n self.next = None\n\n\na = ListNode(1)\na.next = ListNode(3)\n\na.next = None\nprint a.val\nprint a.next\n\n\ndef main():\n print \...
true
3,465
b7511c156c241accaf1668d83ee0a5263b41af0d
from django.db import models from django.contrib.auth.models import AbstractUser from django.core.validators import MinLengthValidator, MaxLengthValidator, RegexValidator from pizzaclub.settings import MAX_DNI_LENGTH, MAX_CUIL_LENGTH, PASSWORD_RESET_TIMEOUT from pizzaclub.settings import MIN_DNI_LENGTH, MIN_CUIL_LENGT...
[ "from django.db import models\nfrom django.contrib.auth.models import AbstractUser\nfrom django.core.validators import MinLengthValidator, MaxLengthValidator, RegexValidator\n\nfrom pizzaclub.settings import MAX_DNI_LENGTH, MAX_CUIL_LENGTH, PASSWORD_RESET_TIMEOUT\nfrom pizzaclub.settings import MIN_DNI_LENGTH, MIN_...
false
3,466
6b7ff00eb9a5d0837def5b245ba2d4a0acec972e
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-15 15:20 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('challenges', '0019_auto_20170310_1114'), ] operations = [ migrations.AddFie...
[ "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-03-15 15:20\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('challenges', '0019_auto_20170310_1114'),\n ]\n\n operations = [\n ...
false
3,467
72cda573bf9c744213a2957d51171f437f211353
import serial import time from Files_management import get_mov_parameters,change_mov_parameters #------------------------------------------------------------------------------- def create_port(): port = get_mov_parameters()[1] try: ser = serial.Serial(port=port,baudrate=9600,timeout=1) return s...
[ "import serial\nimport time\nfrom Files_management import get_mov_parameters,change_mov_parameters\n\n#-------------------------------------------------------------------------------\ndef create_port():\n port = get_mov_parameters()[1]\n try:\n ser = serial.Serial(port=port,baudrate=9600,timeout=1)\n ...
false
3,468
c773b273ad6953bf9c74b11c44aff16e9fd0860e
# coding=utf-8 # Copyright 2021-Present The THUCTC Authors from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import torch import torch.nn as nn import thuctc.utils as utils from thuctc.modules.module import Module from thuctc.modules.layer_norm ...
[ "# coding=utf-8\n# Copyright 2021-Present The THUCTC Authors\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport math\nimport torch\n\nimport torch.nn as nn\nimport thuctc.utils as utils\n\nfrom thuctc.modules.module import Module\nfrom thuctc....
false
3,469
2cfc1bea6dd1571eff67c3f49b2a1899560c7ba7
def koodrinate(kraj, kraji): for ime, x, y in kraji: if ime == kraj: return x, y kraji = { 'Brežice': (68.66, 7.04), 'Lenart': (85.20, 78.75), 'Rateče': (-65.04, 70.04), 'Ljutomer': (111.26, 71.82), 'Rogaška Slatina': (71.00, 42.00), 'Ribnica': (7.10, -10.50), 'Duto...
[ "def koodrinate(kraj, kraji):\n for ime, x, y in kraji:\n if ime == kraj:\n return x, y\n\n\nkraji = {\n 'Brežice': (68.66, 7.04),\n 'Lenart': (85.20, 78.75),\n 'Rateče': (-65.04, 70.04),\n 'Ljutomer': (111.26, 71.82),\n 'Rogaška Slatina': (71.00, 42.00),\n 'Ribnica': (7.10, -...
false
3,470
9be6940fc6f405db652d478f9a74fcf56d8a0ad7
from django.urls import path from . import views # . current directory urlpatterns = [ path("", views.index, name="index"), path("login", views.login_view, name="login"), path("logout", views.logout_view, name="logout"), path("menu", views.menu, name="menu"), path("add_item", views.add_item, name="...
[ "from django.urls import path\nfrom . import views # . current directory\n\nurlpatterns = [\n path(\"\", views.index, name=\"index\"),\n path(\"login\", views.login_view, name=\"login\"),\n path(\"logout\", views.logout_view, name=\"logout\"),\n path(\"menu\", views.menu, name=\"menu\"),\n path(\"add...
false
3,471
b66142e0b674d3920b8e3ad74e0d0b753f0a78c3
from .embedpeek import EmbedPeek __red_end_user_data_statement__ = "This cog does not persistently store data or metadata about users." def setup(bot): bot.add_cog(EmbedPeek(bot))
[ "from .embedpeek import EmbedPeek\n\n__red_end_user_data_statement__ = \"This cog does not persistently store data or metadata about users.\"\n\n\ndef setup(bot):\n bot.add_cog(EmbedPeek(bot))\n", "from .embedpeek import EmbedPeek\n__red_end_user_data_statement__ = (\n 'This cog does not persistently store ...
false
3,472
09417014963172fc71b4268aafdec1405c04f34d
import pandas as pd import matplotlib.pyplot as plt import numpy as np from sklearn.cluster import KMeans from kneed import KneeLocator #Create a panda data frame from the csv file df = pd.read_csv('ClusterPlot.csv', usecols=['V1','V2']) #Convert the panda data frame to a NumPy array arr = df.to_numpy() #Code used t...
[ "import pandas as pd\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom sklearn.cluster import KMeans\nfrom kneed import KneeLocator\n\n#Create a panda data frame from the csv file\ndf = pd.read_csv('ClusterPlot.csv', usecols=['V1','V2'])\n\n#Convert the panda data frame to a NumPy array\narr = df.to_numpy(...
false
3,473
41889456fbb56d263e0039716519e8959316b67e
#! /usr/bin/env python # # Copyright (c) 2015 Jason Ish # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this li...
[ "#! /usr/bin/env python\n#\n# Copyright (c) 2015 Jason Ish\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions\n# are met:\n#\n# 1. Redistributions of source code must retain the above copyright\n# ...
false
3,474
40b1fac14aaa81039aec8e80ce1c91bb881cfe78
debt = 100 equity = 50 ratio = debt / equity if ratio <= 2: print('😊') else: print('⚠️') print('Ratio is', ratio)
[ "debt = 100\nequity = 50\n\nratio = debt / equity\n\nif ratio <= 2:\n print('😊')\nelse:\n print('⚠️')\n\nprint('Ratio is', ratio)\n", "debt = 100\nequity = 50\nratio = debt / equity\nif ratio <= 2:\n print('😊')\nelse:\n print('⚠️')\nprint('Ratio is', ratio)\n", "<assignment token>\nif ratio <= 2:\...
false
3,475
303e1b95c2ca60041a34b8c09e013849112a108d
import matplotlib.image as mpimg import cv2 import rasterio from ode_data_access.image_utils import view_as_blocks, is_black, align_and_crop import os import numpy as np from tqdm import tqdm class ChunkProcessor: def write_result_blocks(self, result_blocks, window, product_name, chunk_size, save_dir=...
[ "import matplotlib.image as mpimg\r\nimport cv2\r\nimport rasterio\r\nfrom ode_data_access.image_utils import view_as_blocks, is_black, align_and_crop\r\nimport os\r\nimport numpy as np\r\nfrom tqdm import tqdm\r\n\r\n\r\nclass ChunkProcessor:\r\n\r\n def write_result_blocks(self, result_blocks, window, product_...
false
3,476
883cb1e3ea227bb5ac5aa3b4348336ab1a7fba70
import pygame import numpy as np import glob from entities.base import AnimatedSprite images_path = sorted(glob.glob('./resources/trophy_sparkle_*.png')) trophy_im_dict = {'sparkle':[pygame.transform.scale(pygame.image.load(img_path),(400,400)) for img_path in images_path]} class Trophy(AnimatedSprite): def __in...
[ "import pygame\nimport numpy as np\nimport glob\nfrom entities.base import AnimatedSprite\n\n\nimages_path = sorted(glob.glob('./resources/trophy_sparkle_*.png'))\ntrophy_im_dict = {'sparkle':[pygame.transform.scale(pygame.image.load(img_path),(400,400)) for img_path in images_path]}\n\nclass Trophy(AnimatedSprite)...
false
3,477
ca91052072d7b2da5729cf55f7f4ba4b54608017
# -*- coding: utf-8 -*- """ Created on Mon Jul 13 11:43:58 2020 @author: Dr. Tang """ import tensorflow as tf # 需要你编程:将下面转换成tensorflow #x = 10 #y = 2 #u=x/y #z = u- 1 x=tf.placeholder(tf.int32) y=tf.placeholder(tf.int32) u=tf.divide(x,y) z=tf.subtract(u,tf.constant(1.0,dtype=tf.float64)) # 需要你编程:从session中打印 z with t...
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Jul 13 11:43:58 2020\n\n@author: Dr. Tang\n\"\"\"\n\nimport tensorflow as tf\n# 需要你编程:将下面转换成tensorflow\n#x = 10\n#y = 2\n#u=x/y\n#z = u- 1\n\nx=tf.placeholder(tf.int32)\ny=tf.placeholder(tf.int32)\nu=tf.divide(x,y)\nz=tf.subtract(u,tf.constant(1.0,dtype=tf.float64))\...
false
3,478
ee3718dee869a58089e897489af2eec3ff72be56
from django.shortcuts import render from post.models import * from .models import * from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator from account.models import Profile from django.contrib.auth.models import User from django.db.models import Q # Create your views here. def index(request): posts...
[ "from django.shortcuts import render\nfrom post.models import *\nfrom .models import *\nfrom django.core.paginator import EmptyPage, PageNotAnInteger, Paginator\nfrom account.models import Profile\nfrom django.contrib.auth.models import User\nfrom django.db.models import Q\n\n# Create your views here.\ndef index(re...
false
3,479
66f8fa5fc12dc80b8f46684c39781c2e4634de4a
# -*- coding:utf-8 -*- import requests import json def fun1(): s_cut = [('72af8ecf3609a546bac3150c20f70455', ['老凤祥', '六福珠宝', '周生生', '亚一珠宝', '亚一金店']), ('3e78397f7dbb88ffbd78ba52d0e925fa', ['老庙', '谢瑞麟', '中国黄金', '明牌珠宝']), # yh ('6bee32b2f0719ea45cc194847efd8917', ['周大福', '潮宏基', '东华美钻', '周...
[ "# -*- coding:utf-8 -*-\n\nimport requests\nimport json\n\n\ndef fun1():\n s_cut = [('72af8ecf3609a546bac3150c20f70455', ['老凤祥', '六福珠宝', '周生生', '亚一珠宝', '亚一金店']),\n ('3e78397f7dbb88ffbd78ba52d0e925fa', ['老庙', '谢瑞麟', '中国黄金', '明牌珠宝']), # yh\n ('6bee32b2f0719ea45cc194847efd8917', ['周大福', '潮宏...
false
3,480
25d210144ef209fd5e4ff7e4e4c2e77fd7eb79ac
# Copyright 2017 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. DEPS = [ 'step', ] def RunSteps(api): try: api.step('test step', [{}]) except AssertionError as e: assert str(e) == 'Type <type \'...
[ "# Copyright 2017 The LUCI Authors. All rights reserved.\n# Use of this source code is governed under the Apache License, Version 2.0\n# that can be found in the LICENSE file.\n\nDEPS = [\n 'step',\n]\n\n\ndef RunSteps(api):\n try:\n api.step('test step', [{}])\n except AssertionError as e:\n assert str(e)...
false
3,481
de3e952ad43fe7e323e8f975a45bbd4eec7192db
class Node(object): def __init__(self, d, n=None): self.data = d self.next_node = n def get_data(self): return self.data def set_data(self, d): self.data = d def get_next(self): return self.next_node def set_next(self, n): self.next_node=n class...
[ "class Node(object):\n\n def __init__(self, d, n=None):\n self.data = d\n self.next_node = n\n\n def get_data(self):\n return self.data\n\n def set_data(self, d):\n self.data = d\n\n def get_next(self):\n return self.next_node\n\n def set_next(self, n):\n sel...
true
3,482
15fea8a84accdfc2dac87c111cbe8bfca61fe801
import sys from pprint import pprint sys.stdin = open("sample_input.txt", "r") test_case = int(input()) """ for test in range(test_case): nxn_array, palin_len = map(int, input().split()) ## 2차 배열 만들기 => 행스트링 리스트 order_2nd_array = [] for i in range(nxn_array): order_2nd_array.append(input()) ...
[ "import sys\nfrom pprint import pprint\nsys.stdin = open(\"sample_input.txt\", \"r\")\n\n\ntest_case = int(input())\n\n\"\"\"\nfor test in range(test_case):\n nxn_array, palin_len = map(int, input().split())\n\n ## 2차 배열 만들기 => 행스트링 리스트\n order_2nd_array = []\n for i in range(nxn_array):\n order_...
false
3,483
ca0bca24509df2bf0bd07fb2f31d3e7909957405
# coding: utf-8 from datetime import datetime #from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils import timezone from persol_users.models import PersolUser from django.db.models import Q, Count # アンケート from questions.m...
[ "# coding: utf-8\nfrom datetime import datetime\n\n#from __future__ import unicode_literals\n\nfrom django.db import models\nfrom django.utils.encoding import python_2_unicode_compatible\nfrom django.utils import timezone\nfrom persol_users.models import PersolUser\nfrom django.db.models import Q, Count\n\n# アンケート\...
false
3,484
ab3609c27fa002d79735c5d5c09ec7a52fedd040
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-02-07 23:42 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('events', '0005_auto_20160207_1529'), ] operations = [ migrations.AddField( ...
[ "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.2 on 2016-02-07 23:42\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('events', '0005_auto_20160207_1529'),\n ]\n\n operations = [\n mig...
false
3,485
df3dcbf3c8d621f5db2a07765a0a28e7626387d9
#!/usr/bin/env python3 # Rhino Motor Driver (RMCS 2303) - Basic Modbus Communication # ----------------------------------------------------------- """ BSD 3-Clause License Copyright (c) 2021, Rajesh Subramanian All rights reserved. Redistribution and use in source and binary forms, with or without ...
[ "#!/usr/bin/env python3\n\n# Rhino Motor Driver (RMCS 2303) - Basic Modbus Communication\n# -----------------------------------------------------------\n\n\"\"\"\n BSD 3-Clause License\n\n Copyright (c) 2021, Rajesh Subramanian\n All rights reserved.\n\n Redistribution and use in source and binary forms...
false
3,486
53dd753356d8a8d60975c8f4cdaf20de66c2db46
import times_series_learning as tsl import numpy as np import time import datetime as dt import sortedcontainers import pandas as pd from collections import defaultdict class ServerProfileLearning(object): def __init__(self, data, parameters, distribution, distribution_period, level_threshold, p...
[ "import times_series_learning as tsl\nimport numpy as np\nimport time\nimport datetime as dt\nimport sortedcontainers\nimport pandas as pd\nfrom collections import defaultdict\n\n\nclass ServerProfileLearning(object):\n\n def __init__(self, data, parameters, distribution, distribution_period, level_threshold,\n ...
false
3,487
0d3cc85cd18ee197b24c8b01b71afe82110bfad2
""" Stirng - Liste - Dosya - Fonksiyon yazıyoruz. - Bu fonksiyon iki parametre alacak. (dosya, string) 1. sorun : Dosyanın içinde string var ise True döndürecek yok ise False 2. sorun : Dosyanın içinde string bulunursa ilk bulunduğu konumu return edecek 3. sorun : Dosyanın içerisinde yazdığımız strinng kaç k...
[ "\"\"\"\nStirng - Liste - Dosya\n - Fonksiyon yazıyoruz.\n - Bu fonksiyon iki parametre alacak. (dosya, string)\n 1. sorun : Dosyanın içinde string var ise True döndürecek yok ise False \n 2. sorun : Dosyanın içinde string bulunursa ilk bulunduğu konumu return edecek\n 3. sorun : Dosyanın içerisinde yazdığımız...
false
3,488
f047afeb6462ab01a8fea1f3c8693608335eb960
import discord from discord.ext import commands from discord.ext.commands import Bot import asyncio import random import requests import os #Discord Tech Stuff BOT_PREFIX = ("!") client = discord.Client() client = Bot(command_prefix=BOT_PREFIX) #Functions of the Funny Coin @client.command() async def wasitfunny():...
[ "import discord\nfrom discord.ext import commands\nfrom discord.ext.commands import Bot\nimport asyncio\nimport random\nimport requests\nimport os\n\n\n#Discord Tech Stuff\nBOT_PREFIX = (\"!\")\n\n\nclient = discord.Client()\nclient = Bot(command_prefix=BOT_PREFIX)\n\n#Functions of the Funny Coin\n@client.command()...
false
3,489
acd5cf675522c90fc9fbc96bdeb52f66835626b4
permissions = ('restart', ) commands = ('restart', ) def get_command(session, parsed_message): return 'stop', 'restart' def parse_response(permission, response): return response
[ "permissions = ('restart', )\ncommands = ('restart', )\n\n\ndef get_command(session, parsed_message):\n return 'stop', 'restart'\n\n\ndef parse_response(permission, response):\n return response\n", "permissions = 'restart',\ncommands = 'restart',\n\n\ndef get_command(session, parsed_message):\n return 's...
false
3,490
57d1fb805fce2ba75ea2962598e809ba35fd7eb6
# Copyright 2008 Google Inc. # # 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,...
[ "# Copyright 2008 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed...
false
3,491
31d87b11f6a1f6304a2fef6dd1cd1c0ca292dfe8
import os import random import cv2 import tensorflow as tf import tensorflow.contrib.slim as slim import tensorflow.contrib.slim.nets as nets from skimage.transform import resize import PIL import numpy as np import json # os.environ["CUDA_VISIBLE_DEVICES"] = "1" import matplotlib.pyplot as plt # plt.switch_backend('...
[ "import os\nimport random\n\nimport cv2\nimport tensorflow as tf\nimport tensorflow.contrib.slim as slim\nimport tensorflow.contrib.slim.nets as nets\nfrom skimage.transform import resize\nimport PIL\nimport numpy as np\nimport json\n# os.environ[\"CUDA_VISIBLE_DEVICES\"] = \"1\"\nimport matplotlib.pyplot as plt\n\...
false
3,492
237724db5130926123a3a31be7070947ec7b01f3
import sys import smtplib from email.mime.text import MIMEText from email.utils import formatdate from ... import config def create_message(from_addr, to_addr, subject, message, encoding): body = MIMEText(message, 'plain', encoding) body['Subject'] = subject body['From'] = from_addr body['To'] = to_add...
[ "import sys\nimport smtplib\nfrom email.mime.text import MIMEText\nfrom email.utils import formatdate\nfrom ... import config\n\ndef create_message(from_addr, to_addr, subject, message, encoding):\n body = MIMEText(message, 'plain', encoding)\n body['Subject'] = subject\n body['From'] = from_addr\n body...
false
3,493
7b4f46f6c286a7d0ef45079b2fd238b81d5f89eb
import cv2 #imports cv2 package import numpy as np #imports numpy package import matplotlib.pyplot as plt #imports matplotlib.pyplot package img_noblur = cv2.imread('road8.jpg') #reads the image imgnew = img_noblur.copy() #creates a copy of the image img_noblur_grey = cv2.cvtColor(img_noblu...
[ "import cv2\t\t\t\t\t\t\t\t\t\t#imports cv2 package\nimport numpy as np \t\t\t\t\t\t\t\t#imports numpy package\nimport matplotlib.pyplot as plt \t\t\t\t#imports matplotlib.pyplot package\n\nimg_noblur = cv2.imread('road8.jpg')\t\t\t#reads the image\nimgnew = img_noblur.copy()\t\t\t\t\t\t#creates a copy of the image...
false
3,494
1bb151171bbbb899456324056be3634e87b5c8fb
from floppy.node import Node, Input, Output, Tag, abstractNode @abstractNode class StringNode(Node): Tag('StringOperations') class StringAppend(StringNode): """ Creates a new node which combines two strings. These can be seperated by a delimiter. :param nodeClass: subclass object of 'Node'. :retur...
[ "from floppy.node import Node, Input, Output, Tag, abstractNode\n\n@abstractNode\nclass StringNode(Node):\n Tag('StringOperations')\n\nclass StringAppend(StringNode):\n \"\"\"\n Creates a new node which combines two strings. These can be seperated by a delimiter.\n :param nodeClass: subclass object of '...
false
3,495
315996a783d7b95fd87374a8fe2602a572de071e
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import codecs import time import json import os class OitYitikuscrapyDataPipeline(object): def open_spider(self, spider): ...
[ "# -*- coding: utf-8 -*-\n\n# Define your item pipelines here\n#\n# Don't forget to add your pipeline to the ITEM_PIPELINES setting\n# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html\nimport codecs\nimport time\nimport json\nimport os\n\nclass OitYitikuscrapyDataPipeline(object):\n def open_spider...
false
3,496
b03960999fa30a55932ada7fbf731a3861b840ae
n = int(input()) lista = [] for i in range(n): inp = int(input()) lista.append(inp) lista.sort(reverse=True) print(lista[0]) print(lista[1])
[ "n = int(input())\nlista = []\n\nfor i in range(n):\n inp = int(input())\n lista.append(inp)\n\nlista.sort(reverse=True)\n\nprint(lista[0])\nprint(lista[1])", "n = int(input())\nlista = []\nfor i in range(n):\n inp = int(input())\n lista.append(inp)\nlista.sort(reverse=True)\nprint(lista[0])\nprint(lista[...
false
3,497
5229002103379ff10969e64289d5a0f36641c0a3
auto_duration_sec = 15 teleop_duration_sec = 135
[ "auto_duration_sec = 15\nteleop_duration_sec = 135", "auto_duration_sec = 15\nteleop_duration_sec = 135\n", "<assignment token>\n" ]
false
3,498
c45ffe8cba8d152e346182252dbc43e22eaf83e2
from rest_framework.views import APIView from rest_framework.response import Response from drf_yasg.utils import swagger_auto_schema from theme.models import UserProfile from hs_core.views import serializers class UserInfo(APIView): @swagger_auto_schema(operation_description="Get information about the logged in ...
[ "from rest_framework.views import APIView\nfrom rest_framework.response import Response\nfrom drf_yasg.utils import swagger_auto_schema\n\nfrom theme.models import UserProfile\nfrom hs_core.views import serializers\n\n\nclass UserInfo(APIView):\n @swagger_auto_schema(operation_description=\"Get information about...
false
3,499
a2344f405aa681daff12166b7aad1230652373de
from . import match from . import mimetype from .mimetype import MIMEType def sniff_unknown(resource: bytes, sniff_scriptable: bool = False): #might need more arguments raise NotImplementedError def sniff_mislabeled_binary(resource: bytes) -> MIMEType: raise NotImplementedError def sniff_mislabeled_feed(reso...
[ "from . import match\nfrom . import mimetype\nfrom .mimetype import MIMEType\n\ndef sniff_unknown(resource: bytes, sniff_scriptable: bool = False): #might need more arguments\n raise NotImplementedError\n\ndef sniff_mislabeled_binary(resource: bytes) -> MIMEType:\n raise NotImplementedError\n\ndef sniff_misla...
false