index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
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 =... |
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",
... |
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
... |
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... |
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))
|
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... |
4,506 | f47e4d6ff079b6ac2320467d87b34ae82face032 | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class SearchConfig(AppConfig):
name = 'search'
verbose_name = _("Search")
|
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... |
4,508 | 851cfd4e71ffd2d5fed33616abca4444474669a3 | def four_Ow_four(error):
'''
method to render the 404 error page
'''
return render_template('fourOwfour.html'),404 |
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... |
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),
... |
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
... |
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)
... |
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... |
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
... |
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... |
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... |
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... |
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"
|
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... |
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'... |
4,521 | 9dead39e41fd0f3cff43501c659050885a50fec3 | try:
a=100
b=a/0
print(b)
except ZeroDivisionError as z:
print("Error= ",z) |
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... |
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)... |
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 = ''
... |
4,525 | 8e3f23733235d73fab14e80ee0a3706ae351c7a2 | vozrast=int(input("сколько вам лет?"))
print ("через 10 лет вам бóдет", vozrast+10) |
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... |
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... |
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... |
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:
... |
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 ... |
4,531 | 00b06b5e6465bae3eab336441b283a9831bb93c0 | a=int(raw_input())
if (a%2)==0:
print("Even")
else:
print("Odd")
|
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),
... |
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... |
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... |
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]]
... |
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),... |
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',... |
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
... |
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)
... |
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... |
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... |
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... |
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... |
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... |
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... |
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 ... |
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... |
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:]
... |
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... |
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 ") |
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([
... |
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... |
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
|
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()
|
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... |
4,556 | 7ac53779a98b6e4b236b1e81742163d2c610a274 | __author__ = 'samar'
import mv_details
import product
|
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... |
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... |
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_... |
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... |
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... |
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)
|
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... |
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=... |
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.... |
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... |
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[... |
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',... |
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())
... |
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... |
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', ... |
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... |
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... |
4,574 | bb1caf4d04c8a42279afa0ac586ced991e0dff84 | import Individual
import Grupal
import matplotlib.pyplot as plt
import pandas as pd
plt.show()
|
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:
#... |
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... |
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... |
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... |
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 ... |
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... |
4,581 | e642054dad8a2de5b01f2994348e10e9c7574ee0 | from django.apps import AppConfig
class BooksaleConfig(AppConfig):
name = 'booksale'
|
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)... |
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(... |
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... |
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... |
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... |
4,587 | 23bd2ed783ab117bee321d97aa1c70698bdeb387 | ../../3.1.1/_downloads/b19d86251aea30061514e17fba258dab/nan_test.py |
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... |
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 _... |
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)
|
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... |
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... |
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'... |
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):
... |
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... |
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... |
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... |
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(... |
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,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.