index int64 0 100k | blob_id stringlengths 40 40 | code stringlengths 7 7.27M | steps listlengths 1 1.25k | error bool 2
classes |
|---|---|---|---|---|
9,500 | 8dfea24545ec4bb95b66d4b5ff3c4936990eb73a | """
Plugin for ResolveUrl
Copyright (C) 2022 shellc0de
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
... | [
"\"\"\"\n Plugin for ResolveUrl\n Copyright (C) 2022 shellc0de\n\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any ... | false |
9,501 | 8e28135da60f8e11459697c4ae9c63e60c437d7a | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 24 18:46:26 2019
@author: kiran
"""
import matplotlib.pylab as plt
import pandas as pd
import numpy as np
import statsmodels as sm
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
from statsmodels.tsa.stattools import acf, pacf
from stat... | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Fri May 24 18:46:26 2019\n@author: kiran\n\"\"\"\nimport matplotlib.pylab as plt\nimport pandas as pd\nimport numpy as np\nimport statsmodels as sm\nfrom statsmodels.graphics.tsaplots import plot_acf, plot_pacf\nfrom statsmodels.tsa.stattools impo... | false |
9,502 | 7cf6a4b8057280b38572dd92693013724751c47f | import numpy as np
import cv2
print("read imafe from file" )
img = cv2.imread("panda.jpg")
print("create a window holder for the image")
cv2.namedWindow("Image",cv2.WINDOW_NORMAL)
print ('display the image ')
cv2.imshow("Image",img)
print ('press a key inside the image to make a copy')
cv2.waitKey(0)
| [
"import numpy as np \nimport cv2\n\n\nprint(\"read imafe from file\" )\nimg = cv2.imread(\"panda.jpg\")\n\nprint(\"create a window holder for the image\")\ncv2.namedWindow(\"Image\",cv2.WINDOW_NORMAL)\n\nprint ('display the image ')\ncv2.imshow(\"Image\",img)\n\nprint ('press a key inside the image to make a copy'... | false |
9,503 | 22f4ae755e7ea43604db39452ca80f44f540708a | import pandas as pd
dict_data = {'c0': [1, 2, 3], 'c1': [4, 5, 6], 'c2': [
7, 8, 9], 'c3': [10, 11, 12], 'c4': [13, 14, 15]}
df = pd.DataFrame(dict_data)
print(type(df))
print('\n')
print(df)
# <class 'pandas.core.frame.DataFrame'>
# c0 c1 c2 c3 c4
# 0 1 4 7 10 13
# 1 2 5 8 11 14
# 2 ... | [
"import pandas as pd\n\ndict_data = {'c0': [1, 2, 3], 'c1': [4, 5, 6], 'c2': [\n 7, 8, 9], 'c3': [10, 11, 12], 'c4': [13, 14, 15]}\n\ndf = pd.DataFrame(dict_data)\n\nprint(type(df))\nprint('\\n')\nprint(df)\n\n# <class 'pandas.core.frame.DataFrame'>\n\n\n# c0 c1 c2 c3 c4\n# 0 1 4 7 10 13\n# 1 2 ... | false |
9,504 | 38ffbb6a66837e975a611a57579bb365ab69a32c | """
\tSeja bem-vindo ao Admirável Mundo Novo!
\tO objetivo do jogo é dar suporte ao desenvolvimento de Agentes Inteligentes que utilizam Deep Reinforcement Learning
\tpara tarefas de Processamento de Linguagem Natural em língua portuguesa.
\tAutor: Gabriel Pontes (@ograndoptimist)
"""
import random
fr... | [
"\"\"\"\n \\tSeja bem-vindo ao Admirável Mundo Novo!\n \\tO objetivo do jogo é dar suporte ao desenvolvimento de Agentes Inteligentes que utilizam Deep Reinforcement Learning\n \\tpara tarefas de Processamento de Linguagem Natural em língua portuguesa.\n \\tAutor: Gabriel Pontes (@ograndoptimist)\n\"\"\... | false |
9,505 | 6e845f2543b548fb936cc3719eb150e530281945 | stevila = [5, 2, 8, 3]
#Izpis vseh števil
print(stevila)
#Izpis števila na mestu 1
print(stevila[1]) | [
"stevila = [5, 2, 8, 3]\n\n#Izpis vseh števil\nprint(stevila)\n\n#Izpis števila na mestu 1\nprint(stevila[1])",
"stevila = [5, 2, 8, 3]\nprint(stevila)\nprint(stevila[1])\n",
"<assignment token>\nprint(stevila)\nprint(stevila[1])\n",
"<assignment token>\n<code token>\n"
] | false |
9,506 | e81294c984497dbba9fa345b61abb8d781f136bf | #######################
# PYMERGE V.1.1 #
#######################
# Samuel Farrens 2014 #
#######################
"""@file pycatcut.v.1.1
@brief Code that merges cluster catalogues into a single catalogue.
@author Samuel Farrens
"""
import math, optparse, numpy as np
import errors
from classes.cluster import Cl... | [
"#######################\n# PYMERGE V.1.1 #\n#######################\n# Samuel Farrens 2014 #\n#######################\n\n\"\"\"@file pycatcut.v.1.1\n@brief Code that merges cluster catalogues into a single catalogue.\n@author Samuel Farrens\n\"\"\"\n\nimport math, optparse, numpy as np\nimport errors\nfrom c... | true |
9,507 | 00fd5efa4c66b7bd4617f4c886eddcdf38b951b7 | print ("Hello, Django girls!")
volume = 57
if volume < 20:
print("It's kinda quiet.")
elif 20 <= volume < 40:
print("It's nice for background music")
elif 40 <= volume < 60:
print("Perfect, I can hear all the details")
elif 60 <= volume < 80:
print("Nice for parties")
elif 80 <= volume < 100:
print... | [
"print (\"Hello, Django girls!\")\n\nvolume = 57\nif volume < 20:\n print(\"It's kinda quiet.\")\nelif 20 <= volume < 40:\n print(\"It's nice for background music\")\nelif 40 <= volume < 60:\n print(\"Perfect, I can hear all the details\")\nelif 60 <= volume < 80:\n print(\"Nice for parties\")\nelif 80 ... | false |
9,508 | 8cb7290792f9390dd350e0c79711e0dd72d6063b | a=range(1,11) #1~10숫자를 에이에 저장
b=1
for i in a: #a에있는 원소를 b에 곱하고 비에 저장
b*=i
print(b)
| [
"a=range(1,11) #1~10숫자를 에이에 저장\nb=1\nfor i in a: #a에있는 원소를 b에 곱하고 비에 저장\n b*=i\nprint(b)\n",
"a = range(1, 11)\nb = 1\nfor i in a:\n b *= i\nprint(b)\n",
"<assignment token>\nfor i in a:\n b *= i\nprint(b)\n",
"<assignment token>\n<code token>\n"
] | false |
9,509 | c2490c3aacfa3ce22c3f47a69dbc44b695c2a2e5 | # -*- coding:utf-8 -*-
from __future__ import unicode_literals
from django.db import models
SERVICE_RANGE_CHOISE = {(1, '1年'), (2, '2年'), (3, '3年'), (4, '4年'), (5, '5年'), (6, '6年'), (7, '7年'), (8, '8年'), (0, '长期')}
USER_STATUS_CHOISE = {(1, '停用'), (2, '正常'), (3, '锁定')}
DBSERVER_POS_CHOISE = {(1, '8层机房'), (2, '11层机房')... | [
"# -*- coding:utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models\n\nSERVICE_RANGE_CHOISE = {(1, '1年'), (2, '2年'), (3, '3年'), (4, '4年'), (5, '5年'), (6, '6年'), (7, '7年'), (8, '8年'), (0, '长期')}\nUSER_STATUS_CHOISE = {(1, '停用'), (2, '正常'), (3, '锁定')}\nDBSERVER_POS_CHOISE = {(1, '8层机房'), ... | false |
9,510 | c3a7a8a006f717057a7ad2920f19d82842b04a85 | import cv2
import numpy as np
import matplotlib.pyplot as plt
'''
def diff_of_gaussians(img):
grey_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
blur_img_grey = cv2.GaussianBlur(grey_img, (9,9), 0)
blur_img_colour = cv2.GaussianBlur(img, (9,9), 0)
#plt.fig... | [
"import cv2\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n'''\ndef diff_of_gaussians(img):\n\n grey_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\n img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)\n blur_img_grey = cv2.GaussianBlur(grey_img, (9,9), 0)\n blur_img_colour = cv2.GaussianBlur(img, (9,9), 0... | false |
9,511 | 677154aa99a5a4876532f3e1edfec45b1790384c | from flask_marshmallow import Marshmallow
from models import Uservet
ma = Marshmallow()
class UserVetSchema(ma.Schema):
class Meta:
model = Uservet
user_vet_1 = ['dni','email','nombre','apellidos','telefono','tipo_uservet']
| [
"from flask_marshmallow import Marshmallow\nfrom models import Uservet\nma = Marshmallow()\n\nclass UserVetSchema(ma.Schema):\n class Meta:\n model = Uservet\n\nuser_vet_1 = ['dni','email','nombre','apellidos','telefono','tipo_uservet']\n\n\n ",
"from flask_marshmallow import Marshmallow\nfrom mo... | false |
9,512 | 9db2377f15aaf28373959dad88c6ec7b6dacffd2 | import sys
sys.stdin = open('retire.txt', 'r')
def counseling(pay, row):
global max_sum
if row == N - 1:
if arr[row][0] == 1:
pay += arr[row][1]
max_sum = max(pay, max_sum)
return
if row == N:
max_sum = max(pay, max_sum)
return
if row > N - 1:
... | [
"import sys\nsys.stdin = open('retire.txt', 'r')\n\ndef counseling(pay, row):\n global max_sum\n if row == N - 1:\n if arr[row][0] == 1:\n pay += arr[row][1]\n max_sum = max(pay, max_sum)\n return\n if row == N:\n max_sum = max(pay, max_sum)\n return\n if ro... | false |
9,513 | 2417dd4f3787742832fec53fec4592165d0fccfc | from tensorflow import keras
class SkippableSeq(keras.utils.Sequence):
def __init__(self, seq):
super(SkippableSeq, self).__init__()
self.start = 0
self.seq = seq
def __iter__(self):
return self
def __next__(self):
res = self.seq[self.start]
self.start = (self.start + 1) % len(self)
... | [
"from tensorflow import keras\n\n\nclass SkippableSeq(keras.utils.Sequence):\n def __init__(self, seq):\n super(SkippableSeq, self).__init__()\n self.start = 0\n self.seq = seq\n\n def __iter__(self):\n return self\n\n def __next__(self):\n res = self.seq[self.start]\n self.start = (self.start ... | false |
9,514 | 09792da1c3cc38c7df7def2b487c2078de4e8912 | import config
import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
def check_db_exists(opt):
try:
conn = psycopg2.connect(opt)
cur = conn.cursor()
cur.close()
print('Database exists.')
return True
except:
print("Database doesn't exist.")
return False
def create_db(opt):
if check... | [
"import config\nimport psycopg2\nfrom psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT\n\ndef check_db_exists(opt):\n\ttry:\n\t\tconn = psycopg2.connect(opt)\n\t\tcur = conn.cursor()\n\t\tcur.close()\n\t\tprint('Database exists.')\n\t\treturn True\n\texcept:\n\t\tprint(\"Database doesn't exist.\")\n\t\treturn ... | false |
9,515 | 9e43eb3c3ab3be4e695dbc80aa005332b8d8a4ec | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class StravaAuthConfig(AppConfig):
name = "strava.contrib.strava_django"
verbose_name = _("Strava Auth")
def ready(self):
pass
| [
"from django.apps import AppConfig\nfrom django.utils.translation import gettext_lazy as _\n\n\nclass StravaAuthConfig(AppConfig):\n name = \"strava.contrib.strava_django\"\n verbose_name = _(\"Strava Auth\")\n\n def ready(self):\n pass\n",
"from django.apps import AppConfig\nfrom django.utils.tra... | false |
9,516 | 9c320db85ca1a9df6b91f6bb062e4d5c3d94ee91 | from test.framework import TestCase
from test.mock import Mock
from package.util.svnutil import ReleaseXmlParser, Release
import time
class SvnUtilTests(TestCase):
def setUp(self):
r1 = Release()
r1.name = 'BETA1.1.0'
r1.type = 'BETA'
r1.version = '1.1.0'
r1.date = time.strp... | [
"from test.framework import TestCase\nfrom test.mock import Mock\nfrom package.util.svnutil import ReleaseXmlParser, Release\nimport time\n\nclass SvnUtilTests(TestCase):\n def setUp(self):\n r1 = Release()\n r1.name = 'BETA1.1.0'\n r1.type = 'BETA'\n r1.version = '1.1.0'\n r1.... | false |
9,517 | c5f46be6d7214614892d227c76c75e77433a8fa9 | from CTO import CTO
#from UI import UIManager
from Cidades import Cidades
from Database import Database
from datetime import datetime
class Main:
def __init__(self, cidade_filename="", dados_filename=""):
#cidade_filename, dados_filename = UIManager().get_filenames()
print("cidade: " + cidade_fil... | [
"from CTO import CTO\n#from UI import UIManager\nfrom Cidades import Cidades\nfrom Database import Database\nfrom datetime import datetime\n\nclass Main:\n\n def __init__(self, cidade_filename=\"\", dados_filename=\"\"):\n #cidade_filename, dados_filename = UIManager().get_filenames()\n\n print(\"c... | false |
9,518 | 2d192963bfe046bce1a0c82e0179380693f5c541 | from tkinter import *
root = Tk()
photo = PhotoImage(file = 'flag.png')
panel = Label(root, image=photo)
panel.pack()
root.mainloop()
| [
"from tkinter import *\n\nroot = Tk()\n\nphoto = PhotoImage(file = 'flag.png')\n\npanel = Label(root, image=photo)\npanel.pack()\n\nroot.mainloop()\n",
"from tkinter import *\nroot = Tk()\nphoto = PhotoImage(file='flag.png')\npanel = Label(root, image=photo)\npanel.pack()\nroot.mainloop()\n",
"<import token>\n... | false |
9,519 | 020691fe2c7e7092d45415b72ce1804618421a2a | """
Question:
You are given a string s consisting only of digits 0-9, commas ,, and dots .
Your task is to complete the regex_pattern defined below, which will be used to
re.split() all of the , and . symbols in s.
It’s guaranteed that every comma and every dot in s is preceded and followed
by a digit.
Sample Input... | [
"\"\"\"\nQuestion:\n\nYou are given a string s consisting only of digits 0-9, commas ,, and dots .\n\nYour task is to complete the regex_pattern defined below, which will be used to\nre.split() all of the , and . symbols in s.\n\nIt’s guaranteed that every comma and every dot in s is preceded and followed\nby a dig... | false |
9,520 | 625a5d14aaf37493c3f75ec0cdce77d45ca08f78 | #Packages to be imported
import requests
import pandas as pd
from geopy.distance import distance
import json
from datetime import date
from datetime import datetime
import time
#POST request to get authentication token
URL = "https://api.birdapp.com/user/login"
email = {"email": "himanshu.agarwal20792@gmail.com"}
head... | [
"#Packages to be imported\nimport requests\nimport pandas as pd\nfrom geopy.distance import distance\nimport json\nfrom datetime import date\nfrom datetime import datetime\nimport time\n\n#POST request to get authentication token\nURL = \"https://api.birdapp.com/user/login\"\nemail = {\"email\": \"himanshu.agarwal2... | true |
9,521 | f66306908f1fdd5c662804e73596b445c66dc176 | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
from sqlalchemy.orm.session import sessionmaker, query
from FoodPandaStore.FoodPandaStore.model import *
import datetime as ... | [
"# -*- 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: https://docs.scrapy.org/en/latest/topics/item-pipeline.html\n\n\nfrom sqlalchemy.orm.session import sessionmaker, query\nfrom FoodPandaStore.FoodPandaStore.model import *\nimpo... | false |
9,522 | 02e40e051c19116c9cb3a903e738232dc8f5d026 |
from BeautifulSoup import BeautifulSoup, NavigableString
from urllib2 import urlopen
from time import ctime
import sys
import os
import re
restaurants = ["http://finweb.rit.edu/diningservices/brickcity",
"http://finweb.rit.edu/diningservices/commons",
"http://finweb.rit.edu/diningservices/crossroads",
"http://finweb.r... | [
"\nfrom BeautifulSoup import BeautifulSoup, NavigableString\nfrom urllib2 import urlopen\nfrom time import ctime\nimport sys\nimport os\nimport re\nrestaurants = [\"http://finweb.rit.edu/diningservices/brickcity\",\n\"http://finweb.rit.edu/diningservices/commons\",\n\"http://finweb.rit.edu/diningservices/crossroads... | true |
9,523 | d3b0a1d8b9f800c5d34732f4701ea2183405e5b4 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 3 18:27:30 2020
@author: PREET MODH
"""
for _ in range(int(input())):
n=int(input())
xco,yco=[],[]
flagx,flagy,xans,yans=1,1,0,0
for x in range(4*n-1):
x,y=input().split()
xco.append(int(x))
yco.append(int(y))
... | [
"# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Fri Jul 3 18:27:30 2020\r\n\r\n@author: PREET MODH\r\n\"\"\"\r\n\r\n\r\nfor _ in range(int(input())):\r\n n=int(input())\r\n xco,yco=[],[]\r\n flagx,flagy,xans,yans=1,1,0,0\r\n for x in range(4*n-1):\r\n x,y=input().split()\r\n xco.append(i... | false |
9,524 | f327f408ae2759407ac9f01ad4feff5c6a0845f1 | #Function to remove spaces in a string
def remove(string_input):
return string_input.replace(" ", "")
| [
"#Function to remove spaces in a string\n\ndef remove(string_input):\n return string_input.replace(\" \", \"\")\n",
"def remove(string_input):\n return string_input.replace(' ', '')\n",
"<function token>\n"
] | false |
9,525 | 3b8c4f19e28e54e651862ec9b88b091c9faff02b | import urllib.request, urllib.parse, urllib.error
from urllib.request import urlopen
import xml.etree.ElementTree as ET
import ssl
# # Ignore SSL certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
url = input('Enter a URL: ')
# if len(url) < 1 : url = 'ht... | [
"import urllib.request, urllib.parse, urllib.error\nfrom urllib.request import urlopen\nimport xml.etree.ElementTree as ET\nimport ssl \n\n# # Ignore SSL certificate errors\nctx = ssl.create_default_context()\nctx.check_hostname = False\nctx.verify_mode = ssl.CERT_NONE\n\nurl = input('Enter a URL: ')\n# if len(url)... | false |
9,526 | 0c283cd31203291da24226a0eae781bd397e84d4 | '''
Generate a ten-character alphanumeric password with at least one lowercase,
at least one uppercase character, and at least three digits
'''
import secrets
import string
alphabets = string.ascii_letters + string.digits
while True:
password = "".join(secrets.choice(alphabets) for i in range(10))
if(a... | [
"'''\r\nGenerate a ten-character alphanumeric password with at least one lowercase,\r\nat least one uppercase character, and at least three digits\r\n'''\r\nimport secrets\r\nimport string\r\nalphabets = string.ascii_letters + string.digits\r\nwhile True:\r\n password = \"\".join(secrets.choice(alphabets) for i ... | false |
9,527 | 0ebd19079a16a6e3da34da2ecfda0d159b8580b2 | #!/usr/bin/python
#
# @name = 'fmsrutil.py'
#
# @description = "F-MSR utilities module."
#
# @author = ['YU Chiu Man', 'HU Yuchong', 'TANG Yang']
#
import sys
import os
import random
from finitefield import GF256int
from coeffvector import CoeffVector
from coeffvector import CoeffMatrix
import common
#Check if C l... | [
"#!/usr/bin/python\n#\n# @name = 'fmsrutil.py'\n# \n# @description = \"F-MSR utilities module.\"\n#\n# @author = ['YU Chiu Man', 'HU Yuchong', 'TANG Yang']\n#\n\nimport sys\nimport os\nimport random\n\nfrom finitefield import GF256int\nfrom coeffvector import CoeffVector\nfrom coeffvector import CoeffMatrix\n\nimpo... | false |
9,528 | 65ea27851d9db0f0a06d42bd37eff633d22a1548 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-30 14:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('books', '0007_auto_20170127_2254'),
]
operations = [
migrations.AlterField(... | [
"# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-01-30 14:50\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('books', '0007_auto_20170127_2254'),\n ]\n\n operations = [\n mig... | false |
9,529 | aac334256c1e05ef33a54da19925911af6645a10 | from django.urls import path
from .authentication import GetToken, RegisterUserAPIView
from .resurses import *
urlpatterns = [
path('register/', RegisterUserAPIView.as_view()),
path('get/token/', GetToken.as_view()),
path('card/list/', ShowCardsAPIView.as_view()),
path('card/create/', CreateCardAPIVie... | [
"from django.urls import path\n\nfrom .authentication import GetToken, RegisterUserAPIView\nfrom .resurses import *\n\nurlpatterns = [\n path('register/', RegisterUserAPIView.as_view()),\n path('get/token/', GetToken.as_view()),\n path('card/list/', ShowCardsAPIView.as_view()),\n path('card/create/', Cr... | false |
9,530 | 8a0c0f5ca6a965e07f59a6c88d4dd335310cbdfc | import text
nan=""
section_words = {'start': -1, '1.1': 17, '1.2': 38, '1.3': 55, '1.4': 76, '1.5': 95, '1.6': 114, '1.7': 133, '1.8': 151, '1.9': 170, '1.10': 190, '1.11': 209, '1.12': 233, '1.13': 257, '1.14': 277, '1.15': 299, '1.16': 320, '1.17': 341, '1.18': 364, '1.19': 385, '1.20': 405, '1.21': 428, '2.1': 451, ... | [
"import text\nnan=\"\"\nsection_words = {'start': -1, '1.1': 17, '1.2': 38, '1.3': 55, '1.4': 76, '1.5': 95, '1.6': 114, '1.7': 133, '1.8': 151, '1.9': 170, '1.10': 190, '1.11': 209, '1.12': 233, '1.13': 257, '1.14': 277, '1.15': 299, '1.16': 320, '1.17': 341, '1.18': 364, '1.19': 385, '1.20': 405, '1.21': 428, '2.... | false |
9,531 | 6028b46eab422dea02af24e9cf724fe0d8b3ecc4 | import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GroupKFold
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_log_error
from sklearn.preprocessing import OneHotEncoder
from sklearn.linear_model import... | [
"import numpy as np\nimport pandas as pd\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.model_selection import GroupKFold\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn.metrics import mean_squared_log_error\nfrom sklearn.preprocessing import OneHotEncoder\nfrom sklearn.linear_... | false |
9,532 | 821afa85eb783b4bf1018800f598a3294c4cbcfb | from django.contrib import admin
# Register your models here.
from registration.models import FbAuth
class AllFieldsAdmin(admin.ModelAdmin):
"""
A model admin that displays all field in admin excpet Many to many and pk field
"""
def __init__(self, model, admin_site):
self.list_display = [fi... | [
"from django.contrib import admin\n\n# Register your models here.\nfrom registration.models import FbAuth\n\n\nclass AllFieldsAdmin(admin.ModelAdmin):\n\n \"\"\"\n A model admin that displays all field in admin excpet Many to many and pk field\n \"\"\"\n\n def __init__(self, model, admin_site):\n ... | false |
9,533 | 15e0b396a4726f98ce5ae2620338d7d48985707e | try:
fh = open("testfile","w")
fh.write("test")
except IOError:
print("Error:没有找到文件")
else:
print("sucess")
fh.close()
| [
"try:\r\n\tfh = open(\"testfile\",\"w\")\r\n\tfh.write(\"test\")\r\nexcept IOError:\r\n\tprint(\"Error:没有找到文件\")\r\nelse:\r\n\tprint(\"sucess\")\r\n\tfh.close()\r\n\r\n",
"try:\n fh = open('testfile', 'w')\n fh.write('test')\nexcept IOError:\n print('Error:没有找到文件')\nelse:\n print('sucess')\n fh.clo... | false |
9,534 | 60079005c2091d2dc0b76fb71739671873f0e0f1 | import threading
import time
g_num = 0
def work1(num):
global g_num
for i in range(num):
g_num += 1
print("__in work1: g_num is {}".format(g_num))
def work2(num):
global g_num
for i in range(num):
g_num += 1
print("__in work2: g_num is {}".format(g_num))
def main():
... | [
"import threading\nimport time\n\n\ng_num = 0\n\n\ndef work1(num):\n global g_num\n for i in range(num):\n g_num += 1\n print(\"__in work1: g_num is {}\".format(g_num))\n\n\ndef work2(num):\n global g_num\n for i in range(num):\n g_num += 1 \n print(\"__in work2: g_num is {}\".format... | false |
9,535 | ff7cb8261f3abb70599725fe7c598c571d037226 | ## 허프변환에 의한 직선 검출
# cv2.HoughLines(image, rho, theta, threshold, lines=None, srn=None, stn=None, min-theta=None, max-theta=None) => lines
# image : 에지 입력 영상(Canny 연산을 이용한 에지 영상)
# rho(로우) : 축적 배열에서 rho 값의 간격(보통 1.0 사용)
# theta(세타) : 축적 배열에서 theta 값의 간격(보통 np.pi/180)
# rho, theta 값이 커지면 축적배열의 크기는 작아지고, 값이 작으면 축적배... | [
"## 허프변환에 의한 직선 검출\r\n# cv2.HoughLines(image, rho, theta, threshold, lines=None, srn=None, stn=None, min-theta=None, max-theta=None) => lines\r\n# image : 에지 입력 영상(Canny 연산을 이용한 에지 영상)\r\n# rho(로우) : 축적 배열에서 rho 값의 간격(보통 1.0 사용)\r\n# theta(세타) : 축적 배열에서 theta 값의 간격(보통 np.pi/180)\r\n\r\n# rho, theta 값이 커지면 축적배열의 크기는... | false |
9,536 | 00429a16ac009f6f706ef11bc29b0aec77b9ebe6 | import pandas as pd
iris_nan = pd.read_csv("MLData/iris_nan.csv")
iris_nan.head()
Y = iris_nan["class"].values
X = iris_nan.drop("class", axis=1)
# Our iris dataframe presents some NaN values, and we need to fix that.
# We got some methods to apply on a pandas dataframe:
# 1: Drop records presenting a NaN value: We... | [
"import pandas as pd\n\niris_nan = pd.read_csv(\"MLData/iris_nan.csv\")\niris_nan.head()\n\nY = iris_nan[\"class\"].values\nX = iris_nan.drop(\"class\", axis=1)\n\n# Our iris dataframe presents some NaN values, and we need to fix that.\n# We got some methods to apply on a pandas dataframe:\n\n# 1: Drop records pres... | false |
9,537 | c60b8eec57d845c73ee3e00432747d23748c1706 | import tensorflow as tf
def Float32():
return tf.float32
def Float16():
return tf.float16 | [
"import tensorflow as tf\r\n\r\ndef Float32():\r\n return tf.float32\r\n\r\ndef Float16():\r\n return tf.float16",
"import tensorflow as tf\n\n\ndef Float32():\n return tf.float32\n\n\ndef Float16():\n return tf.float16\n",
"<import token>\n\n\ndef Float32():\n return tf.float32\n\n\ndef Float16(... | false |
9,538 | 8de6877f040a7234da73b55c8b7fdefe20bc0d6e | import pandas as pd
df = pd.read_csv('~/Documents/data/tables.csv')
mdfile = open('tables_with_refs.md', 'w')
mdfile.write('# Tables with references\n')
for i, row in df.iterrows():
t = '\n```\n{% raw %}\n' + str(row['table']) + '\n{% endraw %}\n```\n'
r = '\n```\n{% raw %}\n' + str(row['refs']) + '\n{% end... | [
"import pandas as pd\n\ndf = pd.read_csv('~/Documents/data/tables.csv')\nmdfile = open('tables_with_refs.md', 'w')\n\nmdfile.write('# Tables with references\\n')\n\n\nfor i, row in df.iterrows():\n t = '\\n```\\n{% raw %}\\n' + str(row['table']) + '\\n{% endraw %}\\n```\\n'\n r = '\\n```\\n{% raw %}\\n' + str... | false |
9,539 | 8559448822b3d3989a9795e7b497a2791588c327 | f = open("resources/yesterday.txt", 'r')
yesterday_lyric = ""
while 1 :
line = f.readline()
if not line :
break
yesterday_lyric = yesterday_lyric + line.strip() + "\n"
f.close()
# 대소문자 구분없이 yesterday 단어의 개수 세기 : 대문자로 또는 소문자로 만들고 카운드 세기
num_of_yesterday = yesterday_lyric.upper().count("YESTERDAY")
... | [
"f = open(\"resources/yesterday.txt\", 'r')\nyesterday_lyric = \"\"\nwhile 1 :\n line = f.readline()\n if not line :\n break\n yesterday_lyric = yesterday_lyric + line.strip() + \"\\n\"\n\nf.close()\n\n# 대소문자 구분없이 yesterday 단어의 개수 세기 : 대문자로 또는 소문자로 만들고 카운드 세기\nnum_of_yesterday = yesterday_lyric.uppe... | false |
9,540 | d7b91b0476a1f2e00408ce1f1501bf98d4c06e4e | # -*- coding: utf-8 -*-
# @Author: Marcela Campo
# @Date: 2016-05-06 18:56:47
# @Last Modified by: Marcela Campo
# @Last Modified time: 2016-05-06 19:03:21
import os
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
from server import app, db
app.config.from_object('confi... | [
"# -*- coding: utf-8 -*-\n# @Author: Marcela Campo\n# @Date: 2016-05-06 18:56:47\n# @Last Modified by: Marcela Campo\n# @Last Modified time: 2016-05-06 19:03:21\nimport os\nfrom flask.ext.script import Manager\nfrom flask.ext.migrate import Migrate, MigrateCommand\n\nfrom server import app, db\n\n\napp.config.f... | false |
9,541 | 33daf5753b27f6b4bcb7c98e28cf2168e7f0b403 |
#calss header
class _WATERWAYS():
def __init__(self,):
self.name = "WATERWAYS"
self.definitions = waterway
self.parents = []
self.childen = []
self.properties = []
self.jsondata = {}
self.basic = ['waterway']
| [
"\n\n#calss header\nclass _WATERWAYS():\n\tdef __init__(self,): \n\t\tself.name = \"WATERWAYS\"\n\t\tself.definitions = waterway\n\n\t\tself.parents = []\n\t\tself.childen = []\n\t\tself.properties = []\n\t\tself.jsondata = {}\n\n\n\t\tself.basic = ['waterway']\n",
"class _WATERWAYS:\n\n def __init__(self):\n ... | false |
9,542 | 73cacc1317c8624b45c017144bc7449bc99bd045 | import torch
from torchelie.data_learning import *
def test_pixel_image():
pi = PixelImage((1, 3, 128, 128), 0.01)
pi()
start = torch.randn(3, 128, 128)
pi = PixelImage((1, 3, 128, 128), init_img=start)
assert start.allclose(pi() + 0.5, atol=1e-7)
def test_spectral_image():
pi = SpectralIm... | [
"import torch\nfrom torchelie.data_learning import *\n\n\ndef test_pixel_image():\n pi = PixelImage((1, 3, 128, 128), 0.01)\n pi()\n\n start = torch.randn(3, 128, 128)\n pi = PixelImage((1, 3, 128, 128), init_img=start)\n\n assert start.allclose(pi() + 0.5, atol=1e-7)\n\n\ndef test_spectral_image():\... | false |
9,543 | 9cb734f67d5149b052ff1d412d446aea1654fa69 | import uuid
from cqlengine import columns
from cqlengine.models import Model
from datetime import datetime as dt
class MBase(Model):
__abstract__ = True
#__keyspace__ = model_keyspace
class Post(MBase):
id = columns.BigInt(index=True, primary_key=True)
user_id = columns.Integer(required=True, index=... | [
"import uuid\nfrom cqlengine import columns\nfrom cqlengine.models import Model\nfrom datetime import datetime as dt\n\n\nclass MBase(Model):\n __abstract__ = True\n #__keyspace__ = model_keyspace\n\n\nclass Post(MBase):\n id = columns.BigInt(index=True, primary_key=True)\n user_id = columns.Integer(req... | false |
9,544 | 38c1b82a29a5ad0b4581e63fb083ca2487a79817 | #Created by Jake Hansen for Zebra interview take home assessment, July 2020.
import csv, os, sys, pickle
from datetime import date
#Class For storing information about each file generally. Helpful for future
#use cases to remember the indicies from a file, if file has thousands of fields
#Also can be used as a log to ... | [
"#Created by Jake Hansen for Zebra interview take home assessment, July 2020.\nimport csv, os, sys, pickle\nfrom datetime import date\n\n#Class For storing information about each file generally. Helpful for future\n#use cases to remember the indicies from a file, if file has thousands of fields\n#Also can be used a... | false |
9,545 | c8ab53c77ff3646a30ca49eaafc275afeadd2ca6 | from __future__ import division # floating point division
import csv
import random
import math
import numpy as np
import dataloader as dtl
import classalgorithms as algs
def getaccuracy(ytest, predictions):
correct = 0
for i in range(len(ytest)):
if ytest[i] == predictions[i]:
correct ... | [
"from __future__ import division # floating point division\nimport csv\nimport random\nimport math\nimport numpy as np\n\nimport dataloader as dtl\nimport classalgorithms as algs\n \n \ndef getaccuracy(ytest, predictions):\n correct = 0\n for i in range(len(ytest)):\n if ytest[i] == predictions[i]:\n ... | true |
9,546 | 08568c31e5a404957c11eca9cbc9472c71cf088b | import os
import re
import logging
import time
from string import replace
from settings import *
import wsgiref.handlers
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from modules.xml2dict import *
from modules import kayak
from modules.messaging import *
from modules.cron im... | [
"import os\nimport re\nimport logging\nimport time\nfrom string import replace\nfrom settings import *\nimport wsgiref.handlers\nfrom google.appengine.ext import webapp\nfrom google.appengine.ext.webapp import template\n\nfrom modules.xml2dict import *\nfrom modules import kayak\nfrom modules.messaging import *\nfr... | false |
9,547 | 87e0b9dc518d439f71e261d5c5047153324919ba | # Generated by Django 2.0.2 on 2018-06-10 18:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Expression',
fields=[
... | [
"# Generated by Django 2.0.2 on 2018-06-10 18:24\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n initial = True\n\n dependencies = [\n ]\n\n operations = [\n migrations.CreateModel(\n name='Expression',\n ... | false |
9,548 | 4dcc0261abdb783c60471736567faf7db8b56190 | from model.area import AreaModel
from flask_restful import Resource, reqparse
from flask_jwt import jwt_required
class Area(Resource):
pareser = reqparse.RequestParser()
pareser.add_argument('name',
type = str,
required = True,
help = 'Area name is required')
@jwt_required()
def get(self,... | [
"from model.area import AreaModel\nfrom flask_restful import Resource, reqparse\nfrom flask_jwt import jwt_required\n\nclass Area(Resource):\n pareser = reqparse.RequestParser()\n pareser.add_argument('name', \n type = str,\n required = True,\n help = 'Area name is required')\n\n @jwt_required()\n... | false |
9,549 | 6bd9c8e38373e696193c146b88ebf6601170cf0e | from django.urls import reverse_lazy
from django.views.generic import CreateView, edit, ListView
from django.shortcuts import render
from django.contrib.auth import authenticate, login
from users.forms import CustomUserCreationForm, LoginForm
from users.models import CustomUser as Users
class SignUpView(CreateView):... | [
"from django.urls import reverse_lazy\nfrom django.views.generic import CreateView, edit, ListView\nfrom django.shortcuts import render\nfrom django.contrib.auth import authenticate, login\n\nfrom users.forms import CustomUserCreationForm, LoginForm\nfrom users.models import CustomUser as Users\n\n\nclass SignUpVie... | false |
9,550 | a3f6ea649fc5e60b0f8353b1404912d060686b99 | # 10.13.20 - sjg
# Exercise 15 - solution A
# Write a function called greatestCommomFactor that,
#given two distinct positive integers,
#returns the greatest common factor of those two values
#Input: greatestCommonFactor(9,12)
#Output: 3
#Input: greatestCommonFactor(6,18)
#Output: 6
#Input: greatestCommonFactor(11... | [
"# 10.13.20 - sjg \n# Exercise 15 - solution A\n# Write a function called greatestCommomFactor that, \n#given two distinct positive integers,\n#returns the greatest common factor of those two values\n\n#Input: greatestCommonFactor(9,12)\n#Output: 3\n\n#Input: greatestCommonFactor(6,18)\n#Output: 6\n\n#Input: greate... | false |
9,551 | 00e8e0b5aeccd2a67f6cfdad63012a0d8b066e6f | from django.shortcuts import render
from django.template import loader
# Create your views here.
from django.http import HttpResponse
from .models import Student
def index(request):
student_objects = Student.objects.all()
context = {"students": student_objects}
return render(request, 'student_list.html', context... | [
"from django.shortcuts import render\nfrom django.template import loader\n\n# Create your views here.\n\nfrom django.http import HttpResponse\n\nfrom .models import Student\n\ndef index(request):\n\tstudent_objects = Student.objects.all()\n\tcontext = {\"students\": student_objects}\n\treturn render(request, 'stude... | false |
9,552 | 0bf970a84911d29a8343575ef15f2765875b8b89 | from graphics import *
from random import random
def printIntro():
print("This program evaluates pi via Monte Carlo techniques")
def simDarts(n):
win = GraphWin("", 400, 400)
win.setCoords(-1.2, -1.2, 1.2, 1.2)
hits = 0
for i in range(n):
pt = getDarts()
if hitTarget(pt):
... | [
"from graphics import *\nfrom random import random\n\ndef printIntro():\n print(\"This program evaluates pi via Monte Carlo techniques\")\n \ndef simDarts(n):\n win = GraphWin(\"\", 400, 400)\n win.setCoords(-1.2, -1.2, 1.2, 1.2)\n hits = 0 \n\n for i in range(n):\n pt = getDarts()\n ... | false |
9,553 | 42f021c728a88f34d09f94ea96d91abded8a29fb | # Generated by Django 3.2.6 on 2021-08-19 16:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('crm', '0040_auto_20210819_1913'),
]
operations = [
migrations.RemoveField(
model_name='customer',
name='full_name',
... | [
"# Generated by Django 3.2.6 on 2021-08-19 16:17\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('crm', '0040_auto_20210819_1913'),\n ]\n\n operations = [\n migrations.RemoveField(\n model_name='customer',\n name='f... | false |
9,554 | 5718eab8c5fac4cb7bfa1b049b63ca1e30610247 | L = [
[
"0",
"0",
"00"
],[
"..0",
"000"
],[
"00",
".0",
".0"
], [
"000",
"0"
]
]
J = [
[
".0",
".0",
"00"
],[
"0..",
"000"
],[
"00",
"0",
"0"... | [
"L = [\n [\n \"0\",\n \"0\",\n \"00\"\n ],[\n \"..0\",\n \"000\" \n ],[\n \"00\",\n \".0\",\n \".0\"\n ], [\n \"000\",\n \"0\"\n ]\n]\n\nJ = [\n [\n \".0\",\n \".0\",\n \"00\"\n ],[\n \"0..\",\n ... | false |
9,555 | eba8e2bda786760898c10d3e75620144973d6236 | class FixtureBittrex:
PING = {"serverTime": 1582535502000}
MARKETS = [
{
"symbol": "ETH-BTC", "baseCurrencySymbol": "ETH", "quoteCurrencySymbol": "BTC",
"minTradeSize": "0.01314872", "precision": 8,
"status": "ONLINE", "createdAt": "2015-08-14T09:02:24.817Z"},
... | [
"class FixtureBittrex:\n PING = {\"serverTime\": 1582535502000}\n\n MARKETS = [\n {\n \"symbol\": \"ETH-BTC\", \"baseCurrencySymbol\": \"ETH\", \"quoteCurrencySymbol\": \"BTC\",\n \"minTradeSize\": \"0.01314872\", \"precision\": 8,\n \"status\": \"ONLINE\", \"createdAt\... | false |
9,556 | 67b483d9d002cc66dd368cf53fdc49ebb7b4f4d4 | # type: ignore[no-redef]
import pytest
@pytest.mark.asyncio
@pytest.mark.core
async def test_async_executor(executor):
def func():
pass
result = await executor.run(func)
assert result is None
def func():
return 1
result = await executor.run(func)
assert result == 1
def ... | [
"# type: ignore[no-redef]\nimport pytest\n\n\n@pytest.mark.asyncio\n@pytest.mark.core\nasync def test_async_executor(executor):\n def func():\n pass\n\n result = await executor.run(func)\n assert result is None\n\n def func():\n return 1\n\n result = await executor.run(func)\n assert... | false |
9,557 | 62094d036596f39e7cf936fe7a91e67d53ee055e | from flask import (
Flask,
render_template,
request
)
import requests
app = Flask(__name__)
base_url = "https://api.github.com/users/"
@app.route("/", methods = ["GET", "POST"])
def index():
if request.method == "POST":
githubName = request.form.get("githubname")
responseUser = request... | [
"from flask import (\n Flask,\n render_template,\n request\n)\nimport requests\n\napp = Flask(__name__)\nbase_url = \"https://api.github.com/users/\"\n\n@app.route(\"/\", methods = [\"GET\", \"POST\"])\ndef index():\n if request.method == \"POST\":\n githubName = request.form.get(\"githubname\")\... | false |
9,558 | ce65a672cae26bdb8ec8cb04eabfe1877f9cd7d4 | #!/usr/bin/env python
# coding: utf-8
from sklearn.metrics import confusion_matrix
import numpy as np
import pandas as pd
df = pd.read_csv('orb.csv')
d = pd.pivot_table(df,index='col1',columns='col2',values='result')
d.fillna(0,inplace=True)
| [
"#!/usr/bin/env python\n# coding: utf-8\n\nfrom sklearn.metrics import confusion_matrix\nimport numpy as np\nimport pandas as pd\n\n\ndf = pd.read_csv('orb.csv')\nd = pd.pivot_table(df,index='col1',columns='col2',values='result')\nd.fillna(0,inplace=True)\n",
"from sklearn.metrics import confusion_matrix\nimport ... | false |
9,559 | 8fa58791aae1352109b3bf7410d68bf5ae1d8cb7 | # coding: utf-8
"""
Styled object
=============
A :class:`~benker.styled.Styled` object contains a dictionary of styles.
It is mainly used for :class:`~benker.table.Table`, :class:`~benker.table.RowView`,
:class:`~benker.table.ColView`, and :class:`~benker.cell.Cell`.
"""
import pprint
class Styled(object):
""... | [
"# coding: utf-8\n\"\"\"\nStyled object\n=============\n\nA :class:`~benker.styled.Styled` object contains a dictionary of styles.\n\nIt is mainly used for :class:`~benker.table.Table`, :class:`~benker.table.RowView`,\n:class:`~benker.table.ColView`, and :class:`~benker.cell.Cell`.\n\n\"\"\"\nimport pprint\n\n\ncla... | false |
9,560 | 53909b750f259b67b061ba26d604e0c2556376df | ###############################################################################
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by ... | [
"###############################################################################\r\n# #\r\n# This program is free software: you can redistribute it and/or modify #\r\n# it under the terms of the GNU General Public License as publi... | false |
9,561 | fd2b60de2ef540264855f04e1c5bcb9d1cf23c51 | """Changed Views table name
Revision ID: 7f559bb24ca4
Revises: cc927fe47c8f
Create Date: 2021-08-20 23:20:31.959984
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "7f559bb24ca4"
down_revision = "cc927fe47c8f"
branch_labels = None
depends_on = None
def upgrade... | [
"\"\"\"Changed Views table name\n\nRevision ID: 7f559bb24ca4\nRevises: cc927fe47c8f\nCreate Date: 2021-08-20 23:20:31.959984\n\n\"\"\"\nimport sqlalchemy as sa\nfrom alembic import op\n\n# revision identifiers, used by Alembic.\nrevision = \"7f559bb24ca4\"\ndown_revision = \"cc927fe47c8f\"\nbranch_labels = None\nde... | false |
9,562 | cac49a9a2cb753bb81c45ac1d2d887b1f48dd9bb | from Tkinter import *
import time
def create_window():
window = Toplevel(root)
w, h = root.winfo_screenwidth(), root.winfo_screenheight()
canvas = Canvas(window,width=w,height=h)
canvas.create_text(w/2,h/2,text="this will close after 3 seconds",font="Arial")
canvas.pack()
window.overrideredirec... | [
"from Tkinter import *\nimport time\n\ndef create_window():\n window = Toplevel(root)\n w, h = root.winfo_screenwidth(), root.winfo_screenheight()\n canvas = Canvas(window,width=w,height=h)\n canvas.create_text(w/2,h/2,text=\"this will close after 3 seconds\",font=\"Arial\")\n canvas.pack()\n wind... | false |
9,563 | 91188b55b0f5d8277812d82711f5bcde82819b30 | import datetime, time, threading, os
from . import queues
logLevels = ["none", "info", "debug"]
level = "none"
def write(message):
queues.logger_queue.put(message)
def runLogger():
while True:
# The log path should be read from config. Pass into logger?
log_path = "/home/pi/Desktop/Projects/r... | [
"import datetime, time, threading, os\nfrom . import queues\n\nlogLevels = [\"none\", \"info\", \"debug\"]\nlevel = \"none\"\n\ndef write(message):\n queues.logger_queue.put(message)\n\ndef runLogger():\n while True:\n # The log path should be read from config. Pass into logger?\n log_path = \"/... | false |
9,564 | 0e0e51904f05b41b4769b730c836568b8bb63869 | #Sorting for a number list
#ascending and descending
ls=[1,34,23,56,34,67,87,54,62,31,66]
ls.sort(reverse=True)
print(ls)
ls.sort()
print(ls)
#Sorting a letter's list with different scenarios
ls_l=["aaa","ertdf","ieurtff","fnjr","resdjx","jfh","r","fd"]
#1-sort according to string length from small length to bigger
ls... | [
"#Sorting for a number list\n#ascending and descending\nls=[1,34,23,56,34,67,87,54,62,31,66]\nls.sort(reverse=True)\nprint(ls)\nls.sort()\nprint(ls)\n#Sorting a letter's list with different scenarios\nls_l=[\"aaa\",\"ertdf\",\"ieurtff\",\"fnjr\",\"resdjx\",\"jfh\",\"r\",\"fd\"]\n\n#1-sort according to string length... | false |
9,565 | 7b38c64174656d1c4ec2b0541e6ed8d6680af7d7 | '''
we have source files with a certain format and each file has 200 columns and there is a process that takes the source
files and loads into hbase and moves it into sql data warehouse. We have to create automated test scripts that compares
with with is with hbase and sql data warehouse. load into hbase and query the ... | [
"'''\nwe have source files with a certain format and each file has 200 columns and there is a process that takes the source\nfiles and loads into hbase and moves it into sql data warehouse. We have to create automated test scripts that compares\nwith with is with hbase and sql data warehouse. load into hbase and qu... | false |
9,566 | 857e3e04b99cb346fd89b34c0d14957d65b7ac38 | #公路工程工程量清单编码默认格式母节点为数字型式,子节点为-b字母形式,为使编码唯一便于数据处理,编制此脚本
import re
import pandas as pd
import os
def get_csv_path():#原编码保存为csv文件的一列,便于读取
path=input('enter csv path:')
if os.path.isfile(path):
return path
else:
print('csv file not exsit,try again:')
return get_csv_path()
def unique_code... | [
"#公路工程工程量清单编码默认格式母节点为数字型式,子节点为-b字母形式,为使编码唯一便于数据处理,编制此脚本\nimport re\nimport pandas as pd\nimport os\ndef get_csv_path():#原编码保存为csv文件的一列,便于读取\n path=input('enter csv path:')\n if os.path.isfile(path):\n return path\n else:\n print('csv file not exsit,try again:')\n return get_csv_path()\... | false |
9,567 | 84d0c439fcee4339250ced11dd2264740cc20d9c | import ply.lex as lex
print("hello word!")
| [
"import ply.lex as lex\n\nprint(\"hello word!\")\n",
"import ply.lex as lex\nprint('hello word!')\n",
"<import token>\nprint('hello word!')\n",
"<import token>\n<code token>\n"
] | false |
9,568 | 797cedc9dc2a47713b9554e4f5975a4505ecf6d3 | #!/usr/bin/env python3
# encoding: utf-8
"""
@version: ??
@author: ami
@license: Apache Licence
@file: dictTest.py
@time: 2019/9/25 18:26
@tools: PyCharm
"""
def func():
pass
class Main():
def __init__(self):
pass
if __name__ == '__main__':
pass
d = {'name': 'Bob', ... | [
"#!/usr/bin/env python3\r\n# encoding: utf-8\r\n\r\n\"\"\"\r\n@version: ??\r\n@author: ami\r\n@license: Apache Licence \r\n@file: dictTest.py\r\n@time: 2019/9/25 18:26\r\n@tools: PyCharm\r\n\"\"\"\r\n\r\n\r\ndef func():\r\n pass\r\n\r\n\r\nclass Main():\r\n def __init__(self):\r\n pass\r\n\r\n\r\nif __... | false |
9,569 | cc985ae061c04696dbf5114273befd62321756ae | __title__ = 'pyaddepar'
__version__ = '0.6.0'
__author__ = 'Thomas Schmelzer'
__license__ = 'MIT'
__copyright__ = 'Copyright 2019 by Lobnek Wealth Management' | [
"__title__ = 'pyaddepar'\n__version__ = '0.6.0'\n__author__ = 'Thomas Schmelzer'\n__license__ = 'MIT'\n__copyright__ = 'Copyright 2019 by Lobnek Wealth Management'",
"__title__ = 'pyaddepar'\n__version__ = '0.6.0'\n__author__ = 'Thomas Schmelzer'\n__license__ = 'MIT'\n__copyright__ = 'Copyright 2019 by Lobnek Wea... | false |
9,570 | 79ff164c36cc5f0a2382a571ec183952a03e66cc | import csv
import hashdate as hd
with open('Grainger_Library.csv', newline='') as f:
reader = csv.reader(f)
data = list(reader)
del data[0]
gld = []
glo = []
data.sort(key=lambda x:x[1])
for i in range(0,len(data)):
gld.append((data[i][1],data[i][2]))
print('ahd:')
#print(ahd)
glh = hd.hashdate(365,2020... | [
"import csv\nimport hashdate as hd\n\n\n\nwith open('Grainger_Library.csv', newline='') as f:\n reader = csv.reader(f)\n data = list(reader)\ndel data[0]\ngld = []\nglo = []\ndata.sort(key=lambda x:x[1])\n\nfor i in range(0,len(data)):\n gld.append((data[i][1],data[i][2]))\nprint('ahd:')\n#print(ahd)\nglh ... | false |
9,571 | 7ca88d451ad702e5a8e532da3e3f5939cfaa7215 | import argparse
import subprocess
import os
def get_files(dir_path, ext='.png'):
relative_paths = os.listdir(dir_path)
relative_paths = list(filter(lambda fp: ext in fp, relative_paths))
return list(map(lambda rel_p: os.path.join(dir_path, rel_p), relative_paths))
def ipfs_add_local(file_path):
'Ret... | [
"import argparse\nimport subprocess\nimport os\n\n\ndef get_files(dir_path, ext='.png'):\n relative_paths = os.listdir(dir_path)\n relative_paths = list(filter(lambda fp: ext in fp, relative_paths))\n return list(map(lambda rel_p: os.path.join(dir_path, rel_p), relative_paths))\n\n\ndef ipfs_add_local(file... | false |
9,572 | d4625dd743dd6648044e40b02743ae80f4caea36 | import argparse
import datetime
import json
import os
import sys
import hail as hl
from .utils import run_all, run_pattern, run_list, RunConfig
from .. import init_logging
def main(args):
init_logging()
records = []
def handler(stats):
records.append(stats)
data_dir = args.data_dir or os.... | [
"import argparse\nimport datetime\nimport json\nimport os\nimport sys\n\nimport hail as hl\n\nfrom .utils import run_all, run_pattern, run_list, RunConfig\nfrom .. import init_logging\n\n\ndef main(args):\n init_logging()\n\n records = []\n\n def handler(stats):\n records.append(stats)\n\n data_d... | false |
9,573 | 8d8f1f0dbb76b5c536bd1a2142bb61c51dd75075 | import pandas as pd
import numpy as np
df = pd.DataFrame([['Hospital1', '2019-10-01'],
['Hospital2', '2019-10-01'],
['Hospital3', '2019-10-01'],
['Hospital1', '2019-10-01'],
['Hospital2', '2019-10-02'],
['Hospital3',... | [
"import pandas as pd\r\nimport numpy as np\r\n\r\ndf = pd.DataFrame([['Hospital1', '2019-10-01'],\r\n ['Hospital2', '2019-10-01'],\r\n ['Hospital3', '2019-10-01'],\r\n ['Hospital1', '2019-10-01'],\r\n ['Hospital2', '2019-10-02'],\r\n ... | false |
9,574 | 4f1956b34ac3b55b2d40220b79816c139b4a2f5c | import setuptools
setuptools.setup(
name='cppersist',
install_requires=['Eve']
)
| [
"import setuptools\n\nsetuptools.setup(\n name='cppersist',\n install_requires=['Eve']\n)\n",
"import setuptools\nsetuptools.setup(name='cppersist', install_requires=['Eve'])\n",
"<import token>\nsetuptools.setup(name='cppersist', install_requires=['Eve'])\n",
"<import token>\n<code token>\n"
] | false |
9,575 | 8adcd75e925fe0c5a50b2fc7dc8c472a9610b4f2 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2017--2018 Amazon.com, Inc. or its affiliates. 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. A copy of the License
# is located at
#
# http://aws.... | [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# Copyright 2017--2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n# use this file except in compliance with the License. A copy of the License\n# is located at\n#\n#... | false |
9,576 | 763e2db4eb9ad5953273fb310c8e9714964a39e6 | from flask import Blueprint, request, render_template, session, redirect
log = Blueprint('login', __name__, )
@log.route('/login', methods=['GET', 'POST'])
def login():
print(request.path, )
if request.method == 'GET':
return render_template('exec/login.html')
else:
username = request.for... | [
"from flask import Blueprint, request, render_template, session, redirect\n\nlog = Blueprint('login', __name__, )\n\n\n@log.route('/login', methods=['GET', 'POST'])\ndef login():\n print(request.path, )\n if request.method == 'GET':\n return render_template('exec/login.html')\n else:\n userna... | false |
9,577 | 759b440bf436afbfb081cf55eeb4a0f075ed3e6d | ulang = 'y'
while True :
a = int(input ("masukkan nilai = "))
if a > 60 :
status = "LULUS"
elif a <= 60 :
status = "TIDAK LULUS"
print(status)
ulang = input("apakah anda ingin mengulang? y/n = ") | [
"ulang = 'y'\r\nwhile True :\r\n\ta = int(input (\"masukkan nilai = \"))\r\n\r\n\tif a > 60 :\r\n\t\tstatus = \"LULUS\"\r\n\telif a <= 60 :\r\n\t\tstatus = \"TIDAK LULUS\"\r\n\tprint(status)\r\n\r\n\tulang = input(\"apakah anda ingin mengulang? y/n = \")",
"ulang = 'y'\nwhile True:\n a = int(input('masukkan ni... | false |
9,578 | 5616ec135a2233e742ff3b2b1f378ec12298b935 | from flask_restful import Resource, reqparse
import sqlite3
from flask_jwt import jwt_required
from models.item_model import ItemModel
from flask_sqlalchemy import SQLAlchemy
from d import db
from models.store_model import StoreModel
class Modell(Resource):
def get(self, name):
item = Store... | [
"from flask_restful import Resource, reqparse\r\nimport sqlite3\r\nfrom flask_jwt import jwt_required\r\nfrom models.item_model import ItemModel\r\nfrom flask_sqlalchemy import SQLAlchemy\r\nfrom d import db\r\nfrom models.store_model import StoreModel\r\n\r\n\r\nclass Modell(Resource):\r\n\r\n\r\n def get(self,... | false |
9,579 | d806d1b31712e3d8d60f4bfbc60c6939dfeeb357 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 16 20:47:28 2019
@author: jaco
"""
| [
"#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Dec 16 20:47:28 2019\n\n@author: jaco\n\"\"\"\n\n",
"<docstring token>\n"
] | false |
9,580 | ccf3ada9a2bedf29820170f2e8184fc16f1b7aea | #
# @lc app=leetcode.cn id=15 lang=python3
#
# [15] 三数之和
#
# https://leetcode-cn.com/problems/3sum/description/
#
# algorithms
# Medium (25.76%)
# Likes: 1904
# Dislikes: 0
# Total Accepted: 176.6K
# Total Submissions: 679K
# Testcase Example: '[-1,0,1,2,-1,-4]'
#
# 给你一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,... | [
"#\n# @lc app=leetcode.cn id=15 lang=python3\n#\n# [15] 三数之和\n#\n# https://leetcode-cn.com/problems/3sum/description/\n#\n# algorithms\n# Medium (25.76%)\n# Likes: 1904\n# Dislikes: 0\n# Total Accepted: 176.6K\n# Total Submissions: 679K\n# Testcase Example: '[-1,0,1,2,-1,-4]'\n#\n# 给你一个包含 n 个整数的数组 nums,判断 nu... | false |
9,581 | a22bc3bdb5e35060eff7f523b90d605ff2dd3878 | import requests
import datetime
import time
from tqdm import tqdm
import json
import logging
logging.basicConfig(filename='logo.log', level=logging.DEBUG, filemode='w')
logging.debug('debug message')
logging.info('info message')
# from pprint import pprint
id_vk = input('введите id пользователя вк: ')
token_vk = input... | [
"import requests\nimport datetime\nimport time\nfrom tqdm import tqdm\nimport json\nimport logging\nlogging.basicConfig(filename='logo.log', level=logging.DEBUG, filemode='w')\nlogging.debug('debug message')\nlogging.info('info message')\n\n# from pprint import pprint\nid_vk = input('введите id пользователя вк: ')\... | false |
9,582 | ea4ec2e605ab6e8734f7631fe298c93467908b5f | import json
import decimal
import threading
import websocket
from time import sleep
from supervisor.core.utils.math import to_nearest
def find_item_by_keys(keys, table, match_data):
for item in table:
matched = True
for key in keys:
if item[key] != match_data[key]:
matc... | [
"import json\nimport decimal\nimport threading\nimport websocket\nfrom time import sleep\nfrom supervisor.core.utils.math import to_nearest\n\n\ndef find_item_by_keys(keys, table, match_data):\n for item in table:\n matched = True\n for key in keys:\n if item[key] != match_data[key]:\n ... | false |
9,583 | c7037b6a576374f211580b304f8447349bbbbea3 | #!/usr/bin/python
# -*- coding: latin-1 -*-
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html', titre="Ludovic DELSOL - Portfolio")
@app.route('/etude')
def etude():
return render_template('etude.html', titre="Portfolio Ludovic DEL... | [
"#!/usr/bin/python\n# -*- coding: latin-1 -*-\nfrom flask import Flask, render_template\n\napp = Flask(__name__)\n\n\n@app.route('/')\ndef index():\n return render_template('index.html', titre=\"Ludovic DELSOL - Portfolio\")\n\n@app.route('/etude')\ndef etude():\n return render_template('etude.html', titre=\"... | false |
9,584 | 7f7d087b7001cd7df01d4f22e056809be5a35568 | # 使用celery
from django.conf import settings
from django.core.mail import send_mail
from django.template import loader,RequestContext
from celery import Celery
import time
# 在任务处理者一
#
# 端加的代码
import os
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dailyfresh.settings")
django.setup()
from goods.models ... | [
"# 使用celery\nfrom django.conf import settings\nfrom django.core.mail import send_mail\nfrom django.template import loader,RequestContext\nfrom celery import Celery\nimport time\n# 在任务处理者一\n#\n# 端加的代码\nimport os\nimport django\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"dailyfresh.settings\")\ndjango.setup(... | false |
9,585 | 40a73ceeeb310c490fe2467511966679a1afa92b | #usage: exploit.py
print "-----------------------------------------------------------------------"
print ' [PoC 2] MS Visual Basic Enterprise Ed. 6 SP6 ".dsr" File Handling BoF\n'
print " author: shinnai"
print " mail: shinnai[at]autistici[dot]org"
print " site: http://shinnai.altervista.org\n"
print " Once you create... | [
"#usage: exploit.py\n\nprint \"-----------------------------------------------------------------------\"\nprint ' [PoC 2] MS Visual Basic Enterprise Ed. 6 SP6 \".dsr\" File Handling BoF\\n'\nprint \" author: shinnai\"\nprint \" mail: shinnai[at]autistici[dot]org\"\nprint \" site: http://shinnai.altervista.org\\n\"\... | true |
9,586 | f5542cfe6827c352cc6e6da1147e727f2b2d8247 | import pandas as pd
import numpy
dato=pd.read_csv('medallero_Panamericanos_Lima2019.csv')
print(dato)
def calculo_suma():
print("---Funcion con Python---")
print("la sumatoria de los valores: ", dato['Bronce'].sum())
print("---Funcion con Numpy---")
print("la sumatoria de los valores: ", numpy.sum(dat... | [
"import pandas as pd\nimport numpy\n\ndato=pd.read_csv('medallero_Panamericanos_Lima2019.csv')\nprint(dato)\n\ndef calculo_suma():\n print(\"---Funcion con Python---\")\n print(\"la sumatoria de los valores: \", dato['Bronce'].sum())\n print(\"---Funcion con Numpy---\")\n print(\"la sumatoria de los val... | false |
9,587 | eea962d6c519bee802c346fcf8d0c7410e00c30b | h = int(input())
a = int(input())
b = int(input())
c = (h - b + a - b - 1) // (a - b)
print(int(c))
| [
"h = int(input())\na = int(input())\nb = int(input())\nc = (h - b + a - b - 1) // (a - b)\nprint(int(c))\n",
"<assignment token>\nprint(int(c))\n",
"<assignment token>\n<code token>\n"
] | false |
9,588 | 11ca13aca699b1e0744243645b3dbcbb0dacdb7e | import random as rnd
import pandas as pd
from sklearn.metrics import accuracy_score
from sklearn.metrics import f1_score
from sklearn.metrics import roc_auc_score
from sklearn.metrics import confusion_matrix
from sklearn.metrics import precision_recall_fscore_support, roc_auc_score
import os
def mkdir_tree(source):
... | [
"import random as rnd\n\nimport pandas as pd\nfrom sklearn.metrics import accuracy_score\nfrom sklearn.metrics import f1_score\nfrom sklearn.metrics import roc_auc_score\nfrom sklearn.metrics import confusion_matrix\nfrom sklearn.metrics import precision_recall_fscore_support, roc_auc_score\nimport os\n\ndef mkdir_... | false |
9,589 | 8a3cf65550893367b9001369111fa19a3e998d82 | import oneflow as flow
import torch
def convert_torch_to_flow(model, torch_weight_path, save_path):
parameters = torch.load(torch_weight_path)
new_parameters = dict()
for key, value in parameters.items():
if "num_batches_tracked" not in key:
val = value.detach().cpu().numpy()
ne... | [
"import oneflow as flow\nimport torch\n\ndef convert_torch_to_flow(model, torch_weight_path, save_path):\n parameters = torch.load(torch_weight_path)\n new_parameters = dict()\n for key, value in parameters.items():\n if \"num_batches_tracked\" not in key:\n val = value.detach().cpu().numpy... | false |
9,590 | c41388043295280f9354e661a8d38ae46cae2d65 | #for declaring the variables used in program
img_rows=200
img_cols=200
img_channels=1
nb_classes=3
nb_test_images=1
| [
"#for declaring the variables used in program\nimg_rows=200\nimg_cols=200\nimg_channels=1\nnb_classes=3\nnb_test_images=1\n",
"img_rows = 200\nimg_cols = 200\nimg_channels = 1\nnb_classes = 3\nnb_test_images = 1\n",
"<assignment token>\n"
] | false |
9,591 | 1d817ee09705301b574c421a9ff716748c146fdd | import pandas as pd
import re
import sqlite3 as lite
import os
from pybedtools import BedTool
import django
from checkprimers import CheckPrimers
from pandas import ExcelWriter
import datetime
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
django.setup()
class GetPrimers(object):
"""Extracts data from e... | [
"import pandas as pd\nimport re\nimport sqlite3 as lite\nimport os\nfrom pybedtools import BedTool\nimport django\nfrom checkprimers import CheckPrimers\nfrom pandas import ExcelWriter\nimport datetime\nos.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'\ndjango.setup()\n\n\nclass GetPrimers(object):\n \"\"... | true |
9,592 | 576d6bec4a91ba6f0597b76a5da5ad3ef6562b19 | import numpy as np
#!pip install pygame
import pygame
#from copy import deepcopy
pygame.init()
#-----------
# Modifications (Matthieu, 15/04):
# Modification de la représentation du terrain du jeu. Il est maintenant représenté par une seule liste.
# un seul identifiant par coupe semble plus simple à gérer qu'un... | [
"import numpy as np\r\n#!pip install pygame\r\nimport pygame\r\n#from copy import deepcopy\r\npygame.init()\r\n#-----------\r\n# Modifications (Matthieu, 15/04):\r\n# Modification de la représentation du terrain du jeu. Il est maintenant représenté par une seule liste.\r\n# un seul identifiant par coupe semble plus... | false |
9,593 | 8b009451e9f65ef12e5db1321a9d5347ef7fd756 | # aylat
# This program will calculate an individual's body mass index (BMI),
# based on their height and their weight
# Prompt user to input information
Name = input('Enter your full name: ')
Weight = float(input('Enter your weight in pounds: '))
Height = float(input('Enter your height in inches: '))
# Perform BMI ... | [
"# aylat\n\n# This program will calculate an individual's body mass index (BMI), \n# based on their height and their weight\n\n# Prompt user to input information\nName = input('Enter your full name: ')\nWeight = float(input('Enter your weight in pounds: '))\nHeight = float(input('Enter your height in inches: '))\n\... | false |
9,594 | 3c03f71ef9de8825ecd7c89208c79f43c9fb7a56 | """
Python Challenge - Level 1 - What about making trans?
"""
import string
#import requests
#res = requests.get('http://www.pythonchallenge.com/pc/def/map.html')
#res.raise_for_status()
#print(res.text)
INPUT_TEXT = string.ascii_lowercase # abcdefghijklmnopqrstuvwxyz
OUTPUT_TEXT = INPUT_TEXT[2:]+INPUT_TEXT[:2... | [
"\"\"\"\nPython Challenge - Level 1 - What about making trans?\n\"\"\"\nimport string\n#import requests\n#res = requests.get('http://www.pythonchallenge.com/pc/def/map.html')\n#res.raise_for_status()\n#print(res.text)\n\nINPUT_TEXT = string.ascii_lowercase # abcdefghijklmnopqrstuvwxyz\nOUTPUT_TEXT = INPUT_T... | false |
9,595 | 4f674b30c919c7ec72c11a8edd9692c91da7cb90 | import json
import spotipy
import spotipy.util as util
from spotipy.oauth2 import SpotifyClientCredentials
from flask import abort, Flask, flash, redirect, render_template, request, session
from flask_session import Session
from tempfile import mkdtemp
from helpers import login_required
# Configure application
app = ... | [
"import json\nimport spotipy\nimport spotipy.util as util\nfrom spotipy.oauth2 import SpotifyClientCredentials\nfrom flask import abort, Flask, flash, redirect, render_template, request, session\nfrom flask_session import Session\nfrom tempfile import mkdtemp\n\nfrom helpers import login_required\n\n# Configure app... | false |
9,596 | 367c3b4da38623e78f2853f9d3464a414ad049c2 | '''
Utility functions to do get frequencies of n-grams
Author: Jesus I. Ramirez Franco
December 2018
'''
import nltk
import pandas as pd
from nltk.stem.snowball import SnowballStemmer
from pycorenlp import StanfordCoreNLP
import math
from nltk.tokenize import RegexpTokenizer
from nltk.corpus import stopwords
import st... | [
"'''\nUtility functions to do get frequencies of n-grams\n\nAuthor: Jesus I. Ramirez Franco\nDecember 2018\n'''\nimport nltk\nimport pandas as pd\nfrom nltk.stem.snowball import SnowballStemmer\nfrom pycorenlp import StanfordCoreNLP\nimport math\nfrom nltk.tokenize import RegexpTokenizer\nfrom nltk.corpus import st... | false |
9,597 | 164167590051fac3f3fd80c5ed82621ba55c4cc4 | from arnold import config
class TestMicrophone:
def setup_method(self, method):
self.config = config.SENSOR['microphone']
def test_config(self):
required_config = [
'card_number', 'device_index', 'sample_rate', 'phrase_time_limit',
'energy_threshold'
]
... | [
"from arnold import config\n\n\nclass TestMicrophone:\n\n def setup_method(self, method):\n self.config = config.SENSOR['microphone']\n\n def test_config(self):\n required_config = [\n 'card_number', 'device_index', 'sample_rate', 'phrase_time_limit',\n 'energy_threshold'\n... | false |
9,598 | b694c834555843cc31617c944fa873f15be2b9c5 | #
# This source file is part of the EdgeDB open source project.
#
# Copyright 2016-present MagicStack Inc. and the EdgeDB authors.
#
# 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... | [
"#\n# This source file is part of the EdgeDB open source project.\n#\n# Copyright 2016-present MagicStack Inc. and the EdgeDB authors.\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 a... | false |
9,599 | 07854dc9e0a863834b8e671d29d5f407cdd1c13e | import requests
import datetime
from yahoo_finance import Share
def getYahooStock(ticker, date1, date2):
companyData = Share(ticker)
dataList = companyData.get_historical(date1, date2)
endData = dataList[0];
startData = dataList[len(dataList) - 1];
print ticker, float(startData['Open']), float(endD... | [
"import requests\nimport datetime\nfrom yahoo_finance import Share\n\ndef getYahooStock(ticker, date1, date2):\n companyData = Share(ticker)\n dataList = companyData.get_historical(date1, date2)\n endData = dataList[0];\n startData = dataList[len(dataList) - 1];\n print ticker, float(startData['Open'... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.