text stringlengths 8 6.05M |
|---|
from django.contrib import admin
from models import Women_Warriors
#PART 6.4 see the line above, don't forget to tell the page from where it is supposed to pull!! I forgot about this line and was getting into hella errors. Super important.
admin.site.register(Women_Warriors)
#PART 6.5 You are telling the admin site, ... |
import random
random_integer = random.randint(1, 10)
print(random_integer) |
'''
Created on 11/mar/2014
@author: isiu
'''
from xml.dom.minidom import parseString
#all these imports are standard on most modern python implementations
def readXml(filename):
#open the xml file for reading:
file = open(filename,'r')
#convert to string:
data = file.read()
file.close()
#parse the xml you go... |
'''
A unit fraction contains 1 in the numerator.
The decimal representation of the unit fractions with denominators 2 to 10 are given:
1/2 = 0.5
1/3 = 0.(3)
1/4 = 0.25
1/5 = 0.2
1/6 = 0.1(6)
1/7 = 0.(142857)
1/8 = 0.125
1/9 = 0.(1)
1/10 = 0.1
Where 0.1(6)... |
# Generated by Django 2.2.4 on 2020-12-26 09:17
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('whcapp', '0003_comment'),
]
operations = [
migrations.RenameField(
model_name='comment',
... |
def NumberChooser(number):
if number == 0:
return "ゼロ"
elif len(str(number)) == 1:
return Unit(number)
elif len(str(number)) == 2:
return Dozens(number)
elif len(str(number)) == 3:
return Hundreds(number)
elif len(str(number)) == 4:
return Thousands(number)
... |
from django.contrib import admin
from .models import Topic, Video, Question, Pdf, Query, Comment
class TopicAdmin(admin.ModelAdmin):
list_display = ('id', 'topicName')
list_display_links = ('id', 'topicName')
list_filter = ('id',)
search_fields = ('topicName',)
list_per_page = 10
class VideoAdmin... |
from django.urls import path
from .views import create_user,activate,forgot_password_mail,reset_password,change_password,teacher_details
from django.conf.urls import url
app_name = 'contacts'
urlpatterns = [
path('/signup',create_user,name='signup'),
url(r'^activate/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Z... |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
#!env python3
# -*- coding: utf-8 -*-
class Clock:
def __init__(self, hour):
self._hour = hour
self._ampm = "am"
@property
def hour(self):
return self._hour
@hour.setter
def hour(self, value):
self._hour = value % 12
self._ampm = "am" if value <= 12 else "p... |
import pickle
from scipy import sparse as sp
def matrix_equal(m1: sp.csr_matrix, m2: sp.csr_matrix):
return (m1 != m2).nnz == 0
def _structure_equal(s1, s2):
for m1, m2 in zip(s1, s2):
yield matrix_equal(m1, m2)
def structure_equal(s1, s2):
if len(s1) != len(s2):
return False
retur... |
from skimage import io, img_as_ubyte
import numpy as np
from os import listdir
from os.path import isfile, join
from utilities import *
import warnings
import png
mypath = './data_relabelled/'
outputdir = './img_nodupes_test'
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
with warnings.catch_warn... |
class Solution(object):
def convert(self, s, numRows):
"""
:type s: str
:type numRows: int
:rtype: str
"""
result = []
for row in range(numRows):
go_down = False
next_index = row
while next_index < len(s):
re... |
from bfimpl.bfunc import generateId
PATTERN = """//Start:Declarations
int sub_%ID%(%ARGS%);
//Stop:Declarations
//Start:Definitions
int sub_%ID%(%ARGS%) {
int retval;
retval = %EXPRESSION%;
return retval;
}
//Stop:Definitions
"""
def generate(n):
identification = generateId()
arguments = ""
... |
# -*- coding: utf-8 -*-
from Itinerary import Itinerary
from AirportAtlas import AirportAtlas
from AircraftList import AircraftList
from CurrencyList import CurrencyList
from CurrencyRateList import CurrencyRateList
from itertools import permutations
import sys
from tkinter import messagebox
class ItineraryList:
... |
import os
from dotenv import load_dotenv
load_dotenv()
DISPLAY_NAME = os.getenv('display_name')
SENDER_EMAIL = os.getenv('sender_email')
PASSWORD = os.getenv('password')
try:
assert DISPLAY_NAME
assert SENDER_EMAIL
assert PASSWORD
except AssertionError:
print('Please set up credentials!')
else:
p... |
#!/usr/bin/env python3
"""Processes errors for pyincapsula
Handles all error that might occur with pyincapsula and returns a
JSON breakdown of what the error is. See github for more information
byond the description and details the error message returns
error -- Exception thrown by the script
data -- Extra data ne... |
'''
File defining the global constants
'''
FRAMES_PER_SAMPLE = 100 # number of frames forming a chunk of data
SAMPLING_RATE = 8000
FRAME_SIZE = 256
NEFF = 129 # effective FFT points
# amplification factor of the waveform sig
AMP_FAC = 10000
MIN_AMP = 10000
# TF bins smaller than THRESHOLD will be
# considered inactiv... |
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import backend as K
class FullyConvNets(keras.layers.Layer):
def __init__(self, nb_filters=128, **kwargs):
super(FullyConvNets, self).__init__(**kwargs)
self.conv1 = keras.Sequential([
keras.layers.Conv1D(nb_f... |
import unittest
import cupy
from cupy import testing
from cupyx.scipy import sparse
import numpy
import pytest
@testing.parameterize(*testing.product({
'format': ['csr', 'csc'],
'density': [0.1, 0.4, 0.9],
'dtype': ['float32', 'float64', 'complex64', 'complex128'],
'n_rows': [25, 150],
'n_cols... |
from flask_restful import Resource
from flask_restful import abort
from flask_restful import marshal_with, marshal
from flask_restful import fields
from flask_restful import reqparse
from app.db import dbs
from app.models.user import User
import re
from datetime import datetime
from app.resources.auth import validate_p... |
# Copyright (c) 2012--2014 King's College London
# Created by the Software Development Team <http://soft-dev.org/>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, inclu... |
import socket
from base64 import encode
sock = socket.socket()
print("创建连接,连接服务器")
sock.connect(('127.0.0.1',5050))
print("准备发送数据给客户端")
content = 'hello smallqiang'
print("发送的内容为........")
print(content)
sock.send(content.encode()) |
# !/usr/bin/python
# coding=utf-8
#
# @Author: LiXiaoYu
# @Time: 2013-10-17
# @Info: Redis Library.
import redis, Log, sys, json
from Config import Config
from Cache import Cache
class Redis(Cache):
config = None
def __init__(self, options={}):
self.config = Config()
if "redis" not in sys.mod... |
#!/usr/bin/python
import os
import sys
import re
from ConfigParser import ConfigParser, NoSectionError, NoOptionError
import requests
CONFIG_FILENAME = 'pac.ini'
SECTION_PAC = 'PAC'
OPTION_PAC_SAVE_PATH = 'SavePath'
OPTION_PAC_TEMPLATE_PATH = 'TemplatePath'
OPTION_DOMAIN_LIST_PATH = 'DomainListPath'
OPTION_PROXY_BLA... |
#!/usr/bin/env
############################################
# exercise_7_2.py
# Author: Paul Yang
# Date: June, 2016
# Brief:
############################################
data = open("dialogue_chinese.txt", encoding="utf-8")
for line in data:
try:
(role,line_spoken) = line.split(":",maxsplit=1)
p... |
class Solution(object):
def maxNumber(self, nums1, nums2, k):
def get_max_sub_array(nums, k):
res , n = [] ,len(nums)
for i in xrange(n):
while res and len(res) + n - i > k and nums[i] > res[-1]:
res.pop()
if len(res) < k:
... |
from django.http import JsonResponse, HttpResponse
from wrapper import *
#####################################
#### FUNCIONES AUXILIARES ####
#####################################
def complain_about_get():
data = {
'message': "La peticion tiene que ser GET",
}
return JsonResponse(data,safe... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django import template
from extra_settings.models import Setting
register = template.Library()
@register.simple_tag(takes_context=True)
def get_setting(context, name, default=''):
return Setting.get(name, default)
|
#import sys input = sys.stdin.readline
def main():
S, T = input().split()
print(T+S)
if __name__ == '__main__':
main()
|
#HOUSE PRICE PREDICTIONS
# PART 1 :-
# PART 1- Getting the Data
#Import the libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#Import the Dataset
train=pd.read_csv('train.csv')
test=pd.read_csv('test.csv')
#PART 2:-
... |
from collective.rooter.navroot import setNavigationRoot
from plone.app.layout.navigation.interfaces import INavigationRoot
from zope.component import adapter
from zope.publisher.interfaces import IEndRequestEvent
from zope.traversing.interfaces import IBeforeTraverseEvent
@adapter(INavigationRoot, IBeforeTraverseEven... |
#!/usr/bin/env python
# coding: utf-8
# ## Run LRP on all test and validation results
import sys
import os
import json
import time
import torch
import pandas as pd
import numpy as np
import time
import matplotlib.pyplot as plt
import seaborn as sns
from collections import Counter
import torch
import torch.nn as nn
f... |
# --------------
# Importing header files
import numpy as np
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Code starts here
#Loading data file and saving it into a new numpy array
data = np.genfromtxt(path, delimiter=",", skip_header=1)
print(data.shape)
#Concatenating the new record to ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-28 06:51
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('player', '0002_auto_20161228_1215'),
]
operations = [
migrations.RemoveField(
... |
import report
#import axteriz |
#!/usr/bin/env python
"""
This script downloads article information of one URL. The results are stored in JSON-files in a sub-folder.
You need to adapt the variables url and basepath in order to use the script.
"""
import json
from newsplease import NewsPlease
url = 'https://www.rt.com/news/203203-ukraine-russia-tro... |
"""
Contains the class to color code and value code the cards.
"""
class Card():
"""
Creates a deck of cards (52 cards).
"""
def __init__(self, suit, value):
"""
Initializes the suit and value for each card.
"""
self.suit = suit
self.value = value
def __repr... |
class Solution:
def permuteUnique(self, nums: List[int]) -> List[List[int]]:
# import itertools
# return list(set(itertools.permutations(nums)))
if not nums:
return []
result = set()
visited = [0] * len(nums)
def do_permute(nums, track):
if le... |
import json
from tools import playlists as p
from tools import tracks_data as t
if __name__ == '__main__':
playlists = p.Playlists()
playlists.formatter()
playlists.save_to_local()
# open playlist's info
with open('data/playlists_info.json') as f:
playlists_info = json.load(f)
#i... |
import scipy.io as sio
import os
import numpy as np
import matplotlib.pyplot as plt
path_loss = os.path.join('result','0','loss_list.mat')
data_loss = sio.loadmat(path_loss)
total_loss = data_loss['loss_t'][0]
mse_loss = data_loss['mse'][0]
ce_loss = data_loss['ce'][0]
for id in range(1):
print('--------------',id)... |
import os
import unittest
import mox
import WMCore_t.Storage_t.Plugins_t.PluginTestBase_t
from WMCore.Storage.Plugins.FNALImpl import FNALImpl as ourPlugin
from WMCore.Storage.Plugins.CPImpl import CPImpl as ourFallbackPlugin
import subprocess
from WMCore.WMBase import getWMBASE
from WMCore.Storage.StageOutError import... |
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.shortcuts import render,redirect
from django.contrib.auth.forms import UserCreationForm
from django.views.generic import View
from django.shortcuts import get_object_or_404
from .forms import PostForm
from .models import Posts
from d... |
from PyQt5.QtWidgets import QMainWindow, QWidget
from PyQt5.QtWidgets import QApplication, QDialog, QTreeWidget, QTreeWidgetItem
from PyQt5.QtGui import QIcon, QFont
import PyQt5
from PyQt5.QtWidgets import QMessageBox
from PyQt5.QtCore import QDir
from PyQt5.QtCore import Qt, pyqtSlot, pyqtSignal
from libopenimu.qt.... |
from .person import Person
class MITPerson(Person):
nextIdNum = 0
def __init__(self, name):
Person.__init__(self, name)
self.idNum = MITPerson.nextIdNum
MITPerson.nextIdNum += 1
def getIdNum(self):
return self.idNum
def __lt__(self, other):
return self.idNum < other.idNum
def speak(s... |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
from django.db import models
# Create your models here.
class ClientModel(models.Model):
lastname = models.CharField(max_length=120,blank=True, null=True, default=None,verbose_name="Фамилия")
email = models.EmailField(blank=True, null=True, default=None)
firstname = models.CharField(max_length=120,blank=Tr... |
# -*- coding: utf-8 -*-
class GrapheNO:
"""graphe code par liste d'adjacence. Les sommets devront etre numerotes 0,1,...,n-1"""
def __init__(self, n, l_adj):
"""initialise un graphe d'apres la liste d'adjacence l_adj et son ordre n"""
self.ordre = n # attribut ordre = nb de sommets
... |
import pika
from src.settings import RABBITMQ_HOST, RABBITMQ_PORT, RABBITMQ_USERNAME, RABBITMQ_PASSWORD, RABBITMQ_QUEUE, \
RABBITMQ_PREFETCH_COUNT
from src.contracts.event_consumer import EventConsumer
class RabbitConsumer(EventConsumer):
def start_consumption(self, callback):
credentials = pika.Plai... |
from timeit import default_timer as timer
import tkinter
from PIL import Image
from PIL import ImageTk
import cv2
import numpy as np
from math import sqrt
MAX_FEATURES = 5000
GOOD_MATCH_PERCENT = 0.25
MIN_MATCHES = 10
camindex = 2
ransacReprojThreshold = 25.0
im1 = cv2.imread('template.jpg')
im1Gray = cv2.cvtColor(im1... |
#!/usr/bin/env python
import logging
from typing import (
Any,
Dict,
List,
Optional,
)
from hummingbot.logger import HummingbotLogger
from hummingbot.core.event.events import TradeType
from hummingbot.connector.exchange.bittrex.bittrex_order_book_message import BittrexOrderBookMessage
from hummingbot.... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import smtplib
import sys
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
# message
lines = sys.stdin.readlines()
message = ""
for i in range(len(lines)):
message += lines[i]
# email setting
msg = MIMEMultipart()
msg['From'] = 'sende... |
"""module containing url patterns for the comments app"""
from django.urls import path
from authors.apps.comments.views import (
ListCreateCommentView, UpdateDestroyCommentView,
LikeComment, LikeCommentStatus, DislikeComment, CommentHistoryViewSet
)
urlpatterns = [
path(
"comments/",
ListCr... |
from math import cos, inf
from random import uniform, random
from src.glTypes import V3, newColor
from src.glMath import angle, cross, divide, dot, matrixMult, matrixMult_4_1, mult, negative, norm, substract
def flat(render, **kwargs):
u, v, w = kwargs['baryCoords']
tA, tB, tC = kwargs['textureCoords']
A, B, C =... |
"""
================================
Spectral analysis of the trials
================================
This example demonstrates how to perform spectral
analysis on epochs extracted from a specific subject
within the :class:`moabb.datasets.Cattan2019_PHMD` dataset.
"""
# Authors: Pedro Rodrigues <pedro.rodrigues01@g... |
from django.apps import AppConfig
class AppCrontabConfig(AppConfig):
name = 'app_crontab'
|
"""
Enough is enough!
Alice and Bob were on a holiday. Both of them took many pictures of the places they've been,
and now they want to show Charlie their entire collection. However, Charlie doesn't like these sessions,
since the motive usually repeats. He isn't fond of seeing the Eiffel tower 40 times. He tells them... |
from distutils.core import setup
import pathlib
HERE = pathlib.Path(__file__).parent
README = (HERE / "README.md").read_text()
setup(
name = 'hitomi_py',
packages = ['hitomi_py'],
version = '1.0',
license='MIT',
description = 'hitomi api',
long_description=README,
long_description_content... |
# Generated by Django 3.1.6 on 2021-07-03 15:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('cabroozadmin', '0012_auto_20210703_1856'),
]
operations = [
migrations.RemoveField(
model_name='driverdetails',
name='approv... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 11 18:22:50 2021
@author: chulke
"""
class Punto:
def __init__(self, x, y):
self.x = x
self.y = y
def __str__(self):
return f'({self.x}, {self.y})'
def __repr__(self):
return f'Punto({self.x... |
import multiprocessing
workers = multiprocessing.cpu_count() * 2 + 1
bind = 'unix:rabbitholeapi.sock'
umask = 0o007
reload = True
#logging
accesslog = '-'
errorlog = '-' |
from cgshop2021_pyutils.solution import Solution
from cgshop2021_pyutils.solution import TargetNotReachedError
def __last(iter):
last = None
for i in iter:
last = i
return last
def validate(solution: Solution):
"""
Attempts to validate an instance, raising an exception
derived from In... |
# Generated by Django 2.2.3 on 2020-02-04 08:45
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tracks', '0023_track_track_designer'),
]
operations = [
migrations.AlterField(
model_name='cour... |
class Initials:
def getInitials(self,name):
words = name.split()
out = []
for word in words:
out.append(word[0])
return "".join(out)
|
#import sys
#input = sys.stdin.readline
def main():
X = int( input())
print(X//500*1000 + X%500//5*5)
if __name__ == '__main__':
main()
|
# The Airport Kiosk - V 1.0.0
# Author: Dena, Rene
# Last Modified: 5/1/17
# _Misc.
# _Functions
# _Strictly Script
print('\n\t\t\tWelcome to "THE AIRPORT KIOSK" script!')
while True:
name = input('\nBefore we begin, what is your name?:')
if name.isalpha():
print('\nAwesome! We can now begin {}.'.... |
"""
bir kitaba sayfa numaraları verilirken 689 tane 1 rakamı kullanılmıştır
bu kitabın sayfa sayısını bulunuz
"""
toplam=0
for i in range(1,2000):
sayfa_no=list(str(i))
for j in sayfa_no:
if(str(j)=="1"):
toplam+=1
if(toplam==689):
print("sayfa sayisi:",i)
... |
#!/usr/bin/python3
"""This module creates a class State that inherits from BaseModel"""
from models.base_model import BaseModel
class State(BaseModel):
"""
This is a User class with the public class attributes:
- name: string - empty string
"""
name = ''
|
from django.contrib import admin
# Register your models here.
# since models.py is in the same folder we say from .models import class profile
from .models import profile
# to make profile model manageable through Django admin
class profileAdmin(admin.ModelAdmin):
class Meta:
model = profile
admin.site.r... |
import os
import subprocess
from libqtile import layout, hook
from libqtile.config import Group
from keys import keys
from groups import groups
from screens import screens
layout_theme = {
"border_width": 2,
"margin": 6,
"border_focus": "e1acff",
"border_normal": "1D2330"
}
layouts = [
layout... |
import networkx as nx
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import scipy
import numpy as np
import math
import pickle
from tqdm import tqdm_notebook
from multiprocessing import Pool
np.set_printoptions(suppress=True)
pd.set_option('display.float_format', lambda x: '%.3f' % x)
im... |
# -*- coding: utf-8 -*-
import irc3
import base64
__doc__ = '''
===================================================
:mod:`irc3.plugins.sasl` SASL authentification
===================================================
Allow to use sasl authentification
..
>>> from irc3.testing import IrcBot
>>> from irc3.testing... |
'''
Author: Vinicius de Figueiredo Marques
++++++++++++++++++++++++++++++++++++++
The objective of this script is to load a XML file representing a database structure with some data.
Then it process this structure and generates SQL instructions to be inserted to a choosen SGBD
'''
from XMLParser import *
from D... |
"""
File: linkedbst.py
Author: Ken Lambert
"""
from abstractcollection import AbstractCollection
from bstnode import BSTNode
from linkedstack import LinkedStack
# from linkedqueue import LinkedQueue
from math import log
class LinkedBST(AbstractCollection):
"""An link-based binary search tree implementation."""
... |
from django.views.decorators.csrf import csrf_exempt
from django.http import Http404, JsonResponse, HttpResponse
from django.contrib.auth import authenticate, login
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from api.serializers import Experim... |
from rest_framework.routers import DefaultRouter
from .views import SnippetViewSet,TestViewSet
router = DefaultRouter()
router.register(r'snippets', SnippetViewSet)
router.register(r'tests', TestViewSet)
urlpatterns = router.urls
# from django.conf.urls import url
# from . import views
#
# urlpatterns = [
# u... |
from utils.time_watch import time_watch
class Rotate:
''' 数组循环左移
'''
@classmethod
def fun_1(cls, lst, k):
tmp = lst[:]
print(id(tmp))
print(id(lst))
for i in range(k):
tmp.append(tmp.pop(0))
return tmp
@classmethod
def fun_2(cls, lst, k):
... |
import pandas as pd
from autumn.core.inputs.database import get_input_db
def get_mmr_testing_numbers():
"""
Returns daily PCR test numbers for Myanmar
"""
input_db = get_input_db()
df = input_db.query(
"covid_mmr",
columns=["date_index", "tests"],
)
df.dropna(how="any", ... |
#!/usr/bin/env
############################################
# test_vehicle.py
# Author: Paul Yang
# Date: June, 2016
# Brief: this is to show HOWTO of python class, __init__method, accessing instance/class attribute
############################################
from vehicle import Truck, Sportscar, Compactcar
cars ... |
import sys
N=int(input())
a=[[]]*N
sum=0
for i in range(N):
b=input()
x=b.split()
if(len(x)==N):
a[i]=b.split()
else:
print("不符合要求,请重新输入!")
sys.exit()
if(N%2==0):
for j in range(N):
sum=sum+int(a[j][j])+int(a[j][N-j-1])
print(sum)
else:
for j in range(N):
... |
#encoding:utf-8
from celery import Celery
from WenShuCourtDB_Mongo import WenshucoutMongoDb
from config import master_ip
mydb = WenshucoutMongoDb('WenShuCourt',host=master_ip)
app = Celery('db_tasks', broker='redis://127.0.0.1:6379/0',backend='redis://127.0.0.1:6379/1')
def getCourts():
ret = mydb.getCourts()
... |
'''
Client module that controls database, telegram client, and face recognition model
'''
import copy
import datetime
import threading
import logging
from pickle import PicklingError, UnpicklingError
from bson.errors import BSONError
from PIL import Image
import numpy as np
from model.recognition_model import FaceRe... |
import os
import re
import json
import sys
os.chdir(os.path.dirname(__file__))
sys.path.append("..")
from tool.append_to_json import AppendToJson
def main_run():
os.chdir(os.path.dirname(__file__))
lexicon_name = "lexicon"
input_path = '../../data/knowledge_triple.json'
output_path = '../../data/' + lexicon_name +... |
# This file test_campigns is created by lincan for Project uuloong-strategy
# on a date of 8/17/16 - 3:01 PM
import unittest
from flask import json
from mongoengine import connect
from manage import app
__author__ = "lincan"
__copyright__ = "Copyright 2016, The uuloong-strategy Project"
__version__ = "0.1"
__maintain... |
import urllib2
import datetime
import time
import random
import os
import csv
import re
from bs4 import BeautifulSoup
seanad_yr_base_address = 'http://oireachtasdebates.oireachtas.ie/debates%20authoring/debateswebpack.nsf/datelist?readform&chamber=seanad&year='
seanad_yr_addresses = {}
for yr in range(1922,2017):
s... |
# coding:utf-8
import requests, re
from mooc_login import get_cookie
from pyquery import PyQuery as pq
username = "username"
password = "password"
cookie = get_cookie(username, password) # 从mooc_login取回来cookies
s = requests.Session()
def get_course_id():
course_ids = []
postdata= {
"tabIndex... |
#!/u/shared/programs/x86_64/python/2.5.5/bin/python
# 2013-05-09, tc
#
# Use:
# ./pp.py data.d [lbin=1] [binstart=0]
#
from numpy import loadtxt
from math import sqrt
from sys import argv
if len(argv)<2:
print '*****************************************'
print 'usage: ./pp.py filename [lbin=1] [binstart=0]'
... |
f = open('lab3-2.txt', 'r')
def push(val):
global top
top += 1
stack[top] = val
def pop():
global top
fin = top
top -= 1
return stack[fin]
def isEmpty():
global top
return top == -1
def isFull():
global top
return top == len(stack)
if __nam... |
import pygame
pygame.init()
screen = pygame.display.set_mode((320, 470))
color = (88, 89, 90)
color_light = (208, 0, 147)
color_text = (255, 255, 255)
color_dark = (174, 0, 255)
width = 500
height = 500
color_blue = (85, 182, 217)
color_orange = (255, 110, 63)
color_red = (255, 0, 0)
scree... |
import base64
import json
import Queue
import ssl
import time
import urllib
import urllib2
import uuid
import random
import string
from threading import Thread
from time import sleep
from concurrent.futures import ThreadPoolExecutor
from hawkeye_test_runner import (HawkeyeTestCase, HawkeyeTestSuite,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.