text stringlengths 8 6.05M |
|---|
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
import os.path
from PyQt4 import QtCore, QtGui
QtCore.Signal = QtCore.pyqtSignal
import vtk
from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
class VTKFrame(QtGui.QFrame):
def __init__(self, parent = None):
super(VTKFrame,... |
#!/usr/bin/python
# -*-coding:gbk-*-
import random
import demjson
import os
def randomProxy(isPrint=True):
curr_dir = os.path.dirname(os.path.realpath(__file__))
file = open(curr_dir + os.sep + ".." + os.sep + "conf" + os.sep + "ip.json")
jsontext = file.read()
file.close()
ip_pool = demjson.deco... |
"""
This module demonstrates the WAIT-FOR-EVENT pattern implemented
by using a WHILE loop using the ITCH pattern:
Initialize as needed so that the CONDITION can be TESTED.
while <some CONDITION>: # Test the CONDITION, continue WHILE it is true.
...
...
CHange something that (eventually) affe... |
import requests
from bs4 import BeautifulSoup
print "THIS IS FROM TOI- BUSINESS" + '\n'
r = requests.get("http://timesofindia.indiatimes.com/business")
soup = BeautifulSoup(r.content)
linksTOImain = soup.find_all("div",{"class":"ct1stry"})
for item in linksTOImain:
for kuch in item.contents:
print... |
"""
子图:
"""
from matplotlib import pyplot as plt
import numpy as np
x = np.arange(1, 4)
# 方法1:add_subplot()方法
fig1 = plt.figure()
# 表示生成2*2个图形,左上角标号是1,右上角标号是2
ax1 = fig1.add_subplot(2, 2, 1)
# ax1 = fig1.add_subplot(221) 当每个数字都小于10的时候,两者等价
ax1.plot(x, x**2)
# 方法2:plt.subplot()与方法1类似
# 方法3:plt.axes()函数
fig2 = plt.figu... |
__author__ = 'Elisabetta Ronchieri'
VERSION = (2, 0, 1, 13)
def get_version():
version = '%s.%s.%s-%s' % (VERSION[0], VERSION[1], VERSION[2], VERSION[3])
from tstorm.utils.version import get_svn_revision
svn_rev = get_svn_revision()
if svn_rev != u'SVN-unknown':
version = "%s %s" % (version, s... |
import urllib.request
import requests
import bs4
proxies=[]
def get(url: str, header: list = {}):
"""
HTTP GET获取
:param url: URL地址
:param header: HTTP头
:return: row
"""
header['Accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
header['Accept-Lan... |
import sys
import json
import queue
f = open(sys.argv[1], 'r')
lines = f.read()
lines = lines.replace('\n', '')
lines = lines.split(';')
pipt = []
popt = []
assign = []
submodule = {}
jsobj = json.load(open(sys.argv[2]))
sdfobj = json.load(open(sys.argv[3]))
ipt = {}
wire_connect = {}
que = queue.Queue... |
# Стратегии платежной матрицы
N = 3
A1 = [30 + N, 10, 20, 25 + N/2]
A2 = [50, 70 - N, 10 + N/2, 25]
A3 = [25 - N/2, 35, 40, 60 - N/2]
matrix_A = [A1, A2, A3]
# Вероятности наступления исходов со стороны оппонента
q1 = 0.3
q2 = 0.2
q3 = 0.4
q4 = 0.1
q = [q1, q2, q3, q4]
# Функция для поиска оптимальной страт... |
import os
import cv2
def generate_video_labels():
video_content = '''
<video id="video" controls="controls" preload="none" width="300" height="300" poster='{}'>
<source id="mp4" src="{}" type="video/mp4">
<p>Your user agent does not support the HTML5 Video element.</p>
</video>
'''
... |
# from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404, redirect
from django.contrib.auth.decorators import login_required
from django.utils import timezone
from django.urls import reverse_lazy
# from django.shortcuts import render
from django.contrib.auth.mixins import LoginRequi... |
def prime_number():
for num in range(1,101):
if num>1:
for i in range(2,num):
if num % i==0:
break
else:
print(num)
def palindrome_checker():
string=input('Enter a String. ')
new_str=string[::-1]
if string==new_str:
... |
# coding: utf-8
import datetime
import os
import numpy as np
import tensorflow as tf
import time
import cfg
from word2vec import W2VModelManager
from data_helpers import load_csv
from source.text_cnn.text_cnn import TextCNN
# 参数
tf.flags.DEFINE_float('dev_sample_percentage', .005, '验证集比例')
tf.flags.DEFINE_string('tra... |
from datetime import datetime as dt
from utils.objects import Map
def is_api_available(data: Map) -> bool:
""" Функция проверяет доступность АПИ по временному интервалу
:param data: Объект Map с настройками
:return: bool
"""
dt_from = data.get('unavailable_from_dt', '')
if dt_from:
dt... |
# encoding=utf8
from flask import Blueprint
from flask import jsonify
from shutil import copyfile, move
from google.cloud import storage
from google.cloud import bigquery
import dataflow_pipeline.claro.claro_campanas_beam as claro_campanas_beam
import dataflow_pipeline.claro.claro_seguimiento_beam as claro_seguimiento_... |
# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
#!/usr/bin/env python3
#
import re, base64, logging, pickle, httplib2, time, urlparse, urllib2, urllib, St... |
# uses the previous homework written by Zhiwang Wang
import math, random
random.seed(0)
## ================================================================
# calculate a random number a <= rand < b
def rand(a, b):
return (b - a) * random.random() + a
def make_matrix(I, J, fill=0.0):
m = []
for i in ran... |
# parser.py
import requests
from bs4 import BeautifulSoup as bs
import sys
import os
import datetime
from pymongo import MongoClient
new = []
def scrape_html(url):
req = requests.get(url)
return bs(req.text, 'html.parser')
def mongoConnection(dict):
client = MongoClient('localhost', 27017)
db = cli... |
import pyglet
import pyglet.gl as gl
class Visualizer(pyglet.window.Window):
def __init__(self,*args,**kwargs):
super().__init__(*args, **kwargs)
#pyglet.app.run()
def on_draw(self):
self.window.clear()
gl.glEnable(gl.GL_DEPTH_TEST)
gl.glEnable(gl.GL_LINE_SMOOTH)
... |
#!/usr/bin/env python3
from argparse import ArgumentParser
import os
from .lib import utils
from . import detector
from . import analyzer
from . import doc_collector
from . import doc_analyzer
from . import builder
from . import evaluator
modules = {
'build': builder.build,
'generate-bc': builder.generate_bc,... |
Arreglo=input("Ingrese los números reales del arreglo(separados por un espacio): ").split()
for i in range(len(Arreglo)):
Arreglo[i]=float(Arreglo[i])
promedio=sum(Arreglo)/len(Arreglo)
print("El promedio del arreglo de reales es de:",promedio)
|
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-28 04:11
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... |
# Import necessary classes
from django.conf.urls import url
from django.http import HttpResponse, HttpResponseNotFound, HttpResponseRedirect
from django.shortcuts import get_object_or_404, redirect
from django.shortcuts import render
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.... |
import os
import pathlib
from typing import List
import boto3
import botocore
def s3_bucket_exists(name: str) -> bool:
s3 = boto3.client("s3")
try:
s3.head_bucket(Bucket=name)
except botocore.exceptions.ClientError as e:
print(e)
return False
return True
def s3_get_object_na... |
#!/usr/bin/python
#!/nasa/python/2.7.3/bin/python
# graphPosterLine.py
# by: Mike Pozulp
# same as graphLine, but make
# the plot and font bigger for
# purposes of legibility
import matplotlib.pyplot as plt
import pylab
import csv
import sys
import numpy
# allow for assignment of
# different color to each line
count... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 4 20:12:40 2019
@author: Zackerman24
"""
import numpy as np
import game_setup as gs
"""There's probably a way of creating six separate lists for each letter
and then combining them into one array. Look into this after?"""
base_array = np.arr... |
import os
import sys
#
# Complete the timeConversion function below.
#
def timeConversion(s):
a = s[-2:] #PM
s1 = s[:-2]
hour = s1[:2] #07
rest = s1[2:] #:09:45
check = hour+rest
conversion = int(hour)
#print(int(h)-12) #prints everything except last two letters 12:09:45
#print(a) #pr... |
#B
men3=[int(q) for q in input().split()]
print(abs(men3[0]-men3[1]))
|
6# -*- coding: utf-8 -*-
"""
Spyder Editor
Dies ist eine temporäre Skriptdatei.
"""
import matplotlib.pyplot as plt
import numpy as np
img = plt.imread("test.png")
rgb_weights = [0.2989, 0.5870, 0.1140]
#plt.imshow(img)
grayscale_image = np.dot(img[...,:3], rgb_weights)
plt.imshow(grayscale_image, cmap = plt.get_... |
"""
A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N.
For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary representation 1000010001 and contai... |
# -*- coding: utf-8 -*-
# Copyright 2019 the HERA Project
# Licensed under the MIT License
import warnings
import pytest
import numpy as np
from copy import deepcopy
import os
import sys
import shutil
from scipy import constants, interpolate
from pyuvdata import UVCal, UVData
from hera_sim import noise
from uvtools imp... |
from django.contrib import admin
from .models import Service, Position, Employee, Feature, Plan, Client
@admin.register(Position)
class PositionAdmin(admin.ModelAdmin):
list_display = ('position', 'active', 'modified')
@admin.register(Service)
class ServiceAdmin(admin.ModelAdmin):
list_display = ('service',... |
import keras as k
from keras.models import Graph
from keras.layers.core import *
from keras.layers.convolutional import *
from keras.layers.normalization import BatchNormalization
from keras import backend as K
from data_utils import *
from collections import defaultdict
import random
#########################
### U... |
import pyscreenshot
import numpy as np
import cv2
import os
class DistanceDetector:
x1 = 66
x2 = 760 + x1
y1 = 450
y2 = 800 + y1
def __init__(self):
self.step = 0
def screen_shoot(self):
im = pyscreenshot.grab(bbox=(self.x1, self.y1, self.x2, self.y2))
self.im = np.arr... |
import npyscreen
import argparse
ADDRESS=''
class TCUMonitorForm(npyscreen.Form):
def afterEditing(self):
self.parentApp.setNextForm(None)
def create(self):
self.keypress_timeout = 10 # refresh period in 100ms (10 = 1s)
self.text_address = self.add(npyscreen.TitleText, name='IP Addr... |
import unittest
from katas.kyu_6.take_a_num_and_sum_digits_to_consecutive_powers import \
sum_dig_pow
class SumDigitsToConsecutivePowersTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(sum_dig_pow(1, 10), [1, 2, 3, 4, 5, 6, 7, 8, 9])
def test_equals_2(self):
self.asse... |
def bad_filename(filename):
return repr(filename)[1:-1]
try:
print filename
except UnicodeEncodeError:
print bad_filename() |
import subprocess
import os
import sys
import re
sys.path.insert(0, 'scripts')
sys.path.insert(0, os.path.join("tools", "families"))
import simulations_common
import experiments as exp
import fam
datasets = []
cores = 40
subst_model = "GTR+G"
gene_trees = ["raxml-ng"]
launch_mode = "normald"
replicates = range(3000, 3... |
from django.shortcuts import render
from django.views import View
from db.login_mixin import LoginRequiredMixin
from .models import Position
from enterprice.models import EnterPrice
# Create your views here.
class JobCustomizeView(LoginRequiredMixin,View):
'''岗位订阅'''
def get(self,request):
return render... |
# Generated by Django 2.2.1 on 2019-05-18 02:01
from django.db import migrations, models
import django.utils.timezone
import filebrowser.fields
class Migration(migrations.Migration):
dependencies = [
('posts', '0003_auto_20190518_0117'),
]
operations = [
migrations.AlterModelOptions(
... |
"""
Greedily prune a set of conformers.
Usage:
python main.py input 0.1 10
"""
def ignore_smiles(systems, patterns, align_dir):
"""
"""
from openbabel.openbabel import OBSmartsPattern, OBAtomBondIter
remove_dict = {x: [] for x in systems}
# Find the atoms to remove using the smart patterns.... |
from __future__ import print_function
import numpy as np
import cv2
import sys
import glob
import os
if __name__ == '__main__':
min_size = (30,30)
max_size = (60,60)
haar_scale = 1.2
min_neighbors = 3
haar_flags = 0
face_cascade = cv2.CascadeClassifier('/opt/ros/kinetic/share/OpenCV-3.3.1-dev... |
import logging
class numList:
"""This is a numList class.
Attributes:
:maxMin (tuple): tuple of the Max and Min values in the list
:max_diff (list): list of the highest diff between 2 adj values in list
:list_add (int): sum of all the values in the list
"""
def __init__(se... |
# Generated by Django 3.1.4 on 2021-01-03 02:54
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('Blog', '0004_remove_starred_save'),
]
operations... |
import re
import tkinter
from tkinter import filedialog
import threading
import src
from src import CNF
from src.CNF import ClauseSet, Clause
class gui_window:
def __init__(self, name):
self.mainframe = tkinter.Tk()
self.mainframe.title(name)
self.mainframe.geometry("200x200")
sel... |
print(6*(1-2)) |
import sdl2.ext
class MenuRenderer(sdl2.ext.SoftwareSpriteRenderSystem):
def __init__(self, window):
super(MenuRenderer, self).__init__(window)
def render(self, components, x=None, y=None):
sdl2.ext.fill(self.surface, sdl2.ext.Color(128, 128, 128))
super(MenuRenderer, self).render(com... |
rule hisat2:
input:fwd="outData/trimmed/{sample}_clean_R1.fq.gz",
rev="outData/trimmed/{sample}_clean_R2.fq.gz"
output:sam="outData/hisat2/{sample}.sam",
log="outData/hisat2/{sample}.log"
params:index=config["ref"]["index"]
threads:config["threads"]
message:"""--- Hisat2 Mapping.---"""
shell:""... |
# RachelPotterCH7P1.py
# A program that calculates a person's BMI and determines if it is in a healthy range
def get_bmi():
weight = float(input("Enter your weight in pounds: "))
height = float(input("Enter your height in inches: "))
bmi = (weight * 720)/(height**2)
print("Your BMI is", round(bmi, 2))... |
#-*- coding: UTF-8 -*-
import numpy as np
import operator
import os
from os import listdir
# Doses begin
#读取文件为numpy数据,
def file2matrix(filename):
fp = open(filename)
lines = fp.readlines()
num_of_lines = len(lines)
ret_mat = np.zeros((num_of_lines, 3))
label = []
index = 0
for line in lin... |
from ui.AddSiteWindow_ui import Ui_AddSiteWindow
from PyQt5.QtWidgets import QDialog
class AddSiteWindow(QDialog, Ui_AddSiteWindow):
def __init__(self, parent):
super().__init__(parent)
self.setupUi(self)
self.buttonBox.accepted.connect(self.inputSiteName)
self.buttonBox.rejected.c... |
# Generated by Django 2.0.3 on 2018-03-16 05:26
import ckeditor.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('static_pages', '0003_auto_20180313_0411'),
]
operations = [
migrations.AlterField(
model_name='page',
... |
from django import forms
from orders.models import ConatacForm
class ContactForm(forms.ModelForm):
class Meta:
model = ConatacForm
fields = ['name', 'telephone']
|
# Generated by Django 2.0.7 on 2020-08-10 09:03
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='comment',
fields=[
... |
def knight_or_knave(said):
return 'Knight!' if eval(str(said)) else 'Knave! Do not trust.'
|
import unittest
import logging
import sys
VERBOSITY = 0
LOGGER = logging.getLogger()
LOGGER.setLevel(logging.DEBUG)
# Adding some niceness to the default TextTestRunner, test totals, etc
class CustomRunner(unittest.TextTestRunner):
def run(self, test):
ran_count = 0
errors = []
failures = ... |
#!/usr/bin/python3
import matplotlib.pyplot as plt
import numpy as np
import audio
import effects
def plot_io(xn: list, yn: list, fs: float, n: int = -1):
f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, sharex='col', sharey='row')
xn_l = xn if n < 1 else xn[0:n]
yn_l = yn if n < 1 else yn[0:n]
Xn = np.ff... |
n1 = int(input('Type a number'))
n2 = int(input('Type a more number'))
n3 = int(input('Type other number'))
if n1>n2 and n1>n3:
biggest = n1
if n2>n1 and n2>n3:
biggest = n2
if n3>n1 and n3>n2:
biggest = n3
if n1<n2 and n1<n3:
smaller = n1
if n2<n1 and n2<n3:
smaller = n2
if n3<n1 and n3<n2:
... |
text = "I am from Chennai"
for i in range(len(text)):
if(text[i] == 'f'):
print("position of f is ",i)
break |
"""Mealy Machine : md-réduction, dualisation, inversion, produit, factorisation..."""
from copy import deepcopy
from graphviz import Digraph
from sympy.combinatorics.perm_groups import PermutationGroup
from sympy.combinatorics import Permutation
import igraph
Permutation.print_cyclic = True
class MealyMachine:
"... |
from rest_framework import viewsets
from .serializers import (MovieSerializer, ShowingRoomSerializer, ShowingSerializer, OrderSerializer)
from .models import (Movie, ShowingRoom, Showing, Order, Status)
class MovieViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows you to create new Movie and get all... |
"""
CCT 建模优化代码
工具集
作者:赵润晓
日期:2021年6月12日
"""
# 超导线材临界电流关键点
magnet_field_critical_points = [6, 7, 8, 9]
current_critical_points = [795, 620, 445, 275]
# cct 单线电流和表面最大磁场
current = 444 # 588
max_magnet_field = 4.39 # 4.00
# ---------------------------------------------------------------------------------------- #
impo... |
from flask_wtf import FlaskForm
from wtforms import TextAreaField, TextField
from wtforms.validators import DataRequired
from widgets import SubmitButtonField
class NewCommentForm(FlaskForm):
comment = TextAreaField("comment", validators=[DataRequired("You need to enter a comment.")], render_kw={
"placeho... |
class Solution:
def reorderLogFiles(self, logs: List[str]) -> List[str]:
n = len(logs)
res1, res2 = [], []
for sub in logs:
tmp = sub.strip().split(' ')
if tmp[1].isdigit():
res1.append(sub)
else:
res2.append(sub)
r... |
import read
import facts_and_rules
facts, rules = read.read_tokenize("statements_backup.txt")
global KB
KB = []
global RB
RB = []
def assert_rule(rule):
if rule not in RB:
RB.append(rule)
infer_from_rule(rule)
def assert_fact(fact):
if fact not in KB:
KB.append(fact)
infer_f... |
from setuptools import setup
setup(
name='overpass',
packages=['overpass'],
version='0.1.0',
description='Python wrapper for the OpenStreetMap Overpass API',
author='Martijn van Exel',
author_email='m@rtijn.org',
url='https://github.com/mvexel/overpass-api-python-wrapper',
download_url=... |
def foo():
# hmps!
|
#activation function
#gradient dof the activation function
#add bias
#feed forward
#encoding the labels
#calculate the cost function
#gradient with respect to the weights
#initialize those weights
import struct
import numpy as np
import matplotlib.pyplot as plt
import os
from scipy.special import expit
def load_data(... |
import RPi.GPIO as GPIO
import time
x = 0.1
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.OUT)
GPIO.output(4, GPIO.LOW)
while True:
GPIO.output(4, GPIO.HIGH)
time.sleep(x)
GPIO.output(4, GPIO.LOW)
time.sleep(x)
GPIO.cleanup()
|
import scrapy
import sys
import string
import urllib
from urllib.request import urlopen
from urllib.parse import urlparse
import socket
from datetime import datetime
from bs4 import BeautifulSoup
import requests
from ..items import SihItem
def get_last_modified(url):
result = urlparse(url)
if True if [... |
from msvcrt import getch
charkey = getch()
if(key == 32):
print('you pressed space') |
from DominoExceptions import EndGameException
from Solitaire import Solitaire
class AutoPlaySolitaire(Solitaire):
TESTED_SOLUTION = {}
MATCH_COUNT = 0
def auto_play(self):
"""TODO Returns a solution, if any. None otherwise"""
try:
self.auto_play_helper()
except EndGa... |
#!/usr/bin/env python
import sys
import time
import os.path
import datetime
import logging
from operator import attrgetter
from functools import partial
import click
from click_datetime import Datetime
from finam import (Exporter,
Timeframe,
Market,
FinamExport... |
import json
import pickle
from bisect import bisect_left, bisect_right
from datetime import datetime, timedelta
from collections import defaultdict
import numpy as np
import pandas as pd
from tqdm import tqdm
from sklearn.model_selection import train_test_split
import torch
from torch.utils.data import Dataset, DataLoa... |
from django.contrib import admin
from .models import Realtor, Immo
# Register your models here.
@admin.register(Realtor)
class RealtorAdmin(admin.ModelAdmin):
pass
@admin.register(Immo)
class ImmoAdmin(admin.ModelAdmin):
pass |
print("Master")
print("Check Command") |
from flask_wtf import FlaskForm
from wtforms import SubmitField, IntegerField
from wtforms.validators import DataRequired
class PrintLabelsForm(FlaskForm):
start_from = IntegerField('Start from', validators=[DataRequired()])
page_count = IntegerField('Page count', validators=[DataRequired()])
submit = Sub... |
from selenium import webdriver
import random
from selenium.webdriver.common.keys import Keys
from time import sleep
from easygui import passwordbox
# Lưu ý: Cần đặt file chromedriver chung bên cạnh để có thể chạy chương trình
x = 'yes'
while x == 'yes' :
# 1.1 nhập username fb
username = input("USERN... |
from pathlib import Path
from dotenv import load_dotenv
import os
load_dotenv()
BASE_DIR = Path(__file__).resolve().parent.parent
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'ui/'), ]
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
MEDIA_URL = '/m... |
ns = []
try:
while True:
n = float(input())
ns.append( [n] )
except:
pass
for i in range (0,len(ns) - 1):
for j in range (0,len(ns) - i - 1):
ns[j].append( (pow(2, i + 1) * ns[j + 1][i] - ns[j][i]) / (pow(2, i + 1) - 1) )
print('N:', ns[0][len(ns[0]) - 1]) |
import tensorflow as tf
import os
from skimage import io
import matplotlib.pyplot as plt
import numpy as np
import argparse
def decode_labels(image, label):
""" store label data to colored images """
layer1 = [255, 0, 0]
layer2 = [255, 165, 0]
layer3 = [255, 255, 0]
layer4 = [0, 255, ... |
import pytest
pytest_plugins = ['session_log_fixture', 'current_stack_fixture'] |
import xlrd
from collections import Counter
from matplotlib import pyplot as plt
colors = ["red","coral","green","yellow","orange","purple","Indigo"]
data = xlrd.open_workbook('dataFood.xlsx')
table = data.sheet_by_name(u'愛評網')
cityCounter = Counter()
for x in table.col_values(2):
cityCounter.update([x])
topsix... |
# Purpose: Manages the QActions that are bound to hotkeys
from .KeyBind import KeyBind
from .KeyBinds import KeyBindsByID
from bsp.leveleditor import LEGlobals
from PyQt5 import QtWidgets, QtGui, QtCore
class EditorAction(QtWidgets.QAction):
def __init__(self, text, parent, checkable, keyBindID):
QtWid... |
# This file is part of beets.
# Copyright 2019, Joris Jensen
#
# 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, including
# without limitation the rights to use, copy, mod... |
#!/usr/bin/env python
import rospy
import tf
# from nav_msgs.msg import *
# from geometry_msgs.msg import *
from gazebo_msgs.srv import GetLinkState
if __name__ == '__main__':
rospy.init_node('tf_X_broadcaster')
botframe1 = 'X1/base_link'
botframe2 = 'X2/base_link'
br = tf.TransformBroadcaster()
r... |
#Autor: Andrés Reyes Rangel
#Calcular el área de un helado (vista lateral)
radio = int(input("Ingrese el radio: "))
altura = int(input("Ingrese la altura: "))
area= (3.141592*radio**2)/ 2 + radio*altura
print ("Área= ", area) |
class Solution:
def candy(self, ratings): # 实际也是贪心
candy_list = [1]*len(ratings)
if len(ratings) == 1:
return 1
if len(ratings) == 0:
return 0
for i in range(1,len(ratings)):
if ratings[i] > ratings[i-1] and candy_list[i]<=candy_list[i-1]:
candy_list[i] = candy_list[i-1] + 1
print(candy_list)
... |
# Generated by Django 2.2.1 on 2019-05-19 02:14
from django.db import migrations, models
import filebrowser.fields
class Migration(migrations.Migration):
dependencies = [
('posts', '0007_auto_20190519_0009'),
]
operations = [
migrations.AlterField(
model_name='category',
... |
# Generated by Django 2.1.2 on 2018-10-06 10:37
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app', '0004_auto_20181006_0136'),
]
operations = [
migrations.CreateModel(
name='Project',
... |
import math
import pygame as pg
import numpy as np
class Player:
def __init__(self, start_position: list or tuple, start_angle: int, movement_speed: int, angle_speed: int, use_mouse=False, rotational_control=False, strait_control=False):
self.pos = np.array(start_position, dtype=float)
self.angle ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-13 10:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('application', '0010_auto_20170413_1526'),
]
operations = [
migrations.Alter... |
from collections import Counter
import matplotlib.pyplot as plt
import networkx as nx
import sys
import os
import re
from scipy.sparse import csr_matrix
from sklearn.cross_validation import KFold
from sklearn.linear_model import LogisticRegression
import string
import pickle
import time
from TwitterAPI import TwitterAP... |
"""
LCS
https://www.acmicpc.net/problem/9251
"""
import sys
sys.setrecursionlimit(10**5)
first_word = input()
first_word_len = len(first_word)
second_word = input()
second_word_len = len(second_word)
data = [[0] * second_word_len for _ in range(first_word_len)]
max_data = []
for i, first in enumerate(first_wor... |
import dash_bootstrap_components as dbc
from dash import html
popovers = html.Div(
[
dbc.Button(
"Hidden Arrow",
id="hide-arrow-target",
className="me-1",
n_clicks=0,
),
dbc.Popover(
"I am a popover without an arrow!",
... |
from epidemioptim.environments.cost_functions.costs.death_toll_cost import DeathToll
from epidemioptim.environments.cost_functions.costs.gdp_recess_cost import GdpRecess |
from __future__ import unicode_literals
from django.apps import AppConfig
class UserOtpConfig(AppConfig):
name = 'phoneuser'
|
#先验指纹库
matches = {
} |
# Generated by Django 3.2.5 on 2021-07-28 15:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('clinic_app', '0013_prescription_dose'),
]
operations = [
migrations.AddField(
model_name='medicine',
name='date',
... |
from .hpgl2_elm_classes import cHpgl2ElmCommand, \
cHpgl2IN, cHpgl2PG, cHpgl2RO, cHpgl2AA, cHpgl2CI, \
cHpgl2PA, cHpgl2PD, cHpgl2PU, cHpgl2LT, cHpgl2PW, \
cHpgl2SP, cHpgl2SD, cHpgl2SS, cHpgl2BP, cHpgl2PS, \
cHpgl2NP
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.