text stringlengths 8 6.05M |
|---|
import cv2
import time
class CameraView:
def __init__(self):
self.frame_count = 0
self.fps = 0
self.last_rendered_sec = int(time.time())
self.shown = True
self.display_results = True
def draw_text(self, image, text, left, bottom):
if self.display_results:
... |
#!/usr/bin/env python
import os
import sys
from django.core.management import execute_from_command_line
if __name__ == "__main__":
# Making sure we can import each app
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(PROJECT_ROOT, 'avere/apps'))
os.environ.setde... |
#!/usr/bin/python
import requests
page=requests.get('https://www.instagram.com/sooraj.s__/')
print(page.status_code)
from bs4 import BeautifulSoup
soup=BeautifulSoup(page.content,'html.parser')
soup.find_all(class_="")
txt=[soup.get_text() for m in soup]
print(txt[0])
newfile=open('text.txt','w')
newfile.write(txt[0])... |
from django.contrib import admin
from django.urls import path
from polls.views import polls_list, option_vote, polls_view, polls_index, polls_create
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns = [
path('', polls_index, name='polls-index'),
path('polls/list/', polls_list, na... |
paper = {}
counter = 0
i = 0
for i in range(10):
for j in range(10):
paper.update({(i,j):0})
while i < 50:
try:
x, y, s = list(map(int,input().split(",")))
except:
break
if s == 3:
paper[(x+2,y)] += 1
paper[(x-2,y)] += 1
paper[(x,y+2)] += 1
paper[(x,y-2)] += 1
if s >= 2:
paper[(x+1,y+1)] += 1
pap... |
'''
This module provides a set of useful functions on strings
To transform them in lists :
- `explode_protected` to explode a string in a smart way
'''
def explode_protected(delim, str, protectors = ['()']) -> list:
"""
like explode function but it will protect delimiters that are protected by protector<br... |
import random
from settings import (
BAG_SIZE,
MAX_ITENS,
POPULATION_SIZE,
SELECTION_PERCENT,
MUTATION_PERCENT,
MAX_ITERATION,
ITENS
)
from chromosome import Chromosome
from utils import (
roulette_selection,
crossover,
chromosome_is_valid,
mutate,
best,
get_bests
)
... |
import utils
import pandas as pd
import numpy as np
from sklearn.tree import DecisionTreeClassifier
from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble import AdaBoostClassifier
from sklearn.ensemble import AdaBoostRegressor
from sklearn.ensemble import BaggingRegressor
from sklearn.ensemble import Bag... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 16/4/19 下午3:17
# @Author : ZHZ
import pandas as pd
import datetime
#20151228-20160110
config = pd.read_csv("/Users/zhuohaizhen/PycharmProjects/Tianchi_Python/Data/OutputData/1_config1.csv",index_col=0)
sample = pd.read_csv("/Users/zhuohaizhen/PycharmProjects/... |
import os
from flask import Flask,request,redirect,url_for,render_template
from cfenv import AppEnv
import hdbcli
from hdbcli import dbapi
from test import request_refresh_and_access_token,get_user_info_using_access_token
from tabulate import tabulate
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
templates = o... |
def gcd(s,v):
if(v==0):
return s
else:
return gcd(v,s%v)
s1,v1=map(int,input().split())
print(gcd(s1,v1))
|
# -*- coding: utf-8 -*-
from django.db import models
from django_extensions.db.fields import AutoSlugField
from abs_models import Abs_titulado_slugfy
#from Materia.models import Materia
from Corretor.base import CorretorException,ComparadorException,CompiladorException, ExecutorException
from template_avaliacao impor... |
spamdict = {
} |
# Generated by Django 3.1.3 on 2020-11-23 03:23
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
import unittest
import task2 as t
class MyTestCase(unittest.TestCase):
def test_get_history_successes(self):
top_list1 = [14000000, 13500000, 13500000,
11000000, 9000000, 9000000,
9000000]
successes_data_team1 = [100000, 900000, 8000000,
... |
#demo06_stack.py 组合与拆分
import numpy as np
a = np.arange(1, 7).reshape(2, 3)
b = np.arange(7, 13).reshape(2, 3)
print(a)
print(b)
c = np.hstack((a, b))
print(c)
a, b = np.hsplit(c, 2)
print(a)
print(b)
c = np.vstack((a, b))
print(c)
a, b = np.vsplit(c, 2)
print(a)
print(b)
c = np.dstack((a, b))
print(c)
a, b = np.ds... |
#!/usr/bin/env python
import pika
import sys
connection = pika.BlockingConnection(pika.ConnectionParameters(host='192.168.20.10'))
channel = connection.channel()
channel.exchange_declare(exchange='ip_exchange', type='fanout')
message = ' '.join(sys.argv[1:]) or "10.10.10.10"
channel.basic_publish(exchange='ip_exchan... |
#!/usr/bin/env python
# -*- coding::utf-8 -*-
# Author :GG
# 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。
#
# 你可以假设数组中无重复元素。
#
# 示例 1:
#
# 输入: [1,3,5,6], 5
# 输出: 2
#
#
# 示例 2:
#
# 输入: [1,3,5,6], 2
# 输出: 1
#
#
# 示例 3:
#
# 输入: [1,3,5,6], 7
# 输出: 4
#
#
# 示例 4:
#
# 输入: [1,3,5,6], 0
# 输出: 0
#
# Re... |
#!/usr/bin/env python3
info = [
("jp1", "1077", ["2006-06-05-12-second.txt", "2008-06-03-11-first.txt"]),
("jp2", "1080", ["2007-07-03-06-second.txt", "2007-06-17-06-second.txt"]),
("jp3", "936", ["2006-06-01-12-second.txt"]),
("jp4", "1099", ["2009-01-05-11-first.txt", "2013-10-28-03-first.txt", "2012... |
from selenium import webdriver
from selenium.webdriver.support.select import Select
driver = webdriver.Ie()
driver.get("https://172.18.5.111")
driver.find_element_by_id("overridelink").click()
driver.find_element_by_xpath("//img[@src='/no1/images/passwd.gif']").click() |
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
svrIP = input(("Sever IP(Sever IP(default: 127.0.0.1): "))
if svrIP=='':
svrIP= '127.0.0.1'
port = input('port(default: 2500):')
if port == '':
port = 2500
else:
port = int(port)
sock.connect((svrIP,port))
print('Connetcted to' + svr... |
#!/usr/bin/python
import cgi
import cgitb
cgitb.enable()
print "Content-type: text/html\r\n\r\n"
form = cgi.FieldStorage()
if "file" in form.keys():
files = form["file"]
print files.filename, files.name, files.value
open('/tmp/' + files.filename, 'wb').write(files.value.read()) |
#preloaded variable: "dictionary"
def make_backronym(acronym):
return ' '.join(dictionary[x] for x in acronym.upper())
'''
back·ro·nym
An acronym deliberately formed from a phrase whose initial letters spell out
a particular word or words, either to create a memorable name or as a
fanciful explanat... |
#-*- coding:utf8 -*-
# Copyright (c) 2020 barriery
# Python release: 3.7.0
# Create time: 2020-07-14
import json
from .query import QueryExecutor
from .entity import Contract, Node, Cluster
from operator import itemgetter, attrgetter
import logging
def load_balancing_by_node_centor(node_center, privateKey, publicKey):... |
#
# This file is part of LUNA.
#
# Copyright (c) 2020 Great Scott Gadgets <info@greatscottgadgets.com>
# SPDX-License-Identifier: BSD-3-Clause
""" ECP5 Versa platform definitions.
This is a non-core platform. To use it, you'll need to set your LUNA_PLATFORM variable:
> export LUNA_PLATFORM="luna.gateware.platfor... |
import torch.utils.data as data_utils
from torch import Tensor
from train_config import *
import torch.nn.functional as F
DATA_DIM = 168
def predict(data, model, preprocessor=None):
dfs = []
p = u.Permuter()
for i in range(3):
p.ix = np.ones_like(data.index)*i
x = p.permute(data).replace(... |
import pyautogui
import keyboard
from pynput.mouse import Button, Controller
mouse = Controller()
# Use pyautogui to determine the X and Y mouse position.
xPos = [733, 875, 1015, 1160]
y = 725
darknessVal = 2.36
# Columns
lock = [False, False, False, False]
while keyboard.is_pressed('q') == False:
for col, x in... |
# 문자열 함수 들
title = "TEAMLAB X Inflearn"
title.upper()
title.lower()
title.split()
title.isdigit()
title.title()
|
from graph_txt_files.txt_functions import *
import graph_txt_files.txt_functions
|
import re
import string
def preproccess_text(text: str) -> str:
"""
Функция для предварительной обработки текста.
:param text: str
:return: str
"""
text = text.replace("ё", "е")
text = re.sub('((www\.[^\s]+)|(https?://[^\s]+))', 'URL', text)
text = re.sub('@[^\s]+', 'USER', text)
t... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'Hanzhiyun'
def triangles():
tri = [1]
while True:
yield tri
tri = [sum(i) for i in zip([0] + tri, tri + [0])]
return
n = 0
for t in triangles():
print(t)
n += 1
if 10 == n:
break
|
from django.apps import AppConfig
class ApiFormatterConfig(AppConfig):
name = 'api_formatter'
|
#!/usr/bin/env python
# coding: utf-8
import spacy
from spacy.lang.en.stop_words import STOP_WORDS
from string import punctuation
import sys
from heapq import nlargest
nlp = spacy.load('en_core_web_sm')
stopwords = list(STOP_WORDS)
def calc_word_frequencies(doc):
print(type(doc))
word_frequencies = {}
fo... |
from django.db import models
'''
Account class:
account_type: 'employee', 'foreman', 'director'
'''
class Account(models.Model):
identity = models.CharField(max_length=4,default='0000')
password = models.CharField(max_length=200, default='00000')
account_type = models.CharField(max_length=200)
ban... |
""""
绘制X、Y两个方向束斑大小,随阶数、动量分散变化图。(两个方向 * 动量分散取 8% 0 -7%,共6条线)
然后取一阶和五阶,绘制束斑图
"""
from os import error, path
import sys
sys.path.append(path.dirname(path.abspath(path.dirname(__file__))))
sys.path.append(path.dirname(path.dirname(
path.abspath(path.dirname(__file__)))))
from cctpy import *
#------------------------... |
from CreateSpiral import *
createSpiral(-3)
createSpiral(0)
createSpiral('a')
createSpiral(1)
createSpiral(3)
createSpiral(5)
createSpiral(10) |
import sunspec2.modbus.modbus as modbus_client
import pytest
import socket
import serial
import sunspec2.tests.mock_socket as MockSocket
import sunspec2.tests.mock_port as MockPort
def test_modbus_rtu_client(monkeypatch):
monkeypatch.setattr(serial, 'Serial', MockPort.mock_port)
c = modbus_client.modbus_rtu_c... |
import os
import sys
import argparse
import errno
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import axes3d, proj3d
import torch
from torch.nn import init
def make_D_label(input, value, device, random=False):
if random:
if value == 0:
lower, upper = 0, 0.205
elif value ... |
import networkx as nx
import pandas as pd
import numpy as np
import os
import pickle
import matplotlib.pyplot as plt
from math import log
##################################
######### 读取边列表 #########
##################################
# 社交网络数据集
NetWorks=['twitter', 'gplus', 'hamster', 'advogato']
... |
import logging
import pymc3 as pm
logger = logging.getLogger('root')
def add_beta_binomial_model(hierarchical_model, a=1, b=1):
'''
A model for binomial observations (number of successes in a sequence of n independent experiments)
via a Binomial variable, and a Beta prior.
:param a:
:param b:
:return:
... |
from turtle import forward, right, left, shape, speed, exitonclick, circle,
shape('turtle')
speed(0)
# květ
for i in range(18):
for j in range(4):
forward(50)
left(90)
left(20)
# stonek a listy
right(90)
forward(100)
for i in range(12):
if i % 2 == 0:
left(75)
circle(50 + i *... |
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def inicio():
return render_template("inicio.html")
@app.route('/articulos')
def articulos():
return render_template("articulos.html")
@app.route('/acercade')
def acercade():
return render_template("acercade.html")
app.run(... |
from sklearn.metrics.pairwise import cosine_similarity
from sentence_transformers import SentenceTransformer
import pickle
def get_cosine_similarity(feature_vec_1, feature_vec_2):
return cosine_similarity(feature_vec_1.reshape(1, -1), feature_vec_2.reshape(1, -1))[0][0]
model = SentenceTransformer('paraphrase-T... |
import sys
def frequencyAnalyse(string):
charList = []
frequencyList = []
temp = string.replace(" ", "")
stringList = list(temp)
for i in xrange(len(stringList)):
if stringList[i] in charList:
for j in xrange(len(charList)):
if stringList[i] == charList[j] and... |
#!/usr/bin/env python
from autodisc.cppn.twodmatrixcppnneatevolution import TwoDMatrixCCPNNEATEvolution
from autodisc.cppn.neatcppngui import NeatCPPNEvolutionGUI
def fitness_function(image, genome):
return 0
evo_config = TwoDMatrixCCPNNEATEvolution.default_config()
evo_config['is_verbose'] = True
evo_config['k... |
from django.urls import path
from django.urls.conf import path, re_path
from .apis import *
urlpatterns = [
path('rev_exps/add', AddRevenueExpenditureApi.as_view(), name='rev_exp_add'),
re_path(r'^rev_exps/list/(?:start=(?P<start>(?:19|20)\d{2}(0[1-9]|1[012])))&(?:end=(?P<end>(?:19|20)\d{2}(0[1-9]|1[012])))$'... |
from unittest.mock import MagicMock, Mock, patch
class ProductionClass:
def method():
pass
with patch.object(ProductionClass, "method", return_value=None) as mock_method:
thing = ProductionClass()
thing.method(1, 2, 3)
mock_method.assert_called_once_with(1, 2, 3)
# mock_method.assert_called_onc... |
import platform
import sys
import warnings
from setuptools import Extension
from setuptools import setup
if sys.version_info < (3, 6):
raise RuntimeError('当前ctpbee_api只支持python36以及更高版本/ ctpbee only support python36 and highly only ')
runtime_library_dir = []
long_description = ""
if platform.uname().system == "... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simple model for path recursive walk.
Run script: dick_path_scanner PATH
PATH - can be absolute or relative
"""
import os
class RecursivePathWalker(object):
""" Interface for recursive path walk"""
def __init__(self, path):
self.path = p... |
from enum import Enum
class Architecture(Enum):
amd64 = 0
armv7 = 1
class ResultStatus(Enum):
Completed = 0
Declined = 1
JobDescriptionError = 2
JobNotFound = 3
MemoryExceeded = 4
StorageExceeded = 5
InstructionsExceeded = 6
BandwidthExceeded = 7
ExceptionOccured = 8
DirectoryUnavailable = 9
class Par... |
"""Defines URL patterns for learning_logs."""
from django.urls import path
from . import views
urlpatterns = [
# Home page
path('', views.index, name='index'),
# Query Menu
path('dblists/', views.dblists, name='dblists'),
# List Clients
path('dblists/clients/', views.clients, name='clients'),
... |
# 算法一
def str_compress1(string):
result = []
current = string[0]
count = 1
for s in string[1:]:
if s == current:
count += 1
else:
# result += current + str(count)
result.append(current)
result.append(str(count))
current = s
... |
#!/usr/bin/env python3
"""
Spooloff Oracle data file parser to csv file
"""
from optparse import OptionParser
import fnmatch
import logging
import os
import re
def gen_find(filepattern, top):
for path, _, filelist in os.walk(top):
break
for name in fnmatch.filter(filelist, filepattern):
yield... |
# win10 python3.10 maya2018
# python module
import os,subprocess,re
from tkinter import *
from tkinter import ttk
from tkinter.filedialog import askdirectory,askopenfilenames
from tkinter.scrolledtext import ScrolledText
# local module
import deadlineSubmission
import configFile
# extra module
import windnd
def g... |
from package_template import increment
class TestApp:
def test_increment(self):
arg = 0
assert increment(0) == 1 |
def cached_method(fnc):
cache = {}
def result(self, *args):
try:
return cache[args]
except:
value = fnc(self, *args)
cache[args] = value
return value
result._cache = cache
return result
class OpenStruct(dict):
def __init__(self, *args, **kws):
dict.__init__(self, *args, **... |
#!/usr/bin/env python3
"""Render Rosette API dependency parse trees as SVG via Graphviz"""
import argparse
import os
import re
import subprocess
import sys
import urllib
from operator import itemgetter, methodcaller
from getpass import getpass
EXTERNALS = ('rosette_api',)
try:
from rosette.api import API, Docum... |
import random as rd
from tkinter import *
class Boss():
def __init__(self):
self.HP = 20
self.damage = 2
self.special = 5
self.name = "Toby"
self.weapon = "Great sword"
def set_HP(self, HP):
if(HP < 0):
HP = 0
self.HP = HP
else... |
# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from textwrap import dedent
import pytest
from pants.backend.python import target_types_rules
from pants.backend.python.dependency_inference import ru... |
import socket
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
s.bind(('',5002))
while True:
date,addr = s.recvfrom(1024)
print('received message:{0} from PORT {1} on {2}'.format(date.decode(),addr[1],addr[0]))
if date.decode().lower() == 'bye':
break
s.close() |
# demo01_series.py Series对象
import numpy as np
import pandas as pd
# 创建Series对象
ary = np.array(['zs', 'ls', 'ww', 'zl'])
# 使用index参数可以更改索引
s = pd.Series(ary, index=['s01', 's02', 's03', 's04'])
print(s)
# 使用字典创建Series
s = pd.Series({'s01':'zs', 's02':'ls', 's03':'ww'})
print(s)
# 使用标量创建Series
s = pd.Series(5, index=... |
#!/usr/bin/env python3
import argparse
import os
import pyjetty.alihfjets.hf_data_io as hfdio
from pyjetty.mputils import perror, pinfo, pwarning, treewriter
from pyjetty.mputils import JetAnalysisWithRho
import fastjet as fj
import fjcontrib
import fjext
import fjtools
import ROOT
ROOT.gROOT.SetBatch(True)
class ... |
# Class definition of a linked list
class Node:
def __init__(self, data, next=None):
self.data=data
self.next=next
# Add two linked lists
def add_two_linked_list(node0, node1, carry_over=0):
if not node0 and not node1 and not carry_over:
return None
node0_val = node0.data if n... |
import numpy as np
import matplotlib.pyplot as plt
n1 = int(input('length of s1: '))
n2 = int(input('length of s2: '))
s1 = []
s2 = []
for i in range(n1):
i1 = input('enter input signal: ')
s1.append(int(i1))
for i in range(n2):
i2 = input('enter response signal: ')
s2.append(int(i2))
s3 = np.flip(s2,0)
length ... |
import codecs
s = input("Enter a String: ")
ro_encrypt = codecs.encode(s,"rot13")
print("Ciphered Text: ",ro_encrypt) |
from reviewapp import create_app
from reviewapp.review import get_python_review,get_mobile_all
from reviewapp.sentiment_analys import go
from reviewapp.dostoevsky_analysys import dostoevsky_run
app = create_app()
with app.app_context():
dostoevsky_run()
#get_python_review()
|
# github code - Support Vector Machine Kernels example
# includes matplotlib graphing plots and sample output
#
# SupportVectorMachineKernels.py
import sys
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import style
style.use('ggplot')
####
# build o... |
# Generated by Django 2.0.1 on 2018-01-23 16:19
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='IoT',
fields=[
('serial_no', models.CharFie... |
from functools import singledispatch
from typing import Tuple
from ._parse import (
AST,
Program,
StatementList,
ExprStatement,
ReturnStatement,
FunctionDefinition,
FunctionCall,
IntLiteral,
BinopExpr
)
RET_REG = 'rax'
ARG1_REG = 'rdi'
# TODO track arithmetic stack pointer durin... |
import random
import os
import yaml
from models import Pair
CONFIG_PATH = os.path.join(os.path.dirname(__file__), 'config.yml')
def choose_reciever(giver, recievers):
choice = random.choice(recievers)
if giver.partner == choice.name or giver.name == choice.name:
if len(recievers) is 1:
... |
import datetime
import sys
def next_day(date_str):
flag = False
if date_str.count("-") ==2:
data = date_str.split("-")
if data[0].isdigit() and data[1].isdigit() and data[2].isdigit():
if int(data[2])<=31 and int(data[2])>=1 and int(data[1])<=12 and int(data[1])>=1:
... |
data_list = [
{"id":10001, "wname":"python","year":"2001"},
{"id":10002, 'wname':'UI','year':'2002'},
{"id":10004, 'wname':'AI','year':'2003'}
]
try:
with open('ws.txt','w') as file:
for data in data_list:
line = f'{data["id"]},{data["wname"]},{data["year"]}\n'
file.writ... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# TypeError session
from ..exceptions import DigitError, IntError, RealError, ComplexError, \
BoolError, BytesError, StringError, DictError, \
ListError, TupleError, ProtocolUnbound
# AttributeError session
from ..exceptions i... |
<<<<<<< HEAD
from django.test import TestCase, override_settings
from django.core import mail
from django.urls import reverse
from django.core.cache import cache
from django.core.cache.utils import make_template_fragment_key
import tempfile
from django.conf import settings
from .models import User, Group, Post
clas... |
#!/usr/bin/python
import numpy as np
import math
from roboclaw import *
vx = 0
vy = 0
w = 0
theta = 0
wheel_radius = 3.0
M = 1.0/wheel_radius*np.matrix([[-0.5,0.866,(0.866*6.9282+0.5*4)],[-0.5,-0.866,(0.866*6.9282+.5*4)],[1,0,8]])
R = np.matrix([[],[],[]])
magic_number = 2**13
back_number = 2**12.8
def rotation_matrix... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
import sys
import traceback
from django.core.management import setup_environ
sys.path.append("/home/bao/public_html/")
from bao import settings
setup_environ(settings)
from bao.athaliana.models import Syntelog
import csv
reader = csv.DictReader(open("data/da... |
A=int(input())
B=int(input())
list=[]
for j in range(A,B+1):
if j % 3 == 0:
list.append(j)
print(sum(list) / len(list)) |
# if practice
number = int(input("pls input a number:"))
if number > 18:
print("it's ok")
else:
print("it's a boy")
sex = input("pls input your sex(man/woman):")
if sex == "man":
print("you are %s" % sex)
elif sex == "woman":
print("you are %s" % sex)
else:
print("you input wrong sex")
|
from django.shortcuts import render
from .apps import PricepredictorConfig
from django.http import JsonResponse
from rest_framework.views import APIView
import pandas as pd
class call_model(APIView):
def get(self,request):
if request.method == 'GET':
return render(request, 'index.html')
def... |
"""This module contains a function to plot graph to analyze the grade change over time"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#author: Muhe Xie
#netID: mx419
#date: 11/26/2015
def generate_line_graph(df_data,plot_title):
'''this function will generate a line plot to show the c... |
#Esta función proporciona soporte a los parámetros de la consola:
def parseator():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-Nombre", type=str,help="Muestra los resultados del nombre elegido")
parser.add_argument("-Empresa", type=str,help="Muestra los resultados de la... |
Hello atgiugu!
Hello World!
|
import os
import numpy as np
import torch
import torch.nn as nn
from torch.nn import init
PI = np.pi
class Actor(nn.Module):
def __init__(self, input_size, output_size, order=1, lr=0.001):
super(Actor, self).__init__()
# parameters
self._out_gain = PI / 9
# self._norm_matrix = 0.1... |
import numpy as np
import sys
import seaborn as sb
import scipy.stats as stats
import matplotlib.pyplot as plt
import pickle
import argparse
import pymc3 as pm
import pathlib
# import some cool fortran modules that are precompiled and fast
from model_paths import fortran_path, base_path, data_path
sys.path.append(fortr... |
from PyQt5 import QtWidgets, QtCore
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg, NavigationToolbar2QT
from sklearn.decomposition import PCA
from matplotlib.ticker import MaxNLocator
from matplotlib import pyplot as plt
import sys
import math
import numpy as np
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# ventanas_Tkinter_curso.py
#
from Tkinter import *
root = Tk(className ="Mi primera GUI")
svalue = StringVar() # definimos el widget como string
w = Entry(root,textvariable=svalue) # añadimos textarea widget
w.pack()
def act():
p... |
import pygame
from GameParameter import clock
from StartMenu import StartMenu
from SelectMenu import SelectMenu
def start_menu():
screen = StartMenu()
game = True
while game:
for event in pygame.event.get():
if event.type == pygame.QUIT:
game = False
screen.dr... |
from __future__ import print_function
# import requests
import csv
import os
import re
# AWS Requirements
import boto3
from botocore.exceptions import ClientError
from botocore.vendored import requests
dynamodb = boto3.client('dynamodb')
def update_saved_info(phone_number, zip_code):
try:
response = dynamodb.get... |
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
from registration import views
from registration.views import *
from registration.models import *
from django.contrib.auth import views as auth_views
from django.contrib.auth.decorators import login... |
def row_weights(array):
f_team = sum([c for i, c in enumerate(array) if i%2 == 0])
return (f_team, sum(array) - f_team)
'''
Scenario
Several people are standing in a row divided into two teams.
The first person goes into team 1, the second goes into team 2,
the third goes into team 1, and so on.
Task
Given ... |
from flask import Flask, jsonify, request, Blueprint
from ..models.models import (
Users, get_all_users, get_user_by_id, update_admin_status, get_menu, get_username, get_user_orders,
get_orders, get_order_by_id, insert_response)
from ..controllers import (registration_controller,
logi... |
#!/usr/bin/env python
__author__ = "Master Computer Vision. Team 02"
__license__ = "M6 Video Analysis"
# Import libraries
import os
import sys
import cv2
import math
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from skimage.transform import resize
from skimage.measure import block_reduce
from ... |
# coding=utf-8
import smtplib
from email.mime.text import MIMEText
class mailSender(object):
def __init__(self):
self.server = 'smtp.domain.com'
self.username = '发信人名称'
self.password = 'password'
self.port = 25
self.sender = 'admin@domain.com'
def send(sel... |
../gasp/Rmag_aperture_annulus_r_file_median_w1_subplot_date_target.py |
import random
from uuid import UUID
from wacryptolib.cryptainer import CryptainerStorage, dump_cryptainer_to_filesystem, PAYLOAD_CIPHERTEXT_LOCATIONS
class FakeTestCryptainerStorage(CryptainerStorage):
"""Fake class which bypasses encryption and forces filename unicity regardless of datetime, to speed up tests..... |
#encoding=utf-8
import os
import sys
import mmap
import time
import socket
import struct
import elb_pb2
from StaticRoute import StaticRoute
from CacheLayer import CacheUnit
class FormatError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
c... |
import cv2 as cv
import numpy as np
from basic_functions import read_image, show_images
from luminance_correction import luminance_correction
from copy import deepcopy
def create_eye_map_c(imgYCrCb):
"""
Function responsible for calculate eye map from chrominance components
:param imgYCrCb: image in YCrCb... |
# -*- encoding: UTF-8 -*-
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from django.db import models
class Category(models.Model):
name = models.CharField(max_length=100, verbose_name=u'Nom de la Catégorie')
class ... |
#-*- coding:utf-8 –*-
from random import uniform, sample
from numpy import *
from copy import deepcopy
import ConnectEndPoint
from SPARQLWrapper import SPARQLWrapper, JSON
FBdir = "/Users/wenqiangliu/Documents/KG2E/data/FB15k/entity2id.txt"
sp = "\t"
idNum = 0
FBdic = {} # freebase Entity,key is entity; value=-1
with ... |
from configparser import ConfigParser
# 常量名全部大写
CONFIG_FILE = "config.txt"
config = ConfigParser()
# 读取配置文件
config.read(CONFIG_FILE, encoding='gb2312')
# 获取messages区段的内容
greeting = config.get('messages', 'greeting')
print(greeting)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.