index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
14,500
d71e5a37b65b0ad0ebcc3378ba9347b1ddb72563
from django.apps import AppConfig class CssframeworksConfig(AppConfig): name = 'CSSFrameworks'
14,501
48f7381a79dfcd3b1b1438dba8f7a3f51bc85962
import requests from lxml import etree def handle_douyin_web_share(): share_web_url = 'https://www.douyin.com/share/user/88445518961' share_web_header = { 'user-agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36' } share_web_re...
14,502
c58abacf58a65b37f1844af3a5f27b80d12f8460
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'D:\Documents\CEID\Βασεις Δεδομενων\ProjectDB\Recruit.ui' # # Created by: PyQt5 UI code generator 5.11.3 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_RecruitWindow(ob...
14,503
ed3c06339ee40242d036ad877ea2ecb80481f359
print (__doc__) import numpy as np import pylab as pl from sklearn import svm # we create 40 separable points np.random.seed(0) X = np.r_[np.random.randn(20,2)-[2,2],np.random.randn(20,2)+[2,2]] Y = [0] * 20 +[1] * 20 #fit the model clf = svm.SVC(kernel='linear') clf.fit(X,Y) #get the separating hyperplane w= clf....
14,504
7f66a05d894edcc1a2c04635dcb250515bf6af7a
import pyglet; from itertools import chain; from victor.vector import *; __all__ = ['MovementGrid']; scales = (1, 5, 10, 20, 40, 80); class MovementGrid(object): def __init__(self, width, height, color = (127, 127, 127 , 127)): self.color = color; self.width = width; self.height = heigh...
14,505
5680e24fd897a6a92a830ef359713885f171f2ab
import numpy as np def perform_thresholding(f,M,type): """ Only 3 types of thresholding currently implemented """ if type == "largest": a = np.sort(np.ravel(abs(f)))[::-1] #sort a 1D copy of F in descending order T = a[M] y = f*(abs(f) > T) elif type == "soft": s...
14,506
b2c436bd35cf4864fd1a3fdfca797c8978620477
# 在这里写上你的代码 :-) ''' 【备注】:#画line,线粗4,背景色: #ddeeff ''' import tkinter def tm056_1(): canvas = tkinter.Canvas(width=600, height=500, bg='#ddeeff') canvas.pack(expand='yes', fill='both') r=150 canvas.create_line(300 - r,250 - r,300 + r,250 + r, width=4) canvas.mainloop() tm056_1()
14,507
4861ac12a440e940703fed8dfa5774da6e520283
import scrapy from tutorial.items import JobsItem, DefaultLoader from Helper.NetHelper import header from scrapy.http import Request, FormRequest class QuotesSpider(scrapy.Spider): name = "51Job" def start_requests(self): # 需要的访问的列表 return [Request("https://login.51job.com/", ...
14,508
dbf532c3401137b26ae0dbc21178c3b67cdf087f
import requests import pandas as pd import numpy as np from bs4 import BeautifulSoup url = 'https://www.metafilter.com/' params = ['171194'] def get_post_text(url, params): page = requests.get(url+params).content soup = BeautifulSoup(page, 'html.parser') post_text = soup.find('div', attrs={'class': 'copy'...
14,509
6e2a5d9549f5aace1de039770aa2f3297374a07e
import pygame import os pygame.init() win = pygame.display.set_mode((1000,500)) # loading image file inside the variable bg_img = pygame.image.load("background.jpg") # scale the image according to the window size bg = pygame.transform.scale(bg_img, (1000, 500)) width = 1000 i = 0 run = True while run: ...
14,510
79f9e6fe14f86090b368a5f41d76731a04bc77fe
import socket, hashlib def create_socket(addr): proto, params = addr.split('://', 1) if not proto.isalnum(): raise socket.error("Unknown protocol") try: mod = getattr(__import__('socketutil.'+proto), proto) except ImportError: raise socket.error("Unknown protocol") return mod.TheSoc...
14,511
de431f201efa776cd310dbf3374e9dcaad60a62b
import json import sys def get_attribute_index(attribute): key = '' temp_list = [] keys_list = [] for char in attribute: if char == '[' or char == ']': if key != '': temp_list.append(key) key = '' continue key += char for...
14,512
9eb8b7f4c6025aeb7007b28f8b72bfedc9bd62e9
"""URL definition for the beer site""" from django.conf.urls import url, include from beers.views import user, validation, contest import beers.api.views as api_views urlpatterns = [ url(r'^$', contest.index, name='index'), url(r'^', include('django.contrib.auth.urls')), url(r'^signup$', user.signup, nam...
14,513
654bf311288c9bfed81e072caecfa926fa01b2e8
from collections import Counter from AoC2018.util import util def count_twos_threes(line): """ Counts the frequency of double and triple letters in a string. Return list: first element is true if some letters occur exactly 2 times and second element is true if some letters occur exactly 3 times....
14,514
c08d9b9bb5ac9d2de74fd035a4fe4d8886989b5e
from .garden import Garden from.bunny import Bunny def eat(garden): garden = Garden.from_matrix(garden) bunny = Bunny(garden) bunny.run() return bunny.stomach
14,515
ab0cb23753ceb3209488d6c1de1e943e8ef0eb7f
""" Domain object for tracking Civet jobs in the incremental submission system """ from sqlalchemy import * from base import Base import logging from sqlalchemy.orm import relationship from sqlalchemy import func from session import Session from status import Status dependencies = Table('job_dependencies', Base.metada...
14,516
a78b594ecb47a9485a72c64524e9eed3bf237e37
from django.db import models # Create your models here. class User(models.Model): score = models.IntegerField() coins = models.IntegerField() def __str__(self): return f'{self.pk}' class Windmills(models.Model): user_id = models.ForeignKey('User', on_delete=models.CASCADE) height = model...
14,517
86222835a111e33684463047783439bb596c8247
import json import re import urllib from bs4 import BeautifulSoup from decimal import Decimal from storescraper.product import Product from storescraper.store import Store from storescraper.utils import session_with_proxy, check_ean13, \ html_to_markdown class Pontofrio(Store): preferred_discover_urls_concu...
14,518
f36996b7205d8e5527d68028e61e7bade57560f3
#!/usr/bin/python # --*-- encoding:utf-8 --*-- #################################################### # Zhihu Auto-Aogin # # # Created on : 03/07/17 # Last Modified : # # Author : Pengcheng Zhou(Kevin) # #################################################### import re from urllib import parse, request, ...
14,519
11203073788b38ed27d4ad89a93870582165e46b
from PyQt5 import QtCore from PyQt5 import Qt from PyQt5 import QtWidgets from PyQt5.QtWidgets import QTableWidgetItem import config_enterTable_widget class EnterTableWidget(QtWidgets.QDialog, config_enterTable_widget.Ui_enter_Table_Widget): def __init__(self, parent = None): # Это здесь нужно для досту...
14,520
c4b1ddf5cec23a59ba47ae5aa7613644b1c488ec
import os import numpy as np import scipy.io as spio from scipy.ndimage import gaussian_filter1d def jittered_neuron(t=None, feature=None, n_trial=61, jitter=1.0, gain=0.0, noise=0.05, seed=1234): """Generates a synthetic dataset of a single neuron with a jittered firing pattern. Parameters ---------- ...
14,521
d141bb4118adbe017f54e9013e07ab5218d2fa55
import mysql.connector from mysql.connector.constants import ClientFlag print ("MySQL connector module import succeed") config = { 'user':'root', 'password':'root', 'host':'35.229.99.14', 'client_flags':[ClientFlag.SSL], 'database':'room1', 'ssl_ca':'/home/pi/server-ca.pem', 'ssl_cert':'/home/pi/client-cert.pe...
14,522
5cd9f33a94835c5e1a84925af1b47ba56b9ba5ee
""" <Program> test_sqli.py <Purpose> Some unit tests for the sqlite3 interface for the dependency tools. """ import depresolve import depresolve.depdata as depdata import testdata import depresolve.sql_i as sqli def main(): deps = testdata.DEPS_MODERATE versions_by_package = depdata.generate_dict_versio...
14,523
c9792a255da837ffcddd29ac22143b486af0d7f0
import os import socket import threading import time import gbn CLIENT_SEND_HOST = '127.0.0.1' CLIENT_SEND_PORT = 8080 CLIENT_SEND_ADDR = (CLIENT_SEND_HOST, CLIENT_SEND_PORT) CLIENT_RECV_HOST = '127.0.0.1' CLIENT_RECV_PORT = 8023 CLIENT_RECV_ADDR = (CLIENT_RECV_HOST, CLIENT_RECV_PORT) CLIENT_DIR = os.path.dirname(__...
14,524
ca335abef14163e5d214295deb6620f030c5c08a
from pymongo import MongoClient from flask import Flask, g, render_template, abort, request, jsonify from bson.json_util import dumps from bson.objectid import ObjectId # Setup Flask app = Flask(__name__) app.config.from_object(__name__) # Main api page @app.route('/api/') def api_help(): return r...
14,525
efe25827c2a539f8feb05b5e502ff54884e0b5c4
import pytest from fhepy.polynomials import Polynomials from fhepy.zmodp import ZMod ZMod2 = ZMod(2) ZMod7 = ZMod(7) ZMod11 = ZMod(11) @pytest.mark.parametrize('field,coefficients,expected', [ (ZMod2, [0], "0"), (ZMod2, [1], "1"), (ZMod2, [3], "1"), (ZMod7, [6], "6"), (ZMod7, [7], "0")]) def tes...
14,526
e02e670474a8f16ae32b195cc64ea3665cb6b8ac
"""##################################################################################################################### # This is a simple game in which you will enter different combinations of card and it will tell you to winning situation ############################################################################...
14,527
569c9c1ccc71a88e470668ad95df03c0c12cc8d4
import datetime #import time #import caldendar dt_now = datetime.datetime.now() print(dt_now) print("Year:", dt_now.year) print("Month:", dt_now.month) print("Week:", dt_now.weekday()) tdelta = datetime.timedelta(days= 5) print("-5 days:", dt_now - tdelta) tdelta = datetime.timedelta(seconds= 5) print("+5 seconds...
14,528
35fac0d3c95d1e8ac118b12d4c9d9845e1313cfe
import yaml def get_data_with_file(file_name): with open('./data/' +file_name+ '.yml','r')as f: return yaml.load(f,Loader=yaml.FullLoader)
14,529
e97ab73d4e9281a5269f64d6706e22151c3c081b
#!/usr/bin/env python #coding: utf-8 import hashlib import os def md5(filename): ''' 计算文件的 md5 值 ''' if os.path.isfile(filename): hash_md5 = hashlib.md5() with open(filename, 'rb') as f: for chunk in iter(lambda: f.read(4096), b""): hash_md5.update(chunk) ...
14,530
e4b0f7f5e39228036189a8b78747fc8605ee00ef
import re op1=open("Book1.txt","r") book1=op1.read() longest1=0 for i in book1.split("."): b=i.split() for re in range(len(b)): if len(b[re]) > longest1: longest1 = len(b[re]) longest_word1 = b[re] print("Longest word from book1 is : ",longest_word1) op2=open("Book2.txt","r") boo...
14,531
81031cbf5a53e66589f346db24405975e2683561
import tkinter as tk counter = 0 def counter_label(label): def count(): global counter counter+=1 label.config(text=str(counter)) label.after(1000,count) count() root = tk.Tk() root.title("Counting The Clicks") label = tk.Label(root, fg="green") label.pack() counter_l...
14,532
28d38fb90aee0f28ba944b29c8c3be1b881ada9d
from Procedure import procedure import Procedures_Motion import Procedures_Pumps class PrintLine(procedure): def Prepare(self): self.name = 'PrintLine' self.requirements['startpoint']={'source':'apparatus', 'address':'', 'value':'', 'desc':'Reference point'} self.requirements['endpo...
14,533
fd3156a0872682aa9a65a6b586c0f891460cb2a5
from __future__ import division #!/usr/bin/python3 # idVendor 0x0b9c # idProduct 0x0315 import binascii import time import vlc import numpy as np forestFile = "/home/pi/PulsePlayer/sounds/jura.wav" cityFile = "/home/pi/PulsePlayer/sounds/miestas.wav" cat = vlc.MediaPlayer(cityFile) squirrel = vl...
14,534
9b5d7f54d23bb62ada83125cd772451235ddf88e
# List of icons # http://kml4earth.appspot.com/icons.html import pygmaps # lat_long_list = [(30.3358376, 77.8701919), (30.307977, 78.048457), (30.3216419, 78.0413095), (30.3427904, 77.886958), (30.378598, 77.825396), (30.3548185, 77.8460573), (30.3345816, 78.0537813), (30.387299, 78.090614), (30.3272198, 78.03...
14,535
3c4a1302f2b6684d9178e116294bef0478f22e72
from datetime import datetime from stock import stock import math import time import webbrowser import netsvc import openerp.exceptions from osv import osv, fields from openerp.tools.translate import _ import openerp.addons.decimal_precision as dp class absensi(osv.osv): _name = 'absensi' _description = 'absensi' _...
14,536
7b82092953acc32dc12c64cc47b2f3fd86717e59
#模块的查找顺序 内存:sys.modules->内建->最后找sys.path import sys print(sys.path)#模块查找顺序 #加载不在当前路径的模块 sys.path.append('D:\\python\\project\\面向对象') import new
14,537
5c992638f24efa703f1a97df0939dc4ecd595178
from django.shortcuts import render, redirect # Create your views here. def index(request): # first time user experience if 'username' not in request.session: request.session['username'] = 'New User' request.session['users'] = [] context = { 'username': request.session['username'],...
14,538
41d825d92b57f0acad66e503e4b7e2fee877260d
from random import random, randint import time def time_complite(func): def proc(n): start_time = time.time() result = func(n) finish_time = time.time() delta = round(finish_time - start_time, 4) print(delta) return result return proc @time_complite def point_...
14,539
ab0a77ebbea8a9382578288a1bef2e13938168a2
# Generated by Django 3.0.14 on 2021-05-29 20:58 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Book', '0003_auto_20210530_0119'), ] operations = [ migrations.RemoveField( model_name='books', name='visits', ...
14,540
4cb4d4421c7f6fb9e73fcf18375113af345ea3fd
# -*- encoding:utf-8 -*- """ company:IT author:pengjinfu project:js time:2020.5.1 """ from info import user, pwd import requests import execjs import asyncio class Login(): def __init__(self): self.session = requests.Session() async def get_js_info(self): with open('fangtianxia.js', 'r') as ...
14,541
6ec2edac4e434a9782fb45ee0ab059bbf4819c05
import json import psycopg2 import os import time import re import random import sys start_time = time.perf_counter() MYDSN = "dbname=movie_json_test user=movie_json_user password=Change_me_1st! host=127.0.0.1"; cnx = psycopg2.connect(MYDSN) cnx.set_session(readonly=True, autocommit=True) cursor = cnx.cursor() cu...
14,542
317d791a182015deb0b075dcde8db32ed2222c2c
import sys, os reverseSelection=True def separate(inPath, outPath, listFname): readPrefixes=[] with open(listFname) as f: for line in f: readPrefixes.append( line.split()[0].upper() ) for fname in os.listdir(inPath): isInList= fname.split(".")[0] in readPrefixes if (not reverseSelection and isIn...
14,543
d2aa4d653fbd70455015bd8f82c863db699b90e0
import logging import time from modules.core.props import Property, StepProperty from modules.core.step import StepBase from modules import cbpi @cbpi.step class BringToTempOverTime(StepBase): # Properties kettle = StepProperty.Kettle("Kettle") temp = Property.Number("Temperature", configurable=True) ...
14,544
9df228e4cbefc40db6b37607eaf473b8e94df79a
from sys import argv from os.path import exists script, from_file, to_file = argv # put cmd line args into vars print "Copying file from %s to %s." % (from_file, to_file) indata = open(from_file).read() # open and read from_file, put contents in indata out_file = open(to_file, 'w') # open the file in write mode out_...
14,545
ab40f147980e0e69f3bdb600f2d74a432e4b4792
import requests from bs4 import BeautifulSoup import re url = "http://python123.io/ws/demo.html" r = requests.get(url) demo = r.text soup = BeautifulSoup(demo, "html.parser") for link in soup.find_all("a"): # find_all() # print(link) print(link.get('href')) print('-'*50) print("含course属性的a标签:\n",soup.find_...
14,546
8d1e6a54cd1df4e57efe096eb222f0ab89cf7f15
#!/usr/bin/python3 -u import os import paho.mqtt.client as mqtt import paho.mqtt.publish as publish MQTT_HOST=os.getenv("MQTT_HOST", "test.mosquitto.org").strip() print("Will connect to "+str(MQTT_HOST)) # The callback for when the client receives a CONNACK response from the server. def on_connect(client, userdata, f...
14,547
cb4b4bab8e328e3dbaf8fdce9083f47947ae56b0
r, c = map(int, input().split()) a = [list(map(int, input().split())), list(map(int, input().split()))] print(a[r - 1][c - 1])
14,548
cd78d220a67b73d774559c42c395d9662e125ebc
import serial #import time import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation #from datetime import datetime #dt = datetime.now() #dt.microsecond import csv ser = serial.Serial('COM13', 115200) with open('middle.csv', 'w', newline ='') as f: writer = csv.write...
14,549
444a680c9df110d8fab919def46693c14619288f
# """ # 装饰器的功能: # 1.引入日志 # 2.函数执行时间的统计 # 3.执行函数前预备处理,如flask的请求钩子 # 4.执行函数后清理功能 # 5.权限校验等场景,如登陆验证装饰器 # 6.缓存 # """ # import time from functools import wraps import math def timefunc(func): """统计一个函数的运行时间""" @wraps(func) def wrapper(*args, **kwargs): start_time = time.time() res = func(*args,...
14,550
af27dae1dcf7dbbf940f7ddaf16114c0be263580
from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from sqlalchemy import Column, String, Integer, Date engine = create_engine("mysql+mysqldb://root:cga3026@localhost:3306/gpoascen_crm", echo=False) Session = sessionmaker(bind=engine) ...
14,551
52b25f7e697b550394ef5f96bdcb77422ba75d4f
def paintingPlan( n, k): """ :type n: int :type k: int :rtype: int """ if k==n*n: return 1 count=0 def get(num): num1 =1 for i in range(1,num+1): num1 =num1*i num2 =1 for j in range(n,n-num,-1): num2=num2*j return nu...
14,552
9d42c369f0bc85153cd5c91b67506c183b57e8ec
import logging from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.decorators import login_required from django.shortcuts import get_object_or_404, render, redirect from django.urls import reverse, reverse_lazy from django.views.generic.edit import (CreateView, DeleteView, FormView, ...
14,553
f1133a749b0462ad646eef34bd159f49dcbf8bc9
""" 3. Массив размером 2m + 1, где m – натуральное число, заполнен случайным образом. Найдите в массиве медиану. Медианой называется элемент ряда, делящий его на две равные по длине части: в одной находятся элементы, которые не меньше медианы, в другой – не больше медианы. Задачу можно решить без сортировки исходного ...
14,554
6c6393732c5279dcd256da72c6b14587424887a3
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jun 24 10:36:49 2018 @author: hk """ import os os.getcwd() os.chdir('/Users/hk/Dropbox/TDI/Project') import pandas as pd import numpy as np import matplotlib.pyplot as plt def hIndex(citations): h = 0 for x in citations: if x >= h + 1:...
14,555
40fb4c9eb801baed07c825e74d588d6d82ffa8f9
import hashlib def hashing(word) : """ The hashing function takes a string input and converts it into a hash using the SHA256 hashing technique present in the hashlib library in python. Arguments word : a string Return Value ans : a string of hexadecimal digits corresponding to the...
14,556
ce7e97be76ef989a0a275defd42059eb37397d12
from tkinter import Tk, Label, Radiobutton, StringVar from PIL import Image, ImageTk from tkinter import filedialog from Filter import Filter from MeanBlur import MeanBlur from MedianBlur import MedianBlur from GaussianBlur import GaussianBlur from Translator import Translator from Scaler import Scaler from Rotator im...
14,557
8d1bf4226e7d59c47eeb7952914e3086efe43036
from sys import maxsize def Stack(): stack=[] return stack def isEmpty(stack): return len(stack)==0 def push(stack,item): stack.append(item) print(item+" pushed to stack ") def pop(stack): if(isEmpty(stack)): return str(-maxsize-1) return stack.pop() def top(stack): ...
14,558
93d92daf4b287c08e82195404b50b04fa1dc82ba
from unittest.mock import Mock import pytest from rest_framework.exceptions import ValidationError from rest_framework.status import ( HTTP_200_OK, HTTP_401_UNAUTHORIZED, HTTP_404_NOT_FOUND, ) from api.serializers import ProjectSerializer class TestProjectSerializer: def test_validate_project_name_...
14,559
20670c03f0a6786b0fbfccb750f20791c95bdc4e
#!/tps/bin/python -B import os, sys, json, re from math import floor import elasticsearch1, urllib3 from elasticsearch1 import helpers pwd = os.getcwd() sys.path.insert(0, '{}/msl-datalytics/src/'.format(pwd)) from spazz import * import timeit start = time.time() # from msldatalytics.src.spazz import * ...
14,560
0e263353c43ac17e54e9281dcf2d707cbb5203f6
infos = {"name":"remove_channel","require":["message","commandes","commu"],"show":2,"use":1} async def command(message,commandes,commu): if await commandes["admin"][0](message,commu): await message.delete() channs = commu[str(message.channel.category_id)][0].remove(message.channel.id) await message.channe...
14,561
d2e9b8214faf47d9ef7da72941833178caba5711
#!/usr/bin/python import sys, os, Image, time, psutil, ImageDraw import SlideshowPanel as spanel import TextureLoader as tl import numpy as np class SlideshowPlaylist: def __init__(self, _path, _scale, _fade, _titleDur, _duration, _font, _fontSize): try: f = open(_path+'titles', 'r') self.titles = ...
14,562
176e2f760b4912ba2067ed03291062835ae831c7
from p_load_points import load_points import random def initial_solution(vec): vec2 = vec[:] number_of_points = len(vec) number_of_points_for_solution = (3 * number_of_points)/5 number_of_points_for_solution = round(number_of_points_for_solution) first_solution = [] first_solution.append(0) for x in...
14,563
0c650b700edfa61ac71cbfdb5095580c1053c70d
#!/usr/bin/env python2 import json import math import os import logging import time import geojson import threading import utils from pgoapi import pgoapi from pgoapi import utilities as util from pgoapi.exceptions import NotLoggedInException, ServerSideRequestThrottlingException, ServerBusyOrOfflineException from s...
14,564
5fdc91db26ea54cf64952a041ddb43b0bfc7e0eb
# # Copyright (c) 2017, Massachusetts Institute of Technology All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # Redistributions of source code must retain the above copyright notice, this # list o...
14,565
68cc4f6bf51b9de0b6882a0e4d4b4a3f9ae543c7
import json from policyuniverse.policy import Policy from policyuniverse.expander_minimizer import expand_policy # White listed policies (e.g. the approved admin policies) can be specified here, or as an # exception to this policy. ADMIN_ACTIONS = { 'Permissions', } def policy(resource): iam_policy = Policy...
14,566
8c79b71935fa8623f77323517e4a82f3b537b101
# -*- coding: utf-8 -*- # @Time : 2019-01-09 17:41 # @Author : 彭涛 # @Site : # @File : form.py # @Software: PyCharm from django import forms from django.forms import widgets from django.forms import fields from django.forms import ModelForm from django.forms import inlineformset_factory from .models import ...
14,567
38b9e15e17ec56e02acbaa2d68ff775d387e0d46
import tensorflow as tf from tensorflow.contrib.layers.python.layers.layers import layer_norm __author__ = 'assafarbelle' def conv(in_tensor, name, kx, ky, kout, stride=None, biased=True, kernel_initializer=None, biase_initializer=None, ...
14,568
28b23181f4c2d3d6e204852b8ab0caed0347935c
import numpy as np import random # Find homography which map @p2 to @p1. # # Inputs: # @p1: point set 1. # @p2: point set 2. # # Return: Homography for @p1 and @p2. def GetHomography(p1, p2): assert isinstance(p1, np.ndarray) and isinstance(p2, np.ndarray) assert p1.shape[0] == p2.shape[0] # Build th...
14,569
bda95ecc3a31745a25b88022463802dd1ff90278
name = "Zen" print("My name is " , 2)
14,570
8b9b0b52606063c78aa47fe510925bf21a046d92
from Poker import Poker class Player: def __init__(self, name, money=2000): self._name = name self._money = money self._currentGame = None self._currentIndex = None def getName(self): return self._name def shufflePoker(self): self._currentGam...
14,571
39c39b78e3930aec1993de96dc09b7f1ddf7495e
#!/usr/bin/env python # BSD Licence # Copyright (c) 2011, Science & Technology Facilities Council (STFC) # All rights reserved. # # See the LICENSE file in the source distribution of this software for # the full license text. # subset_2d_cdat.py # # # Scripts implementing this test should subset a dataset to a given #...
14,572
b14f16475f98ff71584e2ce3d4afbbebadfcc7d1
# -*- coding: utf-8 -*- import unittest from http_clients import * from stomp_client import * from mqtt_client import * import sys import logging import json logger = logging.getLogger() logger.level = logging.INFO stream_handler = logging.StreamHandler(sys.stdout) logger.addHandler(stream_handler) # For tests to ...
14,573
c46adae45f24696128e2c93724002ce030cd90dd
#!/usr/bin/python # Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # SPDX-License-Identifier: MIT-0 # Import modules from loremipsum import get_sentences import boto3 import names import random import string import signal import math import time import sys # Global variables dynamod...
14,574
281d7ba1aa0b720a467e151c4fb9c11c0114d42a
# Digit Fifth Powers https://projecteuler.net/problem=30 def sumOfFifthPower(n): digits = [int(i) for i in str(n)] result = 0 for j in digits: result = result + j**5 return result digitFifthPowers = [] for n in range(2, 1000000): if(n == sumOfFifthPower(n)): digitFifthPow...
14,575
64cd02e6f4b9b6d866af0f120106a17c48b309fe
import re from datetime import datetime import smtplib sender = input ("Enter sender email: ") password = input("Enter password: ") receiver = input("Enter receiver email: ") with open("domain_out.txt", "r") as f: content = f.read() pattern = "\d{4}[/.-]\w{2,3}[/.-]\d{2}|\d{8}|\d{1,2}[/.-]\w{1,3}[/.-]\d{4}|\w{1,4...
14,576
078575eadd8ea4822a948f90c8a2d02d08772721
class Counter: def __init__(self): self.count = 0 def count_up(self, channel): self.count += 1 print('GPIO%02d count=%d' % (channel, self.count)) def __eq__(self, other): return self.count == other def __lt__(self, other): return self.count < other def main()...
14,577
f0fdf95627426b1f15dba33cda0fd013937c2c96
import tensorflow as tf import numpy as np # restore variables # redefine the same shape and same type for your variables W = tf.Variable(np.arange(6).reshape(2, 3), dtype=tf.float32, name='Weights')#name must be the same with saver b = tf.Variable(np.arange(3).reshape(1, 3), dtype=tf.float32, name='biases') # not ne...
14,578
aa51b1a271afed28c2a84ce14dec6f43405bc618
# Please write your HelloWorld.py code and commit it! print'hello word'
14,579
c46fe4e3846b0ac73e756410853500e9ce500248
from django.db import models class Document(models.Model): category = models.CharField(max_length=20) content = models.TextField() url = models.TextField() class MongoMeta: db_table = "DocsManageApp_document" def __str__(self): return self.content class Category(models.Model): ...
14,580
c9ba4229c9d87c8ca08f86f43a3d144be0d954ae
# Author: Sean Fallon # Shout out to Kenneth Love # Date Created: # Date Changed: # All standard imports used in Django from django.http import HttpResponse from django.shortcuts import render_to_response , get_object_or_404 from django.template import RequestContext # Custom from epictools.models import epicTools, P...
14,581
c8d41e8d476504b5c8bc44fc925bd071efe10d13
from itertools import product arrays = [(-1,1),(-3,3),(-5,5)] cp = list(product(*arrays)) print(cp)
14,582
a2e659e87772ca15c81a402fc75aad580fb05c7d
# coding: utf-8 from rqalpha import run_func from rqalpha.api import * import talib from sklearn.model_selection import train_test_split import time from datetime import datetime, timedelta import warnings import numpy as np from numpy import newaxis from keras.layers.core import Dense, Activation, Dropout from keras....
14,583
b2e7eff1be1bca92fbb717a4f4690b9098d17e7a
import turtle def draw_art(): turtle.shape("turtle") turtle.color("red") turtle.speed('slow') for i in range(1, 37): turtle.right(20) turtle.right(90) turtle.forward(300) if __name__ == '__main__': draw_art()
14,584
e0c24c1721667289789d1537611cdc189013e287
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-05-23 13:30 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion import uuid class Migration(migrations.Migration): dependencies = [ ('accounts', '0002...
14,585
7613a24a637dccc315cbaf8220605e59d46ce1e7
from django.apps import AppConfig class DOTConfig(AppConfig): name = "azure_ad_sso" verbose_name = "Django Azure Active Directory Single-Sign-On"
14,586
ca002dcb5aeddf98620cfa9b1977f8b803f46717
# -*- coding: mbcs -*- from part import * from material import * from section import * from assembly import * from step import * from interaction import * from load import * from mesh import * from optimization import * from job import * from sketch import * from visualization import * from connectorBehavior import * i...
14,587
74792f29918f3195ede3621db5396c6023cb0ee6
import luigi from luigi.contrib.external_program import ExternalProgramTask from os import path from .utils import MetaOutputHandler from .utils import Wget from .utils import GlobalParams from .reference import ReferenceGenome from .align import FastqAlign class SortSam(ExternalProgramTask): def requires(self): ...
14,588
def2729bd2634c947ea50cde869f54db81f92967
"""Discovery service for UniFi.""" import voluptuous as vol from supervisor.validate import network_port from ..const import ATTR_HOST, ATTR_PORT SCHEMA = vol.Schema( {vol.Required(ATTR_HOST): vol.Coerce(str), vol.Required(ATTR_PORT): network_port} )
14,589
04e1b6ff2ead4ada8d9e3d04cd1735a95e628437
from calculos.basicos.operacionesBasicas import * dividir(4, 2)
14,590
d1813a621a1158f4d1d5641d31aa45b9dcb7c206
import imaplib import sys from recover import * FILE_NAME = 'mail_address' # Nombre del archivo con las direcciones a analizar # Datos del usuario (dirección de correo y contraseña) cred = open('credentials', 'r') lines = cred.readlines() USR_EMAIL = lines[0].strip('\n') # Correo electrónico USR_PW = li...
14,591
890c13a0d8b6afc49f40c39709d8a8e802a883bb
# coding=utf-8 import socket def get_plugin_info(): plugin_info = { "name": "Jetty 共享缓存区远程泄露", "info": "攻击者可利用此漏洞获取其他用户的请求信息,进而获取其权限", "exp_url": "https://www.secpulse.com/archives/4911.html", "other": "tag:jetty", "docker": "" } return plugin_info def check(ip, p...
14,592
6504c4bf81317f2403567cfa52a2a5d5ac108abd
#!/usr/bin/env python import hid class dna75: _vendorId = 0x268b _productId = 0x0408 def __init__(self): self._connect() def _connect(self): self.h = hid.device() self.h.open(self._vendorId, self._productId) self.h.set_nonblocking(1) print('Connecting %s [%s]...
14,593
984ebb830e8dedb5e4257f1eb553b6428a27ab11
#Exploring Datasets with pandas and Matplotlib #A pie chart is a circualr graphic that displays numeric proportions by dividing a circle (or pie) into proportional slices. You are most likely already familiar with pie charts as it is widely used in business and media. We can create pie charts in Matplotlib by pass...
14,594
7830f535d19a039aad8696202c3876231e1a2415
""" __author__: Kevin Chau __description: Quantify RNA-seq samples with Kallisto """ import os import subprocess def quantify(kallisto, fq_dir, transcriptome): """Quantify the passed FASTQ files using a subprocess call to Kallisto @param kallisto Path to kallisto executable @param fq_dir ...
14,595
c45234fcad6d0a0283b7926d891a029a2b31840f
from essentials import * import pygame, sys from pygame.locals import * import types class Instance: #Start def __init__ (self,name,resolution,background_color): #Start pygame.init() self.screen = pygame.display.set_mode(resolution) #Title pygame.display.set_caption(name) #Game clo...
14,596
5581493f5c7455c64abee4f54f7850704ebd5a9e
from typing import List class Solution: def calculateMinimumHP(self, dungeon: List[List[int]]) -> int: rows = len(dungeon) cols = len(dungeon[0]) dp = [[9999 for _ in range(cols + 1)] for _ in range(rows + 1)] dp[rows][cols - 1] = 1 dp[rows - 1][cols] = 1 for i in...
14,597
0a3a4cd7019219bf719df8e30f4e1101b3d1a21f
def list_com(array): new_array = [] for number in array: if number % 2 == 0: number = number ** 2 else: number = int(number ** 0.5) new_array.append(number) return new_array print(list_com([1, 56, 34, 78, 55, 90, 11, 73]))
14,598
d2d316fd509f6779a9614eceab036e4f28b6d1ab
""" Implement an alghorithm to determine if a sting has all unique characters. What if you can't use additional data structures? """ def is_unique_n_2(string: str) -> bool: """ We take the first character and check for all letters if we found a copy of it. This is going to take O(n ^ 2) time and O(...
14,599
c3aa0272e928821b6be23340e9c2a846003bd6ca
from .base import * DEBUG = True COMPRESS_OFFLINE = True LIBSASS_OUTPUT_STYLE = 'compressed' STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.ses...