text
stringlengths
38
1.54M
import os import numpy as np import pylab as plt from PIL import Image,ImageDraw from copy import deepcopy import matplotlib.pyplot as plt import matplotlib.pylab as pylab import requests from io import BytesIO import matplotlib.pyplot as pyplt import torch from maskrcnn_benchmark.config import cfg from maskrcnn_benchm...
"""Welcome to the API functionality.""" from flask_restful import Resource # pylint:disable=no-self-use class WelcomeResource(Resource): """Displays welcome message and any other introductory information.""" def get(self): """Get the welcome message an display it.""" return { 's...
import numpy as np import os import pickle import matplotlib.pyplot as plt from copy import deepcopy from tqdm import tqdm import qeval import qanim #TODO: after 100g create a new file for saving #TODO: fusion and fision class EvolAlg(): def __init__(self, time=300, popsize=180, load_pop=True): # interna...
#! /usr/bin/env python # coding: utf-8 #ヘアスタイル合成のメインコード #基準座標型フィッテング手法 #スケール変更 → 位置合わせ → クロマキー合成 import cv import cv2 import numpy as np import pylab as plt import synthesis #クロマキー合成 import hairTranceform2 #スケール変更 + 位置合わせ #入力 samplenum = raw_input('合成するヘアスタイル番号を指定してください : ') sampleName = '../image2/sample' +...
# -*- coding: utf-8 -*- """ Created on Sat Mar 5 14:59:30 2016 @author: alex """ from AlexRobotics.dynamic import Manipulator as M from AlexRobotics.estimation import ManipulatorDisturbanceObserver as OBS from scipy.interpolate import interp1d import numpy as np ''' #####################...
import time from datetime import datetime from multiprocessing import Process, Value, Queue, Manager from Algorithms import Algorithm from Arduino import Arduino # from Android import Android from socket import error as SocketError import errno ANDROID_HEADER = 'AND'.encode() ARDUINO_HEADER = 'ARD'.encode() ALGORIT...
#!/usr/bin/python3 a = 21 b = 10 c = 0 if ( a == b ): print ("1 - a 等于 b") else: print ("1 - a 不等于 b") if ( a != b ): print ("2 - a 不等于 b") else: print ("2 - a 等于 b") if ( a < b ): print ("3 - a 小于 b") else: print ("3 - a 大于等于 b") if ( a > b ): print ("4 - a 大于 b") ...
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-07-04 05:48 from __future__ import unicode_literals import core.utils from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ ...
"""firstproject URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-...
# 1. Напиши программу, которая выводит на экран сегодняшнюю дату в формате 2017-01-31 15:34:45 # 2. Напиши функцию, которая принимает радиус окружности, и возвращает площадь этой окружности. # 3. Напиши функцию, которая принимает цифру n от 0 до 9(больше или меньше должны выводить на экран ошибку), и возвращает сумму n...
from django.db import models class CustomUser(models.Model): email = models.EmailField(unique=True, verbose_name='Email') name = models.CharField(blank=True, max_length=100, verbose_name='Name') password = models.CharField(max_length=20, verbose_name='Password') def __str__(self): return self.e...
import os from flask import Flask, request app = Flask(__name__) @app.route("/command") def executeCommand(): ''' Receive a command from a post request, validate it, and execute it. ''' if request.method == 'POST': action = request.args.get('action') os.system(action) retur...
from django import forms # Форма регистрации from .models import DiskUser from django.contrib.auth import password_validation from django.core.exceptions import ValidationError # Регистрацция class RegisterUserForm(forms.ModelForm): # Полное объявление - обязательно для заполнения: email = forms.EmailField(r...
import requests from datetime import datetime import config exercise_endpoint = "https://trackapi.nutritionix.com/v2/natural/exercise" # exercise_text = input("What exercise did you do? ") exercise_body = { "query": "ran 5 kilometers", "gender": "male", "weight_kg": 88, "height_cm": 183, "age": 3...
from django.urls import path from . import views app_name = 'stores' urlpatterns = [ path('', views.store_list, name='store_list'), path('new/', views.store_create, name='store_create'), path('<int:pk>', views.store_detail, name='store_detail'), path('<int:pk>/update/', views.store_update, name='stor...
from tensorflow.examples.tutorials.mnist import input_data import tensorflow as tf from matplotlib import pyplot as plt import numpy as np mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) sess = tf.Session() Xtr, Ytr = mnist.train.next_batch(5000) # distance = tf.reduce_sum(tf.abs(Xtr - x_test)) x_tr,...
import time from threading import Thread """ Clase fondo Atributos: +ejeX:es el eje x tanta de las estrellas y de los planetas del fondo +canvas: canvas donde se mueve el fondo +imagen:imagenes de las estrellas y de los planetas +velocidadX: velocidad de movimiento en el eje x +jugando:boolean que determina si se est...
# Note: Validation is done for 8-word input, we just need to check 3^8 = 6561 cases # Validation for 16-word inputs reqires 3**16 = 43'046'721 checks ELEMENTS_COUNT = 8 ALL_MASK = (1 << ELEMENTS_COUNT) - 1 ALL_BUT_ONE_MASK = (ALL_MASK >> 1) # 'V' - single-word character (always valid) # 'L' - low surr...
import unittest # get_adjacent_space_keys(area, k): # get_moveable_space_keys(area, ls_k): # get_moveable_adjacent_space_keys(area, k): # get_move_spaces(area, k): from model import Area, Unit from combat import CombatRangeUtil class CombatRangeUtilTest(unittest.TestCase): def setUp(self): self.area = Area(5, 5)...
""" Ordered Dict -> Garante que o dicionario ira ser impresso na ordem correta em uma iteraçao """ from collections import OrderedDict dicionario = OrderedDict({'a':1, 'b':2, 'c':3, 'd':4, 'e':5, 'f':6}) for chave, valor in dicionario.items(): print(f'{chave} = {valor}') print()
from collections import OrderedDict from cloudshell.cli.command_template.command_template import CommandTemplate ACTION_MAP = OrderedDict() ERROR_MAP = OrderedDict([(r'[Ee]rror:', 'Command error')]) SWITCH_INFO = CommandTemplate('switch-info-show format model,chassis-serial', ACTION_MAP, ERROR_MAP) SWITCH_SETUP = Co...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: LiSnB # @Date: 2015-04-26 14:42:31 # @Last Modified by: LiSnB # @Last Modified time: 2015-04-26 15:03:48 class Solution: """ @param A: sorted integer array A which has m elements, but size of A is m+n @param B: sorted integer arra...
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score, precision_score, recall_score # plt.style.use('seaborn-whitegrid') plt.style.use('dark_b...
''' Title :make_predictions_1.py Description :This script makes predictions using the 1st trained model and generates a submission file. Author :Adil Moujahid Date Created :20160623 Date Modified :20160625 version :0.2 usage :python make_predictions_1.py python_version :2....
import os import numpy as np import matplotlib.pyplot as plt import pandas as pd from lmfit import minimize, Parameters, report_fit import sys sys.path.append("../common") def get_hourly_aggregate(df, how='mean'): df_c = df.copy() df_c["hour"] = df_c.index.hour return df_c.groupby("hour").mean() # Wea...
import requests # UA伪装 headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Edg/87.0.664.66' } url = 'https://www.sogou.com/web' kw = input('enter a word:') param = { 'query': kw } response = requests.get(url=url, params=pa...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jul 14 21:19:31 2019 @author: jorge """ #Geolocalización import geopy import time import math ##Creamos función distancia para calcularla def distancia(lugar1,lugar2): origen = geolocator.geocode(lugar1) destino = geolocator.geocode(lugar2) ...
from flask import Flask, render_template, flash, redirect, url_for, session, logging,request, session from flask_mysqldb import MySQL from wtforms import Form, StringField, TextAreaField, PasswordField, validators,DateTimeField,IntegerField from twilio.rest import Client from functools import wraps import smtplib mys...
# -*- coding: utf-8 -*- """File containing a Windows Registry plugin to parse the USB Device key.""" from parsers.logs import general class WindowsUSBDeviceEventData(general.PlasoGeneralEvent): """Windows USB device event data attribute container. Attributes: key_path (str): Windows Registry key path....
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auth', '0006_require_contenttypes_0002'), ] operations = [ migrations.CreateModel( name='BaseUser', ...
print ("Exercise 3") a = 10 b = 20 c = 30 avg = (a + b + c)/ 3 print ("Average= ", avg) if (avg > a and avg > b and avg > c): print ("Average is higher than a,b,c") else: if (avg > a and avg > b): print ("Average is higher than a, b") elif (avg > a and avg > c): print ("Average is ...
#!/usr/bin/env python # -*- coding: UTF-8 -*- __author__ = "Marcelo Souza" __license__ = "GPL" # Config from configobj import ConfigObj, ConfigObjError cfg = None plugin_cfg = None # # Read ConfigObj from file # def read_cfg(filename): cfg_obj = None try: cfg_obj = ConfigObj(filename, raise_errors=Tr...
#!/usr/bin/env python3 # encoding utf-8 from Environment import HFOEnv import multiprocessing as mp import argparse from Networks import ValueNetwork from SharedAdam import SharedAdam from Worker import * from ctypes import c_bool, c_double import os import matplotlib.pyplot as plt import time try: from subproc...
# -*- coding: utf-8 -*- from selenium import webdriver import eCenter_buttons import eCenter_Login import eCenter_Create_Data import time from eCenter_buttons import xpaths from selenium.webdriver.support.select import Select from selenium.webdriver.support.ui import Select #-------------------------------------------...
# Copyright 2019 Bruno P. Kinoshita # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
from django.shortcuts import render from rest_framework import status from rest_framework.decorators import api_view from rest_framework.response import Response from collections import Counter @api_view(['POST']) def lambda_function(request): if request.method == 'POST': data = request.data.get('question...
from bc4py.config import P, NewInfo from bc4py.chain import Block, TX from bc4py.contract.watch.checkdata import * import logging from threading import Thread def start_contract_watch(): assert P.F_WATCH_CONTRACT is False P.F_WATCH_CONTRACT = True Thread(target=loop, name='Watch', daemon=True).start() d...
import logging import requests from flask import Flask app = Flask(__name__) @app.route('/') def index(): try: r = requests.get( 'http://metadata/computeMetadata/v1/instance/service-accounts/default/identity?audience=https%3A%2F%2Fexample.com%2F', headers={'Metadata-Flavor': 'Go...
#!/usr/bin/env python """ test file for codingbat module This version used unittest """ import unittest from codingbat import sleep_in class Test_sleep_in(unittest.TestCase): def test_false_false(self): self.assertTrue( sleep_in(False, False) ) def test_true_false(self): self.asser...
import abc class AbstractAgent(abc.ABC): @abc.abstractmethod def get_parameters(self): """ Returns a dictionary containing all agent parameters. Returns: Dict: the agent parameters. """ @abc.abstractmethod def get_action_probabilities(self, state, available_acti...
#!/usr/bin/env python import os, sys import ROOT ROOT.PyConfig.IgnoreCommandLineOptions = True from importlib import import_module from PhysicsTools.NanoAODTools.postprocessing.framework.postprocessor import PostProcessor from wgFakePhotonModule import * from PhysicsTools.NanoAODTools.postprocessing.modules.common.c...
''' Find coordinate of Closest Point on Shapely Polygon ''' from shapely.geometry import Point from shapely.geometry import Polygon from shapely.geometry import LinearRing point = Point(0.0, 0.0) poly = Polygon ([(-1 ,1), (2,1), (2,2),(-1,2)]) # Polygon exterior ring exterior = LinearRing(poly.exterior.coo...
import numpy as np import pandas as pd import os from PIL import Image import glob import torch import torchfile from os.path import join as pjoin from utils.util import label_colormap from utils.util import pad_and_crop from scipy.io import loadmat from torchvision import transforms import torchvision.transforms.funct...
import tensorflow as tf class Prediction: """ model分类预测 es 2018-10-10 """ def __init__(self, model, width, height, channels, classes, model_path): self.load_model(model, width, height, channels, classes, model_path) def load_model(self, model, width, height, channels, classes, model_...
from tkinter import * from tkinter import ttk, filedialog import cv2 import matplotlib from PIL import ImageTk, Image matplotlib.use("TkAgg") from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from matplotlib.figure import Figure class Widget(Frame): IMG = None TempIMG = None def __init__(...
#-*- coding: utf-8 -*- import sys import replaceparameter import os.path parameter = sys.argv[1] value = sys.argv[2] for filename in os.listdir("."): if filename.split(".")[0] == "inputparameters" and \ unicode(filename.split(".")[1]).isnumeric(): replaceparameter.replace(filename, parameter, value) ...
from django.urls import path from .views import ( HomePageView, AboutPageView, BookPageView, CodingPageView, MusicPageView, PeoplePageView, PerspectivePageView, TravelPageView, ) urlpatterns = [ path('travel/', TravelPageView.as_view(), name='travel'), path('perspective/'...
import heapq N = int(input()) A = list(map(int,input().split())) C = A[0:N] S = sum(C) prefix = [S] heapq.heapify(C) for i in range(N, 2*N): heapq.heappush(C,A[i]) popped = heapq.heappop(C) S = S + A[i] - popped prefix.append(S) C = [-e for e in A[2*N:]] S = -sum(C) suffix = [S] heapq.heapify...
import argparse import threading from queue import Queue import cv2 import imutils from imutils.video import FPS from imutils.video import FileVideoStream from scripts.all_behaviours import AllBehaviours ap = argparse.ArgumentParser() ap.add_argument("-i1", "--input1", required=True, type=str) ap.add_ar...
import tensorflow as tf import numpy as np import os os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = "-1" input1 = tf.constant(3.0) input2 = tf.constant(2.0) input3 = tf.constant(5.0) intermed = tf.add(input2, input3) mul = tf.multiply(input1, intermed) with tf.Session() as sess: ...
#!/usr/bin/python # -*- coding: UTF-8 -*- try: import RPi.GPIO as GPIO except: print ("Erreur: RPi.GPIO n'est pas disponible"); exit(); import libi2c class Port: IN=GPIO.IN; OUT=GPIO.OUT; def __init__(self, num, mode): self._nump=num; self._status=mode; GPIO.setmode(GPIO.BOARD); GPIO.setup(num, mode...
# -*- coding: utf-8 -*- number = raw_input() salary = int(raw_input()) * float(raw_input()) print 'NUMBER =', number print 'SALARY = U$ %.2f' % salary
""" import csv f = open('gender.csv') data = csv.reader(f) m = [] f = [] """ import csv import matplotlib.pyplot as plt f = open('daegu2000.csv', encoding='cp949') data = csv.reader(f) next(data) result = [] for row in data: if row[-1] != '': #값이 존재한다면 if row[0].split('.')[1] == '4' and row[0].split('.')[...
# coding=utf-8 from PIL import Image import numpy as np import shutil import os ''' _noise 为图像添加噪声 随机生成5000个椒盐 ''' def addNoise(img): rows,cols,dims = img.shape noise_img = img for i in range(5000): x = np.random.randint(0,rows) y = np.random.randint(0,cols) noise_img[x,y,:]...
""" This script is written for CASA 4.5.3. Note: if you do everything in this script, you'll use up about 260 GB of space. The final calibrated continuum MS is 3.8 GB. """ # Labeling setups SB_field = 'Wa_Oph_6' LB_field = 'Wa_Oph_6' all_field = 'Wa_Oph_6' SB_tag = 'SB' LB_tag = 'LB' all_tag = 'all' SB_data = '...
from django.db import models class Employee(models.Model): # Create your models here. eid=models.IntegerField() ename=models.CharField(max_length=10) esal=models.IntegerField()
from django.db import models # Create your models here class Contact(models.Model): srno = models.AutoField(primary_key=True) name = models.CharField(max_length=250) email = models.CharField(max_length=250) message = models.TextField() def __str__(self): return 'Message from' +...
# -*- coding: utf-8 -*- from dp_tornado.engine.schema import Table as dpTable from dp_tornado.engine.schema import Schema as dpSchema from dp_tornado.engine.schema import Attribute as dpAttribute class FieldsSchema(dpTable): __table_name__ = 'fields' __engine__ = 'MyISAM' PK = dpAttribute.field(dpAttr...
# -*- coding: utf-8 -*- # LtData # Copyright (C) 2010 Salvo "LtWorf" Tomaselli # # Relation is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later ver...
#!/usr/bin/env python # my own teleop code! from __future__ import print_function # for python2 users import rospy # imports for keys import tty import select import sys import termios # imports for actions from geometry_msgs.msg import Twist, Vector3 # import for emergency stop with lost telometry import atexit #...
import pygame as pg from settings import * import pytweening as tween vec=pg.math.Vector2 from random import randrange,choice class Button: def __init__(self,game): self.game=game self.image=self.game.button self.rect=self.image.get_rect() def draw_button(self,text,x,y): self.re...
import numpy as np from scipy.optimize import linear_sum_assignment # Recursive Hungarian Algorithm for Dynamic Environments class RHA2: def __init__(self, agent_pos, agent_energy, task_pos, task_importance): self.agent_pos = agent_pos self.agent_energy = agent_energy self.task_pos = task_...
from gturtle import * def onMouseHit(x, y): fill(x, y) makeTurtle(mouseHit = onMouseHit) hideTurtle() addStatusBar(30) setStatusText("Click to fill a region!") repeat 12: repeat 6: forward(80) right(60) left(30)
import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import subprocess PIPE = subprocess.PIPE zdvec = np.linspace(0.0,1.0,5) # piezometer locations sigmavec = np.logspace(np.log10(2.5E+1),np.log10(2.5E+5),5) # Sy/(Ss*b) kappavec = np.logspace(-3,1,5) # Kz/Kr c = ['red','green'...
# Import Dash packages import dash_core_components as dcc import dash_html_components as html import dash_bootstrap_components as dbc from dash.dependencies import Input, Output # Import extra packages import numpy as np import time # Import app from app import app from common import data component = dbc.Col([ ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Aug 6 23:19:22 2017 class Perceptron as AND, OR & NAND gates @author: Esteban Reyes de Jong """ class Perceptron: 'Common base class for all perceptrons' ''' contructor input: two weights and bias @param weight1 doble (first weight)...
# Generated by Django 2.1.1 on 2018-11-07 16:20 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('myapp', '0012_auto_20181107_2349'), ] operations = [ migrations.AlterField( model_name='realteammember', ...
class Solution: def reverseString(self, s): """ :type s: str :rtype: str 注意: 字符串是不可变的,不能直接使用反转数组的方法 """ length = len(s) new_s = '' for i in range(length): new_s += s[length - i -1] # new_s = s[::-1] print(new_s) retu...
from django.urls import path from . import views app_name = "user" urlpatterns = [ path("", views.UserListView.as_view(), name="user_list"), path("<int:pk>/", views.UserDetailView.as_view(), name="user_detail"), path( "update/<int:pk>", views.UserUpdateView.as_view(), name="user_update" ), ...
from django.conf.urls import url from . import views app_name = "tbapp" urlpatterns = [ url(r"^$", views.IndexView.as_view(), name="index"), url(r"^login$", views.login_view, name="login"), url(r"^logout$", views.logout_view, name="logout"), url(r"^events$", views.all_events_view, name="events"), ...
from django import template from django.conf import settings from django.core.urlresolvers import reverse register = template.Library() def getAb(context): #todo: for any reason I am not able to import abTest.settings contextName = getattr( settings, 'AB_TEST_CONTEXT_NAME', getattr(settings, 'A...
import json import traceback from urllib import urlencode from zope.interface import implements from twisted.web.iweb import IBodyProducer from twisted.internet.defer import inlineCallbacks, returnValue, succeed from twisted.web.client import Agent, readBody from twisted.web.http_headers import Headers from twisted.in...
#! /usr/bin/env python2 """ This will simulate doing a "tee": having stdout directly to the console as well as saving it in a list for later processing. """ import os import sys import time import select import logging import threading import subprocess class CopyThread(threading.Thread): def __init__(self, rea...
#!/usr/bin/python # # Program To Demonstrate Inheritance # furnishings.py # # Created by: Jason M Wolosonovich # 6/04/2015 # # Lesson 7 - Project Attempt 1 """ furnishings.py: Demonstrates inheritance @author: Jason M. Wolosonovich """ import sys class Furnishing(object): def __init__(self, room): ...
# %% import difflib import numpy as np import pandas as pd pd.options.mode.chained_assignment = None def merge_fixtures(fpl_path, understat_path, data_path): """[Merges team and fixtures onto fpl. Slightly processes data.] Args: fpl_path ([type]): [description] understat_path ([type]): [descri...
from eth_utils import ValidationError import pytest from eth2.beacon.constants import FAR_FUTURE_EPOCH, GENESIS_EPOCH from eth2.beacon.helpers import compute_start_slot_at_epoch from eth2.beacon.state_machines.forks.serenity.block_validation import ( _validate_eligible_exit_epoch, _validate_validator_has_not_e...
# Generated by Django 3.1.5 on 2021-01-21 14:44 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('shop', '0002_auto_20210121_1726'), ] operations = [ migrations.CreateModel( name='ShopUser', ...
#tkinter implementaion from tkinter import * from tkinter import messagebox import pyqrcode ws = Tk() ws.title("PythonGuides") ws.config(bg='#F25252') def generate_QR(): if len(user_input.get())!=0 : global qr,img qr = pyqrcode.create(user_input.get()) img = BitmapImage(data = qr.xbm(scale...
# encoding: utf-8 #!/usr/bin/python import bluetooth import os import time from threading import Thread # @UnusedWildImport os.system("echo "+str(os.getpid())+">>.tmp") address_list = ["00:14:35:00:17:DC", "11:11:11:11:11:11"] target_address = None sendComanndNow = False port = 3 def sendComannd(command): """Mé...
# https://leetcode.com/problems/minimum-swaps-to-make-strings-equal/ class Solution: def minimumSwap(self, s1: str, s2: str) -> int: if len(s1) != len(s2): return -1 s1_x = s1.count('x') s2_x = s2.count('x') if (s1_x + s2_x) % 2 == 1: return -1 x = ...
import os import sys import cPickle from string import Template # # read Tina's b efficiency variations for msugra on heplx* and assemble # them in one pickle file # # # get effect of scale factor (defined as SF1 / SF0) # if necessary : sum over b-tag bins # def getFactor (dic,signal,btags): norm_sf0 = 0. no...
from matplotlib import pyplot as plt # 支持中文 plt.rcParams['font.sans-serif'] = ['Microsoft YaHei'] # 用来正常显示中文标签 plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号 x_values = [x for x in range(-100, 100)] y_values = [x ** 2 for x in x_values] # 设置style: plt.style.available plt.style.use('ggplot') fig, ax = plt.s...
"""pandemic URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-base...
from __future__ import absolute_import from .classification import ResNet20V2ASKC, ResNet50_v1bASKC, ResNextASKC, ResNet110V2ASKC, CIFARResNextASKC
from _20180425 import * def output_20180425(): # except_sentence.except_output() # about_dim.dim_output() # sort_alg.sort_output() # q_fibonacci.q_fibonacci_output() # about_set.set_output() # dictionary.dictionary_output() tuple.tuple_output()
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# Software Name: MOON # Version: 5.4 # SPDX-FileCopyrightText: Copyright (c) 2018-2020 Orange and its contributors # SPDX-License-Identifier: Apache-2.0 # This software is distributed under the 'Apache License 2.0', # the text of which is available at 'http://www.apache.org/licenses/LICENSE-2.0.txt' # or see the "LI...
"""Utilities for loading raw data""" import struct import numpy as np from PIL import Image, ImageEnhance # Specify the path to the ETL character database files ETL_PATH = 'ETLC' def read_record(database, f): """Load image from ETL binary Args: database (string): 'ETL8B2' or 'ETL1C'. Read the ETL ...
# Generated by Django 3.0.8 on 2020-07-24 18:22 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Customer', fields=[ ...
#!/usr/bin/env python3 # Animation: https://imgur.com/a/nyVEK2j DAY_NUM = 5 DAY_DESC = 'Day 5: Supply Stacks' class TrackableLetter: def __init__(self, value, letter_id): self.value = value self.letter_id = letter_id def __str__(self): return self.value def calc(log, values, mode, d...
import functools import logging import h5py import numpy as np import pandas as pd import torch from dcase_util.data import ProbabilityEncoder from genericpath import exists from scipy.signal import medfilt from torch.utils.data import DataLoader, Dataset from evaluation_measures import ConfusionMatrix, compute_metri...
# -*- coding: utf-8 -*- """ Created on Thu Aug 8 14:33:16 2019 @author: Lee """ import numpy as np SRM_Kernels = np.load('SRM_Kernels.npy') print(SRM_Kernels[:1])
################################################################ # pp.client-plone # (C) 2013, ZOPYX Limited, D-72074 Tuebingen, Germany ################################################################ from zope.interface import Interface from zope import schema from pp.client.plone.i18n import MessageFactory as _ ...
import sys from PIL import Image # Helper Functions # def region3x3 (img, x, y): C = getpixel(img, x, y) NW = getpixel(img, x-1, y-1) N = getpixel(img, x, y-1) NE = getpixel(img, x+1, y-1) E = getpixel(img, x+1, y) SE = getpixel(img, x+1, y+1) S = getpixel(img, x, y+1) SW = getpixel(img, x-1, y+1) W = getpixe...
class Solution: def minDistance(self, word1, word2): """ :type word1: str :type word2: str :rtype: int """ if len(word1) < len(word2): word1, word2 = word2, word1 lw1 = len(word1) lw2 = len(word2) opt = list(range(1+lw2)) i...
#!/usr/bin/env python3 from QuantumCircuits import QuantumPrograms from qiskit import QuantumProgram from QConfig import QConfig from SignalUtils import tryExecuteWithTimeout import CsvDataWriter from random import randint import time import sys def setup_quantum_program(): timeout = 210 # 3.5 minutes # timeo...
# Generated by Django 3.0.3 on 2020-03-01 20:42 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('core', '0010_maintasks'), ] operations = [ migrations.AlterField( model_name='maintasks', ...
#!/usr/bin/env python # # Author: yasser hifny # from __future__ import print_function import numpy as np np.random.seed(1337) # for reproducibility import sys import codecs from tensorflow.keras.preprocessing import sequence from tensorflow.keras.layers import Embedding, Dense, Input, LSTM, Global...
# -*- coding: utf-8 -*- """ Created on Fri Nov 29 20:18:22 2019 @author: zhuguohua """ import sympy as sp sp.init_printing(use_unicode=True) # 车辆参数 m,I_z,l_f,l_r,C_alpha_f,C_alpha_r,V_x,R,delta_ff = sp.symbols('m I_z l_f l_r C_alpha_f C_alpha_r V_x R delta_ff') k1,k2,k3,k4 = sp.symbols('k1 k2 k3 k4') s = sp.symbol...
from avx.devices.net import TCPDevice class Tivo(TCPDevice): ''' A networked TiVo device. Developed against Virgin Media UK's TiVo boxes. ''' socket = None def __init__(self, deviceID, ipAddress, port=31339, **kwargs): super(Tivo, self).__init__(deviceID, ipAddress, port, **kwargs) ...