index int64 0 100k | blob_id stringlengths 40 40 | code stringlengths 7 7.27M | steps listlengths 1 1.25k | error bool 2
classes |
|---|---|---|---|---|
4,500 | b3bace532f687edc966c6aef5f454bde9367204f | from sys import exit
# Outside
def outside():
print """
Oyoiyoi ... The train isn't running due to the HVV being complete crap.
Well, the Rewe around the corner is still open
and there's a HSV bar around the corner.
You want to get your drank on, right now!
Where do you go?
"""
choice =... | [
"from sys import exit\n\n# Outside\ndef outside():\n print \"\"\"\n Oyoiyoi ... The train isn't running due to the HVV being complete crap.\n Well, the Rewe around the corner is still open\n and there's a HSV bar around the corner.\n You want to get your drank on, right now!\n Where do you go?\n ... | true |
4,501 | a9a067ee3b176d2f2ca558b69ce2bc598bb31d22 | from celery.task.schedules import crontab
from celery.decorators import periodic_task
from celery.utils.log import get_task_logger
from bbapp.scripts.getScores import doScoresScrape, fixScores
logger = get_task_logger(__name__)
@periodic_task(
run_every=(crontab(minute='*/10')),
name="scrape_espn_feed",
... | [
"from celery.task.schedules import crontab\nfrom celery.decorators import periodic_task\nfrom celery.utils.log import get_task_logger\n\n\nfrom bbapp.scripts.getScores import doScoresScrape, fixScores\n\nlogger = get_task_logger(__name__)\n\n\n@periodic_task(\n run_every=(crontab(minute='*/10')),\n name=\"scr... | false |
4,502 | da19bc4fc999bd48a3d55b8cb5f47ba6208bc02b | # Duy B. Lam
# 61502602
# Project 3
# A module that reads the input and constructs the objects
# that will generate the program's output. This is the only
# module that should have an if __name__ == '__main__' block
# to make it executable; you would execute this module to run your program.
import Module1
... | [
"# Duy B. Lam\r\n# 61502602\r\n# Project 3\r\n\r\n# A module that reads the input and constructs the objects\r\n# that will generate the program's output. This is the only\r\n# module that should have an if __name__ == '__main__' block\r\n# to make it executable; you would execute this module to run your program.\r... | false |
4,503 | 58fb2676b599b5f7fb9041cfae113a9d428d8ef8 | #Horror_Novel_Generator.py
import markovify as mk
import random as rng
from fpdf import FPDF
def makePDF(filename):
#Get text, separating title and paragraphs
#Assumes first line is title
file= open(filename, "r")
title= file.readline()
pars= []
for line in file:
pars.append... | [
"#Horror_Novel_Generator.py\r\nimport markovify as mk\r\nimport random as rng\r\nfrom fpdf import FPDF\r\n\r\ndef makePDF(filename):\r\n #Get text, separating title and paragraphs\r\n #Assumes first line is title\r\n file= open(filename, \"r\")\r\n title= file.readline()\r\n pars= []\r\n for line ... | false |
4,504 | d13957c3d3f4d34279dc660d80ca91ca84ba4a77 | # As variáveis abaixo estão recebendo uma função anônima
contador_letras = lambda lista: [len(x) for x in lista]
lista_animais = ['cachorro', 'pato', 'marreco']
print(contador_letras(lista_animais))
| [
"# As variáveis abaixo estão recebendo uma função anônima\ncontador_letras = lambda lista: [len(x) for x in lista]\n\nlista_animais = ['cachorro', 'pato', 'marreco']\nprint(contador_letras(lista_animais))\n",
"contador_letras = lambda lista: [len(x) for x in lista]\nlista_animais = ['cachorro', 'pato', 'marreco']... | false |
4,505 | 3343844bf49cb3f4d655613475e44a140ac3106d | from django.db import models
# Create your models here.
STATUS_CHOICES=(
('Pending','Pending'),
('Completed','Completed'))
class Appointment(models.Model):
first_name=models.CharField(max_length=100)
last_name=models.CharField(max_length=100)
phone_number=models.CharField(max_length=12,null=False... | [
"from django.db import models\n\n# Create your models here.\n\nSTATUS_CHOICES=(\n ('Pending','Pending'),\n ('Completed','Completed'))\n\nclass Appointment(models.Model):\n first_name=models.CharField(max_length=100)\n last_name=models.CharField(max_length=100)\n phone_number=models.CharField(max_leng... | false |
4,506 | f47e4d6ff079b6ac2320467d87b34ae82face032 | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class SearchConfig(AppConfig):
name = 'search'
verbose_name = _("Search")
| [
"from django.apps import AppConfig\r\nfrom django.utils.translation import gettext_lazy as _\r\n\r\nclass SearchConfig(AppConfig):\r\n name = 'search'\r\n verbose_name = _(\"Search\")\r\n",
"from django.apps import AppConfig\nfrom django.utils.translation import gettext_lazy as _\n\n\nclass SearchConfig(App... | false |
4,507 | 9e9403ea1c128e07803d080b337003055759c5ae | # project/tests/test_tmdb.py
import unittest
import json
from project.server import db
from project.server.models import Tmdb
from project.tests.base import BaseTestCase
class TestTmdb(BaseTestCase):
"""
Testing if we have the good responses from the api
"""
def test_discover(self):
""" Tes... | [
"# project/tests/test_tmdb.py\n\n\nimport unittest\nimport json\n\nfrom project.server import db\nfrom project.server.models import Tmdb\nfrom project.tests.base import BaseTestCase\n\n\nclass TestTmdb(BaseTestCase):\n \"\"\"\n Testing if we have the good responses from the api\n \"\"\"\n def test_disco... | false |
4,508 | 851cfd4e71ffd2d5fed33616abca4444474669a3 | def four_Ow_four(error):
'''
method to render the 404 error page
'''
return render_template('fourOwfour.html'),404 | [
"def four_Ow_four(error):\n '''\n method to render the 404 error page\n '''\n return render_template('fourOwfour.html'),404",
"def four_Ow_four(error):\n \"\"\"\n method to render the 404 error page\n \"\"\"\n return render_template('fourOwfour.html'), 404\n",
"<function token>\n"
] | false |
4,509 | 2c89f12d633da8da4d500dca910662d351b0958f | #!/usr/bin/python
# -*- coding:utf-8 -*-
################################################################
# 服务器程序
################################################################
import json
import time
import traceback
from flask import Flask, abort, render_template, redirect, send_from_directory, request, make_respon... | [
"#!/usr/bin/python\n# -*- coding:utf-8 -*-\n################################################################\n# 服务器程序\n################################################################\nimport json\nimport time\nimport traceback\nfrom flask import Flask, abort, render_template, redirect, send_from_directory, request... | true |
4,510 | e1c68c7eb899718dd1c28dc6e95d5538c2b8ad74 | import copy
import math
import operator
import numpy as np, pprint
def turn_left(action):
switcher = {
(-1, 0): (0, -1),
(0, 1): (-1, 0),
(1, 0): (0, 1),
(0, -1): (1, 0)
}
return switcher.get(action)
def turn_right(action):
switcher = {
(-1, 0): (0, 1),
... | [
"import copy\nimport math\nimport operator\n\nimport numpy as np, pprint\n\n\ndef turn_left(action):\n switcher = {\n (-1, 0): (0, -1),\n (0, 1): (-1, 0),\n (1, 0): (0, 1),\n (0, -1): (1, 0)\n\n }\n return switcher.get(action)\n\n\ndef turn_right(action):\n switcher = {\n ... | true |
4,511 | 00260e23614a7b0a11ff3649e71392e4892de423 | class Node:
def __init__(self, dataVal=None):
self.dataVal = dataVal
self.nextVal = None
class LinkedList:
def __init__(self):
self.headVal = None
def atBeginning(self, data):
NewNode = Node(data)
NewNode.nextVal = self.headVal
self.headVal = NewNode
... | [
"class Node:\n def __init__(self, dataVal=None):\n self.dataVal = dataVal\n self.nextVal = None\n\nclass LinkedList:\n def __init__(self):\n self.headVal = None\n def atBeginning(self, data):\n NewNode = Node(data)\n NewNode.nextVal = self.headVal\n self.headVal = ... | false |
4,512 | bf60e34190f4c453c85baaf2fbbff027fb77b7c8 | import os
import sendgrid
class Mail:
def __init__(self, to, subject, msg):
self.to = to
self.subject = subject
self.msg = msg
def send(self):
sg = sendgrid.SendGridClient(os.environ.get('SENDGRID_KEY', ''))
message = sendgrid.Mail()
message.add_to(self.to)
... | [
"import os\nimport sendgrid\n\n\nclass Mail:\n def __init__(self, to, subject, msg):\n self.to = to\n self.subject = subject\n self.msg = msg\n\n def send(self):\n sg = sendgrid.SendGridClient(os.environ.get('SENDGRID_KEY', ''))\n message = sendgrid.Mail()\n message.a... | true |
4,513 | d5c6582547df540ffc9c73d10a3405ec97487bba | #!/usr/bin/env python
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import subprocess
import sys
import os
def main():
parser = argparse.ArgumentParser(
description='Create the s... | [
"#!/usr/bin/env python\n# Copyright 2013 The Flutter Authors. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# found in the LICENSE file.\n\nimport argparse\nimport subprocess\nimport sys\nimport os\n\n\ndef main():\n parser = argparse.ArgumentParser(\n descrip... | false |
4,514 | bf1d54015a9ae529f4fda4fa9b9f7c874ec3b240 | #!/usr/bin/python
import serial
import time
import sys
senderId="\x01"
receiverId="\x00"
#openSerial just opens the serial connection
def openSerial(port):
#Some configuration for the serial port
ser = serial.Serial()
ser.baudrate = 300
ser.port = port
ser.bytesize = 8
ser.stopbits = 2
ser.open()
return ser
... | [
"#!/usr/bin/python\n\nimport serial\nimport time\nimport sys\n\nsenderId=\"\\x01\"\nreceiverId=\"\\x00\"\n\n#openSerial just opens the serial connection\ndef openSerial(port):\n\t#Some configuration for the serial port\n\tser = serial.Serial()\n\tser.baudrate = 300\n\tser.port = port\n\tser.bytesize = 8\n\tser.stop... | true |
4,515 | fe1d47b63e88935f8b2eb4bac883f3028d6f560b | from flask import render_template, request, redirect, url_for
from flask_login import current_user
from application import app, db, login_required
from application.auth.models import User
from application.memes.models import Meme
from application.comments.forms import CommentForm
# only a dummy new comment form
@app... | [
"from flask import render_template, request, redirect, url_for\nfrom flask_login import current_user\n\nfrom application import app, db, login_required\nfrom application.auth.models import User\nfrom application.memes.models import Meme\nfrom application.comments.forms import CommentForm\n\n# only a dummy new comme... | false |
4,516 | 1ff2f06349ab1906a1649bdb83828fbdb3cf584f | #!/usr/bin/env python
# coding: utf-8
#%%:
import secrets
import hashlib
import base64
import ecdsa
from sys import byteorder
#%%:
class k_box:
def __init__(self, string = 0, file = 0):
if string != 0:
if not(len(string) == 64):
raise Exception("Bad len")
self.__pr... | [
"#!/usr/bin/env python\n# coding: utf-8\n\n#%%:\nimport secrets\nimport hashlib\nimport base64\nimport ecdsa\nfrom sys import byteorder\n\n\n#%%:\nclass k_box:\n def __init__(self, string = 0, file = 0):\n if string != 0:\n if not(len(string) == 64):\n raise Exception(\"Bad len\"... | false |
4,517 | a2fc9d947c75eaaaeafcd92750c99f4cfcdb9d7d | # python3
from random import randint
def partition3(array, left, right):
pivot = array[right]
begin = left - 1
end = left - 1
for j in range(left, right):
if array[j] < pivot:
begin += 1
array[begin], array[j] = array[j], array[begin]
end += 1
i... | [
"# python3\n\nfrom random import randint\n\n\ndef partition3(array, left, right):\n pivot = array[right]\n begin = left - 1\n end = left - 1\n for j in range(left, right):\n if array[j] < pivot:\n begin += 1\n array[begin], array[j] = array[j], array[begin]\n end ... | false |
4,518 | 32e3eed2e279706bca2925d3d9d897a928243b4c | class Handlers():
change_store = "/change_store"
change_status = "/change_status"
mail = "/mail"
get_status = "/get_status"
create_order = "/create_order"
ask_store = "/ask_store"
check = "/check"
test = "/test"
| [
"class Handlers():\n change_store = \"/change_store\"\n change_status = \"/change_status\"\n mail = \"/mail\"\n get_status = \"/get_status\"\n create_order = \"/create_order\"\n ask_store = \"/ask_store\"\n check = \"/check\"\n test = \"/test\"\n",
"class Handlers:\n change_store = '/ch... | false |
4,519 | 71a0900dc09b1ff55e4e5a4cc7cab617b9c73406 | from django.shortcuts import render, get_object_or_404
# Create your views here.
from django.http import HttpResponse
from .models import Post
from django.utils import timezone
def list_of_posts(request):
posts = (Post.objects
.filter(published_date__lte=timezone.now())
.order_b... | [
"from django.shortcuts import render, get_object_or_404\n\n# Create your views here.\n\nfrom django.http import HttpResponse\nfrom .models import Post\nfrom django.utils import timezone\n\ndef list_of_posts(request):\n posts = (Post.objects\n .filter(published_date__lte=timezone.now())\n ... | false |
4,520 | c55b6fed92a5f4f2961c6f8d5b150b22a5f622e8 | import datetime
import time
import requests
from config import url
from data import DistrictList
import random
import pymysql
def base_url():
default_request = {
'base_url': url,
'headers': {
"Content-Type": "application/json;charset=UTF-8"}
}
return default_request['base_url'... | [
"import datetime\nimport time\n\nimport requests\n\nfrom config import url\nfrom data import DistrictList\nimport random\nimport pymysql\n\ndef base_url():\n default_request = {\n 'base_url': url,\n 'headers': {\n \"Content-Type\": \"application/json;charset=UTF-8\"}\n }\n return d... | false |
4,521 | 9dead39e41fd0f3cff43501c659050885a50fec3 | try:
a=100
b=a/0
print(b)
except ZeroDivisionError as z:
print("Error= ",z) | [
"try:\r\n a=100\r\n b=a/0\r\n print(b)\r\nexcept ZeroDivisionError as z:\r\n print(\"Error= \",z)",
"try:\n a = 100\n b = a / 0\n print(b)\nexcept ZeroDivisionError as z:\n print('Error= ', z)\n",
"<code token>\n"
] | false |
4,522 | 79f03af05fb40f5f5247b582eabae2dc125e6b52 | # THIS FILE WAS CREATED IN THIS DIRECTORY EARLIER, NOW MOIVED TO ROOT OF THE REPO
print "Hello buddy"
print "Let's get started"
spy_name = raw_input ("What is your spy name? ")
if len(spy_name) >3:
print "Welcome " + spy_name + ". Glad to have you with us."
spy_salutation= raw_input("What's your titl... | [
"# THIS FILE WAS CREATED IN THIS DIRECTORY EARLIER, NOW MOIVED TO ROOT OF THE REPO\r\n\r\n\r\nprint \"Hello buddy\"\r\nprint \"Let's get started\"\r\nspy_name = raw_input (\"What is your spy name? \")\r\nif len(spy_name) >3:\r\n print \"Welcome \" + spy_name + \". Glad to have you with us.\"\r\n spy_salutati... | true |
4,523 | 6f13ebe7355d530ba3403aab54b313ecf35b1261 | import turtle
import random
shaan = turtle.Turtle()
#shaan.color(50,50,50)
#shaan.begin_fill()
for i in range (2):
shaan.forward(200)
shaan.right(90)
shaan.forward(250)
shaan.right(90)
shaan.left(60)
for i in range(4):
shaan.forward(200)
shaan.right(120)
shaan.forward(100)
shaan.left(150)
shaan.forward(100)... | [
"import turtle\nimport random\n\nshaan = turtle.Turtle()\n\n#shaan.color(50,50,50)\n\n#shaan.begin_fill()\nfor i in range (2):\n\tshaan.forward(200)\n\tshaan.right(90)\n\tshaan.forward(250)\n\tshaan.right(90)\n\nshaan.left(60)\n\nfor i in range(4):\n\tshaan.forward(200)\n\tshaan.right(120)\n\nshaan.forward(100)\nsh... | false |
4,524 | fb332808890e369d1439d1dba61244a0f7b89301 | #!/usr/bin/env python
import rospy
from racecar_control.msg import drive_param
import curses
forward = 0;
left = 0;
stdscr = curses.initscr()
curses.cbreak()
stdscr.keypad(1)
rospy.init_node('keyop', anonymous=True)
pub = rospy.Publisher('drive_parameters', drive_param, queue_size=10)
stdscr.refresh()
key = ''
... | [
"#!/usr/bin/env python\n\nimport rospy\nfrom racecar_control.msg import drive_param\nimport curses\n\nforward = 0;\nleft = 0;\n\n\nstdscr = curses.initscr()\ncurses.cbreak()\nstdscr.keypad(1)\nrospy.init_node('keyop', anonymous=True)\n\npub = rospy.Publisher('drive_parameters', drive_param, queue_size=10)\n\n\nstds... | false |
4,525 | 8e3f23733235d73fab14e80ee0a3706ae351c7a2 | vozrast=int(input("сколько вам лет?"))
print ("через 10 лет вам бóдет", vozrast+10) | [
"vozrast=int(input(\"сколько вам лет?\"))\nprint (\"через 10 лет вам бóдет\", vozrast+10)",
"vozrast = int(input('сколько вам лет?'))\nprint('через 10 лет вам бóдет', vozrast + 10)\n",
"<assignment token>\nprint('через 10 лет вам бóдет', vozrast + 10)\n",
"<assignment token>\n<code token>\n"
] | false |
4,526 | 7ba2377b7d4f8d127cfee63c856d20753da9b7c6 | import requests
from datetime import datetime, timedelta
from . import base
class YoutubeVerifier(base.SimpleVerifier):
def __init__(self, channel_id, access_token):
self.channel_id = channel_id
self.access_token = access_token
self.headers = {
'Authorization': 'Bearer {}'.fo... | [
"import requests\n\nfrom datetime import datetime, timedelta\n\nfrom . import base\n\n\nclass YoutubeVerifier(base.SimpleVerifier):\n def __init__(self, channel_id, access_token):\n self.channel_id = channel_id\n self.access_token = access_token\n self.headers = {\n 'Authorization... | false |
4,527 | 26ac0c94d0ab70d90854ca2c913ef0f633b54a3c | #!/usr/bin/env python
import rospy
import cv2
from geometry_msgs.msg import PoseStamped
class PositionReader:
def __init__(self):
self.image_sub = rospy.Subscriber(
"/visp_auto_tracker/object_position", PoseStamped, self.callback)
self.pub = rospy.Publisher('object_position', PoseSta... | [
"#!/usr/bin/env python\n\nimport rospy\nimport cv2\nfrom geometry_msgs.msg import PoseStamped\n\n\nclass PositionReader:\n\n def __init__(self):\n self.image_sub = rospy.Subscriber(\n \"/visp_auto_tracker/object_position\", PoseStamped, self.callback)\n self.pub = rospy.Publisher('object... | false |
4,528 | 173e6017884a1a4df64018b306ea71bcaa1c5f1d | #!flask/bin/python
from config import SQLALCHEMY_DATABASE_URI
from app.models import Patient, Appointment, PhoneCalls
from app import db
import os.path
db.create_all()
# Patient.generate_fake();
# Appointment.generate_fake();
# PhoneCalls.generate_fake();
Patient.add_patient();
Appointment.add_appointment();
PhoneCal... | [
"#!flask/bin/python\nfrom config import SQLALCHEMY_DATABASE_URI\nfrom app.models import Patient, Appointment, PhoneCalls\nfrom app import db\nimport os.path\ndb.create_all()\n\n# Patient.generate_fake();\n# Appointment.generate_fake();\n# PhoneCalls.generate_fake();\n\nPatient.add_patient();\nAppointment.add_appoin... | false |
4,529 | 5f77e93d63c696363c30f019019acd22c694308b | from datetime import date
from django.test import TestCase
from model_mommy import mommy
from apps.debtors.models import Debtor
from apps.invoices.models import Invoice, InvoiceStatusChoices
from apps.invoices.services import InvoiceService
class InvoiceServiceTestCase(TestCase):
def setUp(self) -> None:
... | [
"from datetime import date\nfrom django.test import TestCase\nfrom model_mommy import mommy\n\nfrom apps.debtors.models import Debtor\nfrom apps.invoices.models import Invoice, InvoiceStatusChoices\nfrom apps.invoices.services import InvoiceService\n\n\nclass InvoiceServiceTestCase(TestCase):\n def setUp(self) -... | false |
4,530 | 602df213c0d588404597c566001cd9c96b5034d0 | __author__ = 'laispace.com'
import sqlite3
dbname = 'alloyteam.db'
def createTable():
conn = sqlite3.connect(dbname)
c = conn.cursor()
c.execute('''CREATE TABLE IF NOT EXISTS posts
(url text primary key,
title text,
date text,
authorLink ... | [
"__author__ = 'laispace.com'\n\nimport sqlite3\n\ndbname = 'alloyteam.db'\n\ndef createTable():\n conn = sqlite3.connect(dbname)\n c = conn.cursor()\n c.execute('''CREATE TABLE IF NOT EXISTS posts\n (url text primary key,\n title text,\n date text,\n ... | false |
4,531 | 00b06b5e6465bae3eab336441b283a9831bb93c0 | a=int(raw_input())
if (a%2)==0:
print("Even")
else:
print("Odd")
| [
"a=int(raw_input())\nif (a%2)==0:\n\tprint(\"Even\")\nelse:\n\tprint(\"Odd\")\n",
"a = int(raw_input())\nif a % 2 == 0:\n print('Even')\nelse:\n print('Odd')\n",
"<assignment token>\nif a % 2 == 0:\n print('Even')\nelse:\n print('Odd')\n",
"<assignment token>\n<code token>\n"
] | false |
4,532 | fa09937ce64952795ae27cb91bf2c52dfb3ef4da | # Generated by Django 3.1.3 on 2020-11-18 13:26
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | [
"# Generated by Django 3.1.3 on 2020-11-18 13:26\n\nfrom django.conf import settings\nfrom django.db import migrations, models\nimport django.db.models.deletion\nimport django.utils.timezone\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n migrations.swappable_dependency(settings.AUTH_US... | false |
4,533 | 25dd7ea4a154e5693c65f8c42107224efee42516 | import pandas as pd
from fbprophet import Prophet
import os
from utils.json_utils import read_json, write_json
from sklearn.model_selection import train_test_split
import numpy as np
from sklearn.metrics import mean_absolute_error
root_dir = "/home/charan/Documents/workspaces/python_workspaces/Data/ADL_Project/"
final... | [
"import pandas as pd\nfrom fbprophet import Prophet\nimport os\nfrom utils.json_utils import read_json, write_json\nfrom sklearn.model_selection import train_test_split\nimport numpy as np\nfrom sklearn.metrics import mean_absolute_error\n\nroot_dir = \"/home/charan/Documents/workspaces/python_workspaces/Data/ADL_P... | false |
4,534 | 047b3398a73c9e7d75d43eeeab85f52c05ff90c3 | """
This file contains the ScoreLoop which is used to show
the user thw at most 10 highest scores made by the player
"""
import pygame
from score_fetcher import fetch_scores
from entities.sprite_text import TextSprite
class ScoreLoop:
def __init__(self):
self.scores = fetch_scores()
self.sprites... | [
"\"\"\"\nThis file contains the ScoreLoop which is used to show\nthe user thw at most 10 highest scores made by the player\n\"\"\"\nimport pygame\nfrom score_fetcher import fetch_scores\nfrom entities.sprite_text import TextSprite\n\n\nclass ScoreLoop:\n\n def __init__(self):\n\n self.scores = fetch_score... | false |
4,535 | 012d9b5aa13c557ad958343cadf935b73c808a56 | """
定义函数,根据年、月、日计算星期。
0 星期一
1 星期二
....
"""
import time
def get_week(year, month, day):
str_time = "%d-%d-%d" % (year, month, day)
time_tuple = time.strptime(str_time, "%Y-%m-%d")
tuple_week = ("星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日")
return tuple_week[time_tuple[6]]
... | [
"\"\"\"\n 定义函数,根据年、月、日计算星期。\n 0 星期一\n 1 星期二\n ....\n\"\"\"\nimport time\n\n\ndef get_week(year, month, day):\n str_time = \"%d-%d-%d\" % (year, month, day)\n time_tuple = time.strptime(str_time, \"%Y-%m-%d\")\n tuple_week = (\"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\", \"星期日\"... | false |
4,536 | 89ec04280ecfdfcba1923e2742e31d34750f894f | import falcon
import json
from sqlalchemy.exc import SQLAlchemyError
from db import session
import model
import util
class AchievementGrant(object):
def on_post(self, req, resp):
"""
Prideleni achievementu
Format dat:
{
"users": [ id ],
"task": (null|id),... | [
"import falcon\nimport json\nfrom sqlalchemy.exc import SQLAlchemyError\n\nfrom db import session\nimport model\nimport util\n\n\nclass AchievementGrant(object):\n\n def on_post(self, req, resp):\n \"\"\"\n Prideleni achievementu\n\n Format dat:\n {\n \"users\": [ id ],\n ... | false |
4,537 | 0356b408624988100c10b20facecef14f1552203 | import numpy as np
import pandas as pd
import nltk
from collections import defaultdict
import os.path
stop_words = ['i', 'me', 'my', 'myself', 'we', 'our', 'ours', 'ourselves', 'you', 'your', 'yours',
'yourself', 'yourselves', 'he', 'him', 'his', 'himself', 'she', 'her', 'hers',
'herself',... | [
"import numpy as np\nimport pandas as pd\nimport nltk\nfrom collections import defaultdict\nimport os.path\n\n\nstop_words = ['i', 'me', 'my', 'myself', 'we', 'our', 'ours', 'ourselves', 'you', 'your', 'yours',\n 'yourself', 'yourselves', 'he', 'him', 'his', 'himself', 'she', 'her', 'hers',\n ... | false |
4,538 | e3f180d4309ade39ac42a895f7f73469fd20724f | #coding=utf-8
from selenium import webdriver
from selenium.webdriver import ActionChains
# 常用鼠标操作
driver = webdriver.Chrome()
driver.get('https://www.baidu.com')
driver.maximize_window()
element = driver.find_element_by_link_text(u"新闻")
#˫ 双击 ‘新闻’ 这个超链接
ActionChains(driver).double_click(element).perform()
import time
... | [
"#coding=utf-8\nfrom selenium import webdriver\nfrom selenium.webdriver import ActionChains\n\n# 常用鼠标操作\ndriver = webdriver.Chrome()\ndriver.get('https://www.baidu.com')\ndriver.maximize_window()\nelement = driver.find_element_by_link_text(u\"新闻\")\n#˫ 双击 ‘新闻’ 这个超链接\nActionChains(driver).double_click(element).perfo... | false |
4,539 | d85c0929b22f57367c0e707bac78e56027113417 | import time
import numpy as np
from OpenGL.GLUT import *
from OpenGL.GLU import *
from OpenGL.GL import *
from utils import *
g = 9.8
t_start = 0
def init():
glClearColor(1.0, 1.0, 1.0, 1.0)
glClear(GL_COLOR_BUFFER_BIT)
glColor3f(1.0, 0.0, 0.0)
glPointSize(2)
gluOrtho2D(0.0, 500.0, 0.0, 500.0)
... | [
"import time\n\nimport numpy as np\nfrom OpenGL.GLUT import *\nfrom OpenGL.GLU import *\nfrom OpenGL.GL import *\nfrom utils import *\n\ng = 9.8\nt_start = 0\n\n\ndef init():\n glClearColor(1.0, 1.0, 1.0, 1.0)\n glClear(GL_COLOR_BUFFER_BIT)\n glColor3f(1.0, 0.0, 0.0)\n glPointSize(2)\n gluOrtho2D(0.0... | false |
4,540 | 139d06497a44031f6414980ad54454477e3d0b2c | import numpy as np
import matplotlib.pyplot as plt
import math
filename = '/home/kolan/mycode/python/dektak/data/t10_1_1_normal.csv'
#filename = '/home/kolan/mycode/python/dektak/t10_1_3_normal.csv'
#filename = '/home/kolan/mycode/python/dektak/t10_1_6_normal.csv'
#filename = '/home/kolan/mycode/python/dektak/t10_1_7... | [
"import numpy as np \nimport matplotlib.pyplot as plt\nimport math\n\nfilename = '/home/kolan/mycode/python/dektak/data/t10_1_1_normal.csv'\n#filename = '/home/kolan/mycode/python/dektak/t10_1_3_normal.csv'\n#filename = '/home/kolan/mycode/python/dektak/t10_1_6_normal.csv'\n#filename = '/home/kolan/mycode/python/de... | true |
4,541 | 67509ce426fd572b22d5059d98e5439e87cdc591 | '''
@author: Victor Barrera Burgos
Created on 09 Feb 2014
Description: This script permits the obtention of the
methylation profile of a CpGRegion indicating the
methylation status of each CpG dinucleotide.
Addition on 02 March 2014
Description: permits the obtention of the
methylation profile of the whole genome usi... | [
"'''\n@author: Victor Barrera Burgos\nCreated on 09 Feb 2014\nDescription: This script permits the obtention of the\nmethylation profile of a CpGRegion indicating the \nmethylation status of each CpG dinucleotide.\n\nAddition on 02 March 2014\nDescription: permits the obtention of the\nmethylation profile of the wh... | true |
4,542 | f7c6990b4ddbe5ef9d79ef2326e60cdf1f761db3 | #python -m marbles test_clean_rangos.py
import unittest
from marbles.mixins import mixins
import pandas as pd
import requests
from pyspark.sql import SparkSession
import psycopg2 as pg
import pandas as pd
from pyspark.sql.types import StructType, StructField, StringType
from src.features.build_features import get_clea... | [
"#python -m marbles test_clean_rangos.py\n\nimport unittest\nfrom marbles.mixins import mixins\nimport pandas as pd\nimport requests\nfrom pyspark.sql import SparkSession\nimport psycopg2 as pg\nimport pandas as pd\nfrom pyspark.sql.types import StructType, StructField, StringType\nfrom src.features.build_features ... | false |
4,543 | da2c615b8fab8de6bd63864508da254a46e65bb8 | import proactive
import unittest
import numbers
import os
import pytest
class RestApiTestSuite(unittest.TestCase):
"""Advanced test cases."""
gateway = None
username = ""
password = ""
@pytest.fixture(autouse=True)
def setup_gateway(self, metadata):
self.gateway = proactive.ProActive... | [
"import proactive\nimport unittest\nimport numbers\nimport os\nimport pytest\n\n\nclass RestApiTestSuite(unittest.TestCase):\n \"\"\"Advanced test cases.\"\"\"\n\n gateway = None\n username = \"\"\n password = \"\"\n\n @pytest.fixture(autouse=True)\n def setup_gateway(self, metadata):\n sel... | false |
4,544 | f86d01c4b980ac44dcdb1b0008493e1dbda25971 | from bacalhau.tei_document import TEIDocument
import nltk
import unittest
class TestDocument(unittest.TestCase):
def setUp(self):
self.filepath = 'tests/corpus/a.xml'
self.doc = TEIDocument(self.filepath,
nltk.tokenize.regexp.WordPunctTokenizer(),
nltk.corpus.stop... | [
"from bacalhau.tei_document import TEIDocument\nimport nltk\nimport unittest\n\n\nclass TestDocument(unittest.TestCase):\n\n def setUp(self):\n self.filepath = 'tests/corpus/a.xml'\n self.doc = TEIDocument(self.filepath, \n nltk.tokenize.regexp.WordPunctTokenizer(),\n ... | false |
4,545 | 8bd918896fb72c89a622ba4e18666bb90755cafd | import abc
import hashlib
import hmac
from typing import Any, Dict
from urllib.parse import urlencode
class IceCubedClientABC(abc.ABC):
@abc.abstractproperty
def _has_auth_details(self) -> bool:
pass
@abc.abstractmethod
def sign(self, params: Dict[str, Any]) -> str:
pass
class IceCu... | [
"import abc\nimport hashlib\nimport hmac\nfrom typing import Any, Dict\nfrom urllib.parse import urlencode\n\n\nclass IceCubedClientABC(abc.ABC):\n @abc.abstractproperty\n def _has_auth_details(self) -> bool:\n pass\n\n @abc.abstractmethod\n def sign(self, params: Dict[str, Any]) -> str:\n ... | false |
4,546 | 63360ec9693a916375b49d0881008b1d7d4ec953 | from function import *
from .propogation import optimize
from .initialize import initialize_with_zeros
def predict(weight, intercept, x_vector):
"""
Predict whether the label is 0 or 1 using learned logistic regression parameters (w, b)
Arguments:
w -- weights, a numpy array of size (num_px * num_px ... | [
"from function import *\nfrom .propogation import optimize\nfrom .initialize import initialize_with_zeros\n\n\ndef predict(weight, intercept, x_vector):\n \"\"\"\n Predict whether the label is 0 or 1 using learned logistic regression parameters (w, b)\n\n Arguments:\n w -- weights, a numpy array of size... | false |
4,547 | 897075810912e8360aa5cdedda3f12ce7c868263 | from PIL import Image, ImageStat
import os
import shutil
# full white photo - 255.0
# full black photo - 0.0
class ImageSelection:
def __init__(self, path):
self.path = path
def brightness_check(self, image):
'''count function to set value of brightness, 0 - full black, 100 - fu... | [
"from PIL import Image, ImageStat\r\nimport os\r\nimport shutil\r\n\r\n# full white photo - 255.0\r\n# full black photo - 0.0\r\n\r\n\r\nclass ImageSelection:\r\n def __init__(self, path):\r\n self.path = path\r\n\r\n def brightness_check(self, image):\r\n '''count function to set value of brigh... | false |
4,548 | 235fce2615e2a5879f455aac9bcecbc2d152679b | from collections import Counter
class Solution:
def countStudents(self, students, sandwiches) -> int:
if not students or not sandwiches:
return 0
while students:
top_san = sandwiches[0]
if top_san == students[0]:
students = students[1:]
... | [
"from collections import Counter\n\nclass Solution:\n def countStudents(self, students, sandwiches) -> int:\n if not students or not sandwiches:\n return 0\n\n while students:\n top_san = sandwiches[0]\n if top_san == students[0]:\n students = student... | false |
4,549 | 10c8316aee2107dc84ce7c1427dd62f52a2ce697 | import os
import numpy as np
import scipy as sp
import sys
from sure import that
from itertools import combinations, permutations
input_file = open('input1.txt', 'r')
output_file = open('output1.txt', 'w')
T = int(input_file.readline().rstrip('\n'))
case_num = 1
while case_num - 1 < T:
# Parse data
data = ma... | [
"import os\nimport numpy as np\nimport scipy as sp\nimport sys\nfrom sure import that\nfrom itertools import combinations, permutations\n\n\ninput_file = open('input1.txt', 'r')\noutput_file = open('output1.txt', 'w')\n\nT = int(input_file.readline().rstrip('\\n'))\ncase_num = 1\nwhile case_num - 1 < T:\n # Pars... | false |
4,550 | a8190c7c8926df18ee9439922ce8e3241e9a6140 | n=int(input("enter a number"))
cp=n
rev=0
sum=0
while(n>0):
rev=n%10
sum+=rev**3
n=n//10
if(cp==sum):
print("the given no is amstrong ")
else:
print("the given no is not amstrong ") | [
"n=int(input(\"enter a number\"))\ncp=n\nrev=0\nsum=0\nwhile(n>0):\n\trev=n%10\n\tsum+=rev**3\n\tn=n//10\nif(cp==sum):\n\tprint(\"the given no is amstrong \")\nelse:\n\tprint(\"the given no is not amstrong \")",
"n = int(input('enter a number'))\ncp = n\nrev = 0\nsum = 0\nwhile n > 0:\n rev = n % 10\n sum +... | false |
4,551 | a4b61a5a79e314e56ba25c6e2e735bd2ee4ef0d3 | # Generated by Django 2.2.3 on 2019-07-14 13:34
from django.db import migrations, models
def forwards_func(apps, schema_editor):
""" Add Theater Rooms """
TheaterRoom = apps.get_model("main", "TheaterRoom")
db_alias = schema_editor.connection.alias
TheaterRoom.objects.using(db_alias).bulk_create([
... | [
"# Generated by Django 2.2.3 on 2019-07-14 13:34\n\nfrom django.db import migrations, models\n\n\ndef forwards_func(apps, schema_editor):\n \"\"\" Add Theater Rooms \"\"\"\n TheaterRoom = apps.get_model(\"main\", \"TheaterRoom\")\n db_alias = schema_editor.connection.alias\n TheaterRoom.objects.using(db... | false |
4,552 | 3630f83e7e6a10f42e96f8bd6fa9714232d9176b | import os
import time
import pickle
from configparser import ConfigParser
from slackbot import bot
from slackbot.bot import Bot
from slackbot.bot import listen_to
from elasticsearch_dsl.connections import connections
from okcom_tokenizer.tokenizers import CCEmojiJieba, UniGram
from marginalbear_elastic.query import p... | [
"import os\nimport time\nimport pickle\nfrom configparser import ConfigParser\n\nfrom slackbot import bot\nfrom slackbot.bot import Bot\nfrom slackbot.bot import listen_to\nfrom elasticsearch_dsl.connections import connections\n\nfrom okcom_tokenizer.tokenizers import CCEmojiJieba, UniGram\nfrom marginalbear_elasti... | false |
4,553 | b1a808e76008edec02d37ec596461e3a00a1d349 | from flask_wtf import FlaskForm
from wtforms import StringField, DateField, DecimalField
class HoursForm(FlaskForm):
date = StringField("Date")
begins = DecimalField("Begins")
ends = DecimalField("Ends")
class Meta:
csrf = False
| [
"from flask_wtf import FlaskForm\nfrom wtforms import StringField, DateField, DecimalField\n\nclass HoursForm(FlaskForm):\n date = StringField(\"Date\")\n begins = DecimalField(\"Begins\")\n ends = DecimalField(\"Ends\")\n \n class Meta:\n csrf = False\n",
"from flask_wtf import FlaskForm\nfrom... | false |
4,554 | 6420d1b9da7ff205e1e138f72b194f63d1011012 | import unittest
from .context import *
class BasicTestSuite(unittest.TestCase):
"""Basic test cases."""
def test_hello_world(self):
self.assertEqual(hello_world(), 'hello world')
if __name__ == '__main__':
unittest.main()
| [
"import unittest\n\nfrom .context import *\n\nclass BasicTestSuite(unittest.TestCase):\n \"\"\"Basic test cases.\"\"\"\n\n def test_hello_world(self):\n self.assertEqual(hello_world(), 'hello world')\n\nif __name__ == '__main__':\n unittest.main()\n",
"import unittest\nfrom .context import *\n\n\n... | false |
4,555 | 13451352e8dcdfe64771f9fc188b13a31b8109f5 | import giraffe.configuration.common_testing_artifactrs as commons
from giraffe.business_logic.ingestion_manger import IngestionManager
from redis import Redis
def test_parse_redis_key(config_helper, ingestion_manager):
im = ingestion_manager
job_name = config_helper.nodes_ingestion_operation
operation = c... | [
"import giraffe.configuration.common_testing_artifactrs as commons\nfrom giraffe.business_logic.ingestion_manger import IngestionManager\nfrom redis import Redis\n\n\ndef test_parse_redis_key(config_helper, ingestion_manager):\n im = ingestion_manager\n job_name = config_helper.nodes_ingestion_operation\n ... | false |
4,556 | 7ac53779a98b6e4b236b1e81742163d2c610a274 | __author__ = 'samar'
import mv_details
import product
| [
"__author__ = 'samar'\nimport mv_details\nimport product\n",
"__author__ = 'samar'\n<import token>\n",
"<assignment token>\n<import token>\n"
] | false |
4,557 | 0457ac2ecd0a951b0088c887539ab696797d68bc | import os
from datetime import datetime, timedelta
from django.shortcuts import render
from django.utils.decorators import method_decorator
from rest_framework.viewsets import GenericViewSet, mixins
from common.jwt_util import generate_jwt
from .serializers import ApiUser, ApiUserSerializer, UserSerializer
f... | [
"import os\r\nfrom datetime import datetime, timedelta\r\n\r\nfrom django.shortcuts import render\r\nfrom django.utils.decorators import method_decorator\r\nfrom rest_framework.viewsets import GenericViewSet, mixins\r\n\r\nfrom common.jwt_util import generate_jwt\r\nfrom .serializers import ApiUser, ApiUserSerializ... | false |
4,558 | 4d05e65dce9f689ae533a57466bc75fa24db7b4d | from tkinter import *
import re
class Molecule:
def __init__(self, nom, poids, adn):
self.nom = nom
self.poids = poids
self.adn = adn
def __repr__(self):
return "{} : {} g".format(self.nom, self.poids)
class Menu:
def __init__(self):
self.data = dict()
se... | [
"from tkinter import *\nimport re\n\n\nclass Molecule:\n def __init__(self, nom, poids, adn):\n self.nom = nom\n self.poids = poids\n self.adn = adn\n\n def __repr__(self):\n return \"{} : {} g\".format(self.nom, self.poids)\n\n\nclass Menu:\n def __init__(self):\n self.d... | false |
4,559 | 8afce5b47c7c9c67a8be493f7f4de1510352b1c7 | from django.db import models
class TestModel(models.Model):
name = models.CharField(max_length=15)
surname = models.CharField(max_length=10)
age = models.IntegerField()
class Example(models.Model):
integer_field = models.IntegerField()
positive_field = models.PositiveIntegerField()
positive_... | [
"from django.db import models\n\n\nclass TestModel(models.Model):\n name = models.CharField(max_length=15)\n surname = models.CharField(max_length=10)\n age = models.IntegerField()\n\n\nclass Example(models.Model):\n integer_field = models.IntegerField()\n positive_field = models.PositiveIntegerField... | false |
4,560 | 9c653719ea511d78de9ddcc19442d9f9f7dc11dc | # -*- coding: utf-8 -*-
import pickle
import pathlib
from pathlib import Path
from typing import List, Tuple, Dict
import numpy as np
import torch
import torch.nn as nn
from torch.optim import SGD, Adam
from torch.utils.data import Dataset, DataLoader
from torchtext.data import get_tokenizer
from matplotlib import py... | [
"# -*- coding: utf-8 -*-\n\n\nimport pickle\nimport pathlib\nfrom pathlib import Path\nfrom typing import List, Tuple, Dict\nimport numpy as np\nimport torch\nimport torch.nn as nn\nfrom torch.optim import SGD, Adam\nfrom torch.utils.data import Dataset, DataLoader\nfrom torchtext.data import get_tokenizer\nfrom ma... | false |
4,561 | 0e2b4e8e8c5a728e5123dfa704007b0f6adaf1e1 | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
n=int(input("Enter the number of votes : "))
print()
p... | [
"from selenium import webdriver\r\nfrom selenium.webdriver.common.keys import Keys\r\nfrom selenium.webdriver.common.by import By \r\nfrom selenium.webdriver.support.ui import WebDriverWait \r\nfrom selenium.webdriver.support import expected_conditions as EC\r\nimport time\r\nn=int(input(\"Enter the number of votes... | false |
4,562 | 0abba9fdd98d6bb5c706b82a01a267dbcefbba28 | import re
APACHE_ACCESS_LOG_PATTERN = '^(\S+) (\S+) (\S+) \[([\w:/]+\s[+\-]\d{4})\] "(\S+) (\S+)\s*(\S*)" (\d{3}) (\S+)'
pattern = re.compile(APACHE_ACCESS_LOG_PATTERN)
print re.match('ix-sac6-20.ix.netcom.com - - [08/Aug/1995:14:43:39 -0400] "GET / HTTP/1.0 " 200 7131', 0)
| [
"import re\nAPACHE_ACCESS_LOG_PATTERN = '^(\\S+) (\\S+) (\\S+) \\[([\\w:/]+\\s[+\\-]\\d{4})\\] \"(\\S+) (\\S+)\\s*(\\S*)\" (\\d{3}) (\\S+)'\npattern = re.compile(APACHE_ACCESS_LOG_PATTERN)\nprint re.match('ix-sac6-20.ix.netcom.com - - [08/Aug/1995:14:43:39 -0400] \"GET / HTTP/1.0 \" 200 7131', 0)\n"
] | true |
4,563 | a2c62091b14929942b49853c4a30b851ede0004b | #!/usr/bin/env python3.4
from flask import Flask, render_template, request, jsonify
from time import time
application = Flask(__name__)
@application.route("/chutesnladders")
@application.route("/cnl")
@application.route("/snakesnladders")
@application.route("/snl")
def chutesnladders():
response = application.m... | [
"#!/usr/bin/env python3.4\n\nfrom flask import Flask, render_template, request, jsonify\nfrom time import time\n\napplication = Flask(__name__)\n\n\n@application.route(\"/chutesnladders\")\n@application.route(\"/cnl\")\n@application.route(\"/snakesnladders\")\n@application.route(\"/snl\")\ndef chutesnladders():\n ... | false |
4,564 | e3afaabc1f7f64b9189fc88dd478ed75e81f35e1 | import json
import sys
from os import listdir
from os.path import isfile, join
import params
def encodeText(tweet_text):
tweet_text = tweet_text.replace('\n',' ')
return str(tweet_text)
def parse_file(file_in, file_out):
ptrFile_in = open(file_in, "r")
ptrFile_out = open(file_out, "w", encoding=... | [
"import json\nimport sys\nfrom os import listdir\nfrom os.path import isfile, join\nimport params\n\ndef encodeText(tweet_text): \n tweet_text = tweet_text.replace('\\n',' ') \n return str(tweet_text)\n\ndef parse_file(file_in, file_out):\n ptrFile_in = open(file_in, \"r\")\n ptrFile_out = open(file... | false |
4,565 | 2a062f0c2836850320cdd39eee6a354032ba5c33 | # coding=utf8
from __future__ import unicode_literals, absolute_import, division, print_function
"""This is a method to read files, online and local, and cache them"""
import os
from .Read import read as botread
from .Database import db as botdb
class BotNotes():
def __init__(self):
self.notes = botdb.... | [
"# coding=utf8\nfrom __future__ import unicode_literals, absolute_import, division, print_function\n\"\"\"This is a method to read files, online and local, and cache them\"\"\"\n\nimport os\n\nfrom .Read import read as botread\nfrom .Database import db as botdb\n\n\nclass BotNotes():\n\n def __init__(self):\n ... | false |
4,566 | f7a335db0ddf8a871e98eac54b59c41a40622153 | # Generated by Django 3.2.4 on 2021-08-09 03:22
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('employee', '0013_auto_20... | [
"# Generated by Django 3.2.4 on 2021-08-09 03:22\n\nfrom django.conf import settings\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n migrations.swappable_dependency(settings.AUTH_USER_MODEL),\n ('employee... | false |
4,567 | 79f945694f853e5886b590020bb661ecd418510d | import os
import sqlite3
from typing import Any
from direct_geocoder import get_table_columns
from reverse_geocoder import is_point_in_polygon
from utils import zip_table_columns_with_table_rows, get_average_point
def get_organizations_by_address_border(city: str,
nodes: list[... | [
"import os\nimport sqlite3\nfrom typing import Any\n\nfrom direct_geocoder import get_table_columns\nfrom reverse_geocoder import is_point_in_polygon\nfrom utils import zip_table_columns_with_table_rows, get_average_point\n\n\ndef get_organizations_by_address_border(city: str,\n ... | false |
4,568 | 15821bb33c2949f5a3e72e23cf7b5d8766dfce70 | import FWCore.ParameterSet.Config as cms
maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
readFiles = cms.untracked.vstring()
source = cms.Source ("PoolSource",fileNames = readFiles, lumisToProcess = cms.untracked.VLuminosityBlockRange(*('1:11169', '1:11699', '1:16592', '1:23934', '1:17699', '1:22722',... | [
"import FWCore.ParameterSet.Config as cms\nmaxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )\nreadFiles = cms.untracked.vstring()\nsource = cms.Source (\"PoolSource\",fileNames = readFiles, lumisToProcess = cms.untracked.VLuminosityBlockRange(*('1:11169', '1:11699', '1:16592', '1:23934', '1:17699', ... | false |
4,569 | aa913fd40a710cfd7288fd59c4039c4b6a5745cc | import pandas as pd
import random
import string
import names
def generatetest(n=100, filename="test_data"):
ids = []
names_list = []
for _ in range(n):
ids.append(''.join(random.choices(
string.ascii_letters + string.digits, k=9)))
names_list.append(names.get_full_name())
... | [
"import pandas as pd\nimport random\nimport string\nimport names\n\n\ndef generatetest(n=100, filename=\"test_data\"):\n ids = []\n names_list = []\n for _ in range(n):\n ids.append(''.join(random.choices(\n string.ascii_letters + string.digits, k=9)))\n names_list.append(names.get... | false |
4,570 | 001d2ae89a2d008fdf6621a1be73de94c766c65f | SOURCE_FILE = "D:\\temp\\twitter\\tweet.js"
TWITTER_USERNAME = 'roytang'
auto_tags = ["mtg"]
syndicated_sources = ["IFTTT", "Tumblr", "instagram.com", "Mailchimp", "Twitter Web", "TweetDeck", "mtgstorm"]
debug_id = None
# debug_id = "11143081155"
import frontmatter
import json
import requests
import urllib.request
fr... | [
"SOURCE_FILE = \"D:\\\\temp\\\\twitter\\\\tweet.js\"\nTWITTER_USERNAME = 'roytang'\nauto_tags = [\"mtg\"]\nsyndicated_sources = [\"IFTTT\", \"Tumblr\", \"instagram.com\", \"Mailchimp\", \"Twitter Web\", \"TweetDeck\", \"mtgstorm\"]\ndebug_id = None\n# debug_id = \"11143081155\" \n\nimport frontmatter\nimport json\n... | false |
4,571 | 5024db0538f0022b84c203882df9c35979ba978a | # Example solution for HW 5
# %%
# Import the modules we will use
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# %%
# ** MODIFY **
# Set the file name and path to where you have stored the data
filename = 'streamflow_week5.txt' #modified filename
filepath = os.path.join('../data', ... | [
"# Example solution for HW 5\n\n# %%\n# Import the modules we will use\nimport os\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\n# %%\n# ** MODIFY **\n# Set the file name and path to where you have stored the data\nfilename = 'streamflow_week5.txt' #modified filename\nfilepath = os.pat... | false |
4,572 | 790110a8cba960eb19593e816b579080dfc46a4e | from bs4 import BeautifulSoup
import urllib2
def get_begin_data(url):
headers = {
'ser-Agent': '',
'Cookie': ''
}
request = urllib2.Request(url, headers=headers)
web_data = urllib2.urlopen(request)
soup = BeautifulSoup(web_data, 'html.parser')
results = soup.select('tab... | [
"from bs4 import BeautifulSoup\r\nimport urllib2\r\ndef get_begin_data(url):\r\n headers = {\r\n 'ser-Agent': '',\r\n 'Cookie': ''\r\n }\r\n request = urllib2.Request(url, headers=headers)\r\n web_data = urllib2.urlopen(request)\r\n soup = BeautifulSoup(web_data, 'html.parser')\r\n r... | false |
4,573 | 0aed35827e6579f7a9434d252d0b9150ab24adf9 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-31 07:54
from __future__ import unicode_literals
import codenerix.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('codenerix_products', '0005_remove_p... | [
"# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-03-31 07:54\nfrom __future__ import unicode_literals\n\nimport codenerix.fields\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('codenerix_products... | false |
4,574 | bb1caf4d04c8a42279afa0ac586ced991e0dff84 | import Individual
import Grupal
import matplotlib.pyplot as plt
import pandas as pd
plt.show()
| [
"import Individual\nimport Grupal\nimport matplotlib.pyplot as plt\nimport pandas as pd\n\nplt.show()\n",
"import Individual\nimport Grupal\nimport matplotlib.pyplot as plt\nimport pandas as pd\nplt.show()\n",
"<import token>\nplt.show()\n",
"<import token>\n<code token>\n"
] | false |
4,575 | 8b29c12c294a8614d8be96c312ecffa9d3bcb3f8 | import Bio
import os
import sys
from Bio import PDB
from Bio.PDB import PDBIO
from Bio.PDB.PDBParser import PDBParser
import math
import numpy
from collections import Counter
import random
from Bio.PDB import *
import gzip
def get_center(res_list):
coord = []
for atom in residue:
#... | [
"import Bio\r\nimport os\r\nimport sys\r\nfrom Bio import PDB\r\nfrom Bio.PDB import PDBIO\r\nfrom Bio.PDB.PDBParser import PDBParser\r\nimport math\r\nimport numpy\r\nfrom collections import Counter\r\nimport random \r\nfrom Bio.PDB import *\r\nimport gzip\r\ndef get_center(res_list):\r\n coord = []\r\n \r\n... | false |
4,576 | d4c297af395581c6d955eb31a842ab86e599d23c | ##########################################################################
#
# Copyright (c) 2007-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redis... | [
"##########################################################################\n#\n# Copyright (c) 2007-2013, Image Engine Design Inc. 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 are\n# met:\n#\n... | false |
4,577 | 4e383130b185c6147315517d166ffe66be1be40d | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Member',
fields=[
('id', models.AutoField(verbo... | [
"# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ]\n\n operations = [\n migrations.CreateModel(\n name='Member',\n fields=[\n ('id', mo... | false |
4,578 | 5fa8ae36c4b4a5bffa64f4c65b74b74b29ba246f | # 0=RED, 1=GREEN, 2=BLUE, 3=ALPHA
#import tkinter as tk
#import tkinter.ttk as ttk
#from tkcolorpicker import askcolor
import time
c1 = [0,0,0,0] #this color
c2 = [0,0,0] #over this color
c3 = [0,0,0] #result
cont='y'
#--------------------------------
while cont=='y':
print('--enter underlay co... | [
"# 0=RED, 1=GREEN, 2=BLUE, 3=ALPHA\r\n\r\n#import tkinter as tk\r\n#import tkinter.ttk as ttk\r\n#from tkcolorpicker import askcolor\r\nimport time\r\n\r\nc1 = [0,0,0,0] #this color\r\nc2 = [0,0,0] #over this color\r\nc3 = [0,0,0] #result\r\n\r\ncont='y'\r\n\r\n#--------------------------------\r\n\r\nwhile cont=='... | false |
4,579 | d7db617131bf6e72c7aa808030f7286ddb609cc2 | from abc import ABC
# This is base class
class Vehicle(ABC):
pass
# GroundVehicle inherits from Vehicle
class GroundVehicle(Vehicle):
pass
# Car inherits from GroundVehicle
class Car(GroundVehicle):
pass
# Motorcycle inherits from GroundVehicle
class Motorcycle(GroundVehicle):
pass
# FlightVehicle ... | [
"from abc import ABC\n\n# This is base class\nclass Vehicle(ABC):\n pass\n\n# GroundVehicle inherits from Vehicle\nclass GroundVehicle(Vehicle):\n pass\n\n# Car inherits from GroundVehicle\nclass Car(GroundVehicle):\n pass\n\n# Motorcycle inherits from GroundVehicle\nclass Motorcycle(GroundVehicle):\n p... | false |
4,580 | 9e28fa1f221df13f9cc8e6b71586da961ebdc0e0 | # 上传文件
import os
from selenium import webdriver
# 获取当前路径的 “files” 文件夹
file_path = os.path.abspath("./files//")
# 浏览器打开文件夹的 upfile.html 文件
driver = webdriver.Firefox()
upload_page = "file:///" + file_path + "/upfile.html"
driver.get(upload_page)
# 定位上传按钮,添加本地文件
driver.find_element_by_id("inputfile").send_keys(file_p... | [
"# 上传文件\n\nimport os\nfrom selenium import webdriver\n\n# 获取当前路径的 “files” 文件夹\nfile_path = os.path.abspath(\"./files//\")\n\n# 浏览器打开文件夹的 upfile.html 文件\ndriver = webdriver.Firefox()\nupload_page = \"file:///\" + file_path + \"/upfile.html\"\ndriver.get(upload_page)\n\n# 定位上传按钮,添加本地文件\ndriver.find_element_by_id(\"in... | false |
4,581 | e642054dad8a2de5b01f2994348e10e9c7574ee0 | from django.apps import AppConfig
class BooksaleConfig(AppConfig):
name = 'booksale'
| [
"from django.apps import AppConfig\r\n\r\n\r\nclass BooksaleConfig(AppConfig):\r\n name = 'booksale'\r\n",
"from django.apps import AppConfig\n\n\nclass BooksaleConfig(AppConfig):\n name = 'booksale'\n",
"<import token>\n\n\nclass BooksaleConfig(AppConfig):\n name = 'booksale'\n",
"<import token>\n\n... | false |
4,582 | a430b4629ee06dbfb267f839599383624e37451e | # -*- coding: utf-8 -*-
"""Test custom node separator."""
import six
from helper import assert_raises, eq_
import anytree as at
class MyNode(at.Node):
separator = "|"
def test_render():
"""Render string cast."""
root = MyNode("root")
s0 = MyNode("sub0", parent=root)
MyNode("sub0B", parent=s0)... | [
"# -*- coding: utf-8 -*-\n\"\"\"Test custom node separator.\"\"\"\n\nimport six\nfrom helper import assert_raises, eq_\n\nimport anytree as at\n\n\nclass MyNode(at.Node):\n\n separator = \"|\"\n\n\ndef test_render():\n \"\"\"Render string cast.\"\"\"\n root = MyNode(\"root\")\n s0 = MyNode(\"sub0\", par... | false |
4,583 | bd0cc8cf059440f8fd7ad135894d82c9b18ebc80 | aax=int(input("enter aa-x"))
aay=int(input("enter aa-y"))
bbx=int(input("enter bb-x"))
bby=int(input("enter bb-y"))
ccx=int(input("enter cc-x"))
ccy=int(input("enter cc-y"))
ddx=int(input("enter dd-x"))
ddy=int(input("enter dd-y"))
if aax==aay and aay==bbx and bby==ccx and ccx==ccy and ccy==ddx and ddy==aax:
print(... | [
"aax=int(input(\"enter aa-x\"))\naay=int(input(\"enter aa-y\"))\nbbx=int(input(\"enter bb-x\"))\nbby=int(input(\"enter bb-y\"))\nccx=int(input(\"enter cc-x\"))\nccy=int(input(\"enter cc-y\"))\nddx=int(input(\"enter dd-x\"))\nddy=int(input(\"enter dd-y\"))\nif aax==aay and aay==bbx and bby==ccx and ccx==ccy and ccy=... | false |
4,584 | 4ba0affd3cbdc2652274213a8d410b541fb3edb4 | ## n.b. uses python 3 wordseg virtualenv (wordseg needs Py3)
# e.g. $ source ~/venvs/Py3/wordseg/bin/activate
## wordseg: see https://wordseg.readthedocs.io
from __future__ import division
import io, collections, os, glob, csv, re
from scipy.stats import entropy
from copy import deepcopy
# get username
impo... | [
"## n.b. uses python 3 wordseg virtualenv (wordseg needs Py3)\r\n# e.g. $ source ~/venvs/Py3/wordseg/bin/activate\r\n\r\n## wordseg: see https://wordseg.readthedocs.io\r\nfrom __future__ import division\r\nimport io, collections, os, glob, csv, re\r\nfrom scipy.stats import entropy\r\nfrom copy import deepcopy\r\n\... | false |
4,585 | 6434e427c9015544985a38104cffeaa10866b9ea | import os
import string
filenames = os.listdir('data/SENTIMENT_test')
filenames.sort()
outfile = open('sentiment_test.txt', 'w')
remove_punctuation_map = dict((ord(char), None) for char in string.punctuation)
for filename in filenames:
infile = open('data/SENTIMENT_test/' + filename, errors='ignore')
infilet... | [
"import os\nimport string\n\nfilenames = os.listdir('data/SENTIMENT_test')\nfilenames.sort()\noutfile = open('sentiment_test.txt', 'w')\n\nremove_punctuation_map = dict((ord(char), None) for char in string.punctuation)\n\nfor filename in filenames:\n infile = open('data/SENTIMENT_test/' + filename, errors='ignor... | false |
4,586 | d80cb5ea57faa0f9e3a8dd5d40c9852c2f7f83e4 | # coding: utf-8
import logging
from flask import request
from flask.ext.admin import expose
from cores.actions import action
from cores.adminweb import BaseHandler
from dao.bannerdao import banner
from extends import csrf
from libs.flask_login import login_required
from utils.function_data_flow import flow_tools
from... | [
"# coding: utf-8\nimport logging\n\nfrom flask import request\nfrom flask.ext.admin import expose\n\nfrom cores.actions import action\nfrom cores.adminweb import BaseHandler\nfrom dao.bannerdao import banner\nfrom extends import csrf\nfrom libs.flask_login import login_required\nfrom utils.function_data_flow import... | false |
4,587 | 23bd2ed783ab117bee321d97aa1c70698bdeb387 | ../../3.1.1/_downloads/b19d86251aea30061514e17fba258dab/nan_test.py | [
"../../3.1.1/_downloads/b19d86251aea30061514e17fba258dab/nan_test.py"
] | true |
4,588 | 98c2fdf0dfc9a660a3eb9a359aa9ca14d83c60ce | import numpy as np
import sympy as sp
# (index: int, cos: bool)
# 0 1 1 2 2 3 3 4 4 5 5 ...
# {0, cos}, {1, cos}, {1, sen}, {2, cos}, {2, sen}, ...
alternatingRange = lambda m : [{'index': j, 'cos': True if k == 0 else False} for j in range(m + 1) for k in range(2 if j != 0 else 1)]
# data: "dict"
# data = {'x': [x-p... | [
"import numpy as np\nimport sympy as sp\n\n# (index: int, cos: bool)\n# 0 1 1 2 2 3 3 4 4 5 5 ...\n# {0, cos}, {1, cos}, {1, sen}, {2, cos}, {2, sen}, ...\nalternatingRange = lambda m : [{'index': j, 'cos': True if k == 0 else False} for j in range(m + 1) for k in range(2 if j != 0 else 1)]\n\n# data: \"dict\"\n# d... | false |
4,589 | 5850be6aef6e4adb36a122cb8e5ffe044b1c9009 | __author__ = 'cromox'
from time import sleep
import inspect
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from Forex_CFD.features.main_page import FxMainPage
class FxBuySell(FxMainPage):
def _... | [
"__author__ = 'cromox'\n\nfrom time import sleep\nimport inspect\nfrom selenium.webdriver.support.wait import WebDriverWait\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.support import expected_conditions as EC\nfrom Forex_CFD.features.main_page import FxMainPage\n\nclass FxBuySell(FxMainPag... | false |
4,590 | 2f6d51d5c14ddc1f6cd60ab9f3b5d4a879d14af0 | from django import forms
BET_CHOICES = (
('1', 'Will rise'),
('x', 'Will stay'),
('2', 'Will fall'),
)
class NormalBetForm(forms.Form):
song = forms.CharField()
data = forms.ChoiceField(BET_CHOICES)
| [
"from django import forms\n\n\nBET_CHOICES = (\n ('1', 'Will rise'),\n ('x', 'Will stay'),\n ('2', 'Will fall'),\n)\n\n\nclass NormalBetForm(forms.Form):\n song = forms.CharField()\n data = forms.ChoiceField(BET_CHOICES)\n",
"from django import forms\nBET_CHOICES = ('1', 'Will rise'), ('x', 'Will s... | false |
4,591 | 08408cf096bbe23f9a832cc0cf2e017abdbd359f | import sys, os
import cv2
# set the video reader
video_path = 0 # camera number index
# video_path = "/home/pacific/Documents/Work/Projects/Workflows/server/PycharmProjects/Pacific_AvatarGame_Host/humanpose_2d/LiveCamera/test.mp4" # real video file
if type(video_path).__name__ == "str":
videoReader = cv2.VideoCap... | [
"import sys, os\nimport cv2\n\n\n# set the video reader\nvideo_path = 0 # camera number index\n# video_path = \"/home/pacific/Documents/Work/Projects/Workflows/server/PycharmProjects/Pacific_AvatarGame_Host/humanpose_2d/LiveCamera/test.mp4\" # real video file\nif type(video_path).__name__ == \"str\":\n videoRead... | false |
4,592 | a484272ace089008e27f4e00d2e641118432665e | from PIL import Image
from random import randrange
class PileMosaic:
def __init__(self):
self.width, self.height = 2380, 2800
self.filename = "pile_mosaic.png"
self.crema = (240, 233, 227)
self.choco = (89, 62, 53)
self.luna = (43, 97, 123)
self.latte = (195, 175, 14... | [
"from PIL import Image\nfrom random import randrange\n\nclass PileMosaic:\n def __init__(self):\n self.width, self.height = 2380, 2800\n self.filename = \"pile_mosaic.png\"\n self.crema = (240, 233, 227)\n self.choco = (89, 62, 53)\n self.luna = (43, 97, 123)\n self.latt... | false |
4,593 | d0adbcd60727c2c68e06dc5e796f2676f927c45a |
# coding: utf-8
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import time
import random
csvfilename = 'data/0901/exp1/xiaoxiong.csv'
df = pd.read_csv(csvfilename, header=None,
names=['abstime','posx','posy','posz','roty','rotx','anim'... | [
"\n# coding: utf-8\n\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.mplot3d import Axes3D\nimport time\nimport random\n\n\ncsvfilename = 'data/0901/exp1/xiaoxiong.csv'\ndf = pd.read_csv(csvfilename, header=None,\n names=['abstime','posx','posy','posz','r... | false |
4,594 | 493dbf85069f2115896a5f5f5d593c8d95b85cff | #
# Wrappers for model evaluation
#
import torch
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from modules import Classifier
from typing import Generator, NamedTuple, Optional, Union
from utils import expand_generator
class Evaluator(object):
class Result(NamedTuple):
... | [
"#\n# Wrappers for model evaluation\n#\n\nimport torch\nimport torch.nn.functional as F\nfrom torch.utils.data import Dataset, DataLoader\nfrom modules import Classifier\nfrom typing import Generator, NamedTuple, Optional, Union\nfrom utils import expand_generator\n\n\nclass Evaluator(object):\n class Result(Nam... | false |
4,595 | b8fa36ed3587511e0c64f0ffc87ea6e7857725d7 | from django.utils.html import strip_tags
from rest_framework import serializers
from home.models import *
class SliderSerializer(serializers.ModelSerializer):
class Meta:
model = Slider
fields = "__all__"
class CategorySerializer(serializers.ModelSerializer):
class Meta:
model = Cate... | [
"from django.utils.html import strip_tags\nfrom rest_framework import serializers\nfrom home.models import *\n\n\nclass SliderSerializer(serializers.ModelSerializer):\n class Meta:\n model = Slider\n fields = \"__all__\"\n\n\nclass CategorySerializer(serializers.ModelSerializer):\n class Meta:\n... | false |
4,596 | fb9ae5b3cdeac0c254669e214779ad43a02bff6d | #!/usr/bin/env python
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | [
"#!/usr/bin/env python\n\n# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\... | false |
4,597 | 0efac7d9d1a9180eafa8c9c4e3a42b4c68e718a2 | ##Linear Queue Data Structure
#Main Queue Class
class LinearQueue():
def __init__(self, length):
#When initiating, user defines the length.
#The head and tail pointers are set at -1 (i.e. not pointing to anything, index beginning at zero)
#The queue is set as a series of None objects in a l... | [
"##Linear Queue Data Structure\n\n#Main Queue Class\nclass LinearQueue():\n def __init__(self, length):\n #When initiating, user defines the length.\n #The head and tail pointers are set at -1 (i.e. not pointing to anything, index beginning at zero)\n #The queue is set as a series of None ob... | false |
4,598 | 80d49b24a2233569a340cee918393b1663c3d55d | import inspect
import threading
from monitor.mutex import Mutex, mutex_hooks
from monitor.condition import Condition, condition_hooks
from monitor.shared_variables import SharedList, SharedDict, shared_auto, \
variable_hooks
hooks = {}
for h in [mutex_hooks, condition_hooks, variable_hooks]:
hooks.update(... | [
"import inspect\nimport threading\n\nfrom monitor.mutex import Mutex, mutex_hooks\nfrom monitor.condition import Condition, condition_hooks\nfrom monitor.shared_variables import SharedList, SharedDict, shared_auto, \\\n variable_hooks\n\nhooks = {}\nfor h in [mutex_hooks, condition_hooks, variable_hooks]:\n ... | false |
4,599 | 9d37d1618fb9d00d63b7ed58290c5ba1b8f106cd | import numpy
#calculate field of simple
def dipole(x, y, z, dx, dy, dz, mx, my, mz):
R = (x - dx)**2 + (y - dy)**2 + (z - dz)**2
return (3.0*(x - dx) * ((x - dx)*mx + (y - dy)*my + (z - dz)*mz) / R**2.5 - mx/R**1.5,
3.0*(y - dy) * ((x - dx)*mx + (y - dy)*my + (z - dz)*mz) / R**2.5 - my/R**1.5,
... | [
"import numpy \n\n#calculate field of simple \ndef dipole(x, y, z, dx, dy, dz, mx, my, mz):\n R = (x - dx)**2 + (y - dy)**2 + (z - dz)**2\n return (3.0*(x - dx) * ((x - dx)*mx + (y - dy)*my + (z - dz)*mz) / R**2.5 - mx/R**1.5,\n 3.0*(y - dy) * ((x - dx)*mx + (y - dy)*my + (z - dz)*mz) / R**2.5 - m... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.